muon-ui 0.26.0 → 0.26.47
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/README.md +5 -0
- package/android.d.ts +4 -4
- package/dist/android/lib/index.cjs +13 -10
- package/dist/android/lib/index.cjs.map +1 -1
- package/dist/android/lib/index.mjs +14 -11
- package/dist/android/lib/index.mjs.map +1 -1
- package/dist/android/maven/dev/muon/runtime/0.1.0/runtime-0.1.0.aar +0 -0
- package/dist/android/maven/dev/muon/runtime/0.1.0/runtime-0.1.0.aar.md5 +1 -1
- package/dist/android/maven/dev/muon/runtime/0.1.0/runtime-0.1.0.aar.sha1 +1 -1
- package/dist/android/maven/dev/muon/runtime/0.1.0/runtime-0.1.0.aar.sha256 +1 -1
- package/dist/android/maven/dev/muon/runtime/0.1.0/runtime-0.1.0.aar.sha512 +1 -1
- package/dist/android/maven/dev/muon/runtime/0.1.0/runtime-0.1.0.module +10 -10
- package/dist/android/maven/dev/muon/runtime/0.1.0/runtime-0.1.0.module.md5 +1 -1
- package/dist/android/maven/dev/muon/runtime/0.1.0/runtime-0.1.0.module.sha1 +1 -1
- package/dist/android/maven/dev/muon/runtime/0.1.0/runtime-0.1.0.module.sha256 +1 -1
- package/dist/android/maven/dev/muon/runtime/0.1.0/runtime-0.1.0.module.sha512 +1 -1
- package/dist/android/maven/dev/muon/runtime/maven-metadata.xml +1 -1
- package/dist/android/maven/dev/muon/runtime/maven-metadata.xml.md5 +1 -1
- package/dist/android/maven/dev/muon/runtime/maven-metadata.xml.sha1 +1 -1
- package/dist/android/maven/dev/muon/runtime/maven-metadata.xml.sha256 +1 -1
- package/dist/android/maven/dev/muon/runtime/maven-metadata.xml.sha512 +1 -1
- package/dist/android/renderer/renderer.js +41 -14
- package/dist/android/renderer/renderer.js.map +1 -1
- package/dist/cli.cjs +82 -56
- package/dist/cli.cjs.map +1 -1
- package/dist/index.cjs +2 -2
- package/dist/index.mjs +2 -2
- package/dist/native/linux-amd64/muon-builder +0 -0
- package/dist/native/linux-amd64/muon-launcher +0 -0
- package/dist/native/linux-amd64/muon-runtime-helper +0 -0
- package/dist/native/linux-arm64/muon-builder +0 -0
- package/dist/native/linux-arm64/muon-launcher +0 -0
- package/dist/native/linux-arm64/muon-runtime-helper +0 -0
- package/dist/native/linux-armhf/muon-builder +0 -0
- package/dist/native/linux-armhf/muon-launcher +0 -0
- package/dist/native/linux-armhf/muon-runtime-helper +0 -0
- package/dist/native/windows-amd64/muon-builder.exe +0 -0
- package/dist/native/windows-amd64/muon-launcher.exe +0 -0
- package/dist/native/windows-amd64/muon-plugin-inspector.exe +0 -0
- package/dist/native/windows-i686/muon-builder.exe +0 -0
- package/dist/native/windows-i686/muon-launcher.exe +0 -0
- package/dist/native/windows-i686/muon-plugin-inspector.exe +0 -0
- package/dist/runtime/linux-amd64/libmuon-ui.so +0 -0
- package/dist/runtime/linux-amd64/muon-core +0 -0
- package/dist/runtime/linux-amd64/plugins/node-bridge.mjs +5 -5
- package/dist/runtime/linux-amd64/plugins/node.so +0 -0
- package/dist/runtime/linux-arm64/libmuon-ui.so +0 -0
- package/dist/runtime/linux-arm64/muon-core +0 -0
- package/dist/runtime/linux-arm64/plugins/node-bridge.mjs +5 -5
- package/dist/runtime/linux-arm64/plugins/node.so +0 -0
- package/dist/runtime/linux-armhf/libmuon-ui.so +0 -0
- package/dist/runtime/linux-armhf/muon-core +0 -0
- package/dist/runtime/linux-armhf/plugins/node-bridge.mjs +5 -5
- package/dist/runtime/linux-armhf/plugins/node.so +0 -0
- package/dist/runtime/windows-amd64/libcardio.dll +0 -0
- package/dist/runtime/windows-amd64/libmuon-ui.dll +0 -0
- package/dist/runtime/windows-amd64/muon-core.exe +0 -0
- package/dist/runtime/windows-amd64/plugins/node-bridge.mjs +5 -5
- package/dist/runtime/windows-amd64/plugins/node.dll +0 -0
- package/dist/runtime/windows-i686/libcardio.dll +0 -0
- package/dist/runtime/windows-i686/libmuon-ui.dll +0 -0
- package/dist/runtime/windows-i686/muon-core.exe +0 -0
- package/dist/runtime/windows-i686/plugins/node-bridge.mjs +5 -5
- package/dist/runtime/windows-i686/plugins/node.dll +0 -0
- package/dist/{vite-internals-DseKep-X.cjs → vite-internals-CueaxMaY.cjs} +4225 -1963
- package/dist/vite-internals-CueaxMaY.cjs.map +1 -0
- package/dist/vite.cjs +100 -1294
- package/dist/vite.cjs.map +1 -1
- package/dist/vite.mjs +6102 -5128
- package/dist/vite.mjs.map +1 -1
- package/images/get-started-android.png +0 -0
- package/muon-virtual-modules.d.ts +53 -0
- package/package.json +13 -13
- package/vite.d.ts +8 -0
- package/dist/vite-internals-DseKep-X.cjs.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vite-internals-CueaxMaY.cjs","names":["module","exports","defaultConfigFileNames","isJsonObject","isStringArray","getErrorMessage","fileExists","access","constants","resolve","join","readJsonObjectFile","readFile","parse","validatePluginConfig","basename","createHash","record","isAbsolute","realpath","resolve","relative","sep","dirname","readFile","randomBytes","relative","readFileSync","join","dirname","existsSync","require","createRequire","join","resolve","readFile","basename","mkdir","copyFile","spawn","access","delimiter","join","constants","resolve","readFile","dirname","homedir","mkdir","runScriptOnceToText","readFile","resolve","relative","isAbsolute","rm","cp","join","chmod","mkdir","stat","copyFile","writeFile","dirname","basename","pathToFileURL","sharp","__resolveDefaultExport","__screwUpDefaultImportModule0","readFile","mkdir","dirname","writeFile","resolveResourcePath","extname","fileExists","readFile","isAbsolute","resolve","access","constants","record","resolve","basename","readFile","readFile","resolve","createHash","resolve","join","access","dirname","rename","writeFile","rm","readFile","realpath","stat","readdir","join","resolve","relative","isAbsolute","basename","moduleDirectory","dirname","fileURLToPath","access","constants","join","spawn","defaultConfigFileNames","moduleDirectory","dirname","fileURLToPath","resolve","join","fileExists","readJsonObjectFile","resolveConfigPath","isJsonObject","readFile","getErrorMessage","parse","access","constants","isJsonObject","randomBytes","fileExists","stat","basename","dirname","join","parse","readFile","writeFile","access","cp","moduleDirectory","dirname","fileURLToPath","readJsonObjectFile","readProjectJson","createOptionsSource","resolveStringField","isJsonObject","readFile","stat","mkdtemp","join","tmpdir","writeFile","copyFile","chmod","rm","resolve","fileExists","parse","resolveResourcePath","assertIconPath","extname","isAbsolute","access","constants","moduleDirectory","dirname","fileURLToPath","isJsonObject","readFile","writeFile","join","parse","fileExists","extname","resolve","isAbsolute","access","constants","isJsonObject","isStringArray","spawn","__resolveDefaultExport","__screwUpDefaultImportModule0","readFile","getErrorMessage","isJsonObject","resolve","realpath","join","rm","mkdir","cp","assertFile","copyFile","isSameOrInsidePath","relative","isAbsolute","dirname","basename","stat","__screwUpDefaultImportModule0","resolve","isJsonObject","join","randomBytes","relative","isAbsolute","basename","rm","mkdir","chmod","copyFile","readFile","readdir","writeFile","createHash","sep","mkdtemp","tmpdir","stat","resolve","join","readFile","writeFile","isAbsolute","resolve","isAbsolute","resolve","dirname","fileURLToPath","join","mkdtemp","tmpdir","access","constants","parse","readFile","spawn","rm"],"sources":["../../node_modules/json5/dist/index.js","../common/plugin-access.ts","../../sdk/dist/artifact-DcfIPRjn.mjs","../../sdk/dist/artifact.mjs","../../core/android/function-paths.ts","../common/capability.ts","../common/native-plugins.ts","../android/command.ts","../android/toolchain.ts","../android/build.ts","../../core/android/renderer/android-config.ts","../cef/windows-icon.ts","../common/app-icon.ts","../android/plugins.ts","../android/plugin-access.ts","../android/plugin-metadata.ts","../android/signing.ts","../android/target.ts","../cef/targets.ts","../common/targets.ts","../common/progress.ts","../cef/prepare.ts","../common/build-config.ts","../cef/embed-config.ts","../cef/windows-resource.ts","../cef/linux-desktop.ts","../cef/windows-code-signing.ts","../../node_modules/semver/internal/lrucache.js","../../node_modules/semver/internal/parse-options.js","../../node_modules/semver/internal/constants.js","../../node_modules/semver/internal/debug.js","../../node_modules/semver/internal/re.js","../../node_modules/semver/internal/identifiers.js","../../node_modules/semver/classes/semver.js","../../node_modules/semver/functions/compare.js","../../node_modules/semver/functions/eq.js","../../node_modules/semver/functions/neq.js","../../node_modules/semver/functions/gt.js","../../node_modules/semver/functions/gte.js","../../node_modules/semver/functions/lt.js","../../node_modules/semver/functions/lte.js","../../node_modules/semver/functions/cmp.js","../../node_modules/semver/classes/comparator.js","../../node_modules/semver/classes/range.js","../cef/node-project.ts","../cef/build.ts","../common/build.ts","../common/gitignore.ts","../common/vite-options.ts","../common/vite-assets.ts","../common/build-sequence.ts","../cef/vite-internals.ts"],"sourcesContent":["(function (global, factory) {\n\ttypeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :\n\ttypeof define === 'function' && define.amd ? define(factory) :\n\t(global.JSON5 = factory());\n}(this, (function () { 'use strict';\n\n\tfunction createCommonjsModule(fn, module) {\n\t\treturn module = { exports: {} }, fn(module, module.exports), module.exports;\n\t}\n\n\tvar _global = createCommonjsModule(function (module) {\n\t// https://github.com/zloirock/core-js/issues/86#issuecomment-115759028\n\tvar global = module.exports = typeof window != 'undefined' && window.Math == Math\n\t ? window : typeof self != 'undefined' && self.Math == Math ? self\n\t // eslint-disable-next-line no-new-func\n\t : Function('return this')();\n\tif (typeof __g == 'number') { __g = global; } // eslint-disable-line no-undef\n\t});\n\n\tvar _core = createCommonjsModule(function (module) {\n\tvar core = module.exports = { version: '2.6.5' };\n\tif (typeof __e == 'number') { __e = core; } // eslint-disable-line no-undef\n\t});\n\tvar _core_1 = _core.version;\n\n\tvar _isObject = function (it) {\n\t return typeof it === 'object' ? it !== null : typeof it === 'function';\n\t};\n\n\tvar _anObject = function (it) {\n\t if (!_isObject(it)) { throw TypeError(it + ' is not an object!'); }\n\t return it;\n\t};\n\n\tvar _fails = function (exec) {\n\t try {\n\t return !!exec();\n\t } catch (e) {\n\t return true;\n\t }\n\t};\n\n\t// Thank's IE8 for his funny defineProperty\n\tvar _descriptors = !_fails(function () {\n\t return Object.defineProperty({}, 'a', { get: function () { return 7; } }).a != 7;\n\t});\n\n\tvar document = _global.document;\n\t// typeof document.createElement is 'object' in old IE\n\tvar is = _isObject(document) && _isObject(document.createElement);\n\tvar _domCreate = function (it) {\n\t return is ? document.createElement(it) : {};\n\t};\n\n\tvar _ie8DomDefine = !_descriptors && !_fails(function () {\n\t return Object.defineProperty(_domCreate('div'), 'a', { get: function () { return 7; } }).a != 7;\n\t});\n\n\t// 7.1.1 ToPrimitive(input [, PreferredType])\n\n\t// instead of the ES6 spec version, we didn't implement @@toPrimitive case\n\t// and the second argument - flag - preferred type is a string\n\tvar _toPrimitive = function (it, S) {\n\t if (!_isObject(it)) { return it; }\n\t var fn, val;\n\t if (S && typeof (fn = it.toString) == 'function' && !_isObject(val = fn.call(it))) { return val; }\n\t if (typeof (fn = it.valueOf) == 'function' && !_isObject(val = fn.call(it))) { return val; }\n\t if (!S && typeof (fn = it.toString) == 'function' && !_isObject(val = fn.call(it))) { return val; }\n\t throw TypeError(\"Can't convert object to primitive value\");\n\t};\n\n\tvar dP = Object.defineProperty;\n\n\tvar f = _descriptors ? Object.defineProperty : function defineProperty(O, P, Attributes) {\n\t _anObject(O);\n\t P = _toPrimitive(P, true);\n\t _anObject(Attributes);\n\t if (_ie8DomDefine) { try {\n\t return dP(O, P, Attributes);\n\t } catch (e) { /* empty */ } }\n\t if ('get' in Attributes || 'set' in Attributes) { throw TypeError('Accessors not supported!'); }\n\t if ('value' in Attributes) { O[P] = Attributes.value; }\n\t return O;\n\t};\n\n\tvar _objectDp = {\n\t\tf: f\n\t};\n\n\tvar _propertyDesc = function (bitmap, value) {\n\t return {\n\t enumerable: !(bitmap & 1),\n\t configurable: !(bitmap & 2),\n\t writable: !(bitmap & 4),\n\t value: value\n\t };\n\t};\n\n\tvar _hide = _descriptors ? function (object, key, value) {\n\t return _objectDp.f(object, key, _propertyDesc(1, value));\n\t} : function (object, key, value) {\n\t object[key] = value;\n\t return object;\n\t};\n\n\tvar hasOwnProperty = {}.hasOwnProperty;\n\tvar _has = function (it, key) {\n\t return hasOwnProperty.call(it, key);\n\t};\n\n\tvar id = 0;\n\tvar px = Math.random();\n\tvar _uid = function (key) {\n\t return 'Symbol('.concat(key === undefined ? '' : key, ')_', (++id + px).toString(36));\n\t};\n\n\tvar _library = false;\n\n\tvar _shared = createCommonjsModule(function (module) {\n\tvar SHARED = '__core-js_shared__';\n\tvar store = _global[SHARED] || (_global[SHARED] = {});\n\n\t(module.exports = function (key, value) {\n\t return store[key] || (store[key] = value !== undefined ? value : {});\n\t})('versions', []).push({\n\t version: _core.version,\n\t mode: _library ? 'pure' : 'global',\n\t copyright: '© 2019 Denis Pushkarev (zloirock.ru)'\n\t});\n\t});\n\n\tvar _functionToString = _shared('native-function-to-string', Function.toString);\n\n\tvar _redefine = createCommonjsModule(function (module) {\n\tvar SRC = _uid('src');\n\n\tvar TO_STRING = 'toString';\n\tvar TPL = ('' + _functionToString).split(TO_STRING);\n\n\t_core.inspectSource = function (it) {\n\t return _functionToString.call(it);\n\t};\n\n\t(module.exports = function (O, key, val, safe) {\n\t var isFunction = typeof val == 'function';\n\t if (isFunction) { _has(val, 'name') || _hide(val, 'name', key); }\n\t if (O[key] === val) { return; }\n\t if (isFunction) { _has(val, SRC) || _hide(val, SRC, O[key] ? '' + O[key] : TPL.join(String(key))); }\n\t if (O === _global) {\n\t O[key] = val;\n\t } else if (!safe) {\n\t delete O[key];\n\t _hide(O, key, val);\n\t } else if (O[key]) {\n\t O[key] = val;\n\t } else {\n\t _hide(O, key, val);\n\t }\n\t// add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative\n\t})(Function.prototype, TO_STRING, function toString() {\n\t return typeof this == 'function' && this[SRC] || _functionToString.call(this);\n\t});\n\t});\n\n\tvar _aFunction = function (it) {\n\t if (typeof it != 'function') { throw TypeError(it + ' is not a function!'); }\n\t return it;\n\t};\n\n\t// optional / simple context binding\n\n\tvar _ctx = function (fn, that, length) {\n\t _aFunction(fn);\n\t if (that === undefined) { return fn; }\n\t switch (length) {\n\t case 1: return function (a) {\n\t return fn.call(that, a);\n\t };\n\t case 2: return function (a, b) {\n\t return fn.call(that, a, b);\n\t };\n\t case 3: return function (a, b, c) {\n\t return fn.call(that, a, b, c);\n\t };\n\t }\n\t return function (/* ...args */) {\n\t return fn.apply(that, arguments);\n\t };\n\t};\n\n\tvar PROTOTYPE = 'prototype';\n\n\tvar $export = function (type, name, source) {\n\t var IS_FORCED = type & $export.F;\n\t var IS_GLOBAL = type & $export.G;\n\t var IS_STATIC = type & $export.S;\n\t var IS_PROTO = type & $export.P;\n\t var IS_BIND = type & $export.B;\n\t var target = IS_GLOBAL ? _global : IS_STATIC ? _global[name] || (_global[name] = {}) : (_global[name] || {})[PROTOTYPE];\n\t var exports = IS_GLOBAL ? _core : _core[name] || (_core[name] = {});\n\t var expProto = exports[PROTOTYPE] || (exports[PROTOTYPE] = {});\n\t var key, own, out, exp;\n\t if (IS_GLOBAL) { source = name; }\n\t for (key in source) {\n\t // contains in native\n\t own = !IS_FORCED && target && target[key] !== undefined;\n\t // export native or passed\n\t out = (own ? target : source)[key];\n\t // bind timers to global for call from export context\n\t exp = IS_BIND && own ? _ctx(out, _global) : IS_PROTO && typeof out == 'function' ? _ctx(Function.call, out) : out;\n\t // extend global\n\t if (target) { _redefine(target, key, out, type & $export.U); }\n\t // export\n\t if (exports[key] != out) { _hide(exports, key, exp); }\n\t if (IS_PROTO && expProto[key] != out) { expProto[key] = out; }\n\t }\n\t};\n\t_global.core = _core;\n\t// type bitmap\n\t$export.F = 1; // forced\n\t$export.G = 2; // global\n\t$export.S = 4; // static\n\t$export.P = 8; // proto\n\t$export.B = 16; // bind\n\t$export.W = 32; // wrap\n\t$export.U = 64; // safe\n\t$export.R = 128; // real proto method for `library`\n\tvar _export = $export;\n\n\t// 7.1.4 ToInteger\n\tvar ceil = Math.ceil;\n\tvar floor = Math.floor;\n\tvar _toInteger = function (it) {\n\t return isNaN(it = +it) ? 0 : (it > 0 ? floor : ceil)(it);\n\t};\n\n\t// 7.2.1 RequireObjectCoercible(argument)\n\tvar _defined = function (it) {\n\t if (it == undefined) { throw TypeError(\"Can't call method on \" + it); }\n\t return it;\n\t};\n\n\t// true -> String#at\n\t// false -> String#codePointAt\n\tvar _stringAt = function (TO_STRING) {\n\t return function (that, pos) {\n\t var s = String(_defined(that));\n\t var i = _toInteger(pos);\n\t var l = s.length;\n\t var a, b;\n\t if (i < 0 || i >= l) { return TO_STRING ? '' : undefined; }\n\t a = s.charCodeAt(i);\n\t return a < 0xd800 || a > 0xdbff || i + 1 === l || (b = s.charCodeAt(i + 1)) < 0xdc00 || b > 0xdfff\n\t ? TO_STRING ? s.charAt(i) : a\n\t : TO_STRING ? s.slice(i, i + 2) : (a - 0xd800 << 10) + (b - 0xdc00) + 0x10000;\n\t };\n\t};\n\n\tvar $at = _stringAt(false);\n\t_export(_export.P, 'String', {\n\t // 21.1.3.3 String.prototype.codePointAt(pos)\n\t codePointAt: function codePointAt(pos) {\n\t return $at(this, pos);\n\t }\n\t});\n\n\tvar codePointAt = _core.String.codePointAt;\n\n\tvar max = Math.max;\n\tvar min = Math.min;\n\tvar _toAbsoluteIndex = function (index, length) {\n\t index = _toInteger(index);\n\t return index < 0 ? max(index + length, 0) : min(index, length);\n\t};\n\n\tvar fromCharCode = String.fromCharCode;\n\tvar $fromCodePoint = String.fromCodePoint;\n\n\t// length should be 1, old FF problem\n\t_export(_export.S + _export.F * (!!$fromCodePoint && $fromCodePoint.length != 1), 'String', {\n\t // 21.1.2.2 String.fromCodePoint(...codePoints)\n\t fromCodePoint: function fromCodePoint(x) {\n\t var arguments$1 = arguments;\n\t // eslint-disable-line no-unused-vars\n\t var res = [];\n\t var aLen = arguments.length;\n\t var i = 0;\n\t var code;\n\t while (aLen > i) {\n\t code = +arguments$1[i++];\n\t if (_toAbsoluteIndex(code, 0x10ffff) !== code) { throw RangeError(code + ' is not a valid code point'); }\n\t res.push(code < 0x10000\n\t ? fromCharCode(code)\n\t : fromCharCode(((code -= 0x10000) >> 10) + 0xd800, code % 0x400 + 0xdc00)\n\t );\n\t } return res.join('');\n\t }\n\t});\n\n\tvar fromCodePoint = _core.String.fromCodePoint;\n\n\t// This is a generated file. Do not edit.\n\tvar Space_Separator = /[\\u1680\\u2000-\\u200A\\u202F\\u205F\\u3000]/;\n\tvar ID_Start = /[\\xAA\\xB5\\xBA\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0370-\\u0374\\u0376\\u0377\\u037A-\\u037D\\u037F\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5\\u03F7-\\u0481\\u048A-\\u052F\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u05D0-\\u05EA\\u05F0-\\u05F2\\u0620-\\u064A\\u066E\\u066F\\u0671-\\u06D3\\u06D5\\u06E5\\u06E6\\u06EE\\u06EF\\u06FA-\\u06FC\\u06FF\\u0710\\u0712-\\u072F\\u074D-\\u07A5\\u07B1\\u07CA-\\u07EA\\u07F4\\u07F5\\u07FA\\u0800-\\u0815\\u081A\\u0824\\u0828\\u0840-\\u0858\\u0860-\\u086A\\u08A0-\\u08B4\\u08B6-\\u08BD\\u0904-\\u0939\\u093D\\u0950\\u0958-\\u0961\\u0971-\\u0980\\u0985-\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BD\\u09CE\\u09DC\\u09DD\\u09DF-\\u09E1\\u09F0\\u09F1\\u09FC\\u0A05-\\u0A0A\\u0A0F\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32\\u0A33\\u0A35\\u0A36\\u0A38\\u0A39\\u0A59-\\u0A5C\\u0A5E\\u0A72-\\u0A74\\u0A85-\\u0A8D\\u0A8F-\\u0A91\\u0A93-\\u0AA8\\u0AAA-\\u0AB0\\u0AB2\\u0AB3\\u0AB5-\\u0AB9\\u0ABD\\u0AD0\\u0AE0\\u0AE1\\u0AF9\\u0B05-\\u0B0C\\u0B0F\\u0B10\\u0B13-\\u0B28\\u0B2A-\\u0B30\\u0B32\\u0B33\\u0B35-\\u0B39\\u0B3D\\u0B5C\\u0B5D\\u0B5F-\\u0B61\\u0B71\\u0B83\\u0B85-\\u0B8A\\u0B8E-\\u0B90\\u0B92-\\u0B95\\u0B99\\u0B9A\\u0B9C\\u0B9E\\u0B9F\\u0BA3\\u0BA4\\u0BA8-\\u0BAA\\u0BAE-\\u0BB9\\u0BD0\\u0C05-\\u0C0C\\u0C0E-\\u0C10\\u0C12-\\u0C28\\u0C2A-\\u0C39\\u0C3D\\u0C58-\\u0C5A\\u0C60\\u0C61\\u0C80\\u0C85-\\u0C8C\\u0C8E-\\u0C90\\u0C92-\\u0CA8\\u0CAA-\\u0CB3\\u0CB5-\\u0CB9\\u0CBD\\u0CDE\\u0CE0\\u0CE1\\u0CF1\\u0CF2\\u0D05-\\u0D0C\\u0D0E-\\u0D10\\u0D12-\\u0D3A\\u0D3D\\u0D4E\\u0D54-\\u0D56\\u0D5F-\\u0D61\\u0D7A-\\u0D7F\\u0D85-\\u0D96\\u0D9A-\\u0DB1\\u0DB3-\\u0DBB\\u0DBD\\u0DC0-\\u0DC6\\u0E01-\\u0E30\\u0E32\\u0E33\\u0E40-\\u0E46\\u0E81\\u0E82\\u0E84\\u0E87\\u0E88\\u0E8A\\u0E8D\\u0E94-\\u0E97\\u0E99-\\u0E9F\\u0EA1-\\u0EA3\\u0EA5\\u0EA7\\u0EAA\\u0EAB\\u0EAD-\\u0EB0\\u0EB2\\u0EB3\\u0EBD\\u0EC0-\\u0EC4\\u0EC6\\u0EDC-\\u0EDF\\u0F00\\u0F40-\\u0F47\\u0F49-\\u0F6C\\u0F88-\\u0F8C\\u1000-\\u102A\\u103F\\u1050-\\u1055\\u105A-\\u105D\\u1061\\u1065\\u1066\\u106E-\\u1070\\u1075-\\u1081\\u108E\\u10A0-\\u10C5\\u10C7\\u10CD\\u10D0-\\u10FA\\u10FC-\\u1248\\u124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u1380-\\u138F\\u13A0-\\u13F5\\u13F8-\\u13FD\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u16EE-\\u16F8\\u1700-\\u170C\\u170E-\\u1711\\u1720-\\u1731\\u1740-\\u1751\\u1760-\\u176C\\u176E-\\u1770\\u1780-\\u17B3\\u17D7\\u17DC\\u1820-\\u1877\\u1880-\\u1884\\u1887-\\u18A8\\u18AA\\u18B0-\\u18F5\\u1900-\\u191E\\u1950-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19B0-\\u19C9\\u1A00-\\u1A16\\u1A20-\\u1A54\\u1AA7\\u1B05-\\u1B33\\u1B45-\\u1B4B\\u1B83-\\u1BA0\\u1BAE\\u1BAF\\u1BBA-\\u1BE5\\u1C00-\\u1C23\\u1C4D-\\u1C4F\\u1C5A-\\u1C7D\\u1C80-\\u1C88\\u1CE9-\\u1CEC\\u1CEE-\\u1CF1\\u1CF5\\u1CF6\\u1D00-\\u1DBF\\u1E00-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u2071\\u207F\\u2090-\\u209C\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u212D\\u212F-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2160-\\u2188\\u2C00-\\u2C2E\\u2C30-\\u2C5E\\u2C60-\\u2CE4\\u2CEB-\\u2CEE\\u2CF2\\u2CF3\\u2D00-\\u2D25\\u2D27\\u2D2D\\u2D30-\\u2D67\\u2D6F\\u2D80-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u2E2F\\u3005-\\u3007\\u3021-\\u3029\\u3031-\\u3035\\u3038-\\u303C\\u3041-\\u3096\\u309D-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312E\\u3131-\\u318E\\u31A0-\\u31BA\\u31F0-\\u31FF\\u3400-\\u4DB5\\u4E00-\\u9FEA\\uA000-\\uA48C\\uA4D0-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA61F\\uA62A\\uA62B\\uA640-\\uA66E\\uA67F-\\uA69D\\uA6A0-\\uA6EF\\uA717-\\uA71F\\uA722-\\uA788\\uA78B-\\uA7AE\\uA7B0-\\uA7B7\\uA7F7-\\uA801\\uA803-\\uA805\\uA807-\\uA80A\\uA80C-\\uA822\\uA840-\\uA873\\uA882-\\uA8B3\\uA8F2-\\uA8F7\\uA8FB\\uA8FD\\uA90A-\\uA925\\uA930-\\uA946\\uA960-\\uA97C\\uA984-\\uA9B2\\uA9CF\\uA9E0-\\uA9E4\\uA9E6-\\uA9EF\\uA9FA-\\uA9FE\\uAA00-\\uAA28\\uAA40-\\uAA42\\uAA44-\\uAA4B\\uAA60-\\uAA76\\uAA7A\\uAA7E-\\uAAAF\\uAAB1\\uAAB5\\uAAB6\\uAAB9-\\uAABD\\uAAC0\\uAAC2\\uAADB-\\uAADD\\uAAE0-\\uAAEA\\uAAF2-\\uAAF4\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E\\uAB30-\\uAB5A\\uAB5C-\\uAB65\\uAB70-\\uABE2\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\uDEE4\\uDF00-\\uDF35\\uDF40-\\uDF55\\uDF60-\\uDF72\\uDF80-\\uDF91]|\\uD803[\\uDC00-\\uDC48\\uDC80-\\uDCB2\\uDCC0-\\uDCF2]|\\uD804[\\uDC03-\\uDC37\\uDC83-\\uDCAF\\uDCD0-\\uDCE8\\uDD03-\\uDD26\\uDD50-\\uDD72\\uDD76\\uDD83-\\uDDB2\\uDDC1-\\uDDC4\\uDDDA\\uDDDC\\uDE00-\\uDE11\\uDE13-\\uDE2B\\uDE80-\\uDE86\\uDE88\\uDE8A-\\uDE8D\\uDE8F-\\uDE9D\\uDE9F-\\uDEA8\\uDEB0-\\uDEDE\\uDF05-\\uDF0C\\uDF0F\\uDF10\\uDF13-\\uDF28\\uDF2A-\\uDF30\\uDF32\\uDF33\\uDF35-\\uDF39\\uDF3D\\uDF50\\uDF5D-\\uDF61]|\\uD805[\\uDC00-\\uDC34\\uDC47-\\uDC4A\\uDC80-\\uDCAF\\uDCC4\\uDCC5\\uDCC7\\uDD80-\\uDDAE\\uDDD8-\\uDDDB\\uDE00-\\uDE2F\\uDE44\\uDE80-\\uDEAA\\uDF00-\\uDF19]|\\uD806[\\uDCA0-\\uDCDF\\uDCFF\\uDE00\\uDE0B-\\uDE32\\uDE3A\\uDE50\\uDE5C-\\uDE83\\uDE86-\\uDE89\\uDEC0-\\uDEF8]|\\uD807[\\uDC00-\\uDC08\\uDC0A-\\uDC2E\\uDC40\\uDC72-\\uDC8F\\uDD00-\\uDD06\\uDD08\\uDD09\\uDD0B-\\uDD30\\uDD46]|\\uD808[\\uDC00-\\uDF99]|\\uD809[\\uDC00-\\uDC6E\\uDC80-\\uDD43]|[\\uD80C\\uD81C-\\uD820\\uD840-\\uD868\\uD86A-\\uD86C\\uD86F-\\uD872\\uD874-\\uD879][\\uDC00-\\uDFFF]|\\uD80D[\\uDC00-\\uDC2E]|\\uD811[\\uDC00-\\uDE46]|\\uD81A[\\uDC00-\\uDE38\\uDE40-\\uDE5E\\uDED0-\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DEA5-\\uDEA9\\uDEAB-\\uDEBB]|\\uD869[\\uDC00-\\uDED6\\uDF00-\\uDFFF]|\\uD86D[\\uDC00-\\uDF34\\uDF40-\\uDFFF]|\\uD86E[\\uDC00-\\uDC1D\\uDC20-\\uDFFF]|\\uD873[\\uDC00-\\uDEA1\\uDEB0-\\uDFFF]|\\uD87A[\\uDC00-\\uDFE0]|\\uD87E[\\uDC00-\\uDE1D]/;\n\tvar ID_Continue = /[\\xAA\\xB5\\xBA\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0300-\\u0374\\u0376\\u0377\\u037A-\\u037D\\u037F\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5\\u03F7-\\u0481\\u0483-\\u0487\\u048A-\\u052F\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u0591-\\u05BD\\u05BF\\u05C1\\u05C2\\u05C4\\u05C5\\u05C7\\u05D0-\\u05EA\\u05F0-\\u05F2\\u0610-\\u061A\\u0620-\\u0669\\u066E-\\u06D3\\u06D5-\\u06DC\\u06DF-\\u06E8\\u06EA-\\u06FC\\u06FF\\u0710-\\u074A\\u074D-\\u07B1\\u07C0-\\u07F5\\u07FA\\u0800-\\u082D\\u0840-\\u085B\\u0860-\\u086A\\u08A0-\\u08B4\\u08B6-\\u08BD\\u08D4-\\u08E1\\u08E3-\\u0963\\u0966-\\u096F\\u0971-\\u0983\\u0985-\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BC-\\u09C4\\u09C7\\u09C8\\u09CB-\\u09CE\\u09D7\\u09DC\\u09DD\\u09DF-\\u09E3\\u09E6-\\u09F1\\u09FC\\u0A01-\\u0A03\\u0A05-\\u0A0A\\u0A0F\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32\\u0A33\\u0A35\\u0A36\\u0A38\\u0A39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EF\\u0CF1\\u0CF2\\u0D00-\\u0D03\\u0D05-\\u0D0C\\u0D0E-\\u0D10\\u0D12-\\u0D44\\u0D46-\\u0D48\\u0D4A-\\u0D4E\\u0D54-\\u0D57\\u0D5F-\\u0D63\\u0D66-\\u0D6F\\u0D7A-\\u0D7F\\u0D82\\u0D83\\u0D85-\\u0D96\\u0D9A-\\u0DB1\\u0DB3-\\u0DBB\\u0DBD\\u0DC0-\\u0DC6\\u0DCA\\u0DCF-\\u0DD4\\u0DD6\\u0DD8-\\u0DDF\\u0DE6-\\u0DEF\\u0DF2\\u0DF3\\u0E01-\\u0E3A\\u0E40-\\u0E4E\\u0E50-\\u0E59\\u0E81\\u0E82\\u0E84\\u0E87\\u0E88\\u0E8A\\u0E8D\\u0E94-\\u0E97\\u0E99-\\u0E9F\\u0EA1-\\u0EA3\\u0EA5\\u0EA7\\u0EAA\\u0EAB\\u0EAD-\\u0EB9\\u0EBB-\\u0EBD\\u0EC0-\\u0EC4\\u0EC6\\u0EC8-\\u0ECD\\u0ED0-\\u0ED9\\u0EDC-\\u0EDF\\u0F00\\u0F18\\u0F19\\u0F20-\\u0F29\\u0F35\\u0F37\\u0F39\\u0F3E-\\u0F47\\u0F49-\\u0F6C\\u0F71-\\u0F84\\u0F86-\\u0F97\\u0F99-\\u0FBC\\u0FC6\\u1000-\\u1049\\u1050-\\u109D\\u10A0-\\u10C5\\u10C7\\u10CD\\u10D0-\\u10FA\\u10FC-\\u1248\\u124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u135D-\\u135F\\u1380-\\u138F\\u13A0-\\u13F5\\u13F8-\\u13FD\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u16EE-\\u16F8\\u1700-\\u170C\\u170E-\\u1714\\u1720-\\u1734\\u1740-\\u1753\\u1760-\\u176C\\u176E-\\u1770\\u1772\\u1773\\u1780-\\u17D3\\u17D7\\u17DC\\u17DD\\u17E0-\\u17E9\\u180B-\\u180D\\u1810-\\u1819\\u1820-\\u1877\\u1880-\\u18AA\\u18B0-\\u18F5\\u1900-\\u191E\\u1920-\\u192B\\u1930-\\u193B\\u1946-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19B0-\\u19C9\\u19D0-\\u19D9\\u1A00-\\u1A1B\\u1A20-\\u1A5E\\u1A60-\\u1A7C\\u1A7F-\\u1A89\\u1A90-\\u1A99\\u1AA7\\u1AB0-\\u1ABD\\u1B00-\\u1B4B\\u1B50-\\u1B59\\u1B6B-\\u1B73\\u1B80-\\u1BF3\\u1C00-\\u1C37\\u1C40-\\u1C49\\u1C4D-\\u1C7D\\u1C80-\\u1C88\\u1CD0-\\u1CD2\\u1CD4-\\u1CF9\\u1D00-\\u1DF9\\u1DFB-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u203F\\u2040\\u2054\\u2071\\u207F\\u2090-\\u209C\\u20D0-\\u20DC\\u20E1\\u20E5-\\u20F0\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u212D\\u212F-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2160-\\u2188\\u2C00-\\u2C2E\\u2C30-\\u2C5E\\u2C60-\\u2CE4\\u2CEB-\\u2CF3\\u2D00-\\u2D25\\u2D27\\u2D2D\\u2D30-\\u2D67\\u2D6F\\u2D7F-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u2DE0-\\u2DFF\\u2E2F\\u3005-\\u3007\\u3021-\\u302F\\u3031-\\u3035\\u3038-\\u303C\\u3041-\\u3096\\u3099\\u309A\\u309D-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312E\\u3131-\\u318E\\u31A0-\\u31BA\\u31F0-\\u31FF\\u3400-\\u4DB5\\u4E00-\\u9FEA\\uA000-\\uA48C\\uA4D0-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA62B\\uA640-\\uA66F\\uA674-\\uA67D\\uA67F-\\uA6F1\\uA717-\\uA71F\\uA722-\\uA788\\uA78B-\\uA7AE\\uA7B0-\\uA7B7\\uA7F7-\\uA827\\uA840-\\uA873\\uA880-\\uA8C5\\uA8D0-\\uA8D9\\uA8E0-\\uA8F7\\uA8FB\\uA8FD\\uA900-\\uA92D\\uA930-\\uA953\\uA960-\\uA97C\\uA980-\\uA9C0\\uA9CF-\\uA9D9\\uA9E0-\\uA9FE\\uAA00-\\uAA36\\uAA40-\\uAA4D\\uAA50-\\uAA59\\uAA60-\\uAA76\\uAA7A-\\uAAC2\\uAADB-\\uAADD\\uAAE0-\\uAAEF\\uAAF2-\\uAAF6\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E\\uAB30-\\uAB5A\\uAB5C-\\uAB65\\uAB70-\\uABEA\\uABEC\\uABED\\uABF0-\\uABF9\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFA6D\\uFA70-\\uFAD9\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFB1D-\\uFB28\\uFB2A-\\uFB36\\uFB38-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DEFC-\\uDF14\\uDF16-\\uDF34\\uDF36-\\uDF4E\\uDF50-\\uDF6E\\uDF70-\\uDF88\\uDF8A-\\uDFA8\\uDFAA-\\uDFC2\\uDFC4-\\uDFCB\\uDFCE-\\uDFFF]|\\uD836[\\uDE00-\\uDE36\\uDE3B-\\uDE6C\\uDE75\\uDE84\\uDE9B-\\uDE9F\\uDEA1-\\uDEAF]|\\uD838[\\uDC00-\\uDC06\\uDC08-\\uDC18\\uDC1B-\\uDC21\\uDC23\\uDC24\\uDC26-\\uDC2A]|\\uD83A[\\uDC00-\\uDCC4\\uDCD0-\\uDCD6\\uDD00-\\uDD4A\\uDD50-\\uDD59]|\\uD83B[\\uDE00-\\uDE03\\uDE05-\\uDE1F\\uDE21\\uDE22\\uDE24\\uDE27\\uDE29-\\uDE32\\uDE34-\\uDE37\\uDE39\\uDE3B\\uDE42\\uDE47\\uDE49\\uDE4B\\uDE4D-\\uDE4F\\uDE51\\uDE52\\uDE54\\uDE57\\uDE59\\uDE5B\\uDE5D\\uDE5F\\uDE61\\uDE62\\uDE64\\uDE67-\\uDE6A\\uDE6C-\\uDE72\\uDE74-\\uDE77\\uDE79-\\uDE7C\\uDE7E\\uDE80-\\uDE89\\uDE8B-\\uDE9B\\uDEA1-\\uDEA3\\uDEA5-\\uDEA9\\uDEAB-\\uDEBB]|\\uD869[\\uDC00-\\uDED6\\uDF00-\\uDFFF]|\\uD86D[\\uDC00-\\uDF34\\uDF40-\\uDFFF]|\\uD86E[\\uDC00-\\uDC1D\\uDC20-\\uDFFF]|\\uD873[\\uDC00-\\uDEA1\\uDEB0-\\uDFFF]|\\uD87A[\\uDC00-\\uDFE0]|\\uD87E[\\uDC00-\\uDE1D]|\\uDB40[\\uDD00-\\uDDEF]/;\n\n\tvar unicode = {\n\t\tSpace_Separator: Space_Separator,\n\t\tID_Start: ID_Start,\n\t\tID_Continue: ID_Continue\n\t};\n\n\tvar util = {\n\t isSpaceSeparator: function isSpaceSeparator (c) {\n\t return typeof c === 'string' && unicode.Space_Separator.test(c)\n\t },\n\n\t isIdStartChar: function isIdStartChar (c) {\n\t return typeof c === 'string' && (\n\t (c >= 'a' && c <= 'z') ||\n\t (c >= 'A' && c <= 'Z') ||\n\t (c === '$') || (c === '_') ||\n\t unicode.ID_Start.test(c)\n\t )\n\t },\n\n\t isIdContinueChar: function isIdContinueChar (c) {\n\t return typeof c === 'string' && (\n\t (c >= 'a' && c <= 'z') ||\n\t (c >= 'A' && c <= 'Z') ||\n\t (c >= '0' && c <= '9') ||\n\t (c === '$') || (c === '_') ||\n\t (c === '\\u200C') || (c === '\\u200D') ||\n\t unicode.ID_Continue.test(c)\n\t )\n\t },\n\n\t isDigit: function isDigit (c) {\n\t return typeof c === 'string' && /[0-9]/.test(c)\n\t },\n\n\t isHexDigit: function isHexDigit (c) {\n\t return typeof c === 'string' && /[0-9A-Fa-f]/.test(c)\n\t },\n\t};\n\n\tvar source;\n\tvar parseState;\n\tvar stack;\n\tvar pos;\n\tvar line;\n\tvar column;\n\tvar token;\n\tvar key;\n\tvar root;\n\n\tvar parse = function parse (text, reviver) {\n\t source = String(text);\n\t parseState = 'start';\n\t stack = [];\n\t pos = 0;\n\t line = 1;\n\t column = 0;\n\t token = undefined;\n\t key = undefined;\n\t root = undefined;\n\n\t do {\n\t token = lex();\n\n\t // This code is unreachable.\n\t // if (!parseStates[parseState]) {\n\t // throw invalidParseState()\n\t // }\n\n\t parseStates[parseState]();\n\t } while (token.type !== 'eof')\n\n\t if (typeof reviver === 'function') {\n\t return internalize({'': root}, '', reviver)\n\t }\n\n\t return root\n\t};\n\n\tfunction internalize (holder, name, reviver) {\n\t var value = holder[name];\n\t if (value != null && typeof value === 'object') {\n\t if (Array.isArray(value)) {\n\t for (var i = 0; i < value.length; i++) {\n\t var key = String(i);\n\t var replacement = internalize(value, key, reviver);\n\t if (replacement === undefined) {\n\t delete value[key];\n\t } else {\n\t Object.defineProperty(value, key, {\n\t value: replacement,\n\t writable: true,\n\t enumerable: true,\n\t configurable: true,\n\t });\n\t }\n\t }\n\t } else {\n\t for (var key$1 in value) {\n\t var replacement$1 = internalize(value, key$1, reviver);\n\t if (replacement$1 === undefined) {\n\t delete value[key$1];\n\t } else {\n\t Object.defineProperty(value, key$1, {\n\t value: replacement$1,\n\t writable: true,\n\t enumerable: true,\n\t configurable: true,\n\t });\n\t }\n\t }\n\t }\n\t }\n\n\t return reviver.call(holder, name, value)\n\t}\n\n\tvar lexState;\n\tvar buffer;\n\tvar doubleQuote;\n\tvar sign;\n\tvar c;\n\n\tfunction lex () {\n\t lexState = 'default';\n\t buffer = '';\n\t doubleQuote = false;\n\t sign = 1;\n\n\t for (;;) {\n\t c = peek();\n\n\t // This code is unreachable.\n\t // if (!lexStates[lexState]) {\n\t // throw invalidLexState(lexState)\n\t // }\n\n\t var token = lexStates[lexState]();\n\t if (token) {\n\t return token\n\t }\n\t }\n\t}\n\n\tfunction peek () {\n\t if (source[pos]) {\n\t return String.fromCodePoint(source.codePointAt(pos))\n\t }\n\t}\n\n\tfunction read () {\n\t var c = peek();\n\n\t if (c === '\\n') {\n\t line++;\n\t column = 0;\n\t } else if (c) {\n\t column += c.length;\n\t } else {\n\t column++;\n\t }\n\n\t if (c) {\n\t pos += c.length;\n\t }\n\n\t return c\n\t}\n\n\tvar lexStates = {\n\t default: function default$1 () {\n\t switch (c) {\n\t case '\\t':\n\t case '\\v':\n\t case '\\f':\n\t case ' ':\n\t case '\\u00A0':\n\t case '\\uFEFF':\n\t case '\\n':\n\t case '\\r':\n\t case '\\u2028':\n\t case '\\u2029':\n\t read();\n\t return\n\n\t case '/':\n\t read();\n\t lexState = 'comment';\n\t return\n\n\t case undefined:\n\t read();\n\t return newToken('eof')\n\t }\n\n\t if (util.isSpaceSeparator(c)) {\n\t read();\n\t return\n\t }\n\n\t // This code is unreachable.\n\t // if (!lexStates[parseState]) {\n\t // throw invalidLexState(parseState)\n\t // }\n\n\t return lexStates[parseState]()\n\t },\n\n\t comment: function comment () {\n\t switch (c) {\n\t case '*':\n\t read();\n\t lexState = 'multiLineComment';\n\t return\n\n\t case '/':\n\t read();\n\t lexState = 'singleLineComment';\n\t return\n\t }\n\n\t throw invalidChar(read())\n\t },\n\n\t multiLineComment: function multiLineComment () {\n\t switch (c) {\n\t case '*':\n\t read();\n\t lexState = 'multiLineCommentAsterisk';\n\t return\n\n\t case undefined:\n\t throw invalidChar(read())\n\t }\n\n\t read();\n\t },\n\n\t multiLineCommentAsterisk: function multiLineCommentAsterisk () {\n\t switch (c) {\n\t case '*':\n\t read();\n\t return\n\n\t case '/':\n\t read();\n\t lexState = 'default';\n\t return\n\n\t case undefined:\n\t throw invalidChar(read())\n\t }\n\n\t read();\n\t lexState = 'multiLineComment';\n\t },\n\n\t singleLineComment: function singleLineComment () {\n\t switch (c) {\n\t case '\\n':\n\t case '\\r':\n\t case '\\u2028':\n\t case '\\u2029':\n\t read();\n\t lexState = 'default';\n\t return\n\n\t case undefined:\n\t read();\n\t return newToken('eof')\n\t }\n\n\t read();\n\t },\n\n\t value: function value () {\n\t switch (c) {\n\t case '{':\n\t case '[':\n\t return newToken('punctuator', read())\n\n\t case 'n':\n\t read();\n\t literal('ull');\n\t return newToken('null', null)\n\n\t case 't':\n\t read();\n\t literal('rue');\n\t return newToken('boolean', true)\n\n\t case 'f':\n\t read();\n\t literal('alse');\n\t return newToken('boolean', false)\n\n\t case '-':\n\t case '+':\n\t if (read() === '-') {\n\t sign = -1;\n\t }\n\n\t lexState = 'sign';\n\t return\n\n\t case '.':\n\t buffer = read();\n\t lexState = 'decimalPointLeading';\n\t return\n\n\t case '0':\n\t buffer = read();\n\t lexState = 'zero';\n\t return\n\n\t case '1':\n\t case '2':\n\t case '3':\n\t case '4':\n\t case '5':\n\t case '6':\n\t case '7':\n\t case '8':\n\t case '9':\n\t buffer = read();\n\t lexState = 'decimalInteger';\n\t return\n\n\t case 'I':\n\t read();\n\t literal('nfinity');\n\t return newToken('numeric', Infinity)\n\n\t case 'N':\n\t read();\n\t literal('aN');\n\t return newToken('numeric', NaN)\n\n\t case '\"':\n\t case \"'\":\n\t doubleQuote = (read() === '\"');\n\t buffer = '';\n\t lexState = 'string';\n\t return\n\t }\n\n\t throw invalidChar(read())\n\t },\n\n\t identifierNameStartEscape: function identifierNameStartEscape () {\n\t if (c !== 'u') {\n\t throw invalidChar(read())\n\t }\n\n\t read();\n\t var u = unicodeEscape();\n\t switch (u) {\n\t case '$':\n\t case '_':\n\t break\n\n\t default:\n\t if (!util.isIdStartChar(u)) {\n\t throw invalidIdentifier()\n\t }\n\n\t break\n\t }\n\n\t buffer += u;\n\t lexState = 'identifierName';\n\t },\n\n\t identifierName: function identifierName () {\n\t switch (c) {\n\t case '$':\n\t case '_':\n\t case '\\u200C':\n\t case '\\u200D':\n\t buffer += read();\n\t return\n\n\t case '\\\\':\n\t read();\n\t lexState = 'identifierNameEscape';\n\t return\n\t }\n\n\t if (util.isIdContinueChar(c)) {\n\t buffer += read();\n\t return\n\t }\n\n\t return newToken('identifier', buffer)\n\t },\n\n\t identifierNameEscape: function identifierNameEscape () {\n\t if (c !== 'u') {\n\t throw invalidChar(read())\n\t }\n\n\t read();\n\t var u = unicodeEscape();\n\t switch (u) {\n\t case '$':\n\t case '_':\n\t case '\\u200C':\n\t case '\\u200D':\n\t break\n\n\t default:\n\t if (!util.isIdContinueChar(u)) {\n\t throw invalidIdentifier()\n\t }\n\n\t break\n\t }\n\n\t buffer += u;\n\t lexState = 'identifierName';\n\t },\n\n\t sign: function sign$1 () {\n\t switch (c) {\n\t case '.':\n\t buffer = read();\n\t lexState = 'decimalPointLeading';\n\t return\n\n\t case '0':\n\t buffer = read();\n\t lexState = 'zero';\n\t return\n\n\t case '1':\n\t case '2':\n\t case '3':\n\t case '4':\n\t case '5':\n\t case '6':\n\t case '7':\n\t case '8':\n\t case '9':\n\t buffer = read();\n\t lexState = 'decimalInteger';\n\t return\n\n\t case 'I':\n\t read();\n\t literal('nfinity');\n\t return newToken('numeric', sign * Infinity)\n\n\t case 'N':\n\t read();\n\t literal('aN');\n\t return newToken('numeric', NaN)\n\t }\n\n\t throw invalidChar(read())\n\t },\n\n\t zero: function zero () {\n\t switch (c) {\n\t case '.':\n\t buffer += read();\n\t lexState = 'decimalPoint';\n\t return\n\n\t case 'e':\n\t case 'E':\n\t buffer += read();\n\t lexState = 'decimalExponent';\n\t return\n\n\t case 'x':\n\t case 'X':\n\t buffer += read();\n\t lexState = 'hexadecimal';\n\t return\n\t }\n\n\t return newToken('numeric', sign * 0)\n\t },\n\n\t decimalInteger: function decimalInteger () {\n\t switch (c) {\n\t case '.':\n\t buffer += read();\n\t lexState = 'decimalPoint';\n\t return\n\n\t case 'e':\n\t case 'E':\n\t buffer += read();\n\t lexState = 'decimalExponent';\n\t return\n\t }\n\n\t if (util.isDigit(c)) {\n\t buffer += read();\n\t return\n\t }\n\n\t return newToken('numeric', sign * Number(buffer))\n\t },\n\n\t decimalPointLeading: function decimalPointLeading () {\n\t if (util.isDigit(c)) {\n\t buffer += read();\n\t lexState = 'decimalFraction';\n\t return\n\t }\n\n\t throw invalidChar(read())\n\t },\n\n\t decimalPoint: function decimalPoint () {\n\t switch (c) {\n\t case 'e':\n\t case 'E':\n\t buffer += read();\n\t lexState = 'decimalExponent';\n\t return\n\t }\n\n\t if (util.isDigit(c)) {\n\t buffer += read();\n\t lexState = 'decimalFraction';\n\t return\n\t }\n\n\t return newToken('numeric', sign * Number(buffer))\n\t },\n\n\t decimalFraction: function decimalFraction () {\n\t switch (c) {\n\t case 'e':\n\t case 'E':\n\t buffer += read();\n\t lexState = 'decimalExponent';\n\t return\n\t }\n\n\t if (util.isDigit(c)) {\n\t buffer += read();\n\t return\n\t }\n\n\t return newToken('numeric', sign * Number(buffer))\n\t },\n\n\t decimalExponent: function decimalExponent () {\n\t switch (c) {\n\t case '+':\n\t case '-':\n\t buffer += read();\n\t lexState = 'decimalExponentSign';\n\t return\n\t }\n\n\t if (util.isDigit(c)) {\n\t buffer += read();\n\t lexState = 'decimalExponentInteger';\n\t return\n\t }\n\n\t throw invalidChar(read())\n\t },\n\n\t decimalExponentSign: function decimalExponentSign () {\n\t if (util.isDigit(c)) {\n\t buffer += read();\n\t lexState = 'decimalExponentInteger';\n\t return\n\t }\n\n\t throw invalidChar(read())\n\t },\n\n\t decimalExponentInteger: function decimalExponentInteger () {\n\t if (util.isDigit(c)) {\n\t buffer += read();\n\t return\n\t }\n\n\t return newToken('numeric', sign * Number(buffer))\n\t },\n\n\t hexadecimal: function hexadecimal () {\n\t if (util.isHexDigit(c)) {\n\t buffer += read();\n\t lexState = 'hexadecimalInteger';\n\t return\n\t }\n\n\t throw invalidChar(read())\n\t },\n\n\t hexadecimalInteger: function hexadecimalInteger () {\n\t if (util.isHexDigit(c)) {\n\t buffer += read();\n\t return\n\t }\n\n\t return newToken('numeric', sign * Number(buffer))\n\t },\n\n\t string: function string () {\n\t switch (c) {\n\t case '\\\\':\n\t read();\n\t buffer += escape();\n\t return\n\n\t case '\"':\n\t if (doubleQuote) {\n\t read();\n\t return newToken('string', buffer)\n\t }\n\n\t buffer += read();\n\t return\n\n\t case \"'\":\n\t if (!doubleQuote) {\n\t read();\n\t return newToken('string', buffer)\n\t }\n\n\t buffer += read();\n\t return\n\n\t case '\\n':\n\t case '\\r':\n\t throw invalidChar(read())\n\n\t case '\\u2028':\n\t case '\\u2029':\n\t separatorChar(c);\n\t break\n\n\t case undefined:\n\t throw invalidChar(read())\n\t }\n\n\t buffer += read();\n\t },\n\n\t start: function start () {\n\t switch (c) {\n\t case '{':\n\t case '[':\n\t return newToken('punctuator', read())\n\n\t // This code is unreachable since the default lexState handles eof.\n\t // case undefined:\n\t // return newToken('eof')\n\t }\n\n\t lexState = 'value';\n\t },\n\n\t beforePropertyName: function beforePropertyName () {\n\t switch (c) {\n\t case '$':\n\t case '_':\n\t buffer = read();\n\t lexState = 'identifierName';\n\t return\n\n\t case '\\\\':\n\t read();\n\t lexState = 'identifierNameStartEscape';\n\t return\n\n\t case '}':\n\t return newToken('punctuator', read())\n\n\t case '\"':\n\t case \"'\":\n\t doubleQuote = (read() === '\"');\n\t lexState = 'string';\n\t return\n\t }\n\n\t if (util.isIdStartChar(c)) {\n\t buffer += read();\n\t lexState = 'identifierName';\n\t return\n\t }\n\n\t throw invalidChar(read())\n\t },\n\n\t afterPropertyName: function afterPropertyName () {\n\t if (c === ':') {\n\t return newToken('punctuator', read())\n\t }\n\n\t throw invalidChar(read())\n\t },\n\n\t beforePropertyValue: function beforePropertyValue () {\n\t lexState = 'value';\n\t },\n\n\t afterPropertyValue: function afterPropertyValue () {\n\t switch (c) {\n\t case ',':\n\t case '}':\n\t return newToken('punctuator', read())\n\t }\n\n\t throw invalidChar(read())\n\t },\n\n\t beforeArrayValue: function beforeArrayValue () {\n\t if (c === ']') {\n\t return newToken('punctuator', read())\n\t }\n\n\t lexState = 'value';\n\t },\n\n\t afterArrayValue: function afterArrayValue () {\n\t switch (c) {\n\t case ',':\n\t case ']':\n\t return newToken('punctuator', read())\n\t }\n\n\t throw invalidChar(read())\n\t },\n\n\t end: function end () {\n\t // This code is unreachable since it's handled by the default lexState.\n\t // if (c === undefined) {\n\t // read()\n\t // return newToken('eof')\n\t // }\n\n\t throw invalidChar(read())\n\t },\n\t};\n\n\tfunction newToken (type, value) {\n\t return {\n\t type: type,\n\t value: value,\n\t line: line,\n\t column: column,\n\t }\n\t}\n\n\tfunction literal (s) {\n\t for (var i = 0, list = s; i < list.length; i += 1) {\n\t var c = list[i];\n\n\t var p = peek();\n\n\t if (p !== c) {\n\t throw invalidChar(read())\n\t }\n\n\t read();\n\t }\n\t}\n\n\tfunction escape () {\n\t var c = peek();\n\t switch (c) {\n\t case 'b':\n\t read();\n\t return '\\b'\n\n\t case 'f':\n\t read();\n\t return '\\f'\n\n\t case 'n':\n\t read();\n\t return '\\n'\n\n\t case 'r':\n\t read();\n\t return '\\r'\n\n\t case 't':\n\t read();\n\t return '\\t'\n\n\t case 'v':\n\t read();\n\t return '\\v'\n\n\t case '0':\n\t read();\n\t if (util.isDigit(peek())) {\n\t throw invalidChar(read())\n\t }\n\n\t return '\\0'\n\n\t case 'x':\n\t read();\n\t return hexEscape()\n\n\t case 'u':\n\t read();\n\t return unicodeEscape()\n\n\t case '\\n':\n\t case '\\u2028':\n\t case '\\u2029':\n\t read();\n\t return ''\n\n\t case '\\r':\n\t read();\n\t if (peek() === '\\n') {\n\t read();\n\t }\n\n\t return ''\n\n\t case '1':\n\t case '2':\n\t case '3':\n\t case '4':\n\t case '5':\n\t case '6':\n\t case '7':\n\t case '8':\n\t case '9':\n\t throw invalidChar(read())\n\n\t case undefined:\n\t throw invalidChar(read())\n\t }\n\n\t return read()\n\t}\n\n\tfunction hexEscape () {\n\t var buffer = '';\n\t var c = peek();\n\n\t if (!util.isHexDigit(c)) {\n\t throw invalidChar(read())\n\t }\n\n\t buffer += read();\n\n\t c = peek();\n\t if (!util.isHexDigit(c)) {\n\t throw invalidChar(read())\n\t }\n\n\t buffer += read();\n\n\t return String.fromCodePoint(parseInt(buffer, 16))\n\t}\n\n\tfunction unicodeEscape () {\n\t var buffer = '';\n\t var count = 4;\n\n\t while (count-- > 0) {\n\t var c = peek();\n\t if (!util.isHexDigit(c)) {\n\t throw invalidChar(read())\n\t }\n\n\t buffer += read();\n\t }\n\n\t return String.fromCodePoint(parseInt(buffer, 16))\n\t}\n\n\tvar parseStates = {\n\t start: function start () {\n\t if (token.type === 'eof') {\n\t throw invalidEOF()\n\t }\n\n\t push();\n\t },\n\n\t beforePropertyName: function beforePropertyName () {\n\t switch (token.type) {\n\t case 'identifier':\n\t case 'string':\n\t key = token.value;\n\t parseState = 'afterPropertyName';\n\t return\n\n\t case 'punctuator':\n\t // This code is unreachable since it's handled by the lexState.\n\t // if (token.value !== '}') {\n\t // throw invalidToken()\n\t // }\n\n\t pop();\n\t return\n\n\t case 'eof':\n\t throw invalidEOF()\n\t }\n\n\t // This code is unreachable since it's handled by the lexState.\n\t // throw invalidToken()\n\t },\n\n\t afterPropertyName: function afterPropertyName () {\n\t // This code is unreachable since it's handled by the lexState.\n\t // if (token.type !== 'punctuator' || token.value !== ':') {\n\t // throw invalidToken()\n\t // }\n\n\t if (token.type === 'eof') {\n\t throw invalidEOF()\n\t }\n\n\t parseState = 'beforePropertyValue';\n\t },\n\n\t beforePropertyValue: function beforePropertyValue () {\n\t if (token.type === 'eof') {\n\t throw invalidEOF()\n\t }\n\n\t push();\n\t },\n\n\t beforeArrayValue: function beforeArrayValue () {\n\t if (token.type === 'eof') {\n\t throw invalidEOF()\n\t }\n\n\t if (token.type === 'punctuator' && token.value === ']') {\n\t pop();\n\t return\n\t }\n\n\t push();\n\t },\n\n\t afterPropertyValue: function afterPropertyValue () {\n\t // This code is unreachable since it's handled by the lexState.\n\t // if (token.type !== 'punctuator') {\n\t // throw invalidToken()\n\t // }\n\n\t if (token.type === 'eof') {\n\t throw invalidEOF()\n\t }\n\n\t switch (token.value) {\n\t case ',':\n\t parseState = 'beforePropertyName';\n\t return\n\n\t case '}':\n\t pop();\n\t }\n\n\t // This code is unreachable since it's handled by the lexState.\n\t // throw invalidToken()\n\t },\n\n\t afterArrayValue: function afterArrayValue () {\n\t // This code is unreachable since it's handled by the lexState.\n\t // if (token.type !== 'punctuator') {\n\t // throw invalidToken()\n\t // }\n\n\t if (token.type === 'eof') {\n\t throw invalidEOF()\n\t }\n\n\t switch (token.value) {\n\t case ',':\n\t parseState = 'beforeArrayValue';\n\t return\n\n\t case ']':\n\t pop();\n\t }\n\n\t // This code is unreachable since it's handled by the lexState.\n\t // throw invalidToken()\n\t },\n\n\t end: function end () {\n\t // This code is unreachable since it's handled by the lexState.\n\t // if (token.type !== 'eof') {\n\t // throw invalidToken()\n\t // }\n\t },\n\t};\n\n\tfunction push () {\n\t var value;\n\n\t switch (token.type) {\n\t case 'punctuator':\n\t switch (token.value) {\n\t case '{':\n\t value = {};\n\t break\n\n\t case '[':\n\t value = [];\n\t break\n\t }\n\n\t break\n\n\t case 'null':\n\t case 'boolean':\n\t case 'numeric':\n\t case 'string':\n\t value = token.value;\n\t break\n\n\t // This code is unreachable.\n\t // default:\n\t // throw invalidToken()\n\t }\n\n\t if (root === undefined) {\n\t root = value;\n\t } else {\n\t var parent = stack[stack.length - 1];\n\t if (Array.isArray(parent)) {\n\t parent.push(value);\n\t } else {\n\t Object.defineProperty(parent, key, {\n\t value: value,\n\t writable: true,\n\t enumerable: true,\n\t configurable: true,\n\t });\n\t }\n\t }\n\n\t if (value !== null && typeof value === 'object') {\n\t stack.push(value);\n\n\t if (Array.isArray(value)) {\n\t parseState = 'beforeArrayValue';\n\t } else {\n\t parseState = 'beforePropertyName';\n\t }\n\t } else {\n\t var current = stack[stack.length - 1];\n\t if (current == null) {\n\t parseState = 'end';\n\t } else if (Array.isArray(current)) {\n\t parseState = 'afterArrayValue';\n\t } else {\n\t parseState = 'afterPropertyValue';\n\t }\n\t }\n\t}\n\n\tfunction pop () {\n\t stack.pop();\n\n\t var current = stack[stack.length - 1];\n\t if (current == null) {\n\t parseState = 'end';\n\t } else if (Array.isArray(current)) {\n\t parseState = 'afterArrayValue';\n\t } else {\n\t parseState = 'afterPropertyValue';\n\t }\n\t}\n\n\t// This code is unreachable.\n\t// function invalidParseState () {\n\t// return new Error(`JSON5: invalid parse state '${parseState}'`)\n\t// }\n\n\t// This code is unreachable.\n\t// function invalidLexState (state) {\n\t// return new Error(`JSON5: invalid lex state '${state}'`)\n\t// }\n\n\tfunction invalidChar (c) {\n\t if (c === undefined) {\n\t return syntaxError((\"JSON5: invalid end of input at \" + line + \":\" + column))\n\t }\n\n\t return syntaxError((\"JSON5: invalid character '\" + (formatChar(c)) + \"' at \" + line + \":\" + column))\n\t}\n\n\tfunction invalidEOF () {\n\t return syntaxError((\"JSON5: invalid end of input at \" + line + \":\" + column))\n\t}\n\n\t// This code is unreachable.\n\t// function invalidToken () {\n\t// if (token.type === 'eof') {\n\t// return syntaxError(`JSON5: invalid end of input at ${line}:${column}`)\n\t// }\n\n\t// const c = String.fromCodePoint(token.value.codePointAt(0))\n\t// return syntaxError(`JSON5: invalid character '${formatChar(c)}' at ${line}:${column}`)\n\t// }\n\n\tfunction invalidIdentifier () {\n\t column -= 5;\n\t return syntaxError((\"JSON5: invalid identifier character at \" + line + \":\" + column))\n\t}\n\n\tfunction separatorChar (c) {\n\t console.warn((\"JSON5: '\" + (formatChar(c)) + \"' in strings is not valid ECMAScript; consider escaping\"));\n\t}\n\n\tfunction formatChar (c) {\n\t var replacements = {\n\t \"'\": \"\\\\'\",\n\t '\"': '\\\\\"',\n\t '\\\\': '\\\\\\\\',\n\t '\\b': '\\\\b',\n\t '\\f': '\\\\f',\n\t '\\n': '\\\\n',\n\t '\\r': '\\\\r',\n\t '\\t': '\\\\t',\n\t '\\v': '\\\\v',\n\t '\\0': '\\\\0',\n\t '\\u2028': '\\\\u2028',\n\t '\\u2029': '\\\\u2029',\n\t };\n\n\t if (replacements[c]) {\n\t return replacements[c]\n\t }\n\n\t if (c < ' ') {\n\t var hexString = c.charCodeAt(0).toString(16);\n\t return '\\\\x' + ('00' + hexString).substring(hexString.length)\n\t }\n\n\t return c\n\t}\n\n\tfunction syntaxError (message) {\n\t var err = new SyntaxError(message);\n\t err.lineNumber = line;\n\t err.columnNumber = column;\n\t return err\n\t}\n\n\tvar stringify = function stringify (value, replacer, space) {\n\t var stack = [];\n\t var indent = '';\n\t var propertyList;\n\t var replacerFunc;\n\t var gap = '';\n\t var quote;\n\n\t if (\n\t replacer != null &&\n\t typeof replacer === 'object' &&\n\t !Array.isArray(replacer)\n\t ) {\n\t space = replacer.space;\n\t quote = replacer.quote;\n\t replacer = replacer.replacer;\n\t }\n\n\t if (typeof replacer === 'function') {\n\t replacerFunc = replacer;\n\t } else if (Array.isArray(replacer)) {\n\t propertyList = [];\n\t for (var i = 0, list = replacer; i < list.length; i += 1) {\n\t var v = list[i];\n\n\t var item = (void 0);\n\n\t if (typeof v === 'string') {\n\t item = v;\n\t } else if (\n\t typeof v === 'number' ||\n\t v instanceof String ||\n\t v instanceof Number\n\t ) {\n\t item = String(v);\n\t }\n\n\t if (item !== undefined && propertyList.indexOf(item) < 0) {\n\t propertyList.push(item);\n\t }\n\t }\n\t }\n\n\t if (space instanceof Number) {\n\t space = Number(space);\n\t } else if (space instanceof String) {\n\t space = String(space);\n\t }\n\n\t if (typeof space === 'number') {\n\t if (space > 0) {\n\t space = Math.min(10, Math.floor(space));\n\t gap = ' '.substr(0, space);\n\t }\n\t } else if (typeof space === 'string') {\n\t gap = space.substr(0, 10);\n\t }\n\n\t return serializeProperty('', {'': value})\n\n\t function serializeProperty (key, holder) {\n\t var value = holder[key];\n\t if (value != null) {\n\t if (typeof value.toJSON5 === 'function') {\n\t value = value.toJSON5(key);\n\t } else if (typeof value.toJSON === 'function') {\n\t value = value.toJSON(key);\n\t }\n\t }\n\n\t if (replacerFunc) {\n\t value = replacerFunc.call(holder, key, value);\n\t }\n\n\t if (value instanceof Number) {\n\t value = Number(value);\n\t } else if (value instanceof String) {\n\t value = String(value);\n\t } else if (value instanceof Boolean) {\n\t value = value.valueOf();\n\t }\n\n\t switch (value) {\n\t case null: return 'null'\n\t case true: return 'true'\n\t case false: return 'false'\n\t }\n\n\t if (typeof value === 'string') {\n\t return quoteString(value, false)\n\t }\n\n\t if (typeof value === 'number') {\n\t return String(value)\n\t }\n\n\t if (typeof value === 'object') {\n\t return Array.isArray(value) ? serializeArray(value) : serializeObject(value)\n\t }\n\n\t return undefined\n\t }\n\n\t function quoteString (value) {\n\t var quotes = {\n\t \"'\": 0.1,\n\t '\"': 0.2,\n\t };\n\n\t var replacements = {\n\t \"'\": \"\\\\'\",\n\t '\"': '\\\\\"',\n\t '\\\\': '\\\\\\\\',\n\t '\\b': '\\\\b',\n\t '\\f': '\\\\f',\n\t '\\n': '\\\\n',\n\t '\\r': '\\\\r',\n\t '\\t': '\\\\t',\n\t '\\v': '\\\\v',\n\t '\\0': '\\\\0',\n\t '\\u2028': '\\\\u2028',\n\t '\\u2029': '\\\\u2029',\n\t };\n\n\t var product = '';\n\n\t for (var i = 0; i < value.length; i++) {\n\t var c = value[i];\n\t switch (c) {\n\t case \"'\":\n\t case '\"':\n\t quotes[c]++;\n\t product += c;\n\t continue\n\n\t case '\\0':\n\t if (util.isDigit(value[i + 1])) {\n\t product += '\\\\x00';\n\t continue\n\t }\n\t }\n\n\t if (replacements[c]) {\n\t product += replacements[c];\n\t continue\n\t }\n\n\t if (c < ' ') {\n\t var hexString = c.charCodeAt(0).toString(16);\n\t product += '\\\\x' + ('00' + hexString).substring(hexString.length);\n\t continue\n\t }\n\n\t product += c;\n\t }\n\n\t var quoteChar = quote || Object.keys(quotes).reduce(function (a, b) { return (quotes[a] < quotes[b]) ? a : b; });\n\n\t product = product.replace(new RegExp(quoteChar, 'g'), replacements[quoteChar]);\n\n\t return quoteChar + product + quoteChar\n\t }\n\n\t function serializeObject (value) {\n\t if (stack.indexOf(value) >= 0) {\n\t throw TypeError('Converting circular structure to JSON5')\n\t }\n\n\t stack.push(value);\n\n\t var stepback = indent;\n\t indent = indent + gap;\n\n\t var keys = propertyList || Object.keys(value);\n\t var partial = [];\n\t for (var i = 0, list = keys; i < list.length; i += 1) {\n\t var key = list[i];\n\n\t var propertyString = serializeProperty(key, value);\n\t if (propertyString !== undefined) {\n\t var member = serializeKey(key) + ':';\n\t if (gap !== '') {\n\t member += ' ';\n\t }\n\t member += propertyString;\n\t partial.push(member);\n\t }\n\t }\n\n\t var final;\n\t if (partial.length === 0) {\n\t final = '{}';\n\t } else {\n\t var properties;\n\t if (gap === '') {\n\t properties = partial.join(',');\n\t final = '{' + properties + '}';\n\t } else {\n\t var separator = ',\\n' + indent;\n\t properties = partial.join(separator);\n\t final = '{\\n' + indent + properties + ',\\n' + stepback + '}';\n\t }\n\t }\n\n\t stack.pop();\n\t indent = stepback;\n\t return final\n\t }\n\n\t function serializeKey (key) {\n\t if (key.length === 0) {\n\t return quoteString(key, true)\n\t }\n\n\t var firstChar = String.fromCodePoint(key.codePointAt(0));\n\t if (!util.isIdStartChar(firstChar)) {\n\t return quoteString(key, true)\n\t }\n\n\t for (var i = firstChar.length; i < key.length; i++) {\n\t if (!util.isIdContinueChar(String.fromCodePoint(key.codePointAt(i)))) {\n\t return quoteString(key, true)\n\t }\n\t }\n\n\t return key\n\t }\n\n\t function serializeArray (value) {\n\t if (stack.indexOf(value) >= 0) {\n\t throw TypeError('Converting circular structure to JSON5')\n\t }\n\n\t stack.push(value);\n\n\t var stepback = indent;\n\t indent = indent + gap;\n\n\t var partial = [];\n\t for (var i = 0; i < value.length; i++) {\n\t var propertyString = serializeProperty(String(i), value);\n\t partial.push((propertyString !== undefined) ? propertyString : 'null');\n\t }\n\n\t var final;\n\t if (partial.length === 0) {\n\t final = '[]';\n\t } else {\n\t if (gap === '') {\n\t var properties = partial.join(',');\n\t final = '[' + properties + ']';\n\t } else {\n\t var separator = ',\\n' + indent;\n\t var properties$1 = partial.join(separator);\n\t final = '[\\n' + indent + properties$1 + ',\\n' + stepback + ']';\n\t }\n\t }\n\n\t stack.pop();\n\t indent = stepback;\n\t return final\n\t }\n\t};\n\n\tvar JSON5 = {\n\t parse: parse,\n\t stringify: stringify,\n\t};\n\n\tvar lib = JSON5;\n\n\tvar es5 = lib;\n\n\treturn es5;\n\n})));\n","// muon - Multi-platform GUI application framework that uses CEF as its backend\n// Copyright (c) Kouji Matsui. (@kekyo@mi.kekyo.net)\n// Under MIT.\n// https://github.com/kekyo/muon-ui\n\nimport { constants } from \"node:fs\";\nimport { access, readFile } from \"node:fs/promises\";\nimport { join, resolve } from \"node:path\";\n\nimport { parse } from \"json5\";\nimport type { ResolvedPluginArtifact } from \"muon-plugin-sdk/artifact\";\nimport type { MuonNativePluginReference } from \"./native-plugins.js\";\nexport type { MuonNativePluginReference } from \"./native-plugins.js\";\n\nimport type {\n MuonCapabilityImportOptions,\n MuonCapabilityOptions,\n MuonRuntimePluginEntryConfig,\n} from \"./capability.js\";\n\n/**\n * Plugin JavaScript exposure mode.\n */\nexport type MuonPluginAccessMode = \"simple\" | \"validate\";\n\n/**\n * Import-side capability rule from public muon plugin access config.\n */\nexport interface MuonPluginAccessImportOptions {\n /**\n * Importer source globs relative to the bundler project root.\n */\n sources?: readonly string[];\n /**\n * NPM package names allowed to import the virtual module.\n */\n packages?: readonly string[];\n /**\n * Plugin function paths allowed for this import rule.\n *\n * @remarks Required in validate mode. Simple mode does not use import rules.\n */\n allow?: readonly string[];\n}\n\n/**\n * Plugin entry from public muon plugin access config.\n */\nexport interface MuonPluginAccessEntryOptions {\n /** Explicit local source, artifact or prebuilt NPM plugin reference. */\n native?: MuonNativePluginReference;\n /**\n * Plugin entry name.\n */\n name: string;\n /**\n * Optional 64-character hexadecimal SHA-256 digest of the final external\n * `.so` or `.dll` file bytes followed by the decoded `salt` bytes.\n *\n * @remarks Calculate this after all library post-processing, including\n * stripping and code signing. It is not supported for `internal`.\n */\n signature?: string;\n /**\n * Optional hex-encoded salt whose decoded bytes are appended when checking\n * the plugin signature.\n *\n * @remarks Required when `signature` is specified. It is not supported for\n * `internal`.\n */\n salt?: string;\n /**\n * Plugin-defined string key-value configuration entries.\n */\n config?: Readonly<Record<string, string>>;\n /**\n * Plugin function path globs allowed by the runtime plugin policy.\n *\n * @remarks Required in simple mode. Validate mode derives the runtime\n * allowlist from `imports[].allow` and rejects this field in public config.\n */\n allow?: readonly string[];\n /**\n * Validate-mode import rules for this plugin entry.\n */\n imports?: readonly MuonPluginAccessImportOptions[];\n}\n\n/**\n * Public plugin access config shared by muon.json and the Vite option.\n */\nexport interface MuonPluginAccessOptions {\n /**\n * External plugin directory override.\n */\n path?: string;\n /**\n * Plugin exposure mode.\n */\n mode?: MuonPluginAccessMode;\n /**\n * Page URL patterns where the plugin bridge is exposed.\n */\n pages?: readonly string[];\n /**\n * Runtime plugin entries and validate-mode import rules.\n */\n plugins?: readonly MuonPluginAccessEntryOptions[];\n}\n\n/**\n * Resolved plugin access config used by bundler integrations.\n */\nexport interface MuonResolvedPluginAccessOptions {\n /** Configuration base for native plugin references. */\n nativeDirectory?: string;\n /** Verified producer catalogs prepared by CLI or Vite. */\n nativeArtifacts?: ReadonlyMap<string, ResolvedPluginArtifact>;\n /**\n * Effective plugin exposure mode.\n */\n mode: MuonPluginAccessMode;\n /**\n * Effective page URL allowlist.\n */\n pages: readonly string[];\n /**\n * Capability resolver inputs generated from plugin imports.\n */\n capabilityOptions: MuonCapabilityOptions;\n /**\n * Runtime config fields added around generated capability policies.\n */\n runtimeOverlay: MuonPluginAccessRuntimeOverlay;\n /**\n * Resolved external plugin directory used by build-time inspectors.\n */\n pluginPath: string;\n /**\n * Effective plugin entries from muon.json and Vite options.\n */\n plugins: readonly MuonPluginAccessEntryOptions[];\n}\n\n/**\n * Runtime plugin config fields that are not derived from capability IDs.\n */\nexport interface MuonPluginAccessRuntimeOverlay {\n /**\n * Page URL allowlist to write into generated runtime config.\n */\n pages?: readonly string[];\n /**\n * External plugin path override.\n */\n path?: string;\n /**\n * Plugin loading allowlist override.\n */\n plugins?: readonly MuonRuntimePluginEntryConfig[];\n}\n\nexport interface ResolveMuonPluginAccessOptionsInput {\n /**\n * Bundler project root.\n */\n root: string;\n /**\n * Optional muon.json path relative to root.\n */\n configPath: string | undefined;\n /**\n * Vite plugin access override.\n */\n pluginAccess: false | MuonPluginAccessOptions | undefined;\n /**\n * Handles project config read failures. When omitted, read failures are\n * reported as errors.\n */\n onConfigReadError?: (error: unknown) => void;\n}\n\ntype JsonObject = Record<string, unknown>;\n\nconst defaultConfigFileNames = [\"muon.json5\", \"muon.jsonc\", \"muon.json\"];\nconst defaultPluginPages = [\"asset://main/**\"];\n\nconst isJsonObject = (value: unknown): value is JsonObject =>\n typeof value === \"object\" && value !== null && !Array.isArray(value);\n\nconst isStringArray = (value: unknown): value is readonly string[] =>\n Array.isArray(value) && value.every((entry) => typeof entry === \"string\");\n\nconst isSha256HexString = (value: string): boolean =>\n value.length === 64 && /^[0-9a-fA-F]+$/.test(value);\n\nconst isHexByteString = (value: string): boolean =>\n value.length % 2 === 0 && /^[0-9a-fA-F]*$/.test(value);\n\nconst containsNul = (value: string): boolean => value.includes(\"\\0\");\n\nconst getErrorMessage = (error: unknown): string =>\n error instanceof Error ? error.message : String(error);\n\nconst fileExists = async (path: string): Promise<boolean> => {\n try {\n await access(path, constants.F_OK);\n return true;\n } catch {\n return false;\n }\n};\n\n/** Resolves the explicit or conventional application configuration path. */\nexport const resolveMuonConfigPath = async (\n root: string,\n configPath: string | undefined,\n): Promise<string | undefined> => {\n if (configPath !== undefined) {\n const resolvedPath = resolve(root, configPath);\n if (await fileExists(resolvedPath)) {\n return resolvedPath;\n }\n throw new Error(`muon config file does not exist: ${resolvedPath}`);\n }\n\n for (const fileName of defaultConfigFileNames) {\n const candidatePath = join(root, fileName);\n if (await fileExists(candidatePath)) {\n return candidatePath;\n }\n }\n return undefined;\n};\n\n/** Reads a JSON/JSON5 configuration object and reports its source on failure. */\nexport const readJsonObjectFile = async (\n path: string,\n label: string,\n): Promise<JsonObject> => {\n let content: string;\n try {\n content = await readFile(path, \"utf8\");\n } catch (error) {\n throw new Error(\n `${label} could not be read: ${path}: ${getErrorMessage(error)}`,\n );\n }\n\n let parsed: unknown;\n try {\n parsed = parse(content);\n } catch (error) {\n throw new Error(\n `${label} could not be parsed: ${path}: ${getErrorMessage(error)}`,\n );\n }\n\n if (!isJsonObject(parsed)) {\n throw new Error(`${label} must contain a JSON object: ${path}`);\n }\n return parsed;\n};\n\nconst readOptionalStringArray = (\n object: JsonObject,\n key: string,\n configPath: string,\n): readonly string[] | undefined => {\n const value = object[key];\n if (value === undefined) {\n return undefined;\n }\n if (!isStringArray(value)) {\n throw new Error(`muon.json ${configPath} must be an array of strings.`);\n }\n return value;\n};\n\nconst readPluginAccessImportOptions = (\n value: unknown,\n configPath: string,\n): MuonPluginAccessImportOptions => {\n if (!isJsonObject(value)) {\n throw new Error(`muon.json ${configPath} must be an object.`);\n }\n\n const sources = readOptionalStringArray(\n value,\n \"sources\",\n `${configPath}.sources`,\n );\n const packages = readOptionalStringArray(\n value,\n \"packages\",\n `${configPath}.packages`,\n );\n const allow = readOptionalStringArray(value, \"allow\", `${configPath}.allow`);\n const options: MuonPluginAccessImportOptions = {};\n if (sources !== undefined) {\n options.sources = sources;\n }\n if (packages !== undefined) {\n options.packages = packages;\n }\n if (allow !== undefined) {\n options.allow = allow;\n }\n return options;\n};\n\nconst readOptionalStringRecord = (\n object: JsonObject,\n key: string,\n configPath: string,\n): Readonly<Record<string, string>> | undefined => {\n const value = object[key];\n if (value === undefined) {\n return undefined;\n }\n if (!isJsonObject(value)) {\n throw new Error(`muon.json ${configPath} must be an object.`);\n }\n const config: Record<string, string> = {};\n for (const [entryKey, entryValue] of Object.entries(value)) {\n if (entryKey.length === 0) {\n throw new Error(`muon.json ${configPath} key must not be empty.`);\n }\n if (containsNul(entryKey)) {\n throw new Error(`muon.json ${configPath} key must not contain NUL.`);\n }\n const valuePath = `${configPath}.${entryKey}`;\n if (typeof entryValue !== \"string\") {\n throw new Error(`muon.json ${valuePath} must be a string.`);\n }\n if (containsNul(entryValue)) {\n throw new Error(`muon.json ${valuePath} must not contain NUL.`);\n }\n config[entryKey] = entryValue;\n }\n return config;\n};\n\nconst readPluginAccessEntryOptions = (\n value: unknown,\n index: number,\n): MuonPluginAccessEntryOptions => {\n const configPath = `plugin.plugins[${index}]`;\n if (!isJsonObject(value)) {\n throw new Error(`muon.json ${configPath} must be an object.`);\n }\n if (typeof value.name !== \"string\") {\n throw new Error(`muon.json ${configPath}.name must be a string.`);\n }\n if (value.signature !== undefined) {\n if (typeof value.signature !== \"string\") {\n throw new Error(`muon.json ${configPath}.signature must be a string.`);\n }\n if (!isSha256HexString(value.signature)) {\n throw new Error(\n `muon.json ${configPath}.signature must be a 64-character SHA-256 hex string.`,\n );\n }\n }\n if (value.salt !== undefined) {\n if (typeof value.salt !== \"string\") {\n throw new Error(`muon.json ${configPath}.salt must be a string.`);\n }\n if (!isHexByteString(value.salt)) {\n throw new Error(\n `muon.json ${configPath}.salt must be a hexadecimal byte string.`,\n );\n }\n }\n const allow = readOptionalStringArray(value, \"allow\", `${configPath}.allow`);\n const config = readOptionalStringRecord(\n value,\n \"config\",\n `${configPath}.config`,\n );\n\n const rawImports = value.imports;\n if (rawImports !== undefined && !Array.isArray(rawImports)) {\n throw new Error(`muon.json ${configPath}.imports must be an array.`);\n }\n const imports =\n rawImports === undefined\n ? undefined\n : rawImports.map((entry, importIndex) =>\n readPluginAccessImportOptions(\n entry,\n `${configPath}.imports[${importIndex}]`,\n ),\n );\n const options: MuonPluginAccessEntryOptions = {\n name: value.name,\n };\n if (value.native !== undefined) {\n if (!isJsonObject(value.native))\n throw new Error(`muon.json ${configPath}.native must be an object.`);\n const native: Record<string, string> = {};\n for (const [key, entry] of Object.entries(value.native)) {\n if (\n ![\n \"source\",\n \"manifest\",\n \"package\",\n \"sysroot\",\n \"androidSdkPath\",\n ].includes(key) ||\n typeof entry !== \"string\" ||\n !entry ||\n containsNul(entry)\n )\n throw new Error(`Invalid muon.json ${configPath}.native.${key}.`);\n native[key] = entry;\n }\n options.native = native;\n }\n if (value.signature !== undefined) {\n options.signature = value.signature;\n }\n if (value.salt !== undefined) {\n options.salt = value.salt;\n }\n if (config !== undefined) {\n options.config = config;\n }\n if (allow !== undefined) {\n options.allow = allow;\n }\n if (imports !== undefined) {\n options.imports = imports;\n }\n return options;\n};\n\nconst readPluginAccessOptions = (\n config: JsonObject,\n): MuonPluginAccessOptions => {\n const browser = config.browser;\n if (isJsonObject(browser) && browser.plugin !== undefined) {\n throw new Error(\n \"muon.json browser.plugin is no longer supported; use plugin.mode and plugin.pages instead.\",\n );\n }\n\n const plugin = config.plugin;\n if (plugin === undefined) {\n return {};\n }\n if (!isJsonObject(plugin)) {\n throw new Error(\"muon.json plugin must be an object.\");\n }\n\n const options: MuonPluginAccessOptions = {};\n if (plugin.path !== undefined) {\n if (typeof plugin.path !== \"string\") {\n throw new Error(\"muon.json plugin.path must be a string.\");\n }\n if (plugin.path.length === 0) {\n throw new Error(\"muon.json plugin.path must not be empty.\");\n }\n options.path = plugin.path;\n }\n if (plugin.mode !== undefined) {\n if (typeof plugin.mode !== \"string\") {\n throw new Error(\"muon.json plugin.mode must be a string.\");\n }\n if (plugin.mode.length === 0) {\n throw new Error(\"muon.json plugin.mode must not be empty.\");\n }\n if (plugin.mode !== \"simple\" && plugin.mode !== \"validate\") {\n throw new Error(\"muon.json plugin.mode has unknown value.\");\n }\n options.mode = plugin.mode;\n }\n const pages = readOptionalStringArray(plugin, \"pages\", \"plugin.pages\");\n if (pages !== undefined) {\n options.pages = pages;\n }\n\n const rawPlugins = plugin.plugins;\n if (rawPlugins !== undefined) {\n if (!Array.isArray(rawPlugins)) {\n throw new Error(\"muon.json plugin.plugins must be an array.\");\n }\n options.plugins = rawPlugins.map((entry, index) =>\n readPluginAccessEntryOptions(entry, index),\n );\n }\n return options;\n};\n\ntype EffectivePluginAccessOptions = Required<\n Pick<MuonPluginAccessOptions, \"mode\" | \"pages\" | \"plugins\">\n> &\n Pick<MuonPluginAccessOptions, \"path\">;\n\nconst hasImportSourceSelector = (\n entry: MuonPluginAccessImportOptions,\n): boolean =>\n (entry.sources !== undefined && entry.sources.length > 0) ||\n (entry.packages !== undefined && entry.packages.length > 0);\n\nconst validatePluginConfig = (rawConfig: unknown, configPath: string): void => {\n if (rawConfig === undefined) {\n return;\n }\n if (!isJsonObject(rawConfig)) {\n throw new Error(`muon.json ${configPath} must be an object.`);\n }\n for (const [entryKey, entryValue] of Object.entries(rawConfig)) {\n if (entryKey.length === 0) {\n throw new Error(`muon.json ${configPath} key must not be empty.`);\n }\n if (containsNul(entryKey)) {\n throw new Error(`muon.json ${configPath} key must not contain NUL.`);\n }\n const valuePath = `${configPath}.${entryKey}`;\n if (typeof entryValue !== \"string\") {\n throw new Error(`muon.json ${valuePath} must be a string.`);\n }\n if (containsNul(entryValue)) {\n throw new Error(`muon.json ${valuePath} must not contain NUL.`);\n }\n }\n};\n\nconst validatePluginAccessOptions = (\n resolved: EffectivePluginAccessOptions,\n): EffectivePluginAccessOptions => {\n for (const [pluginIndex, plugin] of resolved.plugins.entries()) {\n const pluginPath = `plugin.plugins[${pluginIndex}]`;\n const signature: unknown = plugin.signature;\n if (signature !== undefined) {\n if (typeof signature !== \"string\") {\n throw new Error(`muon.json ${pluginPath}.signature must be a string.`);\n }\n if (!isSha256HexString(signature)) {\n throw new Error(\n `muon.json ${pluginPath}.signature must be a 64-character SHA-256 hex string.`,\n );\n }\n }\n const salt: unknown = plugin.salt;\n if (salt !== undefined) {\n if (typeof salt !== \"string\") {\n throw new Error(`muon.json ${pluginPath}.salt must be a string.`);\n }\n if (!isHexByteString(salt)) {\n throw new Error(\n `muon.json ${pluginPath}.salt must be a hexadecimal byte string.`,\n );\n }\n }\n validatePluginConfig(\n (plugin as { config?: unknown }).config,\n `${pluginPath}.config`,\n );\n if (plugin.name === \"internal\" && plugin.signature !== undefined) {\n throw new Error(\n `muon.json ${pluginPath}.signature is not supported for internal plugins.`,\n );\n }\n if (plugin.name === \"internal\" && plugin.salt !== undefined) {\n throw new Error(\n `muon.json ${pluginPath}.salt is not supported for internal plugins.`,\n );\n }\n if (plugin.signature !== undefined && plugin.salt === undefined) {\n throw new Error(\n `muon.json ${pluginPath}.signature requires ${pluginPath}.salt.`,\n );\n }\n if (resolved.mode === \"validate\") {\n if (plugin.allow !== undefined) {\n throw new Error(\n `muon.json ${pluginPath}.allow is only supported in simple mode; use ${pluginPath}.imports[].allow in validate mode.`,\n );\n }\n if (plugin.imports === undefined) {\n throw new Error(\n `muon.json ${pluginPath}.imports is required in validate mode.`,\n );\n }\n if (plugin.imports.length === 0) {\n throw new Error(\n `muon.json ${pluginPath}.imports must not be empty in validate mode.`,\n );\n }\n\n for (const [importIndex, entry] of plugin.imports.entries()) {\n const importPath = `${pluginPath}.imports[${importIndex}]`;\n if (!hasImportSourceSelector(entry)) {\n throw new Error(\n `muon.json ${importPath} requires sources or packages.`,\n );\n }\n if (entry.allow === undefined) {\n throw new Error(\n `muon.json ${importPath}.allow is required in validate mode.`,\n );\n }\n if (entry.allow.length === 0) {\n throw new Error(\n `muon.json ${importPath}.allow must not be empty in validate mode.`,\n );\n }\n }\n continue;\n }\n\n if (plugin.allow === undefined) {\n throw new Error(\n `muon.json ${pluginPath}.allow is required in simple mode.`,\n );\n }\n if (plugin.imports !== undefined) {\n throw new Error(\n `muon.json ${pluginPath}.imports is only supported in validate mode.`,\n );\n }\n }\n return resolved;\n};\n\n/**\n * Reads and validates public plugin settings for an already loaded configuration.\n * @param config - Parsed application configuration.\n * @param defaultMode - Exposure mode used when the application omits it.\n * @returns Explicit settings, preserving omitted plugin and page lists.\n */\nexport const readMuonPluginAccessOptions = (\n config: Record<string, unknown>,\n defaultMode: MuonPluginAccessMode,\n): MuonPluginAccessOptions => {\n const options = readPluginAccessOptions(config);\n validatePluginAccessOptions({\n ...options,\n mode: options.mode ?? defaultMode,\n pages: options.pages ?? defaultPluginPages,\n plugins: options.plugins ?? [],\n });\n return options;\n};\n\nconst getValidateImportAllow = (\n entry: MuonPluginAccessImportOptions,\n pluginIndex: number,\n importIndex: number,\n): readonly string[] => {\n if (entry.allow === undefined || entry.allow.length === 0) {\n throw new Error(\n `muon.json plugin.plugins[${pluginIndex}].imports[${importIndex}].allow is required in validate mode.`,\n );\n }\n return entry.allow;\n};\n\nconst getSimplePluginAllow = (\n plugin: MuonPluginAccessEntryOptions,\n pluginIndex: number,\n): readonly string[] => {\n if (plugin.allow === undefined) {\n throw new Error(\n `muon.json plugin.plugins[${pluginIndex}].allow is required in simple mode.`,\n );\n }\n return plugin.allow;\n};\n\nconst toCapabilityImports = (\n plugins: readonly MuonPluginAccessEntryOptions[],\n): readonly MuonCapabilityImportOptions[] =>\n plugins.flatMap((plugin, pluginIndex) =>\n (plugin.imports ?? []).map((entry, importIndex) => {\n if (!hasImportSourceSelector(entry)) {\n throw new Error(\n `muon.json plugin.plugins[${pluginIndex}].imports[${importIndex}] requires sources or packages.`,\n );\n }\n\n const rule: MuonCapabilityImportOptions = {\n allow: getValidateImportAllow(entry, pluginIndex, importIndex),\n pluginName: plugin.name,\n };\n if (entry.sources !== undefined) {\n rule.sources = entry.sources;\n }\n if (entry.packages !== undefined) {\n rule.packages = entry.packages;\n }\n return rule;\n }),\n );\n\nconst toValidateRuntimePluginEntries = (\n plugins: readonly MuonPluginAccessEntryOptions[],\n): readonly MuonRuntimePluginEntryConfig[] =>\n plugins.map((plugin, pluginIndex) => {\n const allow: string[] = [];\n const seenAllow = new Set<string>();\n for (const [importIndex, entry] of (plugin.imports ?? []).entries()) {\n for (const functionPath of getValidateImportAllow(\n entry,\n pluginIndex,\n importIndex,\n )) {\n if (!seenAllow.has(functionPath)) {\n seenAllow.add(functionPath);\n allow.push(functionPath);\n }\n }\n }\n return {\n name: plugin.name,\n ...(plugin.signature === undefined\n ? {}\n : { signature: plugin.signature }),\n ...(plugin.salt === undefined ? {} : { salt: plugin.salt }),\n ...(plugin.config === undefined ? {} : { config: plugin.config }),\n allow,\n };\n });\n\nconst toSimpleRuntimePluginEntries = (\n plugins: readonly MuonPluginAccessEntryOptions[],\n): readonly MuonRuntimePluginEntryConfig[] =>\n plugins.map((plugin, pluginIndex) => ({\n name: plugin.name,\n ...(plugin.signature === undefined ? {} : { signature: plugin.signature }),\n ...(plugin.salt === undefined ? {} : { salt: plugin.salt }),\n ...(plugin.config === undefined ? {} : { config: plugin.config }),\n allow: [...getSimplePluginAllow(plugin, pluginIndex)],\n }));\n\nconst shouldOverlayRuntimePlugins = (\n resolved: EffectivePluginAccessOptions,\n override: false | MuonPluginAccessOptions | undefined,\n): boolean =>\n override !== false &&\n (override?.plugins !== undefined ||\n (resolved.mode === \"validate\" && resolved.plugins.length > 0));\n\nconst toRuntimePluginEntries = (\n resolved: EffectivePluginAccessOptions,\n): readonly MuonRuntimePluginEntryConfig[] =>\n resolved.mode === \"validate\"\n ? toValidateRuntimePluginEntries(resolved.plugins)\n : toSimpleRuntimePluginEntries(resolved.plugins);\n\nconst mergePluginAccessOptions = (\n base: MuonPluginAccessOptions,\n override: MuonPluginAccessOptions | undefined,\n): EffectivePluginAccessOptions => ({\n ...((override?.path ?? base.path) === undefined\n ? {}\n : { path: override?.path ?? base.path }),\n mode: override?.mode ?? base.mode ?? \"validate\",\n pages: override?.pages ?? base.pages ?? defaultPluginPages,\n plugins: override?.plugins ?? base.plugins ?? [],\n});\n\nconst createRuntimeOverlay = (\n root: string,\n resolved: EffectivePluginAccessOptions,\n override: false | MuonPluginAccessOptions | undefined,\n): MuonPluginAccessRuntimeOverlay => {\n if (override === false) {\n return {};\n }\n\n const path =\n override?.path !== undefined ? resolve(root, override.path) : undefined;\n const plugins = shouldOverlayRuntimePlugins(resolved, override)\n ? toRuntimePluginEntries(resolved)\n : undefined;\n\n return {\n pages: resolved.pages,\n ...(path === undefined ? {} : { path }),\n ...(plugins === undefined ? {} : { plugins }),\n };\n};\n\nconst resolveInspectorPluginPath = (\n root: string,\n configPath: string | undefined,\n resolved: EffectivePluginAccessOptions,\n override: false | MuonPluginAccessOptions | undefined,\n): string => {\n if (override !== false && override?.path !== undefined) {\n return resolve(root, override.path);\n }\n const basePath = configPath === undefined ? root : resolve(configPath, \"..\");\n return resolve(basePath, resolved.path ?? \"./plugins\");\n};\n\n/**\n * Resolves public plugin access config from muon.json and Vite overrides.\n *\n * @param input Resolution inputs.\n * @returns Effective plugin access config for bundler integrations.\n */\nexport const resolveMuonPluginAccessOptions = async ({\n root,\n configPath,\n pluginAccess,\n onConfigReadError,\n}: ResolveMuonPluginAccessOptionsInput): Promise<MuonResolvedPluginAccessOptions> => {\n const resolvedConfigPath = await resolveMuonConfigPath(root, configPath);\n let base: MuonPluginAccessOptions = {};\n if (resolvedConfigPath !== undefined) {\n try {\n base = readPluginAccessOptions(\n await readJsonObjectFile(resolvedConfigPath, \"muon config file\"),\n );\n } catch (error) {\n if (onConfigReadError === undefined) {\n throw error;\n }\n onConfigReadError(error);\n }\n }\n\n if (pluginAccess === false) {\n const resolved = validatePluginAccessOptions(\n mergePluginAccessOptions(base, { mode: \"simple\" }),\n );\n return {\n nativeDirectory:\n resolvedConfigPath === undefined\n ? root\n : resolve(resolvedConfigPath, \"..\"),\n mode: \"simple\",\n pages: resolved.pages,\n capabilityOptions: { imports: [] },\n runtimeOverlay: createRuntimeOverlay(root, resolved, pluginAccess),\n pluginPath: resolveInspectorPluginPath(\n root,\n resolvedConfigPath,\n resolved,\n pluginAccess,\n ),\n plugins: resolved.plugins,\n };\n }\n\n const resolved = validatePluginAccessOptions(\n mergePluginAccessOptions(base, pluginAccess),\n );\n const capabilityOptions: MuonCapabilityOptions = {\n imports:\n resolved.mode === \"validate\" ? toCapabilityImports(resolved.plugins) : [],\n };\n return {\n mode: resolved.mode,\n nativeDirectory:\n pluginAccess?.plugins === undefined && resolvedConfigPath !== undefined\n ? resolve(resolvedConfigPath, \"..\")\n : root,\n pages: resolved.pages,\n capabilityOptions,\n runtimeOverlay: createRuntimeOverlay(root, resolved, pluginAccess),\n pluginPath: resolveInspectorPluginPath(\n root,\n resolvedConfigPath,\n resolved,\n pluginAccess,\n ),\n plugins: resolved.plugins,\n };\n};\n","/*!\n* name: muon-plugin-sdk\n* version: 0.26.47\n* description: Native C and C++ plugin development kit for muon-ui\n* author: Kouji Matsui (@kekyo@mi.kekyo.net)\n* license: MIT\n* repository.url: https://github.com/kekyo/muon-ui.git\n* git.commit.hash: 95dc2712686873c8a022483fd9abf18598019bd7\n*/\nimport { copyFile, cp, mkdir, mkdtemp, readFile, realpath, rm, writeFile } from \"node:fs/promises\";\nimport { basename, dirname, isAbsolute, join, relative, resolve, sep } from \"node:path\";\nimport { createHash } from \"node:crypto\";\nvar runtime_profile_default = {\n\tpluginAbi: 1,\n\tndkVersion: \"29.0.14206865\",\n\tandroidApi: 24,\n\tcardioHeaderSha256: \"9c479b0487588cee284dc0f525916008e2277132a81052a9a7291212ee202af4\",\n\tcardioDefinitions: {\n\t\t\"linux\": [\n\t\t\t\"CARDIO_SHARED_LIB=1\",\n\t\t\t\"CARDIO_WITH_LINUX_IO_URING=0\",\n\t\t\t\"CARDIO_WITH_SUPPLEMENTAL=1\",\n\t\t\t\"CARDIO_HAS_POSIX_FD=1\",\n\t\t\t\"CARDIO_WITH_GLIB=1\",\n\t\t\t\"CARDIO_WITH_GIO=1\"\n\t\t],\n\t\t\"windows\": [\n\t\t\t\"CARDIO_SHARED_LIB=1\",\n\t\t\t\"CARDIO_WITH_LINUX_IO_URING=0\",\n\t\t\t\"CARDIO_WITH_SUPPLEMENTAL=1\"\n\t\t],\n\t\t\"android\": [\n\t\t\t\"CARDIO_SHARED_LIB=1\",\n\t\t\t\"CARDIO_WITH_LINUX_IO_URING=0\",\n\t\t\t\"CARDIO_HAS_POSIX_FD=1\"\n\t\t]\n\t}\n};\n//#endregion\n//#region src/targets.ts\n/** Plugin ABI supported by this SDK and matching muon runtimes. */\nvar muonPluginAbiVersion = runtime_profile_default.pluginAbi;\n/** NDK revision used by the matching Android runtime. */\nvar muonPluginNdkVersion = runtime_profile_default.ndkVersion;\n/** Android API level required by the shared runtime. */\nvar muonPluginAndroidApi = runtime_profile_default.androidApi;\n/** Exact cardio header revision required by the SDK and shared runtime. */\nvar muonPluginCardioHeaderSha256 = runtime_profile_default.cardioHeaderSha256;\n/** All targets supported by muon-plugin-sdk. */\nvar muonPluginTargets = [\n\t\"linux-amd64\",\n\t\"linux-armhf\",\n\t\"linux-arm64\",\n\t\"windows-i686\",\n\t\"windows-amd64\",\n\t\"android-arm64-v8a\",\n\t\"android-x86_64\"\n];\n/**\n* Gets native build requirements without probing the build machine.\n* @param target - Explicit output target, independent of the host architecture.\n* @returns The compiler, dependency and linker requirements.\n*/\nvar getPluginTarget = (target) => {\n\tif (!muonPluginTargets.includes(target)) throw new Error(`Unsupported muon plugin target: ${target}`);\n\tconst os = target.startsWith(\"windows-\") ? \"windows\" : target.startsWith(\"android-\") ? \"android\" : \"linux\";\n\tconst prefix = {\n\t\t\"linux-amd64\": \"\",\n\t\t\"linux-armhf\": \"arm-linux-gnueabihf-\",\n\t\t\"linux-arm64\": \"aarch64-linux-gnu-\",\n\t\t\"windows-i686\": \"i686-w64-mingw32-\",\n\t\t\"windows-amd64\": \"x86_64-w64-mingw32-\",\n\t\t\"android-arm64-v8a\": `aarch64-linux-android${muonPluginAndroidApi}-`,\n\t\t\"android-x86_64\": `x86_64-linux-android${muonPluginAndroidApi}-`\n\t}[target];\n\treturn {\n\t\ttarget,\n\t\tos,\n\t\tcc: prefix + (os === \"android\" ? \"clang\" : \"gcc\"),\n\t\tcxx: prefix + (os === \"android\" ? \"clang++\" : \"g++\"),\n\t\textension: os === \"windows\" ? \".dll\" : \".so\",\n\t\tcardioLibrary: os === \"windows\" ? \"libcardio.dll\" : \"libcardio.so\",\n\t\tcardioLinkLibrary: os === \"windows\" ? \"libcardio.dll.a\" : \"libcardio.so\",\n\t\tdefinitions: runtime_profile_default.cardioDefinitions[os],\n\t\tpackages: os === \"linux\" ? [\"glib-2.0\", \"gio-2.0 >= 2.74\"] : [],\n\t\tcflags: os === \"windows\" ? [] : [\"-fPIC\", \"-pthread\"],\n\t\tldflags: os === \"android\" ? [\"-Wl,-z,max-page-size=16384\", \"-landroid\"] : os === \"windows\" ? [] : [\"-pthread\"]\n\t};\n};\n//#endregion\n//#region src/binary.ts\n/**\n* Validates the binary format and architecture and reads loader metadata.\n* @param data - Complete final library bytes.\n* @param target - Required output platform.\n* @returns Symbols and shared library dependencies; never runs native code.\n*/\nvar inspectPluginBinary = (data, target) => {\n\tconst descriptor = getPluginTarget(target);\n\tconst range = (offset, length) => {\n\t\tif (!Number.isSafeInteger(offset) || !Number.isSafeInteger(length) || offset < 0 || length < 0 || offset + length > data.length) throw new Error(\"Native library contains an invalid table or offset.\");\n\t\treturn offset;\n\t};\n\tconst u16 = (offset) => data.readUInt16LE(range(offset, 2));\n\tconst u32 = (offset) => data.readUInt32LE(range(offset, 4));\n\tconst u64 = (offset) => {\n\t\tconst value = data.readBigUInt64LE(range(offset, 8));\n\t\tif (value > BigInt(Number.MAX_SAFE_INTEGER)) throw new Error(\"Native library offset exceeds the supported size.\");\n\t\treturn Number(value);\n\t};\n\tconst string = (offset, end) => {\n\t\trange(offset, end - offset);\n\t\tconst nul = data.indexOf(0, offset);\n\t\tif (nul < offset || nul >= end) throw new Error(\"Native library contains an unterminated string.\");\n\t\treturn data.toString(\"utf8\", offset, nul);\n\t};\n\tconst exports = [];\n\tconst needed = [];\n\tconst runpath = [];\n\tlet soname;\n\tif (descriptor.os === \"windows\") {\n\t\tif (u16(0) !== 23117) throw new Error(\"Expected a PE DLL.\");\n\t\tconst pe = u32(60);\n\t\tif (u32(pe) !== 17744 || !(u16(pe + 22) & 8192)) throw new Error(\"Expected a PE DLL.\");\n\t\tif (u16(pe + 4) !== (target === \"windows-i686\" ? 332 : 34404)) throw new Error(`PE machine does not match ${target}.`);\n\t\tconst optional = pe + 24;\n\t\tconst is64 = u16(optional) === 523;\n\t\tif (u16(optional) !== (target === \"windows-i686\" ? 267 : 523)) throw new Error(\"Invalid PE optional header.\");\n\t\tconst table = optional + u16(pe + 20);\n\t\tconst sections = Array.from({ length: u16(pe + 6) }, (_, i) => {\n\t\t\tconst offset = table + i * 40;\n\t\t\treturn {\n\t\t\t\taddress: u32(offset + 12),\n\t\t\t\tsize: u32(offset + 16),\n\t\t\t\toffset: u32(offset + 20)\n\t\t\t};\n\t\t});\n\t\tconst rva = (address, size) => {\n\t\t\tconst section = sections.find((item) => address >= item.address && address + size <= item.address + item.size);\n\t\t\tif (!section) throw new Error(\"Invalid PE virtual address.\");\n\t\t\treturn range(section.offset + address - section.address, size);\n\t\t};\n\t\tconst directory = optional + (is64 ? 112 : 96);\n\t\tconst exportAddress = u32(directory);\n\t\tif (exportAddress) {\n\t\t\tconst entry = rva(exportAddress, 40);\n\t\t\tconst count = u32(entry + 24);\n\t\t\tconst names = rva(u32(entry + 32), count * 4);\n\t\t\tfor (let i = 0; i < count; i++) exports.push(string(rva(u32(names + i * 4), 1), data.length));\n\t\t}\n\t\tconst importAddress = u32(directory + 8);\n\t\tif (importAddress) {\n\t\t\tconst importSize = u32(directory + 12);\n\t\t\tconst base = rva(importAddress, importSize);\n\t\t\tfor (let offset = base; offset + 20 <= base + importSize && u32(offset + 12); offset += 20) needed.push(string(rva(u32(offset + 12), 1), data.length));\n\t\t}\n\t} else {\n\t\tconst is64 = target !== \"linux-armhf\";\n\t\tif (u32(0) !== 1179403647 || data[4] !== (is64 ? 2 : 1) || data[5] !== 1 || u16(16) !== 3) throw new Error(`Expected an ELF${is64 ? 64 : 32} little-endian shared library.`);\n\t\tconst machine = target.includes(\"arm64\") ? 183 : target === \"linux-armhf\" ? 40 : 62;\n\t\tif (u16(18) !== machine) throw new Error(`ELF machine does not match ${target}.`);\n\t\tconst word = is64 ? u64 : u32;\n\t\tconst phoff = word(is64 ? 32 : 28);\n\t\tconst phsize = u16(is64 ? 54 : 42);\n\t\tconst phnum = u16(is64 ? 56 : 44);\n\t\trange(phoff, phsize * phnum);\n\t\tlet loads = 0;\n\t\tfor (let i = 0; i < phnum; i++) {\n\t\t\tconst offset = phoff + i * phsize;\n\t\t\tif (u32(offset) !== 1) continue;\n\t\t\tloads++;\n\t\t\tif (descriptor.os === \"android\" && (word(offset + 48) < 16384 || word(offset + 8) % 16384 !== word(offset + 16) % 16384)) throw new Error(\"Android ELF load segments must support 16 KiB pages.\");\n\t\t}\n\t\tif (!loads) throw new Error(\"ELF has no load segments.\");\n\t\tconst shoff = word(is64 ? 40 : 32);\n\t\tconst shsize = u16(is64 ? 58 : 46);\n\t\tconst shnum = u16(is64 ? 60 : 48);\n\t\trange(shoff, shsize * shnum);\n\t\tconst sections = Array.from({ length: shnum }, (_, i) => {\n\t\t\tconst offset = shoff + i * shsize;\n\t\t\treturn {\n\t\t\t\ttype: u32(offset + 4),\n\t\t\t\toffset: word(offset + (is64 ? 24 : 16)),\n\t\t\t\tsize: word(offset + (is64 ? 32 : 20)),\n\t\t\t\tlink: u32(offset + (is64 ? 40 : 24)),\n\t\t\t\tentrySize: word(offset + (is64 ? 56 : 36))\n\t\t\t};\n\t\t});\n\t\tfor (const section of sections) {\n\t\t\tif (section.type !== 6 && section.type !== 11) continue;\n\t\t\tconst size = section.type === 6 ? is64 ? 16 : 8 : is64 ? 24 : 16;\n\t\t\tif (section.entrySize !== size || section.size % size) throw new Error(\"Invalid ELF dynamic table.\");\n\t\t\trange(section.offset, section.size);\n\t\t\tconst strings = sections[section.link];\n\t\t\tif (!strings) throw new Error(\"Missing ELF string table.\");\n\t\t\trange(strings.offset, strings.size);\n\t\t\tconst name = (index) => string(range(strings.offset + index, 1), strings.offset + strings.size);\n\t\t\tfor (let offset = section.offset; offset < section.offset + section.size; offset += size) if (section.type === 11) {\n\t\t\t\tconst info = data[offset + (is64 ? 4 : 12)];\n\t\t\t\tconst visibility = data[offset + (is64 ? 5 : 13)] & 3;\n\t\t\t\tif ((info >> 4 === 1 || info >> 4 === 2) && visibility === 0 && u16(offset + (is64 ? 6 : 14)) !== 0) exports.push(name(u32(offset)));\n\t\t\t} else {\n\t\t\t\tconst tag = word(offset);\n\t\t\t\tif (tag === 1 || tag === 14 || tag === 15 || tag === 29) {\n\t\t\t\t\tconst value = name(word(offset + (is64 ? 8 : 4)));\n\t\t\t\t\tif (tag === 1) needed.push(value);\n\t\t\t\t\telse if (tag === 14) soname = value;\n\t\t\t\t\telse runpath.push(...value.split(\":\"));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn {\n\t\texports,\n\t\tneeded,\n\t\tsoname,\n\t\trunpath\n\t};\n};\n//#endregion\n//#region src/dependencies.ts\nvar androidSystem = [\n\t\"libc.so\",\n\t\"libm.so\",\n\t\"libdl.so\",\n\t\"liblog.so\",\n\t\"libandroid.so\",\n\t\"libjnigraphics.so\",\n\t\"libz.so\",\n\t\"libEGL.so\",\n\t\"libGLESv2.so\",\n\t\"libGLESv3.so\",\n\t\"libOpenSLES.so\",\n\t\"libvulkan.so\"\n];\nvar linuxSystem = [\n\t\"libc.so.6\",\n\t\"libm.so.6\",\n\t\"libdl.so.2\",\n\t\"libpthread.so.0\",\n\t\"librt.so.1\",\n\t\"libresolv.so.2\",\n\t\"libstdc++.so.6\",\n\t\"libgcc_s.so.1\",\n\t\"libglib-2.0.so.0\",\n\t\"libgobject-2.0.so.0\",\n\t\"libgio-2.0.so.0\"\n];\nvar windowsSystem = [\n\t\"kernel32.dll\",\n\t\"user32.dll\",\n\t\"advapi32.dll\",\n\t\"msvcrt.dll\",\n\t\"ucrtbase.dll\",\n\t\"ntdll.dll\",\n\t\"gdi32.dll\",\n\t\"shell32.dll\",\n\t\"shlwapi.dll\",\n\t\"ole32.dll\",\n\t\"oleaut32.dll\",\n\t\"ws2_32.dll\",\n\t\"bcrypt.dll\",\n\t\"crypt32.dll\",\n\t\"secur32.dll\",\n\t\"version.dll\",\n\t\"winmm.dll\",\n\t\"comdlg32.dll\",\n\t\"comctl32.dll\",\n\t\"setupapi.dll\",\n\t\"iphlpapi.dll\",\n\t\"opengl32.dll\",\n\t\"imm32.dll\",\n\t\"dwmapi.dll\",\n\t\"dbghelp.dll\"\n];\n/**\n* Checks packaged dependencies against the runtime and target's system libraries.\n* @param libraries - Plugin entries and ordinary shared dependencies.\n* @param target - Application output target.\n* @returns Resolves normally when the loader can find every declared dependency.\n* @remarks Files provided by muon or the OS must never be replaced by a plugin.\n*/\nvar validatePluginLibraryDependencies = (libraries, target) => {\n\tconst os = getPluginTarget(target).os;\n\tconst normalize = (name) => os === \"windows\" ? name.toLowerCase() : name;\n\tconst reserved = new Set([...os === \"android\" ? [\n\t\t\"libcardio.so\",\n\t\t\"libc++_shared.so\",\n\t\t\"libmuon_android_rpc.so\"\n\t] : os === \"windows\" ? [\n\t\t\"libcardio.dll\",\n\t\t\"libmuon-ui.dll\",\n\t\t\"libcef.dll\",\n\t\t\"libstdc++-6.dll\",\n\t\t\"libgcc_s_seh-1.dll\",\n\t\t\"libgcc_s_dw2-1.dll\",\n\t\t\"libgcc_s_sjlj-1.dll\",\n\t\t\"libwinpthread-1.dll\"\n\t] : [\n\t\t\"libcardio.so\",\n\t\t\"libmuon-ui.so\",\n\t\t\"libcef.so\"\n\t], ...os === \"android\" ? androidSystem : os === \"windows\" ? windowsSystem : linuxSystem].map(normalize));\n\tconst system = (name) => reserved.has(normalize(name)) || os === \"windows\" && /^(api|ext)-ms-win-[a-z0-9-]+\\.dll$/i.test(name);\n\tconst packaged = new Set(libraries.map((entry) => normalize(basename(entry.path))));\n\tfor (const entry of libraries) {\n\t\tconst name = basename(entry.path);\n\t\tif (system(name)) throw new Error(`Native library name is reserved by the runtime or OS: ${name}`);\n\t\tfor (const dependency of entry.info.needed) {\n\t\t\tif (!system(dependency) && !packaged.has(normalize(dependency))) throw new Error(`${name} requires an unpackaged library: ${dependency}`);\n\t\t\tif (os === \"linux\" && packaged.has(dependency) && !entry.info.runpath.includes(\"$ORIGIN\")) throw new Error(`${name} needs a $ORIGIN runtime search path for packaged dependency ${dependency}.`);\n\t\t}\n\t}\n};\n//#endregion\n//#region src/artifact.ts\nvar digest = (data) => createHash(\"sha256\").update(data).digest(\"hex\");\nvar record = (value) => {\n\tif (!value || typeof value !== \"object\" || Array.isArray(value)) throw new Error(\"Plugin manifest must contain objects.\");\n\treturn value;\n};\nvar paths = (value) => {\n\tif (!Array.isArray(value) || !value.every((item) => typeof item === \"string\" && item.length)) throw new Error(\"Plugin manifest must contain path arrays.\");\n\treturn value;\n};\nvar packagePath = async (directory, path) => {\n\tif (!path || isAbsolute(path) || path.includes(\"\\\\\") || path.includes(\"\\0\") || path.split(\"/\").some((part) => part === \"..\" || part === \"\")) throw new Error(`Invalid plugin artifact path: ${path}`);\n\tconst root = await realpath(directory);\n\tconst absolute = await realpath(resolve(root, path));\n\tconst local = relative(root, absolute);\n\tif (local === \"..\" || local.startsWith(\"..\" + sep) || isAbsolute(local)) throw new Error(`Plugin artifact escapes package: ${path}`);\n\treturn absolute;\n};\n/**\n* Reads and validates prebuilt artifacts without requiring authoring tools.\n* @param path - Manifest file path.\n* @param targets - Required application targets.\n* @returns Verified binaries and the producer catalog.\n*/\nvar readPluginArtifact = async (path, targets) => {\n\tpath = resolve(path);\n\tconst directory = dirname(path);\n\tconst raw = record(JSON.parse(await readFile(path, \"utf8\")));\n\tif (raw.schemaVersion !== 1 || raw.abiVersion !== muonPluginAbiVersion) throw new Error(`Unsupported plugin schema or ABI: ${path}`);\n\tif (typeof raw.name !== \"string\" || !/^[A-Za-z_][A-Za-z0-9_]*$/.test(raw.name) || raw.name === \"internal\") throw new Error(\"Invalid plugin registration name.\");\n\tconst functions = paths(raw.functions);\n\tif (!functions.length || new Set(functions).size !== functions.length || functions.some((item) => !/^[A-Za-z_$][\\w$]*(?:\\.[A-Za-z_$][\\w$]*){2,}$/.test(item))) throw new Error(\"Invalid or duplicate plugin function catalog.\");\n\tfor (const group of [\n\t\t\"headers\",\n\t\t\"types\",\n\t\t\"licenses\"\n\t]) for (const item of paths(raw[group])) await packagePath(directory, item);\n\tconst entries = record(raw.targets);\n\tfor (const target of Object.keys(entries)) getPluginTarget(target);\n\tconst resolved = {};\n\tfor (const target of targets) {\n\t\tgetPluginTarget(target);\n\t\tif (!entries[target]) throw new Error(`Plugin ${raw.name} does not support ${target}.`);\n\t\tconst entry = record(entries[target]);\n\t\tconst runtime = record(entry.runtime);\n\t\tconst descriptor = getPluginTarget(target);\n\t\tif (typeof runtime.cardio !== \"boolean\" || runtime.cardio && runtime.cardioAbi !== `muon-${muonPluginAbiVersion}-${muonPluginCardioHeaderSha256}-${target}`) throw new Error(\"Plugin cardio ABI does not match this runtime.\");\n\t\tif (runtime.cpp !== void 0 && runtime.cpp !== (descriptor.os === \"android\" ? \"c++_shared\" : \"libstdc++\")) throw new Error(\"Plugin C++ runtime does not match this target.\");\n\t\tif (descriptor.os === \"android\" && (runtime.ndk !== muonPluginNdkVersion || runtime.androidApi !== muonPluginAndroidApi)) throw new Error(\"Plugin NDK or Android API does not match this runtime.\");\n\t\tconst read = async (value, plugin) => {\n\t\t\tconst file = record(value);\n\t\t\tif (typeof file.path !== \"string\" || typeof file.sha256 !== \"string\" || !/^[a-f0-9]{64}$/.test(file.sha256)) throw new Error(\"Invalid plugin file or SHA-256.\");\n\t\t\tconst absolute = await packagePath(directory, file.path);\n\t\t\tconst data = await readFile(absolute);\n\t\t\tif (digest(data) !== file.sha256) throw new Error(`Plugin SHA-256 mismatch: ${file.path}`);\n\t\t\tconst info = inspectPluginBinary(data, target);\n\t\t\tif (plugin && !info.exports.includes(\"muon_init_plugin\")) throw new Error(`${file.path} must export muon_init_plugin.`);\n\t\t\tif (descriptor.os !== \"windows\" && info.soname !== basename(absolute)) throw new Error(`${file.path} ELF SONAME must match its packaged name.`);\n\t\t\treturn {\n\t\t\t\tpath: absolute,\n\t\t\t\tinfo\n\t\t\t};\n\t\t};\n\t\tconst library = await read(entry.library, true);\n\t\tif (!Array.isArray(entry.dependencies) || !Array.isArray(entry.linkLibraries)) throw new Error(\"Plugin dependencies and linkLibraries must be arrays.\");\n\t\tconst dependencies = [];\n\t\tconst inspections = [{\n\t\t\tpath: library.path,\n\t\t\tinfo: library.info\n\t\t}];\n\t\tfor (const dependency of entry.dependencies) {\n\t\t\tconst inspected = await read(dependency, false);\n\t\t\tdependencies.push(inspected.path);\n\t\t\tinspections.push(inspected);\n\t\t}\n\t\tvalidatePluginLibraryDependencies(inspections, target);\n\t\tfor (const value of entry.linkLibraries) {\n\t\t\tconst file = record(value);\n\t\t\tif (typeof file.path !== \"string\" || digest(await readFile(await packagePath(directory, file.path))) !== file.sha256) throw new Error(\"Plugin link input SHA-256 mismatch.\");\n\t\t}\n\t\tresolved[target] = {\n\t\t\tlibrary: library.path,\n\t\t\tdependencies,\n\t\t\tbinary: library.info\n\t\t};\n\t}\n\treturn {\n\t\tpath,\n\t\tmanifest: raw,\n\t\ttargets: resolved\n\t};\n};\n/**\n* Copies final build outputs and writes their verified artifact manifest.\n* @param options - Producer metadata and final native files.\n* @returns Absolute muon-plugin.json path suitable for local use or NPM export.\n* @remarks All strip and signing operations must precede this operation.\n*/\nvar packagePlugin = async (options) => {\n\tconst destinationRoot = resolve(options.outputDirectory);\n\tawait mkdir(dirname(destinationRoot), { recursive: true });\n\tconst output = await mkdtemp(join(dirname(destinationRoot), \".muon-plugin-\"));\n\ttry {\n\t\tconst copy = async (path, directory) => {\n\t\t\tconst destination = join(directory, basename(path));\n\t\t\tconst absolute = join(output, destination);\n\t\t\tawait mkdir(dirname(absolute), { recursive: true });\n\t\t\tif (resolve(path) !== absolute) await copyFile(path, absolute);\n\t\t\treturn {\n\t\t\t\tpath: destination.split(sep).join(\"/\"),\n\t\t\t\tsha256: digest(await readFile(absolute))\n\t\t\t};\n\t\t};\n\t\tconst resources = async (inputs, directory) => {\n\t\t\tif (new Set(inputs.map((path) => basename(path))).size !== inputs.length) throw new Error(`Duplicate plugin ${directory} filename.`);\n\t\t\tconst result = [];\n\t\t\tfor (const path of inputs) result.push((await copy(path, directory)).path);\n\t\t\treturn result;\n\t\t};\n\t\tconst targets = {};\n\t\tfor (const [key, input] of Object.entries(options.targets)) {\n\t\t\tconst target = key;\n\t\t\tconst descriptor = getPluginTarget(target);\n\t\t\tconst native = `native/${target}`;\n\t\t\tconst dependencies = [];\n\t\t\tconst linkLibraries = [];\n\t\t\tif (new Set([input.library, ...input.dependencies ?? []].map((path) => basename(path).toLowerCase())).size !== 1 + (input.dependencies?.length ?? 0)) throw new Error(\"Duplicate plugin native filename.\");\n\t\t\tfor (const path of input.dependencies ?? []) dependencies.push(await copy(path, native));\n\t\t\tfor (const path of input.linkLibraries ?? []) linkLibraries.push(await copy(path, `${native}/link`));\n\t\t\tconst cardio = input.cardio ?? input.language !== \"c\";\n\t\t\ttargets[target] = {\n\t\t\t\tlibrary: await copy(input.library, native),\n\t\t\t\tdependencies,\n\t\t\t\tlinkLibraries,\n\t\t\t\truntime: {\n\t\t\t\t\tcardio,\n\t\t\t\t\t...cardio ? { cardioAbi: `muon-${muonPluginAbiVersion}-${muonPluginCardioHeaderSha256}-${target}` } : {},\n\t\t\t\t\t...input.language === \"c\" ? {} : { cpp: descriptor.os === \"android\" ? \"c++_shared\" : \"libstdc++\" },\n\t\t\t\t\t...descriptor.os === \"android\" ? {\n\t\t\t\t\t\tndk: muonPluginNdkVersion,\n\t\t\t\t\t\tandroidApi: muonPluginAndroidApi\n\t\t\t\t\t} : {}\n\t\t\t\t}\n\t\t\t};\n\t\t}\n\t\tconst manifest = {\n\t\t\tschemaVersion: 1,\n\t\t\tabiVersion: muonPluginAbiVersion,\n\t\t\tname: options.name,\n\t\t\tfunctions: options.functions,\n\t\t\theaders: await resources(options.headers ?? [], \"include\"),\n\t\t\ttypes: await resources(options.types ?? [], \"types\"),\n\t\t\tlicenses: await resources(options.licenses ?? [], \"licenses\"),\n\t\t\ttargets\n\t\t};\n\t\tconst path = join(output, \"muon-plugin.json\");\n\t\tawait writeFile(path, JSON.stringify(manifest, null, 2) + \"\\n\");\n\t\tawait readPluginArtifact(path, Object.keys(targets));\n\t\tawait cp(output, destinationRoot, { recursive: true });\n\t\treturn join(destinationRoot, \"muon-plugin.json\");\n\t} finally {\n\t\tawait rm(output, {\n\t\t\trecursive: true,\n\t\t\tforce: true\n\t\t});\n\t}\n};\n//#endregion\nexport { getPluginTarget as a, muonPluginCardioHeaderSha256 as c, inspectPluginBinary as i, muonPluginNdkVersion as l, readPluginArtifact as n, muonPluginAbiVersion as o, validatePluginLibraryDependencies as r, muonPluginAndroidApi as s, packagePlugin as t, muonPluginTargets as u };\n","/*!\n* name: muon-plugin-sdk\n* version: 0.26.47\n* description: Native C and C++ plugin development kit for muon-ui\n* author: Kouji Matsui (@kekyo@mi.kekyo.net)\n* license: MIT\n* repository.url: https://github.com/kekyo/muon-ui.git\n* git.commit.hash: 95dc2712686873c8a022483fd9abf18598019bd7\n*/\nimport { i as inspectPluginBinary, n as readPluginArtifact, r as validatePluginLibraryDependencies, t as packagePlugin } from \"./artifact-DcfIPRjn.mjs\";\nexport { inspectPluginBinary, packagePlugin, readPluginArtifact, validatePluginLibraryDependencies };\n","// muon - Multi-platform GUI application framework that uses CEF as its backend\n// Copyright (c) Kouji Matsui. (@kekyo@mi.kekyo.net)\n// Under MIT.\n// https://github.com/kekyo/muon-ui\n\n/** Browser functions implemented by Android. */\nexport const browserFunctionNames = [\n 'reload',\n 'toggleFullscreen',\n 'enterFullscreen',\n 'exitFullscreen',\n 'zoomIn',\n 'zoomOut',\n 'resetZoom',\n 'close',\n] as const;\n\n/** Environment functions implemented by Android. */\nexport const environmentFunctionNames = [\n 'getVariables',\n 'getConfigValues',\n 'getProcessId',\n 'getRuntimeInfo',\n] as const;\n\n/** Filesystem functions implemented by Android. */\nexport const filesystemFunctionNames = [\n 'readFile',\n 'writeFile',\n 'readTextFile',\n 'writeTextFile',\n 'stat',\n 'lstat',\n 'exists',\n 'access',\n 'readdir',\n 'mkdir',\n 'rm',\n 'unlink',\n 'rmdir',\n 'rename',\n 'copyFile',\n 'appendFile',\n 'appendTextFile',\n 'truncate',\n 'realpath',\n 'readlink',\n 'symlink',\n 'watch',\n] as const;\n\n/** Fully-qualified built-in function paths implemented by the Android backend. */\nexport const muonAndroidBuiltinFunctionPaths = [\n ...browserFunctionNames.map((name) => `muon.browser.${name}` as const),\n ...environmentFunctionNames.map(\n (name) => `muon.environments.${name}` as const\n ),\n ...filesystemFunctionNames.map((name) => `muon.fs.${name}` as const),\n] as const;\n\n/** A built-in function path available on Android. */\nexport type MuonAndroidBuiltinFunctionPath =\n (typeof muonAndroidBuiltinFunctionPaths)[number];\n\nconst escapeRegularExpression = (source: string): string =>\n source.replace(/[\\\\^$+?.()|[\\]{}]/gu, '\\\\$&');\n\nconst createFunctionAllowExpression = (allow: string): RegExp => {\n let source = '^';\n for (let index = 0; index < allow.length; index += 1) {\n const character = allow[index] ?? '';\n const next = allow[index + 1];\n if (character === '*' && next === '*') {\n source += '.*';\n index += 1;\n } else if (character === '*') {\n source += '[^.]*';\n } else {\n source += escapeRegularExpression(character);\n }\n }\n source += '$';\n return new RegExp(source, 'u');\n};\n\n/**\n * Expands Android capability allow patterns into available function paths.\n *\n * @param allows - Exact paths or glob patterns requested by a validate build.\n * @param catalog - Available public functions; defaults to Android builtins.\n * @returns Available Android paths in stable metadata order.\n * @remarks An exact unsupported path, or a pattern matching no Android\n * functions, fails during the build instead of producing a runtime stub.\n */\nexport const expandMuonAndroidFunctionAllows = (\n allows: readonly string[],\n catalog: readonly string[] = muonAndroidBuiltinFunctionPaths\n): readonly string[] => {\n const selected = new Set<string>();\n for (const allow of allows) {\n if (!allow.includes('*')) {\n const functionPath = catalog.find((candidate) => candidate === allow);\n if (functionPath === undefined) {\n throw new Error(`Muon function is unavailable for Android: ${allow}`);\n }\n selected.add(functionPath);\n continue;\n }\n\n const expression = createFunctionAllowExpression(allow);\n const matches = catalog.filter((functionPath) =>\n expression.test(functionPath)\n );\n if (matches.length === 0) {\n throw new Error(\n `Muon function pattern is unavailable for Android: ${allow}`\n );\n }\n for (const functionPath of matches) {\n selected.add(functionPath);\n }\n }\n return catalog.filter((functionPath) => selected.has(functionPath));\n};\n","// muon - Multi-platform GUI application framework that uses CEF as its backend\n// Copyright (c) Kouji Matsui. (@kekyo@mi.kekyo.net)\n// Under MIT.\n// https://github.com/kekyo/muon-ui\n\nimport { randomBytes } from \"node:crypto\";\nimport { existsSync, readFileSync } from \"node:fs\";\nimport { dirname, join, relative } from \"node:path\";\nimport { muonAndroidBuiltinFunctionPaths } from \"../../core/android/function-paths.js\";\n\n/**\n * Import-side capability rule for muon plugin virtual modules.\n */\nexport interface MuonCapabilityImportOptions {\n /**\n * Importer path globs relative to the bundler project root.\n */\n sources?: readonly string[];\n /**\n * NPM package names allowed to import the virtual module.\n */\n packages?: readonly string[];\n /**\n * Plugin function path globs allowed for matching importers.\n */\n allow: readonly string[];\n /**\n * Plugin entry name that supplied this rule.\n *\n * @internal\n */\n pluginName?: string;\n}\n\n/**\n * Capability import configuration shared by bundler integrations.\n */\nexport interface MuonCapabilityOptions {\n /** Renderer calling convention and built-in catalog. Defaults to CEF. */\n backend?: \"cef\" | \"android\";\n /**\n * Capability imports allowed by importer path.\n */\n imports?: readonly MuonCapabilityImportOptions[];\n /**\n * Known public plugin function paths available for wildcard export expansion.\n *\n * @remarks Exact `imports[].allow` entries do not require this catalog.\n * Wildcard entries are expanded against these paths only when generating\n * virtual module named exports; runtime permission policies keep the original\n * wildcard patterns.\n */\n functionPaths?: readonly string[];\n}\n\n/**\n * Runtime capability policy generated for muon-core.\n */\nexport interface MuonCapabilityRuntimeEntry {\n /**\n * Opaque capability id embedded into generated virtual modules.\n */\n id: string;\n /**\n * Plugin function path globs allowed for this capability.\n */\n allow: readonly string[];\n}\n\n/**\n * Runtime plugin entry generated for muon-core config overlays.\n */\nexport interface MuonRuntimePluginEntryConfig {\n /** Verified producer catalog after applying the application allow policy. */\n expectedFunctions?: readonly string[];\n /**\n * Plugin entry name.\n */\n name: string;\n /**\n * Optional 64-character hexadecimal SHA-256 digest of the final external\n * `.so` or `.dll` file bytes followed by the decoded `salt` bytes.\n *\n * @remarks Calculate this after all library post-processing, including\n * stripping and code signing. It is not supported for `internal`.\n */\n signature?: string;\n /**\n * Optional hex-encoded salt whose decoded bytes are appended when checking\n * the plugin signature.\n *\n * @remarks Required when `signature` is specified. It is not supported for\n * `internal`.\n */\n salt?: string;\n /**\n * Plugin-defined string key-value configuration entries.\n */\n config?: Readonly<Record<string, string>>;\n /**\n * Plugin function path globs allowed for this plugin entry.\n */\n allow: readonly string[];\n}\n\n/**\n * Runtime plugin configuration generated for validate mode.\n */\nexport interface MuonCapabilityRuntimePluginConfig {\n /**\n * Plugin exposure mode.\n */\n mode: \"validate\";\n /**\n * Plugin bridge page URL allowlist.\n */\n pages?: readonly string[];\n /**\n * External plugin path override.\n */\n path?: string;\n /**\n * Plugin loading allowlist override.\n */\n plugins?: readonly MuonRuntimePluginEntryConfig[];\n /**\n * Capability policies consumed by muon-core.\n */\n capabilities: readonly MuonCapabilityRuntimeEntry[];\n}\n\n/**\n * Runtime plugin configuration for simple window-global exposure.\n */\nexport interface MuonSimpleRuntimePluginConfig {\n /**\n * Plugin exposure mode.\n */\n mode: \"simple\";\n /**\n * Plugin bridge page URL allowlist.\n */\n pages?: readonly string[];\n /**\n * External plugin path override.\n */\n path?: string;\n /**\n * Plugin loading allowlist override.\n */\n plugins?: readonly MuonRuntimePluginEntryConfig[];\n}\n\n/**\n * Runtime plugin configuration generated by a build integration.\n */\nexport type MuonRuntimePluginConfig =\n MuonCapabilityRuntimePluginConfig | MuonSimpleRuntimePluginConfig;\n\n/**\n * Resolved virtual module.\n */\nexport interface MuonResolvedCapabilityModule {\n /**\n * Bundler-internal virtual id.\n */\n id: string;\n}\n\n/**\n * Bundler-independent virtual module resolver.\n */\nexport interface MuonCapabilityModuleResolver {\n /**\n * Resolves a muon virtual module specifier for one importer.\n */\n resolveId: (\n source: string,\n importer: string | undefined,\n ) => MuonResolvedCapabilityModule | undefined;\n /**\n * Loads the generated source for a resolved virtual module id.\n */\n load: (id: string) => string | undefined;\n /**\n * Returns runtime plugin config generated from all capability rules.\n */\n getRuntimePluginConfig: () => MuonCapabilityRuntimePluginConfig;\n}\n\ninterface ParsedCapabilitySpecifier {\n moduleName: string;\n namespace: string;\n}\n\ninterface ResolvedRule {\n index: number;\n id: string;\n rule: MuonCapabilityImportOptions;\n namespace: string;\n moduleName: string;\n functionPaths: readonly string[];\n backend: \"cef\" | \"android\";\n}\n\nconst virtualModulePrefix = \"\\0muon-capability:\";\nconst capabilityIdByteLength = 16;\nconst moduleNamePattern =\n /^[A-Za-z_$][A-Za-z0-9_$]*:[A-Za-z_$][A-Za-z0-9_$]*(?:\\.[A-Za-z_$][A-Za-z0-9_$]*)*$/u;\nconst jsIdentifierPattern = /^[A-Za-z_$][A-Za-z0-9_$]*$/u;\nconst defaultMuonCapabilityFunctionPaths = [\n \"muon.browser.reload\",\n \"muon.browser.hardReload\",\n \"muon.browser.toggleFullscreen\",\n \"muon.browser.enterFullscreen\",\n \"muon.browser.exitFullscreen\",\n \"muon.browser.zoomIn\",\n \"muon.browser.zoomOut\",\n \"muon.browser.resetZoom\",\n \"muon.browser.show\",\n \"muon.browser.hide\",\n \"muon.browser.focus\",\n \"muon.browser.blur\",\n \"muon.browser.minimize\",\n \"muon.browser.maximize\",\n \"muon.browser.restore\",\n \"muon.browser.setTitleBarVisibility\",\n \"muon.browser.setTitleBarIcon\",\n \"muon.browser.getWindowBounds\",\n \"muon.browser.setWindowBounds\",\n \"muon.browser.setContextMenuItems\",\n \"muon.browser.clearContextMenuItems\",\n \"muon.browser.createTray\",\n \"muon.browser.setTrayMenu\",\n \"muon.browser.setTrayIcon\",\n \"muon.browser.setTrayTooltip\",\n \"muon.browser.removeTray\",\n \"muon.browser.close\",\n \"muon.browser.shutdown\",\n \"muon.browser.recycle\",\n \"muon.environments.getVariables\",\n \"muon.environments.getConfigValues\",\n \"muon.environments.getCommandLine\",\n \"muon.environments.getProcessId\",\n \"muon.environments.getRuntimeInfo\",\n \"muon.environments.getAutostart\",\n \"muon.environments.setAutostart\",\n \"muon.executor.spawn\",\n \"muon.executor.loadLibrary\",\n \"muon.fs.readFile\",\n \"muon.fs.writeFile\",\n \"muon.fs.readTextFile\",\n \"muon.fs.writeTextFile\",\n \"muon.fs.stat\",\n \"muon.fs.lstat\",\n \"muon.fs.exists\",\n \"muon.fs.access\",\n \"muon.fs.readdir\",\n \"muon.fs.mkdir\",\n \"muon.fs.rm\",\n \"muon.fs.unlink\",\n \"muon.fs.rmdir\",\n \"muon.fs.rename\",\n \"muon.fs.copyFile\",\n \"muon.fs.appendFile\",\n \"muon.fs.appendTextFile\",\n \"muon.fs.truncate\",\n \"muon.fs.realpath\",\n \"muon.fs.readlink\",\n \"muon.fs.symlink\",\n \"muon.fs.watch\",\n \"muon.fs.dialogs.selectFile\",\n \"muon.fs.dialogs.selectFiles\",\n \"muon.fs.dialogs.selectDirectory\",\n \"muon.fs.dialogs.selectDirectories\",\n \"muon.fs.dialogs.selectSaveFile\",\n \"muon.launcher.getSettings\",\n \"muon.launcher.setSettings\",\n \"muon.launcher.triggerUpdate\",\n] as const;\n\nconst normalizePath = (path: string): string =>\n (path.split(\"?\")[0] ?? \"\").replaceAll(\"\\\\\", \"/\");\n\nconst createCapabilityId = (usedIds: Set<string>): string => {\n for (;;) {\n const id = `cap-${randomBytes(capabilityIdByteLength).toString(\"hex\")}`;\n if (!usedIds.has(id)) {\n usedIds.add(id);\n return id;\n }\n }\n};\n\nconst parseCapabilitySpecifier = (\n source: string,\n): ParsedCapabilitySpecifier | undefined => {\n if (!moduleNamePattern.test(source)) {\n return undefined;\n }\n const separator = source.indexOf(\":\");\n const namespace = `${source.slice(0, separator)}.${source.slice(separator + 1)}`;\n return {\n moduleName: source,\n namespace,\n };\n};\n\nconst escapeRegExp = (source: string): string =>\n source.replace(/[\\\\^$+?.()|[\\]{}]/gu, \"\\\\$&\");\n\nconst globToRegExp = (glob: string, separator: string): RegExp => {\n let source = \"^\";\n for (let index = 0; index < glob.length; index += 1) {\n const current = glob[index] ?? \"\";\n const next = glob[index + 1];\n if (current === \"*\" && next === \"*\") {\n source += \".*\";\n index += 1;\n continue;\n }\n if (current === \"*\") {\n source += `[^${escapeRegExp(separator)}]*`;\n continue;\n }\n source += escapeRegExp(current);\n }\n source += \"$\";\n return new RegExp(source, \"u\");\n};\n\nconst isGlobMatch = (glob: string, value: string, separator: string): boolean =>\n globToRegExp(glob, separator).test(value);\n\n/**\n * Selects producer catalog entries using the runtime's dot-separated glob policy.\n * @param catalog - Public function paths from a verified native artifact.\n * @param allow - Application-owned permission patterns.\n * @returns The concrete expected runtime catalog after applying permissions.\n */\nexport const selectMuonPluginFunctionPaths = (\n catalog: readonly string[],\n allow: readonly string[],\n): readonly string[] =>\n catalog.filter((path) =>\n allow.some((pattern) => isGlobMatch(pattern, path, \".\")),\n );\n\nconst containsGlob = (value: string): boolean => value.includes(\"*\");\n\nconst toRootRelativeImporter = (root: string, importer: string): string =>\n normalizePath(relative(root, importer));\n\nconst readPackageName = (packageJsonPath: string): string | undefined => {\n try {\n const parsed = JSON.parse(readFileSync(packageJsonPath, \"utf8\")) as unknown;\n return typeof parsed === \"object\" &&\n parsed !== null &&\n !Array.isArray(parsed) &&\n typeof (parsed as { name?: unknown }).name === \"string\"\n ? (parsed as { name: string }).name\n : undefined;\n } catch {\n return undefined;\n }\n};\n\nconst getImporterPackageName = (\n root: string,\n importer: string,\n): string | undefined => {\n const normalizedRoot = normalizePath(root);\n const rootPackageJsonPath = join(root, \"package.json\");\n let directory = dirname(normalizePath(importer));\n for (;;) {\n const packageJsonPath = join(directory, \"package.json\");\n if (\n packageJsonPath !== rootPackageJsonPath &&\n existsSync(packageJsonPath)\n ) {\n return readPackageName(packageJsonPath);\n }\n if (normalizePath(directory) === normalizedRoot) {\n return undefined;\n }\n const parent = dirname(directory);\n if (parent === directory) {\n return undefined;\n }\n directory = parent;\n }\n};\n\nconst matchesCapabilityRuleImporter = (\n rule: MuonCapabilityImportOptions,\n root: string,\n importer: string,\n): boolean => {\n const relativeImporter = toRootRelativeImporter(root, importer);\n const sourceMatched =\n rule.sources?.some((pattern) =>\n isGlobMatch(normalizePath(pattern), relativeImporter, \"/\"),\n ) ?? false;\n if (sourceMatched) {\n return true;\n }\n\n const packageName = getImporterPackageName(root, importer);\n return packageName === undefined\n ? false\n : (rule.packages?.includes(packageName) ?? false);\n};\n\nconst hasNamespaceFunctionAllow = (\n namespace: string,\n allow: readonly string[],\n): boolean =>\n allow.some((entry) => {\n if (entry.startsWith(`${namespace}.`)) {\n return true;\n }\n return isGlobMatch(entry, `${namespace}.placeholder`, \".\");\n });\n\nconst getExactExportName = (\n namespace: string,\n functionPath: string,\n): string | undefined => {\n const prefix = `${namespace}.`;\n if (!functionPath.startsWith(prefix)) {\n return undefined;\n }\n const name = functionPath.slice(prefix.length);\n if (!jsIdentifierPattern.test(name)) {\n return undefined;\n }\n return name;\n};\n\nconst getExportedFunctions = (\n namespace: string,\n allow: readonly string[],\n functionPaths: readonly string[],\n): [string, string][] => {\n const exportedFunctions = new Map<string, string>();\n const addExport = (functionPath: string): void => {\n const exportName = getExactExportName(namespace, functionPath);\n if (exportName !== undefined && !exportedFunctions.has(exportName)) {\n exportedFunctions.set(exportName, functionPath);\n }\n };\n\n for (const entry of allow) {\n if (!containsGlob(entry)) {\n addExport(entry);\n continue;\n }\n for (const functionPath of functionPaths) {\n if (isGlobMatch(entry, functionPath, \".\")) {\n addExport(functionPath);\n }\n }\n }\n return Array.from(exportedFunctions.entries());\n};\n\nconst createFunctionPathCatalog = (\n functionPaths: readonly string[] | undefined,\n backend: \"cef\" | \"android\",\n): readonly string[] => {\n const catalog: string[] = [];\n const seen = new Set<string>();\n for (const functionPath of [\n ...(backend === \"android\"\n ? muonAndroidBuiltinFunctionPaths\n : defaultMuonCapabilityFunctionPaths),\n ...(functionPaths ?? []),\n ]) {\n if (!seen.has(functionPath)) {\n seen.add(functionPath);\n catalog.push(functionPath);\n }\n }\n return catalog;\n};\n\nconst createRuleRuntimeEntry = (\n rule: MuonCapabilityImportOptions,\n id: string,\n): MuonCapabilityRuntimeEntry => ({\n id,\n allow: [...rule.allow],\n});\n\nconst validateCapabilityRule = (rule: MuonCapabilityImportOptions): void => {\n if (\n (rule.sources === undefined || rule.sources.length === 0) &&\n (rule.packages === undefined || rule.packages.length === 0)\n ) {\n throw new Error(\n \"muon capability import rule requires sources or packages.\",\n );\n }\n};\n\nconst createModuleVirtualId = (rule: ResolvedRule): string =>\n `${virtualModulePrefix}${rule.index}:${rule.moduleName}`;\n\nconst parseModuleVirtualId = (\n id: string,\n): { index: number; moduleName: string } | undefined => {\n if (!id.startsWith(virtualModulePrefix)) {\n return undefined;\n }\n const payload = id.slice(virtualModulePrefix.length);\n const separator = payload.indexOf(\":\");\n if (separator <= 0) {\n return undefined;\n }\n const index = Number.parseInt(payload.slice(0, separator), 10);\n if (!Number.isInteger(index) || index < 0) {\n return undefined;\n }\n return {\n index,\n moduleName: payload.slice(separator + 1),\n };\n};\n\nconst createExecutorSpawnExport = (\n capabilityId: string,\n functionPath: string,\n): string => `const __muonExecutorActiveProcesses = new Set();\nconst __muonExecutorEmptyBytes = new Uint8Array(0);\nconst __muonExecutorOwnerCallback = () => {};\nconst __muonExecutorAsyncDispose =\n typeof Symbol === \"function\" && typeof Symbol.asyncDispose === \"symbol\"\n ? Symbol.asyncDispose\n : null;\nconst __muonExecutorToBytes = (data) => {\n if (typeof data === \"string\") {\n return new TextEncoder().encode(data);\n }\n if (data instanceof ArrayBuffer) {\n return new Uint8Array(data);\n }\n if (ArrayBuffer.isView(data)) {\n return new Uint8Array(data.buffer, data.byteOffset, data.byteLength);\n }\n throw new TypeError(\"stdin data must be a string or BufferSource\");\n};\nconst __muonExecutorFromBase64 = (source) => {\n const text = atob(source ?? \"\");\n const bytes = new Uint8Array(text.length);\n for (let index = 0; index < text.length; index += 1) {\n bytes[index] = text.charCodeAt(index);\n }\n return bytes;\n};\nconst __muonExecutorRpc = async (\n request,\n data = __muonExecutorEmptyBytes,\n onStdout = null,\n onStderr = null,\n) =>\n JSON.parse(\n await __muonCall(${JSON.stringify(capabilityId)}, ${JSON.stringify(functionPath)}, [\n JSON.stringify(request),\n data,\n 0,\n __muonExecutorOwnerCallback,\n onStdout,\n onStderr,\n ]),\n );\nconst __muonExecutorDecodeWaitResult = (raw) => {\n const result = {\n processId: raw.processId,\n exitCode: raw.exitCode,\n };\n if (Object.prototype.hasOwnProperty.call(raw, \"stdoutBase64\")) {\n result.stdout = __muonExecutorFromBase64(raw.stdoutBase64);\n }\n if (Object.prototype.hasOwnProperty.call(raw, \"stderrBase64\")) {\n result.stderr = __muonExecutorFromBase64(raw.stderrBase64);\n }\n return result;\n};\nconst __muonExecutorReleaseActiveProcesses = async () => {\n if (__muonExecutorActiveProcesses.size === 0) {\n return;\n }\n for (const handle of Array.from(__muonExecutorActiveProcesses)) {\n try {\n await handle.release();\n } catch {}\n }\n};\nif (typeof globalThis.addEventListener === \"function\") {\n for (const eventName of [\"beforeunload\", \"pagehide\", \"unload\"]) {\n globalThis.addEventListener(eventName, __muonExecutorReleaseActiveProcesses);\n }\n}\nexport const spawn = async (options = {}) => {\n const stdoutCallback =\n typeof options.onStdout === \"function\"\n ? (chunk) => options.onStdout(new Uint8Array(chunk))\n : null;\n const stderrCallback =\n typeof options.onStderr === \"function\"\n ? (chunk) => options.onStderr(new Uint8Array(chunk))\n : null;\n const start = await __muonExecutorRpc(\n {\n op: \"start\",\n options: {\n command: options.command,\n args: options.args,\n cwd: options.cwd,\n env: options.env,\n daemon: options.daemon,\n },\n captureStdout: stdoutCallback === null,\n captureStderr: stderrCallback === null,\n },\n __muonExecutorEmptyBytes,\n stdoutCallback,\n stderrCallback,\n );\n const handleId = start.handleId;\n let released = false;\n let stdinClosing = false;\n let waitPromise = null;\n const release = async () => {\n if (released) {\n return;\n }\n released = true;\n __muonExecutorActiveProcesses.delete(handle);\n await __muonExecutorRpc({ op: \"dispose\", handleId });\n };\n const handle = {\n processId: start.processId,\n writeStdin: async (data) => {\n if (released) {\n throw new Error(\"executor process is released\");\n }\n if (stdinClosing) {\n throw new Error(\"stdin is closed\");\n }\n await __muonExecutorRpc(\n { op: \"writeStdin\", handleId },\n __muonExecutorToBytes(data),\n );\n },\n closeStdin: async () => {\n if (released) {\n throw new Error(\"executor process is released\");\n }\n stdinClosing = true;\n await __muonExecutorRpc({ op: \"closeStdin\", handleId });\n },\n wait: () => {\n if (waitPromise !== null) {\n return waitPromise;\n }\n waitPromise = (async () => {\n try {\n return __muonExecutorDecodeWaitResult(\n await __muonExecutorRpc({ op: \"wait\", handleId }),\n );\n } finally {\n if (!released) {\n released = true;\n __muonExecutorActiveProcesses.delete(handle);\n try {\n await __muonExecutorRpc({ op: \"dispose\", handleId });\n } catch {}\n }\n }\n })();\n return waitPromise;\n },\n kill: async () => {\n if (released) {\n throw new Error(\"executor process is released\");\n }\n await __muonExecutorRpc({ op: \"kill\", handleId });\n },\n release,\n };\n if (__muonExecutorAsyncDispose !== null) {\n Object.defineProperty(handle, __muonExecutorAsyncDispose, {\n configurable: false,\n enumerable: false,\n value: release,\n writable: false,\n });\n }\n Object.freeze(handle);\n __muonExecutorActiveProcesses.add(handle);\n return handle;\n};`;\n\nconst createExecutorLoadLibraryExport = (\n capabilityId: string,\n functionPath: string,\n): string => `const __muonAdhocActiveLibraries = new Set();\nconst __muonAdhocEmptyBytes = new Uint8Array(0);\nconst __muonAdhocAsyncDispose =\n typeof Symbol === \"function\" && typeof Symbol.asyncDispose === \"symbol\"\n ? Symbol.asyncDispose\n : null;\nconst __muonAdhocPointerBrand =\n typeof Symbol === \"function\" ? Symbol.for(\"muon.nativePointer\") : \"__muonNativePointer\";\nconst __muonAdhocType = (name) => Object.freeze({ name });\nconst __muonAdhocTypes = Object.freeze({\n voidType: __muonAdhocType(\"void\"),\n boolType: __muonAdhocType(\"bool\"),\n int8Type: __muonAdhocType(\"int8\"),\n uint8Type: __muonAdhocType(\"uint8\"),\n int16Type: __muonAdhocType(\"int16\"),\n uint16Type: __muonAdhocType(\"uint16\"),\n int32Type: __muonAdhocType(\"int32\"),\n uint32Type: __muonAdhocType(\"uint32\"),\n int64Type: __muonAdhocType(\"int64\"),\n uint64Type: __muonAdhocType(\"uint64\"),\n float32Type: __muonAdhocType(\"float32\"),\n float64Type: __muonAdhocType(\"float64\"),\n stringType: __muonAdhocType(\"string\"),\n pointerType: __muonAdhocType(\"pointer\"),\n bufferViewType: __muonAdhocType(\"bufferView\"),\n usizeType: __muonAdhocType(\"usize\"),\n});\nconst __muonAdhocToBytes = (data) => {\n if (typeof data === \"string\") {\n return new TextEncoder().encode(data);\n }\n if (data instanceof ArrayBuffer) {\n return new Uint8Array(data);\n }\n if (ArrayBuffer.isView(data)) {\n return new Uint8Array(data.buffer, data.byteOffset, data.byteLength);\n }\n throw new TypeError(\"bufferView argument must be a string or BufferSource\");\n};\nconst __muonAdhocFromBase64 = (source) => {\n const text = atob(source ?? \"\");\n const bytes = new Uint8Array(text.length);\n for (let index = 0; index < text.length; index += 1) {\n bytes[index] = text.charCodeAt(index);\n }\n return bytes;\n};\nconst __muonAdhocCreatePointer = (value) => {\n const text = String(value ?? \"0\");\n const pointer = {\n [__muonAdhocPointerBrand]: true,\n value: text,\n toString: () => text,\n toJSON: () => text,\n };\n return Object.freeze(pointer);\n};\nconst __muonAdhocNormalizeType = (type) => {\n if (typeof type === \"string\") {\n return { name: type };\n }\n if (type && typeof type.name === \"string\") {\n return { name: type.name };\n }\n throw new TypeError(\"adhoc type descriptor is invalid\");\n};\nconst __muonAdhocNormalizeSignature = (signature) => {\n if (!signature || !Array.isArray(signature.argTypes)) {\n throw new TypeError(\"adhoc signature is invalid\");\n }\n return {\n argTypes: signature.argTypes.map(__muonAdhocNormalizeType),\n returnType: __muonAdhocNormalizeType(signature.returnType),\n };\n};\nconst __muonAdhocEncodeInteger = (value) => {\n if (typeof value === \"bigint\") {\n return value.toString();\n }\n if (typeof value === \"number\") {\n if (!Number.isFinite(value) || Math.trunc(value) !== value) {\n throw new TypeError(\"integer argument must be finite\");\n }\n return String(value);\n }\n if (typeof value === \"string\") {\n return value;\n }\n throw new TypeError(\"integer argument must be a number, bigint, or string\");\n};\nconst __muonAdhocEncodePointer = (value) => {\n if (value === null || value === undefined) {\n return \"0\";\n }\n if (typeof value === \"object\" && value[__muonAdhocPointerBrand]) {\n return value.value;\n }\n return __muonAdhocEncodeInteger(value);\n};\nconst __muonAdhocEncodeCall = (signature, args) => {\n if (args.length !== signature.argTypes.length) {\n throw new TypeError(\"Invalid adhoc argument count\");\n }\n const encoded = [];\n const chunks = [];\n const bufferViews = [];\n let offset = 0;\n for (let index = 0; index < args.length; index += 1) {\n const name = signature.argTypes[index].name;\n const value = args[index];\n if (name === \"int64\" || name === \"uint64\" || name === \"usize\") {\n encoded.push(__muonAdhocEncodeInteger(value));\n } else if (name === \"pointer\") {\n encoded.push(__muonAdhocEncodePointer(value));\n } else if (name === \"bufferView\") {\n const bytes = __muonAdhocToBytes(value);\n chunks.push(bytes);\n bufferViews.push({ argIndex: index, offset, size: bytes.byteLength });\n offset += bytes.byteLength;\n encoded.push(null);\n } else {\n encoded.push(value);\n }\n }\n const data = new Uint8Array(offset);\n let writeOffset = 0;\n for (const chunk of chunks) {\n data.set(chunk, writeOffset);\n writeOffset += chunk.byteLength;\n }\n return { args: encoded, bufferViews, data };\n};\nconst __muonAdhocDecodeResult = (signature, raw) => {\n const name = signature.returnType.name;\n if (name === \"void\") {\n return undefined;\n }\n if (name === \"pointer\") {\n return __muonAdhocCreatePointer(raw.pointer);\n }\n if (name === \"int64\" || name === \"uint64\" || name === \"usize\") {\n return BigInt(raw.value);\n }\n if (name === \"bufferView\") {\n return __muonAdhocFromBase64(raw.base64);\n }\n return raw.value;\n};\nconst __muonAdhocRpc = async (request, data = __muonAdhocEmptyBytes) =>\n JSON.parse(\n await __muonCall(${JSON.stringify(capabilityId)}, ${JSON.stringify(functionPath)}, [\n JSON.stringify(request),\n data,\n 0,\n ]),\n );\nconst __muonAdhocReleaseActiveLibraries = async () => {\n if (__muonAdhocActiveLibraries.size === 0) {\n return;\n }\n for (const handle of Array.from(__muonAdhocActiveLibraries)) {\n try {\n await handle.release();\n } catch {}\n }\n};\nif (typeof globalThis.addEventListener === \"function\") {\n for (const eventName of [\"beforeunload\", \"pagehide\", \"unload\"]) {\n globalThis.addEventListener(eventName, __muonAdhocReleaseActiveLibraries);\n }\n}\nexport const voidType = __muonAdhocTypes.voidType;\nexport const boolType = __muonAdhocTypes.boolType;\nexport const int8Type = __muonAdhocTypes.int8Type;\nexport const uint8Type = __muonAdhocTypes.uint8Type;\nexport const int16Type = __muonAdhocTypes.int16Type;\nexport const uint16Type = __muonAdhocTypes.uint16Type;\nexport const int32Type = __muonAdhocTypes.int32Type;\nexport const uint32Type = __muonAdhocTypes.uint32Type;\nexport const int64Type = __muonAdhocTypes.int64Type;\nexport const uint64Type = __muonAdhocTypes.uint64Type;\nexport const float32Type = __muonAdhocTypes.float32Type;\nexport const float64Type = __muonAdhocTypes.float64Type;\nexport const stringType = __muonAdhocTypes.stringType;\nexport const pointerType = __muonAdhocTypes.pointerType;\nexport const bufferViewType = __muonAdhocTypes.bufferViewType;\nexport const usizeType = __muonAdhocTypes.usizeType;\nexport const loadLibrary = async (path) => {\n const start = await __muonAdhocRpc({ op: \"load\", path });\n const libraryId = start.libraryId;\n let released = false;\n const release = async () => {\n if (released) {\n return;\n }\n released = true;\n __muonAdhocActiveLibraries.delete(handle);\n await __muonAdhocRpc({ op: \"release\", libraryId });\n };\n const handle = {\n getFunction: async (name, signature) => {\n if (released) {\n throw new Error(\"adhoc library is released\");\n }\n const normalizedSignature = __muonAdhocNormalizeSignature(signature);\n const loaded = await __muonAdhocRpc({\n op: \"getFunction\",\n libraryId,\n name,\n signature: normalizedSignature,\n });\n const functionId = loaded.functionId;\n return async (...args) => {\n if (released) {\n throw new Error(\"adhoc library is released\");\n }\n const encoded = __muonAdhocEncodeCall(normalizedSignature, args);\n const raw = await __muonAdhocRpc(\n {\n op: \"call\",\n libraryId,\n functionId,\n args: encoded.args,\n bufferViews: encoded.bufferViews,\n },\n encoded.data,\n );\n return __muonAdhocDecodeResult(normalizedSignature, raw);\n };\n },\n release,\n };\n if (__muonAdhocAsyncDispose !== null) {\n Object.defineProperty(handle, __muonAdhocAsyncDispose, {\n configurable: false,\n enumerable: false,\n value: release,\n writable: false,\n });\n }\n Object.freeze(handle);\n __muonAdhocActiveLibraries.add(handle);\n return handle;\n};`;\n\nconst createBrowserContextMenuHelpers =\n (): string => `const __muonBrowserContextMenuEventName = \"muon-browser-context-menu-command\";\nconst __muonBrowserContextMenuWhenKeys = [\n \"editable\",\n \"selection\",\n \"link\",\n \"image\",\n \"canCopy\",\n \"canPaste\",\n];\nlet __muonBrowserContextMenuToken = \"\";\nlet __muonBrowserContextMenuHandler = undefined;\nlet __muonBrowserContextMenuListening = false;\nconst __muonCreateBrowserContextMenuToken = () => {\n const crypto = globalThis.crypto;\n if (\n crypto &&\n typeof crypto.getRandomValues === \"function\" &&\n typeof globalThis.Uint32Array === \"function\"\n ) {\n const values = new globalThis.Uint32Array(4);\n crypto.getRandomValues(values);\n return Array.from(values, (value) => value.toString(16).padStart(8, \"0\")).join(\"\");\n }\n return \\`\\${Date.now().toString(36)}-\\${Math.random().toString(36).slice(2)}\\`;\n};\nconst __muonEnsureBrowserContextMenuListener = () => {\n if (\n __muonBrowserContextMenuListening ||\n typeof globalThis.addEventListener !== \"function\"\n ) {\n return;\n }\n globalThis.addEventListener(__muonBrowserContextMenuEventName, (event) => {\n const detail = event && event.detail;\n if (\n typeof detail !== \"object\" ||\n detail === null ||\n detail.token !== __muonBrowserContextMenuToken ||\n typeof __muonBrowserContextMenuHandler !== \"function\"\n ) {\n return;\n }\n __muonBrowserContextMenuHandler(detail);\n });\n __muonBrowserContextMenuListening = true;\n};\nconst __muonNormalizeBrowserContextMenuPlacement = (placement) => {\n if (placement === undefined) {\n return undefined;\n }\n if (placement === \"start\" || placement === \"afterEdit\" || placement === \"end\") {\n return placement;\n }\n throw new TypeError(\"Invalid context menu placement\");\n};\nconst __muonNormalizeBrowserContextMenuWhen = (when) => {\n if (when === undefined) {\n return undefined;\n }\n if (typeof when !== \"object\" || when === null || Array.isArray(when)) {\n throw new TypeError(\"Invalid context menu condition\");\n }\n const normalized = {};\n for (const key of __muonBrowserContextMenuWhenKeys) {\n const value = when[key];\n if (value === undefined) {\n continue;\n }\n if (typeof value !== \"boolean\") {\n throw new TypeError(\"Invalid context menu condition\");\n }\n normalized[key] = value;\n }\n return normalized;\n};\nconst __muonNormalizeBrowserContextMenuCommandId = (id) => {\n if (\n typeof id !== \"string\" ||\n id === \"\" ||\n /[\\\\u0000-\\\\u001f]/u.test(id) ||\n id.startsWith(\"muon.\") ||\n id.startsWith(\"standard.\")\n ) {\n throw new TypeError(\"Invalid context menu item id\");\n }\n return id;\n};\nconst __muonNormalizeBrowserContextMenuItem = (item) => {\n if (typeof item !== \"object\" || item === null || Array.isArray(item)) {\n throw new TypeError(\"Invalid context menu item\");\n }\n const placement = __muonNormalizeBrowserContextMenuPlacement(item.placement);\n const when = __muonNormalizeBrowserContextMenuWhen(item.when);\n if (item.type === \"separator\") {\n return {\n type: \"separator\",\n ...(placement === undefined ? {} : { placement }),\n ...(when === undefined ? {} : { when }),\n };\n }\n if (item.type !== undefined && item.type !== \"item\") {\n throw new TypeError(\"Invalid context menu item type\");\n }\n if (typeof item.label !== \"string\" || item.label === \"\") {\n throw new TypeError(\"Invalid context menu item label\");\n }\n if (item.enabled !== undefined && typeof item.enabled !== \"boolean\") {\n throw new TypeError(\"Invalid context menu item enabled state\");\n }\n return {\n id: __muonNormalizeBrowserContextMenuCommandId(item.id),\n label: item.label,\n enabled: item.enabled === undefined ? true : item.enabled,\n ...(placement === undefined ? {} : { placement }),\n ...(when === undefined ? {} : { when }),\n };\n};\nconst __muonNormalizeBrowserContextMenuItems = (items) => {\n if (!Array.isArray(items)) {\n throw new TypeError(\"Invalid context menu items\");\n }\n return items.map(__muonNormalizeBrowserContextMenuItem);\n};`;\n\nconst createBrowserSetContextMenuItemsExport = (\n capabilityId: string,\n functionPath: string,\n): string => `export const setContextMenuItems = async (items, handler = undefined) => {\n if (handler !== undefined && typeof handler !== \"function\") {\n throw new TypeError(\"Invalid context menu handler\");\n }\n const normalized = __muonNormalizeBrowserContextMenuItems(items);\n const token = __muonCreateBrowserContextMenuToken();\n await __muonCall(${JSON.stringify(capabilityId)}, ${JSON.stringify(functionPath)}, [JSON.stringify(normalized), token]);\n __muonBrowserContextMenuToken = token;\n __muonBrowserContextMenuHandler = handler;\n __muonEnsureBrowserContextMenuListener();\n};`;\n\nconst createBrowserClearContextMenuItemsExport = (\n capabilityId: string,\n functionPath: string,\n): string => `export const clearContextMenuItems = async () => {\n __muonBrowserContextMenuToken = \"\";\n __muonBrowserContextMenuHandler = undefined;\n await __muonCall(${JSON.stringify(capabilityId)}, ${JSON.stringify(functionPath)}, []);\n};`;\n\nconst createBrowserTrayHelpers =\n (): string => `const __muonBrowserTrayEventName = \"muon-browser-tray-event\";\nconst __muonBrowserTrayHandlers = new Map();\nlet __muonBrowserTrayListening = false;\nconst __muonCreateBrowserTrayToken = () => {\n const crypto = globalThis.crypto;\n if (\n crypto &&\n typeof crypto.getRandomValues === \"function\" &&\n typeof globalThis.Uint32Array === \"function\"\n ) {\n const values = new globalThis.Uint32Array(4);\n crypto.getRandomValues(values);\n return Array.from(values, (value) => value.toString(16).padStart(8, \"0\")).join(\"\");\n }\n return \\`\\${Date.now().toString(36)}-\\${Math.random().toString(36).slice(2)}\\`;\n};\nconst __muonEnsureBrowserTrayListener = () => {\n if (\n __muonBrowserTrayListening ||\n typeof globalThis.addEventListener !== \"function\"\n ) {\n return;\n }\n globalThis.addEventListener(__muonBrowserTrayEventName, (event) => {\n const detail = event && event.detail;\n if (\n typeof detail !== \"object\" ||\n detail === null ||\n typeof detail.trayId !== \"string\"\n ) {\n return;\n }\n const entry = __muonBrowserTrayHandlers.get(detail.trayId);\n if (\n entry === undefined ||\n detail.token !== entry.token ||\n typeof entry.handler !== \"function\"\n ) {\n return;\n }\n entry.handler(detail);\n });\n __muonBrowserTrayListening = true;\n};\nconst __muonNormalizeBrowserTrayId = (id) => {\n if (\n typeof id !== \"string\" ||\n id === \"\" ||\n /[\\\\u0000-\\\\u001f]/u.test(id) ||\n id.startsWith(\"muon.\") ||\n id.startsWith(\"standard.\")\n ) {\n throw new TypeError(\"Invalid tray id\");\n }\n return id;\n};\nconst __muonNormalizeBrowserTrayMenuItem = (item) => {\n if (typeof item !== \"object\" || item === null || Array.isArray(item)) {\n throw new TypeError(\"Invalid tray menu item\");\n }\n if (item.type === \"separator\") {\n return { type: \"separator\" };\n }\n const type = item.type === undefined ? \"item\" : item.type;\n if (type !== \"item\" && type !== \"checkbox\" && type !== \"radio\") {\n throw new TypeError(\"Invalid tray menu item type\");\n }\n if (typeof item.label !== \"string\" || item.label === \"\") {\n throw new TypeError(\"Invalid tray menu item label\");\n }\n if (item.enabled !== undefined && typeof item.enabled !== \"boolean\") {\n throw new TypeError(\"Invalid tray menu item enabled state\");\n }\n if (item.checked !== undefined && typeof item.checked !== \"boolean\") {\n throw new TypeError(\"Invalid tray menu item checked state\");\n }\n if (type === \"item\" && item.checked !== undefined) {\n throw new TypeError(\"Invalid tray menu item checked state\");\n }\n return {\n ...(type === \"item\" ? {} : { type }),\n id: __muonNormalizeBrowserTrayId(item.id),\n label: item.label,\n enabled: item.enabled === undefined ? true : item.enabled,\n ...(item.checked === undefined ? {} : { checked: item.checked }),\n };\n};\nconst __muonNormalizeBrowserTrayMenuItems = (items) => {\n if (!Array.isArray(items)) {\n throw new TypeError(\"Invalid tray menu items\");\n }\n return items.map(__muonNormalizeBrowserTrayMenuItem);\n};\nconst __muonNormalizeBrowserTrayOptions = (options) => {\n if (typeof options !== \"object\" || options === null || Array.isArray(options)) {\n throw new TypeError(\"Invalid tray options\");\n }\n const hasIcon = options.icon !== undefined;\n if (hasIcon && (typeof options.icon !== \"string\" || options.icon === \"\")) {\n throw new TypeError(\"Invalid tray icon\");\n }\n if (options.tooltip !== undefined && options.tooltip !== null && typeof options.tooltip !== \"string\") {\n throw new TypeError(\"Invalid tray tooltip\");\n }\n return {\n ...(options.id === undefined ? {} : { id: __muonNormalizeBrowserTrayId(options.id) }),\n ...(hasIcon ? { icon: options.icon } : {}),\n ...(options.tooltip === undefined || options.tooltip === null ? {} : { tooltip: options.tooltip }),\n ...(options.menu === undefined ? {} : { menu: __muonNormalizeBrowserTrayMenuItems(options.menu) }),\n };\n};`;\n\nconst createBrowserCreateTrayExport = (\n capabilityId: string,\n functionPath: string,\n): string => `export const createTray = async (options, handler = undefined) => {\n if (handler !== undefined && typeof handler !== \"function\") {\n throw new TypeError(\"Invalid tray handler\");\n }\n const normalized = __muonNormalizeBrowserTrayOptions(options);\n const token = __muonCreateBrowserTrayToken();\n const trayId = await __muonCall(${JSON.stringify(capabilityId)}, ${JSON.stringify(functionPath)}, [JSON.stringify(normalized), token]);\n __muonBrowserTrayHandlers.set(trayId, { token, handler });\n __muonEnsureBrowserTrayListener();\n return trayId;\n};`;\n\nconst createBrowserSetTrayMenuExport = (\n capabilityId: string,\n functionPath: string,\n): string => `export const setTrayMenu = async (id, items, handler = undefined) => {\n if (handler !== undefined && typeof handler !== \"function\") {\n throw new TypeError(\"Invalid tray handler\");\n }\n const trayId = __muonNormalizeBrowserTrayId(id);\n const normalized = __muonNormalizeBrowserTrayMenuItems(items);\n const token = __muonCreateBrowserTrayToken();\n await __muonCall(${JSON.stringify(capabilityId)}, ${JSON.stringify(functionPath)}, [trayId, JSON.stringify(normalized), token]);\n __muonBrowserTrayHandlers.set(trayId, { token, handler });\n __muonEnsureBrowserTrayListener();\n};`;\n\nconst createBrowserSetTrayIconExport = (\n capabilityId: string,\n functionPath: string,\n): string => `export const setTrayIcon = async (id, iconPath) => {\n const trayId = __muonNormalizeBrowserTrayId(id);\n if (typeof iconPath !== \"string\" || iconPath === \"\") {\n throw new TypeError(\"Invalid tray icon\");\n }\n await __muonCall(${JSON.stringify(capabilityId)}, ${JSON.stringify(functionPath)}, [trayId, iconPath]);\n};`;\n\nconst createBrowserSetTrayTooltipExport = (\n capabilityId: string,\n functionPath: string,\n): string => `export const setTrayTooltip = async (id, tooltip) => {\n const trayId = __muonNormalizeBrowserTrayId(id);\n if (tooltip !== null && typeof tooltip !== \"string\") {\n throw new TypeError(\"Invalid tray tooltip\");\n }\n await __muonCall(${JSON.stringify(capabilityId)}, ${JSON.stringify(functionPath)}, [trayId, tooltip === null ? \"\" : tooltip]);\n};`;\n\nconst createBrowserRemoveTrayExport = (\n capabilityId: string,\n functionPath: string,\n): string => `export const removeTray = async (id) => {\n const trayId = __muonNormalizeBrowserTrayId(id);\n await __muonCall(${JSON.stringify(capabilityId)}, ${JSON.stringify(functionPath)}, [trayId]);\n __muonBrowserTrayHandlers.delete(trayId);\n};`;\n\nconst createGenericFunctionExport = (\n exportName: string,\n capabilityId: string,\n functionPath: string,\n): string => `export const ${exportName} = async (...args) =>\n await __muonCall(${JSON.stringify(capabilityId)}, ${JSON.stringify(functionPath)}, args);`;\n\nconst createEnvironmentsGetConfigValuesExport = (\n capabilityId: string,\n functionPath: string,\n): string =>\n `export const getConfigValues = async () => JSON.parse(await __muonCall(${JSON.stringify(capabilityId)}, ${JSON.stringify(functionPath)}, []));`;\n\nconst createModuleSource = (rule: ResolvedRule): string => {\n const exportedFunctions = getExportedFunctions(\n rule.namespace,\n rule.rule.allow,\n rule.functionPaths,\n );\n if (exportedFunctions.length === 0) {\n const hasWildcardAllow = rule.rule.allow.some(containsGlob);\n throw new Error(\n hasWildcardAllow\n ? `muon capability import has no matching function exports: ${rule.moduleName}`\n : `muon capability import has no exact function exports: ${rule.moduleName}`,\n );\n }\n\n const usesBrowserContextMenuHelpers = exportedFunctions.some(\n ([exportName]) =>\n rule.namespace === \"muon.browser\" &&\n (exportName === \"setContextMenuItems\" ||\n exportName === \"clearContextMenuItems\"),\n );\n const usesBrowserTrayHelpers = exportedFunctions.some(\n ([exportName]) =>\n rule.namespace === \"muon.browser\" &&\n (exportName === \"createTray\" ||\n exportName === \"setTrayMenu\" ||\n exportName === \"setTrayIcon\" ||\n exportName === \"setTrayTooltip\" ||\n exportName === \"removeTray\"),\n );\n const exports = exportedFunctions.map(([exportName, functionPath]) => {\n if (rule.backend === \"android\") {\n return createGenericFunctionExport(exportName, rule.id, functionPath);\n }\n if (\n rule.namespace === \"muon.environments\" &&\n exportName === \"getConfigValues\"\n ) {\n return createEnvironmentsGetConfigValuesExport(rule.id, functionPath);\n }\n if (rule.namespace === \"muon.executor\" && exportName === \"spawn\") {\n return createExecutorSpawnExport(rule.id, functionPath);\n }\n if (rule.namespace === \"muon.executor\" && exportName === \"loadLibrary\") {\n return createExecutorLoadLibraryExport(rule.id, functionPath);\n }\n if (\n rule.namespace === \"muon.browser\" &&\n exportName === \"setContextMenuItems\"\n ) {\n return createBrowserSetContextMenuItemsExport(rule.id, functionPath);\n }\n if (\n rule.namespace === \"muon.browser\" &&\n exportName === \"clearContextMenuItems\"\n ) {\n return createBrowserClearContextMenuItemsExport(rule.id, functionPath);\n }\n if (rule.namespace === \"muon.browser\" && exportName === \"createTray\") {\n return createBrowserCreateTrayExport(rule.id, functionPath);\n }\n if (rule.namespace === \"muon.browser\" && exportName === \"setTrayMenu\") {\n return createBrowserSetTrayMenuExport(rule.id, functionPath);\n }\n if (rule.namespace === \"muon.browser\" && exportName === \"setTrayIcon\") {\n return createBrowserSetTrayIconExport(rule.id, functionPath);\n }\n if (rule.namespace === \"muon.browser\" && exportName === \"setTrayTooltip\") {\n return createBrowserSetTrayTooltipExport(rule.id, functionPath);\n }\n if (rule.namespace === \"muon.browser\" && exportName === \"removeTray\") {\n return createBrowserRemoveTrayExport(rule.id, functionPath);\n }\n return createGenericFunctionExport(exportName, rule.id, functionPath);\n });\n return `const __muonCall = globalThis.__muon_plugin_call;\nif (typeof __muonCall !== \"function\") {\n throw new Error(\"muon plugin capability bridge is not available.\");\n}\n\n${usesBrowserContextMenuHelpers ? `${createBrowserContextMenuHelpers()}\\n\\n` : \"\"}\n${usesBrowserTrayHelpers ? `${createBrowserTrayHelpers()}\\n\\n` : \"\"}\n${exports.join(\"\\n\\n\")}\n`;\n};\n\n/**\n * Creates a capability virtual module resolver for a bundler adapter.\n *\n * @param root Bundler project root.\n * @param options Capability import options.\n */\nexport const createMuonCapabilityModuleResolver = (\n root: string,\n options: MuonCapabilityOptions | undefined,\n): MuonCapabilityModuleResolver => {\n const backend = options?.backend ?? \"cef\";\n const functionPaths = createFunctionPathCatalog(\n options?.functionPaths,\n backend,\n );\n const rules = (options?.imports ?? []).map((rule) => {\n if (backend !== \"android\") return rule;\n const allow = new Set<string>();\n for (const pattern of rule.allow) {\n const matched = functionPaths.filter((path) =>\n isGlobMatch(pattern, path, \".\"),\n );\n if (matched.length === 0)\n throw new Error(`Muon function is unavailable for Android: ${pattern}`);\n for (const path of matched) allow.add(path);\n }\n return { ...rule, allow: [...allow] };\n });\n for (const rule of rules) {\n validateCapabilityRule(rule);\n }\n const usedCapabilityIds = new Set<string>();\n const runtimeEntries = rules.map((rule) =>\n createRuleRuntimeEntry(rule, createCapabilityId(usedCapabilityIds)),\n );\n\n const resolveRule = (\n source: string,\n importer: string | undefined,\n ): ResolvedRule | undefined => {\n const parsed = parseCapabilitySpecifier(source);\n if (parsed === undefined) {\n return undefined;\n }\n const namespaceConfigured = rules.some((rule) =>\n hasNamespaceFunctionAllow(parsed.namespace, rule.allow),\n );\n if (!namespaceConfigured) {\n return undefined;\n }\n if (importer === undefined) {\n throw new Error(\n `muon capability import is not allowed without an importer: ${source}`,\n );\n }\n\n const relativeImporter = toRootRelativeImporter(root, importer);\n for (let index = 0; index < rules.length; index += 1) {\n const rule = rules[index];\n const runtimeEntry = runtimeEntries[index];\n if (\n rule === undefined ||\n runtimeEntry === undefined ||\n !matchesCapabilityRuleImporter(rule, root, importer) ||\n !hasNamespaceFunctionAllow(parsed.namespace, rule.allow)\n ) {\n continue;\n }\n return {\n index,\n id: runtimeEntry.id,\n rule,\n namespace: parsed.namespace,\n moduleName: parsed.moduleName,\n functionPaths,\n backend,\n };\n }\n\n throw new Error(\n `muon capability import is not allowed: ${source} from ${relativeImporter}`,\n );\n };\n\n return {\n resolveId: (source, importer) => {\n const rule = resolveRule(source, importer);\n return rule === undefined\n ? undefined\n : {\n id: createModuleVirtualId(rule),\n };\n },\n load: (id) => {\n const parsed = parseModuleVirtualId(id);\n if (parsed === undefined) {\n return undefined;\n }\n const source = parseCapabilitySpecifier(parsed.moduleName);\n const rule = rules[parsed.index];\n const runtimeEntry = runtimeEntries[parsed.index];\n if (\n source === undefined ||\n rule === undefined ||\n runtimeEntry === undefined\n ) {\n return undefined;\n }\n return createModuleSource({\n index: parsed.index,\n id: runtimeEntry.id,\n rule,\n namespace: source.namespace,\n moduleName: source.moduleName,\n functionPaths,\n backend,\n });\n },\n getRuntimePluginConfig: () => ({\n mode: \"validate\",\n capabilities: runtimeEntries,\n }),\n };\n};\n","// muon - Multi-platform GUI application framework that uses CEF as its backend\n// Copyright (c) Kouji Matsui. (@kekyo@mi.kekyo.net)\n// Under MIT.\n// https://github.com/kekyo/muon-ui\n\nimport { copyFile, mkdir, readFile } from \"node:fs/promises\";\nimport { createRequire } from \"node:module\";\nimport { basename, join, resolve } from \"node:path\";\nimport {\n readPluginArtifact,\n type ResolvedPluginArtifact,\n} from \"muon-plugin-sdk/artifact\";\nimport type { MuonPluginTarget, buildPlugin } from \"muon-plugin-sdk\";\nimport type { MuonPluginAccessEntryOptions } from \"./plugin-access.js\";\nimport {\n selectMuonPluginFunctionPaths,\n type MuonRuntimePluginConfig,\n} from \"./capability.js\";\n\n/** An explicit authoring source, common artifact, or prebuilt NPM package. */\nexport interface MuonNativePluginReference {\n /** Source configuration, relative to muon.json or the Vite project root. */ readonly source?: string;\n /** Common muon-plugin.json path, relative to the same base directory. */ readonly manifest?: string;\n /** NPM package exporting ./muon-plugin.json; never compiled by the consumer. */ readonly package?: string;\n /** Target development sysroot, used only for a source build. */ readonly sysroot?: string;\n /** Android SDK for a source build; defaults to android.sdkPath or ANDROID_HOME. */ readonly androidSdkPath?: string;\n}\n\n/** Inputs shared by CLI and Vite plugin resolution. */\nexport interface ResolveMuonNativePluginsOptions {\n /** Application package root. */ readonly root: string;\n /** Base directory of the configuration supplying references. */ readonly directory: string;\n /** Application-owned plugin entries and policies. */ readonly plugins: readonly MuonPluginAccessEntryOptions[];\n /** Selected native targets, independent of the build host. */ readonly targets: readonly MuonPluginTarget[];\n /** Environment for explicitly requested source builds. */ readonly environment: NodeJS.ProcessEnv;\n /** Android SDK selected by the application. */ readonly androidSdkPath?: string;\n}\n\n/**\n * Resolves explicit plugin inputs and finishes source builds before reading catalogs.\n * @param options - Application references and selected targets.\n * @returns Verified artifacts indexed by their runtime registration name.\n * @remarks Prebuilt paths only read files and do not load the authoring SDK or binaries.\n */\nexport const resolveMuonNativePlugins = async (\n options: ResolveMuonNativePluginsOptions,\n): Promise<ReadonlyMap<string, ResolvedPluginArtifact>> => {\n const artifacts = new Map<string, ResolvedPluginArtifact>();\n const require = createRequire(join(options.root, \"package.json\"));\n for (const plugin of options.plugins) {\n const reference = plugin.native;\n if (!reference) continue;\n if (plugin.signature !== undefined || plugin.salt !== undefined)\n throw new Error(\n `Plugin ${plugin.name} uses target-specific artifact hashes; omit signature and salt from its application entry.`,\n );\n const selectors = [\n reference.source,\n reference.manifest,\n reference.package,\n ].filter((value) => value !== undefined);\n if (\n selectors.length !== 1 ||\n selectors.some(\n (value) => typeof value !== \"string\" || !value || value.includes(\"\\0\"),\n ) ||\n plugin.name === \"internal\"\n )\n throw new Error(\n `Plugin ${plugin.name} requires exactly one native.source, native.manifest or native.package.`,\n );\n if (artifacts.has(plugin.name))\n throw new Error(`Duplicate native plugin name: ${plugin.name}`);\n let path: string;\n if (reference.source !== undefined) {\n let authoring: { buildPlugin: typeof buildPlugin };\n try {\n authoring = require(\"muon-plugin-sdk\");\n } catch (error) {\n throw new Error(\n `Plugin ${plugin.name} requires the authoring SDK. Run npm install -D muon-plugin-sdk in ${options.root}. ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n const output = join(options.root, \".muon/plugins\", plugin.name);\n if (!/^[A-Za-z_][A-Za-z0-9_]*$/.test(plugin.name))\n throw new Error(`Invalid native plugin name: ${plugin.name}`);\n const androidSdkPath =\n reference.androidSdkPath === undefined\n ? options.androidSdkPath\n : resolve(options.directory, reference.androidSdkPath);\n for (const target of options.targets)\n await authoring.buildPlugin({\n configPath: resolve(options.directory, reference.source),\n outputDirectory: output,\n target,\n environment: options.environment,\n ...(reference.sysroot === undefined\n ? {}\n : { sysroot: resolve(options.directory, reference.sysroot) }),\n ...(androidSdkPath === undefined ? {} : { androidSdkPath }),\n });\n path = join(output, \"muon-plugin.json\");\n } else if (reference.package !== undefined) {\n if (\n !/^(?:@[a-z0-9._-]+\\/)?[a-z0-9._-]+$/.test(reference.package) ||\n reference.package.startsWith(\".\")\n )\n throw new Error(\n `Invalid native plugin NPM package: ${reference.package}`,\n );\n try {\n path = require.resolve(`${reference.package}/muon-plugin.json`);\n } catch (error) {\n throw new Error(\n `Cannot resolve ${reference.package}/muon-plugin.json. Install the plugin using npm install ${reference.package}; its package must export ./muon-plugin.json. ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n } else path = resolve(options.directory, reference.manifest!);\n const artifact = await readPluginArtifact(path, options.targets);\n if (artifact.manifest.name !== plugin.name)\n throw new Error(\n `Plugin registration name mismatch: requested ${plugin.name}, artifact declares ${artifact.manifest.name}.`,\n );\n artifacts.set(plugin.name, artifact);\n }\n const functions = new Set<string>();\n for (const artifact of artifacts.values())\n for (const path of artifact.manifest.functions) {\n if (functions.has(path))\n throw new Error(`Duplicate native plugin function: ${path}`);\n functions.add(path);\n }\n return artifacts;\n};\n\n/**\n * Copies verified runtime files into an application-owned loader directory.\n * @param artifacts - Resolved prebuilt or locally built plugins.\n * @param target - Application output target.\n * @param directory - Runtime loader directory.\n * @returns Absolute entry-library paths by registration name.\n */\nexport const stageMuonNativePlugins = async (\n artifacts: ReadonlyMap<string, ResolvedPluginArtifact>,\n target: MuonPluginTarget,\n directory: string,\n): Promise<ReadonlyMap<string, string>> => {\n const result = new Map<string, string>();\n const files = new Map<string, { source: string; destination: string }>();\n const add = async (source: string, filename: string): Promise<void> => {\n const key = target.startsWith(\"windows-\")\n ? filename.toLowerCase()\n : filename;\n const existing = files.get(key);\n if (\n existing &&\n !(await readFile(existing.source)).equals(await readFile(source))\n )\n throw new Error(`Conflicting native library: ${filename}`);\n files.set(key, { source, destination: join(directory, filename) });\n };\n for (const [name, artifact] of artifacts) {\n const entry = artifact.targets[target];\n if (!entry) throw new Error(`Plugin ${name} does not support ${target}.`);\n const filename = target.startsWith(\"android-\")\n ? basename(entry.library)\n : name + (target.startsWith(\"windows-\") ? \".dll\" : \".so\");\n await add(entry.library, filename);\n for (const dependency of entry.dependencies)\n await add(dependency, basename(dependency));\n result.set(name, join(directory, filename));\n }\n await mkdir(directory, { recursive: true });\n for (const file of files.values())\n if (resolve(file.source) !== resolve(file.destination))\n await copyFile(file.source, file.destination);\n return result;\n};\n\n/**\n * Adds verified hashes and expected function catalogs to an application's policy.\n * @param policy - Existing application permissions and capability IDs.\n * @param artifacts - Verified producer metadata.\n * @param target - Native target selected for this runtime.\n * @param path - Directory where these plugins are staged.\n * @returns Runtime-only policy, containing no source or NPM references.\n */\nexport const applyMuonNativePluginCatalogs = (\n policy: MuonRuntimePluginConfig,\n artifacts: ReadonlyMap<string, ResolvedPluginArtifact>,\n target: MuonPluginTarget,\n path: string,\n): MuonRuntimePluginConfig => ({\n ...policy,\n path,\n plugins: (policy.plugins ?? []).map((entry) => {\n const artifact = artifacts.get(entry.name);\n if (!artifact) return entry;\n const expectedFunctions = selectMuonPluginFunctionPaths(\n artifact.manifest.functions,\n entry.allow,\n );\n if (!expectedFunctions.length)\n throw new Error(\n `Plugin ${entry.name} has no allowed functions in its producer catalog.`,\n );\n return {\n name: entry.name,\n allow: entry.allow,\n ...(entry.config === undefined ? {} : { config: entry.config }),\n signature: artifact.manifest.targets[target]!.library.sha256,\n salt: \"\",\n expectedFunctions,\n };\n }),\n});\n","// muon - Multi-platform GUI application framework that uses CEF as its backend\n// Copyright (c) Kouji Matsui. (@kekyo@mi.kekyo.net)\n// Under MIT.\n// https://github.com/kekyo/muon-ui\n\nimport { spawn } from \"node:child_process\";\n\n/**\n * Runs a build tool without a shell and awaits process completion.\n * @param command - Executable path.\n * @param args - Literal argument vector.\n * @param cwd - Working directory.\n * @param environment - Child environment, including any external credentials.\n * @param output - Optional progress sink; undefined captures output only.\n * @returns Captured standard output and standard error.\n */\nexport const runAndroidCommand = async (\n command: string,\n args: readonly string[],\n cwd: string,\n environment: NodeJS.ProcessEnv,\n output: ((text: string) => void) | undefined,\n): Promise<string> =>\n await new Promise<string>((resolve, reject) => {\n const child = spawn(command, args, {\n cwd,\n env: environment,\n stdio: [\"ignore\", \"pipe\", \"pipe\"],\n });\n let captured = \"\";\n const receive = (chunk: Buffer) => {\n const text = chunk.toString();\n captured += text;\n output?.(text);\n };\n child.stdout.on(\"data\", receive);\n child.stderr.on(\"data\", receive);\n child.once(\"error\", reject);\n child.once(\"close\", (code, signal) => {\n if (code === 0) resolve(captured);\n else\n reject(\n new Error(`${command} failed (${signal ?? code}):\\n${captured}`),\n );\n });\n });\n","// muon - Multi-platform GUI application framework that uses CEF as its backend\n// Copyright (c) Kouji Matsui. (@kekyo@mi.kekyo.net)\n// Under MIT.\n// https://github.com/kekyo/muon-ui\n\nimport { constants } from \"node:fs\";\nimport { access, mkdir, readFile } from \"node:fs/promises\";\nimport { homedir } from \"node:os\";\nimport { delimiter, dirname, join, resolve } from \"node:path\";\nimport { runAndroidCommand } from \"./command.js\";\n\n/** Versions fixed by the shipped Android component set. */\nexport interface MuonAndroidToolchain {\n /** Exact Android SDK platform package directory. */ readonly platform: string;\n /** Component schema. */ readonly schemaVersion: 1;\n /** Android Gradle plugin version. */ readonly agp: string;\n /** Wrapper version. */ readonly gradle: string;\n /** API used for compilation. */ readonly compileSdk: number;\n /** API targeted by generated applications. */ readonly targetSdk: number;\n /** Minimum installation API; see documented verification range. */ readonly minSdk: number;\n /** Required SDK Build Tools version. */ readonly buildTools: string;\n /** Minimum JDK runtime version. */ readonly javaMin: number;\n /** Highest supported JDK runtime version. */ readonly javaMax: number;\n /** Version of dev.muon:runtime. */ readonly runtimeVersion: string;\n /** ABIs included in the standard runtime. */ readonly abis: readonly string[];\n}\n\n/** Inputs for the Android environment diagnostic. */\nexport interface MuonAndroidPrepareOptions {\n /** Directory containing templates, maven, renderer and toolchain.json. */ componentsDirectory: string;\n /** Explicit SDK location, otherwise resolved from the environment or adb. */ sdkPath:\n string | undefined;\n /** Child environment. */ environment: NodeJS.ProcessEnv;\n /** Whether to download/verify the pinned Gradle distribution using its Wrapper. */ prepareGradle: boolean;\n}\n\n/** Validated tools for an Android build; no NDK or CMake is needed. */\nexport interface MuonAndroidPrepareResult {\n /** Discriminates Android from desktop preparation. */ readonly target: \"android\";\n /** Absolute SDK directory. */ readonly sdkPath: string;\n /** Detected JDK major version. */ readonly javaVersion: number;\n /** Absolute Java executable. */ readonly javaPath: string;\n /** Shipped version requirements. */ readonly toolchain: MuonAndroidToolchain;\n /** Component directory used for this build. */ readonly componentsDirectory: string;\n}\n\nconst accessible = async (path: string, mode: number): Promise<boolean> => {\n try {\n await access(path, mode);\n return true;\n } catch {\n return false;\n }\n};\n\nconst findExecutable = async (\n name: string,\n environment: NodeJS.ProcessEnv,\n): Promise<string | undefined> => {\n for (const directory of (environment.PATH ?? \"\")\n .split(delimiter)\n .filter(Boolean)) {\n const path = join(directory, name);\n if (await accessible(path, constants.X_OK)) return path;\n }\n return undefined;\n};\n\n/**\n * Diagnoses a Linux x64 SDK/JDK installation and optionally prepares Gradle.\n * @param options - Component location, SDK override and process environment.\n * @returns Validated tool paths and pinned versions.\n * @remarks Does not install SDK packages, accept licenses, or require a device.\n */\nexport const prepareAndroid = async (\n options: MuonAndroidPrepareOptions,\n): Promise<MuonAndroidPrepareResult> => {\n if (process.platform !== \"linux\" || process.arch !== \"x64\") {\n throw new Error(\"Android builds currently support Linux x64 hosts.\");\n }\n const componentsDirectory = resolve(options.componentsDirectory);\n const toolchain = JSON.parse(\n await readFile(join(componentsDirectory, \"toolchain.json\"), \"utf8\"),\n ) as MuonAndroidToolchain;\n if (toolchain.schemaVersion !== 1)\n throw new Error(\"Unsupported Muon Android toolchain schema.\");\n const adb = await findExecutable(\"adb\", options.environment);\n const candidate =\n options.sdkPath ??\n options.environment.ANDROID_HOME ??\n options.environment.ANDROID_SDK_ROOT ??\n (adb === undefined ? undefined : dirname(dirname(adb)));\n if (!candidate)\n throw new Error(\n \"Android SDK not found. Set ANDROID_HOME or android.sdkPath.\",\n );\n const sdkPath = resolve(candidate);\n for (const [file, packageName] of [\n [\n `platforms/${toolchain.platform}/android.jar`,\n `platforms;${toolchain.platform}`,\n ],\n ...[\"aapt2\", \"zipalign\", \"apksigner\"].map((name) => [\n `build-tools/${toolchain.buildTools}/${name}`,\n `build-tools;${toolchain.buildTools}`,\n ]),\n ]) {\n if (!(await accessible(join(sdkPath, file!), constants.R_OK))) {\n throw new Error(\n `Android SDK ${sdkPath} is missing ${packageName}. Install this package using the Android CLI: android sdk install '${packageName}'. See https://developer.android.com/tools/agents/android-cli/commands/sdk`,\n );\n }\n }\n const platformProperties = await readFile(\n join(sdkPath, \"platforms\", toolchain.platform, \"source.properties\"),\n \"utf8\",\n );\n if (\n Number(\n /^AndroidVersion.ApiLevel\\s*=\\s*(\\S+)/mu.exec(platformProperties)?.[1],\n ) !== toolchain.compileSdk\n ) {\n throw new Error(\n `Android SDK platform version differs from the required API ${toolchain.compileSdk}: ${sdkPath}`,\n );\n }\n const buildProperties = await readFile(\n join(sdkPath, \"build-tools\", toolchain.buildTools, \"source.properties\"),\n \"utf8\",\n );\n if (\n /^Pkg.Revision\\s*=\\s*(\\S+)/mu.exec(buildProperties)?.[1] !==\n toolchain.buildTools\n ) {\n throw new Error(\n `Android SDK Build Tools version differs from ${toolchain.buildTools}: ${sdkPath}`,\n );\n }\n const javaPath = options.environment.JAVA_HOME\n ? join(options.environment.JAVA_HOME, \"bin/java\")\n : await findExecutable(\"java\", options.environment);\n if (!javaPath || !(await accessible(javaPath, constants.X_OK))) {\n throw new Error(\n `JDK ${toolchain.javaMin}–${toolchain.javaMax} is required. Set JAVA_HOME or add java to PATH.`,\n );\n }\n const versionText = await runAndroidCommand(\n javaPath,\n [\"-version\"],\n componentsDirectory,\n options.environment,\n undefined,\n );\n const javaVersion = Number(\n /(?:openjdk|java) version \"(\\d+)[.\"]/u.exec(versionText)?.[1],\n );\n if (\n !Number.isInteger(javaVersion) ||\n javaVersion < toolchain.javaMin ||\n javaVersion > toolchain.javaMax\n ) {\n throw new Error(\n `JDK ${toolchain.javaMin}–${toolchain.javaMax} is required; detected ${versionText.trim()}.`,\n );\n }\n if (options.prepareGradle) {\n const cache = join(homedir(), \".cache/muon/android\", toolchain.gradle);\n await mkdir(cache, { recursive: true });\n const result = await runAndroidCommand(\n join(componentsDirectory, \"templates/gradlew\"),\n [\"--version\"],\n cache,\n options.environment,\n undefined,\n );\n if (!result.includes(`Gradle ${toolchain.gradle}`))\n throw new Error(\n \"Gradle Wrapper version differs from the shipped toolchain.\",\n );\n }\n return {\n target: \"android\",\n sdkPath,\n javaVersion,\n javaPath,\n toolchain,\n componentsDirectory,\n };\n};\n","// muon - Multi-platform GUI application framework that uses CEF as its backend\n// Copyright (c) Kouji Matsui. (@kekyo@mi.kekyo.net)\n// Under MIT.\n// https://github.com/kekyo/muon-ui\n\nimport {\n chmod,\n copyFile,\n cp,\n mkdir,\n readFile,\n rm,\n stat,\n writeFile,\n} from \"node:fs/promises\";\nimport {\n basename,\n dirname,\n isAbsolute,\n join,\n relative,\n resolve,\n} from \"node:path\";\nimport { pathToFileURL } from \"node:url\";\nimport { runScriptOnceToText, type FunCityLogEntry } from \"funcity\";\nimport { runAndroidCommand } from \"./command.js\";\nimport { prepareAndroid } from \"./toolchain.js\";\n\n/** ABI shipped by the Muon Android runtime. */\nexport type MuonAndroidAbi = \"arm64-v8a\" | \"x86_64\";\n\n/** Package-owned plugin exposure and built-in function policy. */\nexport type MuonAndroidPluginAccess = {\n /** Whether the trusted main frame may use the bridge. */ readonly enabled: boolean;\n /** Allowed built-in public function paths. */ readonly internalAllow: readonly string[];\n} & (\n | { /** Global API exposure mode. */ readonly mode: \"simple\" }\n | {\n /** Virtual-module exposure mode. */ readonly mode: \"validate\";\n /** Capabilities generated by the same build as the application bundle. */ readonly capabilities: readonly {\n /** Opaque capability id. */ readonly id: string;\n /** Allowed public function paths. */ readonly allow: readonly string[];\n }[];\n }\n);\n\n/** Normalized package-owned plugin entry. */\nexport interface MuonAndroidPackagedPlugin {\n /** Ordinary shared libraries copied beside the plugin for each ABI. */ readonly dependencies?: Readonly<\n Partial<Record<MuonAndroidAbi, readonly string[]>>\n >;\n /** Logical capability name. */ readonly name: string;\n /** Packaged ELF soname. */ readonly soname: string;\n /** Explicitly allowed public function patterns. */ readonly allow: readonly string[];\n /** Producer catalog after applying the allow policy, checked when loading. */ readonly expectedFunctions?: readonly string[];\n /** Application-owned plugin configuration. */ readonly config: readonly {\n readonly key: string;\n readonly value: string;\n }[];\n /** Absolute prebuilt library path for each selected ABI. */ readonly libraries: Readonly<\n Partial<Record<MuonAndroidAbi, string>>\n >;\n}\n\n/** Explicit inputs used by the Android package builder. */\nexport interface MuonAndroidApplicationInput {\n /** Packaged Muon Android components. */ componentsDirectory: string;\n /** Directory containing previously built web assets. */ assetsDirectory: string;\n /** Relative URL path prefix under the trusted asset host. */ assetPath: string;\n /** Trusted HTTPS entry URL. */ startPage: string;\n /** Application identifier independent of Muon's Java namespace. */ applicationId: string;\n /** Launcher label. */ label: string;\n /** Monotonic Android update number. */ versionCode: number;\n /** User-facing version. */ versionName: string;\n /** Selected runtime ABIs. */ abis: readonly MuonAndroidAbi[];\n /** Manifest permissions, already normalized by the public build boundary. */ permissions: readonly string[];\n /** Values returned by muon.environments.getConfigValues. */ values: Readonly<\n Record<string, string>\n >;\n /** Explicit prebuilt plugins; an empty array builds a standard app. */ plugins: readonly MuonAndroidPackagedPlugin[];\n /** Validated common plugin access settings. */ pluginAccess: MuonAndroidPluginAccess;\n /** Optional PNG icon already converted by the public build boundary. */ icon:\n string | undefined;\n /** Owned directory for generated Gradle sources and intermediates. */ projectDirectory: string;\n /** Destination for APKs and result metadata. */ outputDirectory: string;\n /** SDK override. */ sdkPath: string | undefined;\n /** Debug package or unsigned release package. */ variant:\n \"debug\" | \"release\";\n /** Process environment. */ environment: NodeJS.ProcessEnv;\n /** Progress sink, or undefined for a quiet build. */ output:\n ((text: string) => void) | undefined;\n}\n\n/** Android APK result, without desktop launcher or CEF fields. */\nexport interface MuonAndroidApplicationResult {\n /** Target discriminator. */ readonly target: \"android\";\n /** Absolute APK path. */ readonly packagePath: string;\n /** Generated Gradle project for diagnostics. */ readonly projectDirectory: string;\n /** Android variant. */ readonly variant: \"debug\" | \"release\";\n /** Included native ABIs. */ readonly abis: readonly MuonAndroidAbi[];\n /** Application identifier. */ readonly applicationId: string;\n /** Update version. */ readonly versionCode: number;\n /** Display version. */ readonly versionName: string;\n /** Actual signing state. */ readonly signing:\n \"debug\" | \"unsigned\" | \"release\";\n}\n\nconst xml = (value: string): string =>\n value\n .replaceAll(\"&\", \"&\")\n .replaceAll(\"<\", \"<\")\n .replaceAll(\">\", \">\")\n .replaceAll('\"', \""\")\n .replaceAll(\"'\", \"'\");\n\nconst render = async (\n template: string,\n variables: ReadonlyMap<string, unknown>,\n): Promise<string> => {\n const logs: FunCityLogEntry[] = [];\n const value = await runScriptOnceToText(await readFile(template, \"utf8\"), {\n sourceId: template,\n variables,\n logs,\n });\n if (value === undefined || logs.some((log) => log.type === \"error\")) {\n throw new Error(\n `Cannot render Android template ${template}: ${JSON.stringify(logs)}`,\n );\n }\n return value;\n};\n\n/**\n * Builds a self-contained APK from the shipped AAR and prebuilt web assets.\n * @param input - Explicit application, artifact and toolchain inputs.\n * @returns The APK path and its actual variant/signing state.\n * @remarks Does not run Vite, compile native code or infer a repository root.\n */\nexport const buildAndroidApplication = async (\n input: MuonAndroidApplicationInput,\n): Promise<MuonAndroidApplicationResult> => {\n const tools = await prepareAndroid({\n componentsDirectory: input.componentsDirectory,\n sdkPath: input.sdkPath,\n environment: input.environment,\n prepareGradle: false,\n });\n const project = resolve(input.projectDirectory);\n const assetRelative = relative(resolve(input.assetsDirectory), project);\n if (\n assetRelative === \"\" ||\n (!assetRelative.startsWith(\"..\") && !isAbsolute(assetRelative))\n ) {\n throw new Error(\n \"The generated Android project must be outside the web assets directory.\",\n );\n }\n if (\n isAbsolute(input.assetPath) ||\n input.assetPath\n .split(/[\\\\/]/u)\n .some((part) => part === \"..\" || part === \"muon\")\n ) {\n throw new Error(\n \"Android assetPath must be relative and must not use the reserved muon directory.\",\n );\n }\n await rm(project, { recursive: true, force: true });\n await cp(join(tools.componentsDirectory, \"templates\"), project, {\n recursive: true,\n });\n await chmod(join(project, \"gradlew\"), 0o755);\n const assets = join(project, \"app/src/main/assets\");\n await mkdir(assets, { recursive: true });\n await cp(input.assetsDirectory, join(assets, input.assetPath), {\n recursive: true,\n dereference: true,\n });\n const frameworkAssets = join(assets, \"muon\");\n try {\n await stat(frameworkAssets);\n throw new Error(\"Web assets must not contain the reserved muon directory.\");\n } catch (error) {\n if ((error as NodeJS.ErrnoException).code !== \"ENOENT\") throw error;\n }\n await mkdir(frameworkAssets, { recursive: true });\n await cp(\n join(tools.componentsDirectory, \"licenses\"),\n join(frameworkAssets, \"licenses\"),\n { recursive: true },\n );\n await copyFile(\n join(tools.componentsDirectory, \"renderer/renderer.js\"),\n join(frameworkAssets, \"renderer.js\"),\n );\n await writeFile(\n join(frameworkAssets, \"config.json\"),\n JSON.stringify({\n startPage: input.startPage,\n values: input.values,\n plugin: input.pluginAccess,\n }),\n );\n await writeFile(\n join(frameworkAssets, \"plugins.json\"),\n JSON.stringify({\n schemaVersion: 1,\n plugins: input.plugins.map(\n ({ name, soname, allow, config, expectedFunctions }) => ({\n name,\n soname,\n allow,\n config,\n ...(expectedFunctions === undefined ? {} : { expectedFunctions }),\n }),\n ),\n }),\n );\n for (const plugin of input.plugins) {\n for (const abi of input.abis) {\n const library = plugin.libraries[abi];\n if (!library)\n throw new Error(`${plugin.name} is missing its ${abi} library.`);\n const destination = join(\n project,\n \"app/src/main/jniLibs\",\n abi,\n plugin.soname,\n );\n await mkdir(dirname(destination), { recursive: true });\n await copyFile(library, destination);\n for (const dependency of plugin.dependencies?.[abi] ?? [])\n await copyFile(\n dependency,\n join(dirname(destination), basename(dependency)),\n );\n }\n }\n await writeFile(\n join(project, \"muon-build.json\"),\n JSON.stringify(\n {\n ...tools.toolchain,\n applicationId: input.applicationId,\n versionCode: input.versionCode,\n versionName: input.versionName,\n abis: input.abis,\n maven: pathToFileURL(join(tools.componentsDirectory, \"maven\")).href,\n },\n null,\n 2,\n ),\n );\n await writeFile(\n join(project, \"app/src/main/AndroidManifest.xml\"),\n await render(\n join(project, \"AndroidManifest.xml.fc\"),\n new Map([[\"permissions\", input.permissions.map(xml)]]),\n ),\n );\n const resources = join(project, \"app/src/main/res\");\n await mkdir(join(resources, \"values\"), { recursive: true });\n await writeFile(\n join(resources, \"values/strings.xml\"),\n await render(\n join(project, \"strings.xml.fc\"),\n new Map([\n [\n \"label\",\n xml(input.label.replaceAll(\"\\\\\", \"\\\\\\\\\").replaceAll('\"', '\\\\\"')),\n ],\n ]),\n ),\n );\n if (input.icon !== undefined) {\n await rm(join(resources, \"mipmap/ic_launcher.xml\"));\n await copyFile(input.icon, join(resources, \"mipmap/ic_launcher.png\"));\n }\n await runAndroidCommand(\n join(project, \"gradlew\"),\n [\n \"--no-daemon\",\n \"--console=plain\",\n input.variant === \"debug\" ? \":app:assembleDebug\" : \":app:assembleRelease\",\n ],\n project,\n {\n ...input.environment,\n ANDROID_HOME: tools.sdkPath,\n ANDROID_SDK_ROOT: tools.sdkPath,\n },\n input.output,\n );\n const name =\n input.variant === \"debug\" ? \"app-debug.apk\" : \"app-release-unsigned.apk\";\n const packagePath = join(\n resolve(input.outputDirectory),\n `${input.applicationId}-${input.versionCode}-${input.variant}.apk`,\n );\n await mkdir(dirname(packagePath), { recursive: true });\n await copyFile(\n join(project, \"app/build/outputs/apk\", input.variant, name),\n packagePath,\n );\n const result: MuonAndroidApplicationResult = {\n target: \"android\",\n packagePath,\n projectDirectory: project,\n variant: input.variant,\n abis: input.abis,\n applicationId: input.applicationId,\n versionCode: input.versionCode,\n versionName: input.versionName,\n signing: input.variant === \"debug\" ? \"debug\" : \"unsigned\",\n };\n await writeFile(\n `${packagePath}.json`,\n JSON.stringify(result, null, 2) + \"\\n\",\n );\n return result;\n};\n","// muon - Multi-platform GUI application framework that uses CEF as its backend\n// Copyright (c) Kouji Matsui. (@kekyo@mi.kekyo.net)\n// Under MIT.\n// https://github.com/kekyo/muon-ui\n\n/** Result of validating a merged muon configuration for Android. */\nexport interface MuonAndroidConfigValidationResult {\n /** Diagnostics for accepted desktop settings that Android does not enforce. */\n readonly warnings: readonly string[];\n}\n\ntype ConfigObject = Record<string, unknown>;\n\nconst isConfigObject = (value: unknown): value is ConfigObject =>\n typeof value === 'object' && value !== null && !Array.isArray(value);\n\nconst hasOwn = (value: ConfigObject, name: string): boolean =>\n Object.prototype.hasOwnProperty.call(value, name);\n\nconst requireOptionalSection = (\n config: ConfigObject,\n name: string,\n path: string\n): ConfigObject | undefined => {\n const value = config[name];\n if (value === undefined) {\n return undefined;\n }\n if (!isConfigObject(value)) {\n throw new Error(`muon.json ${path} must be an object`);\n }\n return value;\n};\n\nconst rejectConfiguredValue = (\n section: ConfigObject,\n name: string,\n path: string\n): void => {\n if (hasOwn(section, name) && section[name] !== undefined) {\n throw new Error(`muon.json ${path} is unavailable on Android`);\n }\n};\n\nconst validateBrowserConfig = (browser: ConfigObject | undefined): void => {\n if (browser === undefined) {\n return;\n }\n\n rejectConfiguredValue(browser, 'profilePath', 'browser.profilePath');\n rejectConfiguredValue(browser, 'profile', 'browser.profile');\n rejectConfiguredValue(browser, 'titleBarType', 'browser.titleBarType');\n rejectConfiguredValue(\n browser,\n 'initialTitleBarVisibility',\n 'browser.initialTitleBarVisibility'\n );\n rejectConfiguredValue(\n browser,\n 'initialTitleBarIcon',\n 'browser.initialTitleBarIcon'\n );\n\n const initialWindowState = browser.initialWindowState;\n if (\n initialWindowState !== undefined &&\n initialWindowState !== 'normal' &&\n initialWindowState !== 'fullscreen'\n ) {\n throw new Error(\n 'muon.json browser.initialWindowState supports only normal or fullscreen on Android'\n );\n }\n\n const contextMenu = requireOptionalSection(\n browser,\n 'contextMenu',\n 'browser.contextMenu'\n );\n const contextMenuMode = contextMenu?.mode;\n if (\n contextMenuMode !== undefined &&\n contextMenuMode !== 'standard' &&\n contextMenuMode !== 'disabled'\n ) {\n throw new Error(\n 'muon.json browser.contextMenu.mode supports only standard or disabled on Android'\n );\n }\n\n const keybind = browser.keybind;\n if (\n keybind !== undefined &&\n (!isConfigObject(keybind) || Object.keys(keybind).length !== 0)\n ) {\n throw new Error(\n 'muon.json browser.keybind must be an empty object on Android'\n );\n }\n\n const unsafeParentAccess = browser.allowUnsafeJavaScriptParentAccess;\n if (\n unsafeParentAccess !== undefined &&\n (!Array.isArray(unsafeParentAccess) || unsafeParentAccess.length !== 0)\n ) {\n throw new Error(\n 'muon.json browser.allowUnsafeJavaScriptParentAccess must be an empty array on Android'\n );\n }\n};\n\nconst validatePluginConfig = (plugin: ConfigObject | undefined): void => {\n if (plugin === undefined) {\n return;\n }\n rejectConfiguredValue(plugin, 'path', 'plugin.path');\n\n if (hasOwn(plugin, 'pages') && plugin.pages !== undefined) {\n if (\n !Array.isArray(plugin.pages) ||\n plugin.pages.some(\n (page) =>\n page !== 'asset://main/**' &&\n page !== 'https://main.asset.muon.invalid/**'\n )\n ) {\n throw new Error(\n 'muon.json plugin.pages supports only the whole trusted asset origin (asset://main/** or https://main.asset.muon.invalid/**), or [] to disable RPC.'\n );\n }\n }\n\n const plugins = plugin.plugins;\n if (plugins === undefined) {\n return;\n }\n if (!Array.isArray(plugins)) {\n throw new Error('muon.json plugin.plugins must be an array');\n }\n for (const [index, entry] of plugins.entries()) {\n if (!isConfigObject(entry)) {\n throw new Error(`muon.json plugin.plugins[${index}] must be an object`);\n }\n rejectConfiguredValue(\n entry,\n 'signature',\n `plugin.plugins[${index}].signature`\n );\n rejectConfiguredValue(entry, 'salt', `plugin.plugins[${index}].salt`);\n }\n};\n\nconst validateNetworkConfig = (\n network: ConfigObject | undefined,\n warnings: string[]\n): void => {\n if (\n network !== undefined &&\n ['allow', 'authorizedOrigin', 'localAccess'].some((name) =>\n hasOwn(network, name)\n )\n ) {\n warnings.push(\n 'muon.json network policy is not enforced by the Android WebView backend.'\n );\n }\n};\n\n/**\n * Validates Android-specific acceptance rules for a merged muon.json value.\n *\n * @param config - Parsed and merged muon configuration.\n * @returns Warnings for accepted settings whose desktop policy is not enforced.\n * @throws When a setting has no Android-compatible meaning.\n */\nexport const validateMuonAndroidConfig = (\n config: unknown\n): MuonAndroidConfigValidationResult => {\n if (!isConfigObject(config)) {\n throw new Error('muon.json must be an object');\n }\n\n const warnings: string[] = [];\n validateBrowserConfig(requireOptionalSection(config, 'browser', 'browser'));\n validatePluginConfig(requireOptionalSection(config, 'plugin', 'plugin'));\n validateNetworkConfig(\n requireOptionalSection(config, 'network', 'network'),\n warnings\n );\n\n const cdp = requireOptionalSection(config, 'cdp', 'cdp');\n if (cdp?.enable !== undefined && cdp.enable !== false) {\n throw new Error('muon.json cdp.enable must be false on Android');\n }\n\n const node = requireOptionalSection(config, 'node', 'node');\n rejectConfiguredValue(node ?? {}, 'project', 'node.project');\n\n return Object.freeze({ warnings: Object.freeze(warnings) });\n};\n","// muon - Multi-platform GUI application framework that uses CEF as its backend\n// Copyright (c) Kouji Matsui. (@kekyo@mi.kekyo.net)\n// Under MIT.\n// https://github.com/kekyo/muon-ui\n\nimport { mkdir, readFile, writeFile } from \"node:fs/promises\";\nimport { dirname } from \"node:path\";\n\nimport * as __screwUpDefaultImportModule0 from 'sharp';\nconst sharp = __resolveDefaultExport(__screwUpDefaultImportModule0, true);\nglobalThis.__screwUpIsInCJS_1272fdd5aee5 = false;\nfunction __resolveDefaultExport<T>(module: T | { default?: T }, isESM: boolean): T {\n const __isInCJS =\n typeof globalThis !== 'undefined' &&\n (globalThis as any).__screwUpIsInCJS_1272fdd5aee5 === true;\n const maybe = module as { default?: T };\n const hasDefault = !!(maybe && typeof maybe === 'object' && 'default' in maybe);\n const unwrapNamespaceDefault = (value: unknown): unknown => {\n if (!value || typeof value !== 'object') {\n return value;\n }\n const inner = value as any;\n const isModule =\n inner.__esModule === true ||\n (typeof Symbol !== 'undefined' &&\n (inner as any)[Symbol.toStringTag] === 'Module');\n if (isModule && 'default' in inner) {\n return inner.default;\n }\n return value;\n };\n const resolvedDefault = hasDefault\n ? unwrapNamespaceDefault((maybe as any).default)\n : undefined;\n\n if (__isInCJS) {\n return hasDefault ? ((resolvedDefault as T) ?? (module as T)) : (module as T);\n }\n\n if (isESM) {\n if (hasDefault) {\n return resolvedDefault as T;\n }\n throw new Error('Default export not found.');\n }\n\n return hasDefault ? ((resolvedDefault as T) ?? (module as T)) : (module as T);\n}\n\n\nconst normalizedIconSize = 256;\nconst windowsIconDibSizes = [16, 24, 32, 48, 64, 128] as const;\nconst pngSignature = Buffer.from([\n 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a,\n]);\n\ninterface RawIconImage {\n data: Buffer;\n width: number;\n height: number;\n}\n\ninterface WindowsIconImage {\n data: Buffer;\n size: number;\n bitCount: number;\n}\n\n/**\n * Creates a normalized square PNG icon image.\n *\n * @param pngData Source PNG bytes.\n * @param source Diagnostic source label used in errors.\n * @param label User-facing diagnostic label.\n * @returns PNG bytes normalized to the muon base icon size.\n * @remarks Non-square images are fitted into transparent padding without\n * stretching. The normalized PNG is the source for all platform-specific icon\n * derivatives.\n */\nexport const createNormalizedIconPngData = async (\n pngData: Buffer,\n source: string,\n label: string,\n): Promise<Buffer> => {\n await assertPngData(pngData, source, label);\n try {\n return await sharp(pngData)\n .resize(normalizedIconSize, normalizedIconSize, {\n fit: \"contain\",\n background: { r: 0, g: 0, b: 0, alpha: 0 },\n })\n .ensureAlpha()\n .png()\n .toBuffer();\n } catch {\n throw new Error(`${label} must be a valid PNG: ${source}`);\n }\n};\n\n/**\n * Creates a normalized square PNG icon image for Windows resources.\n *\n * @param pngData Source PNG bytes.\n * @param source Diagnostic source label used in errors.\n * @returns PNG bytes normalized to the muon base icon size.\n */\nexport const createNormalizedMuonIconPngData = async (\n pngData: Buffer,\n source: string,\n): Promise<Buffer> =>\n await createNormalizedIconPngData(pngData, source, \"Windows resource icon\");\n\n/**\n * Creates a Windows ICO file from PNG bytes.\n *\n * @param pngData Source PNG bytes.\n * @param source Diagnostic source label used in errors.\n * @returns ICO file bytes containing 16, 24, 32, 48, 64, 128, and 256 pixel images.\n * @remarks The 256px entry is PNG-compressed. Smaller entries are 32-bit DIB\n * images, matching the common Windows ICO layout recommended by Microsoft.\n */\nexport const createWindowsIconBufferFromPngData = async (\n pngData: Buffer,\n source: string,\n): Promise<Buffer> => {\n const normalizedPng = await createNormalizedMuonIconPngData(pngData, source);\n const images: WindowsIconImage[] = [];\n for (const size of windowsIconDibSizes) {\n const rawImage = await resizePngToRawRgba(normalizedPng, size, source);\n images.push({\n data: createDibIconImage(rawImage),\n size,\n bitCount: 32,\n });\n }\n images.push({\n data: normalizedPng,\n size: normalizedIconSize,\n bitCount: 32,\n });\n return createIco(images);\n};\n\n/**\n * Creates a Windows ICO file from a PNG file.\n *\n * @param sourcePath Source PNG file path.\n * @param outputPath Output ICO file path.\n * @returns Promise resolved when the ICO file has been written.\n */\nexport const createWindowsIconFromPngFile = async (\n sourcePath: string,\n outputPath: string,\n): Promise<void> => {\n const icon = await createWindowsIconBufferFromPngData(\n await readFile(sourcePath),\n sourcePath,\n );\n await mkdir(dirname(outputPath), { recursive: true });\n await writeFile(outputPath, icon);\n};\n\nconst assertPngData = async (\n data: Buffer,\n source: string,\n label: string,\n): Promise<void> => {\n if (data.length === 0) {\n throw new Error(`${label} PNG must not be empty: ${source}`);\n }\n if (!data.subarray(0, pngSignature.length).equals(pngSignature)) {\n throw new Error(`${label} must be a valid PNG: ${source}`);\n }\n try {\n const metadata = await sharp(data).metadata();\n if (metadata.format !== \"png\") {\n throw new Error();\n }\n } catch {\n throw new Error(`${label} must be a valid PNG: ${source}`);\n }\n};\n\nconst resizePngToRawRgba = async (\n pngData: Buffer,\n size: number,\n source: string,\n): Promise<RawIconImage> => {\n try {\n const { data, info } = await sharp(pngData)\n .resize(size, size, {\n fit: \"fill\",\n kernel: \"lanczos3\",\n })\n .ensureAlpha()\n .raw()\n .toBuffer({ resolveWithObject: true });\n if (info.width !== size || info.height !== size || info.channels !== 4) {\n throw new Error();\n }\n return {\n data,\n width: info.width,\n height: info.height,\n };\n } catch {\n throw new Error(`Failed to resize Windows resource icon PNG: ${source}`);\n }\n};\n\nconst createDibIconImage = (image: RawIconImage): Buffer => {\n const pixelBytes = image.width * image.height * 4;\n const maskStride = Math.ceil(image.width / 32) * 4;\n const maskBytes = maskStride * image.height;\n const output = Buffer.alloc(40 + pixelBytes + maskBytes);\n output.writeUInt32LE(40, 0);\n output.writeInt32LE(image.width, 4);\n output.writeInt32LE(image.height * 2, 8);\n output.writeUInt16LE(1, 12);\n output.writeUInt16LE(32, 14);\n output.writeUInt32LE(0, 16);\n output.writeUInt32LE(pixelBytes + maskBytes, 20);\n output.writeInt32LE(0, 24);\n output.writeInt32LE(0, 28);\n output.writeUInt32LE(0, 32);\n output.writeUInt32LE(0, 36);\n\n for (let y = 0; y < image.height; y += 1) {\n const sourceY = image.height - 1 - y;\n for (let x = 0; x < image.width; x += 1) {\n const sourceOffset = (sourceY * image.width + x) * 4;\n const outputOffset = 40 + (y * image.width + x) * 4;\n output[outputOffset] = image.data[sourceOffset + 2]!;\n output[outputOffset + 1] = image.data[sourceOffset + 1]!;\n output[outputOffset + 2] = image.data[sourceOffset]!;\n output[outputOffset + 3] = image.data[sourceOffset + 3]!;\n }\n }\n return output;\n};\n\nconst createIco = (images: readonly WindowsIconImage[]): Buffer => {\n const directorySize = 6 + images.length * 16;\n let imageOffset = directorySize;\n const header = Buffer.alloc(directorySize);\n header.writeUInt16LE(0, 0);\n header.writeUInt16LE(1, 2);\n header.writeUInt16LE(images.length, 4);\n\n const imageData: Buffer[] = [];\n images.forEach((image, index) => {\n const entryOffset = 6 + index * 16;\n header[entryOffset] = image.size === 256 ? 0 : image.size;\n header[entryOffset + 1] = image.size === 256 ? 0 : image.size;\n header[entryOffset + 2] = 0;\n header[entryOffset + 3] = 0;\n header.writeUInt16LE(1, entryOffset + 4);\n header.writeUInt16LE(image.bitCount, entryOffset + 6);\n header.writeUInt32LE(image.data.length, entryOffset + 8);\n header.writeUInt32LE(imageOffset, entryOffset + 12);\n imageOffset += image.data.length;\n imageData.push(image.data);\n });\n\n return Buffer.concat([header, ...imageData]);\n};\n","// muon - Multi-platform GUI application framework that uses CEF as its backend\n// Copyright (c) Kouji Matsui. (@kekyo@mi.kekyo.net)\n// Under MIT.\n// https://github.com/kekyo/muon-ui\n\nimport { constants } from \"node:fs\";\nimport { access, readFile } from \"node:fs/promises\";\nimport { extname, isAbsolute, resolve } from \"node:path\";\n\nimport { createNormalizedIconPngData } from \"../cef/windows-icon.js\";\n\ntype JsonObject = Record<string, unknown>;\n\n/**\n * ZIP entry used for the generated static application icon asset.\n */\nexport const appIconAssetEntryName = \"main/.muon/app-icon.png\";\n\n/**\n * Runtime asset URL injected as the generated initial title bar icon.\n */\nexport const appIconAssetUrl = \"asset://main/.muon/app-icon.png\";\n\n/**\n * Source for a unified static application icon path.\n */\nexport interface MuonAppIconSource {\n /** Raw icon path as supplied by the source. */\n iconPath: string;\n /** Directory that relative icon paths are resolved from. */\n directory: string;\n}\n\n/**\n * Creates a static application icon source from API or CLI options.\n */\nexport const createAppIconOptionsSource = (\n iconPath: unknown,\n directory: string,\n label: string = \"iconPath\",\n): MuonAppIconSource | undefined => {\n if (iconPath === undefined) {\n return undefined;\n }\n if (typeof iconPath !== \"string\") {\n throw new Error(`${label} must be a string when present.`);\n }\n if (iconPath.trim() === \"\") {\n return undefined;\n }\n return {\n iconPath: iconPath.trim(),\n directory,\n };\n};\n\n/**\n * Reads the top-level `iconPath` from a muon config object.\n */\nexport const readConfigAppIconSource = (\n config: JsonObject,\n directory: string,\n label: string,\n): MuonAppIconSource | undefined => {\n const value = config.iconPath;\n if (value === undefined) {\n return undefined;\n }\n if (typeof value !== \"string\") {\n throw new Error(`${label} iconPath must be a string when present.`);\n }\n return createAppIconOptionsSource(value, directory);\n};\n\n/**\n * Reads the top-level `iconPath` from project metadata.\n */\nexport const readProjectAppIconSource = (\n projectJson: JsonObject,\n directory: string,\n): MuonAppIconSource | undefined => {\n const value = projectJson.iconPath;\n return typeof value === \"string\"\n ? createAppIconOptionsSource(value, directory)\n : undefined;\n};\n\n/**\n * Resolves and validates the first available static application icon source.\n */\nexport const resolveMuonAppIconPath = async (\n sources: readonly MuonAppIconSource[],\n): Promise<string | undefined> => {\n for (const source of sources) {\n const iconPath = resolveResourcePath(source.directory, source.iconPath);\n await assertMuonAppIconPath(iconPath);\n return iconPath;\n }\n return undefined;\n};\n\nconst assertMuonAppIconPath = async (iconPath: string): Promise<void> => {\n if (extname(iconPath).toLowerCase() !== \".png\") {\n throw new Error(`muon app icon must be a .png file: ${iconPath}`);\n }\n if (!(await fileExists(iconPath))) {\n throw new Error(`muon app icon does not exist: ${iconPath}`);\n }\n await createNormalizedIconPngData(\n await readFile(iconPath),\n iconPath,\n \"muon app icon\",\n );\n};\n\nconst resolveResourcePath = (directory: string, value: string): string =>\n isAbsolute(value) ? value : resolve(directory, value);\n\nconst fileExists = async (path: string): Promise<boolean> => {\n try {\n await access(path, constants.F_OK);\n return true;\n } catch {\n return false;\n }\n};\n","// muon - Multi-platform GUI application framework that uses CEF as its backend\n// Copyright (c) Kouji Matsui. (@kekyo@mi.kekyo.net)\n// Under MIT.\n// https://github.com/kekyo/muon-ui\n\nimport { readFile } from \"node:fs/promises\";\nimport { basename, resolve } from \"node:path\";\nimport {\n inspectPluginBinary,\n validatePluginLibraryDependencies,\n} from \"muon-plugin-sdk/artifact\";\nimport type { MuonAndroidAbi, MuonAndroidPackagedPlugin } from \"./build.js\";\n\nconst runtimeLibraries = new Set([\n \"libcardio.so\",\n \"libc++_shared.so\",\n \"libmuon_android_rpc.so\",\n]);\nconst record = (value: unknown, label: string): Record<string, unknown> => {\n if (value === null || typeof value !== \"object\" || Array.isArray(value))\n throw new Error(`${label} must be an object.`);\n return value as Record<string, unknown>;\n};\nconst text = (value: unknown, label: string): string => {\n if (typeof value !== \"string\" || !value || value.includes(\"\\0\"))\n throw new Error(`${label} must be a nonempty string without NUL.`);\n return value;\n};\n\n// Validate ELF inputs without loading them or requiring an Android NDK.\n/**\n * Resolves application-owned prebuilt plugins and validates their Android ELF inputs.\n * @param input - Parsed android.plugins value.\n * @param abis - Selected APK ABIs.\n * @param directory - Base directory of the configuration supplying the plugins.\n * @returns Runtime registry entries with absolute library paths.\n */\nexport const resolveAndroidPlugins = async (\n input: unknown,\n abis: readonly MuonAndroidAbi[],\n directory: string,\n): Promise<MuonAndroidPackagedPlugin[]> => {\n if (!Array.isArray(input))\n throw new Error(\"android.plugins must be an array.\");\n const names = new Set<string>();\n const sonames = new Set<string>();\n const result = input.map((value) => {\n const plugin = record(value, \"android.plugins entry\");\n const name = text(plugin.name, \"plugin.name\");\n const soname = text(plugin.soname, \"plugin.soname\");\n if (\n !/^[A-Za-z_][A-Za-z0-9_]*$/u.test(name) ||\n name === \"internal\" ||\n names.has(name)\n )\n throw new Error(\"Android plugin names must be valid and unique.\");\n if (!/^lib[A-Za-z0-9_]+\\.so$/u.test(soname) || sonames.has(soname))\n throw new Error(\"Android plugin sonames must be valid and unique.\");\n if (runtimeLibraries.has(soname))\n throw new Error(`Android library name is reserved: ${soname}`);\n names.add(name);\n sonames.add(soname);\n if (!Array.isArray(plugin.allow) || !plugin.allow.length)\n throw new Error(\n `Android plugin ${name} requires a nonempty allow policy.`,\n );\n const allow = plugin.allow.map((value) => text(value, \"plugin.allow\"));\n if (allow.some((value) => !/^[A-Za-z0-9_.$*]+$/u.test(value)))\n throw new Error(\n \"Android plugin.allow contains an invalid function pattern.\",\n );\n const rawLibraries = record(plugin.libraries, \"plugin.libraries\");\n const libraries: Partial<Record<MuonAndroidAbi, string>> = {};\n for (const abi of abis)\n libraries[abi] = resolve(\n directory,\n text(rawLibraries[abi], `plugin.libraries.${abi}`),\n );\n const config = Object.entries(\n record(plugin.config ?? {}, \"plugin.config\"),\n ).map(([key, value]) => {\n if (\n !key ||\n key.includes(\"\\0\") ||\n typeof value !== \"string\" ||\n value.includes(\"\\0\")\n )\n throw new Error(\n \"Android plugin.config must contain string keys and values without NUL.\",\n );\n return { key, value };\n });\n if (\n plugin.expectedFunctions !== undefined &&\n (!Array.isArray(plugin.expectedFunctions) ||\n !plugin.expectedFunctions.every((path) => typeof path === \"string\"))\n )\n throw new Error(`Invalid expected functions for Android plugin ${name}.`);\n const dependencies: Partial<Record<MuonAndroidAbi, readonly string[]>> = {};\n if (plugin.dependencies !== undefined) {\n const raw = record(plugin.dependencies, \"plugin.dependencies\");\n for (const abi of abis) {\n const paths = raw[abi] ?? [];\n if (!Array.isArray(paths))\n throw new Error(\"plugin.dependencies entries must be path arrays.\");\n dependencies[abi] = paths.map((path) =>\n resolve(directory, text(path, \"plugin.dependencies path\")),\n );\n }\n }\n return {\n ...(plugin.dependencies === undefined ? {} : { dependencies }),\n name,\n soname,\n allow,\n libraries,\n config,\n ...(plugin.expectedFunctions === undefined\n ? {}\n : { expectedFunctions: plugin.expectedFunctions as string[] }),\n };\n });\n for (const abi of abis) {\n const files = new Map<\n string,\n { path: string; data: Buffer; plugin: boolean }\n >();\n for (const plugin of result) {\n const paths = [\n plugin.libraries[abi]!,\n ...(plugin.dependencies?.[abi] ?? []),\n ];\n for (let index = 0; index < paths.length; index++) {\n const path = paths[index]!;\n const name = index === 0 ? plugin.soname : basename(path);\n if (!/^lib[A-Za-z0-9_.+-]+\\.so$/u.test(name))\n throw new Error(\"Invalid Android dependency filename: \" + name);\n const data = await readFile(path);\n const previous = files.get(name);\n if (previous && !previous.data.equals(data))\n throw new Error(\"Conflicting Android library: \" + name);\n files.set(name, {\n path,\n data,\n plugin: index === 0 || previous?.plugin === true,\n });\n }\n }\n const inspected = [...files.entries()].map(([name, file]) => {\n const info = inspectPluginBinary(file.data, `android-${abi}`);\n if (info.soname !== name)\n throw new Error(name + \" ELF SONAME must match its packaged name.\");\n if (file.plugin && !info.exports.includes(\"muon_init_plugin\"))\n throw new Error(name + \" must export muon_init_plugin.\");\n return { path: name, info };\n });\n validatePluginLibraryDependencies(inspected, `android-${abi}`);\n }\n return result;\n};\n","// muon - Multi-platform GUI application framework that uses CEF as its backend\n// Copyright (c) Kouji Matsui. (@kekyo@mi.kekyo.net)\n// Under MIT.\n// https://github.com/kekyo/muon-ui\n\nimport {\n expandMuonAndroidFunctionAllows,\n muonAndroidBuiltinFunctionPaths,\n} from \"../../core/android/function-paths.js\";\nimport { validateMuonAndroidConfig } from \"../../core/android/renderer/android-config.js\";\nimport type { MuonRuntimePluginConfig } from \"../common/capability.js\";\nimport { readMuonPluginAccessOptions } from \"../common/plugin-access.js\";\nimport type { MuonAndroidPluginAccess } from \"./build.js\";\n\n/**\n * Connects common plugin policies to Android library definitions.\n * @param config - Merged application configuration.\n * @param runtime - Vite-generated policy override, or undefined for a CLI build.\n * @param libraries - ABI-specific library definitions from Android settings.\n * @param catalogs - Verified producer catalogs, required for external validate plugins.\n * @returns Package-owned exposure settings and native plugin inputs.\n */\nexport const resolveMuonAndroidPluginAccess = (\n config: Record<string, unknown>,\n runtime: MuonRuntimePluginConfig | undefined,\n libraries: unknown,\n catalogs: ReadonlyMap<string, readonly string[]> = new Map(),\n) => {\n const merged =\n runtime === undefined\n ? config\n : {\n ...config,\n plugin: {\n ...(config.plugin as object | undefined),\n ...runtime,\n // Runtime entries already contain the allowlist derived from imports.\n ...(runtime.mode === \"validate\"\n ? { mode: \"simple\", plugins: runtime.plugins ?? [] }\n : {}),\n },\n };\n const plugin = readMuonPluginAccessOptions(merged, \"simple\");\n if ((plugin.mode ?? \"simple\") !== \"simple\") {\n throw new Error(\n \"Android plugin.mode validate requires Vite-generated capabilities from the application build.\",\n );\n }\n validateMuonAndroidConfig(merged);\n const entries = plugin.plugins ?? [\n { name: \"internal\", allow: muonAndroidBuiltinFunctionPaths },\n ];\n const names = new Set<string>();\n for (const entry of entries) {\n if (entry.signature !== undefined || entry.salt !== undefined)\n throw new Error(\n \"Android plugin signature/salt is unsupported; use ABI-specific SHA-256 metadata.\",\n );\n if (names.has(entry.name))\n throw new Error(`Duplicate plugin.plugins name: ${entry.name}`);\n names.add(entry.name);\n }\n if (!Array.isArray(libraries))\n throw new Error(\"android.plugins must be an array.\");\n const definitions = libraries.map((value: unknown) => {\n if (typeof value !== \"object\" || value === null || Array.isArray(value)) {\n throw new Error(\"android.plugins entries must be objects.\");\n }\n const definition = value as Record<string, unknown>;\n if (\n !entries.some(\n (entry) => entry.name !== \"internal\" && entry.name === definition.name,\n )\n ) {\n throw new Error(\n `android.plugins entry ${String(definition.name)} requires a matching plugin.plugins policy.`,\n );\n }\n return definition;\n });\n const plugins = entries\n .filter((entry) => entry.name !== \"internal\")\n .map((entry) => {\n const matches = definitions.filter(\n (definition) => definition.name === entry.name,\n );\n if (matches.length !== 1)\n throw new Error(\n `plugin.plugins entry ${entry.name} requires exactly one android.plugins library definition.`,\n );\n return {\n ...matches[0],\n name: entry.name,\n allow: catalogs.has(entry.name)\n ? expandMuonAndroidFunctionAllows(\n entry.allow ?? [],\n catalogs.get(entry.name)!,\n )\n : entry.allow,\n ...(catalogs.has(entry.name)\n ? {\n expectedFunctions: expandMuonAndroidFunctionAllows(\n entry.allow ?? [],\n catalogs.get(entry.name)!,\n ),\n }\n : {}),\n config: entry.config,\n };\n });\n const internal = entries.find((entry) => entry.name === \"internal\");\n const base = {\n enabled: plugin.pages === undefined || plugin.pages.length > 0,\n internalAllow: expandMuonAndroidFunctionAllows(internal?.allow ?? []),\n };\n const ids = new Set<string>();\n const pluginAccess: MuonAndroidPluginAccess =\n runtime?.mode === \"validate\"\n ? {\n ...base,\n mode: \"validate\",\n capabilities: runtime.capabilities.map((entry) => {\n if (!entry.id || ids.has(entry.id))\n throw new Error(\n \"Android capability ids must be nonempty and unique.\",\n );\n ids.add(entry.id);\n return {\n id: entry.id,\n allow: expandMuonAndroidFunctionAllows(entry.allow, [\n ...muonAndroidBuiltinFunctionPaths,\n ...[...catalogs.values()].flat(),\n ]),\n };\n }),\n }\n : { ...base, mode: \"simple\" };\n return {\n pluginAccess,\n plugins,\n };\n};\n","// muon - Multi-platform GUI application framework that uses CEF as its backend\n// Copyright (c) Kouji Matsui. (@kekyo@mi.kekyo.net)\n// Under MIT.\n// https://github.com/kekyo/muon-ui\n\nimport { createHash } from \"node:crypto\";\nimport { readFile } from \"node:fs/promises\";\nimport { resolve } from \"node:path\";\nimport type { MuonAndroidAbi } from \"./build.js\";\n\nconst record = (value: unknown): Record<string, unknown> => {\n if (typeof value !== \"object\" || value === null || Array.isArray(value))\n throw new Error(\"Android plugin metadata must contain objects.\");\n return value as Record<string, unknown>;\n};\n\n/**\n * Reads producer-supplied Android catalogs without loading native libraries.\n * @param input - Android plugin definitions containing catalog and library paths.\n * @param abis - Selected application ABIs.\n * @param directory - Base directory for paths in these definitions.\n * @param required - Whether every definition must supply a catalog.\n * @returns Public function paths by logical plugin name, with ABI hashes checked.\n */\nexport const readAndroidPluginMetadata = async (\n input: unknown,\n abis: readonly MuonAndroidAbi[],\n directory: string,\n required: boolean,\n): Promise<ReadonlyMap<string, readonly string[]>> => {\n if (!Array.isArray(input))\n throw new Error(\"android.plugins must be an array.\");\n const catalogs = new Map<string, readonly string[]>();\n const paths = new Set<string>();\n for (const raw of input) {\n const plugin = record(raw);\n const name = String(plugin.name);\n if (plugin.metadata === undefined && !required) continue;\n if (typeof plugin.metadata !== \"string\" || !plugin.metadata)\n throw new Error(\n `Android plugin ${name} requires a metadata file for validate mode.`,\n );\n if (catalogs.has(name))\n throw new Error(`Duplicate Android plugin metadata: ${name}`);\n const metadata = record(\n JSON.parse(await readFile(resolve(directory, plugin.metadata), \"utf8\")),\n );\n if (\n metadata.schemaVersion !== 1 ||\n !Array.isArray(metadata.functions) ||\n metadata.functions.length === 0\n )\n throw new Error(`Invalid Android plugin metadata for ${name}.`);\n const functions = metadata.functions.map((path: unknown) => {\n if (\n typeof path !== \"string\" ||\n !/^[A-Za-z_$][\\w$]*(?:\\.[A-Za-z_$][\\w$]*){2,}$/u.test(path) ||\n paths.has(path)\n )\n throw new Error(\n `Invalid or duplicate Android plugin function: ${String(path)}`,\n );\n paths.add(path);\n return path;\n });\n const hashes = record(metadata.sha256);\n const libraries = record(plugin.libraries);\n for (const abi of abis) {\n const library = libraries[abi];\n const expected = hashes[abi];\n if (\n typeof library !== \"string\" ||\n typeof expected !== \"string\" ||\n !/^[a-f0-9]{64}$/u.test(expected)\n )\n throw new Error(\n `Android plugin ${name} (${abi}) requires a library and SHA-256 metadata.`,\n );\n const actual = createHash(\"sha256\")\n .update(await readFile(resolve(directory, library)))\n .digest(\"hex\");\n if (actual !== expected)\n throw new Error(\n `Android plugin ${name} (${abi}) SHA-256 metadata mismatch.`,\n );\n }\n catalogs.set(name, functions);\n }\n return catalogs;\n};\n","// muon - Multi-platform GUI application framework that uses CEF as its backend\n// Copyright (c) Kouji Matsui. (@kekyo@mi.kekyo.net)\n// Under MIT.\n// https://github.com/kekyo/muon-ui\n\nimport { access, rename, rm, writeFile } from \"node:fs/promises\";\nimport { dirname, join, resolve } from \"node:path\";\nimport type { MuonAndroidApplicationResult } from \"./build.js\";\nimport { runAndroidCommand } from \"./command.js\";\n\n/** Signing references; password values are held only in the child environment. */\nexport interface MuonAndroidSigning {\n /** Absolute path to an external keystore. */ readonly keystore: string;\n /** Keystore key alias. */ readonly keyAlias: string;\n /** Environment variable holding the keystore password. */ readonly storePasswordEnv: string;\n /** Environment variable holding the key password. */ readonly keyPasswordEnv: string;\n}\n\n/** APK whose release signature and ZIP alignment have been verified. */\nexport interface MuonAndroidSignedApplicationResult extends MuonAndroidApplicationResult {\n /** Verified signing state. */ readonly signing: \"release\";\n /** Public signer certificate fingerprint. */ readonly certificateSha256: string;\n}\n\n/**\n * Validates external signing references before building a release application.\n * @param input - Parsed android.signing object.\n * @param directory - Directory resolving relative keystore paths.\n * @param environment - Environment containing password values.\n * @returns Signing references, without copying password values.\n */\nexport const resolveAndroidSigning = (\n input: unknown,\n directory: string,\n environment: NodeJS.ProcessEnv,\n): MuonAndroidSigning => {\n if (input === null || typeof input !== \"object\" || Array.isArray(input))\n throw new Error(\n \"Android release APKs require android.signing with an external keystore and password environment variables.\",\n );\n const value = input as Record<string, unknown>;\n const allowed = new Set([\n \"keystore\",\n \"keyAlias\",\n \"storePasswordEnv\",\n \"keyPasswordEnv\",\n ]);\n for (const key of Object.keys(value))\n if (!allowed.has(key))\n throw new Error(\n `android.signing.${key} is unsupported. Use password environment variable names, never inline passwords.`,\n );\n const string = (key: string): string => {\n const text = value[key];\n if (typeof text !== \"string\" || !text || text.includes(\"\\0\"))\n throw new Error(\n `android.signing.${key} must be a nonempty string without NUL.`,\n );\n return text;\n };\n const keystore = resolve(directory, string(\"keystore\"));\n const keyAlias = string(\"keyAlias\");\n const storePasswordEnv = string(\"storePasswordEnv\");\n const keyPasswordEnv =\n value.keyPasswordEnv === undefined\n ? storePasswordEnv\n : string(\"keyPasswordEnv\");\n for (const key of [storePasswordEnv, keyPasswordEnv]) {\n if (!/^[A-Za-z_][A-Za-z0-9_]*$/u.test(key))\n throw new Error(\n \"Android signing password environment variable names are invalid.\",\n );\n if (!environment[key])\n throw new Error(\n `Android signing requires the ${key} environment variable.`,\n );\n }\n return { keystore, keyAlias, storePasswordEnv, keyPasswordEnv };\n};\n\n/**\n * Signs an unsigned release APK, verifies the signature, then publishes metadata.\n * @param result - Unsigned application build result.\n * @param signing - External signing references.\n * @param tools - Validated SDK and Build Tools version.\n * @param environment - Signer environment; credentials never become CLI arguments.\n * @returns Verified APK metadata, including only the public certificate fingerprint.\n */\nexport const signAndroidApplication = async (\n result: MuonAndroidApplicationResult,\n signing: MuonAndroidSigning,\n tools: { sdkPath: string; buildTools: string },\n environment: NodeJS.ProcessEnv,\n): Promise<MuonAndroidSignedApplicationResult> => {\n if (result.variant !== \"release\" || result.signing !== \"unsigned\")\n throw new Error(\n \"Android release signing requires an unsigned release APK.\",\n );\n const redact = (message: string): string => {\n for (const key of [signing.storePasswordEnv, signing.keyPasswordEnv]) {\n const value = environment[key];\n if (value) message = message.replaceAll(value, \"[redacted]\");\n }\n return message;\n };\n const temporary = `${result.packagePath}.signed`;\n const signer = join(\n tools.sdkPath,\n \"build-tools\",\n tools.buildTools,\n \"apksigner\",\n );\n try {\n await access(signing.keystore);\n await runAndroidCommand(\n signer,\n [\n \"sign\",\n \"--ks\",\n signing.keystore,\n \"--ks-key-alias\",\n signing.keyAlias,\n \"--ks-pass\",\n `env:${signing.storePasswordEnv}`,\n \"--key-pass\",\n `env:${signing.keyPasswordEnv}`,\n \"--v4-signing-enabled\",\n \"false\",\n \"--debuggable-apk-permitted\",\n \"false\",\n \"--lib-page-alignment\",\n \"16384\",\n \"--out\",\n temporary,\n result.packagePath,\n ],\n dirname(result.packagePath),\n environment,\n undefined,\n );\n const verification = await runAndroidCommand(\n signer,\n [\"verify\", \"--verbose\", \"--print-certs\", temporary],\n dirname(result.packagePath),\n environment,\n undefined,\n );\n const certificateSha256 =\n /Signer #1 certificate SHA-256 digest: ([a-f0-9]{64})/iu\n .exec(verification)?.[1]\n ?.toLowerCase();\n if (!certificateSha256)\n throw new Error(\n \"Android signer did not return a verified certificate fingerprint.\",\n );\n if (/Signer #1 certificate DN:.*CN=Android Debug/iu.test(verification))\n throw new Error(\n \"A release APK must use an application signing key, not the Android debug certificate.\",\n );\n await runAndroidCommand(\n join(tools.sdkPath, \"build-tools\", tools.buildTools, \"zipalign\"),\n [\"-c\", \"-P\", \"16\", \"4\", temporary],\n dirname(result.packagePath),\n environment,\n undefined,\n );\n await rename(temporary, result.packagePath);\n const signed: MuonAndroidSignedApplicationResult = {\n ...result,\n signing: \"release\",\n certificateSha256,\n };\n await writeFile(\n `${result.packagePath}.json`,\n JSON.stringify(signed, null, 2) + \"\\n\",\n );\n return signed;\n } catch (error) {\n throw new Error(\n redact(error instanceof Error ? error.message : String(error)),\n );\n } finally {\n await rm(temporary, { force: true });\n }\n};\n","// muon - Multi-platform GUI application framework that uses CEF as its backend\n// Copyright (c) Kouji Matsui. (@kekyo@mi.kekyo.net)\n// Under MIT.\n// https://github.com/kekyo/muon-ui\n\nimport { readFile, readdir, realpath, stat } from \"node:fs/promises\";\nimport { basename, isAbsolute, join, relative, resolve } from \"node:path\";\nimport { resolveMuonPluginAccessOptions } from \"../common/plugin-access.js\";\nimport { resolveMuonNativePlugins } from \"../common/native-plugins.js\";\nimport type { InternalMuonBuildOptions } from \"../common/build-types.js\";\nimport {\n buildAndroidApplication,\n type MuonAndroidApplicationResult,\n} from \"./build.js\";\nimport { prepareAndroid } from \"./toolchain.js\";\nimport { validateMuonAndroidConfig } from \"../../core/android/renderer/android-config.js\";\nimport type { MuonAndroidOptions } from \"../android.js\";\nimport type { MuonBuildOptions } from \"../common/build.js\";\nimport type { MuonProgressCallback } from \"../common/progress.js\";\nimport {\n createAppIconOptionsSource,\n resolveMuonAppIconPath,\n} from \"../common/app-icon.js\";\nimport { resolveAndroidPlugins } from \"./plugins.js\";\nimport { resolveMuonAndroidPluginAccess } from \"./plugin-access.js\";\nimport { readAndroidPluginMetadata } from \"./plugin-metadata.js\";\nimport { resolveAndroidSigning, signAndroidApplication } from \"./signing.js\";\n\n/** Result of an Android build, discriminated by target without desktop fields. */\nexport interface MuonAndroidBuildTargetResult extends MuonAndroidApplicationResult {\n /** Public signer certificate digest, present for verified release APKs. */\n readonly certificateSha256?: string;\n /** Fixed Android output directory relative to the output root. */\n readonly distributionDirectoryName: \"dist-muon/android\";\n /** Absolute directory containing the APK and its metadata. */\n readonly outputPath: string;\n}\n\ntype RecordValue = Record<string, unknown>;\nconst object = (value: unknown, label: string): RecordValue => {\n if (value === undefined) return {};\n if (value === null || typeof value !== \"object\" || Array.isArray(value))\n throw new Error(`${label} must be an object.`);\n return value as RecordValue;\n};\nconst string = (value: unknown, label: string): string => {\n if (typeof value !== \"string\" || value.trim() === \"\" || value.includes(\"\\0\"))\n throw new Error(`${label} must be a nonempty string without NUL.`);\n return value;\n};\nconst strings = (value: unknown, label: string): string[] => {\n if (!Array.isArray(value))\n throw new Error(`${label} must be an array of strings.`);\n return [...new Set(value.map((entry) => string(entry, label)))];\n};\n\nconst assertKeystoreIsNotPackaged = async (\n assets: string,\n keystore: string,\n): Promise<void> => {\n const key = await readFile(keystore);\n const pending = [assets];\n const visited = new Set<string>();\n while (pending.length > 0) {\n const path = await realpath(pending.pop()!);\n if (visited.has(path)) continue;\n visited.add(path);\n const info = await stat(path);\n if (info.isDirectory()) {\n for (const name of await readdir(path)) pending.push(join(path, name));\n } else if (\n info.isFile() &&\n info.size === key.length &&\n (await readFile(path)).equals(key)\n ) {\n throw new Error(\n \"The Android keystore must not be included in web assets, including copied or renamed files.\",\n );\n }\n }\n};\nconst settings = (\n root: string,\n config: RecordValue,\n configDirectory: string,\n options: MuonAndroidOptions | undefined,\n) => {\n const configured = object(config.android, \"android\");\n const merged = { ...configured, ...options };\n const path = (key: \"sdkPath\" | \"icon\"): string | undefined => {\n const value = merged[key];\n return value === undefined\n ? undefined\n : resolve(\n options?.[key] === undefined ? configDirectory : root,\n string(value, `android.${key}`),\n );\n };\n return {\n merged,\n sdkPath: path(\"sdkPath\"),\n icon: path(\"icon\"),\n pluginsDirectory: options?.plugins === undefined ? configDirectory : root,\n };\n};\n\n/**\n * Resolves the SDK override with the same precedence as a build.\n * @param root - Project root for explicit option paths.\n * @param packageDirectory - Installed Muon distribution.\n * @param config - Parsed project configuration.\n * @param configDirectory - Base directory for configuration paths.\n * @param options - Explicit Android options, or undefined.\n * @param environment - Child process environment.\n * @returns Validated tools after preparing the Gradle Wrapper.\n */\nexport const prepareMuonAndroidTarget = async (\n root: string,\n packageDirectory: string,\n config: RecordValue,\n configDirectory: string,\n options: MuonAndroidOptions | undefined,\n environment: NodeJS.ProcessEnv,\n) => {\n const resolved = settings(root, config, configDirectory, options);\n return await prepareAndroid({\n componentsDirectory: join(packageDirectory, \"android\"),\n sdkPath: resolved.sdkPath,\n environment,\n prepareGradle: true,\n });\n};\n\n/**\n * Validates public app inputs before invoking the packaged Android builder.\n * @param input - Project, asset and configuration sources with their base paths.\n * @returns Android APK information without desktop runtime fields.\n */\nexport const buildMuonAndroidTarget = async (input: {\n root: string;\n packageDirectory: string;\n packageJson: RecordValue;\n config: RecordValue;\n configDirectory: string;\n options: MuonBuildOptions;\n assets: { sourcePath: string; prefix: string };\n environment: NodeJS.ProcessEnv;\n progress: MuonProgressCallback | undefined;\n}): Promise<MuonAndroidBuildTargetResult> => {\n const { root, options, config, packageJson } = input;\n const resolved = settings(\n root,\n config,\n input.configDirectory,\n options.android,\n );\n const android = resolved.merged;\n const signing =\n options.androidRelease === true\n ? resolveAndroidSigning(\n android.signing,\n options.android?.signing === undefined ? input.configDirectory : root,\n input.environment,\n )\n : undefined;\n if (signing !== undefined) {\n const withinAssets = relative(input.assets.sourcePath, signing.keystore);\n if (\n withinAssets === \"\" ||\n (!withinAssets.startsWith(\"..\") && !isAbsolute(withinAssets))\n ) {\n throw new Error(\n \"The Android keystore must be outside the web assets directory.\",\n );\n }\n await assertKeystoreIsNotPackaged(\n input.assets.sourcePath,\n signing.keystore,\n );\n }\n for (const [key, label] of [\n [\"fcm\", \"FCM\"],\n [\"quickjs\", \"QuickJS\"],\n ] as const) {\n if (android[key] !== undefined && android[key] !== false)\n throw new Error(\n `${label} is unavailable in Android application builds; android.${key} must be false or omitted.`,\n );\n }\n const { warnings } = validateMuonAndroidConfig(config);\n for (const warning of warnings) process.stderr.write(`Warning: ${warning}\\n`);\n if (\n config.node !== undefined &&\n Object.keys(object(config.node, \"node\")).length > 0\n )\n throw new Error(\"node is unavailable in Android application builds.\");\n const browser = object(config.browser, \"browser\");\n if (\n browser.initialWindowState !== undefined &&\n browser.initialWindowState !== \"normal\"\n )\n throw new Error(\n \"Android browser.initialWindowState currently supports normal only; use the runtime fullscreen API.\",\n );\n if (\n browser.contextMenu !== undefined &&\n object(browser.contextMenu, \"browser.contextMenu\").mode !== \"standard\"\n )\n throw new Error(\n \"Android browser.contextMenu currently supports standard only.\",\n );\n\n const defaultName =\n typeof packageJson.name === \"string\" ? packageJson.name : \"application\";\n const defaultId = `dev.muon.${defaultName\n .replace(/^@[^/]+\\//u, \"\")\n .replace(/[^A-Za-z0-9_]/gu, \"_\")\n .replace(/^[^A-Za-z]/u, \"app_\")}`;\n const applicationId = string(\n options.android?.applicationId ??\n options.appId ??\n android.applicationId ??\n defaultId,\n \"android.applicationId\",\n );\n if (\n !/^[A-Za-z][A-Za-z0-9_]*(?:\\.[A-Za-z][A-Za-z0-9_]*)+$/u.test(applicationId)\n )\n throw new Error(\n \"android.applicationId must contain at least two Java-style identifier segments.\",\n );\n const versionCode = android.versionCode ?? 1;\n if (\n !Number.isInteger(versionCode) ||\n typeof versionCode !== \"number\" ||\n versionCode < 1 ||\n versionCode > 2100000000\n )\n throw new Error(\n \"android.versionCode must be an integer from 1 to 2100000000.\",\n );\n const abis = strings(\n android.abis ?? [\"arm64-v8a\", \"x86_64\"],\n \"android.abis\",\n ).map((abi) => {\n if (abi !== \"arm64-v8a\" && abi !== \"x86_64\")\n throw new Error(\"android.abis supports arm64-v8a and x86_64 only.\");\n return abi;\n });\n if (abis.length === 0) throw new Error(\"android.abis must not be empty.\");\n const catalogs = await readAndroidPluginMetadata(\n android.plugins ?? [],\n abis,\n resolved.pluginsDirectory,\n options.runtimePluginConfig?.mode === \"validate\",\n );\n const nativeAccess =\n (options as InternalMuonBuildOptions).nativePluginAccess ??\n (await resolveMuonPluginAccessOptions({\n root,\n configPath: options.configPath,\n pluginAccess: { mode: options.runtimePluginConfig?.mode ?? \"simple\" },\n }));\n const artifacts =\n nativeAccess.nativeArtifacts ??\n (await resolveMuonNativePlugins({\n root,\n directory: nativeAccess.nativeDirectory ?? input.configDirectory,\n plugins: nativeAccess.plugins,\n targets: abis.map((abi) => `android-${abi}` as const),\n environment: input.environment,\n ...(resolved.sdkPath === undefined\n ? {}\n : { androidSdkPath: resolved.sdkPath }),\n }));\n const nativeCatalogs = new Map(catalogs);\n const nativeDefinitions: object[] = [];\n for (const [name, artifact] of artifacts) {\n if (nativeCatalogs.has(name))\n throw new Error(`Duplicate Android plugin definition: ${name}`);\n nativeCatalogs.set(name, artifact.manifest.functions);\n const libraries = Object.fromEntries(\n abis.map((abi) => [abi, artifact.targets[`android-${abi}`]!.library]),\n );\n const sonames = new Set(\n Object.values(libraries).map((path) => basename(path)),\n );\n if (sonames.size !== 1)\n throw new Error(\n `Android plugin ${name} must use the same SONAME for every ABI.`,\n );\n nativeDefinitions.push({\n name,\n soname: [...sonames][0],\n libraries,\n dependencies: Object.fromEntries(\n abis.map((abi) => [\n abi,\n artifact.targets[`android-${abi}`]!.dependencies,\n ]),\n ),\n });\n }\n const pluginConfiguration = resolveMuonAndroidPluginAccess(\n config,\n options.runtimePluginConfig,\n [\n ...(android.plugins === undefined ? [] : (android.plugins as unknown[])),\n ...nativeDefinitions,\n ],\n nativeCatalogs,\n );\n const permissions = strings(android.permissions ?? [], \"android.permissions\");\n if (\n permissions.some(\n (permission) =>\n !/^android\\.permission\\.[A-Z][A-Z0-9_]*$/u.test(permission),\n )\n )\n throw new Error(\n \"android.permissions must contain Android platform permission names.\",\n );\n const values = Object.fromEntries(\n Object.entries(object(config.config, \"config\")).map(([key, value]) => {\n if (typeof value !== \"string\")\n throw new Error(\"muon.json config values must be strings.\");\n return [key, value];\n }),\n );\n const prefix = input.assets.prefix;\n if (prefix !== \"\" && prefix !== \"main\" && !prefix.startsWith(\"main/\"))\n throw new Error(\"Android assetPrefix must use the main asset host.\");\n const assetPath = prefix.replace(/^main\\/?/u, \"\").replace(/\\/+$/u, \"\");\n const rawStartPage = string(\n browser.startPage ??\n options.browserStartPage ??\n `https://main.asset.muon.invalid/${assetPath === \"\" ? \"\" : `${assetPath}/`}index.html`,\n \"browser.startPage\",\n );\n const startPage = rawStartPage.replace(\n /^asset:\\/\\/main\\//u,\n \"https://main.asset.muon.invalid/\",\n );\n const url = new URL(startPage);\n if (\n url.origin !== \"https://main.asset.muon.invalid\" ||\n url.username ||\n url.password\n )\n throw new Error(\n \"Android browser.startPage must use asset://main/ or https://main.asset.muon.invalid/.\",\n );\n if (!(await stat(input.assets.sourcePath)).isDirectory())\n throw new Error(\n \"Android web assets must be a directory; ZIP assets are not supported.\",\n );\n const iconValue =\n options.android?.icon === undefined\n ? (options.iconPath ?? resolved.icon ?? config.iconPath)\n : resolved.icon;\n const iconSource = createAppIconOptionsSource(\n iconValue,\n resolved.icon !== undefined || options.iconPath !== undefined\n ? root\n : input.configDirectory,\n );\n const icon = await resolveMuonAppIconPath(\n iconSource === undefined ? [] : [iconSource],\n );\n const plugins = await resolveAndroidPlugins(\n pluginConfiguration.plugins,\n abis,\n resolved.pluginsDirectory,\n );\n const outputPath = resolve(\n root,\n options.outputRoot ?? \".\",\n \"dist-muon/android\",\n );\n input.progress?.({ phase: \"build\", status: \"Building Android APK\" });\n let result = await buildAndroidApplication({\n componentsDirectory: join(input.packageDirectory, \"android\"),\n assetsDirectory: input.assets.sourcePath,\n assetPath,\n startPage,\n applicationId,\n label: string(\n options.android?.label ?? options.appName ?? android.label ?? defaultName,\n \"android.label\",\n ),\n versionCode,\n versionName: string(\n android.versionName ?? packageJson.version ?? \"0.0.0\",\n \"android.versionName\",\n ),\n abis,\n permissions,\n values,\n pluginAccess: pluginConfiguration.pluginAccess,\n plugins,\n icon,\n projectDirectory: resolve(root, \".muon/android\"),\n outputDirectory: outputPath,\n sdkPath: resolved.sdkPath,\n variant: signing === undefined ? \"debug\" : \"release\",\n environment: input.environment,\n output:\n input.progress === undefined\n ? undefined\n : (text) => input.progress?.({ phase: \"build\", status: text.trim() }),\n });\n if (signing !== undefined) {\n const tools = await prepareAndroid({\n componentsDirectory: join(input.packageDirectory, \"android\"),\n sdkPath: resolved.sdkPath,\n environment: input.environment,\n prepareGradle: false,\n });\n result = await signAndroidApplication(\n result,\n signing,\n { sdkPath: tools.sdkPath, buildTools: tools.toolchain.buildTools },\n input.environment,\n );\n }\n return {\n ...result,\n outputPath,\n distributionDirectoryName: \"dist-muon/android\",\n };\n};\n","// muon - Multi-platform GUI application framework that uses CEF as its backend\n// Copyright (c) Kouji Matsui. (@kekyo@mi.kekyo.net)\n// Under MIT.\n// https://github.com/kekyo/muon-ui\n\n/**\n * Public muon target platform identifier.\n */\nexport type MuonDesktopTarget =\n | \"linux-amd64\"\n | \"linux-armhf\"\n | \"linux-arm64\"\n | \"windows-i686\"\n | \"windows-amd64\";\n\n/**\n * Internal CEF target platform identifier.\n */\nexport type MuonCefTarget =\n \"linux64\" | \"linuxarm\" | \"linuxarm64\" | \"windows32\" | \"windows64\";\n\n/**\n * muon target operating system family.\n */\nexport type MuonTargetOperatingSystem = \"linux\" | \"windows\";\n\n/**\n * Metadata for one supported muon target.\n */\nexport interface MuonTargetDescriptor {\n /**\n * Public target identifier accepted by muon CLI and Vite options.\n */\n id: MuonDesktopTarget;\n /**\n * Internal CEF target identifier used for CEF catalog and native builds.\n */\n cefTarget: MuonCefTarget;\n /**\n * Operating system family.\n */\n os: MuonTargetOperatingSystem;\n /**\n * Public architecture name used in package artifact names.\n */\n arch: \"amd64\" | \"armhf\" | \"arm64\" | \"i686\";\n /**\n * Fixed dist directory path for generated app distributions.\n */\n distributionDirectoryName: string;\n /**\n * muon-core executable file name for this target.\n */\n runtimeExecutableName: string;\n /**\n * Runtime executable file names other than {@link runtimeExecutableName}.\n *\n * @remarks Every entry must also be present in {@link runtimeFiles}. Generated\n * distributions normalize these files to executable mode.\n */\n runtimeAuxiliaryExecutableNames: readonly string[];\n /**\n * muon-launcher executable file name for this target.\n */\n launcherExecutableName: string;\n /**\n * Optional privileged runtime helper executable file name.\n */\n runtimeHelperExecutableName?: string;\n /**\n * Launcher file suffix for app launcher executables.\n */\n launcherExtension: string;\n /**\n * Required runtime files copied into generated app distributions.\n */\n runtimeFiles: readonly string[];\n /**\n * Optional runtime files copied when they exist.\n */\n optionalRuntimeFilePatterns?: readonly RegExp[];\n}\n\n/**\n * Desktop targets included by default and by --all, in deterministic order.\n */\nexport const allMuonTargets = [\n \"linux-amd64\",\n \"linux-armhf\",\n \"linux-arm64\",\n \"windows-i686\",\n \"windows-amd64\",\n] as const satisfies readonly MuonDesktopTarget[];\n\nconst targetDescriptors = {\n \"linux-amd64\": {\n id: \"linux-amd64\",\n cefTarget: \"linux64\",\n os: \"linux\",\n arch: \"amd64\",\n distributionDirectoryName: \"dist-muon/linux-amd64\",\n runtimeExecutableName: \"muon-core\",\n runtimeAuxiliaryExecutableNames: [\"muon-executor-supervisor\"],\n launcherExecutableName: \"muon-launcher\",\n runtimeHelperExecutableName: \"muon-runtime-helper\",\n launcherExtension: \"\",\n runtimeFiles: [\n \"muon-core\",\n \"muon-executor-supervisor\",\n \"libmuon-ui.so\",\n \"libcardio.so\",\n ],\n },\n \"linux-armhf\": {\n id: \"linux-armhf\",\n cefTarget: \"linuxarm\",\n os: \"linux\",\n arch: \"armhf\",\n distributionDirectoryName: \"dist-muon/linux-armhf\",\n runtimeExecutableName: \"muon-core\",\n runtimeAuxiliaryExecutableNames: [\"muon-executor-supervisor\"],\n launcherExecutableName: \"muon-launcher\",\n runtimeHelperExecutableName: \"muon-runtime-helper\",\n launcherExtension: \"\",\n runtimeFiles: [\n \"muon-core\",\n \"muon-executor-supervisor\",\n \"libmuon-ui.so\",\n \"libcardio.so\",\n ],\n },\n \"linux-arm64\": {\n id: \"linux-arm64\",\n cefTarget: \"linuxarm64\",\n os: \"linux\",\n arch: \"arm64\",\n distributionDirectoryName: \"dist-muon/linux-arm64\",\n runtimeExecutableName: \"muon-core\",\n runtimeAuxiliaryExecutableNames: [\"muon-executor-supervisor\"],\n launcherExecutableName: \"muon-launcher\",\n runtimeHelperExecutableName: \"muon-runtime-helper\",\n launcherExtension: \"\",\n runtimeFiles: [\n \"muon-core\",\n \"muon-executor-supervisor\",\n \"libmuon-ui.so\",\n \"libcardio.so\",\n ],\n },\n \"windows-i686\": {\n id: \"windows-i686\",\n cefTarget: \"windows32\",\n os: \"windows\",\n arch: \"i686\",\n distributionDirectoryName: \"dist-muon/windows-i686\",\n runtimeExecutableName: \"muon-core.exe\",\n runtimeAuxiliaryExecutableNames: [],\n launcherExecutableName: \"muon-launcher.exe\",\n launcherExtension: \".exe\",\n runtimeFiles: [\"muon-core.exe\", \"libmuon-ui.dll\", \"libcardio.dll\"],\n optionalRuntimeFilePatterns: [\n /^libgcc_s_.*-1\\.dll$/,\n /^libstdc\\+\\+-6\\.dll$/,\n /^libwinpthread-1\\.dll$/,\n ],\n },\n \"windows-amd64\": {\n id: \"windows-amd64\",\n cefTarget: \"windows64\",\n os: \"windows\",\n arch: \"amd64\",\n distributionDirectoryName: \"dist-muon/windows-amd64\",\n runtimeExecutableName: \"muon-core.exe\",\n runtimeAuxiliaryExecutableNames: [],\n launcherExecutableName: \"muon-launcher.exe\",\n launcherExtension: \".exe\",\n runtimeFiles: [\"muon-core.exe\", \"libmuon-ui.dll\", \"libcardio.dll\"],\n optionalRuntimeFilePatterns: [\n /^libgcc_s_.*-1\\.dll$/,\n /^libstdc\\+\\+-6\\.dll$/,\n /^libwinpthread-1\\.dll$/,\n ],\n },\n} as const satisfies Record<MuonDesktopTarget, MuonTargetDescriptor>;\n\nconst targetByCefTarget = Object.fromEntries(\n allMuonTargets.map((target) => [targetDescriptors[target].cefTarget, target]),\n) as Record<MuonCefTarget, MuonDesktopTarget>;\n\n/**\n * Returns metadata for a public muon target.\n *\n * @param target Public muon target.\n * @returns Target descriptor.\n */\nexport const getMuonTargetDescriptor = (\n target: MuonDesktopTarget,\n): MuonTargetDescriptor => targetDescriptors[target];\n\n/**\n * Returns the runtime app identifier embedded for one target distribution.\n *\n * @param appId Base sanitized application identifier.\n * @param target Public muon target.\n * @returns Target runtime application identifier.\n *\n * @remarks Windows targets append their public architecture name so 32-bit and\n * 64-bit packages do not share runtime state or installer identities.\n */\nexport const getMuonTargetRuntimeAppId = (\n appId: string,\n target: MuonDesktopTarget,\n): string => {\n const descriptor = getMuonTargetDescriptor(target);\n return descriptor.os === \"windows\" ? `${appId}.${descriptor.arch}` : appId;\n};\n\n/**\n * Resolves a Node platform and architecture pair to a public muon target.\n *\n * @param platform Node platform.\n * @param architecture Node architecture.\n * @returns Public muon target.\n */\nexport const getDefaultMuonTarget = (\n platform: NodeJS.Platform,\n architecture: NodeJS.Architecture,\n): MuonDesktopTarget => {\n if (platform === \"win32\") {\n if (architecture === \"ia32\") {\n return \"windows-i686\";\n }\n if (architecture === \"x64\") {\n return \"windows-amd64\";\n }\n }\n if (platform === \"linux\") {\n if (architecture === \"x64\") {\n return \"linux-amd64\";\n }\n if (architecture === \"arm\") {\n return \"linux-armhf\";\n }\n if (architecture === \"arm64\") {\n return \"linux-arm64\";\n }\n }\n throw new Error(\n `Unsupported muon target: platform=${platform}, arch=${architecture}`,\n );\n};\n\n/**\n * Resolves an internal CEF target to a public muon target.\n *\n * @param cefTarget Internal CEF target.\n * @returns Public muon target.\n */\nexport const getMuonTargetForCefTarget = (\n cefTarget: MuonCefTarget,\n): MuonDesktopTarget => targetByCefTarget[cefTarget];\n","// muon - Multi-platform GUI application framework that uses CEF as its backend\n// Copyright (c) Kouji Matsui. (@kekyo@mi.kekyo.net)\n// Under MIT.\n// https://github.com/kekyo/muon-ui\n\nimport { allMuonTargets, type MuonDesktopTarget } from \"../cef/targets.js\";\nexport * from \"../cef/targets.js\";\n\n/** Public build target. Android is selected explicitly. */\nexport type MuonTarget = MuonDesktopTarget | \"android\";\n\n/**\n * Normalizes a user supplied public muon target.\n *\n * @param target Target value supplied by the user.\n * @param label Error label used in diagnostics.\n * @returns Public muon target.\n */\nexport const normalizeMuonTarget = (\n target: string,\n label = \"muon target\",\n): MuonTarget => {\n const normalized = target.trim().toLowerCase();\n if (\n normalized === \"android\" ||\n allMuonTargets.includes(normalized as MuonDesktopTarget)\n ) {\n return normalized as MuonTarget;\n }\n throw new Error(`Unsupported ${label}: ${target}`);\n};\n","// muon - Multi-platform GUI application framework that uses CEF as its backend\n// Copyright (c) Kouji Matsui. (@kekyo@mi.kekyo.net)\n// Under MIT.\n// https://github.com/kekyo/muon-ui\n\n/**\n * Progress event used by internal muon build, pack, and prepare operations.\n *\n * @internal\n */\nexport interface MuonProgressEvent {\n /**\n * Stable phase identifier.\n *\n * @internal\n */\n phase: string;\n\n /**\n * Human-readable single-line status.\n *\n * @internal\n */\n status: string;\n\n /**\n * Current progress value.\n *\n * @internal\n */\n current?: number;\n\n /**\n * Total progress value.\n *\n * @internal\n */\n total?: number;\n\n /**\n * True when current and total form bounded progress.\n *\n * @internal\n */\n determinate?: boolean;\n}\n\n/**\n * Receives internal muon progress events.\n *\n * @internal\n */\nexport type MuonProgressCallback = (event: MuonProgressEvent) => void;\n\n/**\n * Renders internal muon progress events to stderr.\n *\n * @internal\n */\nexport interface MuonProgressRenderer {\n /**\n * Render a progress event.\n *\n * @internal\n */\n report(event: MuonProgressEvent): void;\n\n /**\n * Complete the active status line.\n *\n * @internal\n */\n flush(): void;\n}\n\nconst spinnerFrames = [\"-\", \"\\\\\", \"|\", \"/\"] as const;\nconst spinnerIntervalMilliseconds = 200;\nconst terminalLineStart = \"\\r\";\nconst terminalClearLine = \"\\x1b[K\";\n\nconst clampProgressValue = (value: number, total: number): number =>\n Math.max(0, Math.min(value, total));\n\nconst formatProgressEvent = (event: MuonProgressEvent): string => {\n const status = event.status.trimEnd();\n const current = event.current ?? 0;\n const total = event.total ?? 0;\n if (event.determinate === true && total > 0) {\n const percentage = Math.floor(\n (clampProgressValue(current, total) / total) * 100,\n );\n return `${status} ${percentage}%`;\n }\n if (event.phase === \"installing\" && current > 0) {\n return `${status} ${Math.trunc(current)} files`;\n }\n return status;\n};\n\ninterface ActiveProgressLine {\n key: string;\n text: string;\n}\n\nconst getProgressLineKey = (event: MuonProgressEvent): string =>\n `${event.phase}\\0${event.status.trimEnd()}`;\n\nconst createSpinnerProgressRenderer = (): MuonProgressRenderer => {\n let activeLine: ActiveProgressLine | undefined = undefined;\n let frameIndex = 0;\n let timer: NodeJS.Timeout | undefined = undefined;\n\n const writeRaw = (chunk: string): void => {\n process.stderr.write(chunk);\n };\n\n const stopTimer = (): void => {\n if (timer !== undefined) {\n clearInterval(timer);\n timer = undefined;\n }\n };\n\n const renderLine = (): void => {\n if (activeLine === undefined) {\n return;\n }\n const frame = spinnerFrames[frameIndex] ?? spinnerFrames[0];\n writeRaw(\n `${terminalLineStart}${frame} ${activeLine.text}${terminalClearLine}`,\n );\n frameIndex = (frameIndex + 1) % spinnerFrames.length;\n };\n\n const ensureTimer = (): void => {\n if (timer === undefined) {\n timer = setInterval(renderLine, spinnerIntervalMilliseconds);\n timer.unref();\n }\n };\n\n const finishLine = (): void => {\n if (activeLine === undefined) {\n return;\n }\n stopTimer();\n const text = activeLine.text;\n activeLine = undefined;\n frameIndex = 0;\n writeRaw(`${terminalLineStart}${text}${terminalClearLine}\\n`);\n };\n\n return {\n report: (event): void => {\n const nextLine = {\n key: getProgressLineKey(event),\n text: formatProgressEvent(event),\n };\n if (activeLine === undefined) {\n activeLine = nextLine;\n renderLine();\n ensureTimer();\n return;\n }\n if (activeLine.key !== nextLine.key) {\n finishLine();\n activeLine = nextLine;\n renderLine();\n } else {\n activeLine = nextLine;\n }\n ensureTimer();\n },\n flush: finishLine,\n };\n};\n\n/**\n * Creates a stderr progress renderer for the current terminal mode.\n *\n * @internal\n */\nexport const createMuonProgressRenderer = (): MuonProgressRenderer =>\n createSpinnerProgressRenderer();\n","// muon - Multi-platform GUI application framework that uses CEF as its backend\n// Copyright (c) Kouji Matsui. (@kekyo@mi.kekyo.net)\n// Under MIT.\n// https://github.com/kekyo/muon-ui\n\nimport { spawn } from \"node:child_process\";\nimport { constants } from \"node:fs\";\nimport { access } from \"node:fs/promises\";\nimport { fileURLToPath } from \"node:url\";\nimport { dirname, join } from \"node:path\";\nimport {\n getDefaultMuonTarget,\n normalizeMuonTarget,\n type MuonDesktopTarget,\n} from \"../common/targets.js\";\nimport {\n createMuonProgressRenderer,\n type MuonProgressEvent,\n} from \"../common/progress.js\";\nimport type { MuonNodeRuntimeRequirement } from \"./node-project.js\";\n\n/**\n * Options used to invoke the native muon builder helper.\n */\nexport interface MuonPrepareOptions {\n /**\n * Directory containing muon-core runtime files.\n */\n muonPath: string;\n\n /**\n * Directory containing CEF files, or a CEF archive root with Release/Resources.\n */\n cefPath: string | undefined;\n\n /**\n * Directory where the executable runtime is staged.\n */\n stageDir: string | undefined;\n\n /**\n * Public target runtime platform such as linux-amd64 or windows-amd64.\n */\n target: string | undefined;\n\n /**\n * Cache directory passed to muon-builder.\n */\n cacheDir: string | undefined;\n\n /**\n * Node runtime requirement used to select or validate a sidecar runtime.\n *\n * @remarks This is `undefined` when the application has no Node project.\n */\n nodeRuntimeRequirement: MuonNodeRuntimeRequirement | undefined;\n\n /**\n * Rebuild an existing prepared runtime.\n */\n force: boolean;\n\n /**\n * Suppress progress messages from the native builder process.\n */\n quiet: boolean;\n\n /**\n * Explicit native muon-builder executable path.\n */\n prepareExecutablePath: string | undefined;\n\n /**\n * Environment used for the child process.\n */\n environment: NodeJS.ProcessEnv;\n\n /**\n * Working directory used for the child process.\n */\n cwd: string | undefined;\n}\n\n/**\n * Options used to update Windows PE resources through the native muon helper.\n */\nexport interface MuonPrepareResourceUpdateOptions {\n /**\n * Input PE executable path.\n */\n inputPath: string;\n\n /**\n * Engraver update JSON path.\n */\n updatesJsonPath: string;\n\n /**\n * Output PE executable path.\n *\n * @remarks This must be different from `inputPath`.\n */\n outputPath: string;\n\n /**\n * Suppress progress messages from the native builder process.\n */\n quiet: boolean;\n\n /**\n * Explicit native muon-builder executable path.\n */\n prepareExecutablePath: string | undefined;\n\n /**\n * Environment used for the child process.\n */\n environment: NodeJS.ProcessEnv;\n\n /**\n * Working directory used for the child process.\n */\n cwd: string | undefined;\n}\n\n/**\n * Result returned by native muon-builder.\n */\nexport interface MuonPrepareResult {\n /**\n * Directory containing the staged muon runtime.\n */\n stagePath?: string;\n\n /**\n * Directory containing muon-core files used as the staging source.\n */\n muonPath: string;\n\n /**\n * Directory or cached archive containing CEF files used as the staging source.\n */\n cefPath: string;\n\n /**\n * True when an existing prepared runtime was reused.\n */\n cacheHit: boolean;\n}\n\n/**\n * Returns the default muon prepare target for a Node platform and architecture.\n *\n * @param platform Node platform.\n * @param architecture Node architecture.\n * @returns muon prepare target name.\n */\nexport const getDefaultMuonPrepareTarget = (\n platform: NodeJS.Platform,\n architecture: NodeJS.Architecture,\n): MuonDesktopTarget => {\n try {\n return getDefaultMuonTarget(platform, architecture);\n } catch {\n throw new Error(\n `Unsupported muon prepare target: platform=${platform}, arch=${architecture}`,\n );\n }\n};\n\nconst getBuilderExecutableName = (platform: NodeJS.Platform): string =>\n platform === \"win32\" ? \"muon-builder.exe\" : \"muon-builder\";\n\nconst moduleDirectory =\n typeof __dirname === \"string\"\n ? __dirname\n : dirname(fileURLToPath(import.meta.url));\n\nconst canExecute = async (path: string): Promise<boolean> => {\n try {\n await access(path, constants.X_OK);\n return true;\n } catch {\n return false;\n }\n};\n\nconst resolveMuonBuilderExecutable = async (\n options: Pick<MuonPrepareOptions, \"prepareExecutablePath\" | \"environment\">,\n): Promise<string> => {\n const explicit =\n options.prepareExecutablePath ?? options.environment.MUON_BUILDER_PATH;\n if (explicit !== undefined && explicit !== \"\") {\n return explicit;\n }\n const executableName = getBuilderExecutableName(process.platform);\n const target = getDefaultMuonPrepareTarget(process.platform, process.arch);\n const candidates = [\n join(moduleDirectory, \"native\", target, executableName),\n join(moduleDirectory, \"..\", \"dist\", \"native\", target, executableName),\n ];\n for (const candidate of candidates) {\n if (await canExecute(candidate)) {\n return candidate;\n }\n }\n return candidates[0] ?? executableName;\n};\n\nconst createMuonPrepareArguments = (options: MuonPrepareOptions): string[] => {\n const args = [\"runtime\", \"--muon-path\", options.muonPath, \"--json\"];\n if (!options.quiet) {\n args.push(\"--progress-json\");\n }\n if (options.cefPath !== undefined) {\n args.push(\"--cef-path\", options.cefPath);\n }\n if (options.stageDir !== undefined) {\n args.push(\"--stage-dir\", options.stageDir);\n }\n if (options.target !== undefined) {\n args.push(\n \"--target\",\n normalizeMuonTarget(options.target, \"muon prepare target\"),\n );\n }\n if (options.cacheDir !== undefined) {\n args.push(\"--cache-dir\", options.cacheDir);\n }\n if (options.nodeRuntimeRequirement !== undefined) {\n args.push(\n \"--node-runtime-requirement\",\n JSON.stringify(options.nodeRuntimeRequirement),\n );\n }\n if (options.force) {\n args.push(\"--force\");\n }\n if (options.quiet) {\n args.push(\"--quiet\");\n }\n return args;\n};\n\ninterface MuonPrepareStderrForwarder {\n write(chunk: string): void;\n flush(): void;\n}\n\nconst createPlainStderrForwarder = (): MuonPrepareStderrForwarder => ({\n write: (chunk): void => {\n process.stderr.write(chunk);\n },\n flush: (): void => {},\n});\n\nconst parseProgressJsonLine = (line: string): MuonProgressEvent | undefined => {\n const trimmed = line.trim();\n if (!trimmed.startsWith(\"{\")) {\n return undefined;\n }\n let parsed: unknown;\n try {\n parsed = JSON.parse(trimmed);\n } catch {\n return undefined;\n }\n if (typeof parsed !== \"object\" || parsed === null) {\n return undefined;\n }\n const event = parsed as Record<string, unknown>;\n if (typeof event.phase !== \"string\" || typeof event.status !== \"string\") {\n return undefined;\n }\n const current =\n typeof event.current === \"number\" && Number.isFinite(event.current)\n ? event.current\n : undefined;\n const total =\n typeof event.total === \"number\" && Number.isFinite(event.total)\n ? event.total\n : undefined;\n const determinate =\n typeof event.determinate === \"boolean\" ? event.determinate : undefined;\n return {\n phase: event.phase,\n status: event.status,\n ...(current === undefined ? {} : { current }),\n ...(total === undefined ? {} : { total }),\n ...(determinate === undefined ? {} : { determinate }),\n };\n};\n\nconst createProgressJsonStderrForwarder = (): MuonPrepareStderrForwarder => {\n let pending = \"\";\n const renderer = createMuonProgressRenderer();\n\n const writeLine = (line: string): void => {\n const event = parseProgressJsonLine(line);\n if (event !== undefined) {\n renderer.report(event);\n }\n };\n\n return {\n write: (chunk): void => {\n pending += chunk;\n for (;;) {\n const newlineIndex = pending.indexOf(\"\\n\");\n if (newlineIndex < 0) {\n break;\n }\n const line = pending.slice(0, newlineIndex + 1);\n pending = pending.slice(newlineIndex + 1);\n writeLine(line);\n }\n },\n flush: (): void => {\n if (pending.length > 0) {\n const line = pending;\n pending = \"\";\n writeLine(line);\n }\n renderer.flush();\n },\n };\n};\n\nconst runMuonPrepareCommand = async (\n options: Pick<MuonPrepareOptions, \"prepareExecutablePath\" | \"environment\"> & {\n args: readonly string[];\n cwd: string | undefined;\n quiet: boolean;\n parseProgressJson: boolean;\n },\n): Promise<string> => {\n const executable = await resolveMuonBuilderExecutable(options);\n const child = spawn(executable, [...options.args], {\n cwd: options.cwd,\n env: options.environment,\n stdio: [\"ignore\", \"pipe\", \"pipe\"],\n });\n let stdout = \"\";\n let stderr = \"\";\n child.stdout.setEncoding(\"utf8\");\n child.stderr.setEncoding(\"utf8\");\n const stderrForwarder = options.quiet\n ? undefined\n : options.parseProgressJson\n ? createProgressJsonStderrForwarder()\n : createPlainStderrForwarder();\n child.stdout.on(\"data\", (chunk: string) => {\n stdout += chunk;\n });\n child.stderr.on(\"data\", (chunk: string) => {\n stderr += chunk;\n stderrForwarder?.write(chunk);\n });\n const exitCode = await (async (): Promise<number> => {\n try {\n return await new Promise<number>((resolvePromise, reject) => {\n child.on(\"error\", reject);\n child.on(\"close\", (code) => {\n resolvePromise(code ?? 1);\n });\n });\n } finally {\n stderrForwarder?.flush();\n }\n })();\n if (exitCode !== 0) {\n throw new Error(\n `muon-builder failed with exit code ${exitCode}.\\n${stderr.trim()}`,\n );\n }\n return stdout;\n};\n\n/**\n * Invokes the native muon-builder executable and returns the prepared runtime.\n *\n * @param options Native prepare invocation options.\n * @returns Prepared runtime location.\n */\nexport const runMuonPrepare = async (\n options: MuonPrepareOptions,\n): Promise<MuonPrepareResult> => {\n const args = createMuonPrepareArguments(options);\n const stdout = await runMuonPrepareCommand({\n prepareExecutablePath: options.prepareExecutablePath,\n environment: options.environment,\n cwd: options.cwd,\n quiet: options.quiet,\n parseProgressJson: !options.quiet,\n args,\n });\n const result = JSON.parse(stdout) as Partial<MuonPrepareResult>;\n if (\n (result.stagePath !== undefined && typeof result.stagePath !== \"string\") ||\n typeof result.muonPath !== \"string\" ||\n typeof result.cefPath !== \"string\" ||\n typeof result.cacheHit !== \"boolean\"\n ) {\n throw new Error(`muon-builder returned invalid JSON: ${stdout}`);\n }\n return {\n ...(result.stagePath === undefined ? {} : { stagePath: result.stagePath }),\n muonPath: result.muonPath,\n cefPath: result.cefPath,\n cacheHit: result.cacheHit,\n };\n};\n\n/**\n * Invokes the native muon-builder executable to write Windows PE resources.\n *\n * @param options Resource update invocation options.\n */\nexport const runMuonPrepareResourceUpdate = async (\n options: MuonPrepareResourceUpdateOptions,\n): Promise<void> => {\n await runMuonPrepareCommand({\n prepareExecutablePath: options.prepareExecutablePath,\n environment: options.environment,\n cwd: options.cwd,\n quiet: options.quiet,\n parseProgressJson: false,\n args: [\n \"resource\",\n \"--input\",\n options.inputPath,\n \"--updates-json\",\n options.updatesJsonPath,\n \"--output\",\n options.outputPath,\n ...(options.quiet ? [\"--quiet\"] : []),\n ],\n });\n};\n","// muon - Multi-platform GUI application framework that uses CEF as its backend\n// Copyright (c) Kouji Matsui. (@kekyo@mi.kekyo.net)\n// Under MIT.\n// https://github.com/kekyo/muon-ui\n\nimport { constants } from \"node:fs\";\nimport { access, readFile } from \"node:fs/promises\";\n\nimport { dirname, join, resolve } from \"node:path\";\n\nimport { fileURLToPath } from \"node:url\";\n\nimport { parse } from \"json5\";\n\nimport { getDefaultMuonPrepareTarget } from \"../cef/prepare.js\";\nimport {\n allMuonTargets,\n normalizeMuonTarget,\n type MuonDesktopTarget,\n} from \"./targets.js\";\n\nimport type { MuonBuildTarget, MuonBuildOptions } from \"./build-types.js\";\nconst defaultConfigFileNames = [\"muon.json5\", \"muon.jsonc\", \"muon.json\"];\n\nconst defaultAppName = \"muon-app\";\n\nconst defaultAppId = \"muon-app\";\n\nconst moduleDirectory =\n typeof __dirname === \"string\"\n ? __dirname\n : dirname(fileURLToPath(import.meta.url));\n\n/** Parsed object used by application configuration. */\nexport type JsonObject = Record<string, unknown>;\n\n/** Resolved asset path and ZIP prefix. */\nexport type AssetInput = {\n /** Absolute path of the asset directory or archive. */\n sourcePath: string;\n /** Normalized archive entry prefix. */\n prefix: string;\n};\n\n/** Application configuration and the directory for relative paths. */\nexport type BuildConfig = {\n /** Parsed application configuration. */\n config: JsonObject;\n /** Base directory for paths declared in the configuration. */\n directory: string;\n};\n\n/**\n * Returns the host target used by muon build when no explicit target is passed.\n */\nexport const getDefaultMuonBuildTarget = (): MuonDesktopTarget => {\n return getDefaultMuonPrepareTarget(process.platform, process.arch);\n};\n\n/**\n * Normalizes a user-facing public target identifier.\n */\nexport const normalizeMuonBuildTarget = (target: string): MuonBuildTarget => {\n return normalizeMuonTarget(target, \"muon build target\");\n};\n\n/**\n * Resolves an explicit package directory or the installed distribution.\n * @param packageDirectory - Override, or undefined to use this bundle's directory.\n * @returns Absolute package directory.\n */\nexport const resolvePackageDirectory = (\n packageDirectory: string | undefined,\n): string => {\n if (packageDirectory !== undefined) {\n return resolve(packageDirectory);\n }\n\n return moduleDirectory;\n};\n\n/**\n * Selects and normalizes the targets requested by the build options.\n * @param options - Explicit targets and the all-targets setting.\n * @returns Unique targets in build order.\n */\nexport const resolveBuildTargets = (\n options: MuonBuildOptions,\n): MuonBuildTarget[] => {\n if (options.allTargets === true) {\n return [...allMuonTargets];\n }\n\n if (options.targets !== undefined && options.targets.length > 0) {\n return [\n ...new Set(\n options.targets.map((target) => normalizeMuonBuildTarget(target)),\n ),\n ];\n }\n\n if (options.allTargets !== false) {\n return [...allMuonTargets];\n }\n\n return [getDefaultMuonBuildTarget()];\n};\n\n/**\n * Resolves the asset source against its project or configuration directory.\n * @param root - Project directory for option overrides.\n * @param assetSourcePath - Explicit asset path, or undefined to use configuration.\n * @param assetPrefix - Archive prefix, or undefined for the archive root.\n * @param buildConfig - Configuration and its base directory.\n * @returns Absolute asset source and normalized archive prefix.\n */\nexport const resolveAssetInput = (\n root: string,\n assetSourcePath: string | undefined,\n assetPrefix: string | undefined,\n buildConfig: BuildConfig,\n): AssetInput => {\n const configuredAssetSourcePath =\n assetSourcePath === undefined\n ? readConfigAssetSourcePath(buildConfig.config)\n : undefined;\n const sourcePath =\n assetSourcePath !== undefined\n ? resolve(root, assetSourcePath)\n : configuredAssetSourcePath !== undefined\n ? resolve(buildConfig.directory, configuredAssetSourcePath)\n : resolve(root, \"assets\");\n return {\n sourcePath,\n prefix: normalizeZipPrefix(assetPrefix ?? \"\"),\n };\n};\n\n/**\n * Normalizes an archive prefix to forward slashes.\n * @param prefix - User-provided archive prefix.\n * @returns Empty string or a prefix ending with a slash.\n */\nexport const normalizeZipPrefix = (prefix: string): string => {\n const normalized = prefix\n .replaceAll(\"\\\\\", \"/\")\n .split(\"/\")\n .filter((part) => part.length > 0)\n .join(\"/\");\n\n return normalized.length > 0 ? `${normalized}/` : \"\";\n};\n\n/**\n * Reads project metadata, allowing projects without package.json.\n * @param root - Project directory.\n * @returns Parsed metadata, or an empty object when package.json is absent.\n */\nexport const readPackageJson = async (root: string): Promise<JsonObject> => {\n const packageJsonPath = join(root, \"package.json\");\n if (!(await fileExists(packageJsonPath))) {\n return {};\n }\n return await readJsonObjectFile(packageJsonPath, \"package.json\");\n};\n\nconst resolvePackageName = (packageJson: JsonObject): string => {\n return typeof packageJson.name === \"string\"\n ? packageJson.name\n : defaultAppName;\n};\n\n/**\n * Resolves and sanitizes the launcher name from build options or package metadata.\n * @param packageJson - Project metadata.\n * @param appName - Explicit name, or undefined to use the package name.\n * @returns Launcher name safe for distribution filenames.\n */\nexport const resolveAppName = (\n packageJson: JsonObject,\n appName: string | undefined,\n): string => {\n if (appName !== undefined) {\n return sanitizeAppName(appName);\n }\n\n const packageName = resolvePackageName(packageJson);\n const unscopedName = packageName.startsWith(\"@\")\n ? packageName.slice(packageName.indexOf(\"/\") + 1)\n : packageName;\n\n return sanitizeAppName(unscopedName);\n};\n\nconst sanitizeAppName = (name: string): string => {\n const sanitized = name\n .trim()\n .toLowerCase()\n .replace(/[^a-z0-9._-]+/g, \"-\")\n .replace(/^[.-]+/g, \"\")\n .replace(/[.-]+$/g, \"\");\n\n return sanitized.length > 0 ? sanitized : defaultAppName;\n};\n\n/**\n * Resolves and sanitizes the application identifier.\n * @param packageJson - Project metadata.\n * @param appId - Explicit identifier, or undefined to use the package name.\n * @returns Sanitized application identifier.\n */\nexport const resolveAppId = (\n packageJson: JsonObject,\n appId: string | undefined,\n): string => {\n if (appId !== undefined) {\n return sanitizeAppId(appId);\n }\n return sanitizeAppId(resolvePackageName(packageJson));\n};\n\nconst sanitizeAppId = (value: string): string => {\n const unscoped = value.startsWith(\"@\") ? value.slice(1) : value;\n const sanitized = unscoped\n .trim()\n .toLowerCase()\n .replace(\"/\", \".\")\n .replace(/[^a-z0-9._-]+/g, \".\")\n .replace(/^[.]+/g, \"\")\n .replace(/[.]+$/g, \"\");\n return sanitized.length > 0 ? sanitized : defaultAppId;\n};\n\n/**\n * Reads the selected application configuration and its base directory.\n * @param root - Project directory.\n * @param configPath - Explicit path, or undefined to search default filenames.\n * @returns Parsed configuration and the directory for relative paths.\n */\nexport const readBuildConfig = async (\n root: string,\n configPath: string | undefined,\n): Promise<BuildConfig> => {\n const resolvedConfigPath = await resolveConfigPath(root, configPath);\n if (resolvedConfigPath === undefined) {\n return {\n config: {},\n directory: root,\n };\n }\n\n return {\n config: await readJsonObjectFile(resolvedConfigPath, \"muon config file\"),\n directory: dirname(resolvedConfigPath),\n };\n};\n\nconst readConfigAssetSourcePath = (\n sourceConfig: JsonObject,\n): string | undefined => {\n const sourceAsset = sourceConfig.asset;\n if (sourceAsset === undefined) {\n return undefined;\n }\n if (!isJsonObject(sourceAsset)) {\n throw new Error(\"muon.json asset must be an object when present.\");\n }\n\n const sourceAssetPath = sourceAsset.sourcePath;\n if (sourceAssetPath === undefined) {\n return undefined;\n }\n if (typeof sourceAssetPath !== \"string\") {\n throw new Error(\n \"muon.json asset.sourcePath must be a string when present.\",\n );\n }\n\n return sourceAssetPath;\n};\n\nconst resolveConfigPath = async (\n root: string,\n configPath: string | undefined,\n): Promise<string | undefined> => {\n if (configPath !== undefined) {\n const resolvedPath = resolve(root, configPath);\n if (await fileExists(resolvedPath)) {\n return resolvedPath;\n }\n\n throw new Error(`muon config file does not exist: ${resolvedPath}`);\n }\n\n for (const fileName of defaultConfigFileNames) {\n const candidatePath = join(root, fileName);\n if (await fileExists(candidatePath)) {\n return candidatePath;\n }\n }\n\n return undefined;\n};\n\nconst readJsonObjectFile = async (\n filePath: string,\n label: string,\n): Promise<JsonObject> => {\n let content: string;\n try {\n content = await readFile(filePath, \"utf8\");\n } catch (error) {\n throw new Error(\n `${label} could not be read: ${filePath}: ${getErrorMessage(error)}`,\n );\n }\n\n let parsed: unknown;\n try {\n parsed = parse(content);\n } catch (error) {\n throw new Error(\n `${label} could not be parsed: ${filePath}: ${getErrorMessage(error)}`,\n );\n }\n\n if (!isJsonObject(parsed)) {\n throw new Error(`${label} must contain a JSON object: ${filePath}`);\n }\n\n return parsed;\n};\n\n/**\n * Reports whether a path exists.\n * @param path - Filesystem path to inspect.\n * @returns Whether the path can be accessed.\n */\nexport const fileExists = async (path: string): Promise<boolean> => {\n try {\n await access(path, constants.F_OK);\n return true;\n } catch {\n return false;\n }\n};\n\n/**\n * Checks for an object that can hold configuration fields.\n * @param value - Parsed JSON value.\n * @returns Whether the value is a non-null object excluding arrays.\n */\nexport const isJsonObject = (value: unknown): value is JsonObject => {\n return typeof value === \"object\" && value !== null && !Array.isArray(value);\n};\n\n/**\n * Converts a caught value to a diagnostic string.\n * @param error - Caught exception or rejection value.\n * @returns A readable error message.\n */\nexport const getErrorMessage = (error: unknown): string =>\n error instanceof Error ? error.message : String(error);\n","// muon - Multi-platform GUI application framework that uses CEF as its backend\n// Copyright (c) Kouji Matsui. (@kekyo@mi.kekyo.net)\n// Under MIT.\n// https://github.com/kekyo/muon-ui\n\nimport { access, cp, readFile, stat, writeFile } from \"node:fs/promises\";\nimport { randomBytes } from \"node:crypto\";\nimport { basename, dirname, join } from \"node:path\";\n\nimport { parse } from \"json5\";\n\n/**\n * Fixed byte size reserved in muon-core for an embedded muon.json payload.\n */\nexport const muonEmbeddedConfigSlotSize = 64 * 1024;\n\n/**\n * Fixed byte sequence used to locate an unembedded config slot.\n */\nconst muonEmbeddedConfigEmptySlotMarker = Buffer.from([\n 0x6d, 0x75, 0x6f, 0x6e, 0x2d, 0x63, 0x6f, 0x72, 0x65, 0x3a, 0x65, 0x6d, 0x62,\n 0x65, 0x64, 0x2d, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x3a, 0x73, 0x6c, 0x6f,\n 0x74, 0x3a, 0x76, 0x31, 0x00, 0x5d,\n]);\n\nconst muonEmbeddedConfigPayloadCapacity = muonEmbeddedConfigSlotSize;\nconst muonLauncherEmbeddedConfigSlotSize = 64 * 1024;\nconst muonLauncherEmbeddedConfigEmptySlotMarker = Buffer.from([\n 0x6d, 0x75, 0x6f, 0x6e, 0x2d, 0x6c, 0x61, 0x75, 0x6e, 0x63, 0x68, 0x65, 0x72,\n 0x3a, 0x65, 0x6d, 0x62, 0x65, 0x64, 0x2d, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67,\n 0x3a, 0x76, 0x31, 0x00, 0x5d,\n]);\nconst muonLauncherEmbeddedConfigPayloadCapacity =\n muonLauncherEmbeddedConfigSlotSize;\n\nconst tlvNullTag = 0;\nconst tlvFalseTag = 1;\nconst tlvTrueTag = 2;\nconst tlvUintTag = 3;\nconst tlvStringTag = 4;\nconst tlvBinaryTag = 5;\nconst tlvArrayTag = 6;\nconst tlvObjectTag = 7;\n\n/**\n * Result returned by a muon executable config embedding operation.\n */\nexport interface EmbedMuonConfigResult {\n /** Input executable path. For launcher embedding this is the launcher path. */\n readonly corePath: string;\n /** Written executable path. */\n readonly outputPath: string;\n /** Byte offset of the fixed embedded config slot. */\n readonly slotOffset: number;\n /** Encoded TLV payload size in bytes. */\n readonly payloadSize: number;\n /** Whether an existing embedded payload was replaced. Always false. */\n readonly replaced: boolean;\n}\n\n/**\n * Options for embedding a config into a single muon-core executable.\n */\nexport interface EmbedMuonConfigCoreOptions {\n /** muon-core executable path to patch. */\n readonly corePath: string;\n /** muon.json, muon.json5, or muon.jsonc input path. */\n readonly configPath: string;\n /** Optional output executable path. When omitted, corePath is updated. */\n readonly outputPath: string | undefined;\n}\n\n/**\n * Options for embedding a config into a single muon-launcher executable.\n */\nexport interface EmbedMuonConfigLauncherOptions {\n /** muon-launcher executable path to patch. */\n readonly launcherPath: string;\n /** muon.json, muon.json5, or muon.jsonc input path. */\n readonly configPath: string;\n /** Optional output executable path. When omitted, launcherPath is updated. */\n readonly outputPath: string | undefined;\n}\n\n/**\n * Options for embedding a config into a runtime directory.\n */\nexport interface EmbedMuonConfigRuntimeOptions {\n /** Runtime directory containing muon-core or muon-core.exe. */\n readonly runtimePath: string;\n /** muon.json, muon.json5, or muon.jsonc input path. */\n readonly configPath: string;\n /** Optional output runtime directory. When omitted, runtimePath is updated. */\n readonly outputRuntimePath: string | undefined;\n}\n\n/**\n * Unembedded config slot found in a muon-core executable.\n */\nexport interface MuonEmbeddedConfigSlot {\n /** Empty slot state. */\n readonly state: \"empty\";\n /** Byte offset of the slot. */\n readonly offset: number;\n /** Empty payload. */\n readonly payload: Buffer;\n /** Payload byte size. */\n readonly payloadSize: 0;\n}\n\n/**\n * Unembedded launcher config slot found in a muon-launcher executable.\n */\nexport interface MuonLauncherEmbeddedConfigSlot {\n /** Empty slot state. */\n readonly state: \"empty\";\n /** Byte offset of the slot. */\n readonly offset: number;\n /** Empty payload. */\n readonly payload: Buffer;\n /** Payload byte size. */\n readonly payloadSize: 0;\n}\n\nconst getEmbeddedConfigEmptySlotByte = (index: number): number => {\n if (index < muonEmbeddedConfigEmptySlotMarker.length) {\n return muonEmbeddedConfigEmptySlotMarker[index] ?? 0;\n }\n const value =\n 0xa5 ^\n Math.imul(index, 0x25) ^\n Math.imul(index >>> 8, 0x6d) ^\n Math.imul(index >>> 16, 0x3b) ^\n (Math.imul(index, 0x9e3779b1) >>> 24);\n return value & 0xff;\n};\n\nconst createEmptySlot = (): Buffer => {\n const slot = Buffer.allocUnsafe(muonEmbeddedConfigSlotSize);\n for (let index = 0; index < slot.length; index += 1) {\n slot[index] = getEmbeddedConfigEmptySlotByte(index);\n }\n return slot;\n};\n\nconst encodeVarUint = (value: bigint): Buffer => {\n const bytes: number[] = [];\n let remaining = value;\n do {\n let byte = Number(remaining & 0x7fn);\n remaining >>= 7n;\n if (remaining !== 0n) {\n byte |= 0x80;\n }\n bytes.push(byte);\n } while (remaining !== 0n);\n return Buffer.from(bytes);\n};\n\nconst encodeRawString = (value: string): Buffer => {\n const bytes = Buffer.from(value, \"utf8\");\n return Buffer.concat([encodeVarUint(BigInt(bytes.length)), bytes]);\n};\n\nconst encodeTaggedBytes = (tag: number, bytes: Uint8Array): Buffer =>\n Buffer.concat([\n Buffer.from([tag]),\n encodeVarUint(BigInt(bytes.length)),\n Buffer.from(bytes),\n ]);\n\nconst isJsonObject = (value: unknown): value is Record<string, unknown> =>\n typeof value === \"object\" && value !== null && !Array.isArray(value);\n\nconst isPath = (\n path: readonly string[],\n first: string,\n second: string,\n): boolean => path.length === 2 && path[0] === first && path[1] === second;\n\nconst isPluginSignaturePath = (path: readonly string[]): boolean =>\n path.length === 3 &&\n path[0] === \"plugin\" &&\n path[1] === \"plugins\" &&\n path[2] === \"signature\";\n\nconst isPluginSaltPath = (path: readonly string[]): boolean =>\n path.length === 3 &&\n path[0] === \"plugin\" &&\n path[1] === \"plugins\" &&\n path[2] === \"salt\";\n\nconst isHexString = (value: string): boolean =>\n value.length % 2 === 0 && /^[0-9a-fA-F]*$/.test(value);\n\nconst decodeHexString = (value: string): Buffer => {\n const bytes = Buffer.alloc(value.length / 2);\n for (let index = 0; index < value.length; index += 2) {\n bytes[index / 2] = Number.parseInt(value.slice(index, index + 2), 16);\n }\n return bytes;\n};\n\nconst encodeKnownBinaryString = (\n path: readonly string[],\n value: string,\n): Buffer | undefined => {\n if (isPath(path, \"asset\", \"signature\")) {\n return value.length === 64 && isHexString(value)\n ? decodeHexString(value)\n : undefined;\n }\n if (isPath(path, \"asset\", \"salt\")) {\n return isHexString(value) ? decodeHexString(value) : undefined;\n }\n if (isPluginSignaturePath(path)) {\n return value.length === 64 && isHexString(value)\n ? decodeHexString(value)\n : undefined;\n }\n if (isPluginSaltPath(path)) {\n return isHexString(value) ? decodeHexString(value) : undefined;\n }\n if (isPath(path, \"browser\", \"backgroundColor\")) {\n const hex = value.startsWith(\"#\") ? value.slice(1) : value;\n return hex.length === 6 && isHexString(hex)\n ? decodeHexString(hex)\n : undefined;\n }\n return undefined;\n};\n\nconst encodeTlvValue = (value: unknown, path: readonly string[]): Buffer => {\n if (value === null) {\n return Buffer.from([tlvNullTag]);\n }\n if (typeof value === \"boolean\") {\n return Buffer.from([value ? tlvTrueTag : tlvFalseTag]);\n }\n if (typeof value === \"number\") {\n if (!Number.isSafeInteger(value) || value < 0) {\n throw new Error(\"muon embedded config supports only unsigned integers.\");\n }\n return Buffer.concat([\n Buffer.from([tlvUintTag]),\n encodeVarUint(BigInt(value)),\n ]);\n }\n if (typeof value === \"string\") {\n const binaryValue = encodeKnownBinaryString(path, value);\n if (binaryValue !== undefined) {\n return encodeTaggedBytes(tlvBinaryTag, binaryValue);\n }\n return encodeTaggedBytes(tlvStringTag, Buffer.from(value, \"utf8\"));\n }\n if (Array.isArray(value)) {\n return Buffer.concat([\n Buffer.from([tlvArrayTag]),\n encodeVarUint(BigInt(value.length)),\n ...value.map((entry) => encodeTlvValue(entry, path)),\n ]);\n }\n if (isJsonObject(value)) {\n const entries = Object.entries(value);\n return Buffer.concat([\n Buffer.from([tlvObjectTag]),\n encodeVarUint(BigInt(entries.length)),\n ...entries.flatMap(([key, entry]) => [\n encodeRawString(key),\n encodeTlvValue(entry, [...path, key]),\n ]),\n ]);\n }\n throw new Error(\"muon embedded config contains an unsupported value.\");\n};\n\n/**\n * Encodes a parsed muon config object as the embedded TLV payload.\n *\n * @param config Parsed muon config value.\n * @returns Encoded TLV payload bytes.\n */\nexport const encodeMuonConfigTlv = (config: unknown): Buffer =>\n encodeTlvValue(config, []);\n\n/**\n * Creates an empty or payload-filled fixed embedded config slot.\n *\n * @param payload Optional encoded TLV payload bytes.\n * @returns Fixed-size slot image.\n */\nexport const createMuonEmbeddedConfigSlot = (\n payload: Uint8Array | undefined = undefined,\n): Buffer => {\n if (\n payload !== undefined &&\n payload.length > muonEmbeddedConfigPayloadCapacity\n ) {\n throw new Error(\n `Encoded muon config exceeds the embedded slot capacity: ${payload.length} > ${muonEmbeddedConfigPayloadCapacity}`,\n );\n }\n\n if (payload === undefined) {\n return createEmptySlot();\n }\n\n const slot = randomBytes(muonEmbeddedConfigSlotSize);\n Buffer.from(payload).copy(slot, 0);\n return slot;\n};\n\n/**\n * Creates an empty or payload-filled fixed muon-launcher embedded config slot.\n *\n * @param payload Optional encoded TLV payload bytes.\n * @returns Fixed-size slot image.\n */\nexport const createMuonLauncherEmbeddedConfigSlot = (\n payload: Uint8Array | undefined = undefined,\n): Buffer => {\n if (\n payload !== undefined &&\n payload.length > muonLauncherEmbeddedConfigPayloadCapacity\n ) {\n throw new Error(\n `Encoded muon config exceeds the embedded launcher slot capacity: ${payload.length} > ${muonLauncherEmbeddedConfigPayloadCapacity}`,\n );\n }\n\n if (payload === undefined) {\n const slot = Buffer.alloc(muonLauncherEmbeddedConfigSlotSize, 0);\n muonLauncherEmbeddedConfigEmptySlotMarker.copy(slot, 0);\n return slot;\n }\n\n const slot = randomBytes(muonLauncherEmbeddedConfigSlotSize);\n Buffer.from(payload).copy(slot, 0);\n return slot;\n};\n\nconst isEmptySlotAt = (content: Buffer, offset: number): boolean => {\n for (let index = 0; index < muonEmbeddedConfigSlotSize; index += 1) {\n if (content[offset + index] !== getEmbeddedConfigEmptySlotByte(index)) {\n return false;\n }\n }\n return true;\n};\n\nconst inspectUnembeddedSlotAt = (\n content: Buffer,\n offset: number,\n): MuonEmbeddedConfigSlot | undefined => {\n if (offset < 0 || offset + muonEmbeddedConfigSlotSize > content.length) {\n return undefined;\n }\n if (isEmptySlotAt(content, offset)) {\n return {\n state: \"empty\",\n offset,\n payload: Buffer.alloc(0),\n payloadSize: 0,\n };\n }\n return undefined;\n};\n\nconst collectSlotCandidates = (content: Buffer): MuonEmbeddedConfigSlot[] => {\n const candidates = new Map<number, MuonEmbeddedConfigSlot>();\n for (\n let offset = content.indexOf(muonEmbeddedConfigEmptySlotMarker);\n offset >= 0;\n offset = content.indexOf(muonEmbeddedConfigEmptySlotMarker, offset + 1)\n ) {\n const slot = inspectUnembeddedSlotAt(content, offset);\n if (slot !== undefined) {\n candidates.set(slot.offset, slot);\n }\n }\n return [...candidates.values()].sort(\n (left, right) => left.offset - right.offset,\n );\n};\n\nconst isEmptyLauncherSlotAt = (content: Buffer, offset: number): boolean => {\n if (\n offset < 0 ||\n offset + muonLauncherEmbeddedConfigSlotSize > content.length\n ) {\n return false;\n }\n if (\n !content\n .subarray(\n offset,\n offset + muonLauncherEmbeddedConfigEmptySlotMarker.length,\n )\n .equals(muonLauncherEmbeddedConfigEmptySlotMarker)\n ) {\n return false;\n }\n for (\n let index = muonLauncherEmbeddedConfigEmptySlotMarker.length;\n index < muonLauncherEmbeddedConfigSlotSize;\n index += 1\n ) {\n if (content[offset + index] !== 0) {\n return false;\n }\n }\n return true;\n};\n\nconst inspectUnembeddedLauncherSlotAt = (\n content: Buffer,\n offset: number,\n): MuonLauncherEmbeddedConfigSlot | undefined => {\n if (!isEmptyLauncherSlotAt(content, offset)) {\n return undefined;\n }\n return {\n state: \"empty\",\n offset,\n payload: Buffer.alloc(0),\n payloadSize: 0,\n };\n};\n\nconst collectLauncherSlotCandidates = (\n content: Buffer,\n): MuonLauncherEmbeddedConfigSlot[] => {\n const candidates = new Map<number, MuonLauncherEmbeddedConfigSlot>();\n for (\n let offset = content.indexOf(muonLauncherEmbeddedConfigEmptySlotMarker);\n offset >= 0;\n offset = content.indexOf(\n muonLauncherEmbeddedConfigEmptySlotMarker,\n offset + 1,\n )\n ) {\n const slot = inspectUnembeddedLauncherSlotAt(content, offset);\n if (slot !== undefined) {\n candidates.set(slot.offset, slot);\n }\n }\n return [...candidates.values()].sort(\n (left, right) => left.offset - right.offset,\n );\n};\n\n/**\n * Finds the fixed unembedded config slot in a muon-core executable image.\n *\n * @param content muon-core executable bytes.\n * @returns The single detected unembedded config slot.\n */\nexport const findMuonEmbeddedConfigSlot = (\n content: Uint8Array,\n): MuonEmbeddedConfigSlot => {\n const buffer = Buffer.isBuffer(content) ? content : Buffer.from(content);\n const candidates = collectSlotCandidates(buffer);\n if (candidates.length !== 1) {\n throw new Error(\n `Expected exactly one unembedded muon config slot, found ${candidates.length}.`,\n );\n }\n const [candidate] = candidates;\n if (candidate === undefined) {\n throw new Error(\"Embedded muon config slot was not found.\");\n }\n return candidate;\n};\n\n/**\n * Finds the fixed unembedded config slot in a muon-launcher executable image.\n *\n * @param content muon-launcher executable bytes.\n * @returns The single detected unembedded launcher config slot.\n */\nexport const findMuonLauncherEmbeddedConfigSlot = (\n content: Uint8Array,\n): MuonLauncherEmbeddedConfigSlot => {\n const buffer = Buffer.isBuffer(content) ? content : Buffer.from(content);\n const candidates = collectLauncherSlotCandidates(buffer);\n if (candidates.length !== 1) {\n throw new Error(\n `Expected exactly one unembedded muon-launcher config slot, found ${candidates.length}.`,\n );\n }\n const [candidate] = candidates;\n if (candidate === undefined) {\n throw new Error(\"Embedded muon-launcher config slot was not found.\");\n }\n return candidate;\n};\n\nconst fileExists = async (path: string): Promise<boolean> => {\n try {\n const stats = await stat(path);\n return stats.isFile();\n } catch {\n return false;\n }\n};\n\nconst resolveMuonConfigInputPath = async (\n configPath: string,\n): Promise<string> => {\n if (basename(configPath) === \"muon.json\") {\n const directory = dirname(configPath);\n for (const fileName of [\"muon.json5\", \"muon.jsonc\", \"muon.json\"]) {\n const candidate = join(directory, fileName);\n if (await fileExists(candidate)) {\n return candidate;\n }\n }\n }\n if (!(await fileExists(configPath))) {\n throw new Error(`muon config does not exist: ${configPath}`);\n }\n return configPath;\n};\n\nconst readMuonConfigInput = async (configPath: string): Promise<unknown> => {\n const resolvedPath = await resolveMuonConfigInputPath(configPath);\n return parse(await readFile(resolvedPath, \"utf8\"));\n};\n\nconst isSignedPeExecutable = (content: Buffer): boolean => {\n if (content.length < 0x40 || content[0] !== 0x4d || content[1] !== 0x5a) {\n return false;\n }\n const peOffset = content.readUInt32LE(0x3c);\n if (\n peOffset + 0x18 >= content.length ||\n content.toString(\"ascii\", peOffset, peOffset + 4) !== \"PE\\u0000\\u0000\"\n ) {\n return false;\n }\n\n const optionalHeaderOffset = peOffset + 0x18;\n const optionalHeaderSize = content.readUInt16LE(peOffset + 0x14);\n const optionalHeaderEnd = optionalHeaderOffset + optionalHeaderSize;\n if (optionalHeaderEnd > content.length) {\n return false;\n }\n\n const magic = content.readUInt16LE(optionalHeaderOffset);\n const dataDirectoryOffset =\n magic === 0x20b ? optionalHeaderOffset + 112 : optionalHeaderOffset + 96;\n const certificateEntryOffset = dataDirectoryOffset + 4 * 8;\n if (certificateEntryOffset + 8 > optionalHeaderEnd) {\n return false;\n }\n const certificateSize = content.readUInt32LE(certificateEntryOffset + 4);\n return certificateSize !== 0;\n};\n\n/**\n * Embeds a muon config into a single muon-core executable.\n *\n * @param options Core executable embedding options.\n * @returns Embedding result metadata.\n */\nexport const embedMuonConfigInCoreFile = async ({\n corePath,\n configPath,\n outputPath,\n}: EmbedMuonConfigCoreOptions): Promise<EmbedMuonConfigResult> => {\n const config = await readMuonConfigInput(configPath);\n const payload = encodeMuonConfigTlv(config);\n const embeddedSlot = createMuonEmbeddedConfigSlot(payload);\n const coreContent = await readFile(corePath);\n if (isSignedPeExecutable(coreContent)) {\n throw new Error(\"Cannot embed muon config into a signed PE executable.\");\n }\n\n const slot = findMuonEmbeddedConfigSlot(coreContent);\n const patchedContent = Buffer.from(coreContent);\n embeddedSlot.copy(patchedContent, slot.offset);\n const resolvedOutputPath = outputPath ?? corePath;\n await writeFile(resolvedOutputPath, patchedContent);\n\n return {\n corePath,\n outputPath: resolvedOutputPath,\n slotOffset: slot.offset,\n payloadSize: payload.length,\n replaced: false,\n };\n};\n\n/**\n * Embeds a muon config into a single muon-launcher executable.\n *\n * @param options Launcher executable embedding options.\n * @returns Embedding result metadata.\n */\nexport const embedMuonConfigInLauncherFile = async ({\n launcherPath,\n configPath,\n outputPath,\n}: EmbedMuonConfigLauncherOptions): Promise<EmbedMuonConfigResult> => {\n const config = await readMuonConfigInput(configPath);\n const payload = encodeMuonConfigTlv(config);\n const embeddedSlot = createMuonLauncherEmbeddedConfigSlot(payload);\n const launcherContent = await readFile(launcherPath);\n if (isSignedPeExecutable(launcherContent)) {\n throw new Error(\n \"Cannot embed muon config into a signed muon-launcher PE executable.\",\n );\n }\n\n const slot = findMuonLauncherEmbeddedConfigSlot(launcherContent);\n const patchedContent = Buffer.from(launcherContent);\n embeddedSlot.copy(patchedContent, slot.offset);\n const resolvedOutputPath = outputPath ?? launcherPath;\n await writeFile(resolvedOutputPath, patchedContent);\n\n return {\n corePath: launcherPath,\n outputPath: resolvedOutputPath,\n slotOffset: slot.offset,\n payloadSize: payload.length,\n replaced: false,\n };\n};\n\nconst resolveRuntimeCorePath = async (runtimePath: string): Promise<string> => {\n const candidates = [\n join(runtimePath, \"muon-core\"),\n join(runtimePath, \"muon-core.exe\"),\n ];\n const existing: string[] = [];\n for (const candidate of candidates) {\n try {\n await access(candidate);\n existing.push(candidate);\n } catch {\n // Missing candidates are ignored until the final count check.\n }\n }\n if (existing.length !== 1) {\n throw new Error(\n `Expected exactly one muon-core executable in runtime path, found ${existing.length}.`,\n );\n }\n const [corePath] = existing;\n if (corePath === undefined) {\n throw new Error(\"muon-core executable was not found.\");\n }\n return corePath;\n};\n\n/**\n * Embeds a muon config into a runtime directory containing muon-core.\n *\n * @param options Runtime directory embedding options.\n * @returns Embedding result metadata.\n */\nexport const embedMuonConfigInRuntime = async ({\n runtimePath,\n configPath,\n outputRuntimePath,\n}: EmbedMuonConfigRuntimeOptions): Promise<EmbedMuonConfigResult> => {\n const targetRuntimePath = outputRuntimePath ?? runtimePath;\n if (outputRuntimePath !== undefined) {\n await cp(runtimePath, outputRuntimePath, {\n recursive: true,\n force: true,\n });\n }\n return embedMuonConfigInCoreFile({\n corePath: await resolveRuntimeCorePath(targetRuntimePath),\n configPath,\n outputPath: undefined,\n });\n};\n","// muon - Multi-platform GUI application framework that uses CEF as its backend\n// Copyright (c) Kouji Matsui. (@kekyo@mi.kekyo.net)\n// Under MIT.\n// https://github.com/kekyo/muon-ui\n\nimport { constants } from \"node:fs\";\nimport {\n access,\n chmod,\n copyFile,\n mkdtemp,\n readFile,\n rm,\n stat,\n writeFile,\n} from \"node:fs/promises\";\nimport { tmpdir } from \"node:os\";\nimport { dirname, extname, isAbsolute, join, resolve } from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\n\nimport { parse } from \"json5\";\n\nimport { runMuonPrepareResourceUpdate } from \"./prepare.js\";\nimport type { MuonWindowsResourceOptions } from \"../common/vite.js\";\nimport {\n createNormalizedMuonIconPngData,\n createWindowsIconFromPngFile,\n} from \"./windows-icon.js\";\nimport {\n createAppIconOptionsSource,\n readConfigAppIconSource,\n readProjectAppIconSource,\n resolveMuonAppIconPath,\n type MuonAppIconSource,\n} from \"../common/app-icon.js\";\n\nexport type { MuonWindowsResourceOptions } from \"../common/vite.js\";\n\nconst defaultConfigFileNames = [\"muon.json5\", \"muon.jsonc\", \"muon.json\"];\nconst defaultLanguage = 1033;\nconst defaultCodePage = 1200;\nconst moduleDirectory =\n typeof __dirname === \"string\"\n ? __dirname\n : dirname(fileURLToPath(import.meta.url));\n\ntype JsonObject = Record<string, unknown>;\n\ninterface WindowsResourceSource {\n options: MuonWindowsResourceOptions;\n directory: string;\n}\n\ninterface WindowsResourceDefaults {\n productName: string;\n fileDescription: string;\n companyName: string;\n version: string;\n copyright: string | undefined;\n}\n\ninterface ResolveWindowsResourceInput {\n root: string;\n packageDirectory: string;\n packageJson: JsonObject;\n muonConfig: JsonObject;\n muonConfigDirectory: string;\n options: MuonWindowsResourceOptions | undefined;\n appIconPath: string | undefined;\n defaults: WindowsResourceDefaults;\n}\n\n/**\n * Resolved Windows resource metadata used by build and pack outputs.\n */\nexport interface ResolvedMuonWindowsResource {\n /** Resolved `.png` icon file path. */\n iconPath: string;\n /** Product name. */\n productName: string;\n /** File description. */\n fileDescription: string;\n /** Company name. */\n companyName: string;\n /** Original version string. */\n version: string;\n /** Four-part fixed version string. */\n fixedVersion: string;\n /** Legal copyright, if supplied. */\n copyright: string | undefined;\n /** Windows resource language identifier. */\n language: number;\n /** Windows version resource code page. */\n codePage: number;\n}\n\n/**\n * muon config file content and directory used for resource option resolution.\n */\nexport interface MuonWindowsResourceConfigSource {\n /** Parsed muon config object. */\n config: JsonObject;\n /** Directory that relative config paths are resolved from. */\n directory: string;\n}\n\n/**\n * Reads the muon config file using the same default file names as muon build.\n */\nexport const readMuonConfigForWindowsResource = async (\n root: string,\n configPath: string | undefined,\n): Promise<MuonWindowsResourceConfigSource> => {\n const resolvedConfigPath = await resolveConfigPath(root, configPath);\n if (resolvedConfigPath === undefined) {\n return {\n config: {},\n directory: root,\n };\n }\n return {\n config: await readJsonObjectFile(resolvedConfigPath, \"muon config file\"),\n directory: dirname(resolvedConfigPath),\n };\n};\n\n/**\n * Merges Windows resource options while preserving field-level fallback.\n */\nexport const mergeMuonWindowsResourceOptions = (\n primary: MuonWindowsResourceOptions | undefined,\n fallback: MuonWindowsResourceOptions | undefined,\n): MuonWindowsResourceOptions | undefined => {\n if (primary === undefined) {\n return fallback;\n }\n if (fallback === undefined) {\n return primary;\n }\n\n const merged: MuonWindowsResourceOptions = { ...fallback };\n if (primary.iconPath !== undefined) {\n merged.iconPath = primary.iconPath;\n }\n if (primary.productName !== undefined) {\n merged.productName = primary.productName;\n }\n if (primary.fileDescription !== undefined) {\n merged.fileDescription = primary.fileDescription;\n }\n if (primary.companyName !== undefined) {\n merged.companyName = primary.companyName;\n }\n if (primary.version !== undefined) {\n merged.version = primary.version;\n }\n if (primary.copyright !== undefined) {\n merged.copyright = primary.copyright;\n }\n if (primary.language !== undefined) {\n merged.language = primary.language;\n }\n if (primary.codePage !== undefined) {\n merged.codePage = primary.codePage;\n }\n return merged;\n};\n\n/**\n * Resolves Windows resource metadata from options, config files, and package metadata.\n */\nexport const resolveMuonWindowsResource = async (\n input: ResolveWindowsResourceInput,\n): Promise<ResolvedMuonWindowsResource> => {\n const projectJson = await readProjectJson(input.root);\n const windowsSources = [\n createOptionsSource(input.options, input.root, \"windowsResource\"),\n readConfigWindowsResourceSource(\n input.muonConfig,\n input.muonConfigDirectory,\n \"muon.json\",\n ),\n readConfigWindowsResourceSource(projectJson, input.root, \"project.json\"),\n ].filter((source): source is WindowsResourceSource => source !== undefined);\n const sources = [\n ...windowsSources,\n createProjectSource(projectJson, input.root),\n createPackageSource(input.packageJson, input.root),\n ].filter((source): source is WindowsResourceSource => source !== undefined);\n const appIconSources = [\n createAppIconOptionsSource(input.appIconPath, input.root),\n readConfigAppIconSource(\n input.muonConfig,\n input.muonConfigDirectory,\n \"muon.json\",\n ),\n readProjectAppIconSource(projectJson, input.root),\n ].filter((source): source is MuonAppIconSource => source !== undefined);\n\n const productName = resolveStringField(\n sources,\n \"productName\",\n input.defaults.productName,\n );\n const fileDescription = resolveStringField(\n sources,\n \"fileDescription\",\n input.defaults.fileDescription,\n );\n const companyName = resolveStringField(\n sources,\n \"companyName\",\n input.defaults.companyName,\n );\n const version = resolveStringField(\n sources,\n \"version\",\n input.defaults.version,\n );\n const copyright = resolveOptionalStringField(\n sources,\n \"copyright\",\n input.defaults.copyright,\n );\n const language = resolveNumericField(sources, \"language\", defaultLanguage);\n const codePage = resolveNumericField(sources, \"codePage\", defaultCodePage);\n const fixedVersion = normalizeWindowsVersion(version);\n const iconPath = await resolveWindowsIconPath(\n windowsSources,\n appIconSources,\n await resolveDefaultWindowsIcon(input.packageDirectory),\n );\n\n return {\n iconPath,\n productName,\n fileDescription,\n companyName,\n version,\n fixedVersion,\n copyright,\n language,\n codePage,\n };\n};\n\n/**\n * Removes build-only Windows resource settings from runtime config.\n */\nexport const stripBuildOnlyWindowsResourceConfig = (\n sourceConfig: JsonObject,\n): JsonObject => {\n const sourceWindows = sourceConfig.windows;\n if (!isJsonObject(sourceWindows)) {\n return sourceConfig;\n }\n\n const windowsConfig: JsonObject = {};\n for (const [key, value] of Object.entries(sourceWindows)) {\n if (key !== \"resource\") {\n windowsConfig[key] = value;\n }\n }\n\n const output: JsonObject = {};\n for (const [key, value] of Object.entries(sourceConfig)) {\n if (key !== \"windows\") {\n output[key] = value;\n }\n }\n if (Object.keys(windowsConfig).length > 0) {\n output.windows = windowsConfig;\n }\n return output;\n};\n\n/**\n * Returns true when the file has a Windows PE header.\n */\nexport const isWindowsPeExecutable = async (path: string): Promise<boolean> => {\n const content = await readFile(path);\n if (content.length < 0x40 || content.toString(\"ascii\", 0, 2) !== \"MZ\") {\n return false;\n }\n const peOffset = content.readUInt32LE(0x3c);\n return (\n peOffset + 4 <= content.length &&\n content.toString(\"ascii\", peOffset, peOffset + 4) === \"PE\\0\\0\"\n );\n};\n\n/**\n * Applies resolved resource metadata to a Windows PE executable in place.\n */\nexport const updateWindowsPeResources = async (input: {\n executablePath: string;\n resource: ResolvedMuonWindowsResource;\n environment: NodeJS.ProcessEnv;\n cwd: string;\n}): Promise<boolean> => {\n return await updateWindowsPeResourceFile(input, createEngraverUpdate);\n};\n\n/**\n * Applies only resolved icon metadata to a Windows PE executable in place.\n */\nexport const updateWindowsPeIconResource = async (input: {\n executablePath: string;\n resource: ResolvedMuonWindowsResource;\n environment: NodeJS.ProcessEnv;\n cwd: string;\n}): Promise<boolean> => {\n return await updateWindowsPeResourceFile(input, createEngraverIconUpdate);\n};\n\nconst updateWindowsPeResourceFile = async (\n input: {\n executablePath: string;\n resource: ResolvedMuonWindowsResource;\n environment: NodeJS.ProcessEnv;\n cwd: string;\n },\n createUpdate: (\n resource: ResolvedMuonWindowsResource,\n iconPath: string,\n ) => JsonObject,\n): Promise<boolean> => {\n if (!(await isWindowsPeExecutable(input.executablePath))) {\n return false;\n }\n\n const mode = (await stat(input.executablePath)).mode & 0o777;\n const tempDirectory = await mkdtemp(join(tmpdir(), \"muon-windows-resource-\"));\n const updatesJsonPath = join(tempDirectory, \"updates.json\");\n const outputPath = join(tempDirectory, \"output.exe\");\n const iconPath = join(tempDirectory, \"icon.ico\");\n try {\n await createWindowsIconFromPngFile(input.resource.iconPath, iconPath);\n await writeFile(\n updatesJsonPath,\n `${JSON.stringify(createUpdate(input.resource, iconPath), null, 2)}\\n`,\n );\n await runMuonPrepareResourceUpdate({\n inputPath: input.executablePath,\n updatesJsonPath,\n outputPath,\n quiet: true,\n prepareExecutablePath: undefined,\n environment: input.environment,\n cwd: input.cwd,\n });\n await copyFile(outputPath, input.executablePath);\n await chmod(input.executablePath, mode === 0 ? 0o755 : mode);\n return true;\n } finally {\n await rm(tempDirectory, { recursive: true, force: true });\n }\n};\n\nconst createEngraverUpdate = (\n resource: ResolvedMuonWindowsResource,\n iconPath: string,\n): JsonObject => {\n const strings: JsonObject = {\n CompanyName: resource.companyName,\n FileDescription: resource.fileDescription,\n FileVersion: resource.version,\n ProductName: resource.productName,\n ProductVersion: resource.version,\n };\n if (resource.copyright !== undefined) {\n strings.LegalCopyright = resource.copyright;\n }\n\n return {\n version: {\n language: resource.language,\n codePage: resource.codePage,\n fixed: {\n fileVersion: resource.fixedVersion,\n productVersion: resource.fixedVersion,\n fileOS: \"windows32\",\n fileType: \"app\",\n },\n strings,\n },\n icons: createEngraverIcons(resource, iconPath),\n };\n};\n\nconst createEngraverIconUpdate = (\n resource: ResolvedMuonWindowsResource,\n iconPath: string,\n): JsonObject => ({\n icons: createEngraverIcons(resource, iconPath),\n});\n\nconst createEngraverIcons = (\n resource: ResolvedMuonWindowsResource,\n iconPath: string,\n): JsonObject[] => [\n {\n id: 1,\n language: resource.language,\n path: iconPath,\n },\n];\n\nconst resolveConfigPath = async (\n root: string,\n configPath: string | undefined,\n): Promise<string | undefined> => {\n if (configPath !== undefined) {\n const resolvedPath = resolve(root, configPath);\n if (await fileExists(resolvedPath)) {\n return resolvedPath;\n }\n throw new Error(`muon config file does not exist: ${resolvedPath}`);\n }\n\n for (const fileName of defaultConfigFileNames) {\n const candidatePath = join(root, fileName);\n if (await fileExists(candidatePath)) {\n return candidatePath;\n }\n }\n return undefined;\n};\n\nconst readProjectJson = async (root: string): Promise<JsonObject> => {\n const projectJsonPath = join(root, \"project.json\");\n if (!(await fileExists(projectJsonPath))) {\n return {};\n }\n return await readJsonObjectFile(projectJsonPath, \"project.json\");\n};\n\nconst readJsonObjectFile = async (\n filePath: string,\n label: string,\n): Promise<JsonObject> => {\n const parsed = parse(await readFile(filePath, \"utf8\"));\n if (!isJsonObject(parsed)) {\n throw new Error(`${label} must contain a JSON object: ${filePath}`);\n }\n return parsed;\n};\n\nconst createOptionsSource = (\n options: MuonWindowsResourceOptions | undefined,\n directory: string,\n label: string,\n): WindowsResourceSource | undefined => {\n if (options === undefined) {\n return undefined;\n }\n return {\n options: validateWindowsResourceOptions(options, label),\n directory,\n };\n};\n\nconst readConfigWindowsResourceSource = (\n config: JsonObject,\n directory: string,\n label: string,\n): WindowsResourceSource | undefined => {\n const windows = config.windows;\n if (windows === undefined) {\n return undefined;\n }\n if (!isJsonObject(windows)) {\n throw new Error(`${label} windows must be an object when present.`);\n }\n const resource = windows.resource;\n if (resource === undefined) {\n return undefined;\n }\n return createOptionsSource(\n validateWindowsResourceOptions(resource, `${label} windows.resource`),\n directory,\n `${label} windows.resource`,\n );\n};\n\nconst createProjectSource = (\n projectJson: JsonObject,\n directory: string,\n): WindowsResourceSource | undefined => {\n const topLevel: MuonWindowsResourceOptions = {};\n copyStringField(projectJson, \"productName\", topLevel, \"productName\");\n copyStringField(projectJson, \"name\", topLevel, \"productName\");\n copyStringField(projectJson, \"fileDescription\", topLevel, \"fileDescription\");\n copyStringField(projectJson, \"description\", topLevel, \"fileDescription\");\n copyStringField(projectJson, \"companyName\", topLevel, \"companyName\");\n copyStringField(projectJson, \"version\", topLevel, \"version\");\n copyStringField(projectJson, \"copyright\", topLevel, \"copyright\");\n const author = stringifyAuthor(projectJson.author);\n if (author !== undefined && topLevel.companyName === undefined) {\n topLevel.companyName = author;\n }\n\n const configSource = readConfigWindowsResourceSource(\n projectJson,\n directory,\n \"project.json\",\n );\n const options = mergeMuonWindowsResourceOptions(\n configSource?.options,\n topLevel,\n );\n if (options === undefined || Object.keys(options).length === 0) {\n return undefined;\n }\n return {\n options,\n directory,\n };\n};\n\nconst createPackageSource = (\n packageJson: JsonObject,\n directory: string,\n): WindowsResourceSource | undefined => {\n const options: MuonWindowsResourceOptions = {};\n copyStringField(packageJson, \"name\", options, \"productName\");\n copyStringField(packageJson, \"description\", options, \"fileDescription\");\n copyStringField(packageJson, \"version\", options, \"version\");\n copyStringField(packageJson, \"copyright\", options, \"copyright\");\n const author = stringifyAuthor(packageJson.author);\n if (author !== undefined) {\n options.companyName = author;\n }\n return Object.keys(options).length === 0\n ? undefined\n : {\n options,\n directory,\n };\n};\n\nconst copyStringField = (\n source: JsonObject,\n sourceKey: string,\n target: MuonWindowsResourceOptions,\n targetKey: keyof Pick<\n MuonWindowsResourceOptions,\n \"productName\" | \"fileDescription\" | \"companyName\" | \"version\" | \"copyright\"\n >,\n): void => {\n const value = source[sourceKey];\n if (typeof value === \"string\" && value.trim() !== \"\") {\n target[targetKey] = value.trim();\n }\n};\n\nconst validateWindowsResourceOptions = (\n value: unknown,\n label: string,\n): MuonWindowsResourceOptions => {\n if (!isJsonObject(value)) {\n throw new Error(`${label} must be an object.`);\n }\n\n const output: MuonWindowsResourceOptions = {};\n copyOptionalStringResourceField(value, \"iconPath\", output);\n copyOptionalStringResourceField(value, \"productName\", output);\n copyOptionalStringResourceField(value, \"fileDescription\", output);\n copyOptionalStringResourceField(value, \"companyName\", output);\n copyOptionalStringResourceField(value, \"version\", output);\n copyOptionalStringResourceField(value, \"copyright\", output);\n copyOptionalNumberResourceField(value, \"language\", output, label);\n copyOptionalNumberResourceField(value, \"codePage\", output, label);\n return output;\n};\n\nconst copyOptionalStringResourceField = (\n source: JsonObject,\n key: keyof Pick<\n MuonWindowsResourceOptions,\n | \"iconPath\"\n | \"productName\"\n | \"fileDescription\"\n | \"companyName\"\n | \"version\"\n | \"copyright\"\n >,\n target: MuonWindowsResourceOptions,\n): void => {\n const value = source[key];\n if (value === undefined) {\n return;\n }\n if (typeof value !== \"string\") {\n throw new Error(`${key} must be a string when present.`);\n }\n if (value.trim() !== \"\") {\n target[key] = value.trim();\n }\n};\n\nconst copyOptionalNumberResourceField = (\n source: JsonObject,\n key: keyof Pick<MuonWindowsResourceOptions, \"language\" | \"codePage\">,\n target: MuonWindowsResourceOptions,\n label: string,\n): void => {\n const value = source[key];\n if (value === undefined) {\n return;\n }\n if (\n typeof value !== \"number\" ||\n !Number.isInteger(value) ||\n value < 0 ||\n value > 0xffff\n ) {\n throw new Error(`${label} ${key} must be an integer from 0 to 65535.`);\n }\n target[key] = value;\n};\n\nconst resolveStringField = (\n sources: readonly WindowsResourceSource[],\n field: keyof Pick<\n MuonWindowsResourceOptions,\n \"productName\" | \"fileDescription\" | \"companyName\" | \"version\"\n >,\n fallback: string,\n): string => {\n return resolveOptionalStringField(sources, field, fallback) ?? fallback;\n};\n\nconst resolveOptionalStringField = (\n sources: readonly WindowsResourceSource[],\n field: keyof Pick<\n MuonWindowsResourceOptions,\n \"productName\" | \"fileDescription\" | \"companyName\" | \"version\" | \"copyright\"\n >,\n fallback: string | undefined,\n): string | undefined => {\n for (const source of sources) {\n const value = source.options[field];\n if (value !== undefined && value.trim() !== \"\") {\n return value.trim();\n }\n }\n return fallback;\n};\n\nconst resolveNumericField = (\n sources: readonly WindowsResourceSource[],\n field: keyof Pick<MuonWindowsResourceOptions, \"language\" | \"codePage\">,\n fallback: number,\n): number => {\n for (const source of sources) {\n const value = source.options[field];\n if (value !== undefined) {\n return value;\n }\n }\n return fallback;\n};\n\nconst resolveWindowsIconPath = async (\n windowsSources: readonly WindowsResourceSource[],\n appIconSources: readonly MuonAppIconSource[],\n defaultIconPath: string,\n): Promise<string> => {\n for (const source of windowsSources) {\n const value = source.options.iconPath;\n if (value !== undefined && value.trim() !== \"\") {\n const iconPath = resolveResourcePath(source.directory, value);\n await assertIconPath(iconPath);\n return iconPath;\n }\n }\n const appIconPath = await resolveMuonAppIconPath(appIconSources);\n if (appIconPath !== undefined) {\n return appIconPath;\n }\n await assertIconPath(defaultIconPath);\n return defaultIconPath;\n};\n\nconst assertIconPath = async (iconPath: string): Promise<void> => {\n if (extname(iconPath).toLowerCase() !== \".png\") {\n throw new Error(`Windows resource icon must be a .png file: ${iconPath}`);\n }\n if (!(await fileExists(iconPath))) {\n throw new Error(`Windows resource icon does not exist: ${iconPath}`);\n }\n await createNormalizedMuonIconPngData(await readFile(iconPath), iconPath);\n};\n\nconst resolveDefaultWindowsIcon = async (\n packageDirectory: string,\n): Promise<string> => {\n const sourceIconPath = join(\n moduleDirectory,\n \"..\",\n \"..\",\n \"images\",\n \"muon-256.png\",\n );\n const candidates = [\n join(resolve(packageDirectory), \"native\", \"muon-256.png\"),\n join(moduleDirectory, \"native\", \"muon-256.png\"),\n join(moduleDirectory, \"..\", \"dist\", \"native\", \"muon-256.png\"),\n sourceIconPath,\n ];\n for (const candidate of candidates) {\n if (await fileExists(candidate)) {\n return candidate;\n }\n }\n return sourceIconPath;\n};\n\nconst resolveResourcePath = (directory: string, path: string): string => {\n return isAbsolute(path) ? path : resolve(directory, path);\n};\n\nconst normalizeWindowsVersion = (version: string): string => {\n const normalized = version.trim();\n const match = /^(\\d+)(?:\\.(\\d+))?(?:\\.(\\d+))?(?:\\.(\\d+))?(?:$|[-+])/.exec(\n normalized,\n );\n if (match === null) {\n throw new Error(\n `Windows resource version must start with numeric parts: ${version}`,\n );\n }\n const values = [match[1], match[2], match[3], match[4]].map((value) =>\n value === undefined ? 0 : Number.parseInt(value, 10),\n );\n for (const value of values) {\n if (!Number.isInteger(value) || value < 0 || value > 0xffff) {\n throw new Error(\n `Windows resource version part must be from 0 to 65535: ${version}`,\n );\n }\n }\n return values.join(\".\");\n};\n\nconst stringifyAuthor = (value: unknown): string | undefined => {\n if (typeof value === \"string\" && value.trim() !== \"\") {\n return value.trim();\n }\n if (!isJsonObject(value) || typeof value.name !== \"string\") {\n return undefined;\n }\n const name = value.name.trim();\n if (name === \"\") {\n return undefined;\n }\n return value.email === undefined || typeof value.email !== \"string\"\n ? name\n : `${name} <${value.email}>`;\n};\n\nconst fileExists = async (path: string): Promise<boolean> => {\n try {\n await access(path, constants.F_OK);\n return true;\n } catch {\n return false;\n }\n};\n\nconst isJsonObject = (value: unknown): value is JsonObject =>\n typeof value === \"object\" && value !== null && !Array.isArray(value);\n","// muon - Multi-platform GUI application framework that uses CEF as its backend\n// Copyright (c) Kouji Matsui. (@kekyo@mi.kekyo.net)\n// Under MIT.\n// https://github.com/kekyo/muon-ui\n\nimport { constants } from \"node:fs\";\nimport { access, readFile, writeFile } from \"node:fs/promises\";\nimport { dirname, extname, isAbsolute, join, resolve } from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\n\nimport { parse } from \"json5\";\n\nimport type { MuonLinuxDesktopOptions } from \"../common/vite.js\";\nimport { createNormalizedIconPngData } from \"./windows-icon.js\";\nimport {\n createAppIconOptionsSource,\n readConfigAppIconSource,\n readProjectAppIconSource,\n resolveMuonAppIconPath,\n type MuonAppIconSource,\n} from \"../common/app-icon.js\";\n\nexport type { MuonLinuxDesktopOptions } from \"../common/vite.js\";\n\nconst defaultConfigFileNames = [\"muon.json5\", \"muon.jsonc\", \"muon.json\"];\nconst defaultIconFileName = \"muon-desktop-icon.png\";\nconst defaultDesktopConfigFileName = \"muon-desktop.json\";\nconst moduleDirectory =\n typeof __dirname === \"string\"\n ? __dirname\n : dirname(fileURLToPath(import.meta.url));\n\ntype JsonObject = Record<string, unknown>;\n\ninterface LinuxDesktopSource {\n options: MuonLinuxDesktopOptions;\n directory: string;\n}\n\ninterface LinuxDesktopDefaults {\n desktopId: string;\n name: string;\n comment: string;\n categories: readonly string[];\n startupNotify: boolean;\n}\n\ninterface ResolveLinuxDesktopInput {\n root: string;\n packageDirectory: string;\n muonConfig: JsonObject;\n muonConfigDirectory: string;\n options: MuonLinuxDesktopOptions | undefined;\n appIconPath: string | undefined;\n defaults: LinuxDesktopDefaults;\n}\n\n/**\n * Resolved Linux desktop integration metadata used by build and pack outputs.\n */\nexport interface ResolvedMuonLinuxDesktop {\n /** Desktop file identifier without the `.desktop` suffix. */\n desktopId: string;\n /** Application display name. */\n name: string;\n /** Application description used as a desktop entry comment. */\n comment: string;\n /** Desktop menu categories. */\n categories: readonly string[];\n /** Whether desktop startup notification is requested. */\n startupNotify: boolean;\n /** Resolved PNG icon file path. */\n iconPath: string;\n /** File name written into target distributions for the normalized icon. */\n iconFileName: string;\n /** File name written into target distributions for launcher desktop metadata. */\n configFileName: string;\n}\n\n/**\n * muon config file content and directory used for Linux desktop option\n * resolution.\n */\nexport interface MuonLinuxDesktopConfigSource {\n /** Parsed muon config object. */\n config: JsonObject;\n /** Directory that relative config paths are resolved from. */\n directory: string;\n}\n\n/**\n * Reads the muon config file using the same default file names as muon build.\n */\nexport const readMuonConfigForLinuxDesktop = async (\n root: string,\n configPath: string | undefined,\n): Promise<MuonLinuxDesktopConfigSource> => {\n const resolvedConfigPath = await resolveConfigPath(root, configPath);\n if (resolvedConfigPath === undefined) {\n return {\n config: {},\n directory: root,\n };\n }\n return {\n config: await readJsonObjectFile(resolvedConfigPath, \"muon config file\"),\n directory: dirname(resolvedConfigPath),\n };\n};\n\n/**\n * Merges Linux desktop options while preserving field-level fallback.\n */\nexport const mergeMuonLinuxDesktopOptions = (\n primary: MuonLinuxDesktopOptions | undefined,\n fallback: MuonLinuxDesktopOptions | undefined,\n): MuonLinuxDesktopOptions | undefined => {\n if (primary === undefined) {\n return fallback;\n }\n if (fallback === undefined) {\n return primary;\n }\n\n const merged: MuonLinuxDesktopOptions = { ...fallback };\n if (primary.desktopId !== undefined) {\n merged.desktopId = primary.desktopId;\n }\n if (primary.name !== undefined) {\n merged.name = primary.name;\n }\n if (primary.comment !== undefined) {\n merged.comment = primary.comment;\n }\n if (primary.iconPath !== undefined) {\n merged.iconPath = primary.iconPath;\n }\n if (primary.categories !== undefined) {\n merged.categories = primary.categories;\n }\n if (primary.startupNotify !== undefined) {\n merged.startupNotify = primary.startupNotify;\n }\n return merged;\n};\n\n/**\n * Resolves Linux desktop integration metadata from options, config files, and\n * package metadata.\n */\nexport const resolveMuonLinuxDesktop = async (\n input: ResolveLinuxDesktopInput,\n): Promise<ResolvedMuonLinuxDesktop> => {\n const projectJson = await readProjectJson(input.root);\n const sources = [\n createOptionsSource(input.options, input.root, \"linuxDesktop\"),\n readConfigLinuxDesktopSource(\n input.muonConfig,\n input.muonConfigDirectory,\n \"muon.json\",\n ),\n ].filter((source): source is LinuxDesktopSource => source !== undefined);\n const appIconSources = [\n createAppIconOptionsSource(input.appIconPath, input.root),\n readConfigAppIconSource(\n input.muonConfig,\n input.muonConfigDirectory,\n \"muon.json\",\n ),\n readProjectAppIconSource(projectJson, input.root),\n ].filter((source): source is MuonAppIconSource => source !== undefined);\n\n const desktopId = sanitizeDesktopId(\n resolveStringField(sources, \"desktopId\", input.defaults.desktopId),\n );\n const name = resolveStringField(sources, \"name\", input.defaults.name);\n const comment = resolveStringField(\n sources,\n \"comment\",\n input.defaults.comment,\n );\n const categories = resolveCategories(sources, input.defaults.categories);\n const startupNotify = resolveBooleanField(\n sources,\n \"startupNotify\",\n input.defaults.startupNotify,\n );\n const iconPath = await resolveLinuxIconPath(\n sources,\n appIconSources,\n await resolveDefaultLinuxDesktopIcon(input.packageDirectory),\n );\n\n return {\n desktopId,\n name,\n comment,\n categories,\n startupNotify,\n iconPath,\n iconFileName: defaultIconFileName,\n configFileName: defaultDesktopConfigFileName,\n };\n};\n\n/**\n * Removes build-only Linux desktop settings from runtime config.\n */\nexport const stripBuildOnlyLinuxDesktopConfig = (\n sourceConfig: JsonObject,\n): JsonObject => {\n const sourceLinux = sourceConfig.linux;\n if (!isJsonObject(sourceLinux)) {\n return sourceConfig;\n }\n\n const linuxConfig: JsonObject = {};\n for (const [key, value] of Object.entries(sourceLinux)) {\n if (key !== \"desktop\") {\n linuxConfig[key] = value;\n }\n }\n\n const output: JsonObject = {};\n for (const [key, value] of Object.entries(sourceConfig)) {\n if (key !== \"linux\") {\n output[key] = value;\n }\n }\n if (Object.keys(linuxConfig).length > 0) {\n output.linux = linuxConfig;\n }\n return output;\n};\n\n/**\n * Writes normalized Linux desktop sidecar files into a target distribution.\n */\nexport const writeLinuxDesktopDistributionFiles = async (\n outputPath: string,\n desktop: ResolvedMuonLinuxDesktop,\n): Promise<void> => {\n const iconData = await createNormalizedIconPngData(\n await readFile(desktop.iconPath),\n desktop.iconPath,\n \"Linux desktop icon\",\n );\n await writeFile(join(outputPath, desktop.iconFileName), iconData);\n await writeFile(\n join(outputPath, desktop.configFileName),\n `${JSON.stringify(\n {\n desktopId: desktop.desktopId,\n name: desktop.name,\n comment: desktop.comment,\n categories: desktop.categories,\n startupNotify: desktop.startupNotify,\n iconFileName: desktop.iconFileName,\n },\n undefined,\n 2,\n )}\\n`,\n );\n};\n\n/**\n * Creates a Desktop Entry file.\n */\nexport const createLinuxDesktopEntry = (input: {\n desktop: ResolvedMuonLinuxDesktop;\n exec: string;\n tryExec: string;\n icon: string;\n}): string => {\n const lines = [\n \"[Desktop Entry]\",\n \"Type=Application\",\n `Name=${escapeDesktopString(input.desktop.name)}`,\n ];\n if (input.desktop.comment.length > 0) {\n lines.push(`Comment=${escapeDesktopString(input.desktop.comment)}`);\n }\n lines.push(`Exec=${input.exec}`);\n lines.push(`TryExec=${input.tryExec}`);\n lines.push(`Icon=${escapeDesktopString(input.icon)}`);\n lines.push(`Terminal=false`);\n if (input.desktop.categories.length > 0) {\n lines.push(`Categories=${input.desktop.categories.join(\";\")};`);\n }\n lines.push(`StartupNotify=${input.desktop.startupNotify ? \"true\" : \"false\"}`);\n lines.push(`StartupWMClass=${escapeDesktopString(input.desktop.desktopId)}`);\n lines.push(\"X-muon-Managed=true\");\n lines.push(\"\");\n return lines.join(\"\\n\");\n};\n\n/**\n * Quotes one Desktop Entry Exec argument.\n */\nexport const quoteDesktopExecArgument = (value: string): string => {\n let escaped = '\"';\n for (const character of value) {\n if (\n character === '\"' ||\n character === \"\\\\\" ||\n character === \"$\" ||\n character === \"`\"\n ) {\n escaped += \"\\\\\";\n }\n escaped += character;\n }\n return `${escaped}\"`;\n};\n\nconst resolveConfigPath = async (\n root: string,\n configPath: string | undefined,\n): Promise<string | undefined> => {\n if (configPath !== undefined) {\n const resolvedPath = resolve(root, configPath);\n if (await fileExists(resolvedPath)) {\n return resolvedPath;\n }\n throw new Error(`muon config file does not exist: ${resolvedPath}`);\n }\n\n for (const fileName of defaultConfigFileNames) {\n const candidatePath = join(root, fileName);\n if (await fileExists(candidatePath)) {\n return candidatePath;\n }\n }\n return undefined;\n};\n\nconst readJsonObjectFile = async (\n filePath: string,\n label: string,\n): Promise<JsonObject> => {\n const parsed = parse(await readFile(filePath, \"utf8\"));\n if (!isJsonObject(parsed)) {\n throw new Error(`${label} must contain a JSON object: ${filePath}`);\n }\n return parsed;\n};\n\nconst readProjectJson = async (root: string): Promise<JsonObject> => {\n const projectJsonPath = join(root, \"project.json\");\n if (!(await fileExists(projectJsonPath))) {\n return {};\n }\n return await readJsonObjectFile(projectJsonPath, \"project.json\");\n};\n\nconst createOptionsSource = (\n options: MuonLinuxDesktopOptions | undefined,\n directory: string,\n label: string,\n): LinuxDesktopSource | undefined => {\n if (options === undefined) {\n return undefined;\n }\n return {\n options: validateLinuxDesktopOptions(options, label),\n directory,\n };\n};\n\nconst readConfigLinuxDesktopSource = (\n config: JsonObject,\n directory: string,\n label: string,\n): LinuxDesktopSource | undefined => {\n const linux = config.linux;\n if (linux === undefined) {\n return undefined;\n }\n if (!isJsonObject(linux)) {\n throw new Error(`${label} linux must be an object when present.`);\n }\n const desktop = linux.desktop;\n if (desktop === undefined) {\n return undefined;\n }\n return createOptionsSource(\n validateLinuxDesktopOptions(desktop, `${label} linux.desktop`),\n directory,\n `${label} linux.desktop`,\n );\n};\n\nconst validateLinuxDesktopOptions = (\n value: unknown,\n label: string,\n): MuonLinuxDesktopOptions => {\n if (!isJsonObject(value)) {\n throw new Error(`${label} must be an object.`);\n }\n\n const output: MuonLinuxDesktopOptions = {};\n copyOptionalStringDesktopField(value, \"desktopId\", output);\n copyOptionalStringDesktopField(value, \"name\", output);\n copyOptionalStringDesktopField(value, \"comment\", output);\n copyOptionalStringDesktopField(value, \"iconPath\", output);\n copyOptionalCategoriesField(value, output, label);\n copyOptionalBooleanDesktopField(value, \"startupNotify\", output, label);\n return output;\n};\n\nconst copyOptionalStringDesktopField = (\n source: JsonObject,\n key: keyof Pick<\n MuonLinuxDesktopOptions,\n \"desktopId\" | \"name\" | \"comment\" | \"iconPath\"\n >,\n target: MuonLinuxDesktopOptions,\n): void => {\n const value = source[key];\n if (value === undefined) {\n return;\n }\n if (typeof value !== \"string\") {\n throw new Error(`${key} must be a string when present.`);\n }\n if (value.trim() !== \"\") {\n target[key] = value.trim();\n }\n};\n\nconst copyOptionalCategoriesField = (\n source: JsonObject,\n target: MuonLinuxDesktopOptions,\n label: string,\n): void => {\n const value = source.categories;\n if (value === undefined) {\n return;\n }\n if (\n !Array.isArray(value) ||\n !value.every(\n (entry) =>\n typeof entry === \"string\" &&\n entry.trim() !== \"\" &&\n !entry.includes(\";\") &&\n !entry.includes(\"\\n\") &&\n !entry.includes(\"\\r\"),\n )\n ) {\n throw new Error(\n `${label} categories must be a string array without semicolons when present.`,\n );\n }\n target.categories = value.map((entry) => entry.trim());\n};\n\nconst copyOptionalBooleanDesktopField = (\n source: JsonObject,\n key: keyof Pick<MuonLinuxDesktopOptions, \"startupNotify\">,\n target: MuonLinuxDesktopOptions,\n label: string,\n): void => {\n const value = source[key];\n if (value === undefined) {\n return;\n }\n if (typeof value !== \"boolean\") {\n throw new Error(`${label} ${key} must be a boolean when present.`);\n }\n target[key] = value;\n};\n\nconst resolveStringField = (\n sources: readonly LinuxDesktopSource[],\n field: keyof Pick<MuonLinuxDesktopOptions, \"desktopId\" | \"name\" | \"comment\">,\n fallback: string,\n): string => {\n for (const source of sources) {\n const value = source.options[field];\n if (value !== undefined && value.trim() !== \"\") {\n return value.trim();\n }\n }\n return fallback;\n};\n\nconst resolveCategories = (\n sources: readonly LinuxDesktopSource[],\n fallback: readonly string[],\n): readonly string[] => {\n for (const source of sources) {\n if (source.options.categories !== undefined) {\n return source.options.categories;\n }\n }\n return fallback;\n};\n\nconst resolveBooleanField = (\n sources: readonly LinuxDesktopSource[],\n field: keyof Pick<MuonLinuxDesktopOptions, \"startupNotify\">,\n fallback: boolean,\n): boolean => {\n for (const source of sources) {\n const value = source.options[field];\n if (value !== undefined) {\n return value;\n }\n }\n return fallback;\n};\n\nconst resolveLinuxIconPath = async (\n sources: readonly LinuxDesktopSource[],\n appIconSources: readonly MuonAppIconSource[],\n defaultIconPath: string | undefined,\n): Promise<string> => {\n for (const source of sources) {\n const value = source.options.iconPath;\n if (value !== undefined && value.trim() !== \"\") {\n const iconPath = resolveResourcePath(source.directory, value);\n await assertIconPath(iconPath, true);\n return iconPath;\n }\n }\n const appIconPath = await resolveMuonAppIconPath(appIconSources);\n if (appIconPath !== undefined) {\n return appIconPath;\n }\n if (defaultIconPath !== undefined && (await fileExists(defaultIconPath))) {\n await assertIconPath(defaultIconPath, false);\n return defaultIconPath;\n }\n throw new Error(\"Linux desktop icon does not exist.\");\n};\n\nconst assertIconPath = async (\n iconPath: string,\n required: boolean,\n): Promise<void> => {\n if (extname(iconPath).toLowerCase() !== \".png\") {\n throw new Error(`Linux desktop icon must be a .png file: ${iconPath}`);\n }\n if (required && !(await fileExists(iconPath))) {\n throw new Error(`Linux desktop icon does not exist: ${iconPath}`);\n }\n if (await fileExists(iconPath)) {\n await createNormalizedIconPngData(\n await readFile(iconPath),\n iconPath,\n \"Linux desktop icon\",\n );\n }\n};\n\nconst resolveDefaultLinuxDesktopIcon = async (\n packageDirectory: string,\n): Promise<string | undefined> => {\n const candidates = [\n join(resolve(packageDirectory), \"native\", \"muon-256.png\"),\n join(moduleDirectory, \"native\", \"muon-256.png\"),\n join(moduleDirectory, \"..\", \"dist\", \"native\", \"muon-256.png\"),\n join(moduleDirectory, \"..\", \"..\", \"images\", \"muon-256.png\"),\n ];\n for (const candidate of candidates) {\n if (await fileExists(candidate)) {\n return candidate;\n }\n }\n return undefined;\n};\n\nconst sanitizeDesktopId = (value: string): string => {\n const sanitized = value\n .trim()\n .toLowerCase()\n .replace(/[^a-z0-9._-]+/g, \"-\")\n .replace(/^[.-]+/g, \"\")\n .replace(/[.-]+$/g, \"\");\n return sanitized.length > 0 ? sanitized : \"muon-app\";\n};\n\nconst escapeDesktopString = (value: string): string =>\n value\n .replaceAll(\"\\\\\", \"\\\\\\\\\")\n .replaceAll(\"\\n\", \"\\\\n\")\n .replaceAll(\"\\r\", \"\\\\r\")\n .replaceAll(\"\\t\", \"\\\\t\");\n\nconst resolveResourcePath = (directory: string, path: string): string => {\n return isAbsolute(path) ? path : resolve(directory, path);\n};\n\nconst fileExists = async (path: string): Promise<boolean> => {\n try {\n await access(path, constants.F_OK);\n return true;\n } catch {\n return false;\n }\n};\n\nconst isJsonObject = (value: unknown): value is JsonObject =>\n typeof value === \"object\" && value !== null && !Array.isArray(value);\n","// muon - Multi-platform GUI application framework that uses CEF as its backend\n// Copyright (c) Kouji Matsui. (@kekyo@mi.kekyo.net)\n// Under MIT.\n// https://github.com/kekyo/muon-ui\n\nimport { spawn } from \"node:child_process\";\n\ntype JsonObject = Record<string, unknown>;\n\n/**\n * Windows executable artifact kind accepted by code signing options.\n */\nexport type MuonWindowsCodeSigningTarget =\n \"runtime\" | \"launcher\" | \"nsisInstaller\" | \"nsisUninstaller\";\n\n/**\n * External Windows code signing command options.\n */\nexport interface MuonWindowsCodeSigningOptions {\n /**\n * Executable or script used to sign one file.\n */\n command: string;\n /**\n * Arguments passed to the signing command.\n *\n * @remarks `{path}` is required and is replaced with the executable path.\n * `{target}` and `{kind}` are also replaced when present.\n */\n args: readonly string[];\n /**\n * Artifact kinds to sign.\n *\n * @defaultValue Signs all supported Windows artifact kinds.\n */\n targets?: readonly MuonWindowsCodeSigningTarget[];\n}\n\n/**\n * Resolved Windows code signing command.\n */\nexport interface ResolvedMuonWindowsCodeSigning {\n /** Executable or script used to sign one file. */\n command: string;\n /** Arguments passed to the signing command. */\n args: readonly string[];\n /** Artifact kinds to sign. */\n targets: readonly MuonWindowsCodeSigningTarget[];\n}\n\ninterface WindowsCodeSigningExecution {\n /** Resolved signing command. */\n codeSigning: ResolvedMuonWindowsCodeSigning | undefined;\n /** Artifact kind being signed. */\n kind: MuonWindowsCodeSigningTarget;\n /** Public muon target identifier. */\n target: string;\n /** Executable path being signed. */\n path: string;\n /** Child process working directory. */\n cwd: string;\n /** Child process environment. */\n environment: NodeJS.ProcessEnv;\n}\n\nconst placeholderPath = \"{path}\";\nconst placeholderTarget = \"{target}\";\nconst placeholderKind = \"{kind}\";\n\nconst allWindowsCodeSigningTargets = [\n \"runtime\",\n \"launcher\",\n \"nsisInstaller\",\n \"nsisUninstaller\",\n] as const satisfies readonly MuonWindowsCodeSigningTarget[];\n\nconst isJsonObject = (value: unknown): value is JsonObject =>\n typeof value === \"object\" && value !== null && !Array.isArray(value);\n\nconst isStringArray = (value: unknown): value is readonly string[] =>\n Array.isArray(value) && value.every((entry) => typeof entry === \"string\");\n\nconst isWindowsCodeSigningTarget = (\n value: string,\n): value is MuonWindowsCodeSigningTarget =>\n allWindowsCodeSigningTargets.includes(value as MuonWindowsCodeSigningTarget);\n\nconst readWindowsCodeSigningTargets = (\n value: unknown,\n label: string,\n): readonly MuonWindowsCodeSigningTarget[] => {\n if (value === undefined) {\n return allWindowsCodeSigningTargets;\n }\n if (!isStringArray(value)) {\n throw new Error(`${label}.targets must be an array of strings.`);\n }\n if (value.length === 0) {\n throw new Error(`${label}.targets must not be empty.`);\n }\n const targets: MuonWindowsCodeSigningTarget[] = [];\n for (const target of value) {\n if (!isWindowsCodeSigningTarget(target)) {\n throw new Error(`Unsupported ${label}.targets entry: ${target}`);\n }\n if (!targets.includes(target)) {\n targets.push(target);\n }\n }\n return targets;\n};\n\n/**\n * Validates Windows code signing options.\n */\nexport const validateMuonWindowsCodeSigningOptions = (\n value: unknown,\n label: string,\n): MuonWindowsCodeSigningOptions => {\n if (!isJsonObject(value)) {\n throw new Error(`${label} must be an object.`);\n }\n if (typeof value.command !== \"string\" || value.command.trim() === \"\") {\n throw new Error(`${label}.command must be a non-empty string.`);\n }\n if (!isStringArray(value.args)) {\n throw new Error(`${label}.args must be an array of strings.`);\n }\n if (!value.args.some((arg) => arg.includes(placeholderPath))) {\n throw new Error(`${label}.args must contain ${placeholderPath}.`);\n }\n\n return {\n command: value.command.trim(),\n args: value.args,\n targets: readWindowsCodeSigningTargets(value.targets, label),\n };\n};\n\n/**\n * Returns true when a value is valid Windows code signing options.\n */\nexport const isMuonWindowsCodeSigningOptions = (\n value: unknown,\n): value is MuonWindowsCodeSigningOptions => {\n try {\n validateMuonWindowsCodeSigningOptions(value, \"windowsCodeSigning\");\n return true;\n } catch {\n return false;\n }\n};\n\n/**\n * Resolves Windows code signing options from API options and muon config.\n */\nexport const resolveMuonWindowsCodeSigning = (input: {\n muonConfig: JsonObject;\n options: false | MuonWindowsCodeSigningOptions | undefined;\n}): ResolvedMuonWindowsCodeSigning | undefined => {\n if (input.options === false) {\n return undefined;\n }\n if (input.options !== undefined) {\n return validateMuonWindowsCodeSigningOptions(\n input.options,\n \"windowsCodeSigning\",\n ) as ResolvedMuonWindowsCodeSigning;\n }\n\n const windows = input.muonConfig.windows;\n if (windows === undefined) {\n return undefined;\n }\n if (!isJsonObject(windows)) {\n throw new Error(\"muon.json windows must be an object when present.\");\n }\n const codeSigning = windows.codeSigning;\n if (codeSigning === undefined) {\n return undefined;\n }\n return validateMuonWindowsCodeSigningOptions(\n codeSigning,\n \"muon.json windows.codeSigning\",\n ) as ResolvedMuonWindowsCodeSigning;\n};\n\n/**\n * Removes build-only Windows code signing settings from runtime config.\n */\nexport const stripBuildOnlyWindowsCodeSigningConfig = (\n sourceConfig: JsonObject,\n): JsonObject => {\n const sourceWindows = sourceConfig.windows;\n if (!isJsonObject(sourceWindows)) {\n return sourceConfig;\n }\n\n const windowsConfig: JsonObject = {};\n for (const [key, value] of Object.entries(sourceWindows)) {\n if (key !== \"codeSigning\") {\n windowsConfig[key] = value;\n }\n }\n\n const output: JsonObject = {};\n for (const [key, value] of Object.entries(sourceConfig)) {\n if (key !== \"windows\") {\n output[key] = value;\n }\n }\n if (Object.keys(windowsConfig).length > 0) {\n output.windows = windowsConfig;\n }\n return output;\n};\n\n/**\n * Applies supported placeholders to signing command arguments.\n */\nexport const createWindowsCodeSigningArgs = (input: {\n args: readonly string[];\n kind: MuonWindowsCodeSigningTarget;\n target: string;\n path: string;\n}): string[] =>\n input.args.map((arg) =>\n arg\n .replaceAll(placeholderPath, input.path)\n .replaceAll(placeholderTarget, input.target)\n .replaceAll(placeholderKind, input.kind),\n );\n\n/**\n * Returns true when a resolved signing command includes an artifact kind.\n */\nexport const includesWindowsCodeSigningTarget = (\n codeSigning: ResolvedMuonWindowsCodeSigning | undefined,\n kind: MuonWindowsCodeSigningTarget,\n): codeSigning is ResolvedMuonWindowsCodeSigning =>\n codeSigning !== undefined && codeSigning.targets.includes(kind);\n\n/**\n * Runs the configured Windows code signing command for one executable.\n */\nexport const signWindowsExecutable = async (\n input: WindowsCodeSigningExecution,\n): Promise<void> => {\n if (!includesWindowsCodeSigningTarget(input.codeSigning, input.kind)) {\n return;\n }\n const args = createWindowsCodeSigningArgs({\n args: input.codeSigning.args,\n kind: input.kind,\n target: input.target,\n path: input.path,\n });\n const child = spawn(input.codeSigning.command, args, {\n cwd: input.cwd,\n env: input.environment,\n stdio: [\"ignore\", \"pipe\", \"pipe\"],\n });\n let stderr = \"\";\n child.stderr.setEncoding(\"utf8\");\n child.stderr.on(\"data\", (chunk: string) => {\n stderr += chunk;\n });\n const exitCode = await new Promise<number>((resolvePromise, reject) => {\n child.once(\"error\", reject);\n child.once(\"close\", (code) => {\n resolvePromise(code ?? 1);\n });\n });\n if (exitCode !== 0) {\n throw new Error(\n `${input.codeSigning.command} failed while signing ${input.kind} ${input.path} with exit code ${exitCode}: ${stderr.trim()}`,\n );\n }\n};\n","'use strict'\n\nclass LRUCache {\n constructor () {\n this.max = 1000\n this.map = new Map()\n }\n\n get (key) {\n const value = this.map.get(key)\n if (value === undefined) {\n return undefined\n } else {\n // Remove the key from the map and add it to the end\n this.map.delete(key)\n this.map.set(key, value)\n return value\n }\n }\n\n delete (key) {\n return this.map.delete(key)\n }\n\n set (key, value) {\n const deleted = this.delete(key)\n\n if (!deleted && value !== undefined) {\n // If cache is full, delete the least recently used item\n if (this.map.size >= this.max) {\n const firstKey = this.map.keys().next().value\n this.delete(firstKey)\n }\n\n this.map.set(key, value)\n }\n\n return this\n }\n}\n\nmodule.exports = LRUCache\n","'use strict'\n\n// parse out just the options we care about\nconst looseOption = Object.freeze({ loose: true })\nconst emptyOpts = Object.freeze({ })\nconst parseOptions = options => {\n if (!options) {\n return emptyOpts\n }\n\n if (typeof options !== 'object') {\n return looseOption\n }\n\n return options\n}\nmodule.exports = parseOptions\n","'use strict'\n\n// Note: this is the semver.org version of the spec that it implements\n// Not necessarily the package version of this code.\nconst SEMVER_SPEC_VERSION = '2.0.0'\n\nconst MAX_LENGTH = 256\nconst MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER ||\n/* istanbul ignore next */ 9007199254740991\n\n// Max safe segment length for coercion.\nconst MAX_SAFE_COMPONENT_LENGTH = 16\n\n// Max safe length for a build identifier. The max length minus 6 characters for\n// the shortest version with a build 0.0.0+BUILD.\nconst MAX_SAFE_BUILD_LENGTH = MAX_LENGTH - 6\n\nconst RELEASE_TYPES = [\n 'major',\n 'premajor',\n 'minor',\n 'preminor',\n 'patch',\n 'prepatch',\n 'prerelease',\n]\n\nmodule.exports = {\n MAX_LENGTH,\n MAX_SAFE_COMPONENT_LENGTH,\n MAX_SAFE_BUILD_LENGTH,\n MAX_SAFE_INTEGER,\n RELEASE_TYPES,\n SEMVER_SPEC_VERSION,\n FLAG_INCLUDE_PRERELEASE: 0b001,\n FLAG_LOOSE: 0b010,\n}\n","'use strict'\n\nconst debug = (\n typeof process === 'object' &&\n process.env &&\n process.env.NODE_DEBUG &&\n /\\bsemver\\b/i.test(process.env.NODE_DEBUG)\n) ? (...args) => console.error('SEMVER', ...args)\n : () => {}\n\nmodule.exports = debug\n","'use strict'\n\nconst {\n MAX_SAFE_COMPONENT_LENGTH,\n MAX_SAFE_BUILD_LENGTH,\n MAX_LENGTH,\n} = require('./constants')\nconst debug = require('./debug')\nexports = module.exports = {}\n\n// The actual regexps go on exports.re\nconst re = exports.re = []\nconst safeRe = exports.safeRe = []\nconst src = exports.src = []\nconst safeSrc = exports.safeSrc = []\nconst t = exports.t = {}\nlet R = 0\n\nconst LETTERDASHNUMBER = '[a-zA-Z0-9-]'\n\n// Replace some greedy regex tokens to prevent regex dos issues. These regex are\n// used internally via the safeRe object since all inputs in this library get\n// normalized first to trim and collapse all extra whitespace. The original\n// regexes are exported for userland consumption and lower level usage. A\n// future breaking change could export the safer regex only with a note that\n// all input should have extra whitespace removed.\nconst safeRegexReplacements = [\n ['\\\\s', 1],\n ['\\\\d', MAX_LENGTH],\n [LETTERDASHNUMBER, MAX_SAFE_BUILD_LENGTH],\n]\n\nconst makeSafeRegex = (value) => {\n for (const [token, max] of safeRegexReplacements) {\n value = value\n .split(`${token}*`).join(`${token}{0,${max}}`)\n .split(`${token}+`).join(`${token}{1,${max}}`)\n }\n return value\n}\n\nconst createToken = (name, value, isGlobal) => {\n const safe = makeSafeRegex(value)\n const index = R++\n debug(name, index, value)\n t[name] = index\n src[index] = value\n safeSrc[index] = safe\n re[index] = new RegExp(value, isGlobal ? 'g' : undefined)\n safeRe[index] = new RegExp(safe, isGlobal ? 'g' : undefined)\n}\n\n// The following Regular Expressions can be used for tokenizing,\n// validating, and parsing SemVer version strings.\n\n// ## Numeric Identifier\n// A single `0`, or a non-zero digit followed by zero or more digits.\n\ncreateToken('NUMERICIDENTIFIER', '0|[1-9]\\\\d*')\ncreateToken('NUMERICIDENTIFIERLOOSE', '\\\\d+')\n\n// ## Non-numeric Identifier\n// Zero or more digits, followed by a letter or hyphen, and then zero or\n// more letters, digits, or hyphens.\n\ncreateToken('NONNUMERICIDENTIFIER', `\\\\d*[a-zA-Z-]${LETTERDASHNUMBER}*`)\n\n// ## Main Version\n// Three dot-separated numeric identifiers.\n\ncreateToken('MAINVERSION', `(${src[t.NUMERICIDENTIFIER]})\\\\.` +\n `(${src[t.NUMERICIDENTIFIER]})\\\\.` +\n `(${src[t.NUMERICIDENTIFIER]})`)\n\ncreateToken('MAINVERSIONLOOSE', `(${src[t.NUMERICIDENTIFIERLOOSE]})\\\\.` +\n `(${src[t.NUMERICIDENTIFIERLOOSE]})\\\\.` +\n `(${src[t.NUMERICIDENTIFIERLOOSE]})`)\n\n// ## Pre-release Version Identifier\n// A numeric identifier, or a non-numeric identifier.\n// Non-numeric identifiers include numeric identifiers but can be longer.\n// Therefore non-numeric identifiers must go first.\n\ncreateToken('PRERELEASEIDENTIFIER', `(?:${src[t.NONNUMERICIDENTIFIER]\n}|${src[t.NUMERICIDENTIFIER]})`)\n\ncreateToken('PRERELEASEIDENTIFIERLOOSE', `(?:${src[t.NONNUMERICIDENTIFIER]\n}|${src[t.NUMERICIDENTIFIERLOOSE]})`)\n\n// ## Pre-release Version\n// Hyphen, followed by one or more dot-separated pre-release version\n// identifiers.\n\ncreateToken('PRERELEASE', `(?:-(${src[t.PRERELEASEIDENTIFIER]\n}(?:\\\\.${src[t.PRERELEASEIDENTIFIER]})*))`)\n\ncreateToken('PRERELEASELOOSE', `(?:-?(${src[t.PRERELEASEIDENTIFIERLOOSE]\n}(?:\\\\.${src[t.PRERELEASEIDENTIFIERLOOSE]})*))`)\n\n// ## Build Metadata Identifier\n// Any combination of digits, letters, or hyphens.\n\ncreateToken('BUILDIDENTIFIER', `${LETTERDASHNUMBER}+`)\n\n// ## Build Metadata\n// Plus sign, followed by one or more period-separated build metadata\n// identifiers.\n\ncreateToken('BUILD', `(?:\\\\+(${src[t.BUILDIDENTIFIER]\n}(?:\\\\.${src[t.BUILDIDENTIFIER]})*))`)\n\n// ## Full Version String\n// A main version, followed optionally by a pre-release version and\n// build metadata.\n\n// Note that the only major, minor, patch, and pre-release sections of\n// the version string are capturing groups. The build metadata is not a\n// capturing group, because it should not ever be used in version\n// comparison.\n\ncreateToken('FULLPLAIN', `v?${src[t.MAINVERSION]\n}${src[t.PRERELEASE]}?${\n src[t.BUILD]}?`)\n\ncreateToken('FULL', `^${src[t.FULLPLAIN]}$`)\n\n// like full, but allows v1.2.3 and =1.2.3, which people do sometimes.\n// also, 1.0.0alpha1 (prerelease without the hyphen) which is pretty\n// common in the npm registry.\ncreateToken('LOOSEPLAIN', `[v=\\\\s]*${src[t.MAINVERSIONLOOSE]\n}${src[t.PRERELEASELOOSE]}?${\n src[t.BUILD]}?`)\n\ncreateToken('LOOSE', `^${src[t.LOOSEPLAIN]}$`)\n\ncreateToken('GTLT', '((?:<|>)?=?)')\n\n// Something like \"2.*\" or \"1.2.x\".\n// Note that \"x.x\" is a valid xRange identifier, meaning \"any version\"\n// Only the first item is strictly required.\ncreateToken('XRANGEIDENTIFIERLOOSE', `${src[t.NUMERICIDENTIFIERLOOSE]}|x|X|\\\\*`)\ncreateToken('XRANGEIDENTIFIER', `${src[t.NUMERICIDENTIFIER]}|x|X|\\\\*`)\n\ncreateToken('XRANGEPLAIN', `[v=\\\\s]*(${src[t.XRANGEIDENTIFIER]})` +\n `(?:\\\\.(${src[t.XRANGEIDENTIFIER]})` +\n `(?:\\\\.(${src[t.XRANGEIDENTIFIER]})` +\n `(?:${src[t.PRERELEASE]})?${\n src[t.BUILD]}?` +\n `)?)?`)\n\ncreateToken('XRANGEPLAINLOOSE', `[v=\\\\s]*(${src[t.XRANGEIDENTIFIERLOOSE]})` +\n `(?:\\\\.(${src[t.XRANGEIDENTIFIERLOOSE]})` +\n `(?:\\\\.(${src[t.XRANGEIDENTIFIERLOOSE]})` +\n `(?:${src[t.PRERELEASELOOSE]})?${\n src[t.BUILD]}?` +\n `)?)?`)\n\ncreateToken('XRANGE', `^${src[t.GTLT]}\\\\s*${src[t.XRANGEPLAIN]}$`)\ncreateToken('XRANGELOOSE', `^${src[t.GTLT]}\\\\s*${src[t.XRANGEPLAINLOOSE]}$`)\n\n// Coercion.\n// Extract anything that could conceivably be a part of a valid semver\ncreateToken('COERCEPLAIN', `${'(^|[^\\\\d])' +\n '(\\\\d{1,'}${MAX_SAFE_COMPONENT_LENGTH}})` +\n `(?:\\\\.(\\\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?` +\n `(?:\\\\.(\\\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?`)\ncreateToken('COERCE', `${src[t.COERCEPLAIN]}(?:$|[^\\\\d])`)\ncreateToken('COERCEFULL', src[t.COERCEPLAIN] +\n `(?:${src[t.PRERELEASE]})?` +\n `(?:${src[t.BUILD]})?` +\n `(?:$|[^\\\\d])`)\ncreateToken('COERCERTL', src[t.COERCE], true)\ncreateToken('COERCERTLFULL', src[t.COERCEFULL], true)\n\n// Tilde ranges.\n// Meaning is \"reasonably at or greater than\"\ncreateToken('LONETILDE', '(?:~>?)')\n\ncreateToken('TILDETRIM', `(\\\\s*)${src[t.LONETILDE]}\\\\s+`, true)\nexports.tildeTrimReplace = '$1~'\n\ncreateToken('TILDE', `^${src[t.LONETILDE]}${src[t.XRANGEPLAIN]}$`)\ncreateToken('TILDELOOSE', `^${src[t.LONETILDE]}${src[t.XRANGEPLAINLOOSE]}$`)\n\n// Caret ranges.\n// Meaning is \"at least and backwards compatible with\"\ncreateToken('LONECARET', '(?:\\\\^)')\n\ncreateToken('CARETTRIM', `(\\\\s*)${src[t.LONECARET]}\\\\s+`, true)\nexports.caretTrimReplace = '$1^'\n\ncreateToken('CARET', `^${src[t.LONECARET]}${src[t.XRANGEPLAIN]}$`)\ncreateToken('CARETLOOSE', `^${src[t.LONECARET]}${src[t.XRANGEPLAINLOOSE]}$`)\n\n// A simple gt/lt/eq thing, or just \"\" to indicate \"any version\"\ncreateToken('COMPARATORLOOSE', `^${src[t.GTLT]}\\\\s*(${src[t.LOOSEPLAIN]})$|^$`)\ncreateToken('COMPARATOR', `^${src[t.GTLT]}\\\\s*(${src[t.FULLPLAIN]})$|^$`)\n\n// An expression to strip any whitespace between the gtlt and the thing\n// it modifies, so that `> 1.2.3` ==> `>1.2.3`\ncreateToken('COMPARATORTRIM', `(\\\\s*)${src[t.GTLT]\n}\\\\s*(${src[t.LOOSEPLAIN]}|${src[t.XRANGEPLAIN]})`, true)\nexports.comparatorTrimReplace = '$1$2$3'\n\n// Something like `1.2.3 - 1.2.4`\n// Note that these all use the loose form, because they'll be\n// checked against either the strict or loose comparator form\n// later.\ncreateToken('HYPHENRANGE', `^\\\\s*(${src[t.XRANGEPLAIN]})` +\n `\\\\s+-\\\\s+` +\n `(${src[t.XRANGEPLAIN]})` +\n `\\\\s*$`)\n\ncreateToken('HYPHENRANGELOOSE', `^\\\\s*(${src[t.XRANGEPLAINLOOSE]})` +\n `\\\\s+-\\\\s+` +\n `(${src[t.XRANGEPLAINLOOSE]})` +\n `\\\\s*$`)\n\n// Star ranges basically just allow anything at all.\ncreateToken('STAR', '(<|>)?=?\\\\s*\\\\*')\n// >=0.0.0 is like a star\ncreateToken('GTE0', '^\\\\s*>=\\\\s*0\\\\.0\\\\.0\\\\s*$')\ncreateToken('GTE0PRE', '^\\\\s*>=\\\\s*0\\\\.0\\\\.0-0\\\\s*$')\n","'use strict'\n\nconst numeric = /^[0-9]+$/\nconst compareIdentifiers = (a, b) => {\n if (typeof a === 'number' && typeof b === 'number') {\n return a === b ? 0 : a < b ? -1 : 1\n }\n\n const anum = numeric.test(a)\n const bnum = numeric.test(b)\n\n if (anum && bnum) {\n a = +a\n b = +b\n }\n\n return a === b ? 0\n : (anum && !bnum) ? -1\n : (bnum && !anum) ? 1\n : a < b ? -1\n : 1\n}\n\nconst rcompareIdentifiers = (a, b) => compareIdentifiers(b, a)\n\nmodule.exports = {\n compareIdentifiers,\n rcompareIdentifiers,\n}\n","'use strict'\n\nconst debug = require('../internal/debug')\nconst { MAX_LENGTH, MAX_SAFE_INTEGER } = require('../internal/constants')\nconst { safeRe: re, t } = require('../internal/re')\n\nconst parseOptions = require('../internal/parse-options')\nconst { compareIdentifiers } = require('../internal/identifiers')\n\nconst isPrereleaseIdentifier = (prerelease, identifier) => {\n const identifiers = identifier.split('.')\n if (identifiers.length > prerelease.length) {\n return false\n }\n\n for (let i = 0; i < identifiers.length; i++) {\n if (compareIdentifiers(prerelease[i], identifiers[i]) !== 0) {\n return false\n }\n }\n\n return true\n}\n\nclass SemVer {\n constructor (version, options) {\n options = parseOptions(options)\n\n if (version instanceof SemVer) {\n if (version.loose === !!options.loose &&\n version.includePrerelease === !!options.includePrerelease) {\n return version\n } else {\n version = version.version\n }\n } else if (typeof version !== 'string') {\n throw new TypeError(`Invalid version. Must be a string. Got type \"${typeof version}\".`)\n }\n\n if (version.length > MAX_LENGTH) {\n throw new TypeError(\n `version is longer than ${MAX_LENGTH} characters`\n )\n }\n\n debug('SemVer', version, options)\n this.options = options\n this.loose = !!options.loose\n // this isn't actually relevant for versions, but keep it so that we\n // don't run into trouble passing this.options around.\n this.includePrerelease = !!options.includePrerelease\n\n const m = version.trim().match(options.loose ? re[t.LOOSE] : re[t.FULL])\n\n if (!m) {\n throw new TypeError(`Invalid Version: ${version}`)\n }\n\n this.raw = version\n\n // these are actually numbers\n this.major = +m[1]\n this.minor = +m[2]\n this.patch = +m[3]\n\n if (this.major > MAX_SAFE_INTEGER || this.major < 0) {\n throw new TypeError('Invalid major version')\n }\n\n if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) {\n throw new TypeError('Invalid minor version')\n }\n\n if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) {\n throw new TypeError('Invalid patch version')\n }\n\n // numberify any prerelease numeric ids\n if (!m[4]) {\n this.prerelease = []\n } else {\n this.prerelease = m[4].split('.').map((id) => {\n if (/^[0-9]+$/.test(id)) {\n const num = +id\n if (num >= 0 && num < MAX_SAFE_INTEGER) {\n return num\n }\n }\n return id\n })\n }\n\n this.build = m[5] ? m[5].split('.') : []\n this.format()\n }\n\n format () {\n this.version = `${this.major}.${this.minor}.${this.patch}`\n if (this.prerelease.length) {\n this.version += `-${this.prerelease.join('.')}`\n }\n return this.version\n }\n\n toString () {\n return this.version\n }\n\n compare (other) {\n debug('SemVer.compare', this.version, this.options, other)\n if (!(other instanceof SemVer)) {\n if (typeof other === 'string' && other === this.version) {\n return 0\n }\n other = new SemVer(other, this.options)\n }\n\n if (other.version === this.version) {\n return 0\n }\n\n return this.compareMain(other) || this.comparePre(other)\n }\n\n compareMain (other) {\n if (!(other instanceof SemVer)) {\n other = new SemVer(other, this.options)\n }\n\n if (this.major < other.major) {\n return -1\n }\n if (this.major > other.major) {\n return 1\n }\n if (this.minor < other.minor) {\n return -1\n }\n if (this.minor > other.minor) {\n return 1\n }\n if (this.patch < other.patch) {\n return -1\n }\n if (this.patch > other.patch) {\n return 1\n }\n return 0\n }\n\n comparePre (other) {\n if (!(other instanceof SemVer)) {\n other = new SemVer(other, this.options)\n }\n\n // NOT having a prerelease is > having one\n if (this.prerelease.length && !other.prerelease.length) {\n return -1\n } else if (!this.prerelease.length && other.prerelease.length) {\n return 1\n } else if (!this.prerelease.length && !other.prerelease.length) {\n return 0\n }\n\n let i = 0\n do {\n const a = this.prerelease[i]\n const b = other.prerelease[i]\n debug('prerelease compare', i, a, b)\n if (a === undefined && b === undefined) {\n return 0\n } else if (b === undefined) {\n return 1\n } else if (a === undefined) {\n return -1\n } else if (a === b) {\n continue\n } else {\n return compareIdentifiers(a, b)\n }\n } while (++i)\n }\n\n compareBuild (other) {\n if (!(other instanceof SemVer)) {\n other = new SemVer(other, this.options)\n }\n\n let i = 0\n do {\n const a = this.build[i]\n const b = other.build[i]\n debug('build compare', i, a, b)\n if (a === undefined && b === undefined) {\n return 0\n } else if (b === undefined) {\n return 1\n } else if (a === undefined) {\n return -1\n } else if (a === b) {\n continue\n } else {\n return compareIdentifiers(a, b)\n }\n } while (++i)\n }\n\n // preminor will bump the version up to the next minor release, and immediately\n // down to pre-release. premajor and prepatch work the same way.\n inc (release, identifier, identifierBase) {\n if (release.startsWith('pre')) {\n if (!identifier && identifierBase === false) {\n throw new Error('invalid increment argument: identifier is empty')\n }\n // Avoid an invalid semver results\n if (identifier) {\n const match = `-${identifier}`.match(this.options.loose ? re[t.PRERELEASELOOSE] : re[t.PRERELEASE])\n if (!match || match[1] !== identifier) {\n throw new Error(`invalid identifier: ${identifier}`)\n }\n }\n }\n\n switch (release) {\n case 'premajor':\n this.prerelease.length = 0\n this.patch = 0\n this.minor = 0\n this.major++\n this.inc('pre', identifier, identifierBase)\n break\n case 'preminor':\n this.prerelease.length = 0\n this.patch = 0\n this.minor++\n this.inc('pre', identifier, identifierBase)\n break\n case 'prepatch':\n // If this is already a prerelease, it will bump to the next version\n // drop any prereleases that might already exist, since they are not\n // relevant at this point.\n this.prerelease.length = 0\n this.inc('patch', identifier, identifierBase)\n this.inc('pre', identifier, identifierBase)\n break\n // If the input is a non-prerelease version, this acts the same as\n // prepatch.\n case 'prerelease':\n if (this.prerelease.length === 0) {\n this.inc('patch', identifier, identifierBase)\n }\n this.inc('pre', identifier, identifierBase)\n break\n case 'release':\n if (this.prerelease.length === 0) {\n throw new Error(`version ${this.raw} is not a prerelease`)\n }\n this.prerelease.length = 0\n break\n\n case 'major':\n // If this is a pre-major version, bump up to the same major version.\n // Otherwise increment major.\n // 1.0.0-5 bumps to 1.0.0\n // 1.1.0 bumps to 2.0.0\n if (\n this.minor !== 0 ||\n this.patch !== 0 ||\n this.prerelease.length === 0\n ) {\n this.major++\n }\n this.minor = 0\n this.patch = 0\n this.prerelease = []\n break\n case 'minor':\n // If this is a pre-minor version, bump up to the same minor version.\n // Otherwise increment minor.\n // 1.2.0-5 bumps to 1.2.0\n // 1.2.1 bumps to 1.3.0\n if (this.patch !== 0 || this.prerelease.length === 0) {\n this.minor++\n }\n this.patch = 0\n this.prerelease = []\n break\n case 'patch':\n // If this is not a pre-release version, it will increment the patch.\n // If it is a pre-release it will bump up to the same patch version.\n // 1.2.0-5 patches to 1.2.0\n // 1.2.0 patches to 1.2.1\n if (this.prerelease.length === 0) {\n this.patch++\n }\n this.prerelease = []\n break\n // This probably shouldn't be used publicly.\n // 1.0.0 'pre' would become 1.0.0-0 which is the wrong direction.\n case 'pre': {\n const base = Number(identifierBase) ? 1 : 0\n\n if (this.prerelease.length === 0) {\n this.prerelease = [base]\n } else {\n let i = this.prerelease.length\n while (--i >= 0) {\n if (typeof this.prerelease[i] === 'number') {\n this.prerelease[i]++\n i = -2\n }\n }\n if (i === -1) {\n // didn't increment anything\n if (identifier === this.prerelease.join('.') && identifierBase === false) {\n throw new Error('invalid increment argument: identifier already exists')\n }\n this.prerelease.push(base)\n }\n }\n if (identifier) {\n // 1.2.0-beta.1 bumps to 1.2.0-beta.2,\n // 1.2.0-beta.fooblz or 1.2.0-beta bumps to 1.2.0-beta.0\n let prerelease = [identifier, base]\n if (identifierBase === false) {\n prerelease = [identifier]\n }\n if (isPrereleaseIdentifier(this.prerelease, identifier)) {\n const prereleaseBase = this.prerelease[identifier.split('.').length]\n if (isNaN(prereleaseBase)) {\n this.prerelease = prerelease\n }\n } else {\n this.prerelease = prerelease\n }\n }\n break\n }\n default:\n throw new Error(`invalid increment argument: ${release}`)\n }\n this.raw = this.format()\n if (this.build.length) {\n this.raw += `+${this.build.join('.')}`\n }\n return this\n }\n}\n\nmodule.exports = SemVer\n","'use strict'\n\nconst SemVer = require('../classes/semver')\nconst compare = (a, b, loose) =>\n new SemVer(a, loose).compare(new SemVer(b, loose))\n\nmodule.exports = compare\n","'use strict'\n\nconst compare = require('./compare')\nconst eq = (a, b, loose) => compare(a, b, loose) === 0\nmodule.exports = eq\n","'use strict'\n\nconst compare = require('./compare')\nconst neq = (a, b, loose) => compare(a, b, loose) !== 0\nmodule.exports = neq\n","'use strict'\n\nconst compare = require('./compare')\nconst gt = (a, b, loose) => compare(a, b, loose) > 0\nmodule.exports = gt\n","'use strict'\n\nconst compare = require('./compare')\nconst gte = (a, b, loose) => compare(a, b, loose) >= 0\nmodule.exports = gte\n","'use strict'\n\nconst compare = require('./compare')\nconst lt = (a, b, loose) => compare(a, b, loose) < 0\nmodule.exports = lt\n","'use strict'\n\nconst compare = require('./compare')\nconst lte = (a, b, loose) => compare(a, b, loose) <= 0\nmodule.exports = lte\n","'use strict'\n\nconst eq = require('./eq')\nconst neq = require('./neq')\nconst gt = require('./gt')\nconst gte = require('./gte')\nconst lt = require('./lt')\nconst lte = require('./lte')\n\nconst cmp = (a, op, b, loose) => {\n switch (op) {\n case '===':\n if (typeof a === 'object') {\n a = a.version\n }\n if (typeof b === 'object') {\n b = b.version\n }\n return a === b\n\n case '!==':\n if (typeof a === 'object') {\n a = a.version\n }\n if (typeof b === 'object') {\n b = b.version\n }\n return a !== b\n\n case '':\n case '=':\n case '==':\n return eq(a, b, loose)\n\n case '!=':\n return neq(a, b, loose)\n\n case '>':\n return gt(a, b, loose)\n\n case '>=':\n return gte(a, b, loose)\n\n case '<':\n return lt(a, b, loose)\n\n case '<=':\n return lte(a, b, loose)\n\n default:\n throw new TypeError(`Invalid operator: ${op}`)\n }\n}\nmodule.exports = cmp\n","'use strict'\n\nconst ANY = Symbol('SemVer ANY')\n// hoisted class for cyclic dependency\nclass Comparator {\n static get ANY () {\n return ANY\n }\n\n constructor (comp, options) {\n options = parseOptions(options)\n\n if (comp instanceof Comparator) {\n if (comp.loose === !!options.loose) {\n return comp\n } else {\n comp = comp.value\n }\n }\n\n comp = comp.trim().split(/\\s+/).join(' ')\n debug('comparator', comp, options)\n this.options = options\n this.loose = !!options.loose\n this.parse(comp)\n\n if (this.semver === ANY) {\n this.value = ''\n } else {\n this.value = this.operator + this.semver.version\n }\n\n debug('comp', this)\n }\n\n parse (comp) {\n const r = this.options.loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR]\n const m = comp.match(r)\n\n if (!m) {\n throw new TypeError(`Invalid comparator: ${comp}`)\n }\n\n this.operator = m[1] !== undefined ? m[1] : ''\n if (this.operator === '=') {\n this.operator = ''\n }\n\n // if it literally is just '>' or '' then allow anything.\n if (!m[2]) {\n this.semver = ANY\n } else {\n this.semver = new SemVer(m[2], this.options.loose)\n }\n }\n\n toString () {\n return this.value\n }\n\n test (version) {\n debug('Comparator.test', version, this.options.loose)\n\n if (this.semver === ANY || version === ANY) {\n return true\n }\n\n if (typeof version === 'string') {\n try {\n version = new SemVer(version, this.options)\n } catch (er) {\n return false\n }\n }\n\n return cmp(version, this.operator, this.semver, this.options)\n }\n\n intersects (comp, options) {\n if (!(comp instanceof Comparator)) {\n throw new TypeError('a Comparator is required')\n }\n\n if (this.operator === '') {\n if (this.value === '') {\n return true\n }\n return new Range(comp.value, options).test(this.value)\n } else if (comp.operator === '') {\n if (comp.value === '') {\n return true\n }\n return new Range(this.value, options).test(comp.semver)\n }\n\n options = parseOptions(options)\n\n // Special cases where nothing can possibly be lower\n if (options.includePrerelease &&\n (this.value === '<0.0.0-0' || comp.value === '<0.0.0-0')) {\n return false\n }\n if (!options.includePrerelease &&\n (this.value.startsWith('<0.0.0') || comp.value.startsWith('<0.0.0'))) {\n return false\n }\n\n // Same direction increasing (> or >=)\n if (this.operator.startsWith('>') && comp.operator.startsWith('>')) {\n return true\n }\n // Same direction decreasing (< or <=)\n if (this.operator.startsWith('<') && comp.operator.startsWith('<')) {\n return true\n }\n // same SemVer and both sides are inclusive (<= or >=)\n if (\n (this.semver.version === comp.semver.version) &&\n this.operator.includes('=') && comp.operator.includes('=')) {\n return true\n }\n // opposite directions less than\n if (cmp(this.semver, '<', comp.semver, options) &&\n this.operator.startsWith('>') && comp.operator.startsWith('<')) {\n return true\n }\n // opposite directions greater than\n if (cmp(this.semver, '>', comp.semver, options) &&\n this.operator.startsWith('<') && comp.operator.startsWith('>')) {\n return true\n }\n return false\n }\n}\n\nmodule.exports = Comparator\n\nconst parseOptions = require('../internal/parse-options')\nconst { safeRe: re, t } = require('../internal/re')\nconst cmp = require('../functions/cmp')\nconst debug = require('../internal/debug')\nconst SemVer = require('./semver')\nconst Range = require('./range')\n","'use strict'\n\nconst SPACE_CHARACTERS = /\\s+/g\n\n// hoisted class for cyclic dependency\nclass Range {\n constructor (range, options) {\n options = parseOptions(options)\n\n if (range instanceof Range) {\n if (\n range.loose === !!options.loose &&\n range.includePrerelease === !!options.includePrerelease\n ) {\n return range\n } else {\n return new Range(range.raw, options)\n }\n }\n\n if (range instanceof Comparator) {\n // just put it in the set and return\n this.raw = range.value\n this.set = [[range]]\n this.formatted = undefined\n return this\n }\n\n this.options = options\n this.loose = !!options.loose\n this.includePrerelease = !!options.includePrerelease\n\n // First reduce all whitespace as much as possible so we do not have to rely\n // on potentially slow regexes like \\s*. This is then stored and used for\n // future error messages as well.\n this.raw = range.trim().replace(SPACE_CHARACTERS, ' ')\n\n // First, split on ||\n this.set = this.raw\n .split('||')\n // map the range to a 2d array of comparators\n .map(r => this.parseRange(r.trim()))\n // throw out any comparator lists that are empty\n // this generally means that it was not a valid range, which is allowed\n // in loose mode, but will still throw if the WHOLE range is invalid.\n .filter(c => c.length)\n\n if (!this.set.length) {\n throw new TypeError(`Invalid SemVer Range: ${this.raw}`)\n }\n\n // if we have any that are not the null set, throw out null sets.\n if (this.set.length > 1) {\n // keep the first one, in case they're all null sets\n const first = this.set[0]\n this.set = this.set.filter(c => !isNullSet(c[0]))\n if (this.set.length === 0) {\n this.set = [first]\n } else if (this.set.length > 1) {\n // if we have any that are *, then the range is just *\n for (const c of this.set) {\n if (c.length === 1 && isAny(c[0])) {\n this.set = [c]\n break\n }\n }\n }\n }\n\n this.formatted = undefined\n }\n\n get range () {\n if (this.formatted === undefined) {\n this.formatted = ''\n for (let i = 0; i < this.set.length; i++) {\n if (i > 0) {\n this.formatted += '||'\n }\n const comps = this.set[i]\n for (let k = 0; k < comps.length; k++) {\n if (k > 0) {\n this.formatted += ' '\n }\n this.formatted += comps[k].toString().trim()\n }\n }\n }\n return this.formatted\n }\n\n format () {\n return this.range\n }\n\n toString () {\n return this.range\n }\n\n parseRange (range) {\n // strip build metadata so it can't bleed into the version\n range = range.replace(BUILDSTRIPRE, '')\n\n // memoize range parsing for performance.\n // this is a very hot path, and fully deterministic.\n const memoOpts =\n (this.options.includePrerelease && FLAG_INCLUDE_PRERELEASE) |\n (this.options.loose && FLAG_LOOSE)\n const memoKey = memoOpts + ':' + range\n const cached = cache.get(memoKey)\n if (cached) {\n return cached\n }\n\n const loose = this.options.loose\n // `1.2.3 - 1.2.4` => `>=1.2.3 <=1.2.4`\n const hr = loose ? re[t.HYPHENRANGELOOSE] : re[t.HYPHENRANGE]\n range = range.replace(hr, hyphenReplace(this.options.includePrerelease))\n debug('hyphen replace', range)\n\n // `> 1.2.3 < 1.2.5` => `>1.2.3 <1.2.5`\n range = range.replace(re[t.COMPARATORTRIM], comparatorTrimReplace)\n debug('comparator trim', range)\n\n // `~ 1.2.3` => `~1.2.3`\n range = range.replace(re[t.TILDETRIM], tildeTrimReplace)\n debug('tilde trim', range)\n\n // `^ 1.2.3` => `^1.2.3`\n range = range.replace(re[t.CARETTRIM], caretTrimReplace)\n debug('caret trim', range)\n\n // At this point, the range is completely trimmed and\n // ready to be split into comparators.\n\n let rangeList = range\n .split(' ')\n .map(comp => parseComparator(comp, this.options))\n .join(' ')\n .split(/\\s+/)\n // >=0.0.0 is equivalent to *\n .map(comp => replaceGTE0(comp, this.options))\n\n if (loose) {\n // in loose mode, throw out any that are not valid comparators\n rangeList = rangeList.filter(comp => {\n debug('loose invalid filter', comp, this.options)\n return !!comp.match(re[t.COMPARATORLOOSE])\n })\n }\n debug('range list', rangeList)\n\n // if any comparators are the null set, then replace with JUST null set\n // if more than one comparator, remove any * comparators\n // also, don't include the same comparator more than once\n const rangeMap = new Map()\n const comparators = rangeList.map(comp => new Comparator(comp, this.options))\n for (const comp of comparators) {\n if (isNullSet(comp)) {\n return [comp]\n }\n rangeMap.set(comp.value, comp)\n }\n if (rangeMap.size > 1 && rangeMap.has('')) {\n rangeMap.delete('')\n }\n\n const result = [...rangeMap.values()]\n cache.set(memoKey, result)\n return result\n }\n\n intersects (range, options) {\n if (!(range instanceof Range)) {\n throw new TypeError('a Range is required')\n }\n\n return this.set.some((thisComparators) => {\n return (\n isSatisfiable(thisComparators, options) &&\n range.set.some((rangeComparators) => {\n return (\n isSatisfiable(rangeComparators, options) &&\n thisComparators.every((thisComparator) => {\n return rangeComparators.every((rangeComparator) => {\n return thisComparator.intersects(rangeComparator, options)\n })\n })\n )\n })\n )\n })\n }\n\n // if ANY of the sets match ALL of its comparators, then pass\n test (version) {\n if (!version) {\n return false\n }\n\n if (typeof version === 'string') {\n try {\n version = new SemVer(version, this.options)\n } catch (er) {\n return false\n }\n }\n\n for (let i = 0; i < this.set.length; i++) {\n if (testSet(this.set[i], version, this.options)) {\n return true\n }\n }\n return false\n }\n}\n\nmodule.exports = Range\n\nconst LRU = require('../internal/lrucache')\nconst cache = new LRU()\n\nconst parseOptions = require('../internal/parse-options')\nconst Comparator = require('./comparator')\nconst debug = require('../internal/debug')\nconst SemVer = require('./semver')\nconst {\n safeRe: re,\n src,\n t,\n comparatorTrimReplace,\n tildeTrimReplace,\n caretTrimReplace,\n} = require('../internal/re')\nconst { FLAG_INCLUDE_PRERELEASE, FLAG_LOOSE } = require('../internal/constants')\n\n// unbounded global build-metadata stripper used by parseRange\nconst BUILDSTRIPRE = new RegExp(src[t.BUILD], 'g')\n\nconst isNullSet = c => c.value === '<0.0.0-0'\nconst isAny = c => c.value === ''\n\n// take a set of comparators and determine whether there\n// exists a version which can satisfy it\nconst isSatisfiable = (comparators, options) => {\n let result = true\n const remainingComparators = comparators.slice()\n let testComparator = remainingComparators.pop()\n\n while (result && remainingComparators.length) {\n result = remainingComparators.every((otherComparator) => {\n return testComparator.intersects(otherComparator, options)\n })\n\n testComparator = remainingComparators.pop()\n }\n\n return result\n}\n\n// comprised of xranges, tildes, stars, and gtlt's at this point.\n// already replaced the hyphen ranges\n// turn into a set of JUST comparators.\nconst parseComparator = (comp, options) => {\n comp = comp.replace(re[t.BUILD], '')\n debug('comp', comp, options)\n comp = replaceCarets(comp, options)\n debug('caret', comp)\n comp = replaceTildes(comp, options)\n debug('tildes', comp)\n comp = replaceXRanges(comp, options)\n debug('xrange', comp)\n comp = replaceStars(comp, options)\n debug('stars', comp)\n return comp\n}\n\nconst isX = id => !id || id.toLowerCase() === 'x' || id === '*'\n\nconst invalidXRangeOrder = (M, m, p) => (\n (isX(M) && !isX(m)) ||\n (isX(m) && p && !isX(p))\n)\n\n// ~, ~> --> * (any, kinda silly)\n// ~2, ~2.x, ~2.x.x, ~>2, ~>2.x ~>2.x.x --> >=2.0.0 <3.0.0-0\n// ~2.0, ~2.0.x, ~>2.0, ~>2.0.x --> >=2.0.0 <2.1.0-0\n// ~1.2, ~1.2.x, ~>1.2, ~>1.2.x --> >=1.2.0 <1.3.0-0\n// ~1.2.3, ~>1.2.3 --> >=1.2.3 <1.3.0-0\n// ~1.2.0, ~>1.2.0 --> >=1.2.0 <1.3.0-0\n// ~0.0.1 --> >=0.0.1 <0.1.0-0\nconst replaceTildes = (comp, options) => {\n return comp\n .trim()\n .split(/\\s+/)\n .map((c) => replaceTilde(c, options))\n .join(' ')\n}\n\nconst replaceTilde = (comp, options) => {\n const r = options.loose ? re[t.TILDELOOSE] : re[t.TILDE]\n // if we're including prereleases in the match, then the lower bound is\n // -0, the lowest possible prerelease value, just like x-ranges and carets.\n // this keeps `~1.2` equivalent to the `1.2.x` x-range it's documented as.\n const z = options.includePrerelease ? '-0' : ''\n return comp.replace(r, (_, M, m, p, pr) => {\n debug('tilde', comp, _, M, m, p, pr)\n let ret\n\n if (isX(M)) {\n ret = ''\n } else if (isX(m)) {\n ret = `>=${M}.0.0${z} <${+M + 1}.0.0-0`\n } else if (isX(p)) {\n // ~1.2 == >=1.2.0 <1.3.0-0\n ret = `>=${M}.${m}.0${z} <${M}.${+m + 1}.0-0`\n } else if (pr) {\n debug('replaceTilde pr', pr)\n ret = `>=${M}.${m}.${p}-${pr\n } <${M}.${+m + 1}.0-0`\n } else {\n // ~1.2.3 == >=1.2.3 <1.3.0-0\n ret = `>=${M}.${m}.${p\n } <${M}.${+m + 1}.0-0`\n }\n\n debug('tilde return', ret)\n return ret\n })\n}\n\n// ^ --> * (any, kinda silly)\n// ^2, ^2.x, ^2.x.x --> >=2.0.0 <3.0.0-0\n// ^2.0, ^2.0.x --> >=2.0.0 <3.0.0-0\n// ^1.2, ^1.2.x --> >=1.2.0 <2.0.0-0\n// ^1.2.3 --> >=1.2.3 <2.0.0-0\n// ^1.2.0 --> >=1.2.0 <2.0.0-0\n// ^0.0.1 --> >=0.0.1 <0.0.2-0\n// ^0.1.0 --> >=0.1.0 <0.2.0-0\nconst replaceCarets = (comp, options) => {\n return comp\n .trim()\n .split(/\\s+/)\n .map((c) => replaceCaret(c, options))\n .join(' ')\n}\n\nconst replaceCaret = (comp, options) => {\n debug('caret', comp, options)\n const r = options.loose ? re[t.CARETLOOSE] : re[t.CARET]\n const z = options.includePrerelease ? '-0' : ''\n return comp.replace(r, (_, M, m, p, pr) => {\n debug('caret', comp, _, M, m, p, pr)\n let ret\n\n if (isX(M)) {\n ret = ''\n } else if (isX(m)) {\n ret = `>=${M}.0.0${z} <${+M + 1}.0.0-0`\n } else if (isX(p)) {\n if (M === '0') {\n ret = `>=${M}.${m}.0${z} <${M}.${+m + 1}.0-0`\n } else {\n ret = `>=${M}.${m}.0${z} <${+M + 1}.0.0-0`\n }\n } else if (pr) {\n debug('replaceCaret pr', pr)\n if (M === '0') {\n if (m === '0') {\n ret = `>=${M}.${m}.${p}-${pr\n } <${M}.${m}.${+p + 1}-0`\n } else {\n ret = `>=${M}.${m}.${p}-${pr\n } <${M}.${+m + 1}.0-0`\n }\n } else {\n ret = `>=${M}.${m}.${p}-${pr\n } <${+M + 1}.0.0-0`\n }\n } else {\n debug('no pr')\n if (M === '0') {\n if (m === '0') {\n ret = `>=${M}.${m}.${p\n } <${M}.${m}.${+p + 1}-0`\n } else {\n ret = `>=${M}.${m}.${p\n } <${M}.${+m + 1}.0-0`\n }\n } else {\n ret = `>=${M}.${m}.${p\n } <${+M + 1}.0.0-0`\n }\n }\n\n debug('caret return', ret)\n return ret\n })\n}\n\nconst replaceXRanges = (comp, options) => {\n debug('replaceXRanges', comp, options)\n return comp\n .split(/\\s+/)\n .map((c) => replaceXRange(c, options))\n .join(' ')\n}\n\nconst replaceXRange = (comp, options) => {\n comp = comp.trim()\n const r = options.loose ? re[t.XRANGELOOSE] : re[t.XRANGE]\n return comp.replace(r, (ret, gtlt, M, m, p, pr) => {\n debug('xRange', comp, ret, gtlt, M, m, p, pr)\n if (invalidXRangeOrder(M, m, p)) {\n return comp\n }\n\n const xM = isX(M)\n const xm = xM || isX(m)\n const xp = xm || isX(p)\n const anyX = xp\n\n if (gtlt === '=' && anyX) {\n gtlt = ''\n }\n\n // if we're including prereleases in the match, then we need\n // to fix this to -0, the lowest possible prerelease value\n pr = options.includePrerelease ? '-0' : ''\n\n if (xM) {\n if (gtlt === '>' || gtlt === '<') {\n // nothing is allowed\n ret = '<0.0.0-0'\n } else {\n // nothing is forbidden\n ret = '*'\n }\n } else if (gtlt && anyX) {\n // we know patch is an x, because we have any x at all.\n // replace X with 0\n if (xm) {\n m = 0\n }\n p = 0\n\n if (gtlt === '>') {\n // >1 => >=2.0.0\n // >1.2 => >=1.3.0\n gtlt = '>='\n if (xm) {\n M = +M + 1\n m = 0\n p = 0\n } else {\n m = +m + 1\n p = 0\n }\n } else if (gtlt === '<=') {\n // <=0.7.x is actually <0.8.0, since any 0.7.x should\n // pass. Similarly, <=7.x is actually <8.0.0, etc.\n gtlt = '<'\n if (xm) {\n M = +M + 1\n } else {\n m = +m + 1\n }\n }\n\n if (gtlt === '<') {\n pr = '-0'\n }\n\n ret = `${gtlt + M}.${m}.${p}${pr}`\n } else if (xm) {\n ret = `>=${M}.0.0${pr} <${+M + 1}.0.0-0`\n } else if (xp) {\n ret = `>=${M}.${m}.0${pr\n } <${M}.${+m + 1}.0-0`\n }\n\n debug('xRange return', ret)\n\n return ret\n })\n}\n\n// Because * is AND-ed with everything else in the comparator,\n// and '' means \"any version\", just remove the *s entirely.\nconst replaceStars = (comp, options) => {\n debug('replaceStars', comp, options)\n // Looseness is ignored here. star is always as loose as it gets!\n return comp\n .trim()\n .replace(re[t.STAR], '')\n}\n\nconst replaceGTE0 = (comp, options) => {\n debug('replaceGTE0', comp, options)\n return comp\n .trim()\n .replace(re[options.includePrerelease ? t.GTE0PRE : t.GTE0], '')\n}\n\n// This function is passed to string.replace(re[t.HYPHENRANGE])\n// M, m, patch, prerelease, build\n// 1.2 - 3.4.5 => >=1.2.0 <=3.4.5\n// 1.2.3 - 3.4 => >=1.2.0 <3.5.0-0 Any 3.4.x will do\n// 1.2 - 3.4 => >=1.2.0 <3.5.0-0\n// TODO build?\nconst hyphenReplace = incPr => ($0,\n from, fM, fm, fp, fpr, fb,\n to, tM, tm, tp, tpr) => {\n if (isX(fM)) {\n from = ''\n } else if (isX(fm)) {\n from = `>=${fM}.0.0${incPr ? '-0' : ''}`\n } else if (isX(fp)) {\n from = `>=${fM}.${fm}.0${incPr ? '-0' : ''}`\n } else if (fpr) {\n from = `>=${from}`\n } else {\n from = `>=${from}${incPr ? '-0' : ''}`\n }\n\n if (isX(tM)) {\n to = ''\n } else if (isX(tm)) {\n to = `<${+tM + 1}.0.0-0`\n } else if (isX(tp)) {\n to = `<${tM}.${+tm + 1}.0-0`\n } else if (tpr) {\n to = `<=${tM}.${tm}.${tp}-${tpr}`\n } else if (incPr) {\n to = `<${tM}.${tm}.${+tp + 1}-0`\n } else {\n to = `<=${to}`\n }\n\n return `${from} ${to}`.trim()\n}\n\nconst testSet = (set, version, options) => {\n for (let i = 0; i < set.length; i++) {\n if (!set[i].test(version)) {\n return false\n }\n }\n\n if (version.prerelease.length && !options.includePrerelease) {\n // Find the set of versions that are allowed to have prereleases\n // For example, ^1.2.3-pr.1 desugars to >=1.2.3-pr.1 <2.0.0\n // That should allow `1.2.3-pr.2` to pass.\n // However, `1.2.4-alpha.notready` should NOT be allowed,\n // even though it's within the range set by the comparators.\n for (let i = 0; i < set.length; i++) {\n debug(set[i].semver)\n if (set[i].semver === Comparator.ANY) {\n continue\n }\n\n if (set[i].semver.prerelease.length > 0) {\n const allowed = set[i].semver\n if (allowed.major === version.major &&\n allowed.minor === version.minor &&\n allowed.patch === version.patch) {\n return true\n }\n }\n }\n\n // Version has a -pre, but it's not one of the ones we like.\n return false\n }\n\n return true\n}\n","// muon - Multi-platform GUI application framework that uses CEF as its backend\n// Copyright (c) Kouji Matsui. (@kekyo@mi.kekyo.net)\n// Under MIT.\n// https://github.com/kekyo/muon-ui\n\nimport {\n copyFile,\n cp,\n mkdir,\n readFile,\n realpath,\n rm,\n stat,\n} from \"node:fs/promises\";\nimport {\n basename,\n dirname,\n isAbsolute,\n join,\n relative,\n resolve,\n} from \"node:path\";\n\nimport __screwUpDefaultImportModule0 from 'semver/classes/range.js';\nconst SemverRange = __resolveDefaultExport(__screwUpDefaultImportModule0, false);\nglobalThis.__screwUpIsInCJS_fd9deda55de3 = false;\nfunction __resolveDefaultExport<T>(module: T | { default?: T }, isESM: boolean): T {\n const __isInCJS =\n typeof globalThis !== 'undefined' &&\n (globalThis as any).__screwUpIsInCJS_fd9deda55de3 === true;\n const maybe = module as { default?: T };\n const hasDefault = !!(maybe && typeof maybe === 'object' && 'default' in maybe);\n const unwrapNamespaceDefault = (value: unknown): unknown => {\n if (!value || typeof value !== 'object') {\n return value;\n }\n const inner = value as any;\n const isModule =\n inner.__esModule === true ||\n (typeof Symbol !== 'undefined' &&\n (inner as any)[Symbol.toStringTag] === 'Module');\n if (isModule && 'default' in inner) {\n return inner.default;\n }\n return value;\n };\n const resolvedDefault = hasDefault\n ? unwrapNamespaceDefault((maybe as any).default)\n : undefined;\n\n if (__isInCJS) {\n return hasDefault ? ((resolvedDefault as T) ?? (module as T)) : (module as T);\n }\n\n if (isESM) {\n if (hasDefault) {\n return resolvedDefault as T;\n }\n throw new Error('Default export not found.');\n }\n\n return hasDefault ? ((resolvedDefault as T) ?? (module as T)) : (module as T);\n}\n\n\ndeclare const __MUON_NODE_SUPPORTED_ENGINE_RANGE__: string;\n\ntype JsonObject = Record<string, unknown>;\n\nconst stagedNodeProjectDirectoryName = \"node-project\";\nconst nodeBridgeFileName = \"node-bridge.mjs\";\nconst supportedNodeRange = __MUON_NODE_SUPPORTED_ENGINE_RANGE__;\n\n/**\n * Node runtime constraint passed from the JavaScript build layer to a native\n * launcher or runtime preparer.\n */\nexport interface MuonNodeRuntimeRequirement {\n /** Whether the application must fail when no matching Node runtime exists. */\n readonly required: boolean;\n /** Whether `package.json` explicitly contains `engines.node`. */\n readonly engineRangeSpecified: boolean;\n /** Original `package.json` `engines.node` text, or `*` when omitted. */\n readonly engineRange: string;\n /**\n * Normalized comparator sets accepted by both the project and muon bridge.\n *\n * @remarks The outer array is an OR expression and each inner array is an\n * AND expression. An empty inner array represents a wildcard set.\n */\n readonly comparatorSets: readonly (readonly string[])[];\n}\n\n/**\n * Node project selected by the `node.project` muon configuration.\n */\nexport interface ResolvedMuonNodeProject {\n /** Absolute source directory copied into a muon runtime. */\n readonly sourcePath: string;\n /** Whether `package.json` explicitly contains `engines.node`. */\n readonly engineRangeSpecified: boolean;\n /** Original `package.json` `engines.node` text, or `*` when omitted. */\n readonly engineRange: string;\n /**\n * Normalized comparator sets accepted by both the project and muon bridge.\n */\n readonly comparatorSets: readonly (readonly string[])[];\n}\n\nconst normalizeComparatorSet = (\n comparators: SemverRange[\"set\"][number],\n): string[] =>\n comparators\n .map((comparator) => comparator.value)\n .filter((comparator) => comparator !== \"\");\n\nconst comparatorSetsIntersect = (\n left: readonly string[],\n right: readonly string[],\n): boolean =>\n new SemverRange(left.join(\" \")).intersects(new SemverRange(right.join(\" \")));\n\nconst intersectNodeEngineRanges = (\n projectRange: SemverRange,\n): readonly (readonly string[])[] => {\n const bridgeRange = new SemverRange(supportedNodeRange);\n const comparatorSets: string[][] = [];\n for (const bridgeComparators of bridgeRange.set) {\n const bridgeSet = normalizeComparatorSet(bridgeComparators);\n for (const projectComparators of projectRange.set) {\n const projectSet = normalizeComparatorSet(projectComparators);\n if (comparatorSetsIntersect(bridgeSet, projectSet)) {\n comparatorSets.push([...bridgeSet, ...projectSet]);\n }\n }\n }\n return comparatorSets;\n};\n\nconst readNodeEngineRequirement = async (\n packageJsonPath: string,\n): Promise<\n Pick<\n ResolvedMuonNodeProject,\n \"engineRangeSpecified\" | \"engineRange\" | \"comparatorSets\"\n >\n> => {\n let source: string;\n try {\n source = await readFile(packageJsonPath, \"utf8\");\n } catch (error) {\n throw new Error(\n `muon Node project package.json could not be read: ${packageJsonPath}: ${getErrorMessage(error)}`,\n );\n }\n\n let packageJson: unknown;\n try {\n packageJson = JSON.parse(source) as unknown;\n } catch (error) {\n throw new Error(\n `muon Node project package.json could not be parsed: ${packageJsonPath}: ${getErrorMessage(error)}`,\n );\n }\n if (!isJsonObject(packageJson)) {\n throw new Error(\n `muon Node project package.json must contain an object: ${packageJsonPath}`,\n );\n }\n\n const enginesValue = packageJson.engines;\n if (enginesValue !== undefined && !isJsonObject(enginesValue)) {\n throw new Error(\"package.json engines must be an object\");\n }\n const nodeValue = enginesValue?.node;\n if (\n nodeValue !== undefined &&\n (typeof nodeValue !== \"string\" || nodeValue.trim().length === 0)\n ) {\n throw new Error(\"package.json engines.node must be a non-empty string\");\n }\n\n const engineRange = nodeValue ?? \"*\";\n let projectRange: SemverRange;\n try {\n projectRange = new SemverRange(engineRange);\n } catch {\n throw new Error(\n `package.json engines.node is not a valid range: ${engineRange}`,\n );\n }\n const comparatorSets = intersectNodeEngineRanges(projectRange);\n if (comparatorSets.length === 0) {\n throw new Error(\n \"package.json engines.node does not overlap the muon Node bridge range\",\n );\n }\n return {\n engineRangeSpecified: nodeValue !== undefined,\n engineRange,\n comparatorSets,\n };\n};\n\n/**\n * Creates the native runtime constraint for a resolved Node project.\n *\n * @param project Resolved Node project, or `undefined` when Node is disabled.\n * @param required Whether absence of a matching runtime is fatal.\n * @returns The launcher/runtime requirement, or `undefined` for a non-Node app.\n */\nexport const createMuonNodeRuntimeRequirement = (\n project: ResolvedMuonNodeProject | undefined,\n required: boolean,\n): MuonNodeRuntimeRequirement | undefined =>\n project === undefined\n ? undefined\n : {\n required,\n engineRangeSpecified: project.engineRangeSpecified,\n engineRange: project.engineRange,\n comparatorSets: project.comparatorSets,\n };\n\n/**\n * Resolves and validates an optional Node project from muon configuration.\n *\n * @param config Parsed muon configuration object.\n * @param configDirectory Directory used to resolve a relative `node.project`.\n * @returns The resolved project, or `undefined` when Node hosting is not enabled.\n */\nexport const resolveMuonNodeProject = async (\n config: Readonly<JsonObject> | undefined,\n configDirectory: string,\n): Promise<ResolvedMuonNodeProject | undefined> => {\n const node = config?.node;\n if (node === undefined) {\n return undefined;\n }\n if (!isJsonObject(node)) {\n throw new Error(\"muon.json node must be an object\");\n }\n\n const project = node.project;\n if (project === undefined) {\n throw new Error(\"muon.json node.project is required when node is present\");\n }\n if (typeof project !== \"string\") {\n throw new Error(\"muon.json node.project must be a string\");\n }\n if (project.trim().length === 0) {\n throw new Error(\"muon.json node.project must not be empty\");\n }\n\n const configuredSourcePath = resolve(configDirectory, project);\n if (!(await isDirectory(configuredSourcePath))) {\n throw new Error(\n `muon Node project directory does not exist: ${configuredSourcePath}`,\n );\n }\n const sourcePath = await realpath(configuredSourcePath);\n const packageJsonPath = join(sourcePath, \"package.json\");\n if (!(await isFile(packageJsonPath))) {\n throw new Error(\n `muon Node project package.json does not exist: ${packageJsonPath}`,\n );\n }\n\n return {\n sourcePath,\n ...(await readNodeEngineRequirement(packageJsonPath)),\n };\n};\n\n/**\n * Rewrites a resolved Node project to its packaged runtime location.\n *\n * @param config Source muon configuration.\n * @param project Resolved Node project, when enabled.\n * @returns Configuration suitable for embedding in a built distribution.\n */\nexport const createPackagedMuonNodeConfig = (\n config: Readonly<JsonObject>,\n project: ResolvedMuonNodeProject | undefined,\n): JsonObject => {\n if (project === undefined) {\n return { ...config };\n }\n\n const node = config.node;\n if (!isJsonObject(node)) {\n throw new Error(\"muon.json node must be an object\");\n }\n return {\n ...config,\n node: {\n ...node,\n project: `./${stagedNodeProjectDirectoryName}`,\n },\n };\n};\n\n/**\n * Verifies that staging cannot remove or recursively copy the Node source.\n *\n * @param project Resolved Node project, when enabled.\n * @param runtimeDirectory Runtime directory replaced or used for staging.\n * @returns A promise that resolves when the paths are disjoint.\n */\nexport const assertMuonNodeProjectStagingIsSafe = (\n project: ResolvedMuonNodeProject | undefined,\n runtimeDirectory: string,\n): Promise<void> =>\n assertMuonNodeProjectPathIsDisjoint(\n project,\n runtimeDirectory,\n \"runtime directory\",\n );\n\n/**\n * Verifies that a Node project cannot be exposed through the app asset source.\n *\n * @param project Resolved Node project, when enabled.\n * @param assetSourcePath Directory or ZIP path used as application assets.\n * @returns A promise that resolves when the paths are disjoint.\n */\nexport const assertMuonNodeProjectAssetSourceIsSafe = (\n project: ResolvedMuonNodeProject | undefined,\n assetSourcePath: string,\n): Promise<void> =>\n assertMuonNodeProjectPathIsDisjoint(project, assetSourcePath, \"asset source\");\n\n/**\n * Verifies that a Vite build cannot delete or expose a Node project.\n *\n * @param project Resolved Node project, when enabled.\n * @param outputDirectory Vite output directory emptied before a build.\n * @param publicDirectory Vite public directory copied into build output, or an\n * empty string when public files are disabled.\n * @returns A promise that resolves when the Node project is disjoint from both\n * Vite paths.\n */\nexport const assertMuonNodeProjectViteBuildIsSafe = async (\n project: ResolvedMuonNodeProject | undefined,\n outputDirectory: string,\n publicDirectory: string,\n): Promise<void> => {\n await assertMuonNodeProjectPathIsDisjoint(\n project,\n outputDirectory,\n \"Vite output directory\",\n );\n await assertMuonNodeProjectVitePublicDirectoryIsSafe(\n project,\n publicDirectory,\n );\n};\n\n/**\n * Verifies that Vite cannot expose a Node project through its public directory.\n *\n * @param project Resolved Node project, when enabled.\n * @param publicDirectory Vite public directory copied into served or built\n * assets, or an empty string when public files are disabled.\n * @returns A promise that resolves when the Node project and public directory\n * are disjoint.\n */\nexport const assertMuonNodeProjectVitePublicDirectoryIsSafe = async (\n project: ResolvedMuonNodeProject | undefined,\n publicDirectory: string,\n): Promise<void> => {\n if (publicDirectory !== \"\") {\n await assertMuonNodeProjectPathIsDisjoint(\n project,\n publicDirectory,\n \"Vite public directory\",\n );\n }\n};\n\n/**\n * Verifies that pack cleanup cannot remove a configured Node project.\n *\n * @param project Resolved Node project, when enabled.\n * @param cleanupDirectory Directory recursively removed by muon pack.\n * @returns A promise that resolves when the paths are disjoint.\n */\nexport const assertMuonNodeProjectPackCleanupIsSafe = (\n project: ResolvedMuonNodeProject | undefined,\n cleanupDirectory: string,\n): Promise<void> =>\n assertMuonNodeProjectPathIsDisjoint(\n project,\n cleanupDirectory,\n \"pack cleanup directory\",\n );\n\n/**\n * Stages a resolved Node project beside a muon runtime executable.\n *\n * @param project Resolved Node project, or `undefined` to remove stale staging.\n * @param runtimeDirectory Runtime directory that receives `node-project/`.\n * @returns Absolute staged project path, or `undefined` when Node is disabled.\n *\n * @remarks Symbolic links are dereferenced so portable ZIP and tar packaging\n * retains linked dependencies as ordinary files and directories.\n */\nexport const stageMuonNodeProject = async (\n project: ResolvedMuonNodeProject | undefined,\n runtimeDirectory: string,\n): Promise<string | undefined> => {\n const destinationPath = resolve(\n runtimeDirectory,\n stagedNodeProjectDirectoryName,\n );\n if (project === undefined) {\n await rm(destinationPath, { recursive: true, force: true });\n return undefined;\n }\n\n await assertMuonNodeProjectStagingIsSafe(project, runtimeDirectory);\n await mkdir(runtimeDirectory, { recursive: true });\n await assertMuonNodeProjectStagingIsSafe(project, runtimeDirectory);\n await rm(destinationPath, { recursive: true, force: true });\n await cp(project.sourcePath, destinationPath, {\n dereference: true,\n preserveTimestamps: true,\n recursive: true,\n });\n return destinationPath;\n};\n\n/**\n * Copies the native Node host plugin and JavaScript bridge into a build output.\n *\n * @param sourceRuntimeDirectory Packaged runtime source for one target.\n * @param outputRuntimeDirectory App distribution runtime directory.\n * @param platform Target operating system.\n */\nexport const stageMuonNodeHostArtifacts = async (\n sourceRuntimeDirectory: string,\n outputRuntimeDirectory: string,\n platform: \"linux\" | \"windows\",\n): Promise<void> => {\n const pluginFileName = platform === \"windows\" ? \"node.dll\" : \"node.so\";\n const sourcePluginDirectory = join(sourceRuntimeDirectory, \"plugins\");\n const outputPluginDirectory = join(outputRuntimeDirectory, \"plugins\");\n const sourcePluginPath = join(sourcePluginDirectory, pluginFileName);\n const sourceBridgePath = join(sourcePluginDirectory, nodeBridgeFileName);\n\n await assertFile(sourcePluginPath, `muon Node plugin for ${platform}`);\n await assertFile(sourceBridgePath, \"muon Node bridge\");\n await mkdir(outputPluginDirectory, { recursive: true });\n await copyFile(sourcePluginPath, join(outputPluginDirectory, pluginFileName));\n await copyFile(\n sourceBridgePath,\n join(outputPluginDirectory, nodeBridgeFileName),\n );\n};\n\n/**\n * Validates that a prepared development runtime contains the Node host files.\n *\n * @param runtimeDirectory Prepared runtime directory.\n * @param platform Runtime operating system.\n */\nexport const assertMuonNodeHostArtifacts = async (\n runtimeDirectory: string,\n platform: NodeJS.Platform,\n): Promise<void> => {\n const pluginFileName = platform === \"win32\" ? \"node.dll\" : \"node.so\";\n const pluginDirectory = join(runtimeDirectory, \"plugins\");\n await assertFile(join(pluginDirectory, pluginFileName), \"muon Node plugin\");\n await assertFile(\n join(pluginDirectory, nodeBridgeFileName),\n \"muon Node bridge\",\n );\n};\n\nconst isJsonObject = (value: unknown): value is JsonObject =>\n typeof value === \"object\" && value !== null && !Array.isArray(value);\n\nconst isSameOrInsidePath = (parentPath: string, path: string): boolean => {\n const relativePath = relative(parentPath, path);\n return (\n relativePath === \"\" ||\n (!relativePath.startsWith(\"..\") && !isAbsolute(relativePath))\n );\n};\n\nconst isMissingPathError = (error: unknown): boolean => {\n const code = (error as NodeJS.ErrnoException).code;\n return code === \"ENOENT\" || code === \"ENOTDIR\";\n};\n\nconst getErrorMessage = (error: unknown): string =>\n error instanceof Error ? error.message : String(error);\n\n// Output paths often do not exist yet. Resolve their closest existing\n// ancestor so symlink aliases cannot bypass overlap checks, then append the\n// still-missing path segments without touching the filesystem.\nconst resolveCanonicalPotentialPath = async (path: string): Promise<string> => {\n let ancestorPath = resolve(path);\n const missingSegments: string[] = [];\n\n for (;;) {\n try {\n const canonicalAncestorPath = await realpath(ancestorPath);\n return resolve(canonicalAncestorPath, ...missingSegments.reverse());\n } catch (error) {\n if (!isMissingPathError(error)) {\n throw error;\n }\n const parentPath = dirname(ancestorPath);\n if (parentPath === ancestorPath) {\n throw error;\n }\n missingSegments.push(basename(ancestorPath));\n ancestorPath = parentPath;\n }\n }\n};\n\nconst assertMuonNodeProjectPathIsDisjoint = async (\n project: ResolvedMuonNodeProject | undefined,\n comparedPath: string,\n comparedPathLabel: string,\n): Promise<void> => {\n if (project === undefined) {\n return;\n }\n const [sourcePath, canonicalComparedPath] = await Promise.all([\n resolveCanonicalPotentialPath(project.sourcePath),\n resolveCanonicalPotentialPath(comparedPath),\n ]);\n if (\n isSameOrInsidePath(sourcePath, canonicalComparedPath) ||\n isSameOrInsidePath(canonicalComparedPath, sourcePath)\n ) {\n throw new Error(\n `muon Node project and ${comparedPathLabel} must not overlap: ${sourcePath}, ${canonicalComparedPath}`,\n );\n }\n};\n\nconst isDirectory = async (path: string): Promise<boolean> => {\n try {\n return (await stat(path)).isDirectory();\n } catch {\n return false;\n }\n};\n\nconst isFile = async (path: string): Promise<boolean> => {\n try {\n return (await stat(path)).isFile();\n } catch {\n return false;\n }\n};\n\nconst assertFile = async (path: string, label: string): Promise<void> => {\n if (!(await isFile(path))) {\n throw new Error(`${label} file does not exist: ${path}`);\n }\n};\n","// muon - Multi-platform GUI application framework that uses CEF as its backend\n// Copyright (c) Kouji Matsui. (@kekyo@mi.kekyo.net)\n// Under MIT.\n// https://github.com/kekyo/muon-ui\n\nimport { type Stats } from \"node:fs\";\nimport {\n chmod,\n copyFile,\n mkdir,\n mkdtemp,\n readFile,\n readdir,\n rm,\n stat,\n writeFile,\n} from \"node:fs/promises\";\nimport { createHash, randomBytes } from \"node:crypto\";\nimport { basename, isAbsolute, join, relative, resolve, sep } from \"node:path\";\nimport { tmpdir } from \"node:os\";\nimport {\n applyMuonNativePluginCatalogs,\n resolveMuonNativePlugins,\n stageMuonNativePlugins,\n} from \"../common/native-plugins.js\";\nimport { resolveMuonPluginAccessOptions } from \"../common/plugin-access.js\";\n\nimport __screwUpDefaultImportModule0 from 'adm-zip';\nconst AdmZip = __resolveDefaultExport(__screwUpDefaultImportModule0, false);\n\nimport {\n embedMuonConfigInLauncherFile,\n embedMuonConfigInRuntime,\n} from \"./embed-config.js\";\n\nimport {\n getMuonTargetDescriptor,\n getMuonTargetRuntimeAppId,\n type MuonDesktopTarget,\n type MuonTargetDescriptor,\n} from \"../common/targets.js\";\nimport {\n resolveMuonWindowsResource,\n stripBuildOnlyWindowsResourceConfig,\n updateWindowsPeIconResource,\n updateWindowsPeResources,\n type ResolvedMuonWindowsResource,\n} from \"./windows-resource.js\";\nimport {\n resolveMuonLinuxDesktop,\n stripBuildOnlyLinuxDesktopConfig,\n writeLinuxDesktopDistributionFiles,\n type ResolvedMuonLinuxDesktop,\n} from \"./linux-desktop.js\";\nimport {\n resolveMuonWindowsCodeSigning,\n signWindowsExecutable,\n stripBuildOnlyWindowsCodeSigningConfig,\n type ResolvedMuonWindowsCodeSigning,\n} from \"./windows-code-signing.js\";\nimport { appIconAssetEntryName, appIconAssetUrl } from \"../common/app-icon.js\";\nimport type { MuonRuntimePluginConfig } from \"../common/capability.js\";\nimport type { MuonProgressCallback } from \"../common/progress.js\";\nimport {\n assertMuonNodeProjectAssetSourceIsSafe,\n assertMuonNodeProjectStagingIsSafe,\n createPackagedMuonNodeConfig,\n createMuonNodeRuntimeRequirement,\n resolveMuonNodeProject,\n stageMuonNodeHostArtifacts,\n stageMuonNodeProject,\n type MuonNodeRuntimeRequirement,\n type ResolvedMuonNodeProject,\n} from \"./node-project.js\";\n\nimport type {\n InternalMuonBuildOptions,\n MuonBuildOptions,\n MuonBuildAssetResult,\n MuonDesktopBuildTargetResult,\n MuonBuildResult,\n} from \"../common/build-types.js\";\nimport {\n JsonObject,\n AssetInput,\n BuildConfig,\n resolvePackageDirectory,\n resolveBuildTargets,\n resolveAssetInput,\n readPackageJson,\n resolveAppName,\n resolveAppId,\n readBuildConfig,\n isJsonObject,\n} from \"../common/build-config.js\";\nglobalThis.__screwUpIsInCJS_f5db989a94d0 = false;\nfunction __resolveDefaultExport<T>(module: T | { default?: T }, isESM: boolean): T {\n const __isInCJS =\n typeof globalThis !== 'undefined' &&\n (globalThis as any).__screwUpIsInCJS_f5db989a94d0 === true;\n const maybe = module as { default?: T };\n const hasDefault = !!(maybe && typeof maybe === 'object' && 'default' in maybe);\n const unwrapNamespaceDefault = (value: unknown): unknown => {\n if (!value || typeof value !== 'object') {\n return value;\n }\n const inner = value as any;\n const isModule =\n inner.__esModule === true ||\n (typeof Symbol !== 'undefined' &&\n (inner as any)[Symbol.toStringTag] === 'Module');\n if (isModule && 'default' in inner) {\n return inner.default;\n }\n return value;\n };\n const resolvedDefault = hasDefault\n ? unwrapNamespaceDefault((maybe as any).default)\n : undefined;\n\n if (__isInCJS) {\n return hasDefault ? ((resolvedDefault as T) ?? (module as T)) : (module as T);\n }\n\n if (isESM) {\n if (hasDefault) {\n return resolvedDefault as T;\n }\n throw new Error('Default export not found.');\n }\n\n return hasDefault ? ((resolvedDefault as T) ?? (module as T)) : (module as T);\n}\n\nconst appConfigSourcePath = \"./assets.zip\";\n\nconst muonLicenseFileName = \"CREDITS.md\";\n\nconst directoryMode = 0o755;\n\nconst executableMode = 0o755;\n\nconst assetSaltByteLength = 16;\n\ntype ZipEntry = {\n name: string;\n data: Buffer;\n};\n\ntype DistributionFile = {\n sourcePath: string;\n fileName: string;\n};\n\n/**\n * Builds CEF-free muon app distribution directories for one or more targets.\n */\nexport const buildDesktopMuonApp = async (\n options: MuonBuildOptions = {},\n): Promise<\n Omit<MuonBuildResult, \"targets\"> & { targets: MuonDesktopBuildTargetResult[] }\n> => {\n const internalOptions = options as InternalMuonBuildOptions;\n const browserProfilePathOverride = internalOptions.browserProfilePathOverride;\n const environment = internalOptions.environment ?? process.env;\n const progress = internalOptions.progress;\n const root = resolve(options.root ?? process.cwd());\n const packageDirectory = resolvePackageDirectory(options.packageDirectory);\n const targets = resolveBuildTargets(options).map((target) => {\n if (target === \"android\")\n throw new Error(\"Android is not a desktop target.\");\n return target;\n });\n const outputRoot = resolve(root, options.outputRoot ?? \".\");\n const packageJson = await readPackageJson(root);\n const appName = resolveAppName(packageJson, options.appName);\n const appId = resolveAppId(packageJson, options.appId);\n const buildConfig = await readBuildConfig(root, options.configPath);\n const sourcePluginConfig = buildConfig.config.plugin;\n const hasNativeReferences =\n isJsonObject(sourcePluginConfig) &&\n Array.isArray(sourcePluginConfig.plugins) &&\n sourcePluginConfig.plugins.some(\n (entry) => isJsonObject(entry) && entry.native !== undefined,\n );\n const nativeAccess =\n internalOptions.nativePluginAccess ??\n (hasNativeReferences\n ? await resolveMuonPluginAccessOptions({\n root,\n configPath: options.configPath,\n pluginAccess: { mode: options.runtimePluginConfig?.mode ?? \"simple\" },\n })\n : undefined);\n const nativeArtifacts =\n nativeAccess === undefined\n ? new Map()\n : (nativeAccess.nativeArtifacts ??\n (await resolveMuonNativePlugins({\n root,\n directory: nativeAccess.nativeDirectory ?? buildConfig.directory,\n plugins: nativeAccess.plugins,\n targets,\n environment,\n })));\n const nodeProject = await resolveMuonNodeProject(\n buildConfig.config,\n buildConfig.directory,\n );\n const runtimePluginConfig = options.runtimePluginConfig ?? {\n mode: \"simple\",\n };\n const nodeRuntimeRequirement = createMuonNodeRuntimeRequirement(\n nodeProject,\n true,\n );\n for (const target of targets) {\n await assertMuonNodeProjectStagingIsSafe(\n nodeProject,\n join(\n outputRoot,\n getMuonTargetDescriptor(target).distributionDirectoryName,\n ),\n );\n }\n const { android: _androidBuildConfig, ...desktopConfig } = buildConfig.config;\n const sourceConfig = createPackagedMuonNodeConfig(\n applyRuntimePluginConfig(desktopConfig, runtimePluginConfig),\n nodeProject,\n );\n if (nativeArtifacts.size > 0) {\n const plugin = sourceConfig.plugin as JsonObject;\n plugin.path = \"./plugins\";\n if (Array.isArray(plugin.plugins))\n plugin.plugins = plugin.plugins.map((entry: JsonObject) => {\n const { native: _native, ...runtime } = entry;\n return runtime;\n });\n }\n assertNoUserInitialTitleBarIcon(sourceConfig);\n assertNoUserNodeRuntime(sourceConfig);\n const resolvedBuildConfig: BuildConfig = {\n ...buildConfig,\n config: sourceConfig,\n };\n const assetInput = resolveAssetInput(\n root,\n options.assetSourcePath,\n options.assetPrefix,\n resolvedBuildConfig,\n );\n await assertMuonNodeProjectAssetSourceIsSafe(\n nodeProject,\n assetInput.sourcePath,\n );\n const windowsResource = await resolveMuonWindowsResource({\n root,\n packageDirectory,\n packageJson,\n muonConfig: sourceConfig,\n muonConfigDirectory: buildConfig.directory,\n options: options.windowsResource,\n appIconPath: options.iconPath,\n defaults: {\n productName: appName,\n fileDescription: appName,\n companyName: \"Unknown\",\n version: \"0.0.0\",\n copyright: undefined,\n },\n });\n const windowsCodeSigning = resolveMuonWindowsCodeSigning({\n muonConfig: sourceConfig,\n options: options.windowsCodeSigning,\n });\n const linuxDesktop = await resolveMuonLinuxDesktop({\n root,\n packageDirectory,\n muonConfig: sourceConfig,\n muonConfigDirectory: buildConfig.directory,\n options: options.linuxDesktop,\n appIconPath: options.iconPath,\n defaults: {\n desktopId: appId,\n name: resolveLinuxDesktopDefaultName(packageJson, appName),\n comment: resolvePackageDescription(packageJson),\n categories: [\"Utility\"],\n startupNotify: true,\n },\n });\n const salt = Buffer.from(\n options.assetSalt ?? randomBytes(assetSaltByteLength),\n );\n const distributionFiles = await resolveDistributionFiles({\n root,\n packageJson,\n configuredFiles: options.distributionFiles,\n assetSourcePath: assetInput.sourcePath,\n outputPaths: targets.map((target) =>\n join(\n outputRoot,\n getMuonTargetDescriptor(target).distributionDirectoryName,\n ),\n ),\n });\n\n const results: MuonDesktopBuildTargetResult[] = [];\n\n for (let index = 0; index < targets.length; index += 1) {\n const target = targets[index] as MuonDesktopTarget;\n progress?.({\n phase: \"build\",\n status: `Building muon target ${target} (${index + 1}/${targets.length})`,\n });\n const result = await buildMuonTarget({\n packageDirectory,\n root,\n outputRoot,\n appName,\n appId,\n target,\n assetInput,\n sourceConfig,\n nativeArtifacts,\n windowsResource,\n windowsCodeSigning,\n linuxDesktop,\n distributionFiles,\n nodeProject,\n nodeRuntimeRequirement,\n salt,\n environment,\n browserStartPage: options.browserStartPage,\n browserProfilePathOverride,\n includeRuntimeHelper: options.includeRuntimeHelper === true,\n progress,\n });\n results.push(result);\n progress?.({\n phase: \"build\",\n status: `Built ${result.outputPath}`,\n });\n }\n\n return {\n root,\n appName,\n appId,\n targets: results,\n };\n};\n\nconst readStringArray = (value: unknown, label: string): readonly string[] => {\n if (\n Array.isArray(value) &&\n value.every((entry) => typeof entry === \"string\")\n ) {\n return value;\n }\n throw new Error(`${label} must be an array of strings.`);\n};\n\nconst readDistributionFileCandidates = (\n packageJson: JsonObject,\n configuredFiles: readonly string[] | undefined,\n): readonly string[] => {\n if (configuredFiles !== undefined) {\n return readStringArray(configuredFiles, \"muon distributionFiles\");\n }\n if (packageJson.files === undefined) {\n return [];\n }\n return readStringArray(packageJson.files, \"package.json files\");\n};\n\nconst isSameOrInsidePath = (parentPath: string, path: string): boolean => {\n const relativePath = relative(parentPath, path);\n return (\n relativePath === \"\" ||\n (!relativePath.startsWith(\"..\") && !isAbsolute(relativePath))\n );\n};\n\nconst isExcludedDistributionFilePath = (\n path: string,\n excludedPaths: readonly string[],\n): boolean =>\n excludedPaths.some((excludedPath) => isSameOrInsidePath(excludedPath, path));\n\nconst resolveDistributionFiles = async (input: {\n root: string;\n packageJson: JsonObject;\n configuredFiles: readonly string[] | undefined;\n assetSourcePath: string;\n outputPaths: readonly string[];\n}): Promise<DistributionFile[]> => {\n const candidates = readDistributionFileCandidates(\n input.packageJson,\n input.configuredFiles,\n );\n const excludedPaths = [\n resolve(input.root, \"node_modules\"),\n resolve(input.root, \".git\"),\n input.assetSourcePath,\n ...input.outputPaths,\n ];\n const destinationNames = new Set<string>();\n const files: DistributionFile[] = [];\n\n for (const candidate of candidates) {\n if (candidate.trim() === \"\") {\n throw new Error(\"muon distribution file path must not be empty.\");\n }\n if (isAbsolute(candidate)) {\n throw new Error(\n `muon distribution file path must be relative: ${candidate}`,\n );\n }\n\n const sourcePath = resolve(input.root, candidate);\n if (!isSameOrInsidePath(input.root, sourcePath)) {\n throw new Error(\n `muon distribution file path must stay inside the project root: ${candidate}`,\n );\n }\n if (isExcludedDistributionFilePath(sourcePath, excludedPaths)) {\n continue;\n }\n\n const stats = await statOrUndefined(sourcePath);\n if (stats === undefined) {\n throw new Error(`muon distribution file does not exist: ${candidate}`);\n }\n if (!stats.isFile()) {\n throw new Error(\n `muon distribution file must be a regular file: ${candidate}`,\n );\n }\n\n const fileName = basename(sourcePath);\n if (destinationNames.has(fileName)) {\n throw new Error(\n `Duplicate muon distribution file destination: ${fileName}`,\n );\n }\n destinationNames.add(fileName);\n files.push({ sourcePath, fileName });\n }\n\n return files;\n};\n\nconst resolveLinuxDesktopDefaultName = (\n packageJson: JsonObject,\n appName: string,\n): string =>\n typeof packageJson.name === \"string\" && packageJson.name.trim() !== \"\"\n ? packageJson.name.trim()\n : appName;\n\nconst resolvePackageDescription = (packageJson: JsonObject): string =>\n typeof packageJson.description === \"string\"\n ? packageJson.description.trim()\n : \"\";\n\n/**\n * Resolves the Node project selected by a build-oriented muon configuration.\n *\n * @param root Project root used to locate a default or relative config path.\n * @param configPath Explicit muon config path, or `undefined` to use the\n * default config lookup.\n * @returns The resolved Node project, or `undefined` when Node hosting is not\n * enabled.\n */\nexport const resolveMuonNodeProjectForBuildConfig = async (\n root: string,\n configPath: string | undefined,\n): Promise<ResolvedMuonNodeProject | undefined> => {\n const buildConfig = await readBuildConfig(root, configPath);\n return await resolveMuonNodeProject(\n buildConfig.config,\n buildConfig.directory,\n );\n};\n\nconst applyRuntimePluginConfig = (\n sourceConfig: JsonObject,\n runtimePluginConfig: MuonRuntimePluginConfig | undefined,\n): JsonObject => {\n if (runtimePluginConfig === undefined) {\n return sourceConfig;\n }\n\n const sourcePlugin = sourceConfig.plugin;\n if (sourcePlugin !== undefined && !isJsonObject(sourcePlugin)) {\n throw new Error(\n \"muon.json plugin must be an object when runtime plugin config is applied.\",\n );\n }\n const plugin: JsonObject = sourcePlugin ?? {};\n\n return {\n ...sourceConfig,\n plugin: {\n ...plugin,\n ...runtimePluginConfig,\n },\n };\n};\n\nconst buildMuonTarget = async (input: {\n packageDirectory: string;\n root: string;\n outputRoot: string;\n appName: string;\n appId: string;\n target: MuonDesktopTarget;\n assetInput: AssetInput;\n sourceConfig: JsonObject;\n nativeArtifacts: ReadonlyMap<\n string,\n import(\"muon-plugin-sdk/artifact\").ResolvedPluginArtifact\n >;\n windowsResource: ResolvedMuonWindowsResource;\n windowsCodeSigning: ResolvedMuonWindowsCodeSigning | undefined;\n linuxDesktop: ResolvedMuonLinuxDesktop;\n distributionFiles: readonly DistributionFile[];\n nodeProject: ResolvedMuonNodeProject | undefined;\n nodeRuntimeRequirement: MuonNodeRuntimeRequirement | undefined;\n salt: Buffer;\n environment: NodeJS.ProcessEnv;\n browserStartPage: string | undefined;\n browserProfilePathOverride: string | undefined;\n includeRuntimeHelper: boolean;\n progress: MuonProgressCallback | undefined;\n}): Promise<MuonDesktopBuildTargetResult> => {\n const descriptor = getMuonTargetDescriptor(input.target);\n const sourceRuntimePath = join(\n input.packageDirectory,\n \"runtime\",\n input.target,\n );\n const sourceLauncherPath = join(\n input.packageDirectory,\n \"native\",\n input.target,\n descriptor.launcherExecutableName,\n );\n const sourceRuntimeHelperPath =\n input.includeRuntimeHelper &&\n descriptor.runtimeHelperExecutableName !== undefined\n ? join(\n input.packageDirectory,\n \"native\",\n input.target,\n descriptor.runtimeHelperExecutableName,\n )\n : undefined;\n const outputPath = join(\n input.outputRoot,\n descriptor.distributionDirectoryName,\n );\n const launcherPath = join(\n outputPath,\n getLauncherFileName(input.appName, descriptor),\n );\n const runtimeHelperPath =\n sourceRuntimeHelperPath === undefined ||\n descriptor.runtimeHelperExecutableName === undefined\n ? undefined\n : join(outputPath, descriptor.runtimeHelperExecutableName);\n const assetZipPath = join(outputPath, \"assets.zip\");\n const runtimeAppId = getMuonTargetRuntimeAppId(input.appId, input.target);\n const appIconPath =\n descriptor.os === \"windows\"\n ? input.windowsResource.iconPath\n : input.linuxDesktop.iconPath;\n\n await verifyTargetInputs({\n sourceRuntimePath,\n sourceLauncherPath,\n sourceRuntimeHelperPath,\n descriptor,\n target: input.target,\n });\n\n await rm(outputPath, { recursive: true, force: true });\n await mkdir(outputPath, { recursive: true, mode: directoryMode });\n await copyRuntimeFiles(sourceRuntimePath, outputPath, descriptor);\n for (const executableName of [\n descriptor.runtimeExecutableName,\n ...descriptor.runtimeAuxiliaryExecutableNames,\n ]) {\n await chmod(join(outputPath, executableName), executableMode);\n }\n await copyFile(sourceLauncherPath, launcherPath);\n await chmod(launcherPath, executableMode);\n if (\n sourceRuntimeHelperPath !== undefined &&\n runtimeHelperPath !== undefined\n ) {\n await copyFile(sourceRuntimeHelperPath, runtimeHelperPath);\n await chmod(runtimeHelperPath, executableMode);\n }\n if (input.nodeProject !== undefined) {\n await stageMuonNodeHostArtifacts(\n sourceRuntimePath,\n outputPath,\n descriptor.os,\n );\n await stageMuonNodeProject(input.nodeProject, outputPath);\n }\n await copyDistributionFiles(input.distributionFiles, outputPath);\n if (input.nativeArtifacts.size > 0)\n await stageMuonNativePlugins(\n input.nativeArtifacts,\n input.target,\n join(outputPath, \"plugins\"),\n );\n\n input.progress?.({\n phase: \"build\",\n status: \"Creating assets.zip\",\n });\n const asset = await writeAssetArchive(\n input.assetInput,\n assetZipPath,\n input.salt,\n [{ name: appIconAssetEntryName, data: await readFile(appIconPath) }],\n );\n const embeddedConfig = createEmbeddedConfig(\n input.nativeArtifacts.size === 0\n ? input.sourceConfig\n : {\n ...input.sourceConfig,\n plugin: applyMuonNativePluginCatalogs(\n input.sourceConfig.plugin as unknown as MuonRuntimePluginConfig,\n input.nativeArtifacts,\n input.target,\n \"./plugins\",\n ),\n },\n asset,\n runtimeAppId,\n input.linuxDesktop.desktopId,\n appIconAssetUrl,\n input.browserStartPage,\n input.browserProfilePathOverride,\n );\n const launcherEmbeddedConfig = createLauncherEmbeddedConfig(\n embeddedConfig,\n input.nodeRuntimeRequirement,\n );\n\n input.progress?.({\n phase: \"build\",\n status: \"Embedding config\",\n });\n await withTemporaryConfig(embeddedConfig, async (configPath) => {\n await embedMuonConfigInRuntime({\n runtimePath: outputPath,\n configPath,\n outputRuntimePath: undefined,\n });\n });\n await withTemporaryConfig(launcherEmbeddedConfig, async (configPath) => {\n await embedMuonConfigInLauncherFile({\n launcherPath: launcherPath,\n configPath,\n outputPath: undefined,\n });\n if (runtimeHelperPath !== undefined) {\n await embedMuonConfigInLauncherFile({\n launcherPath: runtimeHelperPath,\n configPath,\n outputPath: undefined,\n });\n }\n });\n\n if (descriptor.os === \"windows\") {\n input.progress?.({\n phase: \"build\",\n status: \"Updating Windows resources\",\n });\n await updateWindowsPeIconResource({\n executablePath: join(outputPath, descriptor.runtimeExecutableName),\n resource: input.windowsResource,\n environment: input.environment,\n cwd: input.root,\n });\n await updateWindowsPeResources({\n executablePath: launcherPath,\n resource: input.windowsResource,\n environment: input.environment,\n cwd: input.root,\n });\n if (input.windowsCodeSigning !== undefined) {\n input.progress?.({\n phase: \"build\",\n status: \"Signing Windows executables\",\n });\n }\n await signWindowsExecutable({\n codeSigning: input.windowsCodeSigning,\n kind: \"runtime\",\n target: input.target,\n path: join(outputPath, descriptor.runtimeExecutableName),\n cwd: input.root,\n environment: input.environment,\n });\n await signWindowsExecutable({\n codeSigning: input.windowsCodeSigning,\n kind: \"launcher\",\n target: input.target,\n path: launcherPath,\n cwd: input.root,\n environment: input.environment,\n });\n } else if (descriptor.os === \"linux\") {\n input.progress?.({\n phase: \"build\",\n status: \"Writing Linux desktop files\",\n });\n await writeLinuxDesktopDistributionFiles(outputPath, input.linuxDesktop);\n }\n\n return {\n target: input.target,\n distributionDirectoryName: descriptor.distributionDirectoryName,\n outputPath,\n launcherPath,\n ...(runtimeHelperPath === undefined ? {} : { runtimeHelperPath }),\n asset,\n runtimeAppId,\n embeddedConfig,\n ...(descriptor.os === \"linux\" ? { linuxDesktop: input.linuxDesktop } : {}),\n };\n};\n\nconst verifyTargetInputs = async (input: {\n sourceRuntimePath: string;\n sourceLauncherPath: string;\n sourceRuntimeHelperPath: string | undefined;\n descriptor: MuonTargetDescriptor;\n target: MuonDesktopTarget;\n}): Promise<void> => {\n await assertDirectory(\n input.sourceRuntimePath,\n `muon runtime for ${input.target}`,\n );\n await assertFile(\n input.sourceLauncherPath,\n `muon launcher for ${input.target}`,\n );\n if (input.sourceRuntimeHelperPath !== undefined) {\n await assertFile(\n input.sourceRuntimeHelperPath,\n `muon runtime helper for ${input.target}`,\n );\n }\n for (const fileName of input.descriptor.runtimeFiles) {\n await assertFile(\n join(input.sourceRuntimePath, fileName),\n `muon runtime file ${fileName} for ${input.target}`,\n );\n }\n await assertFile(\n join(input.sourceRuntimePath, muonLicenseFileName),\n `muon license file for ${input.target}`,\n );\n};\n\nconst getLauncherFileName = (\n appName: string,\n descriptor: MuonTargetDescriptor,\n): string => {\n if (\n descriptor.launcherExtension.length > 0 &&\n !appName.endsWith(descriptor.launcherExtension)\n ) {\n return `${appName}${descriptor.launcherExtension}`;\n }\n\n return appName;\n};\n\nconst copyRuntimeFiles = async (\n sourceRuntimePath: string,\n outputPath: string,\n descriptor: MuonTargetDescriptor,\n): Promise<void> => {\n for (const fileName of descriptor.runtimeFiles) {\n await copyFile(\n join(sourceRuntimePath, fileName),\n join(outputPath, fileName),\n );\n }\n if (descriptor.optionalRuntimeFilePatterns !== undefined) {\n const fileNames = await readdir(sourceRuntimePath);\n for (const fileName of fileNames) {\n if (\n descriptor.optionalRuntimeFilePatterns.some((pattern) =>\n pattern.test(fileName),\n )\n ) {\n await copyFile(\n join(sourceRuntimePath, fileName),\n join(outputPath, fileName),\n );\n }\n }\n }\n await copyFile(\n join(sourceRuntimePath, muonLicenseFileName),\n join(outputPath, muonLicenseFileName),\n );\n};\n\nconst copyDistributionFiles = async (\n files: readonly DistributionFile[],\n outputPath: string,\n): Promise<void> => {\n for (const file of files) {\n const destinationPath = join(outputPath, file.fileName);\n if ((await statOrUndefined(destinationPath)) !== undefined) {\n throw new Error(\n `muon distribution file destination already exists: ${file.fileName}`,\n );\n }\n await copyFile(file.sourcePath, destinationPath);\n }\n};\n\nconst writeAssetArchive = async (\n input: AssetInput,\n outputPath: string,\n salt: Buffer,\n extraEntries: readonly ZipEntry[],\n): Promise<MuonBuildAssetResult> => {\n const sourceStats = await statOrUndefined(input.sourcePath);\n if (sourceStats === undefined) {\n throw new Error(`muon asset source does not exist: ${input.sourcePath}`);\n }\n\n const archive = sourceStats.isDirectory()\n ? await createAssetArchiveFromDirectory(input, extraEntries)\n : sourceStats.isFile()\n ? await createAssetArchiveFromZipFile(input.sourcePath, extraEntries)\n : undefined;\n if (archive === undefined) {\n throw new Error(\n `muon asset source is not a directory or file: ${input.sourcePath}`,\n );\n }\n await writeFile(outputPath, archive);\n\n const signature = createHash(\"sha256\")\n .update(archive)\n .update(salt)\n .digest(\"hex\");\n return {\n path: outputPath,\n signature,\n salt: salt.toString(\"hex\"),\n entryCount: sourceStats.isDirectory()\n ? readZipEntryCount(archive, outputPath)\n : readZipEntryCount(archive, input.sourcePath),\n };\n};\n\nconst createAssetArchiveFromDirectory = async (\n input: AssetInput,\n extraEntries: readonly ZipEntry[],\n): Promise<Buffer> => {\n const entries = await collectZipEntries(input.sourcePath, input.prefix);\n if (entries.length === 0) {\n throw new Error(`muon asset source has no files: ${input.sourcePath}`);\n }\n\n return createZipArchive(appendZipEntries(entries, extraEntries));\n};\n\nconst createAssetArchiveFromZipFile = async (\n sourcePath: string,\n extraEntries: readonly ZipEntry[],\n): Promise<Buffer> => {\n const zip = new AdmZip(await readFile(sourcePath));\n for (const entry of extraEntries) {\n assertSafeZipEntryName(entry.name);\n if (zip.getEntry(entry.name) !== null) {\n throw new Error(\n `muon app icon asset entry already exists: ${entry.name}`,\n );\n }\n zip.addFile(entry.name, entry.data);\n }\n return zip.toBuffer();\n};\n\nconst appendZipEntries = (\n entries: readonly ZipEntry[],\n extraEntries: readonly ZipEntry[],\n): ZipEntry[] => {\n const output = [...entries];\n const names = new Set(entries.map((entry) => entry.name));\n for (const entry of extraEntries) {\n assertSafeZipEntryName(entry.name);\n if (names.has(entry.name)) {\n throw new Error(\n `muon app icon asset entry already exists: ${entry.name}`,\n );\n }\n names.add(entry.name);\n output.push(entry);\n }\n return output;\n};\n\nconst readZipEntryCount = (archive: Buffer, sourcePath: string): number => {\n const endSignature = 0x06054b50;\n const lastPossibleOffset = archive.length - 22;\n const firstPossibleOffset = Math.max(0, lastPossibleOffset - 0xffff);\n\n for (\n let offset = lastPossibleOffset;\n offset >= firstPossibleOffset;\n offset -= 1\n ) {\n if (archive.readUInt32LE(offset) === endSignature) {\n return archive.readUInt16LE(offset + 10);\n }\n }\n\n throw new Error(`muon asset ZIP could not be read: ${sourcePath}`);\n};\n\nconst collectZipEntries = async (\n sourcePath: string,\n prefix: string,\n): Promise<ZipEntry[]> => {\n const entries: ZipEntry[] = [];\n\n const walk = async (directoryPath: string): Promise<void> => {\n const dirents = await readdir(directoryPath, { withFileTypes: true });\n dirents.sort((a, b) => a.name.localeCompare(b.name));\n\n for (const dirent of dirents) {\n const childPath = join(directoryPath, dirent.name);\n if (dirent.isDirectory()) {\n await walk(childPath);\n } else if (dirent.isFile()) {\n const relativePath = relative(sourcePath, childPath)\n .split(sep)\n .join(\"/\");\n const name = `${prefix}${relativePath}`;\n assertSafeZipEntryName(name);\n entries.push({\n name,\n data: await readFile(childPath),\n });\n }\n }\n };\n\n await walk(sourcePath);\n return entries;\n};\n\nconst assertSafeZipEntryName = (name: string): void => {\n if (\n name.length === 0 ||\n name.startsWith(\"/\") ||\n name.includes(\"..\") ||\n name.includes(\"\\\\\")\n ) {\n throw new Error(`Unsafe ZIP entry name: ${name}`);\n }\n};\n\nconst createZipArchive = (entries: readonly ZipEntry[]): Buffer => {\n const zip = new AdmZip();\n for (const entry of entries) {\n zip.addFile(entry.name, entry.data);\n }\n\n return zip.toBuffer();\n};\n\nconst createEmbeddedConfig = (\n sourceConfig: JsonObject,\n asset: MuonBuildAssetResult,\n appId: string,\n desktopId: string,\n initialTitleBarIcon: string,\n browserStartPage: string | undefined,\n browserProfilePathOverride: string | undefined,\n): JsonObject => {\n const sourceAsset = sourceConfig.asset;\n if (sourceAsset !== undefined && !isJsonObject(sourceAsset)) {\n throw new Error(\"muon.json asset must be an object when present.\");\n }\n const sourceLauncher = sourceConfig.launcher;\n if (sourceLauncher !== undefined && !isJsonObject(sourceLauncher)) {\n throw new Error(\"muon.json launcher must be an object when present.\");\n }\n\n const runtimeConfig = stripBuildOnlyAppIconConfig(\n stripBuildOnlyLinuxDesktopConfig(\n stripBuildOnlyWindowsCodeSigningConfig(\n stripBuildOnlyWindowsResourceConfig(sourceConfig),\n ),\n ),\n );\n const sourceBrowser = runtimeConfig.browser;\n if (sourceBrowser !== undefined && !isJsonObject(sourceBrowser)) {\n throw new Error(\"muon.json browser must be an object when present.\");\n }\n\n const browserConfig: JsonObject = {\n ...(sourceBrowser ?? {}),\n initialTitleBarIcon,\n };\n if (browserStartPage !== undefined && browserConfig.startPage === undefined) {\n browserConfig.startPage = browserStartPage;\n }\n if (browserProfilePathOverride !== undefined) {\n browserConfig.profilePath = browserProfilePathOverride;\n }\n\n return {\n ...runtimeConfig,\n browser: browserConfig,\n asset: {\n ...(sourceAsset ?? {}),\n sourcePath: appConfigSourcePath,\n signature: asset.signature,\n salt: asset.salt,\n },\n launcher: {\n ...(sourceLauncher ?? {}),\n appId,\n desktopId,\n },\n };\n};\n\nconst createLauncherEmbeddedConfig = (\n embeddedConfig: JsonObject,\n nodeRuntimeRequirement: MuonNodeRuntimeRequirement | undefined,\n): JsonObject => {\n if (nodeRuntimeRequirement === undefined) {\n return embeddedConfig;\n }\n const launcher = embeddedConfig.launcher;\n if (!isJsonObject(launcher)) {\n throw new Error(\"generated muon launcher config must be an object\");\n }\n return {\n ...embeddedConfig,\n launcher: {\n ...launcher,\n nodeRuntime: nodeRuntimeRequirement,\n },\n };\n};\n\nconst assertNoUserInitialTitleBarIcon = (sourceConfig: JsonObject): void => {\n const sourceBrowser = sourceConfig.browser;\n if (sourceBrowser === undefined) {\n return;\n }\n if (!isJsonObject(sourceBrowser)) {\n throw new Error(\"muon.json browser must be an object when present.\");\n }\n if (sourceBrowser.initialTitleBarIcon !== undefined) {\n throw new Error(\n \"muon.json browser.initialTitleBarIcon is generated by muon build; use top-level iconPath instead.\",\n );\n }\n};\n\nconst assertNoUserNodeRuntime = (sourceConfig: JsonObject): void => {\n const sourceLauncher = sourceConfig.launcher;\n if (sourceLauncher === undefined) {\n return;\n }\n if (!isJsonObject(sourceLauncher)) {\n throw new Error(\"muon.json launcher must be an object when present.\");\n }\n if (sourceLauncher.nodeRuntime !== undefined) {\n throw new Error(\n \"muon.json launcher.nodeRuntime is generated by muon build.\",\n );\n }\n};\n\nconst stripBuildOnlyAppIconConfig = (sourceConfig: JsonObject): JsonObject => {\n const output: JsonObject = {};\n for (const [key, value] of Object.entries(sourceConfig)) {\n if (key !== \"iconPath\") {\n output[key] = value;\n }\n }\n return output;\n};\n\nconst withTemporaryConfig = async (\n config: JsonObject,\n callback: (configPath: string) => Promise<void>,\n): Promise<void> => {\n const tempDirectory = await mkdtemp(join(tmpdir(), \"muon-build-config-\"));\n const configPath = join(tempDirectory, \"muon.json\");\n try {\n await writeFile(configPath, `${JSON.stringify(config, undefined, 2)}\\n`);\n await callback(configPath);\n } finally {\n await rm(tempDirectory, { recursive: true, force: true });\n }\n};\n\nconst assertDirectory = async (path: string, label: string): Promise<void> => {\n const stats = await statOrUndefined(path);\n if (stats === undefined || !stats.isDirectory()) {\n throw new Error(`${label} directory does not exist: ${path}`);\n }\n};\n\nconst assertFile = async (path: string, label: string): Promise<void> => {\n const stats = await statOrUndefined(path);\n if (stats === undefined || !stats.isFile()) {\n throw new Error(`${label} file does not exist: ${path}`);\n }\n};\n\nconst statOrUndefined = async (path: string): Promise<Stats | undefined> => {\n try {\n return await stat(path);\n } catch {\n return undefined;\n }\n};\n","// muon - Multi-platform GUI application framework that uses CEF as its backend\n// Copyright (c) Kouji Matsui. (@kekyo@mi.kekyo.net)\n// Under MIT.\n// https://github.com/kekyo/muon-ui\n\nimport {\n buildMuonAndroidTarget,\n prepareMuonAndroidTarget,\n} from \"../android/target.js\";\n\nimport { resolve } from \"node:path\";\n\nimport { type MuonDesktopTarget } from \"./targets.js\";\n\nimport type {\n InternalMuonBuildOptions,\n MuonBuildOptions,\n MuonDesktopBuildTargetResult,\n MuonBuildResult,\n} from \"./build-types.js\";\nimport {\n resolvePackageDirectory,\n resolveBuildTargets,\n resolveAssetInput,\n readPackageJson,\n resolveAppName,\n readBuildConfig,\n} from \"./build-config.js\";\nimport { buildDesktopMuonApp } from \"../cef/build.js\";\nexport type * from \"./build-types.js\";\nexport {\n getDefaultMuonBuildTarget,\n normalizeMuonBuildTarget,\n} from \"./build-config.js\";\nexport { resolveMuonNodeProjectForBuildConfig } from \"../cef/build.js\";\n\n/**\n * Builds the explicitly selected desktop and/or Android applications.\n * @param options - Project, assets, selected targets and platform configuration.\n * @returns Per-target results discriminated by target.\n */\nexport function buildMuonApp(\n options: Omit<MuonBuildOptions, \"targets\"> & {\n targets?: readonly MuonDesktopTarget[];\n },\n): Promise<\n Omit<MuonBuildResult, \"targets\"> & { targets: MuonDesktopBuildTargetResult[] }\n>;\n\nexport function buildMuonApp(\n options?: MuonBuildOptions,\n): Promise<MuonBuildResult>;\n\nexport async function buildMuonApp(\n options: MuonBuildOptions = {},\n): Promise<MuonBuildResult> {\n const targets = resolveBuildTargets(options);\n if (!targets.includes(\"android\")) return await buildDesktopMuonApp(options);\n const root = resolve(options.root ?? process.cwd());\n const packageJson = await readPackageJson(root);\n const buildConfig = await readBuildConfig(root, options.configPath);\n const internal = options as InternalMuonBuildOptions;\n const android = await buildMuonAndroidTarget({\n root,\n packageDirectory: resolvePackageDirectory(options.packageDirectory),\n packageJson,\n config: buildConfig.config,\n configDirectory: buildConfig.directory,\n options,\n assets: resolveAssetInput(\n root,\n options.assetSourcePath,\n options.assetPrefix,\n buildConfig,\n ),\n environment: internal.environment ?? process.env,\n progress: internal.progress,\n });\n const desktop = targets.filter((target) => target !== \"android\");\n const result: MuonBuildResult =\n desktop.length === 0\n ? {\n root,\n appName: resolveAppName(packageJson, options.appName),\n appId: android.applicationId,\n targets: [],\n }\n : await buildDesktopMuonApp({\n ...options,\n targets: desktop,\n allTargets: false,\n });\n result.targets.push(android);\n return result;\n}\n\n/**\n * Validates and prepares the installed Android toolchain for a project.\n * @param options - Project and optional Android SDK override.\n * @returns Validated SDK/JDK paths and the packaged version requirements.\n */\nexport const prepareMuonAndroid = async (options: MuonBuildOptions = {}) => {\n const root = resolve(options.root ?? process.cwd());\n const config = await readBuildConfig(root, options.configPath);\n return await prepareMuonAndroidTarget(\n root,\n resolvePackageDirectory(options.packageDirectory),\n config.config,\n config.directory,\n options.android,\n (options as InternalMuonBuildOptions).environment ?? process.env,\n );\n};\n","// muon - Multi-platform GUI application framework that uses CEF as its backend\n// Copyright (c) Kouji Matsui. (@kekyo@mi.kekyo.net)\n// Under MIT.\n// https://github.com/kekyo/muon-ui\n\nimport { readFile, writeFile } from \"node:fs/promises\";\nimport { join } from \"node:path\";\n\nconst muonGitignoreEntries = [\".muon/\", \"dist-muon/\", \"artifacts/\"] as const;\n\ntype MuonGitignoreEntry = (typeof muonGitignoreEntries)[number];\n\nconst muonGitignoreEntryAliases: Record<MuonGitignoreEntry, readonly string[]> =\n {\n \".muon/\": [\".muon/\", \"/.muon/\", \".muon\", \"/.muon\"],\n \"dist-muon/\": [\n \"dist-muon/\",\n \"/dist-muon/\",\n \"dist-muon\",\n \"/dist-muon\",\n \"dist-muon/*\",\n \"/dist-muon/*\",\n ],\n \"artifacts/\": [\"artifacts/\", \"/artifacts/\", \"artifacts\", \"/artifacts\"],\n };\n\n/**\n * Result of ensuring muon generated directories are ignored by Git.\n */\nexport interface MuonGitignoreResult {\n /**\n * Path of the .gitignore file that was checked or updated.\n */\n gitignorePath: string;\n\n /**\n * True when the file was created or appended.\n */\n changed: boolean;\n}\n\nconst isMissingFileError = (error: unknown): boolean =>\n error instanceof Error && (error as NodeJS.ErrnoException).code === \"ENOENT\";\n\nconst hasMuonGitignoreEntry = (\n content: string,\n entry: MuonGitignoreEntry,\n): boolean =>\n content\n .split(/\\r?\\n/)\n .map((line) => line.trim())\n .some((line) => muonGitignoreEntryAliases[entry].includes(line));\n\n/**\n * Adds muon generated directories to a project .gitignore file.\n *\n * @param root Project root containing the .gitignore file.\n * @returns Gitignore update result.\n */\nexport const ensureMuonGitignoreEntry = async (\n root: string,\n): Promise<MuonGitignoreResult> => {\n const gitignorePath = join(root, \".gitignore\");\n let content = \"\";\n try {\n content = await readFile(gitignorePath, \"utf8\");\n } catch (error) {\n if (!isMissingFileError(error)) {\n throw error;\n }\n }\n\n const missingEntries = muonGitignoreEntries.filter(\n (entry) => !hasMuonGitignoreEntry(content, entry),\n );\n if (missingEntries.length === 0) {\n return {\n gitignorePath,\n changed: false,\n };\n }\n\n const separator = content.length > 0 && !content.endsWith(\"\\n\") ? \"\\n\" : \"\";\n await writeFile(\n gitignorePath,\n `${content}${separator}${missingEntries.join(\"\\n\")}\\n`,\n );\n return {\n gitignorePath,\n changed: true,\n };\n};\n","// muon - Multi-platform GUI application framework that uses CEF as its backend\n// Copyright (c) Kouji Matsui. (@kekyo@mi.kekyo.net)\n// Under MIT.\n// https://github.com/kekyo/muon-ui\n\nimport type { ResolvedConfig } from \"vite\";\n\nimport type { MuonRuntimePluginConfig } from \"./capability.js\";\nimport type { MuonResolvedPluginAccessOptions } from \"./plugin-access.js\";\nimport type { MuonVitePluginOptions } from \"./vite.js\";\nimport { isMuonWindowsCodeSigningOptions } from \"../cef/windows-code-signing.js\";\n\n/**\n * Metadata symbol used to recover `muon()` plugin options from `vite.config.*`.\n */\nexport const muonVitePluginOptionsSymbol = Symbol.for(\n \"muon.vite.plugin.options\",\n);\n\nconst muonVitePluginRuntimeStateSymbol = Symbol.for(\n \"muon.vite.plugin.runtimeState\",\n);\n\ninterface MuonVitePluginWithOptions {\n [muonVitePluginOptionsSymbol]: MuonVitePluginOptions;\n}\n\n/**\n * Internal state exposed by a resolved muon Vite plugin instance.\n */\nexport interface MuonVitePluginRuntimeState {\n /** Returns the native artifacts used by the same bundle and catalog. */\n getNativePluginAccess?: () => MuonResolvedPluginAccessOptions | undefined;\n /**\n * Returns the Vite config resolved for this plugin instance.\n */\n getResolvedConfig: () => ResolvedConfig | undefined;\n\n /**\n * Returns the runtime plugin config generated by this plugin instance.\n */\n getRuntimePluginConfig: () => MuonRuntimePluginConfig | undefined;\n}\n\ninterface MuonVitePluginWithRuntimeState {\n [muonVitePluginRuntimeStateSymbol]: MuonVitePluginRuntimeState;\n}\n\nconst isRecord = (value: unknown): value is Record<string | symbol, unknown> =>\n typeof value === \"object\" && value !== null && !Array.isArray(value);\n\nconst isStringArray = (value: unknown): value is readonly string[] =>\n Array.isArray(value) && value.every((entry) => typeof entry === \"string\");\n\nconst isStringRecord = (value: unknown): value is Record<string, string> =>\n isRecord(value) &&\n Object.entries(value).every(\n ([entryKey, entryValue]) =>\n entryKey.length > 0 &&\n !entryKey.includes(\"\\0\") &&\n typeof entryValue === \"string\" &&\n !entryValue.includes(\"\\0\"),\n );\n\nconst isWindowsResourceOptions = (value: unknown): boolean => {\n if (!isRecord(value)) {\n return false;\n }\n\n return (\n (value.iconPath === undefined || typeof value.iconPath === \"string\") &&\n (value.productName === undefined ||\n typeof value.productName === \"string\") &&\n (value.fileDescription === undefined ||\n typeof value.fileDescription === \"string\") &&\n (value.companyName === undefined ||\n typeof value.companyName === \"string\") &&\n (value.version === undefined || typeof value.version === \"string\") &&\n (value.copyright === undefined || typeof value.copyright === \"string\") &&\n (value.language === undefined ||\n (typeof value.language === \"number\" &&\n Number.isInteger(value.language))) &&\n (value.codePage === undefined ||\n (typeof value.codePage === \"number\" && Number.isInteger(value.codePage)))\n );\n};\n\nconst isLinuxDesktopOptions = (value: unknown): boolean => {\n if (!isRecord(value)) {\n return false;\n }\n\n return (\n (value.desktopId === undefined || typeof value.desktopId === \"string\") &&\n (value.name === undefined || typeof value.name === \"string\") &&\n (value.comment === undefined || typeof value.comment === \"string\") &&\n (value.iconPath === undefined || typeof value.iconPath === \"string\") &&\n (value.categories === undefined || isStringArray(value.categories)) &&\n (value.startupNotify === undefined ||\n typeof value.startupNotify === \"boolean\")\n );\n};\n\nconst isMuonViteBuildOptions = (value: unknown): boolean => {\n if (!isRecord(value)) {\n return false;\n }\n\n return (\n (value.targets === undefined || isStringArray(value.targets)) &&\n (value.allTargets === undefined || typeof value.allTargets === \"boolean\") &&\n (value.appName === undefined || typeof value.appName === \"string\") &&\n (value.appId === undefined || typeof value.appId === \"string\") &&\n (value.outputRoot === undefined || typeof value.outputRoot === \"string\") &&\n (value.configPath === undefined || typeof value.configPath === \"string\") &&\n (value.iconPath === undefined || typeof value.iconPath === \"string\") &&\n (value.distributionFiles === undefined ||\n isStringArray(value.distributionFiles)) &&\n (value.windowsResource === undefined ||\n isWindowsResourceOptions(value.windowsResource)) &&\n (value.windowsCodeSigning === undefined ||\n value.windowsCodeSigning === false ||\n isMuonWindowsCodeSigningOptions(value.windowsCodeSigning)) &&\n (value.linuxDesktop === undefined ||\n isLinuxDesktopOptions(value.linuxDesktop)) &&\n (value.packageDirectory === undefined ||\n typeof value.packageDirectory === \"string\") &&\n (value.assetSalt === undefined || value.assetSalt instanceof Uint8Array)\n );\n};\n\nconst isMuonVitePluginAccessImportOptions = (value: unknown): boolean => {\n if (!isRecord(value)) {\n return false;\n }\n\n return (\n (value.sources === undefined || isStringArray(value.sources)) &&\n (value.packages === undefined || isStringArray(value.packages)) &&\n (value.allow === undefined || isStringArray(value.allow))\n );\n};\n\nconst isMuonVitePluginAccessEntryOptions = (value: unknown): boolean => {\n if (!isRecord(value)) {\n return false;\n }\n\n return (\n typeof value.name === \"string\" &&\n (value.signature === undefined || typeof value.signature === \"string\") &&\n (value.salt === undefined || typeof value.salt === \"string\") &&\n (value.config === undefined || isStringRecord(value.config)) &&\n (value.allow === undefined || isStringArray(value.allow)) &&\n (value.imports === undefined ||\n (Array.isArray(value.imports) &&\n value.imports.every(isMuonVitePluginAccessImportOptions)))\n );\n};\n\nconst isMuonVitePluginAccessOptions = (value: unknown): boolean => {\n if (!isRecord(value)) {\n return false;\n }\n\n return (\n (value.path === undefined || typeof value.path === \"string\") &&\n (value.mode === undefined ||\n value.mode === \"simple\" ||\n value.mode === \"validate\") &&\n (value.pages === undefined || isStringArray(value.pages)) &&\n (value.plugins === undefined ||\n (Array.isArray(value.plugins) &&\n value.plugins.every(isMuonVitePluginAccessEntryOptions)))\n );\n};\n\nconst isMuonViteDevOptions = (value: unknown): boolean =>\n isRecord(value) &&\n (value.config === undefined || isStringRecord(value.config));\n\nconst isMuonVitePluginOptions = (\n value: unknown,\n): value is MuonVitePluginOptions => {\n if (!isRecord(value)) {\n return false;\n }\n\n return (\n (value.muonPath === undefined || typeof value.muonPath === \"string\") &&\n (value.cefPath === undefined || typeof value.cefPath === \"string\") &&\n (value.stagePath === undefined || typeof value.stagePath === \"string\") &&\n (value.open === undefined || typeof value.open === \"boolean\") &&\n (value.enableDebugger === undefined ||\n typeof value.enableDebugger === \"boolean\") &&\n (value.allowInsecureLocalhost === undefined ||\n typeof value.allowInsecureLocalhost === \"boolean\") &&\n (value.exitWithServer === undefined ||\n typeof value.exitWithServer === \"boolean\") &&\n (value.dev === undefined || isMuonViteDevOptions(value.dev)) &&\n (value.pluginAccess === undefined ||\n value.pluginAccess === false ||\n isMuonVitePluginAccessOptions(value.pluginAccess)) &&\n (value.build === undefined ||\n typeof value.build === \"boolean\" ||\n isMuonViteBuildOptions(value.build))\n );\n};\n\n/**\n * Attaches raw muon Vite plugin options to a plugin instance.\n *\n * @param plugin Plugin object.\n * @param options Raw plugin options.\n * @returns Plugin object with internal muon metadata.\n */\nexport const attachMuonVitePluginOptions = <TPlugin extends object>(\n plugin: TPlugin,\n options: MuonVitePluginOptions,\n): TPlugin & MuonVitePluginWithOptions => {\n Object.defineProperty(plugin, muonVitePluginOptionsSymbol, {\n configurable: false,\n enumerable: false,\n value: { ...options },\n writable: false,\n });\n\n return plugin as TPlugin & MuonVitePluginWithOptions;\n};\n\n/**\n * Attaches internal runtime state to a plugin instance.\n *\n * @param plugin Plugin object.\n * @param runtimeState Runtime state accessor.\n * @returns Plugin object with internal muon runtime metadata.\n */\nexport const attachMuonVitePluginRuntimeState = <TPlugin extends object>(\n plugin: TPlugin,\n runtimeState: MuonVitePluginRuntimeState,\n): TPlugin & MuonVitePluginWithRuntimeState => {\n Object.defineProperty(plugin, muonVitePluginRuntimeStateSymbol, {\n configurable: false,\n enumerable: false,\n value: runtimeState,\n writable: false,\n });\n\n return plugin as TPlugin & MuonVitePluginWithRuntimeState;\n};\n\n/**\n * Reads raw muon Vite plugin options from a plugin instance.\n *\n * @param plugin Candidate plugin object.\n * @returns Attached muon options, if present.\n */\nexport const getMuonVitePluginOptions = (\n plugin: unknown,\n): MuonVitePluginOptions | undefined => {\n if (!isRecord(plugin)) {\n return undefined;\n }\n\n const options = plugin[muonVitePluginOptionsSymbol];\n return isMuonVitePluginOptions(options) ? options : undefined;\n};\n\n/**\n * Reads internal runtime state from a muon Vite plugin instance.\n *\n * @param plugin Candidate plugin object.\n * @returns Runtime state accessor, if present.\n */\nexport const getMuonVitePluginRuntimeState = (\n plugin: unknown,\n): MuonVitePluginRuntimeState | undefined => {\n if (!isRecord(plugin)) {\n return undefined;\n }\n\n const runtimeState = plugin[muonVitePluginRuntimeStateSymbol];\n return isRecord(runtimeState) &&\n typeof runtimeState.getResolvedConfig === \"function\" &&\n typeof runtimeState.getRuntimePluginConfig === \"function\"\n ? (runtimeState as unknown as MuonVitePluginRuntimeState)\n : undefined;\n};\n\n/**\n * Resolves nested Vite plugin option values into a flat list.\n *\n * @param pluginOptions Raw `plugins` field from a Vite config.\n * @returns Flat plugin object list.\n */\nexport const flattenVitePluginOptions = async (\n pluginOptions: unknown,\n): Promise<unknown[]> => {\n const resolvedValue = await pluginOptions;\n if (resolvedValue === null || resolvedValue === undefined || !resolvedValue) {\n return [];\n }\n\n if (Array.isArray(resolvedValue)) {\n const nested = await Promise.all(\n resolvedValue.map((entry) => flattenVitePluginOptions(entry)),\n );\n return nested.flat();\n }\n\n return [resolvedValue];\n};\n","// muon - Multi-platform GUI application framework that uses CEF as its backend\n// Copyright (c) Kouji Matsui. (@kekyo@mi.kekyo.net)\n// Under MIT.\n// https://github.com/kekyo/muon-ui\n\n/**\n * Asset layout derived from Vite's resolved base URL for packaged muon apps.\n */\nexport interface MuonVitePackagedAssetOptions {\n /** ZIP entry prefix used for copied Vite build output. */\n assetPrefix: string;\n /** Generated browser start page when Vite base needs a packaged path. */\n browserStartPage: string | undefined;\n}\n\n/**\n * Returns the package-local asset base path represented by a Vite base URL.\n */\nexport const resolveVitePackagedAssetBasePath = (\n base: string,\n): string | undefined => {\n const normalizedBase = base.trim();\n if (\n normalizedBase === \"\" ||\n normalizedBase === \"/\" ||\n normalizedBase === \"./\" ||\n normalizedBase.startsWith(\"//\") ||\n /^[a-zA-Z][a-zA-Z\\d+.-]*:/.test(normalizedBase) ||\n !normalizedBase.startsWith(\"/\")\n ) {\n return undefined;\n }\n\n const normalizedPath = normalizedBase.split(/[?#]/, 1)[0] ?? \"\";\n const segments = normalizedPath\n .split(\"/\")\n .filter((segment) => segment.length > 0);\n return segments.length > 0 ? segments.join(\"/\") : undefined;\n};\n\n/**\n * Creates muon asset options for packaging Vite build output.\n */\nexport const createVitePackagedAssetOptions = (\n base: string,\n): MuonVitePackagedAssetOptions => {\n const packagedAssetBasePath = resolveVitePackagedAssetBasePath(base);\n const assetPrefix =\n packagedAssetBasePath === undefined\n ? \"main\"\n : `main/${packagedAssetBasePath}`;\n return {\n assetPrefix,\n browserStartPage:\n packagedAssetBasePath === undefined\n ? undefined\n : `asset://${assetPrefix}/index.html`,\n };\n};\n","// muon - Multi-platform GUI application framework that uses CEF as its backend\n// Copyright (c) Kouji Matsui. (@kekyo@mi.kekyo.net)\n// Under MIT.\n// https://github.com/kekyo/muon-ui\n\nimport { isAbsolute, resolve } from \"node:path\";\n\nimport type { InlineConfig, ResolvedConfig } from \"vite\";\n\nimport {\n buildMuonApp,\n resolveMuonNodeProjectForBuildConfig,\n type MuonBuildOptions,\n type MuonBuildResult,\n} from \"./build.js\";\nimport {\n flattenVitePluginOptions,\n getMuonVitePluginOptions,\n getMuonVitePluginRuntimeState,\n} from \"./vite-options.js\";\nimport type { MuonViteBuildOptions, MuonVitePluginOptions } from \"./vite.js\";\nimport { createVitePackagedAssetOptions } from \"./vite-assets.js\";\nimport { mergeMuonWindowsResourceOptions } from \"../cef/windows-resource.js\";\nimport { mergeMuonLinuxDesktopOptions } from \"../cef/linux-desktop.js\";\nimport type { MuonProgressCallback } from \"./progress.js\";\nimport { assertMuonNodeProjectViteBuildIsSafe } from \"../cef/node-project.js\";\nimport type { MuonRuntimePluginConfig } from \"./capability.js\";\n\n/**\n * Environment variable used to prevent the Vite plugin build hook from running\n * when a CLI command owns the muon build sequence.\n */\nexport const muonBuildSequenceSuppressViteBuildEnvironmentKey =\n \"MUON_SUPPRESS_VITE_MUON_BUILD\";\n\n/** CLI target override shared with the Vite config loaded in this sequence. */\nexport const muonBuildSequenceTargetsEnvironmentKey = \"MUON_VITE_BUILD_TARGETS\";\n\n/**\n * Resolved project metadata used by the CLI build sequence.\n */\nexport interface MuonBuildSequenceProject {\n /** Project root used for muon config and package metadata. */\n root: string;\n /** Root passed to Vite when the sequence must run `vite build`. */\n viteBuildRoot: string;\n /** Vite base URL used by the resolved Vite build. */\n viteBase: string | undefined;\n /** Absolute Vite output directory used as muon app assets. */\n viteOutputDirectory: string | undefined;\n /** Absolute Vite public directory copied into output, when enabled. */\n vitePublicDirectory: string | undefined;\n /** muon Vite plugin options if the project config contains the plugin. */\n pluginOptions: MuonVitePluginOptions | undefined;\n /** Whether the resolved Vite config contains server proxy entries. */\n viteServerProxyConfigured: boolean;\n}\n\n/**\n * Options for running the CLI-oriented muon build sequence.\n */\nexport interface MuonBuildSequenceOptions extends MuonBuildOptions {\n /** Target default used only when no muon Vite plugin defines build options. */\n defaultAllTargets?: boolean;\n}\n\ninterface InternalMuonBuildSequenceOptions extends MuonBuildSequenceOptions {\n environment?: NodeJS.ProcessEnv;\n progress?: MuonProgressCallback;\n}\n\ninterface InternalMuonBuildOptions extends MuonBuildOptions {\n nativePluginAccess?: import(\"./plugin-access.js\").MuonResolvedPluginAccessOptions;\n environment?: NodeJS.ProcessEnv;\n progress?: MuonProgressCallback;\n}\n\nconst isMissingVitePackageError = (error: unknown): boolean => {\n const candidate = error as { code?: unknown; message?: unknown };\n return (\n candidate.code === \"ERR_MODULE_NOT_FOUND\" &&\n typeof candidate.message === \"string\" &&\n candidate.message.includes(\"vite\")\n );\n};\n\nconst resolveViteOutputDirectory = (config: ResolvedConfig): string => {\n return isAbsolute(config.build.outDir)\n ? config.build.outDir\n : resolve(config.root, config.build.outDir);\n};\n\nconst hasViteServerProxyConfiguration = (proxy: unknown): boolean =>\n typeof proxy === \"object\" && proxy !== null && Object.keys(proxy).length > 0;\n\nconst withSuppressedMuonViteBuild = async <T>(\n targets: readonly string[] | undefined,\n action: () => Promise<T>,\n): Promise<T> => {\n const previous =\n process.env[muonBuildSequenceSuppressViteBuildEnvironmentKey];\n process.env[muonBuildSequenceSuppressViteBuildEnvironmentKey] = \"1\";\n const previousTargets = process.env[muonBuildSequenceTargetsEnvironmentKey];\n if (targets !== undefined) {\n process.env[muonBuildSequenceTargetsEnvironmentKey] =\n JSON.stringify(targets);\n }\n try {\n return await action();\n } finally {\n if (previousTargets === undefined) {\n delete process.env[muonBuildSequenceTargetsEnvironmentKey];\n } else {\n process.env[muonBuildSequenceTargetsEnvironmentKey] = previousTargets;\n }\n if (previous === undefined) {\n delete process.env[muonBuildSequenceSuppressViteBuildEnvironmentKey];\n } else {\n process.env[muonBuildSequenceSuppressViteBuildEnvironmentKey] = previous;\n }\n }\n};\n\nconst findMuonVitePluginOptions = async (\n plugins: unknown,\n): Promise<MuonVitePluginOptions | undefined> => {\n const flattenedPlugins = await flattenVitePluginOptions(plugins);\n const muonPlugins = flattenedPlugins\n .map((plugin) => getMuonVitePluginOptions(plugin))\n .filter(\n (pluginOptions): pluginOptions is MuonVitePluginOptions =>\n pluginOptions !== undefined,\n );\n\n if (muonPlugins.length > 1) {\n throw new Error(\n \"Multiple muon() plugin definitions were found in vite.config.*.\",\n );\n }\n\n return muonPlugins[0];\n};\n\n/**\n * Loads Vite configuration only far enough to discover whether a muon plugin\n * controls the build sequence.\n */\nexport const loadMuonBuildSequenceProject = async (\n cwd: string,\n targets?: readonly string[],\n): Promise<MuonBuildSequenceProject> => {\n const resolvedCwd = resolve(cwd);\n let vite: typeof import(\"vite\");\n try {\n vite = await import(\"vite\");\n } catch (error) {\n if (isMissingVitePackageError(error)) {\n return {\n root: resolvedCwd,\n viteBuildRoot: resolvedCwd,\n viteBase: undefined,\n viteOutputDirectory: undefined,\n vitePublicDirectory: undefined,\n pluginOptions: undefined,\n viteServerProxyConfigured: false,\n };\n }\n throw error;\n }\n\n const resolvedConfig = await withSuppressedMuonViteBuild(\n targets,\n async () =>\n await vite.resolveConfig(\n { root: resolvedCwd, logLevel: \"silent\" } satisfies InlineConfig,\n \"build\",\n \"production\",\n \"production\",\n ),\n );\n const pluginOptions = await findMuonVitePluginOptions(resolvedConfig.plugins);\n if (pluginOptions === undefined) {\n return {\n root: resolvedCwd,\n viteBuildRoot: resolvedCwd,\n viteBase: undefined,\n viteOutputDirectory: undefined,\n vitePublicDirectory: undefined,\n pluginOptions: undefined,\n viteServerProxyConfigured: hasViteServerProxyConfiguration(\n resolvedConfig.server.proxy,\n ),\n };\n }\n\n return {\n root: resolvedConfig.root,\n viteBuildRoot: resolvedCwd,\n viteBase: resolvedConfig.base,\n viteOutputDirectory: resolveViteOutputDirectory(resolvedConfig),\n vitePublicDirectory:\n resolvedConfig.publicDir === \"\" ? undefined : resolvedConfig.publicDir,\n pluginOptions,\n viteServerProxyConfigured: hasViteServerProxyConfiguration(\n resolvedConfig.server.proxy,\n ),\n };\n};\n\n/**\n * Returns muon build options from a muon Vite plugin declaration.\n */\nexport const resolveMuonViteBuildOptions = (\n pluginOptions: MuonVitePluginOptions | undefined,\n): MuonViteBuildOptions => {\n if (pluginOptions?.build === false) {\n throw new Error(\"muon build is disabled by muon({ build: false }).\");\n }\n return typeof pluginOptions?.build === \"object\" ? pluginOptions.build : {};\n};\n\nconst runViteBuild = async (\n root: string,\n targets: readonly string[] | undefined,\n): Promise<{\n runtime: MuonRuntimePluginConfig | undefined;\n native:\n import(\"./plugin-access.js\").MuonResolvedPluginAccessOptions | undefined;\n}> => {\n const vite = await import(\"vite\");\n let builtConfig: ResolvedConfig | undefined;\n await withSuppressedMuonViteBuild(targets, async () => {\n await vite.build({\n root,\n logLevel: \"silent\",\n plugins: [\n {\n name: \"muon-build-runtime-config\",\n configResolved: (config) => {\n builtConfig = config;\n },\n },\n ],\n } satisfies InlineConfig);\n });\n // Read the instance that generated the bundle: resolving the config again\n // creates different capability IDs.\n const state = builtConfig?.plugins\n .map(getMuonVitePluginRuntimeState)\n .find((state) => state !== undefined);\n return {\n runtime: state?.getRuntimePluginConfig(),\n native: state?.getNativePluginAccess?.(),\n };\n};\n\nconst hasExplicitTargets = (options: MuonBuildSequenceOptions): boolean =>\n options.targets !== undefined && options.targets.length > 0;\n\nconst copyDefinedBuildOptions = (\n output: MuonBuildOptions,\n input: MuonBuildSequenceOptions,\n usesViteAssets: boolean,\n): void => {\n if (input.androidRelease !== undefined)\n output.androidRelease = input.androidRelease;\n if (input.android !== undefined)\n output.android = { ...output.android, ...input.android };\n if (input.assetSourcePath !== undefined) {\n if (usesViteAssets) {\n throw new Error(\n \"--assets cannot be used when a muon() Vite plugin provides the build sequence.\",\n );\n }\n output.assetSourcePath = input.assetSourcePath;\n }\n if (input.assetPrefix !== undefined) {\n output.assetPrefix = input.assetPrefix;\n }\n if (input.targets !== undefined && input.targets.length > 0) {\n output.targets = input.targets;\n if (input.allTargets === undefined) {\n output.allTargets = false;\n }\n }\n if (input.allTargets !== undefined) {\n output.allTargets = input.allTargets;\n }\n if (input.appName !== undefined) {\n output.appName = input.appName;\n }\n if (input.appId !== undefined) {\n output.appId = input.appId;\n }\n if (input.outputRoot !== undefined) {\n output.outputRoot = input.outputRoot;\n }\n if (input.configPath !== undefined) {\n output.configPath = input.configPath;\n }\n if (input.iconPath !== undefined) {\n output.iconPath = input.iconPath;\n }\n if (input.distributionFiles !== undefined) {\n output.distributionFiles = input.distributionFiles;\n }\n if (input.windowsResource !== undefined) {\n const windowsResource = mergeMuonWindowsResourceOptions(\n input.windowsResource,\n output.windowsResource,\n );\n if (windowsResource !== undefined) {\n output.windowsResource = windowsResource;\n }\n }\n if (input.windowsCodeSigning !== undefined) {\n output.windowsCodeSigning = input.windowsCodeSigning;\n }\n if (input.linuxDesktop !== undefined) {\n const linuxDesktop = mergeMuonLinuxDesktopOptions(\n input.linuxDesktop,\n output.linuxDesktop,\n );\n if (linuxDesktop !== undefined) {\n output.linuxDesktop = linuxDesktop;\n }\n }\n if (input.packageDirectory !== undefined) {\n output.packageDirectory = input.packageDirectory;\n }\n if (input.assetSalt !== undefined) {\n output.assetSalt = input.assetSalt;\n }\n if (input.includeRuntimeHelper !== undefined) {\n output.includeRuntimeHelper = input.includeRuntimeHelper;\n }\n};\n\n/**\n * Runs the project build sequence used by `muon build` and `muon pack`.\n */\nexport const runMuonBuildSequence = async (\n options: MuonBuildSequenceOptions = {},\n loadedProject?: MuonBuildSequenceProject,\n): Promise<MuonBuildResult> => {\n const internalOptions = options as InternalMuonBuildSequenceOptions;\n const progress = internalOptions.progress;\n const project =\n loadedProject ??\n (await loadMuonBuildSequenceProject(\n options.root ?? process.cwd(),\n options.targets,\n ));\n const pluginBuildOptions = resolveMuonViteBuildOptions(project.pluginOptions);\n const usesViteAssets = project.pluginOptions !== undefined;\n const buildOptions: MuonBuildOptions = {\n root: project.root,\n };\n\n if (usesViteAssets) {\n if (project.viteOutputDirectory === undefined) {\n throw new Error(\"Vite output directory could not be resolved.\");\n }\n Object.assign(buildOptions, pluginBuildOptions);\n const effectiveConfigPath =\n options.configPath ?? pluginBuildOptions.configPath;\n const nodeProject = await resolveMuonNodeProjectForBuildConfig(\n project.root,\n effectiveConfigPath,\n );\n await assertMuonNodeProjectViteBuildIsSafe(\n nodeProject,\n project.viteOutputDirectory,\n project.vitePublicDirectory ?? \"\",\n );\n const packagedAssetOptions = createVitePackagedAssetOptions(\n project.viteBase ?? \"/\",\n );\n buildOptions.assetSourcePath = project.viteOutputDirectory;\n buildOptions.assetPrefix = packagedAssetOptions.assetPrefix;\n if (packagedAssetOptions.browserStartPage !== undefined) {\n buildOptions.browserStartPage = packagedAssetOptions.browserStartPage;\n }\n progress?.({\n phase: \"build\",\n status: \"Running Vite build\",\n });\n const runtimePluginConfig = await runViteBuild(\n project.viteBuildRoot,\n options.targets ?? pluginBuildOptions.targets,\n );\n if (runtimePluginConfig.runtime !== undefined) {\n buildOptions.runtimePluginConfig = runtimePluginConfig.runtime;\n }\n if (runtimePluginConfig.native !== undefined)\n (buildOptions as InternalMuonBuildOptions).nativePluginAccess =\n runtimePluginConfig.native;\n } else if (\n options.defaultAllTargets !== undefined &&\n options.allTargets === undefined &&\n !hasExplicitTargets(options)\n ) {\n buildOptions.allTargets = options.defaultAllTargets;\n }\n\n copyDefinedBuildOptions(buildOptions, options, usesViteAssets);\n if (internalOptions.environment !== undefined) {\n (buildOptions as InternalMuonBuildOptions).environment =\n internalOptions.environment;\n }\n if (progress !== undefined) {\n (buildOptions as InternalMuonBuildOptions).progress = progress;\n }\n return await buildMuonApp(buildOptions);\n};\n","// muon - Multi-platform GUI application framework that uses CEF as its backend\n// Copyright (c) Kouji Matsui. (@kekyo@mi.kekyo.net)\n// Under MIT.\n// https://github.com/kekyo/muon-ui\n\nimport { spawn, type ChildProcess } from \"node:child_process\";\nimport { constants, writeFileSync } from \"node:fs\";\nimport { access, mkdtemp, readFile, rm } from \"node:fs/promises\";\nimport { tmpdir } from \"node:os\";\nimport { dirname, isAbsolute, join, resolve, win32 } from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\n\nimport { parse } from \"json5\";\nimport type { ViteDevServer } from \"vite\";\n\nimport { ensureMuonGitignoreEntry } from \"../common/gitignore.js\";\nimport { getDefaultMuonPrepareTarget, runMuonPrepare } from \"./prepare.js\";\nimport type { MuonRuntimePluginConfig } from \"../common/capability.js\";\nimport type { MuonVitePluginOptions } from \"../common/vite.js\";\nimport {\n assertMuonNodeHostArtifacts,\n assertMuonNodeProjectStagingIsSafe,\n createMuonNodeRuntimeRequirement,\n resolveMuonNodeProject,\n stageMuonNodeProject,\n} from \"./node-project.js\";\n\nexport interface MuonLaunchScriptOptions {\n muonExecutablePath: string;\n projectConfigPath: string | undefined;\n overrideConfigPath: string;\n platform: NodeJS.Platform;\n}\n\ninterface MuonViteSessionOptions {\n server: ViteDevServer;\n pluginOptions: MuonVitePluginOptions;\n refreshRuntimePluginConfig: () => Promise<MuonRuntimePluginConfig>;\n platform: NodeJS.Platform;\n architecture: NodeJS.Architecture;\n environment: NodeJS.ProcessEnv;\n}\n\ninterface MuonRuntimePaths {\n temporaryDirectory: string;\n overrideConfigPath: string;\n}\n\ninterface MuonProjectConfigResolution {\n path: string | undefined;\n config: Record<string, unknown> | undefined;\n}\n\ninterface MuonOverrideConfig {\n config?: Record<string, string>;\n node?: {\n project: string;\n };\n cdp?: {\n enable: true;\n };\n browser: {\n startPage: string;\n titleBarType?: \"native\" | \"muon\";\n initialTitleBarVisibility?: boolean;\n keybind?: {\n devtools: \"f12\";\n recycle: \"ctrl+f12\";\n };\n };\n plugin: MuonRuntimePluginConfig & {\n pages: string[];\n };\n network: {\n allow: string[];\n localAccess?: {\n allowInsecureLocalhost: boolean;\n };\n };\n}\n\n/**\n * Options for resolving a muon runtime directory used by the Vite plugin.\n */\nexport interface MuonRuntimePathOptions {\n /**\n * Vite project root used to resolve explicit relative paths.\n */\n root: string;\n\n /**\n * Public muon runtime target such as linux-amd64 or windows-amd64.\n */\n target: string;\n\n /**\n * Explicit custom muon-core runtime path.\n */\n muonPath: string | undefined;\n\n /**\n * Directory containing the packaged muon JavaScript files.\n *\n * @remarks This is injectable for tests. Production code uses the module directory.\n */\n packageDirectory?: string;\n}\n\nconst resolveFromRoot = (root: string, path: string): string =>\n isAbsolute(path) ? path : resolve(root, path);\n\nconst moduleDirectory =\n typeof __dirname === \"string\"\n ? __dirname\n : dirname(fileURLToPath(import.meta.url));\nconst defaultProjectConfigFileNames = [\"muon.json5\", \"muon.jsonc\", \"muon.json\"];\nconst muonRecycleExitCode = 88;\n\n/**\n * Resolves the muon-core runtime directory used by the Vite plugin.\n *\n * @param options Runtime path resolution inputs.\n * @returns Absolute or package-relative runtime directory path.\n */\nexport const resolveMuonRuntimePath = ({\n root,\n target,\n muonPath,\n packageDirectory = moduleDirectory,\n}: MuonRuntimePathOptions): string =>\n muonPath === undefined\n ? join(packageDirectory, \"runtime\", target)\n : resolveFromRoot(root, muonPath);\n\nexport const getMuonExecutablePath = (\n runtimePath: string,\n platform: NodeJS.Platform,\n): string =>\n join(runtimePath, platform === \"win32\" ? \"muon-core.exe\" : \"muon-core\");\n\nconst quotePosix = (value: string): string =>\n `'${value.replaceAll(\"'\", \"'\\\\''\")}'`;\n\nconst getPlatformDirectoryName = (\n path: string,\n platform: NodeJS.Platform,\n): string => (platform === \"win32\" ? win32.dirname(path) : dirname(path));\n\nconst getOptionalPosixValue = (value: string | undefined): string =>\n value === undefined ? \"''\" : quotePosix(value);\n\nconst createPosixMuonLaunchScript = ({\n muonExecutablePath,\n projectConfigPath,\n overrideConfigPath,\n}: MuonLaunchScriptOptions): string => `#!/usr/bin/env bash\nset -euo pipefail\nMUON_RECYCLE_EXIT_CODE=${muonRecycleExitCode}\nMUON_EXECUTABLE=${quotePosix(muonExecutablePath)}\nMUON_EXECUTABLE_DIRECTORY=${quotePosix(getPlatformDirectoryName(muonExecutablePath, \"linux\"))}\nMUON_PROJECT_CONFIG=${getOptionalPosixValue(projectConfigPath)}\nMUON_OVERRIDE_CONFIG=${quotePosix(overrideConfigPath)}\n\nMUON_CONFIG_ARGS=()\nif [[ -n \"$MUON_PROJECT_CONFIG\" ]]; then\n if [[ ! -f \"$MUON_PROJECT_CONFIG\" ]]; then\n echo \"muon startup failed: project config does not exist: $MUON_PROJECT_CONFIG\" >&2\n exit 1\n fi\n MUON_CONFIG_ARGS+=(\"-c\" \"$MUON_PROJECT_CONFIG\")\nfi\n\nif [[ ! -x \"$MUON_EXECUTABLE\" ]]; then\n echo \"muon startup failed: executable does not exist or is not executable: $MUON_EXECUTABLE\" >&2\n exit 1\nfi\n\nif [[ ! -f \"$MUON_OVERRIDE_CONFIG\" ]]; then\n echo \"muon startup failed: generated override config does not exist: $MUON_OVERRIDE_CONFIG\" >&2\n exit 1\nfi\nMUON_CONFIG_ARGS+=(\"-c\" \"$MUON_OVERRIDE_CONFIG\")\n\ncd \"$MUON_EXECUTABLE_DIRECTORY\"\nwhile true; do\n set +e\n \"$MUON_EXECUTABLE\" \"\\${MUON_CONFIG_ARGS[@]}\"\n MUON_EXIT_CODE=$?\n set -e\n if [[ \"$MUON_EXIT_CODE\" -ne \"$MUON_RECYCLE_EXIT_CODE\" ]]; then\n exit \"$MUON_EXIT_CODE\"\n fi\ndone\n`;\n\nconst escapeWindowsCmdValue = (value: string): string =>\n value.replaceAll(\"%\", \"%%\").replaceAll(\"\\r\", \"\").replaceAll(\"\\n\", \"\");\n\nconst getOptionalWindowsCmdValue = (value: string | undefined): string =>\n value === undefined ? \"\" : escapeWindowsCmdValue(value);\n\nconst createWindowsMuonLaunchScript = ({\n muonExecutablePath,\n projectConfigPath,\n overrideConfigPath,\n}: MuonLaunchScriptOptions): string => `@echo off\nsetlocal\nset \"MUON_RECYCLE_EXIT_CODE=${muonRecycleExitCode}\"\nset \"MUON_EXECUTABLE=${escapeWindowsCmdValue(muonExecutablePath)}\"\nset \"MUON_EXECUTABLE_DIRECTORY=${escapeWindowsCmdValue(getPlatformDirectoryName(muonExecutablePath, \"win32\"))}\"\nset \"MUON_PROJECT_CONFIG=${getOptionalWindowsCmdValue(projectConfigPath)}\"\nset \"MUON_OVERRIDE_CONFIG=${escapeWindowsCmdValue(overrideConfigPath)}\"\n\nif not exist \"%MUON_EXECUTABLE%\" (\n echo muon startup failed: executable does not exist: %MUON_EXECUTABLE% 1>&2\n exit /b 1\n)\n\nif not exist \"%MUON_OVERRIDE_CONFIG%\" (\n echo muon startup failed: generated override config does not exist: %MUON_OVERRIDE_CONFIG% 1>&2\n exit /b 1\n)\n\npushd \"%MUON_EXECUTABLE_DIRECTORY%\"\n:muon_recycle_loop\nif defined MUON_PROJECT_CONFIG (\n if not exist \"%MUON_PROJECT_CONFIG%\" (\n echo muon startup failed: project config does not exist: %MUON_PROJECT_CONFIG% 1>&2\n popd\n exit /b 1\n )\n \"%MUON_EXECUTABLE%\" -c \"%MUON_PROJECT_CONFIG%\" -c \"%MUON_OVERRIDE_CONFIG%\"\n) else (\n \"%MUON_EXECUTABLE%\" -c \"%MUON_OVERRIDE_CONFIG%\"\n)\nset \"MUON_EXIT_CODE=%ERRORLEVEL%\"\nif \"%MUON_EXIT_CODE%\"==\"%MUON_RECYCLE_EXIT_CODE%\" goto muon_recycle_loop\npopd\nexit /b %MUON_EXIT_CODE%\n`;\n\nexport const createMuonLaunchScript = (\n options: MuonLaunchScriptOptions,\n): string =>\n options.platform === \"win32\"\n ? createWindowsMuonLaunchScript(options)\n : createPosixMuonLaunchScript(options);\n\nconst getBaseUrl = (server: ViteDevServer): string | undefined =>\n server.resolvedUrls?.local[0] ?? server.resolvedUrls?.network[0];\n\nconst getWebSocketOrigin = (startUrl: string): string => {\n const url = new URL(startUrl);\n if (url.protocol === \"https:\") {\n url.protocol = \"wss:\";\n } else if (url.protocol === \"http:\") {\n url.protocol = \"ws:\";\n }\n return url.origin;\n};\n\nconst createMuonOverrideConfig = (\n startUrl: string,\n enableDebugger: boolean,\n allowInsecureLocalhost: boolean | undefined,\n config: Readonly<Record<string, string>> | undefined,\n runtimePluginConfig: MuonRuntimePluginConfig,\n nodeProjectPath: string | undefined,\n): MuonOverrideConfig => {\n const origin = new URL(startUrl).origin;\n return {\n ...(config === undefined ? {} : { config: { ...config } }),\n ...(nodeProjectPath === undefined\n ? {}\n : {\n node: {\n project: nodeProjectPath,\n },\n }),\n ...(enableDebugger\n ? {\n cdp: {\n enable: true,\n },\n }\n : {}),\n browser: {\n startPage: startUrl,\n ...(enableDebugger\n ? {\n keybind: {\n devtools: \"f12\",\n recycle: \"ctrl+f12\",\n },\n }\n : {}),\n },\n plugin: {\n ...runtimePluginConfig,\n pages: [`${origin}/**`],\n },\n network: {\n allow: [`${origin}/**`, `${getWebSocketOrigin(startUrl)}/**`],\n ...(allowInsecureLocalhost === undefined\n ? {}\n : {\n localAccess: {\n allowInsecureLocalhost,\n },\n }),\n },\n };\n};\n\nconst writeMuonOverrideConfig = (\n server: ViteDevServer,\n overrideConfigPath: string,\n pluginOptions: MuonVitePluginOptions,\n runtimePluginConfig: MuonRuntimePluginConfig,\n nodeProjectPath: string | undefined,\n): boolean => {\n const startUrl = getBaseUrl(server);\n if (startUrl === undefined) {\n server.config.logger.warn(\"muon Vite plugin could not resolve a Vite URL.\");\n return false;\n }\n writeFileSync(\n overrideConfigPath,\n `${JSON.stringify(\n createMuonOverrideConfig(\n startUrl,\n pluginOptions.enableDebugger !== false,\n pluginOptions.allowInsecureLocalhost,\n pluginOptions.dev?.config,\n runtimePluginConfig,\n nodeProjectPath,\n ),\n null,\n 2,\n )}\\n`,\n );\n return true;\n};\n\nconst createRuntimePaths = async (): Promise<MuonRuntimePaths> => {\n const temporaryDirectory = await mkdtemp(join(tmpdir(), \"muon-vite-\"));\n return {\n temporaryDirectory,\n overrideConfigPath: join(temporaryDirectory, \"muon.vite.json\"),\n };\n};\n\nconst fileExists = async (path: string): Promise<boolean> => {\n try {\n await access(path, constants.F_OK);\n return true;\n } catch {\n return false;\n }\n};\n\nconst isJsonObject = (value: unknown): value is Record<string, unknown> =>\n typeof value === \"object\" && value !== null && !Array.isArray(value);\n\nconst getErrorMessage = (error: unknown): string =>\n error instanceof Error ? error.message : String(error);\n\nconst resolveProjectConfig = async (\n server: ViteDevServer,\n): Promise<MuonProjectConfigResolution> => {\n for (const fileName of defaultProjectConfigFileNames) {\n const candidatePath = join(server.config.root, fileName);\n if (!(await fileExists(candidatePath))) {\n continue;\n }\n\n try {\n const parsed = parse(await readFile(candidatePath, \"utf8\"));\n if (!isJsonObject(parsed)) {\n throw new Error(\"muon config root must be an object\");\n }\n return {\n path: candidatePath,\n config: parsed,\n };\n } catch (error) {\n server.config.logger.warn(\n `muon project config will be ignored because it could not be read or parsed: ${candidatePath}: ${getErrorMessage(error)}`,\n );\n return {\n path: undefined,\n config: undefined,\n };\n }\n }\n\n server.config.logger.warn(\n `muon project config was not found in ${server.config.root}; launching with generated Vite config only.`,\n );\n return {\n path: undefined,\n config: undefined,\n };\n};\n\nconst createMuonConfigArguments = (\n projectConfigPath: string | undefined,\n overrideConfigPath: string,\n): string[] => [\n ...(projectConfigPath === undefined ? [] : [\"-c\", projectConfigPath]),\n \"-c\",\n overrideConfigPath,\n];\n\nconst waitForMuonProcess = async (\n muonExecutablePath: string,\n configArguments: readonly string[],\n environment: NodeJS.ProcessEnv,\n setCurrentChild: (child: ChildProcess | undefined) => void,\n): Promise<number> => {\n const child = spawn(muonExecutablePath, [...configArguments], {\n cwd: dirname(muonExecutablePath),\n env: environment,\n stdio: \"ignore\",\n windowsHide: false,\n });\n setCurrentChild(child);\n try {\n return await new Promise<number>((resolvePromise, reject) => {\n child.once(\"error\", reject);\n child.once(\"close\", (code) => {\n resolvePromise(code ?? 1);\n });\n });\n } finally {\n setCurrentChild(undefined);\n }\n};\n\nexport const startMuonViteBrowserBridge = async ({\n server,\n pluginOptions,\n refreshRuntimePluginConfig,\n platform,\n architecture,\n environment,\n}: MuonViteSessionOptions): Promise<void> => {\n await ensureMuonGitignoreEntry(server.config.root);\n\n if (pluginOptions.open === false || server.httpServer === null) {\n return;\n }\n\n const target = getDefaultMuonPrepareTarget(platform, architecture);\n const muonPath = resolveMuonRuntimePath({\n root: server.config.root,\n target,\n muonPath: pluginOptions.muonPath,\n });\n const cefPath =\n pluginOptions.cefPath === undefined\n ? undefined\n : resolveFromRoot(server.config.root, pluginOptions.cefPath);\n const stagePath =\n pluginOptions.stagePath === undefined\n ? resolve(server.config.root, \".muon\", target)\n : resolveFromRoot(server.config.root, pluginOptions.stagePath);\n const paths = await createRuntimePaths();\n\n let currentChild: ChildProcess | undefined = undefined;\n let closing = false;\n let serverCloseRequested = false;\n let supervisorPromise: Promise<void> | undefined = undefined;\n\n const setCurrentChild = (child: ChildProcess | undefined): void => {\n currentChild = child;\n };\n\n const closeServerAfterMuonExit = (): void => {\n if (\n closing ||\n serverCloseRequested ||\n pluginOptions.exitWithServer === false\n ) {\n return;\n }\n serverCloseRequested = true;\n void server.close().catch((error: unknown) => {\n server.config.logger.warn(\n `muon could not close the Vite server after muon exited: ${getErrorMessage(error)}`,\n );\n });\n };\n\n const runSupervisor = async (): Promise<void> => {\n let exitCode = muonRecycleExitCode;\n while (!closing && exitCode === muonRecycleExitCode) {\n try {\n const projectConfig = await resolveProjectConfig(server);\n const nodeProject = await resolveMuonNodeProject(\n projectConfig.config,\n projectConfig.path === undefined\n ? server.config.root\n : dirname(projectConfig.path),\n );\n await assertMuonNodeProjectStagingIsSafe(nodeProject, stagePath);\n const runtimePluginConfig = await refreshRuntimePluginConfig();\n const preparedRuntime = await runMuonPrepare({\n muonPath,\n cefPath,\n stageDir: stagePath,\n target,\n cacheDir: environment.MUON_CACHE_DIR,\n nodeRuntimeRequirement: createMuonNodeRuntimeRequirement(\n nodeProject,\n true,\n ),\n force: false,\n quiet: false,\n prepareExecutablePath: undefined,\n environment,\n cwd: server.config.root,\n });\n if (preparedRuntime.stagePath === undefined) {\n throw new Error(\"muon-builder did not return a staged runtime path.\");\n }\n const nodeProjectPath = await stageMuonNodeProject(\n nodeProject,\n preparedRuntime.stagePath,\n );\n if (nodeProjectPath !== undefined) {\n await assertMuonNodeHostArtifacts(\n preparedRuntime.stagePath,\n platform,\n );\n }\n const configWritten = writeMuonOverrideConfig(\n server,\n paths.overrideConfigPath,\n pluginOptions,\n runtimePluginConfig,\n nodeProjectPath,\n );\n if (!configWritten || closing) {\n return;\n }\n exitCode = await waitForMuonProcess(\n getMuonExecutablePath(preparedRuntime.stagePath, platform),\n createMuonConfigArguments(\n projectConfig.path,\n paths.overrideConfigPath,\n ),\n environment,\n setCurrentChild,\n );\n if (!closing && exitCode !== muonRecycleExitCode) {\n closeServerAfterMuonExit();\n }\n } catch (error) {\n if (!closing) {\n server.config.logger.warn(\n `muon startup failed: ${getErrorMessage(error)}`,\n );\n }\n return;\n }\n }\n };\n\n let cleanupPromise: Promise<void> | undefined = undefined;\n const cleanup = async (): Promise<void> => {\n if (cleanupPromise !== undefined) {\n return cleanupPromise;\n }\n cleanupPromise = (async () => {\n closing = true;\n currentChild?.kill();\n await supervisorPromise;\n await rm(paths.temporaryDirectory, { recursive: true, force: true });\n })();\n return cleanupPromise;\n };\n\n const originalClose = server.close.bind(server);\n server.close = async (): Promise<void> => {\n try {\n await originalClose();\n } finally {\n await cleanup();\n }\n };\n server.httpServer.once(\"close\", () => {\n void cleanup();\n });\n server.httpServer.once(\"listening\", () => {\n supervisorPromise = runS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