mirror of
https://github.com/kiddin9/op-packages.git
synced 2026-10-29 08:25:13 +08:00
🌈 Sync 2026-08-11 02:29:57
This commit is contained in:
1 parent
f8bdc4459f
commit
412c262edf
73 files changed
+9791
-5915
No files matched your search
@@ -1,8 +1,8 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=luci-app-openclash
|
||||
PKG_VERSION:=0.47.133
|
||||
PKG_RELEASE:=7
|
||||
PKG_VERSION:=0.47.156
|
||||
PKG_RELEASE:=8
|
||||
PKG_MAINTAINER:=vernesong <https://github.com/vernesong/OpenClash>
|
||||
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
|
||||
@@ -112,10 +112,10 @@ define Package/$(PKG_NAME)/postrm
|
||||
rm -rf /etc/config/openclash >/dev/null 2>&1
|
||||
rm -rf /tmp/openclash.log >/dev/null 2>&1
|
||||
rm -rf /tmp/openclash_start.log >/dev/null 2>&1
|
||||
rm -rf /tmp/openclash_last_version >/dev/null 2>&1
|
||||
rm -rf /tmp/openclash.change >/dev/null 2>&1
|
||||
rm -rf /tmp/clash_last_version >/dev/null 2>&1
|
||||
rm -rf /usr/share/openclash >/dev/null 2>&1
|
||||
rm -rf /tmp/openclash_version_history.json >/dev/null 2>&1
|
||||
rm -rf /tmp/openclash_cdn_info.json >/dev/null 2>&1
|
||||
rm -rf ${DNSMASQ_CONF_DIR}/dnsmasq_openclash_custom_domain.conf >/dev/null 2>&1
|
||||
rm -rf ${DNSMASQ_CONF_DIR}/dnsmasq_openclash_chnroute_pass.conf >/dev/null 2>&1
|
||||
rm -rf ${DNSMASQ_CONF_DIR}/dnsmasq_openclash_chnroute6_pass.conf >/dev/null 2>&1
|
||||
@@ -123,6 +123,9 @@ define Package/$(PKG_NAME)/postrm
|
||||
rm -rf /tmp/openclash_announcement >/dev/null 2>&1
|
||||
rm -rf /www/luci-static/resources/openclash >/dev/null 2>&1
|
||||
rm -rf /tmp/oix* >/dev/null 2>&1
|
||||
rm -rf /tmp/openclash_oix_version.json >/dev/null 2>&1
|
||||
rm -rf /tmp/openclash_version_history_* >/dev/null 2>&1
|
||||
rm -rf /tmp/openclash_cdn_info_* >/dev/null 2>&1
|
||||
sed -i '/OpenClash Append/,/OpenClash Append End/d' "/usr/lib/lua/luci/model/network.lua" >/dev/null 2>&1
|
||||
sed -i '/.*kB maximum content size*/c\HTTP_MAX_CONTENT = 1024*100 -- 100 kB maximum content size' /usr/lib/lua/luci/http.lua >/dev/null 2>&1
|
||||
sed -i '/.*kB maximum content size*/c\export let HTTP_MAX_CONTENT = 1024*100; // 100 kB maximum content size' /usr/share/ucode/luci/http.uc >/dev/null 2>&1
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -13,12 +13,12 @@ m.reset = false
|
||||
m.submit = false
|
||||
|
||||
m:section(SimpleSection).template = "openclash/status"
|
||||
if fs.uci_get_config("config", "oix_token") and fs.uci_get_config("config", "oix_show_info_page") ~= "0" then
|
||||
if fs.uci_get_config("config", "oix_token") and fs.uci_get_config("config", "oix_show_info_page") == "1" then
|
||||
m:append(Template("openclash/oixcloud"))
|
||||
end
|
||||
m:append(Template("openclash/myip"))
|
||||
m:append(Template("openclash/developer"))
|
||||
m:append(Template("openclash/select_git_cdn"))
|
||||
m:append(Template("openclash/update"))
|
||||
m:append(Template("openclash/config_edit"))
|
||||
m:append(Template("openclash/config_upload"))
|
||||
|
||||
|
||||
@@ -93,12 +93,15 @@ o:value("https://cp.cloudflare.com/generate_204")
|
||||
o:value("http://captive.apple.com/generate_204")
|
||||
o.default = "0"
|
||||
|
||||
o = s:taboption("settings", Value, "github_address_mod", translate("Github Address Modify"))
|
||||
o.description = translate("Modify The Github Address In The Config And OpenClash With Proxy(CDN) To Prevent File Download Failed. Format Reference:").." ".."<a href='javascript:void(0)' onclick='javascript:return winOpen(\"https://ghfast.top/\")'>https://ghfast.top/</a>"
|
||||
o = s:taboption("settings", Value, "github_address_mod", font_red..bold_on..translate("GitHub Address Proxy")..bold_off..font_off)
|
||||
o.description = translate("Proxy The GitHub Address In The Config And OpenClash With Proxy(CDN) To Prevent File Download Failed.").." "..translate("Format Reference:").." ".."<a href='javascript:void(0)' onclick='javascript:return winOpen(\"https://ghfast.top/\")'>https://ghfast.top/</a>"
|
||||
o:value("0", translate("Disable"))
|
||||
o:value("https://fastly.jsdelivr.net/")
|
||||
o:value("https://testingcf.jsdelivr.net/")
|
||||
o:value("https://cdn.jsdelivr.net/")
|
||||
for _, cdn in ipairs(fs.cdn_list()) do
|
||||
o:value(cdn)
|
||||
end
|
||||
o.default = "0"
|
||||
|
||||
o = s:taboption("settings", ListValue, "log_level", translate("Log Level"))
|
||||
@@ -406,6 +409,14 @@ o = s:taboption("smart", Flag, "smart_prefer_asn", font_red..bold_on..translate(
|
||||
o.description = translate("Select Nodes Force Lookup and Use Target ASN Info First For More Stable Experience")
|
||||
o.default = 0
|
||||
|
||||
o = s:taboption("smart", Value, "smart_tolerance", translate("Smart Group Tolerance").."(ms)")
|
||||
o.description = translate("Sort When Proxies Delays Within Tolerance are Treated as Equal, Preventing Jitter")
|
||||
o:value("0", translate("Disable"))
|
||||
o:value("100")
|
||||
o:value("150")
|
||||
o.datatype = "uinteger"
|
||||
o.default = "0"
|
||||
|
||||
o = s:taboption("smart", Flag, "smart_enable_lgbm", font_red..bold_on..translate("Enable LightGBM Model")..bold_off..font_off)
|
||||
o.description = font_red..bold_on..translate("Use LightGBM Model To Predict Weight")..bold_off..font_off
|
||||
o.default = 0
|
||||
|
||||
@@ -42,8 +42,9 @@ ful.submit = false
|
||||
sul =ful:section(SimpleSection, "")
|
||||
o = sul:option(FileUpload, "")
|
||||
o.template = "openclash/upload"
|
||||
um = sul:option(DummyValue, "", nil)
|
||||
um.template = "openclash/dvalue"
|
||||
o.cfgvalue = function(self, section)
|
||||
return self.value
|
||||
end
|
||||
|
||||
local dir, fd, clash
|
||||
dir = "/etc/openclash/config/"
|
||||
@@ -72,7 +73,7 @@ HTTP.setfilehandler(
|
||||
end
|
||||
|
||||
if not fd then
|
||||
um.value = translate("upload file error.")
|
||||
o.value = translate("upload file error.")
|
||||
return
|
||||
end
|
||||
end
|
||||
@@ -93,11 +94,11 @@ HTTP.setfilehandler(
|
||||
default_config_set(ymlname .. ".yaml")
|
||||
end
|
||||
end
|
||||
um.value = translate("File saved to") .. ' "/etc/openclash/config/"'
|
||||
o.value = translate("File saved to") .. ' "/etc/openclash/config/"'
|
||||
elseif fp == "proxy-provider" then
|
||||
um.value = translate("File saved to") .. ' "/etc/openclash/proxy_provider/"'
|
||||
o.value = translate("File saved to") .. ' "/etc/openclash/proxy_provider/"'
|
||||
elseif fp == "rule-provider" then
|
||||
um.value = translate("File saved to") .. ' "/etc/openclash/rule_provider/"'
|
||||
o.value = translate("File saved to") .. ' "/etc/openclash/rule_provider/"'
|
||||
elseif fp == "clash_meta" then
|
||||
local archive_path = core_dir .. meta.file
|
||||
if string.lower(string.sub(meta.file, -7, -1)) == ".tar.gz" then
|
||||
@@ -133,20 +134,20 @@ HTTP.setfilehandler(
|
||||
|
||||
os.execute(string.format("chmod 4755 '/etc/openclash/core/%s' >/dev/null 2>&1", fp))
|
||||
os.execute(string.format("rm -rf %s >/dev/null 2>&1", core_dir))
|
||||
um.value = translate("File saved to") .. ' "/etc/openclash/core/"'
|
||||
o.value = translate("File saved to") .. ' "/etc/openclash/core/"'
|
||||
elseif fp == "backup-file" then
|
||||
os.execute("tar -C '/etc/openclash/' -xzf %s >/dev/null 2>&1" % (backup_dir .. meta.file))
|
||||
os.execute("mv /etc/openclash/openclash /etc/config/openclash >/dev/null 2>&1")
|
||||
fs.unlink(backup_dir .. meta.file)
|
||||
um.value = translate("Backup File Restore Successful!")
|
||||
o.value = translate("Backup File Restore Successful!")
|
||||
end
|
||||
end
|
||||
end
|
||||
)
|
||||
|
||||
if HTTP.formvalue("upload") then
|
||||
if not um.value then
|
||||
um.value = translate("No Specify Upload File")
|
||||
if not o.value then
|
||||
o.value = translate("No Specify Upload File")
|
||||
end
|
||||
end
|
||||
|
||||
@@ -305,9 +306,7 @@ btnapply.write = function(self, t)
|
||||
HTTP.close()
|
||||
elseif action == "remove" then
|
||||
local file_name = fs.basename(e[t].name)
|
||||
|
||||
fs.config_refs(file_name)
|
||||
|
||||
fs.unlink("/etc/openclash/history/"..fs.filename(e[t].name)..".db")
|
||||
fs.unlink("/etc/openclash/"..file_name)
|
||||
local a=fs.unlink("/etc/openclash/config/"..file_name)
|
||||
|
||||
@@ -76,9 +76,9 @@ s:tab("rules_update", translate("Rules Update"))
|
||||
s:tab("geo_update", translate("GEO Update"))
|
||||
s:tab("chnr_update", translate("Chnroute Update"))
|
||||
s:tab("auto_restart", translate("Auto Restart"))
|
||||
s:tab("version_update", translate("Version Update"))
|
||||
s:tab("developer", translate("Developer Settings"))
|
||||
s:tab("debug", translate("Core Tests"))
|
||||
s:tab("developer", translate("Developer Settings"))
|
||||
s:tab("version_update", translate("Version Update"))
|
||||
s:tab("oixcloud", translate("oixCloud"))
|
||||
|
||||
o = s:taboption("op_mode", ListValue, "en_mode", font_red..bold_on..translate("Select Mode")..bold_off..font_off)
|
||||
@@ -1394,8 +1394,9 @@ function o.write(self, section, value)
|
||||
end
|
||||
|
||||
---- version update
|
||||
core_update = s:taboption("version_update", DummyValue, "", nil)
|
||||
core_update.template = "openclash/update"
|
||||
version_update_panel = s:taboption("version_update", DummyValue, "", nil)
|
||||
version_update_panel.template = "openclash/update"
|
||||
version_update_panel.version_tab = true
|
||||
|
||||
---- developer
|
||||
o = s:taboption("developer", Value, "firewall_custom")
|
||||
@@ -1464,8 +1465,7 @@ o.write = function()
|
||||
HTTP.redirect(DISP.build_url("admin", "services", "openclash"))
|
||||
end
|
||||
|
||||
m:append(Template("openclash/config_editor"))
|
||||
m:append(Template("openclash/toolbar_show"))
|
||||
m:append(Template("openclash/select_git_cdn"))
|
||||
m:append(Template("openclash/config_editor"))
|
||||
|
||||
return m
|
||||
@@ -335,16 +335,24 @@ function get_resourse_mtime(path)
|
||||
local found = find_case_insensitive_path(path)
|
||||
if found then
|
||||
real_path = found
|
||||
elseif uci_get_config("config", "small_flash_memory") == "1" then
|
||||
local fallback_path = path:gsub("^/etc/openclash/", "/tmp/etc/openclash/")
|
||||
local fallback_found = find_case_insensitive_path(fallback_path)
|
||||
if fallback_found then
|
||||
real_path = fallback_found
|
||||
else
|
||||
return "File Not Exist"
|
||||
end
|
||||
else
|
||||
return "File Not Exist"
|
||||
end
|
||||
end
|
||||
local file = fs.readlink(real_path) or real_path
|
||||
local resourse_etag_version = SYS.exec(string.format("source /usr/share/openclash/openclash_etag.sh && GET_ETAG_TIMESTAMP_BY_PATH '%s'", real_path))
|
||||
local resourse_etag_version = SYS.exec(string.format("source /usr/share/openclash/openclash_etag.sh && GET_ETAG_TIMESTAMP_BY_PATH '%s'", file))
|
||||
if resourse_etag_version and resourse_etag_version ~= "" then
|
||||
return resourse_etag_version
|
||||
end
|
||||
local resourse_version = os.date("%Y-%m-%d %H:%M:%S", mtime(real_path))
|
||||
local resourse_version = os.date("%Y-%m-%d %H:%M:%S", mtime(file))
|
||||
if resourse_version and resourse_version ~= "" then
|
||||
return resourse_version
|
||||
end
|
||||
@@ -600,32 +608,60 @@ function pkg_type()
|
||||
end
|
||||
end
|
||||
|
||||
--- Returns the installed version of luci-app-openclash.
|
||||
-- Supports both opkg and apk package managers.
|
||||
-- @return String containing the version number, or "0" if not found
|
||||
-- NOTE: The module-level cache (_oc_version_cache) provides per-request
|
||||
-- deduplication. In OpenWrt LuCI CGI mode each HTTP request spawns a new Lua
|
||||
-- process, so cross-request caching is impossible.
|
||||
-- Since require() returns the same module instance (package.loaded), the
|
||||
-- first call caches the result and subsequent calls avoid redundant shell
|
||||
-- commands. No time-based expiration is needed — the version is immutable
|
||||
-- for the lifetime of a request.
|
||||
local _oc_version_cache = nil
|
||||
--- Reads the CDN proxy address list from /usr/share/openclash/res/cdn.list.
|
||||
-- Lines starting with "#" are treated as comments and skipped.
|
||||
-- @return Table of CDN address strings (deduplicated, in file order)
|
||||
function cdn_list()
|
||||
local list = {}
|
||||
local seen = {}
|
||||
local raw = fs.readfile("/usr/share/openclash/res/cdn.list")
|
||||
if raw then
|
||||
for line in raw:gmatch("[^\r\n]+") do
|
||||
line = line:gsub("^%s+", ""):gsub("%s+$", "")
|
||||
if line ~= "" and line:sub(1, 1) ~= "#" and not seen[line] then
|
||||
seen[line] = true
|
||||
list[#list + 1] = line
|
||||
end
|
||||
end
|
||||
end
|
||||
return list
|
||||
end
|
||||
|
||||
--- Read a field of an installed package directly from the package database
|
||||
-- (/usr/lib/opkg/status or /lib/apk/db/installed), avoiding the opkg/apk
|
||||
-- binaries and their lock files (/var/lock/opkg.lock, /lib/apk/db/lock).
|
||||
-- Safe to call repeatedly/concurrently and never blocks on a lock.
|
||||
-- @param pkg Package name, e.g. "luci-app-openclash" or "libc"
|
||||
-- @param field Field name; opkg: "Version"/"Architecture", apk: "V"/"A"
|
||||
-- @return String field value, or "" when not found
|
||||
function read_pkg_field(pkg, field)
|
||||
local text
|
||||
if pkg_type() == "opkg" then
|
||||
text = fs.readfile("/usr/lib/opkg/status")
|
||||
else
|
||||
text = fs.readfile("/lib/apk/db/installed")
|
||||
end
|
||||
if not text then return "" end
|
||||
text = text:gsub("\r\n", "\n")
|
||||
|
||||
local prefix = (pkg_type() == "opkg") and ("Package: " .. pkg .. "\n") or ("P:" .. pkg .. "\n")
|
||||
local start = text:find(prefix, 1, true)
|
||||
if not start then return "" end
|
||||
local block_end = text:find("\n\n", start + #prefix, true) or #text
|
||||
local block = text:sub(start + #prefix, block_end - 1)
|
||||
local colon = (pkg_type() == "opkg") and ": " or ":"
|
||||
local val = block:match("\n" .. field .. colon .. "([^\r\n]+)")
|
||||
if not val then
|
||||
val = block:match("^" .. field .. colon .. "([^\r\n]+)")
|
||||
end
|
||||
return val or ""
|
||||
end
|
||||
|
||||
function oc_version()
|
||||
if _oc_version_cache ~= nil then
|
||||
return _oc_version_cache
|
||||
end
|
||||
local v
|
||||
if pkg_type() == "opkg" then
|
||||
v = SYS.exec("rm -f /var/lock/opkg.lock && opkg status luci-app-openclash 2>/dev/null |grep '^Version:' |awk '{print $2}' |tr -d '\n'")
|
||||
else
|
||||
v = SYS.exec("rm -f /lib/apk/db/lock && apk info luci-app-openclash 2>/dev/null |grep '^luci-app-openclash-[0-9]' |sed 's/luci-app-openclash-//' |tr -d '\n'")
|
||||
end
|
||||
local v = read_pkg_field("luci-app-openclash", pkg_type() == "opkg" and "Version" or "V")
|
||||
if v == "" then
|
||||
v = "0"
|
||||
end
|
||||
_oc_version_cache = v
|
||||
return v
|
||||
end
|
||||
|
||||
|
||||
@@ -4,11 +4,11 @@
|
||||
local val = self:cfgvalue(section)
|
||||
if val == translate("Enable") or val == translate("Enabled") or val == translate("Config Normal") or val == translate("Exist") then
|
||||
%>
|
||||
<div style="color: green; font-weight:bold;">
|
||||
<div class="oc" style="color: var(--success-color); font-weight:bold;">
|
||||
<%
|
||||
else
|
||||
%>
|
||||
<div style="color: red; font-weight:bold;">
|
||||
<div class="oc" style="color: var(--error-color); font-weight:bold;">
|
||||
<%
|
||||
end
|
||||
write(pcdata(val))
|
||||
|
||||
@@ -1,50 +0,0 @@
|
||||
<script type="text/javascript">//<![CDATA[
|
||||
(function() {
|
||||
if (window._ocCommonLoaded) return;
|
||||
window._ocCommonLoaded = true;
|
||||
|
||||
window.levelTranslations = {
|
||||
'info': '<%:Info%>',
|
||||
'warning': '<%:Warning%>',
|
||||
'error': '<%:Error%>',
|
||||
'debug': '<%:Debug%>',
|
||||
'tip': '<%:Tip%>',
|
||||
'watchdog': '<%:Watchdog%>',
|
||||
'fatal': '<%:Fatal%>'
|
||||
};
|
||||
window._ocArchOptionsHTML = '<option value="linux-386"><%:linux-386%></option>' +
|
||||
'<option value="linux-amd64-v1"><%:linux-amd64-v1(x86-64)%></option>' +
|
||||
'<option value="linux-amd64-v2"><%:linux-amd64-v2(x86-64)%></option>' +
|
||||
'<option value="linux-amd64-v3"><%:linux-amd64-v3(x86-64)%></option>' +
|
||||
'<option value="linux-armv5"><%:linux-armv5%></option>' +
|
||||
'<option value="linux-armv6"><%:linux-armv6%></option>' +
|
||||
'<option value="linux-armv7"><%:linux-armv7%></option>' +
|
||||
'<option value="linux-arm64"><%:linux-arm64(armv8)%></option>' +
|
||||
'<option value="linux-loong64-abi1"><%:linux-loong64-abi1%></option>' +
|
||||
'<option value="linux-loong64-abi2"><%:linux-loong64-abi2%></option>' +
|
||||
'<option value="linux-riscv64"><%:linux-riscv64%></option>' +
|
||||
'<option value="linux-s390x"><%:linux-s390x%></option>' +
|
||||
'<option value="linux-mips-hardfloat"><%:linux-mips-hardfloat%></option>' +
|
||||
'<option value="linux-mips-softfloat"><%:linux-mips-softfloat%></option>' +
|
||||
'<option value="linux-mips64"><%:linux-mips64%></option>' +
|
||||
'<option value="linux-mips64le"><%:linux-mips64le%></option>' +
|
||||
'<option value="linux-mipsle-softfloat"><%:linux-mipsle-softfloat%></option>' +
|
||||
'<option value="linux-mipsle-hardfloat"><%:linux-mipsle-hardfloat%></option>' +
|
||||
'<option value="0"><%:Not Set%></option>';
|
||||
(function() {
|
||||
function injectArchOptions() {
|
||||
var selects = document.querySelectorAll('.oc-arch-select');
|
||||
for (var i = 0; i < selects.length; i++) {
|
||||
if (selects[i].getAttribute('data-oc-arch-injected')) continue;
|
||||
selects[i].insertAdjacentHTML('afterbegin', window._ocArchOptionsHTML);
|
||||
selects[i].setAttribute('data-oc-arch-injected', '1');
|
||||
}
|
||||
}
|
||||
injectArchOptions();
|
||||
if (document.readyState === 'loading') {
|
||||
document.addEventListener('DOMContentLoaded', injectArchOptions);
|
||||
}
|
||||
})();
|
||||
|
||||
})();
|
||||
//]]></script>
|
||||
@@ -11,7 +11,7 @@
|
||||
<span class="config-file-name" id="config-file-name"><%:Loading...%></span>
|
||||
</div>
|
||||
<div class="config-editor-actions">
|
||||
<button type="button" class="icon-btn" id="config-editor-layout" title="<%:Compare%>" style="display:none;">
|
||||
<button type="button" class="icon-btn oc-hidden" id="config-editor-layout" title="<%:Compare%>">
|
||||
<svg width="14" height="14"><use href="#oc-icon-compare"/></svg>
|
||||
</button>
|
||||
<button type="button" class="icon-btn" id="config-editor-download" title="<%:Download%>">
|
||||
@@ -26,39 +26,32 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="overwrite-banner" class="overwrite-banner" style="display:none;">
|
||||
<svg style="flex-shrink:0;" width="20" height="20"><use href="#oc-icon-alert-circle"/></svg>
|
||||
<div id="overwrite-banner" class="overwrite-banner oc-hidden">
|
||||
<svg class="oc-svg-inline" width="20" height="20"><use href="#oc-icon-alert-circle"/></svg>
|
||||
<span>
|
||||
<%:You are editing the overwrite script, please note that some settings may cause the abnormal, be careful with the modification!%>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div id="config-mode-tabs" style="display:none;">
|
||||
<div id="config-mode-tabs" class="oc-hidden">
|
||||
<div class="mode-tabs">
|
||||
<button type="button" class="mode-tab active" id="tab-original-config" data-mode="original">
|
||||
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" style="vertical-align:middle;margin-right:4px;">
|
||||
<rect x="4" y="4" width="16" height="16" rx="2" stroke="currentColor" stroke-width="2" fill="none"/>
|
||||
<line x1="8" y1="8" x2="16" y2="8" stroke="currentColor" stroke-width="2"/>
|
||||
<line x1="8" y1="12" x2="16" y2="12" stroke="currentColor" stroke-width="2"/>
|
||||
<line x1="8" y1="16" x2="12" y2="16" stroke="currentColor" stroke-width="2"/>
|
||||
</svg>
|
||||
<%:Original Config%>
|
||||
<svg width="16" height="16"><use href="#oc-icon-list"/></svg>
|
||||
<span><%:Original Config%></span>
|
||||
</button>
|
||||
<button type="button" class="mode-tab" id="tab-runtime-config" data-mode="runtime">
|
||||
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" style="vertical-align:middle;margin-right:4px;">
|
||||
<polygon points="13 2 3 14 12 14 11 22 21 10 13 10 13 2" stroke="currentColor" stroke-width="2" fill="none"/>
|
||||
</svg>
|
||||
<%:Runtime Config%>
|
||||
<svg width="16" height="16"><use href="#oc-icon-zap"/></svg>
|
||||
<span><%:Runtime Config%></span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="config-editor-content">
|
||||
<textarea id="config-editor-textarea" style="display: none;"></textarea>
|
||||
<div id="config-mergeview-container" style="display:none;width:100%;height:100%;"></div>
|
||||
<textarea id="config-editor-textarea" class="oc-hidden"></textarea>
|
||||
<div id="config-mergeview-container" class="oc-hidden" style="width:100%;height:100%;"></div>
|
||||
</div>
|
||||
|
||||
<div id="overwrite-card-bar" style="display:none;position:relative;margin:12px;">
|
||||
<div id="overwrite-card-bar" class="oc-hidden" style="position:relative;margin:12px;">
|
||||
<div class="overwrite-card-row" id="overwrite-card-list"></div>
|
||||
</div>
|
||||
|
||||
@@ -78,13 +71,12 @@
|
||||
<script src="/luci-static/resources/openclash/js/common.js?v=<%=plugin_version%>"></script>
|
||||
<script src="/luci-static/resources/openclash/js/oc-icons.js?v=<%=plugin_version%>"></script>
|
||||
<script src="/luci-static/resources/openclash/js/cm6.min.js?v=<%=plugin_version%>"></script>
|
||||
<%+openclash/common%>
|
||||
<script type="text/javascript">
|
||||
ocRegisterEditorHotkeys();
|
||||
|
||||
var _ocIcons = {
|
||||
SVG_COMPARE: '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><rect x="2" y="3" width="8" height="18" rx="2" stroke="currentColor" stroke-width="2" fill="none"/><rect x="14" y="3" width="8" height="18" rx="2" stroke="currentColor" stroke-width="2" fill="none"/></svg>',
|
||||
SVG_RESTORE: '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><rect x="3" y="3" width="18" height="18" rx="2" stroke="currentColor" stroke-width="2" fill="none"/></svg>'
|
||||
SVG_COMPARE: '<svg width="24" height="24"><use href="#oc-icon-compare"/></svg>',
|
||||
SVG_RESTORE: '<svg width="24" height="24"><use href="#oc-icon-restore"/></svg>'
|
||||
};
|
||||
|
||||
// Uses EditorView.updateListener instead of view.dispatch override.
|
||||
@@ -228,20 +220,20 @@ var ConfigEditor = {
|
||||
var textarea = document.getElementById('config-editor-textarea');
|
||||
if (textarea) {
|
||||
textarea.value = '';
|
||||
textarea.style.display = 'none';
|
||||
textarea.classList.add('oc-hidden');
|
||||
}
|
||||
ocShowLoading(textarea.parentNode, '<%:Loading config file...%>');
|
||||
var mergeview = document.getElementById('config-mergeview-container');
|
||||
if (mergeview) mergeview.style.display = 'none';
|
||||
if (mergeview) mergeview.classList.add('oc-hidden');
|
||||
|
||||
var banner = document.getElementById('overwrite-banner');
|
||||
if (banner) banner.style.display = 'none';
|
||||
if (banner) banner.classList.add('oc-hidden');
|
||||
|
||||
var tabs = document.getElementById('config-mode-tabs');
|
||||
if (tabs) tabs.style.display = 'flex';
|
||||
if (tabs) tabs.classList.remove('oc-hidden');
|
||||
|
||||
var layoutBtn = document.getElementById('config-editor-layout');
|
||||
if (layoutBtn) layoutBtn.style.display = 'inline-flex';
|
||||
if (layoutBtn) layoutBtn.classList.remove('oc-hidden');
|
||||
|
||||
if (!configFile) {
|
||||
alert('<%:Please select a config file first%>');
|
||||
@@ -253,6 +245,7 @@ var ConfigEditor = {
|
||||
|
||||
this.model.classList.remove('maximized');
|
||||
this.model.classList.remove('minimized');
|
||||
this.resetModelStyles();
|
||||
|
||||
var editTitle = document.getElementById('editTitle');
|
||||
if (editTitle) {
|
||||
@@ -286,20 +279,20 @@ var ConfigEditor = {
|
||||
var textarea = document.getElementById('config-editor-textarea');
|
||||
if (textarea) {
|
||||
textarea.value = '';
|
||||
textarea.style.display = 'none';
|
||||
textarea.classList.add('oc-hidden');
|
||||
}
|
||||
ocShowLoading(textarea.parentNode, '<%:Loading config file...%>');
|
||||
var mergeview = document.getElementById('config-mergeview-container');
|
||||
if (mergeview) mergeview.style.display = 'none';
|
||||
if (mergeview) mergeview.classList.add('oc-hidden');
|
||||
|
||||
var banner = document.getElementById('overwrite-banner');
|
||||
if (banner) banner.style.display = 'flex';
|
||||
if (banner) banner.classList.remove('oc-hidden');
|
||||
|
||||
var tabs = document.getElementById('config-mode-tabs');
|
||||
if (tabs) tabs.style.display = 'none';
|
||||
if (tabs) tabs.classList.add('oc-hidden');
|
||||
|
||||
var layoutBtn = document.getElementById('config-editor-layout');
|
||||
if (layoutBtn) layoutBtn.style.display = 'none';
|
||||
if (layoutBtn) layoutBtn.classList.add('oc-hidden');
|
||||
|
||||
if (!this.currentConfigFile) {
|
||||
this.currentConfigFile = '/etc/openclash/custom/openclash_custom_overwrite.sh';
|
||||
@@ -308,13 +301,14 @@ var ConfigEditor = {
|
||||
|
||||
this.model.classList.remove('maximized');
|
||||
this.model.classList.remove('minimized');
|
||||
this.resetModelStyles();
|
||||
|
||||
var editTitle = document.getElementById('editTitle');
|
||||
if (editTitle) {
|
||||
editTitle.textContent = '<%:Overwrite Edit%>: ';
|
||||
}
|
||||
|
||||
if (this.overwriteCardBar) this.overwriteCardBar.style.display = 'block';
|
||||
if (this.overwriteCardBar) this.overwriteCardBar.classList.remove('oc-hidden');
|
||||
this.loadOverwriteFiles();
|
||||
|
||||
var configNameElement = document.getElementById('config-file-name');
|
||||
@@ -341,7 +335,7 @@ var ConfigEditor = {
|
||||
}
|
||||
this._currentEditorMode = null;
|
||||
var textarea = document.getElementById('config-editor-textarea');
|
||||
if (textarea) textarea.style.display = '';
|
||||
if (textarea) textarea.classList.remove('oc-hidden');
|
||||
},
|
||||
|
||||
toggleFullscreen: function(forceState) {
|
||||
@@ -362,7 +356,6 @@ var ConfigEditor = {
|
||||
if (typeof _ocExitFullscreen === 'function') _ocExitFullscreen();
|
||||
}
|
||||
}
|
||||
ocUpdateTheme();
|
||||
},
|
||||
|
||||
hide: function() {
|
||||
@@ -373,7 +366,7 @@ var ConfigEditor = {
|
||||
|
||||
this.isModified = false;
|
||||
this.originalContent = '';
|
||||
this.overwriteCardBar.style.display = 'none';
|
||||
this.overwriteCardBar.classList.add('oc-hidden');
|
||||
if (!this.isOverwrite) {
|
||||
this.currentConfigFile = '';
|
||||
}
|
||||
@@ -385,9 +378,9 @@ var ConfigEditor = {
|
||||
|
||||
if (textarea) {
|
||||
ocHideLoading(textarea.parentNode);
|
||||
textarea.style.display = 'none';
|
||||
textarea.classList.add('oc-hidden');
|
||||
}
|
||||
if (mergeview) mergeview.style.display = 'none';
|
||||
if (mergeview) mergeview.classList.add('oc-hidden');
|
||||
if (layoutBtn) {
|
||||
layoutBtn.classList.remove('active');
|
||||
layoutBtn.title = "<%:Compare%>";
|
||||
@@ -396,6 +389,20 @@ var ConfigEditor = {
|
||||
if (editor_help) editor_help.innerHTML = '<%:Press%> <b style="color:var(--success-color)">F11</b> <%:for fullscreen,%> <b style="color:var(--success-color)">Esc</b> <%:to exit fullscreen,%> <b style="color:var(--success-color)">Ctrl + <%:Mouse Wheel%></b> <%:to zoom%>';
|
||||
},
|
||||
|
||||
resetModelStyles: function() {
|
||||
if (!this.model) return;
|
||||
this.model.style.position = '';
|
||||
this.model.style.left = '';
|
||||
this.model.style.top = '';
|
||||
this.model.style.right = '';
|
||||
this.model.style.bottom = '';
|
||||
this.model.style.margin = '';
|
||||
this.model.style.transform = '';
|
||||
this.model.style.transition = '';
|
||||
this.model.style.width = '';
|
||||
this.model.style.height = '';
|
||||
},
|
||||
|
||||
formatDisplayName: function(fileName) {
|
||||
if (!fileName) return '<%:Unknown%>';
|
||||
|
||||
@@ -449,7 +456,7 @@ var ConfigEditor = {
|
||||
var statusText = document.getElementById('config-editor-status-text');
|
||||
var textarea = document.getElementById('config-editor-textarea');
|
||||
var mergeview = document.getElementById('config-mergeview-container');
|
||||
if (mergeview) mergeview.style.display = 'none';
|
||||
if (mergeview) mergeview.classList.add('oc-hidden');
|
||||
|
||||
statusText.textContent = '<%:Loading...%>';
|
||||
|
||||
@@ -485,7 +492,7 @@ var ConfigEditor = {
|
||||
});
|
||||
self.isModified = false;
|
||||
self.updateSaveButtonState();
|
||||
textarea.style.display = 'none';
|
||||
textarea.classList.add('oc-hidden');
|
||||
ocHideLoading(textarea.parentNode);
|
||||
return;
|
||||
}
|
||||
@@ -553,7 +560,7 @@ var ConfigEditor = {
|
||||
parent: parent
|
||||
});
|
||||
|
||||
textarea.style.display = 'none';
|
||||
textarea.classList.add('oc-hidden');
|
||||
self.editorInstance.dom.style.height = '100%';
|
||||
ocHideLoading(textarea.parentNode);
|
||||
|
||||
@@ -612,12 +619,12 @@ var ConfigEditor = {
|
||||
var editor_help = document.getElementById('config-editor-help');
|
||||
var statusText = document.getElementById('config-editor-status-text');
|
||||
|
||||
if (tabs) tabs.style.display = 'none';
|
||||
if (tabs) tabs.classList.add('oc-hidden');
|
||||
if (textarea) {
|
||||
textarea.style.display = 'none';
|
||||
textarea.classList.add('oc-hidden');
|
||||
ocHideLoading(textarea.parentNode);
|
||||
}
|
||||
if (container) container.style.display = 'block';
|
||||
if (container) container.classList.remove('oc-hidden');
|
||||
if (statusText) statusText.textContent = '<%:Loading...%>';
|
||||
if (editor_help) editor_help.innerHTML = '<%:Press%> <b style="color:var(--success-color)">F10</b> <%:to toggle differences,%> <b style="color:var(--success-color)">F11</b> <%:for fullscreen,%> <b style="color:var(--success-color)">Esc</b> <%:to exit fullscreen,%> <b style="color:var(--success-color)">Ctrl + <%:Mouse Wheel%></b> <%:to zoom%>';
|
||||
|
||||
@@ -703,10 +710,10 @@ var ConfigEditor = {
|
||||
var layoutBtn = document.getElementById('config-editor-layout');
|
||||
if (container) {
|
||||
container.innerHTML = '';
|
||||
container.style.display = 'none';
|
||||
container.classList.add('oc-hidden');
|
||||
}
|
||||
if (textarea) textarea.style.display = 'block';
|
||||
if (!this.isOverwrite && tabs) tabs.style.display = 'flex';
|
||||
if (textarea) textarea.classList.remove('oc-hidden');
|
||||
if (!this.isOverwrite && tabs) tabs.classList.remove('oc-hidden');
|
||||
this.mergeViewActive = false;
|
||||
window._mergeViewInstance = null;
|
||||
this.loadConfigContent();
|
||||
@@ -917,7 +924,7 @@ var ConfigEditor = {
|
||||
var addCard = document.createElement('div');
|
||||
addCard.className = 'sub-card overwrite-item';
|
||||
addCard.style.cursor = 'pointer';
|
||||
addCard.innerHTML = '<div class="overwrite-add-icon">+</div>';
|
||||
addCard.innerHTML = '<div class="overwrite-add-icon"><svg width="20" height="20"><use href="#oc-icon-add"/></svg></div>';
|
||||
addCard.title = '<%:Add New File%>';
|
||||
addCard.onclick = function() {
|
||||
ConfigEditor.showAddOverwritemodel();
|
||||
@@ -1057,7 +1064,7 @@ var ConfigEditor = {
|
||||
refresh.className = 'icon-btn overwrite-refresh-btn';
|
||||
refresh.type = 'button';
|
||||
refresh.title = '<%:Refresh Subscription%>';
|
||||
refresh.innerHTML = '<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><polyline points="23 4 23 10 17 10"/><path d="M1 20v-6h6"/><path d="M3.51 9a9 9 0 0 1 14.13-3.36L23 10"/><path d="M1 14l4.35 4.35A9 9 0 0 0 20.49 15"/></svg>';
|
||||
refresh.innerHTML = '<svg width="16" height="16"><use href="#oc-icon-update"/></svg>';
|
||||
refresh.onclick = function(e) {
|
||||
e.stopPropagation();
|
||||
var statusText = document.getElementById('config-editor-status-text');
|
||||
@@ -1112,7 +1119,7 @@ var ConfigEditor = {
|
||||
gear.className = 'icon-btn overwrite-gear-btn';
|
||||
gear.type = 'button';
|
||||
gear.title = '<%:Edit Module Info%>';
|
||||
gear.innerHTML = '<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><circle cx="12" cy="12" r="3"/><path d="M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 1 1-2.83 2.83l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-4 0v-.09a1.65 1.65 0 0 0-1-1.51 1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 1 1-2.83-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1 0-4h.09a1.65 1.65 0 0 0 1.51-1 1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 1 1 2.83-2.83l.06.06a1.65 1.65 0 0 0 1.82.33h.09a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 4 0v.09a1.65 1.65 0 0 0 1 1.51h.09a1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 1 1 2.83 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82v.09a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 0 4h-.09a1.65 1.65 0 0 0-1.51 1z"/></svg>';
|
||||
gear.innerHTML = '<svg width="16" height="16"><use href="#oc-icon-gear"/></svg>';
|
||||
gear.onclick = function(e) {
|
||||
e.stopPropagation();
|
||||
ConfigEditor.showOverwriteSubmodel(name, sub, file.path);
|
||||
@@ -1123,7 +1130,7 @@ var ConfigEditor = {
|
||||
del.className = 'icon-btn overwrite-del-btn';
|
||||
del.type = 'button';
|
||||
del.title = '<%:Delete%>';
|
||||
del.innerHTML = '<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><polyline points="3 6 5 6 21 6"/><path d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h2a2 2 0 0 1 2 2v2"/></svg>';
|
||||
del.innerHTML = '<svg width="16" height="16"><use href="#oc-icon-trash"/></svg>';
|
||||
del.onclick = function(e) {
|
||||
e.stopPropagation();
|
||||
if (confirm('<%:Are you sure you want to delete this file and its subscription info?%>')) {
|
||||
@@ -1583,7 +1590,11 @@ var ConfigEditor = {
|
||||
ConfigEditor.overwriteDrag.isTouchDragging = false;
|
||||
});
|
||||
|
||||
bar.style.display = self.isOverwrite ? 'block' : 'none';
|
||||
if (self.isOverwrite) {
|
||||
bar.classList.remove('oc-hidden');
|
||||
} else {
|
||||
bar.classList.add('oc-hidden');
|
||||
}
|
||||
},
|
||||
|
||||
saveOverwriteSort: function() {
|
||||
@@ -1833,11 +1844,11 @@ var ConfigEditor = {
|
||||
removeBtn.className = 'icon-btn';
|
||||
removeBtn.title = '<%:Remove%>';
|
||||
removeBtn.style.cssText = 'flex-shrink: 0;';
|
||||
removeBtn.innerHTML = '<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><line x1="18" y1="6" x2="6" y2="18"></line><line x1="6" y1="6" x2="18" y2="18"></line></svg>';
|
||||
removeBtn.innerHTML = '<svg width="14" height="14"><use href="#oc-icon-close"/></svg>';
|
||||
removeBtn.addEventListener('click', function() {
|
||||
row.parentNode.removeChild(row);
|
||||
if (container.children.length === 0) {
|
||||
container.style.display = 'none';
|
||||
container.classList.add('oc-hidden');
|
||||
}
|
||||
});
|
||||
|
||||
@@ -1845,7 +1856,7 @@ var ConfigEditor = {
|
||||
row.appendChild(valueInput);
|
||||
row.appendChild(removeBtn);
|
||||
container.appendChild(row);
|
||||
container.style.display = 'block';
|
||||
container.classList.remove('oc-hidden');
|
||||
},
|
||||
|
||||
buildOverwriteParamRows: function(container, paramStr) {
|
||||
@@ -1903,20 +1914,11 @@ var ConfigEditor = {
|
||||
<div class="upload-mode-selector">
|
||||
<div class="mode-tabs">
|
||||
<button type="button" class="mode-tab${activeTab==='file'?' active':''}" id="overwrite-upload-mode-file" data-mode="file">
|
||||
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
||||
<path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"></path>
|
||||
<polyline points="17,11 12,6 7,11"></polyline>
|
||||
<line x1="12" y1="18" x2="12" y2="6"></line>
|
||||
</svg>
|
||||
<svg width="16" height="16"><use href="#oc-icon-upload"/></svg>
|
||||
<%:Upload File%>
|
||||
</button>
|
||||
<button type="button" class="mode-tab${activeTab==='subscribe'?' active':''}" id="overwrite-upload-mode-subscribe" data-mode="subscribe">
|
||||
<svg width="15" height="15" viewBox="0 0 48 48" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M26.2401 16.373L17.1001 7.23303C14.4388 4.57168 10.0653 4.6303 7.33158 7.36397C4.59791 10.0976 4.53929 14.4712 7.20064 17.1325L15.1359 25.0678" stroke="currentColor" stroke-width="4" stroke-linecap="round" stroke-linejoin="round"></path>
|
||||
<path d="M32.9027 23.0031L40.838 30.9384C43.4994 33.5998 43.4407 37.9733 40.7071 40.707C37.9734 43.4407 33.5999 43.4993 30.9385 40.8379L21.7985 31.6979" stroke="currentColor" stroke-width="4" stroke-linecap="round" stroke-linejoin="round"></path>
|
||||
<path d="M26.1093 26.1416C28.843 23.4079 28.9016 19.0344 26.2403 16.373" stroke="currentColor" stroke-width="4" stroke-linecap="round" stroke-linejoin="round"></path>
|
||||
<path d="M21.7989 21.7984C19.0652 24.5321 19.0066 28.9056 21.6679 31.5669" stroke="currentColor" stroke-width="4" stroke-linecap="round" stroke-linejoin="round"></path>
|
||||
</svg>
|
||||
<svg width="15" height="15"><use href="#oc-icon-link"/></svg>
|
||||
<%:Subscribe Link%>
|
||||
</button>
|
||||
</div>
|
||||
@@ -1925,25 +1927,21 @@ var ConfigEditor = {
|
||||
|
||||
var fileContent = `
|
||||
<form id="overwrite-upload-form-file" style="display:${activeTab==='file'?'block':'none'};">
|
||||
<div class="form-group" style="margin-bottom:20px;">
|
||||
<div class="form-group oc-mb-5">
|
||||
<label for="overwrite-upload-config"><%:Config File%>:</label>
|
||||
${fileConfigDropdown}
|
||||
</div>
|
||||
<div class="upload-zone" id="overwrite-upload-zone">
|
||||
<div class="upload-icon">
|
||||
<svg width="48" height="48" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1">
|
||||
<path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"></path>
|
||||
<polyline points="17,11 12,6 7,11"></polyline>
|
||||
<line x1="12" y1="18" x2="12" y2="6"></line>
|
||||
</svg>
|
||||
<svg width="48" height="48"><use href="#oc-icon-upload-feather"/></svg>
|
||||
</div>
|
||||
<div class="upload-text">
|
||||
<p class="upload-primary"><%:Click to select file or drag and drop%></p>
|
||||
<p class="upload-secondary"><%:Support txt,conf files, max size 10MB%></p>
|
||||
</div>
|
||||
<input type="file" id="overwrite-upload-file-input" accept=".txt,.conf,*" style="display: none;">
|
||||
<input type="file" id="overwrite-upload-file-input" accept=".txt,.conf,*" class="oc-hidden">
|
||||
</div>
|
||||
<div class="filename-input-container" style="margin-top:20px;">
|
||||
<div class="filename-input-container oc-mt-5">
|
||||
<label for="overwrite-upload-filename-input"><%:File Name%>:</label>
|
||||
<input type="text" id="overwrite-upload-filename-input" placeholder="<%:Please enter a filename%>" class="form-input" value="${name}" ${readonly ? 'readonly' : ''}/>
|
||||
</div>
|
||||
@@ -2000,10 +1998,10 @@ var ConfigEditor = {
|
||||
<div class="form-group" id="overwrite-subscribe-param-group" style="display:'block';">
|
||||
<label><%:Environment variable%>:</label>
|
||||
<div class="form-help" style="margin-bottom: unset;"><%:Set environment variables for the overwrite script%></div>
|
||||
<div id="overwrite-subscribe-param-container" style="display:none;"></div>
|
||||
<button type="button" id="overwrite-subscribe-param-add" class="btn upload-btn" style="align-self: flex-start; margin-top: 4px; padding: 4px 12px; font-size: 13px; border: 1px solid var(--primary-color); border-radius: var(--radius-sm); cursor: pointer;">+ <%:Add Param%></button>
|
||||
<div id="overwrite-subscribe-param-container" class="oc-hidden"></div>
|
||||
<button type="button" id="overwrite-subscribe-param-add" class="add-row-btn"><svg><use href="#oc-icon-add"/></svg><span><%:Add Param%></span></button>
|
||||
</div>
|
||||
<div class="upload-progress" id="overwrite-upload-progress" style="display:none;">
|
||||
<div class="upload-progress oc-hidden" id="overwrite-upload-progress">
|
||||
<div class="progress-bar">
|
||||
<div class="progress-fill" id="overwrite-progress-fill" style="width:0%;"></div>
|
||||
</div>
|
||||
@@ -2048,10 +2046,7 @@ var ConfigEditor = {
|
||||
</div>
|
||||
<div class="config-upload-actions">
|
||||
<button type="button" class="icon-btn" id="overwrite-add-close" title="<%:Close%>">
|
||||
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
||||
<line x1="18" y1="6" x2="6" y2="18"></line>
|
||||
<line x1="6" y1="6" x2="18" y2="18"></line>
|
||||
</svg>
|
||||
<svg width="14" height="14"><use href="#oc-icon-close"/></svg>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -2296,7 +2291,7 @@ var ConfigEditor = {
|
||||
var progressText = form.querySelector('#overwrite-progress-text');
|
||||
if (type === 'http') {
|
||||
statusText.textContent = '<%:Downloading subscription content...%>';
|
||||
progressContainer.style.display = 'block';
|
||||
progressContainer.classList.remove('oc-hidden');
|
||||
var progress = 0;
|
||||
var interval = setInterval(function() {
|
||||
progress = Math.min(progress + Math.random() * 20, 90);
|
||||
@@ -2362,10 +2357,7 @@ var ConfigEditor = {
|
||||
</div>
|
||||
<div class="config-upload-actions">
|
||||
<button type="button" class="icon-btn" id="overwrite-sub-close" title="<%:Close%>">
|
||||
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
||||
<line x1="18" y1="6" x2="6" y2="18"></line>
|
||||
<line x1="6" y1="6" x2="18" y2="18"></line>
|
||||
</svg>
|
||||
<svg width="14" height="14"><use href="#oc-icon-close"/></svg>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -2506,7 +2498,7 @@ var ConfigEditor = {
|
||||
var statusText = model.querySelector('#overwrite-edit-status-text');
|
||||
if (type === 'http') {
|
||||
statusText.textContent = '<%:Downloading subscription content...%>';
|
||||
progressContainer.style.display = 'block';
|
||||
progressContainer.classList.remove('oc-hidden');
|
||||
var progress = 0;
|
||||
var interval = setInterval(function() {
|
||||
progress = Math.min(progress + Math.random() * 20, 90);
|
||||
@@ -2616,18 +2608,15 @@ var ConfigEditor = {
|
||||
makeDraggable: function() {
|
||||
var self = this;
|
||||
var header = this.model.querySelector('.config-editor-header');
|
||||
var startX, startY, startLeft, startTop;
|
||||
var isDragging = false;
|
||||
var startX = 0, startY = 0, startLeft = 0, startTop = 0;
|
||||
|
||||
header.addEventListener('mousedown', function(e) {
|
||||
header.addEventListener('pointerdown', function(e) {
|
||||
if (isDragging) return;
|
||||
var target = e.target && e.target.nodeType === 1 ? e.target : e.target.parentElement;
|
||||
if (target && target.closest('.config-editor-actions')) {
|
||||
return;
|
||||
}
|
||||
if (target && target.closest('.config-editor-actions')) return;
|
||||
var textEl = target ? target.closest('#editTitle, #config-file-name') : null;
|
||||
if (textEl && self.isPointOnTextContent(textEl, e.clientX, e.clientY)) {
|
||||
return;
|
||||
}
|
||||
if (textEl && self.isPointOnTextContent(textEl, e.clientX, e.clientY)) return;
|
||||
|
||||
isDragging = true;
|
||||
startX = e.clientX;
|
||||
@@ -2643,108 +2632,33 @@ var ConfigEditor = {
|
||||
self.model.style.margin = '0';
|
||||
self.model.style.transform = 'none';
|
||||
self.model.style.transition = 'none';
|
||||
|
||||
document.addEventListener('mousemove', onMouseMove);
|
||||
document.addEventListener('mouseup', onMouseUp);
|
||||
|
||||
header.style.touchAction = 'none';
|
||||
if (header.setPointerCapture) {
|
||||
try { header.setPointerCapture(e.pointerId); } catch(err) {}
|
||||
}
|
||||
e.preventDefault();
|
||||
});
|
||||
|
||||
function onMouseMove(e) {
|
||||
header.addEventListener('pointermove', function(e) {
|
||||
if (!isDragging) return;
|
||||
|
||||
var deltaX = e.clientX - startX;
|
||||
var deltaY = e.clientY - startY;
|
||||
|
||||
var newLeft = startLeft + deltaX;
|
||||
var newTop = startTop + deltaY;
|
||||
|
||||
var modelRect = self.model.getBoundingClientRect();
|
||||
var maxLeft = window.innerWidth - modelRect.width;
|
||||
var maxTop = window.innerHeight - modelRect.height;
|
||||
|
||||
newLeft = Math.max(0, Math.min(newLeft, maxLeft));
|
||||
newTop = Math.max(0, Math.min(newTop, maxTop));
|
||||
|
||||
var rect = self.model.getBoundingClientRect();
|
||||
var newLeft = Math.max(0, Math.min(startLeft + (e.clientX - startX), window.innerWidth - rect.width));
|
||||
var newTop = Math.max(0, Math.min(startTop + (e.clientY - startY), window.innerHeight - rect.height));
|
||||
self.model.style.left = newLeft + 'px';
|
||||
self.model.style.top = newTop + 'px';
|
||||
}
|
||||
|
||||
function onMouseUp() {
|
||||
isDragging = false;
|
||||
|
||||
setTimeout(function() {
|
||||
self.model.style.transition = 'all 0.3s ease';
|
||||
}, 50);
|
||||
|
||||
document.removeEventListener('mousemove', onMouseMove);
|
||||
document.removeEventListener('mouseup', onMouseUp);
|
||||
}
|
||||
|
||||
header.addEventListener('touchstart', function(e) {
|
||||
var target = e.target && e.target.nodeType === 1 ? e.target : e.target.parentElement;
|
||||
if (target && target.closest('.config-editor-actions')) {
|
||||
return;
|
||||
}
|
||||
var touch = e.touches && e.touches[0] ? e.touches[0] : null;
|
||||
var textEl = target ? target.closest('#editTitle, #config-file-name') : null;
|
||||
if (touch && textEl && self.isPointOnTextContent(textEl, touch.clientX, touch.clientY)) {
|
||||
return;
|
||||
}
|
||||
if (e.touches.length !== 1) return;
|
||||
|
||||
isDragging = true;
|
||||
startX = e.touches[0].clientX;
|
||||
startY = e.touches[0].clientY;
|
||||
|
||||
var rect = self.model.getBoundingClientRect();
|
||||
startLeft = rect.left;
|
||||
startTop = rect.top;
|
||||
|
||||
self.model.style.position = 'fixed';
|
||||
self.model.style.left = startLeft + 'px';
|
||||
self.model.style.top = startTop + 'px';
|
||||
self.model.style.margin = '0';
|
||||
self.model.style.transform = 'none';
|
||||
self.model.style.transition = 'none';
|
||||
|
||||
document.addEventListener('touchmove', onTouchMove, {passive: false});
|
||||
document.addEventListener('touchend', onTouchEnd);
|
||||
|
||||
e.preventDefault();
|
||||
});
|
||||
|
||||
function onTouchMove(e) {
|
||||
if (!isDragging || e.touches.length !== 1) return;
|
||||
|
||||
var deltaX = e.touches[0].clientX - startX;
|
||||
var deltaY = e.touches[0].clientY - startY;
|
||||
|
||||
var newLeft = startLeft + deltaX;
|
||||
var newTop = startTop + deltaY;
|
||||
|
||||
var modelRect = self.model.getBoundingClientRect();
|
||||
var maxLeft = window.innerWidth - modelRect.width;
|
||||
var maxTop = window.innerHeight - modelRect.height;
|
||||
|
||||
newLeft = Math.max(0, Math.min(newLeft, maxLeft));
|
||||
newTop = Math.max(0, Math.min(newTop, maxTop));
|
||||
|
||||
self.model.style.left = newLeft + 'px';
|
||||
self.model.style.top = newTop + 'px';
|
||||
|
||||
e.preventDefault();
|
||||
}
|
||||
|
||||
function onTouchEnd() {
|
||||
function stopDrag(e) {
|
||||
if (!isDragging) return;
|
||||
isDragging = false;
|
||||
setTimeout(function() {
|
||||
self.model.style.transition = 'all 0.3s ease';
|
||||
}, 50);
|
||||
|
||||
document.removeEventListener('touchmove', onTouchMove);
|
||||
document.removeEventListener('touchend', onTouchEnd);
|
||||
header.style.touchAction = '';
|
||||
self.model.style.transition = '';
|
||||
if (header.releasePointerCapture) {
|
||||
try { header.releasePointerCapture(e.pointerId); } catch(err) {}
|
||||
}
|
||||
}
|
||||
header.addEventListener('pointerup', stopDrag);
|
||||
header.addEventListener('pointercancel', stopDrag);
|
||||
},
|
||||
|
||||
makeResizable: function() {
|
||||
|
||||
@@ -12,7 +12,6 @@ local path_info = os.getenv("PATH_INFO") or ""
|
||||
local sid = path_info:match("(cfg[0-9a-f]+)") or ""
|
||||
-%>
|
||||
|
||||
<%+openclash/common%>
|
||||
<script type="text/javascript">//<![CDATA[
|
||||
|
||||
ocRegisterEditorHotkeys();
|
||||
@@ -47,7 +46,6 @@ function editor(id, readOnly, wid, height) {
|
||||
});
|
||||
id.parentNode.insertBefore(view.dom, id.nextSibling);
|
||||
ocHideLoading(id.parentNode);
|
||||
ocUpdateTheme();
|
||||
if (wid && height) {
|
||||
view.dom.style.width = wid;
|
||||
view.dom.style.height = height;
|
||||
@@ -75,7 +73,6 @@ function shell_editor(id, readOnly, wid, height) {
|
||||
});
|
||||
id.parentNode.insertBefore(view.dom, id.nextSibling);
|
||||
ocHideLoading(id.parentNode);
|
||||
ocUpdateTheme();
|
||||
if (wid && height) {
|
||||
view.dom.style.width = wid;
|
||||
view.dom.style.height = height;
|
||||
@@ -103,7 +100,6 @@ function other_editor(id, readOnly, wid, height) {
|
||||
});
|
||||
id.parentNode.insertBefore(view.dom, id.nextSibling);
|
||||
ocHideLoading(id.parentNode);
|
||||
ocUpdateTheme();
|
||||
if (wid && height) {
|
||||
view.dom.style.width = wid;
|
||||
view.dom.style.height = height;
|
||||
@@ -131,8 +127,16 @@ function log_editor(id, name, readOnly, wid, height) {
|
||||
});
|
||||
id.parentNode.insertBefore(view.dom, id.nextSibling);
|
||||
ocHideLoading(id.parentNode);
|
||||
ocUpdateTheme();
|
||||
if (CM6.dispatchTheme) CM6.dispatchTheme(view, isDark);
|
||||
window['editor_' + name] = view;
|
||||
if (id.value && id.value.length > 0) {
|
||||
requestAnimationFrame(function() {
|
||||
if (view.state && view.state.doc) {
|
||||
var txt = view.state.doc.toString();
|
||||
if (txt) view.dispatch({ changes: { from: 0, to: view.state.doc.length, insert: txt } });
|
||||
}
|
||||
});
|
||||
}
|
||||
if (wid && height) {
|
||||
view.dom.style.width = wid;
|
||||
view.dom.style.height = height;
|
||||
@@ -176,8 +180,16 @@ function markdown_editor(id, name, readOnly, wid, height) {
|
||||
});
|
||||
id.parentNode.insertBefore(view.dom, id.nextSibling);
|
||||
ocHideLoading(id.parentNode);
|
||||
ocUpdateTheme();
|
||||
if (CM6.dispatchTheme) CM6.dispatchTheme(view, isDark);
|
||||
window['editor_' + name] = view;
|
||||
if (id.value && id.value.length > 0) {
|
||||
requestAnimationFrame(function() {
|
||||
if (view.state && view.state.doc) {
|
||||
var txt = view.state.doc.toString();
|
||||
if (txt) view.dispatch({ changes: { from: 0, to: view.state.doc.length, insert: txt } });
|
||||
}
|
||||
});
|
||||
}
|
||||
if (wid && height) {
|
||||
view.dom.style.width = wid;
|
||||
view.dom.style.height = height;
|
||||
|
||||
@@ -7,23 +7,16 @@
|
||||
<script src="/luci-static/resources/openclash/js/cm6.min.js?v=<%=plugin_version%>"></script>
|
||||
<script src="/luci-static/resources/openclash/js/oc-icons.js?v=<%=plugin_version%>"></script>
|
||||
|
||||
<div id="my_editor_div" style="display:flex;">
|
||||
<div id="config-mode-tabs" style="display:flex;width:100%;">
|
||||
<div id="my_editor_div" class="oc-flex-center">
|
||||
<div id="config-mode-tabs" class="oc-flex-center" style="width:100%;">
|
||||
<div class="mode-tabs">
|
||||
<button type="button" class="mode-tab active" id="tab-original-config">
|
||||
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" style="vertical-align:middle;margin-right:4px;">
|
||||
<rect x="4" y="4" width="16" height="16" rx="2" stroke="currentColor" stroke-width="2" fill="none"/>
|
||||
<line x1="8" y1="8" x2="16" y2="8" stroke="currentColor" stroke-width="2"/>
|
||||
<line x1="8" y1="12" x2="16" y2="12" stroke="currentColor" stroke-width="2"/>
|
||||
<line x1="8" y1="16" x2="12" y2="16" stroke="currentColor" stroke-width="2"/>
|
||||
</svg>
|
||||
<%:Original Config%>
|
||||
</button>
|
||||
<button type="button" class="mode-tab" id="tab-runtime-config">
|
||||
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" style="vertical-align:middle;margin-right:4px;">
|
||||
<polygon points="13 2 3 14 12 14 11 22 21 10 13 10 13 2" stroke="currentColor" stroke-width="2" fill="none"/>
|
||||
</svg>
|
||||
<%:Runtime Config%>
|
||||
<svg width="16" height="16"><use href="#oc-icon-list"/></svg>
|
||||
<span><%:Original Config%></span>
|
||||
</button>
|
||||
<button type="button" class="mode-tab" id="tab-runtime-config">
|
||||
<svg width="16" height="16"><use href="#oc-icon-zap"/></svg>
|
||||
<span><%:Runtime Config%></span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -33,9 +26,9 @@
|
||||
<svg width="24" height="24"><use href="#oc-icon-compare"/></svg>
|
||||
</button>
|
||||
|
||||
<div id="oc-merge-help" style="display:none;">
|
||||
<div id="oc-merge-help" class="oc-hidden">
|
||||
<span id="oc-merge-help-normal"><%:Press%> <b style="color:var(--success-color)">F11</b> <%:for fullscreen,%> <b style="color:var(--success-color)">Esc</b> <%:to exit fullscreen,%> <b style="color:var(--success-color)">Ctrl + <%:Mouse Wheel%></b> <%:to zoom%></span>
|
||||
<span id="oc-merge-help-merge" style="display:none;"><%:Press%> <b style="color:var(--success-color)">F10</b> <%:to toggle differences,%> <b style="color:var(--success-color)">F11</b> <%:for fullscreen,%> <b style="color:var(--success-color)">Esc</b> <%:to exit fullscreen,%> <b style="color:var(--success-color)">Ctrl + <%:Mouse Wheel%></b> <%:to zoom%></span>
|
||||
<span id="oc-merge-help-merge" class="oc-hidden"><%:Press%> <b style="color:var(--success-color)">F10</b> <%:to toggle differences,%> <b style="color:var(--success-color)">F11</b> <%:for fullscreen,%> <b style="color:var(--success-color)">Esc</b> <%:to exit fullscreen,%> <b style="color:var(--success-color)">Ctrl + <%:Mouse Wheel%></b> <%:to zoom%></span>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">//<![CDATA[
|
||||
@@ -88,7 +81,7 @@ function config_merge_editor(id, id2, target, target2, readOnly, readOnly2, wid,
|
||||
|
||||
var helpEl = document.getElementById('oc-merge-help');
|
||||
if (helpEl) {
|
||||
helpEl.style.display = 'inline';
|
||||
helpEl.classList.remove('oc-hidden');
|
||||
var footer = document.createElement('div');
|
||||
footer.className = 'config-editor-footer';
|
||||
footer.style.cssText = 'border-radius:var(--radius-sm);margin: 8px 0;';
|
||||
@@ -171,7 +164,7 @@ function config_merge_editor(id, id2, target, target2, readOnly, readOnly2, wid,
|
||||
if (state.isMerge) {
|
||||
state.showUse = true;
|
||||
_createSingleMergeEditor(state.useContent, false);
|
||||
document.getElementById('my_editor_div').style.display = 'flex';
|
||||
document.getElementById('my_editor_div').classList.remove('oc-hidden');
|
||||
} else if (!state.showUse) {
|
||||
state.showUse = true;
|
||||
_switchSingleTab(state.useContent, false);
|
||||
@@ -197,7 +190,7 @@ function config_merge_editor(id, id2, target, target2, readOnly, readOnly2, wid,
|
||||
if (state.isMerge) {
|
||||
state.showUse = false;
|
||||
_createSingleMergeEditor(state.defContent, true);
|
||||
document.getElementById('my_editor_div').style.display = 'flex';
|
||||
document.getElementById('my_editor_div').classList.remove('oc-hidden');
|
||||
} else if (state.showUse) {
|
||||
state.showUse = false;
|
||||
_switchSingleTab(state.defContent, true);
|
||||
@@ -263,7 +256,7 @@ function _createSingleMergeEditor(content, readOnly) {
|
||||
}));
|
||||
|
||||
var mergeStatus = document.querySelector('.config-editor-status');
|
||||
if (mergeStatus) mergeStatus.style.display = 'none';
|
||||
if (mergeStatus) mergeStatus.classList.add('oc-hidden');
|
||||
|
||||
var view = new CM6.EditorView({
|
||||
state: CM6.EditorState.create({ doc: content, extensions: exts }),
|
||||
@@ -338,9 +331,9 @@ function _renderMergeView() {
|
||||
if (btn && mv.dom) mv.dom.appendChild(btn);
|
||||
|
||||
var mergeStatus = document.querySelector('.config-editor-status');
|
||||
if (mergeStatus) mergeStatus.style.display = '';
|
||||
if (mergeStatus) mergeStatus.classList.remove('oc-hidden');
|
||||
var mergeLabel = document.getElementById('oc-merge-mode-label');
|
||||
if (mergeLabel) mergeLabel.style.display = 'inline';
|
||||
if (mergeLabel) mergeLabel.classList.remove('oc-hidden');
|
||||
|
||||
window._mergeViewInstance = mv;
|
||||
window._ocMergeShowDifferences = true;
|
||||
@@ -374,8 +367,14 @@ function _destroyMergeInstance() {
|
||||
function _updateMergeHelpText(isMerge) {
|
||||
var helpNormal = document.getElementById('oc-merge-help-normal');
|
||||
var helpMerge = document.getElementById('oc-merge-help-merge');
|
||||
if (helpNormal) helpNormal.style.display = isMerge ? 'none' : 'inline';
|
||||
if (helpMerge) helpMerge.style.display = isMerge ? 'inline' : 'none';
|
||||
if (helpNormal) {
|
||||
if (isMerge) helpNormal.classList.add('oc-hidden');
|
||||
else helpNormal.classList.remove('oc-hidden');
|
||||
}
|
||||
if (helpMerge) {
|
||||
if (isMerge) helpMerge.classList.remove('oc-hidden');
|
||||
else helpMerge.classList.add('oc-hidden');
|
||||
}
|
||||
}
|
||||
|
||||
function _toggleMergeView() {
|
||||
@@ -396,10 +395,10 @@ function _toggleMergeView() {
|
||||
if (state.isMerge) {
|
||||
state.showUse = true;
|
||||
_createSingleMergeEditor(state.useContent, false);
|
||||
document.getElementById('my_editor_div').style.display = 'flex';
|
||||
document.getElementById('my_editor_div').classList.remove('oc-hidden');
|
||||
} else {
|
||||
_renderMergeView();
|
||||
document.getElementById('my_editor_div').style.display = 'none';
|
||||
document.getElementById('my_editor_div').classList.add('oc-hidden');
|
||||
}
|
||||
_updateMergeToggleBtn();
|
||||
_updateMergeTabs(state.isMerge);
|
||||
@@ -465,7 +464,6 @@ if (myEditor_use && myEditor_def) {
|
||||
myEditor_div_use.parentNode.style.width = "100%";
|
||||
|
||||
config_merge_editor(myEditor_use, myEditor_def, myEditor_div_use, myEditor_div_def, true, false, 'auto', '700px');
|
||||
ocUpdateTheme();
|
||||
}
|
||||
})();
|
||||
//]]>
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
<div class="upload-mode-selector">
|
||||
<div class="mode-tabs">
|
||||
<button type="button" class="mode-tab active" id="upload-mode-file" data-mode="file">
|
||||
<svg width="16" height="16"><use href="#oc-icon-download"/></svg>
|
||||
<svg width="16" height="16"><use href="#oc-icon-upload"/></svg>
|
||||
<%:Upload File%>
|
||||
</button>
|
||||
<button type="button" class="mode-tab" id="upload-mode-subscribe" data-mode="subscribe">
|
||||
@@ -34,13 +34,13 @@
|
||||
<div class="upload-mode-content" id="mode-file-content">
|
||||
<div class="upload-zone" id="upload-zone">
|
||||
<div class="upload-icon">
|
||||
<svg width="48" height="48"><use href="#oc-icon-download"/></svg>
|
||||
<svg width="48" height="48"><use href="#oc-icon-upload"/></svg>
|
||||
</div>
|
||||
<div class="upload-text">
|
||||
<div class="upload-primary"><%:Click to select file or drag and drop%></div>
|
||||
<div class="upload-secondary"><%:Support YAML file, max size 10MB%></div>
|
||||
</div>
|
||||
<input type="file" id="config-file-input" accept=".yaml,.yml" style="display: none;">
|
||||
<input type="file" id="config-file-input" accept=".yaml,.yml" class="oc-hidden">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
@@ -52,11 +52,11 @@
|
||||
<div class="form-help"><%:Show more upload options%></div>
|
||||
</div>
|
||||
|
||||
<div class="advanced-options-container" id="advanced-options-container-file" style="display: none;">
|
||||
<div class="advanced-options-container oc-hidden" id="advanced-options-container-file">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="upload-mode-content" id="mode-subscribe-content" style="display: none;">
|
||||
<div class="upload-mode-content oc-hidden" id="mode-subscribe-content">
|
||||
<div class="subscribe-form">
|
||||
<div class="form-group">
|
||||
<label for="subscribe-url-input"><%:Subscription URL%>:</label>
|
||||
@@ -74,14 +74,14 @@
|
||||
<option value="custom"><%:Custom%></option>
|
||||
</select>
|
||||
</div>
|
||||
<input type="text" id="subscribe-ua-custom" placeholder="<%:Enter custom User-Agent%>" class="form-input" style="display: none; margin-top: 8px;" />
|
||||
<input type="text" id="subscribe-ua-custom" placeholder="<%:Enter custom User-Agent%>" class="form-input oc-hidden" style="margin-top: 8px;" />
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label><%:Custom Headers%> (<%:Optional%>):</label>
|
||||
<div class="form-help" style="margin-bottom: unset;"><%:Add custom HTTP headers to the subscription request%></div>
|
||||
<div id="subscribe-headers-container" style="display:none;"></div>
|
||||
<button type="button" id="subscribe-headers-add" class="btn upload-btn" style="align-self: flex-start; margin-top: 4px; padding: 4px 12px; font-size: 13px; border: 1px solid var(--primary-color); border-radius: var(--radius-sm); cursor: pointer;">+ <%:Add Header%></button>
|
||||
<div class="form-help" style="margin-bottom:0;"><%:Add custom HTTP headers to the subscription request%></div>
|
||||
<div id="subscribe-headers-container" class="oc-hidden"></div>
|
||||
<button type="button" id="subscribe-headers-add" class="add-row-btn"><svg><use href="#oc-icon-add"/></svg><span><%:Add Header%></span></button>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
@@ -93,7 +93,7 @@
|
||||
<div class="form-help"><%:Show more subscription options%></div>
|
||||
</div>
|
||||
|
||||
<div class="advanced-options-container" id="advanced-options-container" style="display: none;">
|
||||
<div class="advanced-options-container oc-hidden" id="advanced-options-container">
|
||||
<div class="form-group">
|
||||
<label class="form-checkbox">
|
||||
<input type="checkbox" id="sub-convert-enable">
|
||||
@@ -103,7 +103,7 @@
|
||||
<div class="form-help"><%:Convert Subscribe Online With Template%></div>
|
||||
</div>
|
||||
|
||||
<div class="sub-convert-options" id="sub-convert-options" style="display: none;">
|
||||
<div class="sub-convert-options oc-hidden" id="sub-convert-options">
|
||||
<div class="form-group">
|
||||
<label for="convert-address-input"><%:Convert Address%>:</label>
|
||||
<div class="form-select-wrapper">
|
||||
@@ -113,7 +113,7 @@
|
||||
<option value="custom"><%:Custom%></option>
|
||||
</select>
|
||||
</div>
|
||||
<input type="text" id="convert-address-custom" placeholder="<%:Enter custom convert address%>" class="form-input" style="display: none; margin-top: 8px;" />
|
||||
<input type="text" id="convert-address-custom" placeholder="<%:Enter custom convert address%>" class="form-input oc-hidden" style="margin-top: 8px;" />
|
||||
<div id="subconverter-version-status-upload" class="subconverter-version-status" data-state="idle" hidden>
|
||||
<span class="subconverter-version-label"></span>
|
||||
<span class="subconverter-version-text"></span>
|
||||
@@ -148,7 +148,7 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group" id="custom-template-group" style="display: none;">
|
||||
<div class="form-group oc-hidden" id="custom-template-group">
|
||||
<label for="custom-template-input"><%:Custom Template URL%>:</label>
|
||||
<input type="text" id="custom-template-input" placeholder="<%:Enter custom template URL%>" class="form-input" />
|
||||
</div>
|
||||
@@ -251,9 +251,9 @@
|
||||
|
||||
<div class="form-group" id="age-encryption-group">
|
||||
<div class="form-group">
|
||||
<label style="display:block; margin-bottom:6px;"><%:Age Key Type%></label>
|
||||
<div style="display:flex; align-items:center;">
|
||||
<div style="flex:1;">
|
||||
<label style="display:block;margin-bottom:6px;"><%:Age Key Type%></label>
|
||||
<div class="oc-flex-center">
|
||||
<div class="oc-flex-1">
|
||||
<div class="form-select-wrapper">
|
||||
<select id="age-algo-select" class="form-select">
|
||||
<option value="keygen">x25519</option>
|
||||
@@ -261,7 +261,7 @@
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<button type="button" id="age-generate-btn" class="icon-btn" style="margin-left:8px;" title="<%:Generate Age Key%>">
|
||||
<button type="button" id="age-generate-btn" class="icon-btn oc-ml-2" title="<%:Generate Age Key%>">
|
||||
<svg width="16" height="16"><use href="#oc-icon-key"/></svg>
|
||||
</button>
|
||||
</div>
|
||||
@@ -270,9 +270,9 @@
|
||||
|
||||
<div class="form-group">
|
||||
<label for="age-secret-input"><%:Secret Key%>:</label>
|
||||
<div style="display:flex; align-items:center;">
|
||||
<input type="text" id="age-secret-input" class="form-input" style="flex:1;" />
|
||||
<button type="button" id="age-copy-secret" class="icon-btn" style="margin-left:8px;" title="<%:Copy%>">
|
||||
<div class="oc-flex-center">
|
||||
<input type="text" id="age-secret-input" class="form-input oc-flex-1" />
|
||||
<button type="button" id="age-copy-secret" class="icon-btn oc-ml-2" title="<%:Copy%>">
|
||||
<svg width="24" height="24"><use href="#oc-icon-copy-bold"/></svg>
|
||||
</button>
|
||||
</div>
|
||||
@@ -280,9 +280,9 @@
|
||||
|
||||
<div class="form-group">
|
||||
<label for="age-public-input"><%:Public Key%>:</label>
|
||||
<div style="display:flex; align-items:center;">
|
||||
<input type="text" id="age-public-input" class="form-input" style="flex:1;" />
|
||||
<button type="button" id="age-copy-public" class="icon-btn" style="margin-left:8px;" title="<%:Copy%>">
|
||||
<div class="oc-flex-center">
|
||||
<input type="text" id="age-public-input" class="form-input oc-flex-1" />
|
||||
<button type="button" id="age-copy-public" class="icon-btn oc-ml-2" title="<%:Copy%>">
|
||||
<svg width="24" height="24"><use href="#oc-icon-copy-bold"/></svg>
|
||||
</button>
|
||||
<button type="button" id="age-calculate-public" class="icon-btn" style="margin-left:8px;" title="<%:Calculate Public Key%>">
|
||||
@@ -300,7 +300,7 @@
|
||||
<div class="filename-extension">.yaml</div>
|
||||
</div>
|
||||
|
||||
<div class="upload-progress" id="upload-progress" style="display: none;">
|
||||
<div class="upload-progress oc-hidden" id="upload-progress">
|
||||
<div class="progress-bar">
|
||||
<div class="progress-fill" id="upload-progress-fill"></div>
|
||||
</div>
|
||||
@@ -318,7 +318,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="config-upload-model-overlay" id="subscription-url-overlay" style="display: none;">
|
||||
<div class="config-upload-model-overlay" id="subscription-url-overlay">
|
||||
<div class="config-upload-model" id="subscription-url-model">
|
||||
<div class="config-upload-header">
|
||||
<div class="config-upload-title"><%:Set Subscription Info URL%></div>
|
||||
@@ -429,7 +429,7 @@ var SubscriptionUrlSetter = {
|
||||
var textarea = document.getElementById('subscription-url-textarea');
|
||||
if (overlay && textarea) {
|
||||
textarea.value = '';
|
||||
overlay.style.display = 'flex';
|
||||
overlay.classList.add('show');
|
||||
textarea.focus();
|
||||
this.bindEvents();
|
||||
this.loadUrls();
|
||||
@@ -439,7 +439,7 @@ var SubscriptionUrlSetter = {
|
||||
hide: function() {
|
||||
var overlay = document.getElementById('subscription-url-overlay');
|
||||
if (overlay) {
|
||||
overlay.style.display = 'none';
|
||||
overlay.classList.remove('show');
|
||||
}
|
||||
this.unbindEvents();
|
||||
},
|
||||
@@ -647,17 +647,17 @@ var ConfigUploader = {
|
||||
filenameInput.addEventListener('input', this.updateSubmitButton.bind(this));
|
||||
|
||||
subscribeUaSelect.addEventListener('change', function() {
|
||||
subscribeUaCustom.style.display = this.value === 'custom' ? 'block' : 'none';
|
||||
subscribeUaCustom.classList.toggle('oc-hidden', this.value !== 'custom');
|
||||
});
|
||||
|
||||
advancedOptionsEnable.addEventListener('change', function() {
|
||||
if (this.checked) {
|
||||
advancedOptionsContainer.style.display = 'block';
|
||||
advancedOptionsContainer.classList.remove('oc-hidden');
|
||||
if (ageFormNode && advancedOptionsContainer && ageFormNode.parentNode !== advancedOptionsContainer) {
|
||||
advancedOptionsContainer.appendChild(ageFormNode);
|
||||
}
|
||||
} else {
|
||||
advancedOptionsContainer.style.display = 'none';
|
||||
advancedOptionsContainer.classList.add('oc-hidden');
|
||||
self.resetAdvancedOptions();
|
||||
self.updateSubmitButton();
|
||||
if (ageFormNode && advancedOptionsContainer && ageFormNode.parentNode !== advancedOptionsContainer) {
|
||||
@@ -669,12 +669,12 @@ var ConfigUploader = {
|
||||
if (advancedOptionsEnableFile) {
|
||||
advancedOptionsEnableFile.addEventListener('change', function() {
|
||||
if (this.checked) {
|
||||
advancedOptionsContainerFile.style.display = 'block';
|
||||
advancedOptionsContainerFile.classList.remove('oc-hidden');
|
||||
if (ageFormNode && advancedOptionsContainerFile && ageFormNode.parentNode !== advancedOptionsContainerFile) {
|
||||
advancedOptionsContainerFile.appendChild(ageFormNode);
|
||||
}
|
||||
} else {
|
||||
advancedOptionsContainerFile.style.display = 'none';
|
||||
advancedOptionsContainerFile.classList.add('oc-hidden');
|
||||
self.resetAdvancedOptions();
|
||||
self.updateSubmitButton();
|
||||
if (ageFormNode && advancedOptionsContainer && ageFormNode.parentNode === advancedOptionsContainerFile) {
|
||||
@@ -685,18 +685,18 @@ var ConfigUploader = {
|
||||
}
|
||||
|
||||
subConvertEnable.addEventListener('change', function() {
|
||||
subConvertOptions.style.display = this.checked ? 'block' : 'none';
|
||||
subConvertOptions.classList.toggle('oc-hidden', !this.checked);
|
||||
self.updateSubconverterVersionStatus();
|
||||
self.updateSubmitButton();
|
||||
});
|
||||
|
||||
convertAddressSelect.addEventListener('change', function() {
|
||||
convertAddressCustom.style.display = this.value === 'custom' ? 'block' : 'none';
|
||||
convertAddressCustom.classList.toggle('oc-hidden', this.value !== 'custom');
|
||||
self.updateSubconverterVersionStatus();
|
||||
});
|
||||
|
||||
templateSelect.addEventListener('change', function() {
|
||||
customTemplateGroup.style.display = this.value === '0' ? 'block' : 'none';
|
||||
customTemplateGroup.classList.toggle('oc-hidden', this.value !== '0');
|
||||
});
|
||||
|
||||
var ageGenerateBtn = document.getElementById('age-generate-btn');
|
||||
@@ -854,7 +854,7 @@ var ConfigUploader = {
|
||||
|
||||
if (hasAge && advFileEnable && advFileContainer) {
|
||||
advFileEnable.checked = true;
|
||||
advFileContainer.style.display = 'block';
|
||||
advFileContainer.classList.remove('oc-hidden');
|
||||
|
||||
if (ageNode && ageNode.parentNode !== advFileContainer) advFileContainer.appendChild(ageNode);
|
||||
}
|
||||
@@ -885,9 +885,9 @@ var ConfigUploader = {
|
||||
|
||||
resetAdvancedOptions: function() {
|
||||
document.getElementById('sub-convert-enable').checked = false;
|
||||
document.getElementById('sub-convert-options').style.display = 'none';
|
||||
document.getElementById('sub-convert-options').classList.add('oc-hidden');
|
||||
document.getElementById('convert-address-input').selectedIndex = 0;
|
||||
document.getElementById('convert-address-custom').style.display = 'none';
|
||||
document.getElementById('convert-address-custom').classList.add('oc-hidden');
|
||||
document.getElementById('convert-address-custom').value = '';
|
||||
|
||||
var templateSelect = document.getElementById('template-select');
|
||||
@@ -895,7 +895,7 @@ var ConfigUploader = {
|
||||
templateSelect.selectedIndex = 0;
|
||||
}
|
||||
|
||||
document.getElementById('custom-template-group').style.display = 'none';
|
||||
document.getElementById('custom-template-group').classList.add('oc-hidden');
|
||||
document.getElementById('custom-template-input').value = '';
|
||||
|
||||
document.getElementById('emoji-enable').checked = false;
|
||||
@@ -917,7 +917,7 @@ var ConfigUploader = {
|
||||
var advFileEnable = document.getElementById('advanced-options-enable-file');
|
||||
if (advFileEnable) advFileEnable.checked = false;
|
||||
var advFileContainer = document.getElementById('advanced-options-container-file');
|
||||
if (advFileContainer) advFileContainer.style.display = 'none';
|
||||
if (advFileContainer) advFileContainer.classList.add('oc-hidden');
|
||||
if (this.subconverterVersionChecker) this.subconverterVersionChecker.hide();
|
||||
},
|
||||
|
||||
@@ -932,13 +932,13 @@ var ConfigUploader = {
|
||||
document.getElementById('config-filename-input').value = '';
|
||||
document.getElementById('subscribe-url-input').value = '';
|
||||
document.getElementById('subscribe-ua-input').value = 'clash-verge/v2.4.5';
|
||||
document.getElementById('subscribe-ua-custom').style.display = 'none';
|
||||
document.getElementById('subscribe-ua-custom').classList.add('oc-hidden');
|
||||
var hdrContainer = document.getElementById('subscribe-headers-container');
|
||||
hdrContainer.innerHTML = '';
|
||||
hdrContainer.style.display = 'none';
|
||||
hdrContainer.classList.add('oc-hidden');
|
||||
|
||||
document.getElementById('advanced-options-enable').checked = false;
|
||||
document.getElementById('advanced-options-container').style.display = 'none';
|
||||
document.getElementById('advanced-options-container').classList.add('oc-hidden');
|
||||
document.getElementById('config-upload-cancel').disabled = false;
|
||||
this.resetAdvancedOptions();
|
||||
|
||||
@@ -947,7 +947,7 @@ var ConfigUploader = {
|
||||
templateSelect.selectedIndex = 0;
|
||||
}
|
||||
|
||||
document.getElementById('upload-progress').style.display = 'none';
|
||||
document.getElementById('upload-progress').classList.add('oc-hidden');
|
||||
document.getElementById('config-upload-status-text').textContent = '<%:Ready to add config%>';
|
||||
document.getElementById('config-upload-submit').textContent = '<%:Add Config%>';
|
||||
this.updateSubmitButton();
|
||||
@@ -967,12 +967,12 @@ var ConfigUploader = {
|
||||
if (data.sub_ua === 'clash.meta/1.19.20' || data.sub_ua === 'clash-verge/v2.4.5' || data.sub_ua === 'Clash' || data.sub_ua === 'custom') {
|
||||
document.getElementById('subscribe-ua-input').value = data.sub_ua;
|
||||
if (data.sub_ua === 'custom') {
|
||||
document.getElementById('subscribe-ua-custom').style.display = 'block';
|
||||
document.getElementById('subscribe-ua-custom').classList.remove('oc-hidden');
|
||||
document.getElementById('subscribe-ua-custom').value = data.sub_ua_custom || '';
|
||||
}
|
||||
} else {
|
||||
document.getElementById('subscribe-ua-input').value = 'custom';
|
||||
document.getElementById('subscribe-ua-custom').style.display = 'block';
|
||||
document.getElementById('subscribe-ua-custom').classList.remove('oc-hidden');
|
||||
document.getElementById('subscribe-ua-custom').value = data.sub_ua;
|
||||
}
|
||||
}
|
||||
@@ -994,22 +994,22 @@ var ConfigUploader = {
|
||||
|
||||
if (data.sub_convert === '1' || data.convert_address || data.template || data.custom_template_url || data.emoji === 'true' || data.udp === 'true' || data.skip_cert_verify === 'true' || data.sort === 'true' || data.node_type === 'true' || data.rule_provider === 'true' || data.custom_params || data.keyword || data.ex_keyword || data.de_ex_keyword || data.sub_headers || data.config_age_secret || data.config_age_public || data.config_age_algo) {
|
||||
document.getElementById('advanced-options-enable').checked = true;
|
||||
document.getElementById('advanced-options-container').style.display = 'block';
|
||||
document.getElementById('advanced-options-container').classList.remove('oc-hidden');
|
||||
|
||||
if (data.sub_convert === '1') {
|
||||
document.getElementById('sub-convert-enable').checked = true;
|
||||
document.getElementById('sub-convert-options').style.display = 'block';
|
||||
document.getElementById('sub-convert-options').classList.remove('oc-hidden');
|
||||
|
||||
if (data.convert_address) {
|
||||
if (data.convert_address === 'https://api.wcc.best/sub' || data.convert_address === 'https://api.asailor.org/sub') {
|
||||
document.getElementById('convert-address-input').value = data.convert_address;
|
||||
if (data.convert_address === 'custom') {
|
||||
document.getElementById('convert-address-custom').style.display = 'block';
|
||||
document.getElementById('convert-address-custom').classList.remove('oc-hidden');
|
||||
document.getElementById('convert-address-custom').value = data.convert_address_custom || '';
|
||||
}
|
||||
} else {
|
||||
document.getElementById('convert-address-input').value = 'custom';
|
||||
document.getElementById('convert-address-custom').style.display = 'block';
|
||||
document.getElementById('convert-address-custom').classList.remove('oc-hidden');
|
||||
document.getElementById('convert-address-custom').value = data.convert_address;
|
||||
}
|
||||
}
|
||||
@@ -1026,11 +1026,11 @@ var ConfigUploader = {
|
||||
}
|
||||
if (!found && data.template !== '0') {
|
||||
templateSelect.value = '0';
|
||||
document.getElementById('custom-template-group').style.display = 'block';
|
||||
document.getElementById('custom-template-group').classList.remove('oc-hidden');
|
||||
document.getElementById('custom-template-input').value = data.template;
|
||||
} else if (data.template === '0') {
|
||||
templateSelect.value = '0';
|
||||
document.getElementById('custom-template-group').style.display = 'block';
|
||||
document.getElementById('custom-template-group').classList.remove('oc-hidden');
|
||||
document.getElementById('custom-template-input').value = data.custom_template_url || data.custom_template || '';
|
||||
}
|
||||
}
|
||||
@@ -1086,21 +1086,25 @@ var ConfigUploader = {
|
||||
var statusText = document.getElementById('config-upload-status-text');
|
||||
var uploadZone = document.getElementById('upload-zone');
|
||||
|
||||
modeFileTab.style.display = this.isEditMode ? 'none' : '';
|
||||
modeSubscribeTab.style.display = '';
|
||||
if (this.isEditMode) {
|
||||
modeFileTab.classList.add('oc-hidden');
|
||||
} else {
|
||||
modeFileTab.classList.remove('oc-hidden');
|
||||
}
|
||||
modeSubscribeTab.classList.remove('oc-hidden');
|
||||
|
||||
modeFileTab.classList.remove('active');
|
||||
modeSubscribeTab.classList.remove('active');
|
||||
modeFileContent.style.display = 'none';
|
||||
modeSubscribeContent.style.display = 'none';
|
||||
modeFileContent.classList.add('oc-hidden');
|
||||
modeSubscribeContent.classList.add('oc-hidden');
|
||||
|
||||
if (mode === 'file') {
|
||||
modeFileTab.classList.add('active');
|
||||
modeFileContent.style.display = 'block';
|
||||
modeFileContent.classList.remove('oc-hidden');
|
||||
statusText.textContent = '<%:Ready to upload file%>';
|
||||
} else if (mode === 'subscribe') {
|
||||
modeSubscribeTab.classList.add('active');
|
||||
modeSubscribeContent.style.display = 'block';
|
||||
modeSubscribeContent.classList.remove('oc-hidden');
|
||||
statusText.textContent = this.isEditMode ? '<%:Ready to edit subscription%>' : '<%:Ready to add subscription%>';
|
||||
}
|
||||
|
||||
@@ -1271,7 +1275,7 @@ var ConfigUploader = {
|
||||
return;
|
||||
}
|
||||
|
||||
progressContainer.style.display = 'block';
|
||||
progressContainer.classList.remove('oc-hidden');
|
||||
|
||||
var progress = 0;
|
||||
var progressInterval = setInterval(function() {
|
||||
@@ -1433,7 +1437,7 @@ var ConfigUploader = {
|
||||
submitBtn.disabled = true;
|
||||
cancelBtn.disabled = true;
|
||||
statusText.textContent = this.isEditMode ? '<%:Updating subscription...%>' : '<%:Adding subscription...%>';
|
||||
progressContainer.style.display = 'block';
|
||||
progressContainer.classList.remove('oc-hidden');
|
||||
|
||||
var progress = 0;
|
||||
var progressInterval = setInterval(function() {
|
||||
@@ -1578,7 +1582,7 @@ var ConfigUploader = {
|
||||
removeBtn.addEventListener('click', function() {
|
||||
row.parentNode.removeChild(row);
|
||||
if (container.children.length === 0) {
|
||||
container.style.display = 'none';
|
||||
container.classList.add('oc-hidden');
|
||||
}
|
||||
});
|
||||
|
||||
@@ -1586,7 +1590,7 @@ var ConfigUploader = {
|
||||
row.appendChild(valueInput);
|
||||
row.appendChild(removeBtn);
|
||||
container.appendChild(row);
|
||||
container.style.display = 'block';
|
||||
container.classList.remove('oc-hidden');
|
||||
},
|
||||
|
||||
collectHeaders: function() {
|
||||
@@ -1620,7 +1624,7 @@ var ConfigUploader = {
|
||||
this.isProcessing = false;
|
||||
submitBtn.disabled = false;
|
||||
cancelBtn.disabled = false;
|
||||
progressContainer.style.display = 'none';
|
||||
progressContainer.classList.add('oc-hidden');
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ local dns_host = "www.instagram.com"
|
||||
output.innerHTML = '';
|
||||
var ta = document.createElement('textarea');
|
||||
ta.style.width = '100%';
|
||||
ta.value = x.responseText;
|
||||
ta.value = x.responseText.split('\n').map(function(l) { return l.trim(); }).filter(function(l) { return l !== ''; }).join('\n');
|
||||
output.appendChild(ta);
|
||||
_cmWhenReady(function() {
|
||||
other_editor(ta, true, '100%', '400px');
|
||||
@@ -51,11 +51,11 @@ local dns_host = "www.instagram.com"
|
||||
if (legend && output)
|
||||
{
|
||||
output.innerHTML =
|
||||
'<img src="<%=resource%>/icons/loading.svg" onerror="this.onerror=null;this.src=\'<%=resource%>/icons/loading.gif\'" alt="<%:Loading...%>" style="vertical-align:middle" /> ' +
|
||||
'<span class="loading-spinner" style="vertical-align:middle"></span> ' +
|
||||
'<%:Waiting for command to complete...%>';
|
||||
|
||||
legend.textContent = '<%:Collecting data...%>';
|
||||
legend.parentNode.style.display = 'block';
|
||||
legend.parentNode.classList.remove('oc-hidden');
|
||||
legend.style.display = 'block';
|
||||
}
|
||||
|
||||
@@ -95,11 +95,11 @@ local dns_host = "www.instagram.com"
|
||||
if (legend && output)
|
||||
{
|
||||
output.innerHTML =
|
||||
'<img src="<%=resource%>/icons/loading.svg" onerror="this.onerror=null;this.src=\'<%=resource%>/icons/loading.gif\'" alt="<%:Loading...%>" style="vertical-align:middle" /> ' +
|
||||
'<span class="loading-spinner" style="vertical-align:middle"></span> ' +
|
||||
'<%:Waiting for command to complete...%>';
|
||||
|
||||
legend.textContent = '<%:Collecting data...%>';
|
||||
legend.parentNode.style.display = 'block';
|
||||
legend.parentNode.classList.remove('oc-hidden');
|
||||
legend.style.display = 'block';
|
||||
}
|
||||
|
||||
@@ -112,7 +112,7 @@ local dns_host = "www.instagram.com"
|
||||
output.innerHTML = '';
|
||||
var ta = document.createElement('textarea');
|
||||
ta.style.width = '100%';
|
||||
ta.value = x.responseText;
|
||||
ta.value = x.responseText.split('\n').map(function(l) { return l.trim(); }).filter(function(l) { return l !== ''; }).join('\n');
|
||||
output.appendChild(ta);
|
||||
_cmWhenReady(function() {
|
||||
other_editor(ta, true, '100%', '400px');
|
||||
@@ -134,24 +134,24 @@ local dns_host = "www.instagram.com"
|
||||
<div class="oc">
|
||||
<form>
|
||||
<fieldset class="diag-style">
|
||||
<div style="width:50%; float: left; text-align: center; white-space: nowrap;">
|
||||
<div class="oc-text-center" style="width:50%;float:left;white-space:nowrap;">
|
||||
<%:Connection Test%>
|
||||
<input type="text" value="<%=diag_host%>" name="diag" />
|
||||
<input type="button" value="<%:Click to Test%>" class="btn cbi-button cbi-button-apply" onclick="update_status(this.form.diag)" />
|
||||
</div>
|
||||
<div style="width:50%; float: left; text-align: center; white-space: nowrap;">
|
||||
<div class="oc-text-center" style="width:50%;float:left;white-space:nowrap;">
|
||||
<%:DNS Test%>
|
||||
<input type="text" value="<%=dns_host%>" name="dns_host" />
|
||||
<input type="button" value="<%:Click to Test%>" class="btn cbi-button cbi-button-apply" onclick="diag_dns(this.form.dns_host)" />
|
||||
</div>
|
||||
</fieldset>
|
||||
|
||||
<div class="diag-style" style="display:none">
|
||||
<div class="diag-style oc-hidden">
|
||||
<div id="diag-rc-legend" class="diag-legend"><%:Collecting data...%></div>
|
||||
<span id="diag-rc-output"></span>
|
||||
</div>
|
||||
|
||||
<div class="diag-style" style="display:none">
|
||||
<div class="diag-style oc-hidden">
|
||||
<div id="dns-rc-legend" class="diag-legend"><%:Collecting data...%></div>
|
||||
<span id="dns-rc-output"></span>
|
||||
</div>
|
||||
|
||||
@@ -2,38 +2,38 @@
|
||||
<div class="oc">
|
||||
<div class="developer-container">
|
||||
<div class="developer-grid">
|
||||
<span id="_Dreamacro"><%:Collecting data...%></span>
|
||||
<span id="_vernesong"><%:Collecting data...%></span>
|
||||
<span id="_frainzy1477"><%:Collecting data...%></span>
|
||||
<span id="_SukkaW"><%:Collecting data...%></span>
|
||||
<span id="_haishanh"><%:Collecting data...%></span>
|
||||
<span id="_Zephyruso"><%:Collecting data...%></span>
|
||||
<span id="_Alecthw"><%:Collecting data...%></span>
|
||||
<span id="_Tindy_X"><%:Collecting data...%></span>
|
||||
<span id="_lmc999"><%:Collecting data...%></span>
|
||||
<span id="_immortalwrt"><%:Collecting data...%></span>
|
||||
<span id="_MetaCubeX"><%:Collecting data...%></span>
|
||||
<span id="_oixcloud"><%:Collecting data...%></span>
|
||||
<span id="_more"><%:Collecting data...%></span>
|
||||
<span id="Dreamacro"><%:Collecting data...%></span>
|
||||
<span id="vernesong"><%:Collecting data...%></span>
|
||||
<span id="frainzy1477"><%:Collecting data...%></span>
|
||||
<span id="SukkaW"><%:Collecting data...%></span>
|
||||
<span id="haishanh"><%:Collecting data...%></span>
|
||||
<span id="Zephyruso"><%:Collecting data...%></span>
|
||||
<span id="Alecthw"><%:Collecting data...%></span>
|
||||
<span id="Tindy_X"><%:Collecting data...%></span>
|
||||
<span id="lmc999"><%:Collecting data...%></span>
|
||||
<span id="immortalwrt"><%:Collecting data...%></span>
|
||||
<span id="MetaCubeX"><%:Collecting data...%></span>
|
||||
<span id="oixcloud"><%:Collecting data...%></span>
|
||||
<span id="more"><%:Collecting data...%></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
|
||||
<script type="text/javascript">//<![CDATA[
|
||||
var Dreamacro = document.getElementById('_Dreamacro');
|
||||
var vernesong = document.getElementById('_vernesong');
|
||||
var frainzy1477 = document.getElementById('_frainzy1477');
|
||||
var SukkaW = document.getElementById('_SukkaW');
|
||||
var Zephyruso = document.getElementById('_Zephyruso');
|
||||
var haishanh = document.getElementById('_haishanh');
|
||||
var Alecthw = document.getElementById('_Alecthw');
|
||||
var Tindy_X = document.getElementById('_Tindy_X');
|
||||
var immortalwrt = document.getElementById('_immortalwrt');
|
||||
var lmc999 = document.getElementById('_lmc999');
|
||||
var MetaCubeX = document.getElementById('_MetaCubeX');
|
||||
var oixcloud = document.getElementById('_oixcloud');
|
||||
var more = document.getElementById('_more');
|
||||
var Dreamacro = document.getElementById('Dreamacro');
|
||||
var vernesong = document.getElementById('vernesong');
|
||||
var frainzy1477 = document.getElementById('frainzy1477');
|
||||
var SukkaW = document.getElementById('SukkaW');
|
||||
var Zephyruso = document.getElementById('Zephyruso');
|
||||
var haishanh = document.getElementById('haishanh');
|
||||
var Alecthw = document.getElementById('Alecthw');
|
||||
var Tindy_X = document.getElementById('Tindy_X');
|
||||
var immortalwrt = document.getElementById('immortalwrt');
|
||||
var lmc999 = document.getElementById('lmc999');
|
||||
var MetaCubeX = document.getElementById('MetaCubeX');
|
||||
var oixcloud = document.getElementById('oixcloud');
|
||||
var more = document.getElementById('more');
|
||||
|
||||
function getAvatarSize() {
|
||||
var width = window.innerWidth;
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
<%+cbi/valueheader%>
|
||||
<div style="text-align: center; margin:2% auto; display: block; width: 100%; text-overflow: ellipsis;">
|
||||
<div>
|
||||
<%:Note: Please Upload File According To File Type, File Will Be Saved To The Prompt Path%>
|
||||
</div>
|
||||
<div style="color: green; margin-top: 1%;">
|
||||
<%
|
||||
local val = self:cfgvalue(section) or self.default or ""
|
||||
write(pcdata(val))
|
||||
%>
|
||||
</div>
|
||||
</div>
|
||||
<%+cbi/valuefooter%>
|
||||
@@ -10,15 +10,15 @@
|
||||
null,
|
||||
function(x,status)
|
||||
{
|
||||
btn.disabled = false;
|
||||
if ( x && x.status == 200 ) {
|
||||
if(status.flush_status == "0" || status.flush_status != "")
|
||||
if(status.fakeip_flush === "" && status.dns_flush === "")
|
||||
{
|
||||
btn.value = '<%:Flush Failed%>';
|
||||
|
||||
btn.value = '<%:Flush Successful%>';
|
||||
}
|
||||
else
|
||||
{
|
||||
btn.value = '<%:Flush Successful%>';
|
||||
btn.value = '<%:Flush Failed%>';
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -26,7 +26,6 @@
|
||||
}
|
||||
}
|
||||
);
|
||||
btn.disabled = false;
|
||||
return false;
|
||||
};
|
||||
|
||||
|
||||
@@ -10,15 +10,15 @@
|
||||
null,
|
||||
function(x,status)
|
||||
{
|
||||
btn.disabled = false;
|
||||
if ( x && x.status == 200 ) {
|
||||
if(status.flush_status == "0" || status.flush_status != "")
|
||||
if(status.flush_status === "")
|
||||
{
|
||||
btn.value = '<%:Flush Failed%>';
|
||||
|
||||
btn.value = '<%:Flush Successful%>';
|
||||
}
|
||||
else
|
||||
{
|
||||
btn.value = '<%:Flush Successful%>';
|
||||
btn.value = '<%:Flush Failed%>';
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -26,7 +26,6 @@
|
||||
}
|
||||
}
|
||||
);
|
||||
btn.disabled = false;
|
||||
return false;
|
||||
};
|
||||
|
||||
|
||||
@@ -4,22 +4,21 @@
|
||||
local plugin_version = fs.oc_version()
|
||||
%>
|
||||
<script src="/luci-static/resources/openclash/js/oc-icons.js?v=<%=plugin_version%>"></script>
|
||||
<%+openclash/common%>
|
||||
<body>
|
||||
<div id="tab" class="cbi-section oc">
|
||||
<div id="tab" class="oc">
|
||||
<div id="tab-header">
|
||||
<ul class="cbi-tabmenu">
|
||||
<li name="tab-header" class="cbi-tab"><a href="#"><%:OpenClash Log%></a></li>
|
||||
<li name="tab-header" class="cbi-tab-disabled"><a href="#"><%:Core Log%></a></li>
|
||||
<li name="tab-header" class="cbi-tab-disabled"><a href="#"><%:Debug Logs%></a></li>
|
||||
<ul class="oc-tabmenu">
|
||||
<li name="tab-header" class="oc-tab"><a href="#"><svg width="14" height="14"><use href="#oc-icon-package"/></svg><span><%:Plugin Logs%></span></a></li>
|
||||
<li name="tab-header" class="oc-tab-disabled"><a href="#"><svg width="14" height="14"><use href="#oc-icon-cpu"/></svg><span><%:Core Logs%></span></a></li>
|
||||
<li name="tab-header" class="oc-tab-disabled"><a href="#"><svg width="14" height="14"><use href="#oc-icon-bug"/></svg><span><%:Debug Logs%></span></a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div id="tab-content">
|
||||
<div class="dom" style="display: block;">
|
||||
<textarea id="cbid.openclash.config.clog" class="cbi-input-textarea" style="width: 100%;display:inline" data-update="change" rows="32" cols="60" readonly="readonly" ></textarea>
|
||||
<textarea id="cbid.openclash.config.clog" class="oc-input-textarea" style="display:inline" data-update="change" rows="32" cols="60" readonly="readonly" ></textarea>
|
||||
</div>
|
||||
<div class="dom">
|
||||
<textarea id="core_log" class="cbi-input-textarea" style="width: 100%;display:inline" data-update="change" rows="32" cols="60" readonly="readonly" ></textarea>
|
||||
<textarea id="core_log" class="oc-input-textarea" style="display:inline" data-update="change" rows="32" cols="60" readonly="readonly" ></textarea>
|
||||
<div class="radio-button">
|
||||
<input type="radio" id="info" name="radios" value="info" checked onclick="return switch_log_level(this.value)"/>
|
||||
<label for="info"><%:Info%></label>
|
||||
@@ -34,7 +33,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="dom">
|
||||
<textarea id="debug_log" class="cbi-input-textarea" style="width: 100%;display:none" data-update="change" rows="32" cols="60" readonly="readonly" ></textarea>
|
||||
<textarea id="debug_log" class="oc-input-textarea oc-hidden" data-update="change" rows="32" cols="60" readonly="readonly" ></textarea>
|
||||
<div id="debug-render-wrapper">
|
||||
<div id="debug-rendered"></div>
|
||||
<div class="oc-usage-help-float" id="debug-copy-source" onclick="copyDebugSource()" title="<%:Copy Debug%>"><svg width="20" height="20"><use href="#oc-icon-copy"/></svg></div>
|
||||
@@ -43,21 +42,27 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<fieldset style="text-align: center; width: 100%" class="cbi-section">
|
||||
<div class="btn-group">
|
||||
<input type="button" class="btn cbi-button cbi-button-apply" id="stop_refresh_button" value="<%:Stop Refresh%>" onclick=" return stop_refresh() "/>
|
||||
<input type="button" class="btn cbi-button cbi-button-apply" id="start_refresh_button" value="<%:Start Refresh%>" onclick=" return start_refresh() "/>
|
||||
<input type="button" class="btn cbi-button cbi-button-apply" id="del_log_button" value="<%:Clean%>" onclick=" return del_log() " />
|
||||
<input type="button" class="btn cbi-button cbi-button-apply" id="down_log_button" value="<%:Download Log%>" onclick=" return download_log() " />
|
||||
<span style="display:inline-flex; align-items:center; gap:4px;">
|
||||
<input type="button" class="btn cbi-button cbi-button-apply" id="gen_debug_button" value="<%:Generate Logs%>" onclick="return gen_debug_logs()" />
|
||||
<span id="debug_loading" style="display:none; vertical-align:middle; line-height:1;"><img src="<%=resource%>/icons/loading.svg" onerror="this.onerror=null;this.src='<%=resource%>/icons/loading.gif'" alt="<%:Loading...%>" style="vertical-align:middle; height:1.6em; width:auto;" /></span>
|
||||
</span>
|
||||
<div class="oc oc-text-center oc-w100">
|
||||
<div class="select-popup-footer log-footer">
|
||||
<button type="button" class="footer-btn" id="stop_refresh_button" onclick="return stop_refresh()"><svg width="14" height="14"><use href="#oc-icon-player-pause"/></svg><span><%:Stop Refresh%></span></button>
|
||||
<button type="button" class="footer-btn" id="start_refresh_button" onclick="return start_refresh()"><svg width="14" height="14"><use href="#oc-icon-player-play"/></svg><span><%:Start Refresh%></span></button>
|
||||
<button type="button" class="footer-btn" id="del_log_button" onclick="return del_log()"><svg width="14" height="14"><use href="#oc-icon-trash"/></svg><span><%:Clean%></span></button>
|
||||
<button type="button" class="footer-btn" id="down_log_button" onclick="return download_log()"><svg width="14" height="14"><use href="#oc-icon-download"/></svg><span><%:Download Log%></span></button>
|
||||
<button type="button" class="footer-btn" id="gen_debug_button" onclick="return gen_debug_logs()"><svg width="14" height="14"><use href="#oc-icon-play-bugs"/></svg><span><%:Generate Logs%></span></button>
|
||||
</div>
|
||||
</fieldset>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
<script type="text/javascript">//<![CDATA[
|
||||
window.levelTranslations = {
|
||||
'info': '<%:Info%>',
|
||||
'warning': '<%:Warning%>',
|
||||
'error': '<%:Error%>',
|
||||
'debug': '<%:Debug%>',
|
||||
'tip': '<%:Tip%>',
|
||||
'watchdog': '<%:Watchdog%>',
|
||||
'fatal': '<%:Fatal%>'
|
||||
};
|
||||
var r;
|
||||
var s;
|
||||
var log_len = 0;
|
||||
@@ -76,7 +81,9 @@ var isPolling = false;
|
||||
var core_refresh = true;
|
||||
var wsHasData = false;
|
||||
var coreEditorInitialized = false;
|
||||
var editor_oc;
|
||||
var editor_core;
|
||||
var editor_debug;
|
||||
var coreLogAccumulator = '';
|
||||
var pollInterval = 1000;
|
||||
|
||||
@@ -170,7 +177,7 @@ function download_log(){
|
||||
var activeTabId = 0;
|
||||
var titles = document.getElementsByName('tab-header');
|
||||
for(var i=0; i<titles.length; i++){
|
||||
if(titles[i].className === 'cbi-tab') {
|
||||
if(titles[i].className === 'oc-tab') {
|
||||
activeTabId = i;
|
||||
break;
|
||||
}
|
||||
@@ -213,48 +220,56 @@ function download_log(){
|
||||
}
|
||||
|
||||
if (oc_content.trim()) {
|
||||
downloadContent += "<%:OpenClash Log%>:\n" + oc_content + "\n\n";
|
||||
downloadContent += "<%:Plugin Logs%>:\n" + oc_content + "\n\n";
|
||||
}
|
||||
if (core_content.trim()) {
|
||||
downloadContent += "<%:Core Log%>:\n" + core_content;
|
||||
downloadContent += "<%:Core Logs%>:\n" + core_content;
|
||||
}
|
||||
|
||||
createAndDownloadFile("OpenClash-"+timestamp+".log", downloadContent);
|
||||
return;
|
||||
};
|
||||
|
||||
function restoreDebugEditor() {
|
||||
var wrapper = document.getElementById('debug-render-wrapper');
|
||||
var rendered = document.getElementById('debug-rendered');
|
||||
if (wrapper) { wrapper.style.display = 'none'; }
|
||||
if (rendered) { rendered.innerHTML = ''; }
|
||||
dl.value = "";
|
||||
if (typeof editor_debug !== 'undefined' && editor_debug) {
|
||||
editor_debug.setValue("");
|
||||
if (editor_debug.dom) {
|
||||
editor_debug.dom.style.setProperty('display', '', 'important');
|
||||
}
|
||||
editor_debug.refresh();
|
||||
}
|
||||
}
|
||||
|
||||
function del_log() {
|
||||
var activeTabId = 0;
|
||||
var titles = document.getElementsByName('tab-header');
|
||||
for(var i=0; i<titles.length; i++){
|
||||
if(titles[i].className === 'cbi-tab') {
|
||||
if(titles[i].className === 'oc-tab') {
|
||||
activeTabId = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (activeTabId === 2) {
|
||||
restoreDebugEditor();
|
||||
XHR.get('<%=luci.dispatcher.build_url("admin", "services", "openclash", "del_log")%>', {type: "debug"}, function(x, data){
|
||||
dl.value = "";
|
||||
var wrapper = document.getElementById('debug-render-wrapper');
|
||||
var rendered = document.getElementById('debug-rendered');
|
||||
if (wrapper) { wrapper.style.display = 'none'; }
|
||||
if (rendered) { rendered.innerHTML = ''; }
|
||||
if (typeof editor_debug !== 'undefined' && editor_debug) {
|
||||
editor_debug.setValue("");
|
||||
if (editor_debug.dom) {
|
||||
editor_debug.dom.style.setProperty('display', '', 'important');
|
||||
if (typeof editor_debug === 'undefined' || !editor_debug) {
|
||||
if (typeof markdown_editor === 'function' && dl) {
|
||||
markdown_editor(dl, 'debug', true, '100%', '540px');
|
||||
}
|
||||
editor_debug.refresh();
|
||||
} else if (typeof markdown_editor === 'function' && dl) {
|
||||
markdown_editor(dl, 'debug', true, '100%', '540px');
|
||||
}
|
||||
});
|
||||
} else {
|
||||
XHR.get('<%=luci.dispatcher.build_url("admin", "services", "openclash", "del_log")%>', null, function(x, data){
|
||||
lv.innerHTML="";
|
||||
cl.innerHTML="";
|
||||
lv.value = "";
|
||||
cl.value = "";
|
||||
coreLogBuffer = [];
|
||||
coreLogAccumulator = '';
|
||||
log_len = 0;
|
||||
if (typeof editor_oc !== 'undefined' && editor_oc) {
|
||||
editor_oc.setValue(lv.value);
|
||||
@@ -385,31 +400,119 @@ function coreLogWebSocket() {
|
||||
|
||||
function gen_debug_logs()
|
||||
{
|
||||
var loading_el = document.getElementById('debug_loading');
|
||||
var btn = document.getElementById('gen_debug_button');
|
||||
var originalText = btn.value;
|
||||
if (loading_el) { loading_el.style.display = 'inline'; }
|
||||
if (btn) { btn.value = '<%:Generating...%>'; btn.disabled = true; }
|
||||
|
||||
XHR.get('<%=luci.dispatcher.build_url("admin", "services", "openclash", "gen_debug_logs")%>', null, function(x, status) {
|
||||
if (loading_el) { loading_el.style.display = 'none'; }
|
||||
if (btn) { btn.value = originalText; btn.disabled = false; }
|
||||
dl.value = x.responseText || '<%:Some error occurred!%>';
|
||||
if (typeof editor_debug !== 'undefined' && editor_debug) {
|
||||
editor_debug.setValue(dl.value);
|
||||
var btnText = btn ? btn.querySelector('span') : null;
|
||||
var btnSvg = btn ? btn.querySelector('svg') : null;
|
||||
var originalText = btnText ? btnText.textContent : '';
|
||||
var originalSvg = btnSvg ? btnSvg.outerHTML : '';
|
||||
if (btn) {
|
||||
if (btnText) { btnText.textContent = '<%:Generating...%>'; }
|
||||
btn.disabled = true;
|
||||
if (btnSvg) {
|
||||
var spinner = document.createElement('span');
|
||||
spinner.className = 'loading-spinner oc-btn-spinner';
|
||||
btnSvg.replaceWith(spinner);
|
||||
}
|
||||
renderDebugView();
|
||||
});
|
||||
}
|
||||
|
||||
function restoreGenerateBtn() {
|
||||
if (!btn) return;
|
||||
if (btnText) { btnText.textContent = originalText; }
|
||||
btn.disabled = false;
|
||||
var sp = btn.querySelector('.loading-spinner');
|
||||
if (sp) { sp.outerHTML = originalSvg; }
|
||||
}
|
||||
|
||||
restoreDebugEditor();
|
||||
|
||||
var titles = document.getElementsByName('tab-header');
|
||||
if (titles.length > 2 && titles[2].className !== 'oc-tab') {
|
||||
titles[2].click();
|
||||
}
|
||||
|
||||
if (typeof editor_debug === 'undefined' || !editor_debug) {
|
||||
if (typeof markdown_editor === 'function' && dl) {
|
||||
markdown_editor(dl, 'debug', true, '100%', '540px');
|
||||
}
|
||||
}
|
||||
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.timeout = 0;
|
||||
xhr.open('GET', '<%=luci.dispatcher.build_url("admin", "services", "openclash", "gen_debug_logs")%>', true);
|
||||
xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest');
|
||||
|
||||
var lastLen = 0;
|
||||
xhr.onprogress = function() {
|
||||
var text = xhr.responseText;
|
||||
if (text.length <= lastLen) return;
|
||||
lastLen = text.length;
|
||||
var lines = text.split('\n');
|
||||
lines.pop();
|
||||
if (lines.length > 0 && lines[0].length === 8192 && /^ +$/.test(lines[0])) {
|
||||
lines.shift();
|
||||
}
|
||||
var preview = lines.join('\n');
|
||||
if (editor_debug && editor_debug.setValue) {
|
||||
editor_debug.setValue(preview);
|
||||
if (editor_debug.scrollDOM) editor_debug.scrollDOM.scrollTop = editor_debug.scrollDOM.scrollHeight;
|
||||
} else {
|
||||
dl.value = preview;
|
||||
}
|
||||
};
|
||||
|
||||
xhr.onload = function() {
|
||||
restoreGenerateBtn();
|
||||
var finalText = xhr.responseText || '';
|
||||
|
||||
if (xhr.status != 200 && finalText == "") {
|
||||
if (editor_debug && editor_debug.setValue) {
|
||||
editor_debug.setValue('<%:Some error occurred!%>');
|
||||
} else {
|
||||
dl.value = '<%:Some error occurred!%>';
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// reload after sed, because log changed
|
||||
load_debug_log();
|
||||
};
|
||||
|
||||
xhr.ontimeout = function() {
|
||||
restoreGenerateBtn();
|
||||
if (xhr.responseText == "") {
|
||||
if (editor_debug && editor_debug.setValue) {
|
||||
editor_debug.setValue('<%:Request Timeout...%>');
|
||||
} else {
|
||||
dl.value = '<%:Request Timeout...%>';
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
xhr.onerror = function() {
|
||||
restoreGenerateBtn();
|
||||
if (xhr.responseText == "") {
|
||||
if (editor_debug && editor_debug.setValue) {
|
||||
editor_debug.setValue('<%:Some error occurred!%>');
|
||||
} else {
|
||||
dl.value = '<%:Some error occurred!%>';
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
xhr.send();
|
||||
return;
|
||||
};
|
||||
|
||||
function load_existing_debug_log()
|
||||
function load_debug_log()
|
||||
{
|
||||
XHR.get('<%=luci.dispatcher.build_url("admin", "services", "openclash", "get_debug_logs")%>', null, function(x, status) {
|
||||
if (x && x.status == 200 && x.responseText != "")
|
||||
{
|
||||
dl.value = x.responseText;
|
||||
if (typeof editor_debug !== 'undefined' && editor_debug && editor_debug.setValue) {
|
||||
editor_debug.setValue(x.responseText);
|
||||
setCursorToFirstLineEnd(editor_debug);
|
||||
}
|
||||
renderDebugView();
|
||||
}
|
||||
else
|
||||
@@ -421,66 +524,82 @@ function load_existing_debug_log()
|
||||
});
|
||||
};
|
||||
|
||||
function line_tolocal(str) {
|
||||
function line_tolocal(input) {
|
||||
var trans_local = new Array();
|
||||
var local_count = 0;
|
||||
var lines;
|
||||
|
||||
str.trim().split('\n').forEach(function(v, i) {
|
||||
var regex = /(time=)"([^"]*)"/g;
|
||||
var res = regex.exec(v);
|
||||
if (Array.isArray(input)) {
|
||||
lines = input;
|
||||
} else {
|
||||
lines = input.trim().split('\n');
|
||||
}
|
||||
|
||||
for (var i = 0; i < lines.length; i++) {
|
||||
var v = lines[i];
|
||||
if (!v) continue;
|
||||
|
||||
try {
|
||||
if (res) {
|
||||
var dt = new Date(res[2]);
|
||||
if (v.indexOf('time=') >= 0) {
|
||||
var regex = /(time=)"([^"]*)"/g;
|
||||
var res = regex.exec(v);
|
||||
|
||||
if (!isNaN(dt.getTime())) {
|
||||
var timestamp = dt.getFullYear() + "-" + p(dt.getMonth() + 1) + "-" + p(dt.getDate()) + " " +
|
||||
p(dt.getHours()) + ":" + p(dt.getMinutes()) + ":" + p(dt.getSeconds());
|
||||
|
||||
var levelMatch = v.match(/level=(\w+)/);
|
||||
var level = levelMatch ? levelMatch[1] : 'info';
|
||||
var translatedLevel = levelTranslations[level] || level;
|
||||
var msgMatch = v.match(/msg="(.*)"/);
|
||||
var msg = msgMatch ? msgMatch[1] : '';
|
||||
trans_local[local_count] = timestamp + " [" + translatedLevel + "] " + msg;
|
||||
if (res) {
|
||||
var dt = new Date(res[2]);
|
||||
|
||||
if (!isNaN(dt.getTime())) {
|
||||
var timestamp = dt.getFullYear() + "-" + p(dt.getMonth() + 1) + "-" + p(dt.getDate()) + " " +
|
||||
p(dt.getHours()) + ":" + p(dt.getMinutes()) + ":" + p(dt.getSeconds());
|
||||
var levelMatch = v.match(/level=(\w+)/);
|
||||
var level = levelMatch ? levelMatch[1] : 'info';
|
||||
var translatedLevel = levelTranslations[level] || level;
|
||||
var msgMatch = v.match(/msg="(.*)"/);
|
||||
var msg = msgMatch ? msgMatch[1] : '';
|
||||
trans_local[local_count] = timestamp + " [" + translatedLevel + "] " + msg;
|
||||
local_count++;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
var dtt = new Date(v.substring(0, 19));
|
||||
|
||||
if (!isNaN(dtt.getTime()) && v.substring(0, 19).match(/^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/)) {
|
||||
trans_local[local_count] = v;
|
||||
local_count++;
|
||||
} else {
|
||||
trans_local[local_count] = v;
|
||||
local_count++;
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
var dtt = new Date(v.substring(0, 19));
|
||||
|
||||
if (!isNaN(dtt.getTime()) && v.substring(0, 19).match(/^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/)) {
|
||||
trans_local[local_count] = v;
|
||||
local_count++;
|
||||
} else {
|
||||
trans_local[local_count] = v;
|
||||
local_count++;
|
||||
}
|
||||
} catch (e) {
|
||||
trans_local[local_count] = v;
|
||||
local_count++;
|
||||
}
|
||||
} catch (e) {
|
||||
trans_local[local_count] = v;
|
||||
local_count++;
|
||||
}
|
||||
} catch (e) {
|
||||
trans_local[local_count] = v;
|
||||
local_count++;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return trans_local;
|
||||
};
|
||||
|
||||
function setCursorToFirstLineEnd(editor) {
|
||||
if (!editor || !editor.state) return;
|
||||
var doc = editor.state.doc;
|
||||
if (doc.lines >= 1) {
|
||||
var fl = doc.line(1);
|
||||
editor.dispatch({ selection: { anchor: fl.to }, scrollIntoView: true });
|
||||
}
|
||||
}
|
||||
|
||||
function smoothlyDisplayLogs(newLines, target, isEditor, currentContent, isActiveTab) {
|
||||
var scrollPosition = null;
|
||||
var isAtTop = false;
|
||||
var cursorPos = null;
|
||||
var selectionRange = null;
|
||||
|
||||
var isFirstLoad = !currentContent || currentContent.trim() === "";
|
||||
|
||||
if (isEditor && target) {
|
||||
scrollPosition = target.getScrollInfo();
|
||||
isAtTop = (scrollPosition.top < 20);
|
||||
@@ -508,14 +627,9 @@ function smoothlyDisplayLogs(newLines, target, isEditor, currentContent, isActiv
|
||||
isAtTop = (target.scrollTop < 20);
|
||||
}
|
||||
|
||||
if ((target === editor_oc && animatingOC) || (target === editor_core && animatingCore) || !isActiveTab) {
|
||||
var content = "";
|
||||
if ((target === editor_oc && animatingOC) || (target === editor_core && animatingCore) || (target === editor_debug && animatingDebug) || !isActiveTab) {
|
||||
var lines = newLines.slice().reverse();
|
||||
for (var i = 0; i < lines.length; i++) {
|
||||
content += lines[i] + "\n";
|
||||
}
|
||||
content = content + (currentContent || "");
|
||||
|
||||
var content = lines.join('\n') + (lines.length > 0 ? '\n' : '') + (currentContent || '');
|
||||
var allLines = content.split("\n");
|
||||
if (allLines.length > 2000) {
|
||||
allLines = allLines.slice(0, 1999);
|
||||
@@ -531,7 +645,6 @@ function smoothlyDisplayLogs(newLines, target, isEditor, currentContent, isActiv
|
||||
if (cursorPos) {
|
||||
cursorPos.line += addedLines;
|
||||
target.setCursor(cursorPos);
|
||||
|
||||
target.scrollIntoView({line: cursorPos.line, ch: cursorPos.ch}, 300);
|
||||
} else {
|
||||
target.scrollTo(scrollPosition.left, scrollPosition.top);
|
||||
@@ -541,7 +654,6 @@ function smoothlyDisplayLogs(newLines, target, isEditor, currentContent, isActiv
|
||||
selectionRange.from.line += addedLines;
|
||||
selectionRange.to.line += addedLines;
|
||||
target.setSelection(selectionRange.from, selectionRange.to);
|
||||
|
||||
target.scrollIntoView({
|
||||
from: selectionRange.from,
|
||||
to: selectionRange.to
|
||||
@@ -554,8 +666,6 @@ function smoothlyDisplayLogs(newLines, target, isEditor, currentContent, isActiv
|
||||
target.setCursor({line: 0, ch: firstLineLen});
|
||||
}
|
||||
}
|
||||
|
||||
target.refresh();
|
||||
} else {
|
||||
var oldScrollTop = scrollPosition;
|
||||
target.innerHTML = content;
|
||||
@@ -568,6 +678,8 @@ function smoothlyDisplayLogs(newLines, target, isEditor, currentContent, isActiv
|
||||
|
||||
if (target === editor_oc || target === lv) {
|
||||
animatingOC = true;
|
||||
} else if (target === editor_debug) {
|
||||
animatingDebug = true;
|
||||
} else {
|
||||
animatingCore = true;
|
||||
}
|
||||
@@ -576,25 +688,25 @@ function smoothlyDisplayLogs(newLines, target, isEditor, currentContent, isActiv
|
||||
var batchSize, interval;
|
||||
|
||||
if (totalLines <= 10) {
|
||||
batchSize = 2;
|
||||
interval = 90;
|
||||
batchSize = 5;
|
||||
interval = 80;
|
||||
} else if (totalLines <= 50) {
|
||||
batchSize = 10;
|
||||
interval = 60;
|
||||
batchSize = 25;
|
||||
interval = 50;
|
||||
} else if (totalLines <= 200) {
|
||||
batchSize = 30;
|
||||
interval = 35;
|
||||
} else if (totalLines <= 500) {
|
||||
batchSize = 60;
|
||||
interval = 25;
|
||||
interval = 30;
|
||||
} else if (totalLines <= 500) {
|
||||
batchSize = 150;
|
||||
interval = 20;
|
||||
} else if (totalLines <= 1000) {
|
||||
batchSize = 120;
|
||||
interval = 15;
|
||||
batchSize = 300;
|
||||
interval = 12;
|
||||
} else if (totalLines <= 1500) {
|
||||
batchSize = 180;
|
||||
interval = 10;
|
||||
batchSize = 400;
|
||||
interval = 8;
|
||||
} else {
|
||||
batchSize = 250;
|
||||
batchSize = 500;
|
||||
interval = 5;
|
||||
}
|
||||
|
||||
@@ -607,6 +719,8 @@ function smoothlyDisplayLogs(newLines, target, isEditor, currentContent, isActiv
|
||||
if (currentBatchCount >= logLines.length) {
|
||||
if (target === editor_oc || target === lv) {
|
||||
animatingOC = false;
|
||||
} else if (target === editor_debug) {
|
||||
animatingDebug = false;
|
||||
} else {
|
||||
animatingCore = false;
|
||||
}
|
||||
@@ -629,11 +743,7 @@ function smoothlyDisplayLogs(newLines, target, isEditor, currentContent, isActiv
|
||||
}
|
||||
}
|
||||
if (isEditor && !cursorPos) {
|
||||
var doc = target.state.doc;
|
||||
if (doc.lines >= 1) {
|
||||
var fl = doc.line(1);
|
||||
target.dispatch({ selection: { anchor: fl.to } });
|
||||
}
|
||||
setCursorToFirstLineEnd(target);
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -651,13 +761,6 @@ function smoothlyDisplayLogs(newLines, target, isEditor, currentContent, isActiv
|
||||
|
||||
var content = accumulatedContent + (displayedContent ? "\n" + displayedContent : "");
|
||||
|
||||
var contentLines = content.split("\n");
|
||||
if (contentLines.length > 2000) {
|
||||
contentLines = contentLines.slice(0, 1999);
|
||||
contentLines.push("...");
|
||||
content = contentLines.join("\n");
|
||||
}
|
||||
|
||||
if (isEditor) {
|
||||
var currentScrollInfo = isAtTop ? null : target.getScrollInfo();
|
||||
target.setValue(content);
|
||||
@@ -665,7 +768,6 @@ function smoothlyDisplayLogs(newLines, target, isEditor, currentContent, isActiv
|
||||
if (!isAtTop && currentScrollInfo) {
|
||||
target.scrollTo(currentScrollInfo.left, currentScrollInfo.top);
|
||||
}
|
||||
target.refresh();
|
||||
} else {
|
||||
var currentScrollTop = isAtTop ? null : target.scrollTop;
|
||||
target.innerHTML = content;
|
||||
@@ -679,6 +781,8 @@ function smoothlyDisplayLogs(newLines, target, isEditor, currentContent, isActiv
|
||||
} else {
|
||||
if (target === editor_oc || target === lv) {
|
||||
animatingOC = false;
|
||||
} else if (target === editor_debug) {
|
||||
animatingDebug = false;
|
||||
} else {
|
||||
animatingCore = false;
|
||||
}
|
||||
@@ -701,10 +805,19 @@ function smoothlyDisplayLogs(newLines, target, isEditor, currentContent, isActiv
|
||||
}
|
||||
}
|
||||
if (isEditor && !cursorPos) {
|
||||
var doc = target.state.doc;
|
||||
if (doc.lines >= 1) {
|
||||
var fl = doc.line(1);
|
||||
target.dispatch({ selection: { anchor: fl.to } });
|
||||
setCursorToFirstLineEnd(target);
|
||||
}
|
||||
|
||||
if (isEditor) {
|
||||
var finalContent = target.getValue();
|
||||
var finalLines = finalContent.split("\n");
|
||||
if (finalLines.length > 2000) {
|
||||
finalLines = finalLines.slice(0, 1999);
|
||||
finalLines.push("...");
|
||||
target.setValue(finalLines.join("\n"));
|
||||
if (!cursorPos) {
|
||||
setCursorToFirstLineEnd(target);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -725,7 +838,7 @@ function poll_log(){
|
||||
clearTimeout(r);
|
||||
|
||||
for(var i=0; i<titles.length; i++){
|
||||
if(titles[i].className === 'cbi-tab') {
|
||||
if(titles[i].className === 'oc-tab') {
|
||||
activeTabId = i;
|
||||
break;
|
||||
}
|
||||
@@ -736,7 +849,7 @@ function poll_log(){
|
||||
if (coreLogBuffer.length > 0) {
|
||||
bufferToProcess = coreLogBuffer;
|
||||
coreLogBuffer = [];
|
||||
core_logs = line_tolocal(bufferToProcess.join('\n'));
|
||||
core_logs = line_tolocal(bufferToProcess);
|
||||
if (editor_core && activeTabId === 1) {
|
||||
currentCoreContent = editor_core.getValue();
|
||||
smoothlyDisplayLogs(core_logs, editor_core, true, currentCoreContent, true);
|
||||
@@ -825,14 +938,14 @@ window.onload = function(){
|
||||
li.id = i;
|
||||
function handleTabSwitch(tab) {
|
||||
return function(e) {
|
||||
if (tab.className === 'cbi-tab') return;
|
||||
if (tab.className === 'oc-tab') return;
|
||||
var prevTabId = -1;
|
||||
for(var j=0; j<titles.length; j++){
|
||||
if (titles[j].className === 'cbi-tab') prevTabId = j;
|
||||
titles[j].className = 'cbi-tab-disabled';
|
||||
if (titles[j].className === 'oc-tab') prevTabId = j;
|
||||
titles[j].className = 'oc-tab-disabled';
|
||||
divs[j].classList.remove('active');
|
||||
}
|
||||
tab.className = 'cbi-tab';
|
||||
tab.className = 'oc-tab';
|
||||
divs[tab.id].classList.add('active');
|
||||
|
||||
if (prevTabId == 1 && editor_core) {
|
||||
@@ -840,15 +953,24 @@ window.onload = function(){
|
||||
cl.value = coreLogAccumulator;
|
||||
}
|
||||
|
||||
if (tab.id == 0 && typeof editor_oc !== 'undefined' && editor_oc) {
|
||||
setCursorToFirstLineEnd(editor_oc);
|
||||
}
|
||||
|
||||
if (tab.id == 1 && !coreEditorInitialized) {
|
||||
coreEditorInitialized = true;
|
||||
if (typeof log_editor === 'function' && cl) {
|
||||
cl.value = coreLogAccumulator;
|
||||
cl.value = coreLogAccumulator.replace(/\n+$/, '');
|
||||
log_editor(cl, 'core', true, '100%', '540px');
|
||||
}
|
||||
} else if (tab.id == 1 && editor_core) {
|
||||
editor_core.setValue(coreLogAccumulator);
|
||||
editor_core.setValue(coreLogAccumulator.replace(/\n+$/, ''));
|
||||
editor_core.refresh();
|
||||
setCursorToFirstLineEnd(editor_core);
|
||||
}
|
||||
|
||||
if (tab.id == 2 && typeof editor_debug !== 'undefined' && editor_debug) {
|
||||
setCursorToFirstLineEnd(editor_debug);
|
||||
}
|
||||
|
||||
pollInterval = (tab.id == 1) ? 5000 : 1000;
|
||||
@@ -863,19 +985,20 @@ window.onload = function(){
|
||||
get_log_level();
|
||||
poll_log();
|
||||
setTimeout(function() {
|
||||
load_existing_debug_log();
|
||||
load_debug_log();
|
||||
}, 500);
|
||||
};
|
||||
|
||||
function renderDebugView() {
|
||||
function renderDebugView(src) {
|
||||
var wrapper = document.getElementById('debug-render-wrapper');
|
||||
var rendered = document.getElementById('debug-rendered');
|
||||
if (!wrapper || !rendered) return;
|
||||
var src = '';
|
||||
if (typeof editor_debug !== 'undefined' && editor_debug) {
|
||||
src = editor_debug.getValue();
|
||||
} else if (dl) {
|
||||
src = dl.value || '';
|
||||
if (!src) {
|
||||
if (typeof editor_debug !== 'undefined' && editor_debug) {
|
||||
src = editor_debug.getValue();
|
||||
} else if (dl) {
|
||||
src = dl.value || '';
|
||||
}
|
||||
}
|
||||
if (!src) return;
|
||||
|
||||
@@ -920,7 +1043,6 @@ function renderDebugView() {
|
||||
if (dl.parentNode && dl.parentNode.className.indexOf('oc') < 0) {
|
||||
dl.parentNode.classList.add('oc');
|
||||
}
|
||||
ocUpdateTheme();
|
||||
}
|
||||
|
||||
function copyDebugSource() {
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1,5 +1,6 @@
|
||||
<%-
|
||||
local fs = require "luci.openclash"
|
||||
local plugin_version = fs.oc_version()
|
||||
local logged_in = fs.uci_get_config("config", "oix_token") and true or false
|
||||
local checkin_enabled = fs.uci_get_config("config", "oix_checkin") == "1"
|
||||
local checkin_interval = fs.uci_get_config("config", "oix_checkin_interval") or "1"
|
||||
@@ -12,37 +13,39 @@ local function oix_logo_img(cls)
|
||||
end
|
||||
-%>
|
||||
<div class="oc">
|
||||
<script src="/luci-static/resources/openclash/js/common.js?v=<%=plugin_version%>"></script>
|
||||
<script src="/luci-static/resources/openclash/js/oc-icons.js?v=<%=plugin_version%>"></script>
|
||||
<fieldset class="cbi-section oix-panel">
|
||||
<div id="oix-msg-bar" class="oix-msg-bar"></div>
|
||||
<div id="oix-login-section"<%= logged_in and ' style="display:none;"' or '' %>>
|
||||
<div id="oix-msg-bar" class="oix-msg-bar oc-hidden"></div>
|
||||
<div id="oix-login-section" class="<%= logged_in and 'oc-hidden' or '' %>">
|
||||
<div class="oix-login-box">
|
||||
|
||||
<%= oix_logo_img("oix-logo") %>
|
||||
|
||||
<div class="mode-tabs" style="margin-bottom:14px;" id="oix-tabs">
|
||||
<div class="mode-tabs" id="oix-tabs">
|
||||
<button type="button" class="mode-tab active" id="oix-tab-account" onclick="OixCloud.switchTab('account')">
|
||||
<svg class="oc-icon" width="13" height="13"><use href="#oc-icon-user"/></svg>
|
||||
<%:Account Login%>
|
||||
<span><%:Account Login%></span>
|
||||
</button>
|
||||
<button type="button" class="mode-tab" id="oix-tab-token" onclick="OixCloud.switchTab('token')">
|
||||
<svg class="oc-icon" width="13" height="13"><use href="#oc-icon-key-oix"/></svg>
|
||||
<%:Token Login%>
|
||||
<span><%:Token Login%></span>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div id="oix-panel-account">
|
||||
<div style="margin-bottom:10px;">
|
||||
<div class="oix-field-group-sm">
|
||||
<input type="text" id="oix-email" class="oix-input oix-input-ok" placeholder="<%:Account Email Address%>" autocomplete="email" inputmode="email"
|
||||
value="<%= fs.uci_get_config('config', 'oix_email') or '' %>">
|
||||
<span id="oix-email-hint" class="oix-field-hint oix-field-help"></span>
|
||||
</div>
|
||||
<div style="margin-bottom:14px;">
|
||||
<div style="position:relative;">
|
||||
<input type="password" id="oix-passwd" class="oix-input oix-input-ok" placeholder="<%:Account Password%>" autocomplete="current-password"
|
||||
style="padding-right:36px;"
|
||||
<div class="oix-field-group">
|
||||
<div class="oix-input-wrap">
|
||||
<input type="password" id="oix-passwd" class="oix-input oix-input-ok oix-input-has-icon" placeholder="<%:Account Password%>" autocomplete="current-password"
|
||||
value="<%= fs.uci_get_config('config', 'oix_passwd') or '' %>">
|
||||
<button type="button" class="oix-pwd-toggle" onclick="OixCloud.togglePwd('oix-passwd')" style="position:absolute;right:5px;top:50%;transform:translateY(-50%);background:none;border:none;cursor:pointer;padding:3px;line-height:0;" title="<%:Show/Hide Password%>">
|
||||
<button type="button" class="oix-pwd-toggle" onclick="OixCloud.togglePwd('oix-passwd')"
|
||||
data-show="<%:Show Password%>" data-hide="<%:Hide Password%>"
|
||||
title="<%:Show Password%>">
|
||||
<svg class="oc-icon oix-eye-icon" width="15" height="15"><use href="#oc-icon-eye"/></svg>
|
||||
</button>
|
||||
</div>
|
||||
@@ -50,23 +53,25 @@ end
|
||||
</div>
|
||||
<button type="button" class="oix-btn oix-btn-primary oix-btn-block" onclick="OixCloud.doLogin()">
|
||||
<svg class="oc-icon" width="14" height="14"><use href="#oc-icon-login"/></svg>
|
||||
<%:Login Account%>
|
||||
<span><%:Login Account%></span>
|
||||
</button>
|
||||
|
||||
<div style="text-align:center;margin-top:12px;">
|
||||
<button type="button" class="oix-btn oix-btn-ghost oix-btn-block" onclick="OixCloud.openWebsite();return false;">
|
||||
<svg class="oc-icon" width="14" height="14"><use href="#oc-icon-home"/></svg>
|
||||
<%:oixCloud Website%>
|
||||
</button>
|
||||
</div>
|
||||
<div class="oix-btn-row">
|
||||
<button type="button" class="oix-btn oix-btn-ghost oix-btn-block" onclick="OixCloud.openWebsite();return false;">
|
||||
<svg class="oc-icon" width="14" height="14"><use href="#oc-icon-home"/></svg>
|
||||
<span><%:oixCloud Website%></span>
|
||||
</button>
|
||||
</div>
|
||||
<div id="oix-panel-token" style="display:none;">
|
||||
<div style="margin-bottom:14px;">
|
||||
<div style="position:relative;">
|
||||
<input type="password" id="oix-token" class="oix-input oix-input-ok" placeholder="<%:Enter your oixCloud token%>"
|
||||
style="padding-right:36px;"
|
||||
</div>
|
||||
<div id="oix-panel-token" class="oc-hidden">
|
||||
<div class="oix-field-group">
|
||||
<div class="oix-input-wrap">
|
||||
<input type="password" id="oix-token" class="oix-input oix-input-ok oix-input-has-icon" placeholder="<%:Please enter your oixCloud token%>"
|
||||
autocomplete="off"
|
||||
value="<%= fs.uci_get_config('config', 'oix_token') or '' %>">
|
||||
<button type="button" class="oix-pwd-toggle" onclick="OixCloud.togglePwd('oix-token')" style="position:absolute;right:5px;top:50%;transform:translateY(-50%);background:none;border:none;cursor:pointer;padding:3px;line-height:0;" title="<%:Show/Hide Token%>">
|
||||
<button type="button" class="oix-pwd-toggle" onclick="OixCloud.togglePwd('oix-token')"
|
||||
data-show="<%:Show Token%>" data-hide="<%:Hide Token%>"
|
||||
title="<%:Show Token%>">
|
||||
<svg class="oc-icon oix-eye-icon" width="15" height="15"><use href="#oc-icon-eye"/></svg>
|
||||
</button>
|
||||
</div>
|
||||
@@ -74,13 +79,13 @@ end
|
||||
</div>
|
||||
<button type="button" class="oix-btn oix-btn-primary oix-btn-block" onclick="OixCloud.doLogin()">
|
||||
<svg class="oc-icon" width="14" height="14"><use href="#oc-icon-login"/></svg>
|
||||
<%:Login Account%>
|
||||
<span><%:Login Account%></span>
|
||||
</button>
|
||||
|
||||
<div style="text-align:center;margin-top:12px;">
|
||||
<div class="oix-btn-row">
|
||||
<button type="button" class="oix-btn oix-btn-ghost oix-btn-block" onclick="OixCloud.openWebsite();return false;">
|
||||
<svg class="oc-icon" width="12" height="12"><use href="#oc-icon-home"/></svg>
|
||||
<%:oixCloud Website%>
|
||||
<span><%:oixCloud Website%></span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -90,7 +95,7 @@ end
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="oix-logged-section" style="display:<%= logged_in and 'block' or 'none' %>;">
|
||||
<div id="oix-logged-section"<%= logged_in and '' or ' class="oc-hidden"' %>>
|
||||
<div class="oix-header">
|
||||
<div class="oix-header-left">
|
||||
<span class="oix-status-badge">
|
||||
@@ -101,27 +106,27 @@ end
|
||||
<div class="oix-header-right">
|
||||
<button type="button" class="oix-btn oix-btn-primary oix-btn-sm" onclick="OixCloud.doCheckin();return false;">
|
||||
<svg class="oc-icon" width="12" height="12"><use href="#oc-icon-gift"/></svg>
|
||||
<%:Checkin%>
|
||||
<span><%:Checkin%></span>
|
||||
</button>
|
||||
<button type="button" class="oix-btn oix-btn-ghost-subtle oix-btn-sm" onclick="OixCloud.openWebsite();return false;">
|
||||
<img src="<%= oix_logo_src %>" width="14" height="14" style="border-radius:50%;vertical-align:middle" alt="oixCloud">
|
||||
<%:oixCloud Website%>
|
||||
<img class="oix-img-inline" src="<%= oix_logo_src %>" width="14" height="14" alt="oixCloud">
|
||||
<span><%:oixCloud Website%></span>
|
||||
</button>
|
||||
<button type="button" class="oix-btn oix-btn-danger oix-btn-sm" onclick="OixCloud.doLogout();return false;">
|
||||
<svg class="oc-icon" width="12" height="12"><use href="#oc-icon-logout"/></svg>
|
||||
<%:Logout Account%>
|
||||
<span><%:Logout Account%></span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="oix-announce" id="oix-announce">
|
||||
<div class="oix-announce oc-hidden" id="oix-announce">
|
||||
<div class="oix-announce-header">
|
||||
<svg class="oc-icon" width="14" height="14"><use href="#oc-icon-bell"/></svg>
|
||||
<%:Announcement%>
|
||||
</div>
|
||||
<div class="oix-announce-body oix-collapsed" id="oix-announce-body"></div>
|
||||
<div class="oix-announce-arrow" id="oix-announce-arrow" style="display:none;" onclick="OixCloud.toggleAnnounce();return false;">
|
||||
<svg class="oc-icon" width="18" height="18" style="color:var(--primary-color)"><use href="#oc-icon-chevron-oix"/></svg>
|
||||
<div class="oix-announce-arrow oc-hidden" id="oix-announce-arrow" onclick="OixCloud.toggleAnnounce();return false;">
|
||||
<svg class="oc-icon oix-icon-accent" width="18" height="18"><use href="#oc-icon-chevron-oix"/></svg>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -165,7 +170,7 @@ end
|
||||
<div class="oix-toggle-row">
|
||||
<span><%:Show on Overview%></span>
|
||||
<label class="oix-toggle" title="<%:Show on Overview%>">
|
||||
<input type="checkbox" id="oix-show-info-page" onchange="OixCloud.toggleInfoPage()" <%= fs.uci_get_config('config', 'oix_show_info_page') ~= '0' and 'checked' or '' %>>
|
||||
<input type="checkbox" id="oix-show-info-page" onchange="OixCloud.toggleInfoPage()" <%= fs.uci_get_config('config', 'oix_show_info_page') == '1' and 'checked' or '' %>>
|
||||
<span class="oix-toggle-slider"></span>
|
||||
</label>
|
||||
</div>
|
||||
@@ -209,10 +214,10 @@ end
|
||||
</div>
|
||||
</div>
|
||||
<div class="oix-settings-grid">
|
||||
<div class="oix-setting-card" style="grid-column: span 2;">
|
||||
<div class="oix-setting-card oix-card-span-2">
|
||||
<div class="oix-params-item">
|
||||
<span><%:Optional Parameters%>:</span>
|
||||
<input type="text" id="oix-params" style="min-width:140px;" value="<%= oix_params %>" onblur="OixCloud.saveParams()" oninput="OixCloud.validateParams(this)" class="oix-input-num oix-input-ok" placeholder="&type=love&tfo=false&area=hk">
|
||||
<input type="text" id="oix-params" class="oix-input-num oix-input-ok oix-input-wide" value="<%= oix_params %>" onblur="OixCloud.saveParams()" oninput="OixCloud.validateParams(this)" placeholder="&type=love&tfo=true">
|
||||
</div>
|
||||
<div class="oix-card-help">
|
||||
<svg class="oc-icon" width="12" height="12"><use href="#oc-icon-help"/></svg>
|
||||
@@ -245,6 +250,9 @@ var OixCloud = {
|
||||
_paramsRetry: 0,
|
||||
_paramsMaxRetry: 30,
|
||||
_paramsRetryTimer: null,
|
||||
_origCheckinInterval: '<%= checkin_interval %>',
|
||||
_origCheckinMultiple: '<%= checkin_multiple %>',
|
||||
_origParams: '<%= oix_params %>',
|
||||
|
||||
init: function() {
|
||||
if (this.loggedIn) { this.loadAccountInfo(); this.startPolling(); this.fetchParams(); }
|
||||
@@ -254,20 +262,38 @@ var OixCloud = {
|
||||
var input = document.getElementById('oix-params');
|
||||
if (!input || input.value !== '') return;
|
||||
var self = this;
|
||||
var uciDefault = '<%= oix_default_params %>';
|
||||
XHR.get(OIX_URLS.paramsGet, null, function(x, status) {
|
||||
if (x && x.status == 200 && status && status.params) {
|
||||
input.value = status.params;
|
||||
self._paramsRetry = 0;
|
||||
if (status.default_params) {
|
||||
XHR.get(OIX_URLS.save, {default_params: status.default_params}, function() {});
|
||||
if (x && x.status == 200 && status) {
|
||||
if (status.params) {
|
||||
input.value = status.params;
|
||||
self._paramsRetry = 0;
|
||||
if (status.default_params) {
|
||||
XHR.get(OIX_URLS.save, {default_params: status.default_params}, function() {});
|
||||
}
|
||||
} else if (status.default_params) {
|
||||
input.value = status.default_params;
|
||||
input.placeholder = status.default_params;
|
||||
self._paramsRetry = 0;
|
||||
} else if (uciDefault) {
|
||||
input.value = uciDefault;
|
||||
input.placeholder = uciDefault;
|
||||
self._paramsRetry = 0;
|
||||
} else {
|
||||
if (self._paramsRetry < self._paramsMaxRetry) {
|
||||
self._paramsRetry++;
|
||||
self._paramsRetryTimer = setTimeout(function() { self.fetchParams(); }, 5000);
|
||||
} else {
|
||||
self._paramsRetry = 0;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (self._paramsRetry < self._paramsMaxRetry) {
|
||||
self._paramsRetry++;
|
||||
self._paramsRetryTimer = setTimeout(function() { self.fetchParams(); }, 5000);
|
||||
} else {
|
||||
var cached = '<%= oix_default_params %>';
|
||||
if (cached) { input.value = cached; input.placeholder = cached; }
|
||||
} else if (uciDefault) {
|
||||
input.value = uciDefault;
|
||||
input.placeholder = uciDefault;
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -277,8 +303,8 @@ var OixCloud = {
|
||||
this._activeTab = tab;
|
||||
document.getElementById('oix-tab-account').classList.toggle('active', tab === 'account');
|
||||
document.getElementById('oix-tab-token').classList.toggle('active', tab === 'token');
|
||||
document.getElementById('oix-panel-account').style.display = tab === 'account' ? 'block' : 'none';
|
||||
document.getElementById('oix-panel-token').style.display = tab === 'token' ? 'block' : 'none';
|
||||
document.getElementById('oix-panel-account').classList.toggle('oc-hidden', tab !== 'account');
|
||||
document.getElementById('oix-panel-token').classList.toggle('oc-hidden', tab !== 'token');
|
||||
OixMsg.clearAll();
|
||||
},
|
||||
|
||||
@@ -297,46 +323,110 @@ var OixCloud = {
|
||||
if (!passwd) { OixMsg.field('oix-passwd', '<%:Please enter password%>'); return; }
|
||||
data.email = email; data.passwd = passwd;
|
||||
}
|
||||
data.checkin = document.getElementById('oix-checkin-enable').checked ? '1' : '0'; data.interval = document.getElementById('oix-checkin-interval').value || '1'; data.multiple = document.getElementById('oix-checkin-multiple').value || '1';
|
||||
var self = this, btns = document.querySelectorAll('#oix-login-section .oix-btn-primary');
|
||||
btns.forEach(function(b){ b._origHTML = b.innerHTML; b.disabled = true; var svg = b.querySelector('svg'); b.innerHTML = (svg ? svg.outerHTML : '') + ' <%:Login...%>'; });
|
||||
XHR.get(OIX_URLS.save, data, function(x, status) {
|
||||
if (!x || x.status != 200) { OixMsg.show('<%:Network request failed, please check your connection and try again%>', 'error'); btns.forEach(function(b){b.disabled=false;b.innerHTML=b._origHTML;}); return; }
|
||||
var setBtnBusy = function(b, busy, text) {
|
||||
var span = b.querySelector('span:not(.loading-spinner)');
|
||||
if (busy) {
|
||||
if (span && !b.dataset.ocBtnOriginalText) {
|
||||
b.dataset.ocBtnOriginalText = span.textContent;
|
||||
}
|
||||
if (span && text) { span.textContent = text; }
|
||||
ocSetBtnLoading(b, true);
|
||||
} else {
|
||||
ocSetBtnLoading(b, false);
|
||||
if (span && b.dataset.ocBtnOriginalText) {
|
||||
span.textContent = b.dataset.ocBtnOriginalText;
|
||||
delete b.dataset.ocBtnOriginalText;
|
||||
}
|
||||
}
|
||||
};
|
||||
btns.forEach(function(b){ setBtnBusy(b, true, '<%:Login...%>'); });
|
||||
|
||||
var onLoginSuccess = function() {
|
||||
var info = '<%:oixCloud Login Successful%>' + ', <%:Note: oixCloud need a specific core installed, OpenClash will auto download, After the core start, an oixCloud nodes provider will be added, which you can customize as needed%>';
|
||||
OixMsg.show(info, 'success', 20000);
|
||||
self.loggedIn = true; self.showLoggedIn(); self.loadAccountInfo(); self.startPolling();
|
||||
var updateBtnText = function(text) {
|
||||
btns.forEach(function(b){
|
||||
var span = b.querySelector('span:not(.loading-spinner)');
|
||||
if (span) { span.textContent = text; }
|
||||
});
|
||||
};
|
||||
|
||||
var onLoginSuccess = function() {
|
||||
btns.forEach(function(b){ setBtnBusy(b, false); });
|
||||
var info = '<%:oixCloud Login Successful%>' + ', <%:Note: oixCloud need a specific core installed, OpenClash will auto download, After the core start, an oixCloud nodes provider will be added, which you can customize as needed%>';
|
||||
OixMsg.show(info, 'success', 20000);
|
||||
self.loggedIn = true; self.showLoggedIn(); self.loadAccountInfo(); self.startPolling(); self.fetchParams();
|
||||
};
|
||||
|
||||
var onLoginError = function(msg) {
|
||||
btns.forEach(function(b){ setBtnBusy(b, false); });
|
||||
OixMsg.show('<%:oixCloud Login Failed:%> ' + msg, 'error');
|
||||
self.rebuildCredentials();
|
||||
};
|
||||
|
||||
var doStreamLogin = function(loginData) {
|
||||
var xhr = new XMLHttpRequest();
|
||||
var url = OIX_URLS.login;
|
||||
var sep = url.indexOf('?') >= 0 ? '&' : '?';
|
||||
if (loginData) {
|
||||
url += sep + Object.keys(loginData).map(function(k){ return encodeURIComponent(k)+'='+encodeURIComponent(loginData[k]); }).join('&');
|
||||
}
|
||||
xhr.open('GET', url, true);
|
||||
xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest');
|
||||
var lastIndex = 0;
|
||||
|
||||
var parseLines = function(text) {
|
||||
var lines = text.split('\n');
|
||||
for (var i = 0; i < lines.length; i++) {
|
||||
var line = lines[i].trim();
|
||||
if (!line) continue;
|
||||
try {
|
||||
var obj = JSON.parse(line);
|
||||
if (obj.stage === 'done') {
|
||||
onLoginSuccess();
|
||||
} else if (obj.stage === 'error') {
|
||||
onLoginError(obj.result || '<%:oixCloud Login Failed%>');
|
||||
} else if (obj.text) {
|
||||
updateBtnText(obj.text);
|
||||
}
|
||||
} catch(e) {}
|
||||
}
|
||||
};
|
||||
|
||||
if (isToken) {
|
||||
XHR.get(OIX_URLS.login, {token: data.token}, function(x2, s2) {
|
||||
btns.forEach(function(b){ b.disabled = false; b.innerHTML = b._origHTML; });
|
||||
if (x2 && x2.status == 200 && s2.result == 200) {
|
||||
onLoginSuccess();
|
||||
} else {
|
||||
var msg = (s2 && s2.result) ? s2.result : '<%:oixCloud Login Failed%>';
|
||||
OixMsg.show('<%:oixCloud Login Failed:%> ' + msg, 'error');
|
||||
}
|
||||
});
|
||||
} else {
|
||||
XHR.get(OIX_URLS.login, null, function(x2, s2) {
|
||||
btns.forEach(function(b){ b.disabled = false; b.innerHTML = b._origHTML; });
|
||||
if (x2 && x2.status == 200 && s2.result == 200) {
|
||||
onLoginSuccess();
|
||||
} else {
|
||||
var msg = (s2 && s2.result) ? s2.result : '<%:oixCloud Login Failed%>';
|
||||
OixMsg.show('<%:oixCloud Login Failed:%> ' + msg, 'error');
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
xhr.onprogress = function() {
|
||||
var newText = xhr.responseText.substring(lastIndex);
|
||||
lastIndex = xhr.responseText.length;
|
||||
parseLines(newText);
|
||||
};
|
||||
xhr.onload = function() {
|
||||
if (lastIndex < xhr.responseText.length) {
|
||||
parseLines(xhr.responseText.substring(lastIndex));
|
||||
}
|
||||
if (xhr.status !== 200) {
|
||||
onLoginError('<%:Network request failed, please check your connection and try again%>');
|
||||
} else if (xhr.responseText.indexOf('"stage":"done"') === -1 &&
|
||||
xhr.responseText.indexOf('"stage":"error"') === -1) {
|
||||
onLoginError('<%:Server response error, please try again later%>');
|
||||
}
|
||||
};
|
||||
xhr.onerror = function() {
|
||||
onLoginError('<%:Network request failed, please check your connection and try again%>');
|
||||
};
|
||||
xhr.send();
|
||||
};
|
||||
|
||||
if (isToken) {
|
||||
doStreamLogin({token: data.token});
|
||||
} else {
|
||||
XHR.get(OIX_URLS.save, data, function(x, status) {
|
||||
if (!x || x.status != 200) { OixMsg.show('<%:Network request failed, please check your connection and try again%>', 'error'); btns.forEach(function(b){setBtnBusy(b, false);}); return; }
|
||||
doStreamLogin(null);
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
doLogout: function() {
|
||||
var self = this;
|
||||
var btn = document.querySelector('#oix-logged-section .oix-btn-danger');
|
||||
if (btn) { btn._origHTML = btn.innerHTML; btn.disabled = true; var svg = btn.querySelector('svg'); btn.innerHTML = (svg ? svg.outerHTML : '') + ' <%:Logout...%>'; }
|
||||
if (btn) { btn._origHTML = btn.innerHTML; btn.disabled = true; var svg = btn.querySelector('svg'); btn.innerHTML = (svg ? svg.outerHTML : '') + ' <span><%:Logout...%></span>'; }
|
||||
XHR.get(OIX_URLS.logout, null, function(x, status) {
|
||||
if (btn) { btn.disabled = false; btn.innerHTML = btn._origHTML; }
|
||||
if (x && x.status == 200 && status.result == 200) {
|
||||
@@ -350,15 +440,33 @@ var OixCloud = {
|
||||
},
|
||||
|
||||
showLoggedIn: function() {
|
||||
document.getElementById('oix-login-section').style.display = 'none';
|
||||
document.getElementById('oix-logged-section').style.display = 'block';
|
||||
document.getElementById('oix-login-section').classList.add('oc-hidden');
|
||||
document.getElementById('oix-logged-section').classList.remove('oc-hidden');
|
||||
},
|
||||
|
||||
showLoggedOut: function() {
|
||||
document.getElementById('oix-login-section').style.display = 'block';
|
||||
document.getElementById('oix-logged-section').style.display = 'none';
|
||||
document.getElementById('oix-login-section').classList.remove('oc-hidden');
|
||||
document.getElementById('oix-logged-section').classList.add('oc-hidden');
|
||||
this.stopParamsRetry();
|
||||
this.clearForm();
|
||||
this.switchTab('account');
|
||||
this.rebuildCredentials();
|
||||
},
|
||||
|
||||
rebuildCredentials: function() {
|
||||
var self = this;
|
||||
setTimeout(function() {
|
||||
if (self.loggedIn) return;
|
||||
['oix-email', 'oix-passwd'].forEach(function(id) {
|
||||
var oldEl = document.getElementById(id);
|
||||
if (oldEl) {
|
||||
var newEl = oldEl.cloneNode(false);
|
||||
newEl.removeAttribute('value');
|
||||
newEl.value = '';
|
||||
oldEl.parentNode.replaceChild(newEl, oldEl);
|
||||
}
|
||||
});
|
||||
}, 150);
|
||||
},
|
||||
|
||||
clearForm: function() {
|
||||
@@ -379,9 +487,9 @@ var OixCloud = {
|
||||
self.renderAnnouncement(status.result);
|
||||
} else {
|
||||
var cards = document.getElementById('oix-cards');
|
||||
if (cards) cards.style.display = 'none';
|
||||
var ann = document.getElementById('oix-announce');
|
||||
if (ann) ann.style.display = 'none';
|
||||
if (cards) cards.classList.add('oc-hidden');
|
||||
var ann = document.getElementById('oix-announce');
|
||||
if (ann) ann.classList.add('oc-hidden');
|
||||
}
|
||||
});
|
||||
},
|
||||
@@ -392,7 +500,7 @@ var OixCloud = {
|
||||
var body = document.getElementById('oix-announce-body');
|
||||
var arrow = document.getElementById('oix-announce-arrow');
|
||||
if (el && body) {
|
||||
el.style.display = 'block';
|
||||
el.classList.remove('oc-hidden');
|
||||
body.innerHTML = '<strong>' + (result.announcement.date || '') + ': </strong>' + result.announcement.content;
|
||||
body.classList.remove('oix-collapsed');
|
||||
var ref = document.getElementById('oix-cards');
|
||||
@@ -414,9 +522,9 @@ var OixCloud = {
|
||||
ref.parentElement.removeChild(measure);
|
||||
if (fullH > maxH + 4) {
|
||||
body.classList.add('oix-collapsed');
|
||||
if (arrow) arrow.style.display = 'flex';
|
||||
if (arrow) arrow.classList.remove('oc-hidden');
|
||||
} else {
|
||||
if (arrow) arrow.style.display = 'none';
|
||||
if (arrow) arrow.classList.add('oc-hidden');
|
||||
}
|
||||
};
|
||||
if (ref && ref.offsetWidth > 0) {
|
||||
@@ -434,7 +542,7 @@ var OixCloud = {
|
||||
}
|
||||
} else {
|
||||
var el2 = document.getElementById('oix-announce');
|
||||
if (el2) el2.style.display = 'none';
|
||||
if (el2) el2.classList.add('oc-hidden');
|
||||
}
|
||||
},
|
||||
|
||||
@@ -457,14 +565,14 @@ var OixCloud = {
|
||||
});
|
||||
},
|
||||
|
||||
startPolling: function() { this.stopPolling(); var s=this; this._pollTimer=setInterval(function(){s.loadAccountInfo();},1800000); },
|
||||
startPolling: function() { this.stopPolling(); var s=this; s.fetchParams(); this._pollTimer=setInterval(function(){s.loadAccountInfo();s.fetchParams();},600000); },
|
||||
stopPolling: function() { if(this._pollTimer){clearInterval(this._pollTimer);this._pollTimer=null;} },
|
||||
stopParamsRetry: function() { if(this._paramsRetryTimer){clearTimeout(this._paramsRetryTimer);this._paramsRetryTimer=null;} this._paramsRetry = 0; },
|
||||
|
||||
doCheckin: function() {
|
||||
var self = this;
|
||||
var btn = document.querySelector('#oix-logged-section .oix-btn-primary');
|
||||
if (btn) { btn._origHTML = btn.innerHTML; btn.disabled = true; var svg = btn.querySelector('svg'); btn.innerHTML = (svg ? svg.outerHTML : '') + ' <%:Checkin...%>'; }
|
||||
if (btn) { btn._origHTML = btn.innerHTML; btn.disabled = true; var svg = btn.querySelector('svg'); btn.innerHTML = (svg ? svg.outerHTML : '') + ' <span><%:Checkin...%></span>'; }
|
||||
XHR.get(OIX_URLS.checkin, null, function(x, status) {
|
||||
if (btn) { btn.disabled = false; btn.innerHTML = btn._origHTML; }
|
||||
if (x && x.status == 200 && status.result && status.result.ret == 200) {
|
||||
@@ -479,7 +587,9 @@ var OixCloud = {
|
||||
|
||||
toggleCheckin: function() {
|
||||
var on = document.getElementById('oix-checkin-enable').checked;
|
||||
XHR.get(OIX_URLS.save, {checkin: on?'1':'0'}, function(x, status) {
|
||||
var interval = document.getElementById('oix-checkin-interval').value || '1';
|
||||
var multiple = document.getElementById('oix-checkin-multiple').value || '1';
|
||||
XHR.get(OIX_URLS.save, {checkin: on?'1':'0', interval: interval, multiple: multiple}, function(x, status) {
|
||||
if (x && x.status == 200) { OixMsg.show('<%:Setting saved%>', 'success', 2000); }
|
||||
});
|
||||
},
|
||||
@@ -493,8 +603,16 @@ var OixCloud = {
|
||||
if (isNaN(interval) || interval < 1 || interval > 720) { OixMsg.field('oix-checkin-interval', '<%:Checkin interval must be between 1 and 720%>'); OixMsg.show('<%:Checkin interval must be between 1 and 720%>', 'error'); valid = false; }
|
||||
if (isNaN(multiple) || multiple < 1 || multiple > 100) { OixMsg.field('oix-checkin-multiple', '<%:Multiple Must Be a Positive Integer and No More Than 100%>'); OixMsg.show('<%:Multiple Must Be a Positive Integer and No More Than 100%>', 'error'); valid = false; }
|
||||
if (!valid) return;
|
||||
XHR.get(OIX_URLS.save, {checkin: on?'1':'0', interval: String(isNaN(interval)?1:interval), multiple: String(isNaN(multiple)?1:multiple)}, function(x, status) {
|
||||
if (x && x.status == 200) { OixMsg.show('<%:Checkin settings saved%>', 'success', 4000); }
|
||||
var newInterval = String(isNaN(interval) ? 1 : interval);
|
||||
var newMultiple = String(isNaN(multiple) ? 1 : multiple);
|
||||
if (newInterval === this._origCheckinInterval && newMultiple === this._origCheckinMultiple) return;
|
||||
var self = this;
|
||||
XHR.get(OIX_URLS.save, {checkin: on?'1':'0', interval: newInterval, multiple: newMultiple}, function(x, status) {
|
||||
if (x && x.status == 200) {
|
||||
self._origCheckinInterval = newInterval;
|
||||
self._origCheckinMultiple = newMultiple;
|
||||
OixMsg.show('<%:Checkin settings saved%>', 'success', 4000);
|
||||
}
|
||||
else { OixMsg.show('<%:Failed to save checkin settings, please try again%>', 'error'); }
|
||||
});
|
||||
},
|
||||
@@ -512,8 +630,13 @@ var OixCloud = {
|
||||
OixMsg.show('<%:Params too long%>', 'error');
|
||||
return;
|
||||
}
|
||||
if (params === this._origParams) return;
|
||||
var self = this;
|
||||
XHR.get(OIX_URLS.params, {params: params}, function(x, status) {
|
||||
if (x && x.status == 200) { OixMsg.show('<%:Optional parameters saved%>', 'success', 4000); }
|
||||
if (x && x.status == 200) {
|
||||
self._origParams = params;
|
||||
OixMsg.show('<%:Optional parameters saved%>', 'success', 4000);
|
||||
}
|
||||
else { OixMsg.show('<%:Failed to save optional parameters, please try again%>', 'error'); }
|
||||
});
|
||||
},
|
||||
@@ -559,6 +682,10 @@ var OixCloud = {
|
||||
if (!inp) return;
|
||||
var isPwd = inp.type === 'password';
|
||||
inp.type = isPwd ? 'text' : 'password';
|
||||
var btn = inp.parentNode.querySelector('.oix-pwd-toggle');
|
||||
if (btn) {
|
||||
btn.title = isPwd ? btn.getAttribute('data-hide') : btn.getAttribute('data-show');
|
||||
}
|
||||
var icon = inp.parentNode.querySelector('svg');
|
||||
if (icon) {
|
||||
icon.innerHTML = isPwd
|
||||
@@ -592,15 +719,15 @@ var OixMsg = {
|
||||
var icons = {
|
||||
success: '<svg width="15" height="15"><use href="#oc-icon-success"/></svg>',
|
||||
error: '<svg width="15" height="15"><use href="#oc-icon-error"/></svg>',
|
||||
info: '<svg width="15" height="15"><use href="#oc-icon-info"/></svg>'
|
||||
info: '<svg width="15" height="15"><use href="#oc-icon-alert-circle"/></svg>'
|
||||
};
|
||||
bar.style.display = 'flex'; bar.innerHTML = (icons[level] || icons.info) + '<span>' + msg + '</span>';
|
||||
bar.classList.remove('oc-hidden'); bar.innerHTML = (icons[level] || icons.info) + '<span>' + msg + '</span>';
|
||||
bar.className = 'oix-msg-bar oix-msg-' + (level || 'info');
|
||||
clearTimeout(this._timer);
|
||||
var t = (timeout !== undefined) ? timeout : (level === 'error' ? 6000 : 3000);
|
||||
if (t > 0) { var s=this; this._timer=setTimeout(function(){s.hide();},t); }
|
||||
},
|
||||
hide: function() { document.getElementById('oix-msg-bar').style.display = 'none'; },
|
||||
hide: function() { document.getElementById('oix-msg-bar').classList.add('oc-hidden'); },
|
||||
field: function(id, msg) {
|
||||
var hint = document.getElementById(id + '-hint'), inp = document.getElementById(id);
|
||||
if (hint) { hint.textContent = msg || ''; hint.className = msg ? 'oix-field-hint oix-field-error' : 'oix-field-hint oix-field-help'; }
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
</div>
|
||||
<div class="general">
|
||||
<h1 id="oix-plan"></h1>
|
||||
<div class="oix-announcement" id="oix-announcement" style="display: none;">
|
||||
<div class="oix-announcement" id="oix-announcement">
|
||||
<div id="oix-announcement-banner" class="oix-announcement-banner">
|
||||
<div class="oix-megaphone-container">
|
||||
<svg id="oix-megaphone" width="15" height="15"><use href="#oc-icon-megaphone"/></svg>
|
||||
@@ -140,7 +140,7 @@
|
||||
oix_integral.title = status.result.integral;
|
||||
|
||||
if (status.result.announcement && status.result.announcement.content != "") {
|
||||
oix_plan.style.display = 'none';
|
||||
oix_plan.classList.add('oc-hidden');
|
||||
loadOixAnnouncement(status.result.announcement.date + ": " + status.result.announcement.content);
|
||||
}
|
||||
show_info();
|
||||
@@ -188,11 +188,11 @@
|
||||
result = result.replace(/\s+/g, ' ').trim();
|
||||
|
||||
if (!result) {
|
||||
oix_container.style.display = 'none';
|
||||
oix_container.classList.add('oc-hidden');
|
||||
return;
|
||||
}
|
||||
|
||||
oix_container.style.display = 'flex';
|
||||
oix_container.classList.remove('oc-hidden');
|
||||
|
||||
var oixAnimator = new AnnouncementAnimator({
|
||||
bannerElement: oix_banner,
|
||||
@@ -209,8 +209,8 @@
|
||||
});
|
||||
|
||||
setTimeout(function() {
|
||||
oix_plan.style.display = 'block';
|
||||
oix_container.style.display = 'none';
|
||||
oix_plan.classList.remove('oc-hidden');
|
||||
oix_container.classList.add('oc-hidden');
|
||||
oixAnimator.destroy();
|
||||
}, 1000 * 60);
|
||||
}
|
||||
@@ -296,12 +296,5 @@
|
||||
}
|
||||
}
|
||||
|
||||
function imgerrorfuns(imgobj,imgSrc)
|
||||
{
|
||||
setTimeout(function(){
|
||||
imgobj.src=imgSrc;
|
||||
},1000*10);
|
||||
}
|
||||
|
||||
//]]></script>
|
||||
</html>
|
||||
@@ -6,77 +6,127 @@
|
||||
|
||||
function act_manual_unlock_test_<%=stream_id_name%>(btn, type)
|
||||
{
|
||||
var manual_<%=stream_id_name%>_type_legend = document.getElementById('manual-<%=stream_id_name%>-test-state');
|
||||
var manual_<%=stream_id_name%>_type_output = document.getElementById('manual-<%=stream_id_name%>-test-output');
|
||||
var legend = document.getElementById('manual-<%=stream_id_name%>-test-state');
|
||||
var output = document.getElementById('manual-<%=stream_id_name%>-test-output');
|
||||
var r = confirm("<%:Network instability may occur during testing, Are you sure want to start test?%>")
|
||||
if (r == true) {
|
||||
if (manual_<%=stream_id_name%>_type_legend && manual_<%=stream_id_name%>_type_output)
|
||||
if (legend && output)
|
||||
{
|
||||
manual_<%=stream_id_name%>_type_output.innerHTML =
|
||||
'<img src="<%=resource%>/icons/loading.svg" onerror="this.onerror=null;this.src=\'<%=resource%>/icons/loading.gif\'" alt="<%:Loading...%>" style="vertical-align:middle" /> ' +
|
||||
output.innerHTML =
|
||||
'<span class="loading-spinner" style="vertical-align:middle"></span> ' +
|
||||
'<%:Waiting for command to complete...%>';
|
||||
|
||||
manual_<%=stream_id_name%>_type_legend.textContent = '<%:Collecting data...%>';
|
||||
manual_<%=stream_id_name%>_type_legend.parentNode.style.display = 'block';
|
||||
manual_<%=stream_id_name%>_type_legend.style.display = 'block';
|
||||
legend.textContent = '<%:Collecting data...%>';
|
||||
legend.parentNode.classList.remove('oc-hidden');
|
||||
legend.style.display = 'block';
|
||||
};
|
||||
|
||||
XHR.get('<%=luci.dispatcher.build_url("admin", "services", "openclash", "manual_stream_unlock_test")%>', {type: type}, function(x, status) {
|
||||
if (x && x.status == 200 && x.responseText != "")
|
||||
{
|
||||
manual_<%=stream_id_name%>_type_legend.textContent = '<%:Unlock Test Result%>';
|
||||
manual_<%=stream_id_name%>_type_output.innerHTML = '';
|
||||
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.timeout = 0;
|
||||
var url = '<%=luci.dispatcher.build_url("admin", "services", "openclash", "manual_stream_unlock_test")%>' + '?type=' + encodeURIComponent(type);
|
||||
xhr.open('GET', url, true);
|
||||
xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest');
|
||||
var editorName = 'manual_stream_unlock_test';
|
||||
var editor = null, editorReady = false;
|
||||
xhr.onprogress = function() {
|
||||
if (!editorReady) {
|
||||
output.innerHTML = '';
|
||||
var ta = document.createElement('textarea');
|
||||
ta.value = x.responseText;
|
||||
manual_<%=stream_id_name%>_type_output.appendChild(ta);
|
||||
_cmWhenReady(function() {
|
||||
log_editor(ta, 'manual_stream_unlock_test', 'true', '600px', '250px');
|
||||
});
|
||||
output.appendChild(ta);
|
||||
editor = log_editor(ta, editorName, 'true', '600px', '250px');
|
||||
editorReady = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
manual_<%=stream_id_name%>_type_output.innerHTML = '<span class="error"><%:Something Wrong While Testing...%></span>';
|
||||
if (editor && editor.setValue) {
|
||||
editor.setValue(xhr.responseText.split('\n').map(function(l) { return l.trim(); }).filter(function(l) { return l !== ''; }).join('\n'));
|
||||
editor.dispatch({ selection: { anchor: editor.state.doc.length } });
|
||||
if (editor.scrollDOM) editor.scrollDOM.scrollTop = editor.scrollDOM.scrollHeight;
|
||||
}
|
||||
}
|
||||
);
|
||||
};
|
||||
xhr.onload = function() {
|
||||
if (editor && editor.setValue) {
|
||||
editor.setValue(xhr.responseText.split('\n').map(function(l) { return l.trim(); }).filter(function(l) { return l !== ''; }).join('\n'));
|
||||
editor.dispatch({ selection: { anchor: editor.state.doc.length } });
|
||||
if (editor.scrollDOM) editor.scrollDOM.scrollTop = editor.scrollDOM.scrollHeight;
|
||||
}
|
||||
legend.textContent = '<%:Unlock Test Result%>';
|
||||
if (xhr.status != 200 && xhr.responseText == "") {
|
||||
output.innerHTML = '<span class="error"><%:Something Wrong While Testing...%></span>';
|
||||
}
|
||||
};
|
||||
xhr.ontimeout = function() {
|
||||
if (xhr.responseText == "") {
|
||||
output.innerHTML = '<span class="error"><%:Request Timeout...%></span>';
|
||||
}
|
||||
};
|
||||
xhr.onerror = function() {
|
||||
if (xhr.responseText == "") {
|
||||
output.innerHTML = '<span class="error"><%:Something Wrong While Testing...%></span>';
|
||||
}
|
||||
};
|
||||
xhr.send();
|
||||
};
|
||||
};
|
||||
|
||||
function act_all_proxies_test_<%=stream_id_name%>(btn, type)
|
||||
{
|
||||
var all_<%=stream_id_name%>_legend = document.getElementById('all-<%=stream_id_name%>-test-state');
|
||||
var all_<%=stream_id_name%>_output = document.getElementById('all-<%=stream_id_name%>-test-output');
|
||||
var legend = document.getElementById('all-<%=stream_id_name%>-test-state');
|
||||
var output = document.getElementById('all-<%=stream_id_name%>-test-output');
|
||||
var r = confirm("<%:Network instability may occur during testing, Are you sure want to start test?%>")
|
||||
if (r == true) {
|
||||
if (all_<%=stream_id_name%>_legend && all_<%=stream_id_name%>_output)
|
||||
if (legend && output)
|
||||
{
|
||||
all_<%=stream_id_name%>_output.innerHTML =
|
||||
'<img src="<%=resource%>/icons/loading.svg" onerror="this.onerror=null;this.src=\'<%=resource%>/icons/loading.gif\'" alt="<%:Loading...%>" style="vertical-align:middle" /> ' +
|
||||
output.innerHTML =
|
||||
'<span class="loading-spinner" style="vertical-align:middle"></span> ' +
|
||||
'<%:Waiting for command to complete...%>';
|
||||
|
||||
all_<%=stream_id_name%>_legend.textContent = '<%:Collecting data...%>';
|
||||
all_<%=stream_id_name%>_legend.parentNode.style.display = 'block';
|
||||
all_<%=stream_id_name%>_legend.style.display = 'block';
|
||||
legend.textContent = '<%:Collecting data...%>';
|
||||
legend.parentNode.classList.remove('oc-hidden');
|
||||
legend.style.display = 'block';
|
||||
};
|
||||
|
||||
XHR.get('<%=luci.dispatcher.build_url("admin", "services", "openclash", "all_proxies_stream_test")%>', {type: type}, function(x, status) {
|
||||
if (x && x.status == 200 && x.responseText != "")
|
||||
{
|
||||
all_<%=stream_id_name%>_legend.textContent = '<%:All Proxies Test Result%>';
|
||||
all_<%=stream_id_name%>_output.innerHTML = '';
|
||||
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.timeout = 0;
|
||||
var url = '<%=luci.dispatcher.build_url("admin", "services", "openclash", "all_proxies_stream_test")%>' + '?type=' + encodeURIComponent(type);
|
||||
xhr.open('GET', url, true);
|
||||
xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest');
|
||||
var editorName = 'all_proxies_stream_test';
|
||||
var editor = null, editorReady = false;
|
||||
xhr.onprogress = function() {
|
||||
if (!editorReady) {
|
||||
output.innerHTML = '';
|
||||
var ta = document.createElement('textarea');
|
||||
ta.value = x.responseText;
|
||||
all_<%=stream_id_name%>_output.appendChild(ta);
|
||||
_cmWhenReady(function() {
|
||||
log_editor(ta, 'all_proxies_stream_test', true, '600px', '250px');
|
||||
});
|
||||
output.appendChild(ta);
|
||||
editor = log_editor(ta, editorName, true, '600px', '250px');
|
||||
editorReady = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
all_<%=stream_id_name%>_output.innerHTML = '<span class="error"><%:Something Wrong While Testing...%></span>';
|
||||
if (editor && editor.setValue) {
|
||||
editor.setValue(xhr.responseText.split('\n').map(function(l) { return l.trim(); }).filter(function(l) { return l !== ''; }).join('\n'));
|
||||
editor.dispatch({ selection: { anchor: editor.state.doc.length } });
|
||||
if (editor.scrollDOM) editor.scrollDOM.scrollTop = editor.scrollDOM.scrollHeight;
|
||||
}
|
||||
}
|
||||
);
|
||||
};
|
||||
xhr.onload = function() {
|
||||
if (editor && editor.setValue) {
|
||||
editor.setValue(xhr.responseText.split('\n').map(function(l) { return l.trim(); }).filter(function(l) { return l !== ''; }).join('\n'));
|
||||
editor.dispatch({ selection: { anchor: editor.state.doc.length } });
|
||||
if (editor.scrollDOM) editor.scrollDOM.scrollTop = editor.scrollDOM.scrollHeight;
|
||||
}
|
||||
legend.textContent = '<%:All Proxies Test Result%>';
|
||||
if (xhr.status != 200 && xhr.responseText == "") {
|
||||
output.innerHTML = '<span class="error"><%:Something Wrong While Testing...%></span>';
|
||||
}
|
||||
};
|
||||
xhr.ontimeout = function() {
|
||||
if (xhr.responseText == "") {
|
||||
output.innerHTML = '<span class="error"><%:Request Timeout...%></span>';
|
||||
}
|
||||
};
|
||||
xhr.onerror = function() {
|
||||
if (xhr.responseText == "") {
|
||||
output.innerHTML = '<span class="error"><%:Something Wrong While Testing...%></span>';
|
||||
}
|
||||
};
|
||||
xhr.send();
|
||||
};
|
||||
};
|
||||
|
||||
@@ -85,11 +135,11 @@ function act_all_proxies_test_<%=stream_id_name%>(btn, type)
|
||||
<input type="button" class="btn cbi-button cbi-input-reload" value="<%:Unlock Test(Select)%>" onclick="return act_manual_unlock_test_<%=stream_id_name%>(this, '<%=self.value%>')" />
|
||||
<input type="button" class="btn cbi-button cbi-input-reload" value="<%:All Proxies Test%>" onclick="return act_all_proxies_test_<%=stream_id_name%>(this, '<%=self.value%>')" />
|
||||
<div class="oc">
|
||||
<div class="diag-style" style="display:none">
|
||||
<div class="diag-style oc-hidden">
|
||||
<div id="manual-<%=stream_id_name%>-test-state" class="diag-legend"><%:Collecting data...%></div>
|
||||
<div id="manual-<%=stream_id_name%>-test-output"></div>
|
||||
</div>
|
||||
<div class="diag-style" style="display:none">
|
||||
<div class="diag-style oc-hidden">
|
||||
<div id="all-<%=stream_id_name%>-test-state" class="diag-legend"><%:Collecting data...%></div>
|
||||
<div id="all-<%=stream_id_name%>-test-output"></div>
|
||||
</div>
|
||||
|
||||
@@ -1,308 +0,0 @@
|
||||
<%+openclash/common%>
|
||||
<script src="/luci-static/resources/openclash/js/oc-icons.js?v=<%=plugin_version%>"></script>
|
||||
<body>
|
||||
<div class="oc">
|
||||
<div id="selectPopup" class="select-popup hidden">
|
||||
<div class="select-popup-header">
|
||||
<div class="config-editor-title">
|
||||
<%:Check Update%>
|
||||
</div>
|
||||
<div class="config-editor-actions">
|
||||
<button type="button" class="icon-btn close-btn" onclick="closeSelectPopup()" title="<%:Close%>">
|
||||
<svg width="14" height="14"><use href="#oc-icon-close"/></svg>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="select-config-section">
|
||||
<div class="config-grid">
|
||||
<div class="config-item">
|
||||
<div class="config-label"><%:Compiled Version%></div>
|
||||
<select class="select-class oc-arch-select" id="CORE_VERSION_CDN">
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="config-item">
|
||||
<div class="config-label"><%:Release Branch%></div>
|
||||
<select class="select-class" id="RELEASE_BRANCH_CDN">
|
||||
<option value="master">Master</option>
|
||||
<option value="dev">Developer</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="config-item">
|
||||
<div class="config-label">
|
||||
<%:Smart Core%>
|
||||
<a href="javascript:void(0);" onclick="window.open('https://github.com/vernesong/mihomo/releases', '_blank');" class="help-link" title="<%:View core infos that support smart group%>">
|
||||
<svg width="12" height="12"><use href="#oc-icon-help"/></svg>
|
||||
</a>
|
||||
</div>
|
||||
<select class="select-class" id="SMART_ENABLE_CDN">
|
||||
<option value="0"><%:Disabled%></option>
|
||||
<option value="1"><%:Enable%></option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="select-popup-body">
|
||||
<div class="select-option" data-value="https://raw.githubusercontent.com/">
|
||||
<span>https://raw.githubusercontent.com/ (<%:RAW address%>)</span>
|
||||
</div>
|
||||
<div class="select-option" data-value="https://fastly.jsdelivr.net/">
|
||||
<span>https://fastly.jsdelivr.net/</span>
|
||||
</div>
|
||||
<div class="select-option" data-value="https://testingcf.jsdelivr.net/">
|
||||
<span>https://testingcf.jsdelivr.net/</span>
|
||||
</div>
|
||||
<div class="select-option" data-value="https://cdn.jsdelivr.net/">
|
||||
<span>https://cdn.jsdelivr.net/</span>
|
||||
</div>
|
||||
<div class="select-option" data-value="custom">
|
||||
<span><%:Custom Your CDN URL%></span>
|
||||
<span style="display: flex; align-items: center; height: 100%;">
|
||||
<svg width="18" height="18" style="display: block;"><use href="#oc-icon-chevron-down"/></svg>
|
||||
</span>
|
||||
</div>
|
||||
<input type="text" id="customOptionInput" class="custom-option-input" value="https://ghfast.top/" placeholder="<%:Type CDN URL, Format Like%> https://ghfast.top/" style="display: none;">
|
||||
<div class="select-option" id="addCustomOption" style="display: none;"><%:Add%></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
<script type="text/javascript">
|
||||
//<*)\\.)+[a-z]{2,}|'+ // domain name
|
||||
'((\\d{1,3}\\.){3}\\d{1,3}))'+ // OR ip (v4) address
|
||||
'(\\:\\d+)?(\\/[-a-z\\d%_.~+]*)*'+ // port and path
|
||||
'(\\?[;&a-z\\d%_.~+=-]*)?'+ // query string
|
||||
'(\\#[-a-z\\d_]*)?'+'\/$','i'); // fragment locator
|
||||
return !!pattern.test(str);
|
||||
}
|
||||
|
||||
function HTTP_delay(domain, ID) {
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.open('GET', '/cgi-bin/luci/admin/services/openclash/website_check?domain=' + encodeURIComponent(domain), true);
|
||||
xhr.timeout = 5000;
|
||||
|
||||
xhr.onreadystatechange = function() {
|
||||
if (xhr.readyState === 4) {
|
||||
let status, text, response_time = 0;
|
||||
if (xhr.status === 200) {
|
||||
try {
|
||||
var resp = JSON.parse(xhr.responseText);
|
||||
response_time = resp.response_time || 0;
|
||||
if (resp.success) {
|
||||
if (response_time <= 500) {
|
||||
status = 'fast';
|
||||
text = response_time + ' ms';
|
||||
} else if (response_time > 500 && response_time <= 1000) {
|
||||
status = 'medium';
|
||||
text = response_time + ' ms';
|
||||
} else {
|
||||
status = 'slow';
|
||||
text = response_time + ' ms';
|
||||
}
|
||||
} else {
|
||||
status = 'error';
|
||||
text = resp.error || '<%:Access Denied%>';
|
||||
}
|
||||
} catch (e) {
|
||||
status = 'error';
|
||||
text = '<%:Access Denied%>';
|
||||
}
|
||||
} else {
|
||||
status = 'error';
|
||||
text = '<%:Access Timed Out%>';
|
||||
}
|
||||
updateCDNStatus(ID, status, text);
|
||||
}
|
||||
};
|
||||
|
||||
xhr.ontimeout = function() {
|
||||
updateCDNStatus(ID, 'error', '<%:Access Timed Out%>');
|
||||
};
|
||||
|
||||
xhr.onerror = function() {
|
||||
updateCDNStatus(ID, 'error', '<%:Access Denied%>');
|
||||
};
|
||||
|
||||
xhr.send();
|
||||
}
|
||||
|
||||
function updateCDNStatus(element, status, text) {
|
||||
var existingStatus = element.querySelector('.cdn-status');
|
||||
if (existingStatus) {
|
||||
existingStatus.remove();
|
||||
}
|
||||
|
||||
var statusSpan = document.createElement('span');
|
||||
statusSpan.className = 'cdn-status ' + status;
|
||||
statusSpan.textContent = text;
|
||||
element.appendChild(statusSpan);
|
||||
}
|
||||
|
||||
function select_git_cdn(btn, type) {
|
||||
var selectPopup = document.getElementById('selectPopup');
|
||||
get_update_info();
|
||||
selectPopup.classList.remove('hidden');
|
||||
|
||||
var customOptionInput = document.getElementById('customOptionInput');
|
||||
var addCustomOption = document.getElementById('addCustomOption');
|
||||
var selectOptions = document.getElementsByClassName('select-option');
|
||||
|
||||
customOptionInput.style.display = 'none';
|
||||
addCustomOption.style.display = 'none';
|
||||
|
||||
selectPopup.addEventListener('click', function(event) {
|
||||
select_window(event, type);
|
||||
});
|
||||
|
||||
document.addEventListener('click', select_window_close);
|
||||
|
||||
refresh_httpdelay = setInterval(() => {
|
||||
for(var i = 0; i < selectOptions.length; i++) {
|
||||
if (isValidURL(selectOptions[i].dataset.value)) {
|
||||
HTTP_delay(selectOptions[i].dataset.value, selectOptions[i]);
|
||||
}
|
||||
}
|
||||
}, Math.floor(Math.random()*(7-3+1)+3)*1000);
|
||||
}
|
||||
|
||||
function select_window_close(event) {
|
||||
var selectPopup = document.getElementById('selectPopup');
|
||||
if (!selectPopup.contains(event.target)) {
|
||||
selectPopup.classList.add('hidden');
|
||||
if (typeof refresh_httpdelay !== 'undefined') {
|
||||
clearInterval(refresh_httpdelay);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function select_window(event, type) {
|
||||
var v = core_version_cdn.value;
|
||||
var r = release_branch_cdn.value;
|
||||
var s = smart_enable_cdn.value;
|
||||
var selectOptions = document.getElementsByClassName('select-option');
|
||||
var target = event.target;
|
||||
var selectPopup = document.getElementById('selectPopup');
|
||||
var customOptionInput = document.getElementById('customOptionInput');
|
||||
var addCustomOption = document.getElementById('addCustomOption');
|
||||
|
||||
var optionElem = target.closest ? target.closest('.select-option') : null;
|
||||
|
||||
if (optionElem && optionElem.dataset.value === 'custom' && customOptionInput.style.display === 'block') {
|
||||
customOptionInput.style.display = 'none';
|
||||
addCustomOption.style.display = 'none';
|
||||
} else if (optionElem && optionElem.dataset.value === 'custom') {
|
||||
customOptionInput.style.display = 'block';
|
||||
addCustomOption.style.display = 'block';
|
||||
customOptionInput.focus();
|
||||
} else if (target === customOptionInput) {
|
||||
customOptionInput.style.display = 'block';
|
||||
addCustomOption.style.display = 'block';
|
||||
customOptionInput.focus();
|
||||
} else if (target === addCustomOption) {
|
||||
var newValue = customOptionInput.value.trim();
|
||||
if (newValue !== '' && isValidURL(newValue)) {
|
||||
var newOption = document.createElement('div');
|
||||
newOption.classList.add('select-option');
|
||||
newOption.innerHTML = '<span>' + newValue + '</span>';
|
||||
newOption.dataset.value = newValue;
|
||||
selectPopup.querySelector('.select-popup-body').insertBefore(newOption, selectPopup.querySelector('.select-popup-body').children[selectOptions.length - 2]);
|
||||
customOptionInput.style.display = 'none';
|
||||
addCustomOption.style.display = 'none';
|
||||
}
|
||||
else {
|
||||
alert("<%:Please enter a valid URL!%>");
|
||||
}
|
||||
} else if (optionElem && optionElem != addCustomOption && optionElem != customOptionInput) {
|
||||
customOptionInput.style.display = 'none';
|
||||
addCustomOption.style.display = 'none';
|
||||
if (typeof LogManager !== 'undefined' && LogManager) {
|
||||
LogManager.startLogDisplay('<%:Checking...%>');
|
||||
}
|
||||
if (optionElem.dataset.value === 'https://raw.githubusercontent.com/') {
|
||||
optionElem.dataset.value = '';
|
||||
}
|
||||
if (type === 'core_download') {
|
||||
XHR.get('<%=luci.dispatcher.build_url("admin", "services", "openclash", "save_corever_branch")%>', {core_ver: v, release_branch: r, smart_enable: s}, function(x, status) {
|
||||
if (x && x.status == 200) {
|
||||
XHR.get('<%=luci.dispatcher.build_url("admin", "services", "openclash", "core_download")%>', {url: optionElem.dataset.value}, function(x, status) {
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
else {
|
||||
XHR.get('<%=luci.dispatcher.build_url("admin", "services", "openclash", "save_corever_branch")%>', {core_ver: v, release_branch: r, smart_enable: s}, function(x, status) {
|
||||
if (x && x.status == 200) {
|
||||
XHR.get('<%=luci.dispatcher.build_url("admin", "services", "openclash", "one_key_update")%>', {url: optionElem.dataset.value}, function(x, status) {
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
selectPopup.classList.add('hidden');
|
||||
if (typeof refresh_httpdelay !== 'undefined') {
|
||||
clearInterval(refresh_httpdelay);
|
||||
}
|
||||
}
|
||||
else if (target != addCustomOption && target != customOptionInput) {
|
||||
customOptionInput.style.display = 'none';
|
||||
addCustomOption.style.display = 'none';
|
||||
}
|
||||
else {
|
||||
if (target != customOptionInput) {
|
||||
selectPopup.classList.add('hidden');
|
||||
if (typeof refresh_httpdelay !== 'undefined') {
|
||||
clearInterval(refresh_httpdelay);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function closeSelectPopup() {
|
||||
var selectPopup = document.getElementById('selectPopup');
|
||||
selectPopup.classList.add('hidden');
|
||||
if (typeof refresh_httpdelay !== 'undefined') {
|
||||
clearInterval(refresh_httpdelay);
|
||||
}
|
||||
}
|
||||
//]]>
|
||||
</script>
|
||||
File diff suppressed because it is too large.
Load diff
@@ -3,7 +3,6 @@
|
||||
local fs = require "luci.openclash"
|
||||
local plugin_version = fs.oc_version()
|
||||
%>
|
||||
<script src="/luci-static/resources/openclash/js/oc-icons.js?v=<%=plugin_version%>"></script>
|
||||
<%
|
||||
local fs = require "luci.openclash"
|
||||
local val = self:cfgvalue(section)
|
||||
@@ -11,17 +10,20 @@
|
||||
local idname = math.random(1000)..(string.match(filename, "[%w_]+") or "")
|
||||
%>
|
||||
|
||||
<div class="sub_div oc">
|
||||
<span id='<%=idname%>' class="sub_tab"></span>
|
||||
<button type="button" class="sub_setting" title='<%:Refresh%>' alt='<%:Refresh%>' onclick='return sub_info_refresh_<%=idname%>(true)'>
|
||||
<svg viewBox="0 0 24 24"><use href="#oc-icon-refresh"/></svg>
|
||||
</button>
|
||||
<button type="button" class="sub_setting" title='<%:Specify URL%>' alt='<%:Specify URL%>' onclick='return setUrlConfig_<%=idname%>()'>
|
||||
<svg viewBox="0 0 48 48"><use href="#oc-icon-chat"/></svg>
|
||||
</button>
|
||||
<button type="button" class="sub_setting" title='<%:Edit Subscription%>' alt='<%:Edit Subscription%>' onclick='return uploadConfig_<%=idname%>()'>
|
||||
<svg width="14" height="14"><use href="#oc-icon-settings"/></svg>
|
||||
</button>
|
||||
<script src="/luci-static/resources/openclash/js/oc-icons.js?v=<%=plugin_version%>"></script>
|
||||
<div class="oc">
|
||||
<div class="sub_div">
|
||||
<span id='<%=idname%>' class="sub_tab"></span>
|
||||
<button type="button" class="sub_setting" title='<%:Refresh%>' alt='<%:Refresh%>' onclick='return sub_info_refresh_<%=idname%>(true)'>
|
||||
<svg viewBox="0 0 24 24"><use href="#oc-icon-refresh"/></svg>
|
||||
</button>
|
||||
<button type="button" class="sub_setting" title='<%:Specify URL%>' alt='<%:Specify URL%>' onclick='return setUrlConfig_<%=idname%>()'>
|
||||
<svg viewBox="0 0 48 48"><use href="#oc-icon-chat"/></svg>
|
||||
</button>
|
||||
<button type="button" class="sub_setting" title='<%:Edit Subscription%>' alt='<%:Edit Subscription%>' onclick='return uploadConfig_<%=idname%>()'>
|
||||
<svg width="14" height="14"><use href="#oc-icon-settings"/></svg>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">//<;
|
||||
}
|
||||
@@ -278,4 +288,5 @@ function uploadConfig_<%=idname%>() {
|
||||
}
|
||||
|
||||
//]]></script>
|
||||
</div>
|
||||
<%+cbi/valuefooter%>
|
||||
@@ -1,5 +1,5 @@
|
||||
<%+cbi/valueheader%>
|
||||
<div style="display: flex; flex-wrap: wrap; align-items: center; gap: 6px;">
|
||||
<div class="oc-flex-center" style="flex-wrap: wrap; gap: 6px;">
|
||||
<div class="cbi-value-field" id="switch_dashboard_<%=self.option%>"><%:Collecting data...%></div>
|
||||
<div class="cbi-value-field" id="delete_dashboard_<%=self.option%>">
|
||||
<input type="button" class="btn cbi-button cbi-button-reset" value="<%:Delete%>" onclick="return delete_dashboard(this, '<%=self.option%>')"/>
|
||||
|
||||
@@ -29,11 +29,11 @@
|
||||
if ( x && x.status == 200 ) {
|
||||
if ( status.switch_mode == "redir-host" ) {
|
||||
alert('<%:Page has been switched to Fake-IP mode!%>')
|
||||
window.location.href='<%="settings"%>';
|
||||
window.location.href='<%=luci.dispatcher.build_url("admin", "services", "openclash", "settings")%>';
|
||||
}
|
||||
else {
|
||||
alert('<%:Page has been switched to Redir-Host mode!%>')
|
||||
window.location.href='<%="settings"%>';
|
||||
window.location.href='<%=luci.dispatcher.build_url("admin", "services", "openclash", "settings")%>';
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -153,6 +153,7 @@ local sectiontype = "_"..self.config.."_"..string.match(self.sectiontype, "[%w_]
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
box-shadow: none;
|
||||
}
|
||||
|
||||
#tab-header-<%=self.config%>-<%=self.sectiontype%> ul li.cbi-tab > a{
|
||||
|
||||
@@ -89,22 +89,23 @@
|
||||
|
||||
function restore_config(btn)
|
||||
{
|
||||
btn.value = '<%:Restore Default%>';
|
||||
btn.disabled = true;
|
||||
var r = confirm("<%:Are you sure want to restore the default config?%>")
|
||||
if (r == true) {
|
||||
btn.disabled = true;
|
||||
btn.value = '<%:Restoring...%>';
|
||||
XHR.get('<%=luci.dispatcher.build_url("admin", "services", "openclash", "restore")%>', null, function(x, status) {
|
||||
btn.disabled = false;
|
||||
btn.value = '<%:Restore Default%>';
|
||||
if ( x && x.status == 200 ) {
|
||||
alert('<%:Restore succeeded!%>')
|
||||
window.location.href='<%="settings"%>';
|
||||
window.location.href='<%=luci.dispatcher.build_url("admin", "services", "openclash", "settings")%>';
|
||||
}
|
||||
else {
|
||||
alert('<%:Restore failed!%>')
|
||||
window.location.href='<%="settings"%>';
|
||||
window.location.href='<%=luci.dispatcher.build_url("admin", "services", "openclash", "settings")%>';
|
||||
}
|
||||
});
|
||||
}
|
||||
btn.disabled = false;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1,27 +1,89 @@
|
||||
<%+cbi/valueheader%>
|
||||
<div style="text-align: center; margin:0 auto; display:block; white-space: nowrap;">
|
||||
<label class="cbi-value" style="display:inline-block; width: 100%;" for="ulfiles"><%:Upload File Type%> <%:(Click to select)%>
|
||||
<select name="file_type" style="width:auto">
|
||||
<option value="config" selected="selected"><%:Config File%> (.yaml)</option>
|
||||
<option value="proxy-provider"><%:Proxy Provider File%></option>
|
||||
<option value="rule-provider"><%:Rule Provider File%></option>
|
||||
<option value="clash_meta">[Meta] <%:Core File%> (.tar.gz)</option>
|
||||
<option value="backup-file"><%:Backup File%> (.tar.gz)</option>
|
||||
</select>
|
||||
<input class="cbi-input-file" style="width: 30%" type="file" id="ulfile" name="ulfile" />
|
||||
<input type="submit" class="btn cbi-button cbi-input-reload" name="upload" value="<%:Upload%>" />
|
||||
<input type="submit" class="btn cbi-button cbi-button-reset" value="<%:Backup%>" onclick="return backup_all_file(this)"/>
|
||||
<%
|
||||
local fs = require "luci.openclash"
|
||||
local plugin_version = fs.oc_version()
|
||||
%>
|
||||
<script src="/luci-static/resources/openclash/js/common.js?v=<%=plugin_version%>"></script>
|
||||
<div class="oc">
|
||||
<div class="upload-bar">
|
||||
<label for="file_type"><%:Upload File Type%>:</label>
|
||||
<div class="form-select-wrapper oc-w-auto">
|
||||
<select name="file_type" id="file_type" class="form-select">
|
||||
<option value="config" selected="selected"><%:Config File%> (.yaml)</option>
|
||||
<option value="proxy-provider"><%:Proxy Provider File%></option>
|
||||
<option value="rule-provider"><%:Rule Provider File%></option>
|
||||
<option value="clash_meta">[Meta] <%:Core File%> (.tar.gz)</option>
|
||||
<option value="backup-file"><%:Backup File%> (.tar.gz)</option>
|
||||
</select>
|
||||
</div>
|
||||
<input type="file" id="ulfile" name="ulfile" class="form-file" />
|
||||
<div class="config-upload-buttons">
|
||||
<button type="submit" class="btn" name="upload">
|
||||
<svg width="14" height="14"><use href="#oc-icon-upload"/></svg>
|
||||
<span><%:Upload%></span>
|
||||
</button>
|
||||
<button type="button" class="btn" onclick="return backup_all_file(this)">
|
||||
<svg width="14" height="14"><use href="#oc-icon-download"/></svg>
|
||||
<span><%:Backup%></span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<%
|
||||
local msg = self:cfgvalue(section) or ""
|
||||
%>
|
||||
<div class="upload-note" id="upload-note">
|
||||
<div class="upload-note-default" id="upload-note-default"><%:Note: Please Upload File According To File Type, File Will Be Saved To The Prompt Path%></div>
|
||||
<% if msg and msg ~= "" then %>
|
||||
<div class="upload-result" id="upload-result"><%=pcdata(msg)%></div>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
<%+cbi/valuefooter%>
|
||||
|
||||
<script type="text/javascript">//<![CDATA[
|
||||
|
||||
(function() {
|
||||
var result = document.getElementById('upload-result');
|
||||
var defaultNote = document.getElementById('upload-note-default');
|
||||
if (result && defaultNote) {
|
||||
defaultNote.classList.add('oc-hidden');
|
||||
setTimeout(function() {
|
||||
result.classList.add('oc-hidden');
|
||||
defaultNote.classList.remove('oc-hidden');
|
||||
}, 10000);
|
||||
}
|
||||
})();
|
||||
|
||||
function backup_all_file(btn)
|
||||
{
|
||||
btn.value = '<%:Backup%>';
|
||||
btn.disabled = true;
|
||||
window.location.href='<%="backup"%>';
|
||||
btn.disabled = false;
|
||||
ocSetBtnLoading(btn, true);
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.open('GET', '<%=luci.dispatcher.build_url("admin", "services", "openclash", "backup")%>', true);
|
||||
xhr.responseType = 'blob';
|
||||
xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest');
|
||||
xhr.onload = function() {
|
||||
ocSetBtnLoading(btn, false);
|
||||
if (xhr.status == 200 && xhr.response) {
|
||||
var disposition = xhr.getResponseHeader('Content-Disposition') || '';
|
||||
var match = disposition.match(/filename="?([^";]+)"?/);
|
||||
var filename = match ? match[1] : 'Backup-OpenClash.tar.gz';
|
||||
var blobUrl = URL.createObjectURL(xhr.response);
|
||||
var a = document.createElement('a');
|
||||
a.href = blobUrl;
|
||||
a.download = filename;
|
||||
document.body.appendChild(a);
|
||||
a.click();
|
||||
document.body.removeChild(a);
|
||||
setTimeout(function() { URL.revokeObjectURL(blobUrl); }, 1000);
|
||||
} else {
|
||||
alert('<%:Backup failed!%>');
|
||||
}
|
||||
};
|
||||
xhr.onerror = function() {
|
||||
ocSetBtnLoading(btn, false);
|
||||
alert('<%:Backup failed!%>');
|
||||
};
|
||||
xhr.send();
|
||||
return false;
|
||||
};
|
||||
|
||||
|
||||
@@ -122,6 +122,12 @@ msgstr "Aplicar ajustes"
|
||||
msgid "Download Config"
|
||||
msgstr "Descargar configuración"
|
||||
|
||||
msgid "Click to Download"
|
||||
msgstr "Clic para descargar"
|
||||
|
||||
msgid "Failed to get download link"
|
||||
msgstr "No se pudo obtener el enlace de descarga"
|
||||
|
||||
msgid "Copy Config"
|
||||
msgstr "Copiar configuración"
|
||||
|
||||
@@ -155,6 +161,9 @@ msgstr "Fake-IP (TUN mixto)"
|
||||
msgid "Select Mode For OpenClash Work, Try Flush DNS Cache If Network Error"
|
||||
msgstr "Selecciona el modo de funcionamiento de OpenClash. Si hay errores de red, intenta vaciar la caché DNS."
|
||||
|
||||
msgid "Proxy"
|
||||
msgstr "Proxy"
|
||||
|
||||
msgid "Proxy Mode"
|
||||
msgstr "Modo de proxy"
|
||||
|
||||
@@ -597,9 +606,6 @@ msgstr "Reglas personalizadas"
|
||||
msgid "Version Update"
|
||||
msgstr "Actualización de versión"
|
||||
|
||||
msgid "Model Not Found"
|
||||
msgstr "No se ha podido identificar la arquitectura del procesador"
|
||||
|
||||
msgid "Current Core Version"
|
||||
msgstr "Versión actual del núcleo"
|
||||
|
||||
@@ -612,9 +618,6 @@ msgstr "Error al comprobar actualización"
|
||||
msgid "<New>"
|
||||
msgstr "<Disponible>"
|
||||
|
||||
msgid "Getting Last Version..."
|
||||
msgstr "Obteniendo la última versión..."
|
||||
|
||||
msgid "Update Core File"
|
||||
msgstr "Actualizar núcleo"
|
||||
|
||||
@@ -1116,6 +1119,12 @@ msgstr "Recopilar datos de conexiones para entrenar modelo Smart"
|
||||
msgid "The Priority Of The Nodes, The Higher Than 1, The More Likely It Is To Be Selected, The Default Is 1, Support Regex"
|
||||
msgstr "Ajusta el peso de cada nodo: >1 aumenta selección; <1 reduce uso. Valor por defecto: 1. Compatible con regex."
|
||||
|
||||
msgid "Smart Group Tolerance"
|
||||
msgstr "Tolerancia del grupo Smart"
|
||||
|
||||
msgid "Sort When Proxies Delays Within Tolerance are Treated as Equal, Preventing Jitter"
|
||||
msgstr "Ordena tratando como iguales los proxies cuya diferencia de latencia no supere la tolerancia, evitando oscilaciones"
|
||||
|
||||
msgid "Running Status"
|
||||
msgstr "Estado de ejecución"
|
||||
|
||||
@@ -1137,6 +1146,9 @@ msgstr "Zashboard"
|
||||
msgid "Control Panel"
|
||||
msgstr "Panel de control"
|
||||
|
||||
msgid "If the control panel does not open properly, please try going to Plugin Settings - Dashboard Settings to reset the panel"
|
||||
msgstr "Si el panel de control no se abre correctamente, vaya a Configuración del [plugin - Ajustes] del panel para restablecerlo"
|
||||
|
||||
msgid "Quick Action"
|
||||
msgstr "Acciones rápidas"
|
||||
|
||||
@@ -1188,9 +1200,6 @@ msgstr "Comprobar actualización de GeoSite"
|
||||
msgid "You have not installed the core yet, do you want to download and install it now?"
|
||||
msgstr "Aún no has instalado el núcleo. ¿Deseas descargarlo e instalarlo ahora?"
|
||||
|
||||
msgid "No Compiled Version is Selected, Please Select on The Top and Try Again!"
|
||||
msgstr "No se ha seleccionado ninguna versión compilada. Selecciónala arriba y vuelve a intentarlo."
|
||||
|
||||
msgid "Checking..."
|
||||
msgstr "Comprobando..."
|
||||
|
||||
@@ -1206,6 +1215,9 @@ msgstr "Guardando..."
|
||||
msgid "Save successful"
|
||||
msgstr "Guardado con éxito"
|
||||
|
||||
msgid "Failed to save"
|
||||
msgstr "Error al guardar"
|
||||
|
||||
msgid "Failed to save age config"
|
||||
msgstr "Error al guardar la configuración de age"
|
||||
|
||||
@@ -1257,51 +1269,18 @@ msgstr "Versión compilada"
|
||||
msgid "Release Branch"
|
||||
msgstr "Rama de actualización"
|
||||
|
||||
msgid "Note: options will auto-save when you click to update or download"
|
||||
msgstr "Nota: las opciones se guardarán automáticamente al actualizar o descargar."
|
||||
|
||||
msgid "CPU Architecture"
|
||||
msgid "CPU Arch"
|
||||
msgstr "Arquitectura de CPU"
|
||||
|
||||
msgid "Last Check Update"
|
||||
msgstr "Última comprobación de actualización"
|
||||
|
||||
msgid "Current Core"
|
||||
msgstr "Versión actual del núcleo"
|
||||
|
||||
msgid "Latest Core"
|
||||
msgstr "Última versión del núcleo"
|
||||
|
||||
msgid "Core path:"
|
||||
msgstr "Ruta del núcleo:"
|
||||
|
||||
msgid "Update Core"
|
||||
msgstr "Actualizar núcleo"
|
||||
|
||||
msgid "Download Latest Core"
|
||||
msgstr "Descargar última versión del núcleo"
|
||||
|
||||
msgid "Client Update"
|
||||
msgstr "Actualización del cliente"
|
||||
|
||||
msgid "Current Client"
|
||||
msgstr "Versión actual del cliente"
|
||||
|
||||
msgid "Update Client"
|
||||
msgstr "Actualizar cliente"
|
||||
|
||||
msgid "Latest Client"
|
||||
msgstr "Última versión del cliente"
|
||||
|
||||
msgid "Download Latest Client"
|
||||
msgstr "Descargar última versión del cliente"
|
||||
|
||||
msgid "Restore Default"
|
||||
msgstr "Restablecer por defecto"
|
||||
|
||||
msgid "Failed to get the latest version. Please try again later!"
|
||||
msgstr "Error al obtener la última versión. Inténtalo más tarde."
|
||||
|
||||
msgid "Are you sure want to restore the default config?"
|
||||
msgstr "¿Seguro que deseas restablecer la configuración por defecto?"
|
||||
|
||||
@@ -1368,6 +1347,45 @@ msgstr "Acceso normal"
|
||||
msgid "Access Denied"
|
||||
msgstr "Acceso denegado"
|
||||
|
||||
msgid "Connection Failed"
|
||||
msgstr "Conexión fallida"
|
||||
|
||||
msgid "Invalid Response"
|
||||
msgstr "Respuesta no válida"
|
||||
|
||||
msgid "Installed"
|
||||
msgstr "Instalado"
|
||||
|
||||
msgid "Select Version"
|
||||
msgstr "Seleccionar versión"
|
||||
|
||||
msgid "Latest"
|
||||
msgstr "Última"
|
||||
|
||||
msgid "Latency"
|
||||
msgstr "Latencia"
|
||||
|
||||
msgid "Plugin"
|
||||
msgstr "Plugin"
|
||||
|
||||
msgid "Core"
|
||||
msgstr "Núcleo"
|
||||
|
||||
msgid "Plugin Version"
|
||||
msgstr "Versión del plugin"
|
||||
|
||||
msgid "Core Version"
|
||||
msgstr "Versión del núcleo"
|
||||
|
||||
msgid "Date"
|
||||
msgstr "Fecha"
|
||||
|
||||
msgid "Failed to get version history"
|
||||
msgstr "Error al obtener historial"
|
||||
|
||||
msgid "Failed to get data, will retry"
|
||||
msgstr "Error al obtener datos, se reintentará"
|
||||
|
||||
msgid "Bind Network Interface"
|
||||
msgstr "Vincular interfaz de red"
|
||||
|
||||
@@ -1461,6 +1479,9 @@ msgstr "¿Seguro que deseas eliminar todos los archivos del núcleo?"
|
||||
msgid "Remove succeeded!"
|
||||
msgstr "Eliminación completada."
|
||||
|
||||
msgid "Removing..."
|
||||
msgstr "Eliminando..."
|
||||
|
||||
msgid "Remove failed!"
|
||||
msgstr "Error al eliminar."
|
||||
|
||||
@@ -1518,20 +1539,26 @@ msgstr "Iniciando descarga"
|
||||
msgid "Download successful, start pre update test..."
|
||||
msgstr "Descarga completa, iniciando pruebas previas a la actualización..."
|
||||
|
||||
msgid "opkg update failed or timed out, retrying..."
|
||||
msgstr "opkg update falló o expiró, reintentando..."
|
||||
msgid "opkg update failed or timed out:"
|
||||
msgstr "opkg update falló o expiró:"
|
||||
|
||||
msgid "opkg update failed, trying pre update test..."
|
||||
msgstr "opkg update falló, se sigue intentando la prueba previa..."
|
||||
msgid "apk update failed or timed out:"
|
||||
msgstr "apk update falló o expiró:"
|
||||
|
||||
msgid "apk update failed or timed out, retrying..."
|
||||
msgstr "apk update falló o expiró, reintentando..."
|
||||
msgid "opkg update failed:"
|
||||
msgstr "opkg update falló:"
|
||||
|
||||
msgid "apk update failed, trying pre update test..."
|
||||
msgstr "apk update falló, se sigue intentando la prueba previa..."
|
||||
msgid "apk update failed:"
|
||||
msgstr "apk update falló:"
|
||||
|
||||
msgid "Pre update test failed..."
|
||||
msgstr "Las pruebas previas han fallado..."
|
||||
msgid "Pre update test failed:"
|
||||
msgstr "Las pruebas previas han fallado:"
|
||||
|
||||
msgid ", retrying..."
|
||||
msgstr ", reintentando..."
|
||||
|
||||
msgid ", trying pre update test..."
|
||||
msgstr ", se sigue intentando la prueba previa..."
|
||||
|
||||
msgid "Pre update test failed after 3 attempts, the file is saved in /tmp/openclash.ipk, please try to update manually with"
|
||||
msgstr "Pruebas fallidas; archivo guardado en /tmp/openclash.ipk, actualiza manualmente con:"
|
||||
@@ -1545,8 +1572,8 @@ msgstr "Pruebas previas superadas. Preparando actualización, no recargues la p
|
||||
msgid "Installing the new version, please do not refresh the page or do other operations..."
|
||||
msgstr "Instalando nueva versión; no recargues la página ni realices acciones."
|
||||
|
||||
msgid "Installation failed..."
|
||||
msgstr "Instalación fallida..."
|
||||
msgid "Installation failed:"
|
||||
msgstr "Instalación fallida:"
|
||||
|
||||
msgid "OpenClash update failed after 3 attempts, the file is saved in /tmp/openclash.ipk, please try to update manually with"
|
||||
msgstr "Actualización fallida; archivo guardado en /tmp/openclash.ipk, intenta actualizar con:"
|
||||
@@ -1575,31 +1602,28 @@ msgstr "Descargando núcleo; si falla, descárgalo y súbelo manualmente."
|
||||
msgid "Core Download Successful, Start Update..."
|
||||
msgstr "Núcleo descargado correctamente, iniciando actualización..."
|
||||
|
||||
msgid "Core Download Failed, Please Check The Network or Try Again Later!"
|
||||
msgstr "Descarga del núcleo fallida; verifica la red o inténtalo más tarde."
|
||||
|
||||
msgid "Core Update Failed, Please Check The Network or Try Again Later!"
|
||||
msgstr "Actualización del núcleo fallida; revisa la red o inténtalo de nuevo."
|
||||
|
||||
msgid "Core Update Successful!"
|
||||
msgid "Core Update Successful"
|
||||
msgstr "¡Actualización del núcleo completada!"
|
||||
|
||||
msgid "Core Update Failed, Please Make Sure Enough Flash Memory Space or Selected Correct Core Platform And Try Again!"
|
||||
msgstr "Error al actualizar el núcleo: verifica que haya espacio suficiente o que la plataforma seleccionada sea correcta."
|
||||
msgid "Core Update Failed:"
|
||||
msgstr "Error al actualizar el núcleo:"
|
||||
|
||||
msgid "Core Update Failed..."
|
||||
msgstr "Error al actualizar el núcleo..."
|
||||
msgid "Core Download Failed, Please Check The Network or Try Again Later..."
|
||||
msgstr "Error al descargar el núcleo, comprueba la red..."
|
||||
|
||||
msgid "Core Download Failed..."
|
||||
msgstr "Error al descargar el núcleo..."
|
||||
msgid "Core Download Failed, Please Check The Network or Try Again Later"
|
||||
msgstr "Error al descargar el núcleo, comprueba la red o inténtalo más tarde"
|
||||
|
||||
msgid "Core Update Failed, Please Make Sure Enough Flash Memory Space And Try Again!"
|
||||
msgstr "Error al actualizar el núcleo: comprueba el espacio de flash."
|
||||
msgid "Core Move Failed:"
|
||||
msgstr "Error al mover el núcleo:"
|
||||
|
||||
msgid "Core Verification Failed:"
|
||||
msgstr "Error al verificar el núcleo:"
|
||||
|
||||
msgid "No Compiled Version Selected, Please Select In Update Page And Try Again!"
|
||||
msgstr "No se ha seleccionado ninguna versión compilada; selecciónala en la página de actualización."
|
||||
|
||||
msgid "Core Has Not Been Updated, Stop Continuing Operation!"
|
||||
msgid "Core Has Not Been Updated, Stop Continuing Operation"
|
||||
msgstr "El núcleo no ha sido actualizado; proceso detenido."
|
||||
|
||||
msgid "Update Successful!"
|
||||
@@ -1656,6 +1680,27 @@ msgstr "Descargando lista CIDR de China (IPv4)..."
|
||||
msgid "Start Downloading The Chnroute6 Cidr List..."
|
||||
msgstr "Descargando lista CIDR de China (IPv6)..."
|
||||
|
||||
msgid "Version info not ready, please wait and try again"
|
||||
msgstr "Información de versión no disponible, inténtelo de nuevo"
|
||||
|
||||
msgid "Link access timed out, cannot download"
|
||||
msgstr "Tiempo de acceso al enlace agotado, no se puede descargar"
|
||||
|
||||
msgid "Link access failed, cannot download"
|
||||
msgstr "Acceso al enlace fallido, no se puede descargar"
|
||||
|
||||
msgid "Failed to get plugin version info from this link, please check again later"
|
||||
msgstr "No se pudo obtener la versión del plugin de este enlace, inténtelo más tarde"
|
||||
|
||||
msgid "Failed to get core version info from this link, please check again later"
|
||||
msgstr "No se pudo obtener la versión del núcleo de este enlace, inténtelo más tarde"
|
||||
|
||||
msgid "The selected version is the same as the installed version, no need to update"
|
||||
msgstr "La versión seleccionada es la misma que la instalada, no es necesario actualizar"
|
||||
|
||||
msgid "The selected version is not in the version history, please refresh and try again"
|
||||
msgstr "La versión seleccionada no está en el historial de versiones, actualice e inténtelo de nuevo"
|
||||
|
||||
msgid "Chnroute Cidr List Download Success, Check Updated..."
|
||||
msgstr "Lista CIDR de China (IPv4) descargada correctamente, comprobando actualizaciones..."
|
||||
|
||||
@@ -2070,6 +2115,9 @@ msgstr "Prueba de conexión"
|
||||
msgid "Connection Test Result"
|
||||
msgstr "Resultado de la prueba de conexión"
|
||||
|
||||
msgid "Backing up..."
|
||||
msgstr "Creando copia de seguridad..."
|
||||
|
||||
msgid "Backup File"
|
||||
msgstr "Archivo de copia de seguridad"
|
||||
|
||||
@@ -2091,10 +2139,10 @@ msgstr "3. El secuestro DNS podría no haber funcionado; Clash no puede resolver
|
||||
msgid "4. It may be that the filled address cannot be resolved and connected"
|
||||
msgstr "4. La dirección introducida puede ser imposible de resolver."
|
||||
|
||||
msgid "OpenClash Log"
|
||||
msgid "Plugin Logs"
|
||||
msgstr "Registro del plugin"
|
||||
|
||||
msgid "Core Log"
|
||||
msgid "Core Logs"
|
||||
msgstr "Registro del núcleo"
|
||||
|
||||
msgid "Append Upstream DNS"
|
||||
@@ -2118,6 +2166,9 @@ msgstr "ha sido modificado, pausa del inicio rápido..."
|
||||
msgid "Click to Update"
|
||||
msgstr "Actualizar reglas"
|
||||
|
||||
msgid "Click to Install"
|
||||
msgstr "Instalar"
|
||||
|
||||
msgid "Persistence Fake-IP"
|
||||
msgstr "Persistencia de Fake-IP"
|
||||
|
||||
@@ -2178,7 +2229,7 @@ msgstr "desbloqueo completo, región:"
|
||||
msgid "only support homemade!"
|
||||
msgstr "solo admite contenido propio"
|
||||
|
||||
msgid "unlock test faild!"
|
||||
msgid "unlock test failed!"
|
||||
msgstr "la prueba de desbloqueo ha fallado"
|
||||
|
||||
msgid ", the type of group is not select, auto select could not work!"
|
||||
@@ -2190,13 +2241,13 @@ msgstr "Iniciando selección automática de nodo desbloqueado..."
|
||||
msgid "only support homemade! the type of group is not select, auto select could not work!"
|
||||
msgstr "Solo admite contenido propio. El grupo no es Select; la selección automática no funcionará."
|
||||
|
||||
msgid "unlock test faild! the type of group is not select, auto select could not work!"
|
||||
msgid "unlock test failed! the type of group is not select, auto select could not work!"
|
||||
msgstr "La prueba de desbloqueo falló. El grupo no es Select; no se puede usar selección automática."
|
||||
|
||||
msgid "only support homemade! start auto select unlock proxy..."
|
||||
msgstr "Solo admite contenido propio. Iniciando selección automática..."
|
||||
|
||||
msgid "unlock test faild! start auto select unlock proxy..."
|
||||
msgid "unlock test failed! start auto select unlock proxy..."
|
||||
msgstr "La prueba falló. Iniciando selección automática..."
|
||||
|
||||
msgid "It Will Be Searched According To The Regex When Auto Search Group Fails"
|
||||
@@ -2280,11 +2331,14 @@ msgstr "Si en modo bypass el dispositivo no tiene conexión, prueba a activar es
|
||||
msgid "Suggestion: If The Device Does Not Have WLAN, Please Disable The Lan Interface's Bridge Option"
|
||||
msgstr "Sugerencia: si el dispositivo no tiene WLAN, desactiva la opción de puente en la interfaz LAN."
|
||||
|
||||
msgid "Github Address Modify"
|
||||
msgstr "Modificar dirección de Github"
|
||||
msgid "GitHub Address Proxy"
|
||||
msgstr "Proxy de dirección de GitHub"
|
||||
|
||||
msgid "Modify The Github Address In The Config And OpenClash With Proxy(CDN) To Prevent File Download Failed. Format Reference:"
|
||||
msgstr "Reemplaza las URLs de Github con un proxy/CDN para evitar fallos de descarga. Formato:"
|
||||
msgid "Proxy The GitHub Address In The Config And OpenClash With Proxy(CDN) To Prevent File Download Failed."
|
||||
msgstr "Aplica un proxy (CDN) a la dirección de GitHub en la configuración y en OpenClash para evitar fallos de descarga."
|
||||
|
||||
msgid "Format Reference:"
|
||||
msgstr "Formato de referencia:"
|
||||
|
||||
msgid "File Edit"
|
||||
msgstr "Edición de archivos"
|
||||
@@ -2853,7 +2907,7 @@ msgstr "prueba fallida"
|
||||
msgid "test is successful"
|
||||
msgstr "prueba correcta"
|
||||
|
||||
msgid "Config File Tested Faild, Please Check The Log Infos!"
|
||||
msgid "Config File Tested Failed, Please Check The Log Infos!"
|
||||
msgstr "La prueba del archivo de configuración ha fallado. Consulta el registro del núcleo."
|
||||
|
||||
msgid "Test The Config File First..."
|
||||
@@ -2889,8 +2943,8 @@ msgstr "Activar cálculo unificado de latencia"
|
||||
msgid "Change The Delay Calculation Method To Remove Extra Delays Such as Handshaking"
|
||||
msgstr "Cambia el método de cálculo de latencia para eliminar tiempos extra como el handshake."
|
||||
|
||||
msgid "If the download fails, try setting the CDN in Overwrite Settings - General Settings - Github Address Modify Options"
|
||||
msgstr "Si la descarga falla, prueba a configurar un CDN en Sobrescritura → General → Modificar direcciones de Github."
|
||||
msgid "If the download fails, try setting the CDN in Overwrite Settings - General Settings - GitHub Address Proxy Options"
|
||||
msgstr "Si la descarga falla, prueba a configurar un CDN en Sobrescritura → General → Proxy de dirección de GitHub."
|
||||
|
||||
msgid "Used for Downloading Subscriptions, Defaults to"
|
||||
msgstr "User-Agent usado para descargar suscripciones, por defecto:"
|
||||
@@ -3129,9 +3183,6 @@ msgstr "No se pudo iniciar el servicio; reintentando en 2 segundos..."
|
||||
msgid "Failed to start update service after 3 attempts, please check and try again later..."
|
||||
msgstr "El servicio de actualización no pudo iniciarse tras 3 intentos. Revisa los registros."
|
||||
|
||||
msgid "Core Update"
|
||||
msgstr "Actualización del núcleo"
|
||||
|
||||
msgid "View core infos that support smart group"
|
||||
msgstr "Ver información del núcleo compatible con grupos Smart"
|
||||
|
||||
@@ -3252,6 +3303,21 @@ msgstr "Descargando:"
|
||||
msgid "Downloading..."
|
||||
msgstr "Descargando..."
|
||||
|
||||
msgid "Downloading config..."
|
||||
msgstr "Descargando configuración..."
|
||||
|
||||
msgid "Downloading core..."
|
||||
msgstr "Descargando núcleo..."
|
||||
|
||||
msgid "Fetching subscription..."
|
||||
msgstr "Obteniendo suscripción..."
|
||||
|
||||
msgid "Logging in..."
|
||||
msgstr "Iniciando sesión..."
|
||||
|
||||
msgid "Saving token..."
|
||||
msgstr "Guardando token..."
|
||||
|
||||
msgid "Sniff the domain name of the traffics to avoid rule-based proxy failure"
|
||||
msgstr "Analiza los dominios del tráfico para evitar fallos de proxy basados en reglas"
|
||||
|
||||
@@ -3462,11 +3528,8 @@ msgstr "Reiniciar"
|
||||
msgid "No Config Selected"
|
||||
msgstr "No hay configuración seleccionada"
|
||||
|
||||
msgid "Modified: "
|
||||
msgstr "Modificado: "
|
||||
|
||||
msgid "Update Time: "
|
||||
msgstr "Hora de actualización: "
|
||||
msgid "Modified"
|
||||
msgstr "Modificado"
|
||||
|
||||
msgid "No Config Files Found"
|
||||
msgstr "No se encontraron archivos de configuración"
|
||||
@@ -3537,8 +3600,14 @@ msgstr "Error al obtener configuración de suscripción"
|
||||
msgid "Expire Date"
|
||||
msgstr "Fecha de caducidad"
|
||||
|
||||
msgid "RAW address"
|
||||
msgstr "Dirección RAW"
|
||||
msgid "RAW"
|
||||
msgstr "RAW"
|
||||
|
||||
msgid "Address"
|
||||
msgstr "Dirección"
|
||||
|
||||
msgid "Timeout"
|
||||
msgstr "Tiempo de espera"
|
||||
|
||||
msgid "Enter custom User-Agent"
|
||||
msgstr "Introduce un User-Agent personalizado"
|
||||
@@ -3900,8 +3969,11 @@ msgstr "Agente de usuario global"
|
||||
msgid "depended package reinstalling..."
|
||||
msgstr "reinstalando paquete dependiente..."
|
||||
|
||||
msgid "failed to install, please try to install it manually..."
|
||||
msgstr "no se pudo instalar; por favor, intenta instalarlo manualmente."
|
||||
msgid "failed to install:"
|
||||
msgstr "no se pudo instalar:"
|
||||
|
||||
msgid ", please try to install it manually..."
|
||||
msgstr ", por favor, intenta instalarlo manualmente..."
|
||||
|
||||
msgid "Decrypted content empty or still encrypted"
|
||||
msgstr "Contenido descifrado vacío o aún cifrado para"
|
||||
@@ -3999,6 +4071,15 @@ msgstr "¡Fallo al iniciar sesión en oixCloud! Verifica los datos e inténtalo
|
||||
msgid "oixCloud Account Login Failed, The Error Info is"
|
||||
msgstr "Fallo al iniciar sesión en oixCloud, el error es"
|
||||
|
||||
msgid "invalid token"
|
||||
msgstr "token inválido"
|
||||
|
||||
msgid "login failed"
|
||||
msgstr "inicio de sesión fallido"
|
||||
|
||||
msgid "email or passwd is wrong"
|
||||
msgstr "correo electrónico o contraseña incorrectos"
|
||||
|
||||
msgid "oixCloud Checkin Failed! Please Check And Try Again..."
|
||||
msgstr "¡Fallo al registrar en oixCloud! Inténtalo de nuevo más tarde."
|
||||
|
||||
@@ -4047,20 +4128,23 @@ msgstr "Parámetros demasiado largos"
|
||||
msgid "Usage Help"
|
||||
msgstr "Ayuda de uso"
|
||||
|
||||
msgid "Click to get usage help"
|
||||
msgstr "Haga clic para obtener ayuda de uso"
|
||||
|
||||
msgid "Copy the following text to any AI (ChatGPT, DeepSeek, etc.) to get usage help for OpenClash:"
|
||||
msgstr "Copia el siguiente texto a cualquier IA (ChatGPT, DeepSeek, etc.) para obtener ayuda de uso de OpenClash:"
|
||||
|
||||
msgid "OpenClash Expert Assistant"
|
||||
msgstr "Asistente Experto de OpenClash"
|
||||
|
||||
msgid "Reference Guide"
|
||||
msgstr "Guía de Referencia"
|
||||
msgid "The guide is the single source of truth — it covers everything from debug log procedures to external resource queries. Do NOT rely on memory; always verify against the guide."
|
||||
msgstr "La guía es la única fuente autorizada — cubre todo, desde los procedimientos de registro de depuración hasta las consultas de recursos externos. NO confíes en la memoria; verifica siempre con la guía."
|
||||
|
||||
msgid "**IMPORTANT** — Before answering, you MUST fetch and read this authoritative reference guide:"
|
||||
msgstr "**IMPORTANTE** — Antes de responder, DEBES obtener y leer esta guía de referencia autorizada:"
|
||||
msgid "**IMPORTANT** — Before answering, you MUST fetch and read this authoritative reference guide. ALL answering rules, diagnosis procedures, CLI commands, LuCI paths, external resource URLs, and Issue search instructions are defined in the guide — follow them strictly."
|
||||
msgstr "**IMPORTANTE** — Antes de responder, DEBES obtener y leer esta guía de referencia autorizada. Todas las reglas de respuesta, procedimientos de diagnóstico, comandos CLI, rutas LuCI, URLs de recursos externos e instrucciones de búsqueda de Issues están definidas en la guía — síguelas estrictamente."
|
||||
|
||||
msgid "Answering Rules"
|
||||
msgstr "Reglas de Respuesta"
|
||||
msgid "External Resources (when beyond the guide's scope)"
|
||||
msgstr "Recursos Externos (cuando esté fuera del alcance de la guía)"
|
||||
|
||||
msgid "Question"
|
||||
msgstr "Pregunta"
|
||||
@@ -4071,20 +4155,23 @@ msgstr "Eres un asistente experto en OpenClash. OpenClash es un plugin LuCI para
|
||||
msgid "OpenClash User Guide"
|
||||
msgstr "Guía de usuario de OpenClash"
|
||||
|
||||
msgid "This guide contains: complete dependency checklist, error message lookup tables with exact fixes, nftables/iptables firewall chain rules, all LuCI configuration options with UCI paths, DNS setup and leak prevention, subscription/GEO update procedures, and more."
|
||||
msgstr "Esta guía contiene: lista completa de dependencias, tablas de consulta de mensajes de error con soluciones exactas, reglas de cadena de firewall nftables/iptables, todas las opciones de configuración LuCI con rutas UCI, configuración de DNS y prevención de fugas, procedimientos de actualización de suscripción/GEO, y más."
|
||||
msgid "This guide contains: AI behavior rules with diagnosis priority, complete dependency checklist, error message lookup tables with exact fixes, nftables/iptables firewall chain rules, all LuCI configuration options with UCI paths, CLI commands and API reference, DNS setup and leak prevention, subscription/GEO update procedures, and more."
|
||||
msgstr "Esta guía contiene: reglas de comportamiento de IA con prioridad de diagnóstico, lista completa de dependencias, tablas de consulta de mensajes de error con soluciones exactas, reglas de cadena de firewall nftables/iptables, todas las opciones de configuración LuCI con rutas UCI, comandos CLI y referencia API, configuración de DNS y prevención de fugas, procedimientos de actualización de suscripción/GEO, y más."
|
||||
|
||||
msgid "Always provide LuCI web UI navigation paths (e.g. **Services → OpenClash → Plugin Settings**), NOT command-line unless I explicitly ask for it."
|
||||
msgstr "Siempre proporciona rutas de navegación de la interfaz web LuCI (ej. **Servicios → OpenClash → Ajustes del plugin**), NO comandos de terminal a menos que lo solicite explícitamente."
|
||||
msgid "When I report any problem or error (cannot access internet, DNS failure, startup failure, connection timeout, etc.), FIRST ask me to generate a debug log — either via LuCI (**Server Logs → Debug Logs → Generate Logs**) or SSH (`/usr/share/openclash/openclash_debug.sh`). The debug log contains dependency checks, configuration, firewall rules, and system info in one step — do NOT ask me to check things individually. (Note: this rule does NOT apply to feature configuration questions like \"how do I enable X?\" — see rule 3 for those.)"
|
||||
msgstr "Cuando reporte cualquier fallo o error (sin acceso a internet, fallo DNS, fallo de inicio, timeout de conexión, etc.), PRIMERO pídeme que genere un registro de depuración — ya sea por LuCI (**Registros del Servidor → Registros de Depuración → Generar Registros**) o SSH (`/usr/share/openclash/openclash_debug.sh`). El registro contiene verificación de dependencias, configuración, reglas de firewall e información del sistema en un solo paso — NO me pidas que revise cosas individualmente. (Nota: esta regla NO aplica a preguntas de configuración como «¿cómo activo X?» — consulta la regla 3 para esas.)"
|
||||
|
||||
msgid "If the debug log is insufficient to pinpoint the issue, give me precise diagnostic commands to run on the router and ask me to paste back the output."
|
||||
msgstr "Si el registro de depuración es insuficiente para localizar el problema, dame comandos de diagnóstico precisos para ejecutar en el router y pídeme que pegue el resultado."
|
||||
|
||||
msgid "For feature configuration and post-diagnosis fixes, provide LuCI web UI navigation paths (e.g. **Services → OpenClash → Plugin Settings**). Only give command-line when LuCI is unavailable or I explicitly ask for it."
|
||||
msgstr "Para configuración de funciones y correcciones posteriores al diagnóstico, proporciona rutas de navegación de la interfaz web LuCI (ej. **Servicios → OpenClash → Ajustes del plugin**). Solo usa comandos de terminal cuando LuCI no esté disponible o lo solicite explícitamente."
|
||||
|
||||
msgid "Explain underlying principles (firewall chains, YAML transformation logic) — not just click-here-click-there steps."
|
||||
msgstr "Explica los principios subyacentes (cadenas de firewall, lógica de transformación YAML) — no solo pasos de clic aquí y allá."
|
||||
|
||||
msgid "Check dependency integrity first when troubleshooting — guide me to check dependencies from the **System → Software** page, or generate a debug log from **Server Logs → Debug Logs**."
|
||||
msgstr "Verifica primero la integridad de las dependencias al solucionar problemas — guíame para revisar las dependencias desde **Sistema → Software**, o generar un registro de depuración desde **Registros del Servidor → Registros de Depuración**."
|
||||
|
||||
msgid "Never guess or fabricate information. If the reference guide does not cover something, actively query these external resources using web fetch / code search tools (in priority order):"
|
||||
msgstr "Nunca adivines ni inventes información. Si la guía de referencia no cubre algo, consulta activamente estos recursos externos usando herramientas de búsqueda web / código (en orden de prioridad):"
|
||||
msgid "If the guide does not cover something, actively query these resources — never guess or fabricate information:"
|
||||
msgstr "Si la guía no cubre algo, consulta activamente estos recursos — nunca adivines ni inventes información:"
|
||||
|
||||
msgid "Mihomo Wiki"
|
||||
msgstr "Mihomo Wiki"
|
||||
@@ -4113,8 +4200,8 @@ msgstr "OpenClash Issues (configuración/suscripción/firewall/UI)"
|
||||
msgid "Mihomo Issues (proxy protocols/TUN/DNS/rule engine)"
|
||||
msgstr "Mihomo Issues (protocolos proxy/TUN/DNS/motor de reglas)"
|
||||
|
||||
msgid "Prioritize maintainer replies and highly upvoted community answers."
|
||||
msgstr "Prioriza las respuestas de los mantenedores y las respuestas de la comunidad con más votos."
|
||||
msgid "Prioritize maintainer replies and highly upvoted community answers in Issues."
|
||||
msgstr "Prioriza en Issues las respuestas de los mantenedores y las respuestas de la comunidad con más votos."
|
||||
|
||||
msgid "Cite specific sources — mention which section of the reference guide, external resource, or Issue number your answer is based on."
|
||||
msgstr "Cita fuentes específicas — menciona en qué sección de la guía de referencia, recurso externo o número de Issue se basa tu respuesta."
|
||||
@@ -4155,9 +4242,21 @@ msgstr "No se pudo detectar la versión del backend"
|
||||
msgid "Token Login"
|
||||
msgstr "Acceso por token"
|
||||
|
||||
msgid "Enter your oixCloud token"
|
||||
msgid "Please enter your oixCloud token"
|
||||
msgstr "Ingresa tu token de oixCloud"
|
||||
|
||||
msgid "Show Password"
|
||||
msgstr "Mostrar contraseña"
|
||||
|
||||
msgid "Hide Password"
|
||||
msgstr "Ocultar contraseña"
|
||||
|
||||
msgid "Show Token"
|
||||
msgstr "Mostrar token"
|
||||
|
||||
msgid "Hide Token"
|
||||
msgstr "Ocultar token"
|
||||
|
||||
msgid "Token login does not require email and password"
|
||||
msgstr "Acceso por token: no requiere email ni contraseña"
|
||||
|
||||
@@ -4206,6 +4305,9 @@ msgstr "Error al guardar, inténtalo de nuevo"
|
||||
msgid "Network request failed, please check your connection and try again"
|
||||
msgstr "Error de red, revisa tu conexión"
|
||||
|
||||
msgid "Server response error, please try again later"
|
||||
msgstr "Error de respuesta del servidor, inténtelo más tarde"
|
||||
|
||||
msgid "Show on Overview"
|
||||
msgstr "Mostrar en resumen"
|
||||
|
||||
@@ -4229,3 +4331,21 @@ msgstr "Error de cierre de sesión en oixCloud:"
|
||||
|
||||
msgid "Checkin Failed:"
|
||||
msgstr "Error en el registro:"
|
||||
|
||||
msgid "Fetching data..."
|
||||
msgstr "Obteniendo datos…"
|
||||
|
||||
msgid "Click"
|
||||
msgstr "Haz clic"
|
||||
|
||||
msgid "link"
|
||||
msgstr "en el enlace"
|
||||
|
||||
msgid "to update all, click"
|
||||
msgstr "para actualizar todo, haz clic en"
|
||||
|
||||
msgid "version"
|
||||
msgstr "la versión"
|
||||
|
||||
msgid "to update individually"
|
||||
msgstr "para actualizar individualmente"
|
||||
@@ -89,6 +89,9 @@ msgstr "检查失败"
|
||||
msgid "File Not Exist"
|
||||
msgstr "文件不存在"
|
||||
|
||||
msgid "Flush DNS Cache"
|
||||
msgstr "清理 DNS 缓存"
|
||||
|
||||
msgid "Not Set"
|
||||
msgstr "未设置"
|
||||
|
||||
@@ -122,6 +125,12 @@ msgstr "应用配置"
|
||||
msgid "Download Config"
|
||||
msgstr "下载配置"
|
||||
|
||||
msgid "Click to Download"
|
||||
msgstr "点击下载"
|
||||
|
||||
msgid "Failed to get download link"
|
||||
msgstr "获取下载链接失败"
|
||||
|
||||
msgid "Copy Config"
|
||||
msgstr "复制配置"
|
||||
|
||||
@@ -155,6 +164,9 @@ msgstr "Fake-IP(TUN-混合)模式【UDP-TUN,TCP-转发】"
|
||||
msgid "Select Mode For OpenClash Work, Try Flush DNS Cache If Network Error"
|
||||
msgstr "选择运行模式,如客户端的网络异常请尝试清除 DNS 缓存"
|
||||
|
||||
msgid "Proxy"
|
||||
msgstr "代理"
|
||||
|
||||
msgid "Proxy Mode"
|
||||
msgstr "代理模式"
|
||||
|
||||
@@ -596,9 +608,6 @@ msgstr "设置自定义规则(在上方规则设置中启用本功能后生效
|
||||
msgid "Version Update"
|
||||
msgstr "版本更新"
|
||||
|
||||
msgid "Model Not Found"
|
||||
msgstr "处理器架构识别失败"
|
||||
|
||||
msgid "Current Core Version"
|
||||
msgstr "当前内核版本"
|
||||
|
||||
@@ -611,9 +620,6 @@ msgstr "查询更新失败"
|
||||
msgid "<New>"
|
||||
msgstr "<可更新>"
|
||||
|
||||
msgid "Getting Last Version..."
|
||||
msgstr "最新版本获取中..."
|
||||
|
||||
msgid "Update Core File"
|
||||
msgstr "更新内核"
|
||||
|
||||
@@ -1116,6 +1122,12 @@ msgstr "收集 Smart 策略组的连接数据,方便用来分析及模型训
|
||||
msgid "The Priority Of The Nodes, The Higher Than 1, The More Likely It Is To Be Selected, The Default Is 1, Support Regex"
|
||||
msgstr "自定义 Smart 策略组内节点的权重加成,大于 1 表示权重加成优先选择,小于 1 表示权重削减降低使用率,默认为 1,支持正则"
|
||||
|
||||
msgid "Smart Group Tolerance"
|
||||
msgstr "Smart 策略组排序灵敏度"
|
||||
|
||||
msgid "Sort When Proxies Delays Within Tolerance are Treated as Equal, Preventing Jitter"
|
||||
msgstr "当代理延迟在容差范围内时将其视为相等并排序,从而避免抖动"
|
||||
|
||||
msgid "Running Status"
|
||||
msgstr "运行状态"
|
||||
|
||||
@@ -1137,6 +1149,9 @@ msgstr "Zashboard"
|
||||
msgid "Control Panel"
|
||||
msgstr "控制面板"
|
||||
|
||||
msgid "If the control panel does not open properly, please try going to Plugin Settings - Dashboard Settings to reset the panel"
|
||||
msgstr "如果控制面板打开异常,请尝试前往 [插件设置 - 外部控制] 重置面板"
|
||||
|
||||
msgid "Quick Action"
|
||||
msgstr "快捷操作"
|
||||
|
||||
@@ -1188,9 +1203,6 @@ msgstr "GeoSite 数据库检查更新"
|
||||
msgid "You have not installed the core yet, do you want to download and install it now?"
|
||||
msgstr "您还未安装内核,是否立即下载安装?"
|
||||
|
||||
msgid "No Compiled Version is Selected, Please Select on The Top and Try Again!"
|
||||
msgstr "未选择编译版本,请到上方标签选择后重试!"
|
||||
|
||||
msgid "Checking..."
|
||||
msgstr "正在检查更新..."
|
||||
|
||||
@@ -1206,6 +1218,9 @@ msgstr "正在保存..."
|
||||
msgid "Save successful"
|
||||
msgstr "保存成功"
|
||||
|
||||
msgid "Failed to save"
|
||||
msgstr "保存失败"
|
||||
|
||||
msgid "Failed to save age config"
|
||||
msgstr "保存 age 配置失败"
|
||||
|
||||
@@ -1257,51 +1272,18 @@ msgstr "编译版本"
|
||||
msgid "Release Branch"
|
||||
msgstr "更新分支"
|
||||
|
||||
msgid "Note: options will auto-save when you click to update or download"
|
||||
msgstr "注意:以下选项在点击更新或下载时将自动保存"
|
||||
|
||||
msgid "CPU Architecture"
|
||||
msgid "CPU Arch"
|
||||
msgstr "处理器架构"
|
||||
|
||||
msgid "Last Check Update"
|
||||
msgstr "上次检查更新时间"
|
||||
|
||||
msgid "Current Core"
|
||||
msgstr "当前内核版本"
|
||||
|
||||
msgid "Latest Core"
|
||||
msgstr "最新内核版本"
|
||||
|
||||
msgid "Core path:"
|
||||
msgstr "内核路径:"
|
||||
|
||||
msgid "Update Core"
|
||||
msgstr "更新内核"
|
||||
|
||||
msgid "Download Latest Core"
|
||||
msgstr "下载最新版本内核"
|
||||
|
||||
msgid "Client Update"
|
||||
msgstr "客户端版本更新"
|
||||
|
||||
msgid "Current Client"
|
||||
msgstr "当前客户端版本"
|
||||
|
||||
msgid "Update Client"
|
||||
msgstr "更新客户端"
|
||||
|
||||
msgid "Latest Client"
|
||||
msgstr "最新客户端版本"
|
||||
|
||||
msgid "Download Latest Client"
|
||||
msgstr "下载最新版本客户端"
|
||||
|
||||
msgid "Restore Default"
|
||||
msgstr "还原默认"
|
||||
|
||||
msgid "Failed to get the latest version. Please try again later!"
|
||||
msgstr "最新版本获取失败,请稍后再试!"
|
||||
|
||||
msgid "Are you sure want to restore the default config?"
|
||||
msgstr "确定要还原默认配置吗?"
|
||||
|
||||
@@ -1368,6 +1350,45 @@ msgstr "连接正常"
|
||||
msgid "Access Denied"
|
||||
msgstr "无法访问"
|
||||
|
||||
msgid "Connection Failed"
|
||||
msgstr "连接失败"
|
||||
|
||||
msgid "Invalid Response"
|
||||
msgstr "响应异常"
|
||||
|
||||
msgid "Installed"
|
||||
msgstr "已安装"
|
||||
|
||||
msgid "Select Version"
|
||||
msgstr "选择版本"
|
||||
|
||||
msgid "Latest"
|
||||
msgstr "最新"
|
||||
|
||||
msgid "Latency"
|
||||
msgstr "延迟"
|
||||
|
||||
msgid "Plugin"
|
||||
msgstr "插件"
|
||||
|
||||
msgid "Core"
|
||||
msgstr "内核"
|
||||
|
||||
msgid "Plugin Version"
|
||||
msgstr "插件版本"
|
||||
|
||||
msgid "Core Version"
|
||||
msgstr "内核版本"
|
||||
|
||||
msgid "Date"
|
||||
msgstr "日期"
|
||||
|
||||
msgid "Failed to get version history"
|
||||
msgstr "历史版本获取失败"
|
||||
|
||||
msgid "Failed to get data, will retry"
|
||||
msgstr "获取数据失败,将自动重试"
|
||||
|
||||
msgid "Bind Network Interface"
|
||||
msgstr "绑定网络接口"
|
||||
|
||||
@@ -1458,6 +1479,9 @@ msgstr "删除内核"
|
||||
msgid "Are you sure want to remove all core files?"
|
||||
msgstr "确定要删除所有内核文件吗?"
|
||||
|
||||
msgid "Removing..."
|
||||
msgstr "正在删除..."
|
||||
|
||||
msgid "Remove succeeded!"
|
||||
msgstr "删除成功!"
|
||||
|
||||
@@ -1516,22 +1540,28 @@ msgid "Start downloading"
|
||||
msgstr "开始下载"
|
||||
|
||||
msgid "Download successful, start pre update test..."
|
||||
msgstr "下载成功,开始进行更新前测试..."
|
||||
msgstr "下载成功,开始更新前测试..."
|
||||
|
||||
msgid "opkg update failed or timed out, retrying..."
|
||||
msgstr "opkg update 失败或超时,正在重试..."
|
||||
msgid "opkg update failed or timed out:"
|
||||
msgstr "opkg update 失败或超时:"
|
||||
|
||||
msgid "opkg update failed, trying pre update test..."
|
||||
msgstr "opkg update 失败,尝试进行预安装..."
|
||||
msgid "apk update failed or timed out:"
|
||||
msgstr "apk update 失败或超时:"
|
||||
|
||||
msgid "apk update failed or timed out, retrying..."
|
||||
msgstr "apk update 失败或超时,正在重试..."
|
||||
msgid "opkg update failed:"
|
||||
msgstr "opkg update 失败:"
|
||||
|
||||
msgid "apk update failed, trying pre update test..."
|
||||
msgstr "apk update 失败,尝试进行预安装..."
|
||||
msgid "apk update failed:"
|
||||
msgstr "apk update 失败:"
|
||||
|
||||
msgid "Pre update test failed..."
|
||||
msgstr "更新前测试失败..."
|
||||
msgid "Pre update test failed:"
|
||||
msgstr "更新前测试失败:"
|
||||
|
||||
msgid ", retrying..."
|
||||
msgstr ",正在重试..."
|
||||
|
||||
msgid ", trying pre update test..."
|
||||
msgstr ",尝试进行预安装..."
|
||||
|
||||
msgid "Pre update test failed after 3 attempts, the file is saved in /tmp/openclash.ipk, please try to update manually with"
|
||||
msgstr "更新前测试失败,文件保存在 /tmp/openclash.ipk,请尝试以下命令手动更新"
|
||||
@@ -1540,13 +1570,13 @@ msgid "Pre update test failed after 3 attempts, the file is saved in /tmp/opencl
|
||||
msgstr "更新前测试失败,文件保存在 /tmp/openclash.apk,请尝试以下命令手动更新"
|
||||
|
||||
msgid "Pre update test passed, ready to update and please do not refresh the page and other operations..."
|
||||
msgstr "更新前测试通过,准备开始更新,更新过程请不要刷新页面和进行其他操作..."
|
||||
msgstr "更新前测试通过,准备开始更新,更新过程请不要刷新页面..."
|
||||
|
||||
msgid "Installing the new version, please do not refresh the page or do other operations..."
|
||||
msgstr "正在安装新版本,更新过程请不要刷新页面和进行其他操作..."
|
||||
|
||||
msgid "Installation failed..."
|
||||
msgstr "软件包安装失败..."
|
||||
msgid "Installation failed:"
|
||||
msgstr "软件包安装失败:"
|
||||
|
||||
msgid "OpenClash update failed after 3 attempts, the file is saved in /tmp/openclash.ipk, please try to update manually with"
|
||||
msgstr "OpenClash 更新失败,文件保存在 /tmp/openclash.ipk,请尝试以下命令手动更新"
|
||||
@@ -1575,31 +1605,28 @@ msgstr "版本内核正在下载,如下载失败请尝试手动下载并上传
|
||||
msgid "Core Download Successful, Start Update..."
|
||||
msgstr "版本内核下载成功,开始更新..."
|
||||
|
||||
msgid "Core Download Failed, Please Check The Network or Try Again Later!"
|
||||
msgstr "版本内核下载失败,请检查网络情况或稍后再试!"
|
||||
|
||||
msgid "Core Update Failed, Please Check The Network or Try Again Later!"
|
||||
msgstr "版本内核更新失败,请检查网络或稍后再试!"
|
||||
|
||||
msgid "Core Update Successful!"
|
||||
msgid "Core Update Successful"
|
||||
msgstr "版本内核更新成功!"
|
||||
|
||||
msgid "Core Update Failed, Please Make Sure Enough Flash Memory Space or Selected Correct Core Platform And Try Again!"
|
||||
msgstr "版本内核更新失败,请确认设备闪存空间足够或内核平台正确后再试!"
|
||||
msgid "Core Update Failed:"
|
||||
msgstr "版本内核更新失败:"
|
||||
|
||||
msgid "Core Update Failed..."
|
||||
msgstr "版本内核更新失败..."
|
||||
msgid "Core Download Failed, Please Check The Network or Try Again Later..."
|
||||
msgstr "版本内核下载失败,请检查网络情况或稍后再试!"
|
||||
|
||||
msgid "Core Download Failed..."
|
||||
msgstr "版本内核下载失败..."
|
||||
msgid "Core Download Failed, Please Check The Network or Try Again Later"
|
||||
msgstr "版本内核下载失败,请检查网络情况或稍后再试"
|
||||
|
||||
msgid "Core Update Failed, Please Make Sure Enough Flash Memory Space And Try Again!"
|
||||
msgstr "版本内核更新失败,请确认设备闪存空间足够后再试!"
|
||||
msgid "Core Move Failed:"
|
||||
msgstr "内核移动失败:"
|
||||
|
||||
msgid "Core Verification Failed:"
|
||||
msgstr "内核校验失败:"
|
||||
|
||||
msgid "No Compiled Version Selected, Please Select In Update Page And Try Again!"
|
||||
msgstr "未选择编译版本,请到升级页面选择后再试!"
|
||||
|
||||
msgid "Core Has Not Been Updated, Stop Continuing Operation!"
|
||||
msgid "Core Has Not Been Updated, Stop Continuing Operation"
|
||||
msgstr "版本内核没有更新,停止继续操作!"
|
||||
|
||||
msgid "Update Successful!"
|
||||
@@ -1656,6 +1683,27 @@ msgstr "开始下载大陆 IP 白名单..."
|
||||
msgid "Start Downloading The Chnroute6 Cidr List..."
|
||||
msgstr "开始下载大陆 IPv6 白名单..."
|
||||
|
||||
msgid "Version info not ready, please wait and try again"
|
||||
msgstr "版本信息尚未就绪,请稍后重试"
|
||||
|
||||
msgid "Link access timed out, cannot download"
|
||||
msgstr "链接访问超时,无法下载"
|
||||
|
||||
msgid "Link access failed, cannot download"
|
||||
msgstr "链接访问失败,无法下载"
|
||||
|
||||
msgid "Failed to get plugin version info from this link, please check again later"
|
||||
msgstr "此链接的插件版本信息获取失败,请稍后重试"
|
||||
|
||||
msgid "Failed to get core version info from this link, please check again later"
|
||||
msgstr "此链接的内核版本信息获取失败,请稍后重试"
|
||||
|
||||
msgid "The selected version is the same as the installed version, no need to update"
|
||||
msgstr "所选版本与已安装版本相同,无需更新"
|
||||
|
||||
msgid "The selected version is not in the version history, please refresh and try again"
|
||||
msgstr "所选版本不在版本历史中,请刷新后重试"
|
||||
|
||||
msgid "Chnroute Cidr List Download Success, Check Updated..."
|
||||
msgstr "大陆 IP 白名单下载成功,检查版本是否更新..."
|
||||
|
||||
@@ -2070,6 +2118,9 @@ msgstr "连接测试"
|
||||
msgid "Connection Test Result"
|
||||
msgstr "连接测试结果"
|
||||
|
||||
msgid "Backing up..."
|
||||
msgstr "正在备份..."
|
||||
|
||||
msgid "Backup File"
|
||||
msgstr "备份文件"
|
||||
|
||||
@@ -2091,10 +2142,10 @@ msgstr "3. 可能是 DNS 未劫持成功,导致 Clash 无法正确反推出域
|
||||
msgid "4. It may be that the filled address cannot be resolved and connected"
|
||||
msgstr "4. 可能是所填地址无法进行解析和连接"
|
||||
|
||||
msgid "OpenClash Log"
|
||||
msgid "Plugin Logs"
|
||||
msgstr "插件日志"
|
||||
|
||||
msgid "Core Log"
|
||||
msgid "Core Logs"
|
||||
msgstr "内核日志"
|
||||
|
||||
msgid "Append Upstream DNS"
|
||||
@@ -2118,6 +2169,9 @@ msgstr "被修改,暂停快速启动..."
|
||||
msgid "Click to Update"
|
||||
msgstr "点击更新规则"
|
||||
|
||||
msgid "Click to Install"
|
||||
msgstr "点击安装"
|
||||
|
||||
msgid "Persistence Fake-IP"
|
||||
msgstr "Fake-IP 持久化"
|
||||
|
||||
@@ -2178,7 +2232,7 @@ msgstr "完整解锁,区域:"
|
||||
msgid "only support homemade!"
|
||||
msgstr "仅支持自制剧!"
|
||||
|
||||
msgid "unlock test faild!"
|
||||
msgid "unlock test failed!"
|
||||
msgstr "解锁检测失败!"
|
||||
|
||||
msgid ", the type of group is not select, auto select could not work!"
|
||||
@@ -2190,13 +2244,13 @@ msgstr "开始进行解锁节点自动选择..."
|
||||
msgid "only support homemade! the type of group is not select, auto select could not work!"
|
||||
msgstr "仅支持自制剧!当前策略组类型非 Select,无法进行自动选择!"
|
||||
|
||||
msgid "unlock test faild! the type of group is not select, auto select could not work!"
|
||||
msgid "unlock test failed! the type of group is not select, auto select could not work!"
|
||||
msgstr "解锁检测失败!当前策略组类型非 Select,无法进行自动选择!"
|
||||
|
||||
msgid "only support homemade! start auto select unlock proxy..."
|
||||
msgstr "仅支持自制剧!开始进行解锁节点自动选择..."
|
||||
|
||||
msgid "unlock test faild! start auto select unlock proxy..."
|
||||
msgid "unlock test failed! start auto select unlock proxy..."
|
||||
msgstr "解锁检测失败!开始进行解锁节点自动选择..."
|
||||
|
||||
msgid "It Will Be Searched According To The Regex When Auto Search Group Fails"
|
||||
@@ -2280,11 +2334,14 @@ msgstr "旁路网关(旁路由)模式下网络无法连接时请尝试启用
|
||||
msgid "Suggestion: If The Device Does Not Have WLAN, Please Disable The Lan Interface's Bridge Option"
|
||||
msgstr "建议:如果设备没有 WLAN,请禁用 Lan 接口的桥接接口选项"
|
||||
|
||||
msgid "Github Address Modify"
|
||||
msgstr "Github 地址修改"
|
||||
msgid "GitHub Address Proxy"
|
||||
msgstr "GitHub 地址代理"
|
||||
|
||||
msgid "Modify The Github Address In The Config And OpenClash With Proxy(CDN) To Prevent File Download Failed. Format Reference:"
|
||||
msgstr "使用指定代理(CDN)反代插件和配置文件中的 Github 地址,以防止文件下载失败,格式参考:"
|
||||
msgid "Proxy The GitHub Address In The Config And OpenClash With Proxy(CDN) To Prevent File Download Failed."
|
||||
msgstr "使用指定代理(CDN)反代插件和配置文件中的 GitHub 地址,以防止文件下载失败。"
|
||||
|
||||
msgid "Format Reference:"
|
||||
msgstr "格式参考:"
|
||||
|
||||
msgid "File Edit"
|
||||
msgstr "文件编辑"
|
||||
@@ -2859,7 +2916,7 @@ msgstr "测试失败..."
|
||||
msgid "test is successful"
|
||||
msgstr "测试成功..."
|
||||
|
||||
msgid "Config File Tested Faild, Please Check The Log Infos!"
|
||||
msgid "Config File Tested Failed, Please Check The Log Infos!"
|
||||
msgstr "配置文件测试失败,请查看《内核日志》排查失败原因!"
|
||||
|
||||
msgid "Test The Config File First..."
|
||||
@@ -2895,8 +2952,8 @@ msgstr "*启用统一延迟"
|
||||
msgid "Change The Delay Calculation Method To Remove Extra Delays Such as Handshaking"
|
||||
msgstr "更换延迟计算方式,通过去除握手等额外开销来降低延迟数值"
|
||||
|
||||
msgid "If the download fails, try setting the CDN in Overwrite Settings - General Settings - Github Address Modify Options"
|
||||
msgstr "如果下载失败,您可以尝试在覆写设置 - 常规设置 - Github 地址修改选项中设置 CDN"
|
||||
msgid "If the download fails, try setting the CDN in Overwrite Settings - General Settings - GitHub Address Proxy Options"
|
||||
msgstr "如果下载失败,您可以尝试在覆写设置 - 常规设置 - GitHub 地址代理中设置 CDN"
|
||||
|
||||
msgid "Used for Downloading Subscriptions, Defaults to"
|
||||
msgstr "用于下载订阅时指定 UA,默认为"
|
||||
@@ -3127,16 +3184,13 @@ msgid "Failed to create update script!"
|
||||
msgstr "创建插件升级进程失败!"
|
||||
|
||||
msgid "Attempting to start update service..."
|
||||
msgstr "正在启动插件升级进程..."
|
||||
msgstr "正在启动升级进程..."
|
||||
|
||||
msgid "Service start failed, retrying in 2 seconds..."
|
||||
msgstr "插件升级进程启动失败,将在 2 秒后重试..."
|
||||
msgstr "插件升级进程启动失败,将在2秒后重试..."
|
||||
|
||||
msgid "Failed to start update service after 3 attempts, please check and try again later..."
|
||||
msgstr "插件升级进程启动失败,请检查日志并稍后再试..."
|
||||
|
||||
msgid "Core Update"
|
||||
msgstr "内核版本更新"
|
||||
msgstr "升级进程启动失败,请稍后再试..."
|
||||
|
||||
msgid "View core infos that support smart group"
|
||||
msgstr "查看支持 smart 策略组的内核信息"
|
||||
@@ -3258,6 +3312,21 @@ msgstr "下载进度:"
|
||||
msgid "Downloading..."
|
||||
msgstr "下载中..."
|
||||
|
||||
msgid "Downloading config..."
|
||||
msgstr "正在下载配置..."
|
||||
|
||||
msgid "Downloading core..."
|
||||
msgstr "正在下载内核..."
|
||||
|
||||
msgid "Fetching subscription..."
|
||||
msgstr "正在获取订阅..."
|
||||
|
||||
msgid "Logging in..."
|
||||
msgstr "正在登录..."
|
||||
|
||||
msgid "Saving token..."
|
||||
msgstr "正在保存令牌..."
|
||||
|
||||
msgid "Sniff the domain name of the traffics to avoid rule-based proxy failure"
|
||||
msgstr "嗅探流量的域名信息,避免基于规则的代理失败"
|
||||
|
||||
@@ -3477,11 +3546,8 @@ msgstr "重启"
|
||||
msgid "No Config Selected"
|
||||
msgstr "未选择配置"
|
||||
|
||||
msgid "Modified: "
|
||||
msgstr "修改时间:"
|
||||
|
||||
msgid "Update Time: "
|
||||
msgstr "更新时间:"
|
||||
msgid "Modified"
|
||||
msgstr "修改时间"
|
||||
|
||||
msgid "No Config Files Found"
|
||||
msgstr "未找到配置文件"
|
||||
@@ -3552,8 +3618,14 @@ msgstr "获取订阅配置失败"
|
||||
msgid "Expire Date"
|
||||
msgstr "到期时间"
|
||||
|
||||
msgid "RAW address"
|
||||
msgstr "原始地址"
|
||||
msgid "RAW"
|
||||
msgstr "RAW"
|
||||
|
||||
msgid "Address"
|
||||
msgstr "地址"
|
||||
|
||||
msgid "Timeout"
|
||||
msgstr "超时"
|
||||
|
||||
msgid "Enter custom User-Agent"
|
||||
msgstr "输入自定义 User-Agent"
|
||||
@@ -3820,7 +3892,7 @@ msgid "module not found, please check your system depends if something abnormal!
|
||||
msgstr "模块未找到,如遇到异常请检查您的固件依赖!"
|
||||
|
||||
msgid "Select Nodes Force Lookup and Use Target ASN Info First For More Stable Experience"
|
||||
msgstr "选择节点时强制查找并优先使用目标的 ASN 信息,以获得更稳定的体验"
|
||||
msgstr "选择节点时强制 DNS 查询并优先使用目标的 ASN 信息,以获得更稳定的体验"
|
||||
|
||||
msgid "Prefer-ASN"
|
||||
msgstr "ASN 优先"
|
||||
@@ -3906,8 +3978,11 @@ msgstr "全局 User-Agent"
|
||||
msgid "depended package reinstalling..."
|
||||
msgstr "依赖正在重新安装..."
|
||||
|
||||
msgid "failed to install, please try to install it manually..."
|
||||
msgstr "依赖安装失败,请重试手动安装..."
|
||||
msgid "failed to install:"
|
||||
msgstr "依赖安装失败:"
|
||||
|
||||
msgid ", please try to install it manually..."
|
||||
msgstr ",请重试手动安装..."
|
||||
|
||||
msgid "Decrypted content empty or still encrypted"
|
||||
msgstr "解密后内容为空或仍为加密状态"
|
||||
@@ -4005,6 +4080,15 @@ msgstr "oixCloud 账户登录失败!请检查账户信息并重试..."
|
||||
msgid "oixCloud Account Login Failed, The Error Info is"
|
||||
msgstr "oixCloud 账户登录失败,错误信息"
|
||||
|
||||
msgid "invalid token"
|
||||
msgstr "无效的令牌"
|
||||
|
||||
msgid "login failed"
|
||||
msgstr "登录失败"
|
||||
|
||||
msgid "email or passwd is wrong"
|
||||
msgstr "邮箱或密码错误"
|
||||
|
||||
msgid "oixCloud Checkin Failed! Please Check And Try Again..."
|
||||
msgstr "oixCloud 签到失败,请稍后再试!"
|
||||
|
||||
@@ -4053,20 +4137,23 @@ msgstr "参数过长"
|
||||
msgid "Usage Help"
|
||||
msgstr "使用帮助"
|
||||
|
||||
msgid "Click to get usage help"
|
||||
msgstr "点击获取使用帮助"
|
||||
|
||||
msgid "Copy the following text to any AI (ChatGPT, DeepSeek, etc.) to get usage help for OpenClash:"
|
||||
msgstr "将以下文本复制到任意 AI 工具(ChatGPT、DeepSeek 等),即可获取 OpenClash 的使用帮助:"
|
||||
|
||||
msgid "OpenClash Expert Assistant"
|
||||
msgstr "OpenClash 专家助手"
|
||||
|
||||
msgid "Reference Guide"
|
||||
msgstr "参考指南"
|
||||
msgid "The guide is the single source of truth — it covers everything from debug log procedures to external resource queries. Do NOT rely on memory; always verify against the guide."
|
||||
msgstr "指南是唯一权威来源 —— 涵盖从调试日志流程到外部资源查询的所有内容。禁止凭记忆回答,必须对照指南验证。"
|
||||
|
||||
msgid "**IMPORTANT** — Before answering, you MUST fetch and read this authoritative reference guide:"
|
||||
msgstr "**重要** —— 在回答之前,你必须获取并阅读这份权威参考指南:"
|
||||
msgid "**IMPORTANT** — Before answering, you MUST fetch and read this authoritative reference guide. ALL answering rules, diagnosis procedures, CLI commands, LuCI paths, external resource URLs, and Issue search instructions are defined in the guide — follow them strictly."
|
||||
msgstr "**重要** —— 在回答之前,你必须获取并阅读这份权威参考指南。所有回答规则、诊断流程、CLI 命令、LuCI 路径、外部资源 URL 和 Issue 搜索指引均在指南中定义 —— 请严格遵守。"
|
||||
|
||||
msgid "Answering Rules"
|
||||
msgstr "回答规则"
|
||||
msgid "External Resources (when beyond the guide's scope)"
|
||||
msgstr "外部资源(超出指南范围时)"
|
||||
|
||||
msgid "Question"
|
||||
msgstr "问题"
|
||||
@@ -4077,20 +4164,23 @@ msgstr "你是 OpenClash 专家助手。OpenClash 是 OpenWrt 上管理 Mihomo
|
||||
msgid "OpenClash User Guide"
|
||||
msgstr "OpenClash 用户指南"
|
||||
|
||||
msgid "This guide contains: complete dependency checklist, error message lookup tables with exact fixes, nftables/iptables firewall chain rules, all LuCI configuration options with UCI paths, DNS setup and leak prevention, subscription/GEO update procedures, and more."
|
||||
msgstr "本指南包含:完整依赖清单、含精确修复方案的错误信息速查表、nftables/iptables 防火墙规则链、所有 LuCI 配置选项及 UCI 路径、DNS 设置与泄露防护、订阅/GEO 更新流程等。"
|
||||
msgid "This guide contains: AI behavior rules with diagnosis priority, complete dependency checklist, error message lookup tables with exact fixes, nftables/iptables firewall chain rules, all LuCI configuration options with UCI paths, CLI commands and API reference, DNS setup and leak prevention, subscription/GEO update procedures, and more."
|
||||
msgstr "本指南包含:AI 行为规则与诊断优先级、完整依赖清单、含精确修复方案的错误信息速查表、nftables/iptables 防火墙规则链、所有 LuCI 配置选项及 UCI 路径、命令行与 API 参考、DNS 设置与泄露防护、订阅/GEO 更新流程等。"
|
||||
|
||||
msgid "Always provide LuCI web UI navigation paths (e.g. **Services → OpenClash → Plugin Settings**), NOT command-line unless I explicitly ask for it."
|
||||
msgstr "始终提供 LuCI Web 界面操作路径(如 **服务 → OpenClash → 插件设置**),除非我明确要求,不要给出命令行操作。"
|
||||
msgid "When I report any problem or error (cannot access internet, DNS failure, startup failure, connection timeout, etc.), FIRST ask me to generate a debug log — either via LuCI (**Server Logs → Debug Logs → Generate Logs**) or SSH (`/usr/share/openclash/openclash_debug.sh`). The debug log contains dependency checks, configuration, firewall rules, and system info in one step — do NOT ask me to check things individually. (Note: this rule does NOT apply to feature configuration questions like \"how do I enable X?\" — see rule 3 for those.)"
|
||||
msgstr "当我报告任何故障或错误(无法上网、DNS 异常、启动失败、连接超时等)时,**首先**要求我生成调试日志 —— 通过 LuCI(**运行日志 → 调试日志 → 生成日志**)或 SSH(`/usr/share/openclash/openclash_debug.sh`)。调试日志一步包含依赖检查、配置、防火墙规则和系统信息 —— **不要**让我逐项检查。(注意:此规则**不适用**于功能配置类问题如「如何开启 XX?」—— 此类问题请参见规则 3。)"
|
||||
|
||||
msgid "If the debug log is insufficient to pinpoint the issue, give me precise diagnostic commands to run on the router and ask me to paste back the output."
|
||||
msgstr "如果调试日志不足以定位问题,给我精确的诊断命令在路由器上执行,并让我粘贴输出结果。"
|
||||
|
||||
msgid "For feature configuration and post-diagnosis fixes, provide LuCI web UI navigation paths (e.g. **Services → OpenClash → Plugin Settings**). Only give command-line when LuCI is unavailable or I explicitly ask for it."
|
||||
msgstr "对于功能配置和诊断后的修复,提供 LuCI Web 界面操作路径(如 **服务 → OpenClash → 插件设置**)。仅在 LuCI 不可用或我明确要求时才提供命令行。"
|
||||
|
||||
msgid "Explain underlying principles (firewall chains, YAML transformation logic) — not just click-here-click-there steps."
|
||||
msgstr "解释底层原理(防火墙规则链、YAML 转换逻辑)—— 而不只是点击步骤。"
|
||||
|
||||
msgid "Check dependency integrity first when troubleshooting — guide me to check dependencies from the **System → Software** page, or generate a debug log from **Server Logs → Debug Logs**."
|
||||
msgstr "排查问题时首先检查依赖完整性 —— 指导我从 **系统 → 软件包** 页面检查依赖,或从 **运行日志 → 调试日志** 页面生成调试日志。"
|
||||
|
||||
msgid "Never guess or fabricate information. If the reference guide does not cover something, actively query these external resources using web fetch / code search tools (in priority order):"
|
||||
msgstr "绝不猜测或编造信息。如参考指南未覆盖某项内容,请使用网页抓取/代码搜索工具主动查询以下外部资源(按优先级):"
|
||||
msgid "If the guide does not cover something, actively query these resources — never guess or fabricate information:"
|
||||
msgstr "如果指南未覆盖某项内容,请主动查询这些资源 —— 绝不猜测或编造信息:"
|
||||
|
||||
msgid "Mihomo Wiki"
|
||||
msgstr "Mihomo Wiki"
|
||||
@@ -4119,8 +4209,8 @@ msgstr "OpenClash Issues(配置/订阅/防火墙/UI)"
|
||||
msgid "Mihomo Issues (proxy protocols/TUN/DNS/rule engine)"
|
||||
msgstr "Mihomo Issues(代理协议/TUN/DNS/规则引擎)"
|
||||
|
||||
msgid "Prioritize maintainer replies and highly upvoted community answers."
|
||||
msgstr "优先参考维护者的回复和高赞社区答案。"
|
||||
msgid "Prioritize maintainer replies and highly upvoted community answers in Issues."
|
||||
msgstr "优先参考 Issues 中维护者的回复和高赞社区答案。"
|
||||
|
||||
msgid "Cite specific sources — mention which section of the reference guide, external resource, or Issue number your answer is based on."
|
||||
msgstr "注明具体来源 —— 说明你的回答基于参考指南的哪个章节、哪个外部资源或哪个 Issue 编号。"
|
||||
@@ -4161,8 +4251,20 @@ msgstr "无法检测后端版本"
|
||||
msgid "Token Login"
|
||||
msgstr "Token 登录"
|
||||
|
||||
msgid "Enter your oixCloud token"
|
||||
msgstr "输入您的 oixCloud Token"
|
||||
msgid "Please enter your oixCloud token"
|
||||
msgstr "请输入您的 oixCloud Token"
|
||||
|
||||
msgid "Show Password"
|
||||
msgstr "显示密码"
|
||||
|
||||
msgid "Hide Password"
|
||||
msgstr "隐藏密码"
|
||||
|
||||
msgid "Show Token"
|
||||
msgstr "显示 Token"
|
||||
|
||||
msgid "Hide Token"
|
||||
msgstr "隐藏 Token"
|
||||
|
||||
msgid "Token login does not require email and password"
|
||||
msgstr "Token 登录无需填写邮箱和密码"
|
||||
@@ -4212,6 +4314,9 @@ msgstr "签到设置保存失败,请重试"
|
||||
msgid "Network request failed, please check your connection and try again"
|
||||
msgstr "网络请求失败,请检查网络连接后重试"
|
||||
|
||||
msgid "Server response error, please try again later"
|
||||
msgstr "服务器响应异常,请稍后重试"
|
||||
|
||||
msgid "Show on Overview"
|
||||
msgstr "主页显示"
|
||||
|
||||
@@ -4236,3 +4341,21 @@ msgstr "oixCloud 退出失败:"
|
||||
msgid "Checkin Failed:"
|
||||
msgstr "签到失败:"
|
||||
|
||||
msgid "Fetching data..."
|
||||
msgstr "数据获取中..."
|
||||
|
||||
msgid "Click"
|
||||
msgstr "点击"
|
||||
|
||||
msgid "link"
|
||||
msgstr "链接"
|
||||
|
||||
msgid "to update all, click"
|
||||
msgstr "可同时更新,点击"
|
||||
|
||||
msgid "version"
|
||||
msgstr "版本号"
|
||||
|
||||
msgid "to update individually"
|
||||
msgstr "则独立更新"
|
||||
|
||||
@@ -575,7 +575,7 @@ do_run_file()
|
||||
|
||||
ln -s "$meta_core_path" /etc/openclash/clash
|
||||
|
||||
if [ -n "$OIX_TOKEN" ] || [ "$core_type" == "Oix" ]; then
|
||||
if [ -n "$OIX_TOKEN" ]; then
|
||||
core_type="Oix"
|
||||
elif [ "$smart_enable" -eq 1 ] || [ "$core_type" == "Smart" ]; then
|
||||
core_type="Smart"
|
||||
@@ -590,7 +590,6 @@ do_run_file()
|
||||
|
||||
[ ! -f "$CLASH" ] || { [ "$core_type" = "Smart" ] && [ -z "$($CLASH -v | grep 'smart')" ] && [ -z "$($CLASH -v | grep 'oix')" ]; } || { [ "$core_type" = "Oix" ] && [ -z "$($CLASH -v | grep 'oix')" ]; } && {
|
||||
LOG_TIP "【$core_type】Core is not Detected installed, Ready to Download..."
|
||||
rm -rf "/tmp/clash_last_version"
|
||||
/usr/share/openclash/openclash_core.sh "$core_type"
|
||||
if [ ! -f "$meta_core_path" ]; then
|
||||
start_fail
|
||||
@@ -807,7 +806,6 @@ check_core_status()
|
||||
fi
|
||||
|
||||
write_run_quick
|
||||
SLOG_CLEAN
|
||||
} >/dev/null 2>&1
|
||||
|
||||
start_run_core()
|
||||
@@ -826,7 +824,7 @@ start_run_core()
|
||||
procd_append_param env CLASH_AGE_SECRET_KEY="$SECRET_KEY"
|
||||
procd_append_param env OIX_TOKEN="$OIX_TOKEN"
|
||||
procd_append_param env OIX_PARAMS="$OIX_PARAMS"
|
||||
procd_set_param command /bin/sh -c "$CLASH -d $CLASH_CONFIG -f \"$CONFIG_FILE\" >> $LOG_FILE 2>&1"
|
||||
procd_set_param command /bin/sh -c "exec $CLASH -d $CLASH_CONFIG -f \"$CONFIG_FILE\" >> $LOG_FILE 2>&1"
|
||||
procd_set_param user "root"
|
||||
procd_set_param group "nogroup"
|
||||
procd_set_param limits nproc="unlimited" as="unlimited" memlock="unlimited" nofile="1000000 1000000"
|
||||
@@ -1727,7 +1725,7 @@ if [ -n "$FW4" ]; then
|
||||
fi
|
||||
if [ "$router_self_proxy" = 1 ]; then
|
||||
nft 'add chain inet fw4 nat_output { type nat hook output priority -1; }'
|
||||
nft insert rule inet fw4 nat_output position 0 skgid != 65534 meta nfproto {ipv6} ip6 nexthdr {tcp,udp} th dport 53 ip6 daddr {::/0} counter redirect to "$DNSPORT" comment \"OpenClash DNS Hijack\"
|
||||
nft insert rule inet fw4 nat_output position 0 skgid != 65534 meta nfproto {ipv6} ip6 nexthdr {tcp,udp} th dport 53 ip6 daddr {::1} counter redirect to "$DNSPORT" comment \"OpenClash DNS Hijack\"
|
||||
fi
|
||||
elif [ "$enable_redirect_dns" -eq 2 ]; then
|
||||
if [ "$lan_ac_mode" != "1" ]; then
|
||||
@@ -1748,7 +1746,7 @@ if [ -n "$FW4" ]; then
|
||||
nft 'insert rule inet fw4 dstnat position 0 meta nfproto {ipv6} ip6 nexthdr {tcp,udp} th dport 53 counter jump openclash_dns_redirect'
|
||||
if [ "$router_self_proxy" = 1 ]; then
|
||||
nft 'add chain inet fw4 nat_output { type nat hook output priority -1; }'
|
||||
nft insert rule inet fw4 nat_output position 0 meta nfproto {ipv6} ip6 nexthdr {tcp,udp} th dport 53 ip6 daddr {::/0} meta skgid != 65534 counter redirect to "$dns_port" comment \"OpenClash DNS Hijack\"
|
||||
nft insert rule inet fw4 nat_output position 0 meta nfproto {ipv6} ip6 nexthdr {tcp,udp} th dport 53 ip6 daddr {::1} meta skgid != 65534 counter redirect to "$dns_port" comment \"OpenClash DNS Hijack\"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
@@ -2563,8 +2561,8 @@ if [ -z "$FW4" ]; then
|
||||
ip6tables -t nat -I PREROUTING -p tcp --dport 53 -m set --match-set lan_ac_white_macs src -j REDIRECT --to-ports "$DNSPORT" -m comment --comment "OpenClash DNS Hijack"
|
||||
fi
|
||||
if [ "$router_self_proxy" = 1 ]; then
|
||||
ip6tables -t nat -I OUTPUT -p tcp --dport 53 -d ::/0 $noowner -j REDIRECT --to-ports "$DNSPORT" -m comment --comment "OpenClash DNS Hijack"
|
||||
ip6tables -t nat -I OUTPUT -p udp --dport 53 -d ::/0 $noowner -j REDIRECT --to-ports "$DNSPORT" -m comment --comment "OpenClash DNS Hijack"
|
||||
ip6tables -t nat -I OUTPUT -p tcp --dport 53 -d ::1 $noowner -j REDIRECT --to-ports "$DNSPORT" -m comment --comment "OpenClash DNS Hijack"
|
||||
ip6tables -t nat -I OUTPUT -p udp --dport 53 -d ::1 $noowner -j REDIRECT --to-ports "$DNSPORT" -m comment --comment "OpenClash DNS Hijack"
|
||||
fi
|
||||
elif [ "$enable_redirect_dns" -eq 2 ]; then
|
||||
ip6tables -t nat -N openclash_dns_redirect
|
||||
@@ -2590,8 +2588,8 @@ if [ -z "$FW4" ]; then
|
||||
ip6tables -t nat -I PREROUTING -p udp --dport 53 -j openclash_dns_redirect
|
||||
ip6tables -t nat -I PREROUTING -p tcp --dport 53 -j openclash_dns_redirect
|
||||
if [ "$router_self_proxy" = 1 ]; then
|
||||
ip6tables -t nat -I OUTPUT -p udp --dport 53 -d ::/0 $noowner -j REDIRECT --to-ports "$dns_port" -m comment --comment "OpenClash DNS Hijack"
|
||||
ip6tables -t nat -I OUTPUT -p tcp --dport 53 -d ::/0 $noowner -j REDIRECT --to-ports "$dns_port" -m comment --comment "OpenClash DNS Hijack"
|
||||
ip6tables -t nat -I OUTPUT -p udp --dport 53 -d ::1 $noowner -j REDIRECT --to-ports "$dns_port" -m comment --comment "OpenClash DNS Hijack"
|
||||
ip6tables -t nat -I OUTPUT -p tcp --dport 53 -d ::1 $noowner -j REDIRECT --to-ports "$dns_port" -m comment --comment "OpenClash DNS Hijack"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
@@ -3159,6 +3157,7 @@ EOF
|
||||
SMART_ENABLE_LGBM:int_bool \
|
||||
SMART_POLICY_PRIORITY:string \
|
||||
SMART_PREFER_ASN:int_bool \
|
||||
SMART_TOLERANCE:int \
|
||||
SKIP_PROXY_ADDRESS:int_bool \
|
||||
SMALL_FLASH_MEMORY:int_bool \
|
||||
SOCKS_PORT:int \
|
||||
@@ -3421,11 +3420,14 @@ EOF
|
||||
yaml_data = YAML.load(yaml_override_content)
|
||||
|
||||
if yaml_data.is_a?(Hash)
|
||||
Value = YAML.load_file('$CONFIG_FILE')
|
||||
Overwrite_Value = YAML.overwrite(Value, yaml_data)
|
||||
File.open('$CONFIG_FILE', 'w') do |f|
|
||||
YAML.dump(Overwrite_Value, f)
|
||||
if File.exist?('/tmp/yaml_overwrite_marshal')
|
||||
Value = Marshal.load(File.open('/tmp/yaml_overwrite_marshal', 'rb') { |f| f.read })
|
||||
else
|
||||
Value = YAML.load_file('$CONFIG_FILE')
|
||||
end
|
||||
Overwrite_Value = YAML.overwrite(Value, yaml_data)
|
||||
YAML.dump(Overwrite_Value, '$CONFIG_FILE')
|
||||
File.open('/tmp/yaml_overwrite_marshal', 'wb') { |f| Marshal.dump(Overwrite_Value, f) }
|
||||
else
|
||||
YAML.LOG_WARN('Invalid YAML Override format, skipped...')
|
||||
end
|
||||
@@ -3444,13 +3446,15 @@ if [ -f "/tmp/yaml_openclash_ruby_parts/$OPENCLASH_OVERWRITE_SID" ]; then
|
||||
ruby_code=$(cat "/tmp/yaml_openclash_ruby_parts/$OPENCLASH_OVERWRITE_SID")
|
||||
ruby -ryaml -rYAML -I "/usr/share/openclash" -E UTF-8 -e "
|
||||
begin
|
||||
Value = YAML.load_file('$CONFIG_FILE')
|
||||
if File.exist?('/tmp/yaml_overwrite_marshal')
|
||||
Value = Marshal.load(File.open('/tmp/yaml_overwrite_marshal', 'rb') { |f| f.read })
|
||||
else
|
||||
Value = YAML.load_file('$CONFIG_FILE')
|
||||
end
|
||||
threads = []
|
||||
$ruby_code
|
||||
threads.each(&:join)
|
||||
File.open('$CONFIG_FILE', 'w') do |f|
|
||||
YAML.dump(Value, f)
|
||||
end
|
||||
YAML.dump(Value, '$CONFIG_FILE')
|
||||
rescue Exception => e
|
||||
YAML.LOG_ERROR('Set Custom Overwrite Script Failed,【%s】' % [e.message])
|
||||
end
|
||||
@@ -3587,6 +3591,7 @@ get_config()
|
||||
smart_policy_priority=$(uci_get_config "smart_policy_priority" || echo 0)
|
||||
smart_enable_lgbm=$(uci_get_config "smart_enable_lgbm" || echo 0)
|
||||
smart_prefer_asn=$(uci_get_config "smart_prefer_asn" || echo 0)
|
||||
smart_tolerance=$(uci_get_config "smart_tolerance" || echo 0)
|
||||
|
||||
[ -z "$dns_port" ] && dns_port=7874 && uci -q set openclash.config.dns_port=7874
|
||||
uci -q commit openclash
|
||||
@@ -3595,7 +3600,7 @@ get_config()
|
||||
start_service()
|
||||
{
|
||||
enable=$(uci_get_config "enable")
|
||||
[ "$enable" != "1" ] && LOG_WARN "OpenClash Now Disabled, Need Start From Luci Page, Exit..." && SLOG_CLEAN && exit 0
|
||||
[ "$enable" != "1" ] && LOG_WARN "OpenClash Now Disabled, Need Start From Luci Page, Exit..." && exit 0
|
||||
|
||||
if procd_running "openclash" >/dev/null; then
|
||||
LOG_TIP "OpenClash Already Running, Exit..."
|
||||
@@ -3633,7 +3638,7 @@ start_service()
|
||||
/usr/share/openclash/yml_rules_change.sh \
|
||||
"$enable_custom_clash_rules" "$TMP_CONFIG_FILE"\
|
||||
"$enable_rule_proxy" "$router_self_proxy" "$lan_ip" "$enable_redirect_dns" "$en_mode"\
|
||||
"$auto_smart_switch" "$smart_collect" "$smart_collect_rate" "$smart_policy_priority" "$smart_enable_lgbm" "$smart_prefer_asn"
|
||||
"$auto_smart_switch" "$smart_collect" "$smart_collect_rate" "$smart_policy_priority" "$smart_enable_lgbm" "$smart_prefer_asn" "$smart_tolerance"
|
||||
|
||||
#Custom overwrite
|
||||
if [ -f "/tmp/yaml_overwrite.sh" ]; then
|
||||
@@ -3658,9 +3663,7 @@ start_service()
|
||||
threads = []
|
||||
$ruby_code
|
||||
threads.each(&:join)
|
||||
File.open('$yaml_file', 'w') do |f|
|
||||
YAML.dump(Value, f)
|
||||
end
|
||||
YAML.dump(Value, '$yaml_file')
|
||||
rescue Exception => e
|
||||
YAML.LOG_ERROR('Set Custom Overwrite Script Failed,【%s】' % [e.message])
|
||||
end
|
||||
@@ -3696,7 +3699,7 @@ start_service()
|
||||
end
|
||||
end
|
||||
threads.each(&:join)
|
||||
File.open('$TMP_CONFIG_FILE', 'w') { |f| YAML.dump(Value, f) }
|
||||
YAML.dump(Value, '$TMP_CONFIG_FILE')
|
||||
rescue Exception => e
|
||||
YAML.LOG_ERROR('Edit Provider Path Failed,【%s】' % [e.message])
|
||||
end
|
||||
@@ -3751,11 +3754,6 @@ stop_service()
|
||||
for i in $(seq 1 10); do
|
||||
procd_running "openclash" >/dev/null && sleep 1 || break
|
||||
done
|
||||
if procd_running "openclash" >/dev/null; then
|
||||
for pid in $(pidof clash 2>/dev/null); do
|
||||
kill -9 "$pid" 2>/dev/null || true
|
||||
done
|
||||
fi
|
||||
|
||||
LOG_OUT "Step 4: Restart Dnsmasq..."
|
||||
revert_dnsmasq
|
||||
@@ -3764,14 +3762,13 @@ stop_service()
|
||||
LOG_TIP "OpenClash Already Stop!"
|
||||
|
||||
if [ "$enable" != "1" ]; then
|
||||
rm -rf /tmp/clash_last_version \
|
||||
/tmp/openclash_last_version \
|
||||
rm -rf /tmp/openclash_version_history.json \
|
||||
/tmp/openclash_cdn_info.json \
|
||||
/tmp/openclash.change \
|
||||
/tmp/openclash_announcement \
|
||||
${DNSMASQ_CONF_DIR}/dnsmasq_openclash_chnroute_pass.conf \
|
||||
${DNSMASQ_CONF_DIR}/dnsmasq_openclash_chnroute6_pass.conf \
|
||||
${DNSMASQ_CONF_DIR}/dnsmasq_openclash_custom_domain.conf
|
||||
SLOG_CLEAN
|
||||
fi
|
||||
|
||||
del_cron
|
||||
@@ -3839,7 +3836,6 @@ reload_service()
|
||||
if pidof clash >/dev/null && [ "$enable" == "1" ] && [ "$1" == "revert" ]; then
|
||||
revert_firewall
|
||||
revert_dnsmasq
|
||||
SLOG_CLEAN
|
||||
fi
|
||||
if pidof clash >/dev/null && [ "$enable" == "1" ] && [ "$1" == "restore" ]; then
|
||||
do_run_mode
|
||||
|
||||
@@ -119,7 +119,7 @@ CONFIG_FILE="$1"
|
||||
# rescue Exception => e
|
||||
# puts '${LOGTIME} [error] Set General Failed,【' + e.message + '】';
|
||||
# ensure
|
||||
# File.open('$CONFIG_FILE','w') {|f| YAML.dump(Value, f)};
|
||||
# YAML.dump(Value, '$CONFIG_FILE');
|
||||
# end" 2>/dev/null >> $LOG_FILE
|
||||
|
||||
exit 0
|
||||
@@ -89,10 +89,13 @@ case "${DISTRIB_ARCH}" in
|
||||
aarch64_*)
|
||||
CORE_ARCH="linux-arm64"
|
||||
;;
|
||||
arm_*_neon-vfp*)
|
||||
armeb_*)
|
||||
CORE_ARCH="0"
|
||||
;;
|
||||
arm_cortex-a5|arm_cortex-a5[^0-9]*|arm_cortex-a7|arm_cortex-a7[^0-9]*|arm_cortex-a8*|arm_cortex-a9*|arm_cortex-a12*|arm_cortex-a15*|arm_cortex-a17*)
|
||||
CORE_ARCH="linux-armv7"
|
||||
;;
|
||||
arm_*_neon|arm_*_vfp*)
|
||||
arm_arm1176jzf-s*|arm_arm1136*|arm_mpcore*)
|
||||
CORE_ARCH="linux-armv6"
|
||||
;;
|
||||
arm*)
|
||||
@@ -101,6 +104,9 @@ case "${DISTRIB_ARCH}" in
|
||||
i386_*)
|
||||
CORE_ARCH="linux-386"
|
||||
;;
|
||||
mips64el_*)
|
||||
CORE_ARCH="linux-mips64le"
|
||||
;;
|
||||
mips64_*)
|
||||
CORE_ARCH="linux-mips64"
|
||||
;;
|
||||
@@ -110,6 +116,12 @@ case "${DISTRIB_ARCH}" in
|
||||
mipsel_*)
|
||||
CORE_ARCH="linux-mipsle-softfloat"
|
||||
;;
|
||||
riscv64*)
|
||||
CORE_ARCH="linux-riscv64"
|
||||
;;
|
||||
loongarch64*|loongarch_*)
|
||||
CORE_ARCH="linux-loong64-abi2"
|
||||
;;
|
||||
x86_64)
|
||||
CORE_ARCH="linux-amd64-v1"
|
||||
;;
|
||||
|
||||
@@ -22,19 +22,19 @@ module YAML
|
||||
end
|
||||
|
||||
def self.load_file(filename, *args, **kwargs)
|
||||
yaml_content = File.read(filename, mode: "r:bom|utf-8")
|
||||
|
||||
secret = nil
|
||||
if kwargs.key?(:secret)
|
||||
secret = kwargs.delete(:secret)
|
||||
end
|
||||
|
||||
if yaml_content.include?("BEGIN AGE ENCRYPTED FILE")
|
||||
header = File.binread(filename, 512).to_s
|
||||
|
||||
if header.include?("BEGIN AGE ENCRYPTED FILE")
|
||||
yaml_content = File.read(filename, mode: "r:bom|utf-8")
|
||||
if secret && secret.to_s.strip != ""
|
||||
decrypted = decrypt_content_with_secret(secret.to_s, yaml_content)
|
||||
if decrypted && !decrypted.empty? && !decrypted.include?("BEGIN AGE ENCRYPTED FILE")
|
||||
processed = fix_short_id_quotes(decrypted)
|
||||
return load(processed, *args, **kwargs)
|
||||
return fix_and_load(decrypted, *args, **kwargs)
|
||||
else
|
||||
raise "Decrypted content empty or still encrypted: [#{filename}]"
|
||||
end
|
||||
@@ -46,8 +46,7 @@ module YAML
|
||||
begin
|
||||
decrypted = decrypt_content_with_secret(sec, yaml_content)
|
||||
if decrypted && !decrypted.empty? && !decrypted.include?("BEGIN AGE ENCRYPTED FILE")
|
||||
processed = fix_short_id_quotes(decrypted)
|
||||
return load(processed, *args, **kwargs)
|
||||
return fix_and_load(decrypted, *args, **kwargs)
|
||||
end
|
||||
rescue => e
|
||||
last_error = e.message
|
||||
@@ -58,13 +57,51 @@ module YAML
|
||||
raise "Encrypted file: decryption failed for [#{filename}]: [#{detail}]"
|
||||
end
|
||||
|
||||
processed_content = fix_short_id_quotes(yaml_content)
|
||||
load(processed_content, *args, **kwargs)
|
||||
base64, short_id, protocol_param = File.open(filename, "r:bom|utf-8") do |io|
|
||||
scan_for_fixes(io)
|
||||
end
|
||||
|
||||
if base64 || protocol_param
|
||||
fix_and_load(File.read(filename, mode: "r:bom|utf-8"), *args, **kwargs)
|
||||
elsif short_id
|
||||
fixed = File.open(filename, "r:bom|utf-8") { |io| fix_short_id_text(io) }
|
||||
begin
|
||||
load(fixed, *args, **kwargs)
|
||||
rescue => e
|
||||
raise "fix short-id values type failed: #{e.message}"
|
||||
end
|
||||
else
|
||||
result = File.open(filename, "r:bom|utf-8") do |io|
|
||||
load(io, *args, **kwargs)
|
||||
end
|
||||
if result.nil? || result == false
|
||||
result = fix_and_load(File.read(filename, mode: "r:bom|utf-8"), *args, **kwargs)
|
||||
end
|
||||
result
|
||||
end
|
||||
end
|
||||
|
||||
def self.dump(obj, io = nil, **options)
|
||||
yaml_content = original_dump(obj, **options)
|
||||
processed = fix_short_id_quotes(yaml_content)
|
||||
if obj.nil? || obj == false
|
||||
target = ""
|
||||
if io.is_a?(String)
|
||||
target = " [#{io}]"
|
||||
elsif io && io.respond_to?(:path)
|
||||
target = " [#{io.path}]"
|
||||
elsif options.key?(:filename)
|
||||
target = " [#{options[:filename]}]"
|
||||
end
|
||||
raise "YAML.dump: refusing to write nil/false config content#{target} (previous load may have failed)"
|
||||
end
|
||||
|
||||
if io.is_a?(String)
|
||||
dump_to_path(obj, io, **options)
|
||||
else
|
||||
dump_to_io(obj, io, **options)
|
||||
end
|
||||
end
|
||||
|
||||
def self.dump_to_io(obj, io = nil, **options)
|
||||
public_key = nil
|
||||
fname = nil
|
||||
if options.key?(:public)
|
||||
@@ -86,7 +123,11 @@ module YAML
|
||||
end
|
||||
end
|
||||
|
||||
needs_fix = contains_short_id?(obj)
|
||||
|
||||
if public_key && public_key.to_s.strip != ""
|
||||
yaml_content = original_dump(obj, **options)
|
||||
processed = needs_fix ? fix_short_id_quotes(yaml_content) : yaml_content
|
||||
begin
|
||||
encrypted = encrypt_content_with_public(public_key.to_s, processed)
|
||||
if encrypted && !encrypted.empty?
|
||||
@@ -108,15 +149,40 @@ module YAML
|
||||
end
|
||||
|
||||
if io.nil?
|
||||
processed
|
||||
yaml_content = original_dump(obj, **options)
|
||||
needs_fix ? fix_short_id_quotes(yaml_content) : yaml_content
|
||||
elsif io.respond_to?(:write)
|
||||
io.write(processed)
|
||||
if needs_fix
|
||||
fix_short_id_text(original_dump(obj, **options), io)
|
||||
else
|
||||
original_dump(obj, io, **options)
|
||||
end
|
||||
io
|
||||
else
|
||||
processed
|
||||
yaml_content = original_dump(obj, **options)
|
||||
needs_fix ? fix_short_id_quotes(yaml_content) : yaml_content
|
||||
end
|
||||
end
|
||||
|
||||
def self.dump_to_path(obj, path, **options)
|
||||
real = File.symlink?(path) ? File.realpath(path) : path
|
||||
dir = File.dirname(real)
|
||||
tmp = File.join(dir, ".#{File.basename(real)}.tmp#{Process.pid}.#{rand(1000)}")
|
||||
mode = File.exist?(real) ? File.stat(real).mode & 07777 : nil
|
||||
begin
|
||||
File.open(tmp, 'w') { |f| dump_to_io(obj, f, **options.merge(filename: real)) }
|
||||
File.chmod(mode, tmp) if mode
|
||||
File.rename(tmp, real)
|
||||
rescue Exception
|
||||
begin
|
||||
File.unlink(tmp) if File.exist?(tmp)
|
||||
rescue
|
||||
end
|
||||
raise
|
||||
end
|
||||
path
|
||||
end
|
||||
|
||||
def self.popen_stream(cmd, input, chunk_size: 64 * 1024)
|
||||
output = String.new
|
||||
IO.popen(cmd, 'r+', err: [:child, :out]) do |io|
|
||||
@@ -229,75 +295,162 @@ module YAML
|
||||
# Input: short-id: "1600e237" -> Output: short-id: "1600e237"
|
||||
# Input: short-id: null -> Output: short-id: ""
|
||||
|
||||
def self.fix_short_id_quotes(yaml_content)
|
||||
def self.fix_and_load(yaml_content, *args, **kwargs)
|
||||
yaml_content = decode64(yaml_content)
|
||||
|
||||
return yaml_content unless yaml_content.include?('short-id:')
|
||||
# Fix bare protocol-param values that break YAML parsing (e.g. "1.2.3.4:8080#test")
|
||||
yaml_content.gsub!(/^(\s*protocol-param:\s+)([^\s"'][^"\n\r]*[#:][^"\n\r]*)$/, '\1"\2"')
|
||||
return load(yaml_content, *args, **kwargs) unless yaml_content.include?('short-id:')
|
||||
|
||||
begin
|
||||
stream = Psych.parse_stream(yaml_content)
|
||||
|
||||
traverse = lambda do |node|
|
||||
case node
|
||||
when Psych::Nodes::Mapping
|
||||
children = node.children || []
|
||||
i = 0
|
||||
while i < children.length
|
||||
key = children[i]
|
||||
val = children[i + 1]
|
||||
if key.is_a?(Psych::Nodes::Scalar) && key.value == 'short-id'
|
||||
if val.is_a?(Psych::Nodes::Scalar)
|
||||
is_null_scalar = (val.tag == 'tag:yaml.org,2002:null') || (val.tag == '!!null') || (val.value =~ /^\s*(~|null|NULL|Null)\s*$/)
|
||||
unless is_null_scalar
|
||||
val.tag = nil
|
||||
val.style = defined?(Psych::Nodes::Scalar::DOUBLE_QUOTED) ? Psych::Nodes::Scalar::DOUBLE_QUOTED : 2
|
||||
end
|
||||
elsif val.is_a?(Psych::Nodes::Sequence)
|
||||
val.children.each do |child|
|
||||
if child.is_a?(Psych::Nodes::Scalar)
|
||||
is_null_child = (child.tag == 'tag:yaml.org,2002:null') || (child.tag == '!!null') || (child.value =~ /^\s*(~|null|NULL|Null)\s*$/)
|
||||
unless is_null_child
|
||||
child.tag = nil
|
||||
child.style = defined?(Psych::Nodes::Scalar::DOUBLE_QUOTED) ? Psych::Nodes::Scalar::DOUBLE_QUOTED : 2
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
else
|
||||
traverse.call(key) if key.respond_to?(:children)
|
||||
traverse.call(val) if val.respond_to?(:children)
|
||||
end
|
||||
i += 2
|
||||
end
|
||||
when Psych::Nodes::Sequence
|
||||
(node.children || []).each { |c| traverse.call(c) }
|
||||
when Psych::Nodes::Document, Psych::Nodes::Stream
|
||||
(node.children || []).each { |c| traverse.call(c) }
|
||||
else
|
||||
if node.respond_to?(:children)
|
||||
(node.children || []).each { |c| traverse.call(c) }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
stream.children.each do |doc_node|
|
||||
if doc_node.is_a?(Psych::Nodes::Document)
|
||||
traverse.call(doc_node.root) if doc_node.root
|
||||
end
|
||||
end
|
||||
|
||||
if stream.respond_to?(:to_yaml)
|
||||
processed_yaml = stream.to_yaml
|
||||
processed_yaml = processed_yaml.gsub(/^([ \t]*short-id:\s*)!\s*/, "\\1")
|
||||
processed_yaml
|
||||
else
|
||||
yaml_content
|
||||
end
|
||||
load(fix_short_id_text(yaml_content), *args, **kwargs)
|
||||
rescue => e
|
||||
raise "fix short-id values type failed: #{e.message}"
|
||||
end
|
||||
end
|
||||
|
||||
def self.quote_short_id_scalar(value)
|
||||
v = value.strip
|
||||
return value if v.empty?
|
||||
return '""' if v =~ /\A(?:~|null|NULL|Null)\z/
|
||||
if v.start_with?("'")
|
||||
if (m = v.match(/\A'((?:[^']|'')*)'(\s+#.*)?\z/))
|
||||
inner = m[1].gsub("''", "'")
|
||||
return "\"#{inner.gsub(/["\\]/) { |c| "\\#{c}" }}\"#{m[2]}"
|
||||
end
|
||||
return value
|
||||
end
|
||||
return value if v.start_with?('"')
|
||||
return value if v =~ /[:{}\[\],|>]/
|
||||
if (m = v.match(/\A(\S+)(\s+#.*)?\z/))
|
||||
"\"#{m[1].gsub('"', '\\"')}\"#{m[2]}"
|
||||
else
|
||||
"\"#{v.gsub('"', '\\"')}\""
|
||||
end
|
||||
end
|
||||
|
||||
def self.fix_short_id_text(yaml_content, output = nil)
|
||||
out = output || String.new
|
||||
in_seq = false
|
||||
seq_indent = -1
|
||||
in_block = false
|
||||
block_indent = -1
|
||||
pending = nil
|
||||
|
||||
yaml_content.each_line do |line|
|
||||
if in_block
|
||||
if line.strip.empty? || (line =~ /^(\s*)/ && Regexp.last_match(1).length > block_indent)
|
||||
out << line
|
||||
next
|
||||
else
|
||||
in_block = false
|
||||
end
|
||||
end
|
||||
|
||||
if pending
|
||||
if (m = line.match(/^(\s*)-(\s*)(.*?)(\r?\n)?\z/)) && m[1].length >= seq_indent
|
||||
out << pending
|
||||
in_seq = true
|
||||
else
|
||||
out << pending.sub(/^(\s*)short-id:.*?(\r?\n)?\z/, '\1short-id: ""\2')
|
||||
in_seq = false
|
||||
end
|
||||
pending = nil
|
||||
end
|
||||
|
||||
if (m = line.match(/^(\s*)short-id:(\s*)(.*?)(\r?\n)?\z/))
|
||||
indent = m[1]
|
||||
rest = m[3].to_s.strip
|
||||
if rest.empty? || rest.start_with?('#')
|
||||
in_seq = true
|
||||
seq_indent = indent.length
|
||||
pending = line
|
||||
else
|
||||
in_seq = false
|
||||
out << indent + "short-id:" + m[2] + quote_short_id_scalar(rest) + m[4].to_s
|
||||
end
|
||||
elsif (m = line.match(/^(\s*)[^:\s][^:]*:\s*[|>](\s*.*)?$/))
|
||||
in_block = true
|
||||
in_seq = false
|
||||
block_indent = m[1].length
|
||||
out << line
|
||||
elsif line.strip.empty?
|
||||
out << line
|
||||
elsif in_seq && (m = line.match(/^(\s*)-(\s*)(.*?)(\r?\n)?\z/)) && m[1].length >= seq_indent
|
||||
out << m[1] + "-" + m[2] + quote_short_id_scalar(m[3]) + m[4].to_s
|
||||
else
|
||||
in_seq = false
|
||||
out << line
|
||||
end
|
||||
end
|
||||
|
||||
if pending
|
||||
out << pending.sub(/^(\s*)short-id:.*?(\r?\n)?\z/, '\1short-id: ""\2')
|
||||
end
|
||||
|
||||
out
|
||||
end
|
||||
|
||||
def self.fix_short_id_quotes(yaml_content)
|
||||
begin
|
||||
fix_short_id_text(yaml_content)
|
||||
rescue => e
|
||||
raise "fix short-id values type failed: #{e.message}"
|
||||
end
|
||||
end
|
||||
|
||||
def self.scan_for_fixes(io)
|
||||
base64 = false
|
||||
short_id = false
|
||||
protocol_param = false
|
||||
first_nonempty_seen = false
|
||||
buffer = String.new
|
||||
chunk_size = 64 * 1024
|
||||
|
||||
while (chunk = io.read(chunk_size))
|
||||
buffer << chunk
|
||||
|
||||
unless first_nonempty_seen
|
||||
if (idx = buffer.index("\n"))
|
||||
stripped = buffer[0...idx].strip
|
||||
if !stripped.empty?
|
||||
first_nonempty_seen = true
|
||||
base64 = stripped.match?(/\A[A-Za-z0-9+\/=]+\z/)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
short_id ||= buffer.include?('short-id:')
|
||||
protocol_param ||= buffer.include?('protocol-param:')
|
||||
|
||||
if first_nonempty_seen && buffer.bytesize > chunk_size + 4096
|
||||
buffer = buffer[-4096, 4096]
|
||||
end
|
||||
|
||||
break if base64 || short_id || protocol_param
|
||||
end
|
||||
|
||||
unless first_nonempty_seen
|
||||
stripped = buffer.strip
|
||||
base64 = !stripped.empty? && stripped.match?(/\A[A-Za-z0-9+\/=]+\z/)
|
||||
end
|
||||
|
||||
[base64, short_id, protocol_param]
|
||||
end
|
||||
|
||||
def self.contains_short_id?(obj, depth = 0)
|
||||
return false if depth > 64
|
||||
case obj
|
||||
when Hash
|
||||
return true if obj.key?('short-id') || obj.key?(:"short-id")
|
||||
obj.each_value { |v| return true if contains_short_id?(v, depth + 1) }
|
||||
false
|
||||
when Array
|
||||
obj.any? { |v| contains_short_id?(v, depth + 1) }
|
||||
else
|
||||
false
|
||||
end
|
||||
end
|
||||
|
||||
def self.overwrite(base, override)
|
||||
return override if base.nil?
|
||||
return base if override.nil?
|
||||
|
||||
@@ -1,48 +0,0 @@
|
||||
#!/bin/bash
|
||||
. /usr/share/openclash/openclash_curl.sh
|
||||
. /usr/share/openclash/uci.sh
|
||||
|
||||
set_lock() {
|
||||
exec 884>"/tmp/lock/openclash_clash_version.lock" 2>/dev/null
|
||||
flock -x 884 2>/dev/null
|
||||
}
|
||||
|
||||
del_lock() {
|
||||
flock -u 884 2>/dev/null
|
||||
rm -rf "/tmp/lock/openclash_clash_version.lock" 2>/dev/null
|
||||
}
|
||||
|
||||
set_lock
|
||||
|
||||
DOWNLOAD_FILE="/tmp/clash_last_version"
|
||||
RELEASE_BRANCH=$(uci_get_config "release_branch" || echo "master")
|
||||
github_address_mod=$(uci_get_config "github_address_mod" || echo 0)
|
||||
CORE_TYPE=$(uci_get_config "core_type")
|
||||
OIX_TOKEN=$(uci_get_config "oix_token")
|
||||
|
||||
if [ -n "$1" ]; then
|
||||
github_address_mod="$1"
|
||||
fi
|
||||
|
||||
if [ "$CORE_TYPE" = "Oix" ] || [ -n "$OIX_TOKEN" ]; then
|
||||
OIX_VERSION_URL="https://github.com/vernesong/mihomo-oix/releases/download/Pre-Alpha/version.txt"
|
||||
OIX_VERSION_P_URL="https://dl.dler.io/mihomo-oix/version.txt?tag=Pre-Alpha"
|
||||
if [ "$github_address_mod" != "0" ] && [ "$github_address_mod" != "https://cdn.jsdelivr.net/" ] && [ "$github_address_mod" != "https://fastly.jsdelivr.net/" ] && [ "$github_address_mod" != "https://testingcf.jsdelivr.net/" ]; then
|
||||
DOWNLOAD_URL="${github_address_mod}${OIX_VERSION_URL}"
|
||||
else
|
||||
DOWNLOAD_URL="$OIX_VERSION_P_URL"
|
||||
fi
|
||||
else
|
||||
if [ "$github_address_mod" != "0" ]; then
|
||||
if [ "$github_address_mod" == "https://cdn.jsdelivr.net/" ] || [ "$github_address_mod" == "https://fastly.jsdelivr.net/" ] || [ "$github_address_mod" == "https://testingcf.jsdelivr.net/" ]; then
|
||||
DOWNLOAD_URL="${github_address_mod}gh/vernesong/OpenClash@core/${RELEASE_BRANCH}/core_version"
|
||||
else
|
||||
DOWNLOAD_URL="${github_address_mod}https://raw.githubusercontent.com/vernesong/OpenClash/core/${RELEASE_BRANCH}/core_version"
|
||||
fi
|
||||
else
|
||||
DOWNLOAD_URL="https://raw.githubusercontent.com/vernesong/OpenClash/core/${RELEASE_BRANCH}/core_version"
|
||||
fi
|
||||
fi
|
||||
|
||||
DOWNLOAD_FILE_CURL "$DOWNLOAD_URL" "$DOWNLOAD_FILE" "$DOWNLOAD_FILE"
|
||||
del_lock
|
||||
@@ -6,7 +6,7 @@ LOG_FILE="/tmp/openclash.log"
|
||||
LOG_OUT()
|
||||
{
|
||||
if [ -n "${1}" ]; then
|
||||
echo -e "${1}" > $START_LOG
|
||||
echo -e "$(date "+%Y-%m-%d %H:%M:%S") [Info] ${1}" >> $START_LOG
|
||||
echo -e "$(date "+%Y-%m-%d %H:%M:%S") [Info] ${1}" >> $LOG_FILE
|
||||
fi
|
||||
}
|
||||
@@ -14,7 +14,7 @@ LOG_OUT()
|
||||
LOG_TIP()
|
||||
{
|
||||
if [ -n "${1}" ]; then
|
||||
echo -e "${1}" > $START_LOG
|
||||
echo -e "$(date "+%Y-%m-%d %H:%M:%S") [Tip] ${1}" >> $START_LOG
|
||||
echo -e "$(date "+%Y-%m-%d %H:%M:%S") [Tip] ${1}" >> $LOG_FILE
|
||||
fi
|
||||
}
|
||||
@@ -22,7 +22,7 @@ LOG_TIP()
|
||||
LOG_WARN()
|
||||
{
|
||||
if [ -n "${1}" ]; then
|
||||
echo -e "${1}" > $START_LOG
|
||||
echo -e "$(date "+%Y-%m-%d %H:%M:%S") [Warning] ${1}" >> $START_LOG
|
||||
echo -e "$(date "+%Y-%m-%d %H:%M:%S") [Warning] ${1}" >> $LOG_FILE
|
||||
fi
|
||||
}
|
||||
@@ -30,7 +30,7 @@ LOG_WARN()
|
||||
LOG_ERROR()
|
||||
{
|
||||
if [ -n "${1}" ]; then
|
||||
echo -e "${1}" > $START_LOG
|
||||
echo -e "$(date "+%Y-%m-%d %H:%M:%S") [Error] ${1}" >> $START_LOG
|
||||
echo -e "$(date "+%Y-%m-%d %H:%M:%S") [Error] ${1}" >> $LOG_FILE
|
||||
fi
|
||||
}
|
||||
@@ -48,14 +48,3 @@ LOG_WATCHDOG()
|
||||
echo -e "$(date "+%Y-%m-%d %H:%M:%S") [Watchdog] ${1}" >> $LOG_FILE
|
||||
fi
|
||||
}
|
||||
|
||||
LOG_ALERT()
|
||||
{
|
||||
echo -e "$(tail -n 20 $LOG_FILE |grep -E 'level=fatal|level=error' |awk 'END {print}')" > $START_LOG
|
||||
sleep 3
|
||||
}
|
||||
|
||||
SLOG_CLEAN()
|
||||
{
|
||||
echo "##FINISH##" > $START_LOG
|
||||
}
|
||||
@@ -67,6 +67,24 @@ config_test()
|
||||
fi
|
||||
}
|
||||
|
||||
yaml_sub_validate()
|
||||
{
|
||||
rm -f /tmp/yaml_sub_status 2>/dev/null
|
||||
ruby -ryaml -rYAML -I "/usr/share/openclash" -E UTF-8 -e "
|
||||
begin
|
||||
Value = YAML.load_file('$CFG_FILE')
|
||||
unless Value.key?('proxies') || Value.key?('proxy-providers')
|
||||
File.open('/tmp/yaml_sub_status', 'w') { |f| f.puts 'NO_CONTENT' }
|
||||
end
|
||||
rescue Exception => e
|
||||
YAML.LOG_ERROR('Unable To Parse Config File,【' + e.message + '】')
|
||||
system 'rm -rf ${CFG_FILE} 2>/dev/null'
|
||||
end
|
||||
" 2>/dev/null >> $LOG_FILE
|
||||
YAML_SUB_STATUS=$(cat /tmp/yaml_sub_status 2>/dev/null)
|
||||
rm -f /tmp/yaml_sub_status 2>/dev/null
|
||||
}
|
||||
|
||||
config_download()
|
||||
{
|
||||
LOG_TIP "Config File【$name】Downloading User-Agent【$sub_ua】..."
|
||||
@@ -152,7 +170,7 @@ config_cus_up()
|
||||
YAML.LOG_ERROR('Filter Proxies Failed,【' + e.message + '】');
|
||||
ensure
|
||||
begin
|
||||
File.open('$CFG_FILE','w') {|f| YAML.dump(Value, f)};
|
||||
YAML.dump(Value, '$CFG_FILE');
|
||||
rescue Exception => e
|
||||
YAML.LOG_ERROR('Write file failed:【%s】' % [e.message])
|
||||
end
|
||||
@@ -222,8 +240,6 @@ config_download_direct()
|
||||
|
||||
if [ "$DOWNLOAD_RESULT" -eq 0 ] && [ -s "$CFG_FILE" ]; then
|
||||
#prevent ruby unexpected error
|
||||
sed -i -E 's/protocol-param: ([^,'"'"'"''}( *#)\n\r]+)/protocol-param: "\1"/g' "$CFG_FILE" 2>/dev/null
|
||||
sed -i '/^ \{0,\}enhanced-mode:/d' "$CFG_FILE" >/dev/null 2>&1
|
||||
config_test
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "Config File Tested Failed, Please Check The Log Infos!"
|
||||
@@ -231,14 +247,7 @@ config_download_direct()
|
||||
config_error
|
||||
return
|
||||
fi
|
||||
ruby -ryaml -rYAML -I "/usr/share/openclash" -E UTF-8 -e "
|
||||
begin
|
||||
YAML.load_file('$CFG_FILE');
|
||||
rescue Exception => e
|
||||
YAML.LOG_ERROR('Unable To Parse Config File,【' + e.message + '】');
|
||||
system 'rm -rf ${CFG_FILE} 2>/dev/null'
|
||||
end
|
||||
" 2>/dev/null >> $LOG_FILE
|
||||
yaml_sub_validate
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "Ruby Works Abnormally, Please Check The Ruby Library Depends!"
|
||||
only_download=1
|
||||
@@ -248,7 +257,7 @@ config_download_direct()
|
||||
LOG_OUT "Config File Format Validation Failed..."
|
||||
change_dns
|
||||
config_error
|
||||
elif ! "$(ruby_read "$CFG_FILE" ".key?('proxies')")" && ! "$(ruby_read "$CFG_FILE" ".key?('proxy-providers')")" ; then
|
||||
elif [ "$YAML_SUB_STATUS" = "NO_CONTENT" ]; then
|
||||
LOG_ERROR "Updated Config【$name】Has No Proxy Field, Update Exit..."
|
||||
change_dns
|
||||
config_error
|
||||
@@ -434,7 +443,6 @@ sub_info_get()
|
||||
config_download
|
||||
if [ "$DOWNLOAD_RESULT" -eq 0 ] && [ -s "$CFG_FILE" ]; then
|
||||
#prevent ruby unexpected error
|
||||
sed -i -E 's/protocol-param: ([^,'"'"'"''}( *#)\n\r]+)/protocol-param: "\1"/g' "$CFG_FILE" 2>/dev/null
|
||||
config_test
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "Config File Tested Failed, Please Check The Log Infos!"
|
||||
@@ -442,14 +450,7 @@ sub_info_get()
|
||||
config_download_direct
|
||||
return
|
||||
fi
|
||||
ruby -ryaml -rYAML -I "/usr/share/openclash" -E UTF-8 -e "
|
||||
begin
|
||||
YAML.load_file('$CFG_FILE');
|
||||
rescue Exception => e
|
||||
YAML.LOG_ERROR('Unable To Parse Config File,【' + e.message + '】');
|
||||
system 'rm -rf ${CFG_FILE} 2>/dev/null'
|
||||
end
|
||||
" 2>/dev/null >> $LOG_FILE
|
||||
yaml_sub_validate
|
||||
if [ $? -ne 0 ]; then
|
||||
LOG_ERROR "Ruby Works Abnormally, Please Check The Ruby Library Depends!"
|
||||
only_download=1
|
||||
@@ -457,7 +458,7 @@ sub_info_get()
|
||||
elif [ ! -f "$CFG_FILE" ]; then
|
||||
LOG_OUT "Config File Format Validation Failed, Trying To Download Without Agent..."
|
||||
config_download_direct
|
||||
elif ! "$(ruby_read "$CFG_FILE" ".key?('proxies')")" && ! "$(ruby_read "$CFG_FILE" ".key?('proxy-providers')")" ; then
|
||||
elif [ "$YAML_SUB_STATUS" = "NO_CONTENT" ]; then
|
||||
LOG_ERROR "Updated Config【$name】Has No Proxy Field, Trying To Download Without Agent..."
|
||||
config_download_direct
|
||||
else
|
||||
@@ -474,6 +475,5 @@ sub_info_get()
|
||||
#分别获取订阅信息进行处理
|
||||
config_load "openclash"
|
||||
config_foreach sub_info_get "config_subscribe" "$1"
|
||||
SLOG_CLEAN
|
||||
dec_job_counter_and_restart "$restart"
|
||||
del_lock
|
||||
@@ -115,6 +115,5 @@ fi
|
||||
|
||||
rm -rf /tmp/china_ip*_route* >/dev/null 2>&1
|
||||
|
||||
SLOG_CLEAN
|
||||
dec_job_counter_and_restart "$restart"
|
||||
del_lock
|
||||
@@ -19,40 +19,54 @@ set_lock
|
||||
inc_job_counter
|
||||
|
||||
restart=0
|
||||
UPDATE_SUCCESS=0
|
||||
github_address_mod=$(uci_get_config "github_address_mod" || echo 0)
|
||||
if [ "$github_address_mod" = "0" ] && [ -z "$(echo $2 2>/dev/null |grep -E 'http|one_key_update')" ] && [ -z "$(echo $3 2>/dev/null |grep 'http')" ]; then
|
||||
LOG_TIP "If the download fails, try setting the CDN in Overwrite Settings - General Settings - Github Address Modify Options"
|
||||
DIRECT_CORE_URL=""
|
||||
if [ -n "$2" ] && echo "$2" | grep -qE '^https?://'; then
|
||||
DIRECT_CORE_URL="$2"
|
||||
fi
|
||||
if [ -n "$3" ] && [ "$2" = "one_key_update" ]; then
|
||||
github_address_mod="$3"
|
||||
if [ "$github_address_mod" = "0" ] && [ -z "$DIRECT_CORE_URL" ] && [ -z "$(echo $2 2>/dev/null |grep -E 'http|one_key_update')" ] && [ -z "$(echo $3 2>/dev/null |grep 'http')" ]; then
|
||||
LOG_TIP "If the download fails, try setting the CDN in Overwrite Settings - General Settings - GitHub Address Proxy Options"
|
||||
fi
|
||||
if [ -n "$2" ] && [ "$2" = "one_key_update" ] && [ -z "$3" ]; then
|
||||
github_address_mod=0
|
||||
fi
|
||||
if [ -n "$2" ] && [ "$2" != "one_key_update" ]; then
|
||||
github_address_mod="$2"
|
||||
if [ -z "$DIRECT_CORE_URL" ]; then
|
||||
if [ -n "$3" ] && [ "$2" = "one_key_update" ]; then
|
||||
github_address_mod="$3"
|
||||
fi
|
||||
if [ -n "$2" ] && [ "$2" = "one_key_update" ] && [ -z "$3" ]; then
|
||||
github_address_mod=0
|
||||
fi
|
||||
if [ -n "$2" ] && [ "$2" != "one_key_update" ]; then
|
||||
github_address_mod="$2"
|
||||
fi
|
||||
if echo "$github_address_mod" | grep -q "raw\.githubusercontent\.com"; then
|
||||
github_address_mod=0
|
||||
fi
|
||||
fi
|
||||
CORE_TYPE="$1"
|
||||
C_CORE_TYPE=$(uci_get_config "core_type")
|
||||
SMART_ENABLE=$(uci_get_config "smart_enable" || echo 0)
|
||||
OIX_TOKEN=$(uci_get_config "oix_token")
|
||||
[ "$SMART_ENABLE" -eq 1 ] && CORE_TYPE="Smart"
|
||||
[ "$CORE_TYPE" = "Oix" ] || [ -n "$OIX_TOKEN" ] && CORE_TYPE="Oix"
|
||||
[ -n "$OIX_TOKEN" ] && CORE_TYPE="Oix"
|
||||
[ -z "$CORE_TYPE" ] && CORE_TYPE="Meta"
|
||||
small_flash_memory=$(uci_get_config "small_flash_memory")
|
||||
CPU_MODEL=$(uci_get_config "core_version")
|
||||
RELEASE_BRANCH=$(uci_get_config "release_branch" || echo "master")
|
||||
|
||||
if [ "$github_address_mod" != "0" ]; then
|
||||
/usr/share/openclash/clash_version.sh "$github_address_mod" 2>/dev/null
|
||||
else
|
||||
/usr/share/openclash/clash_version.sh 2>/dev/null
|
||||
fi
|
||||
if [ ! -f "/tmp/clash_last_version" ]; then
|
||||
LOG_ERROR "【"$CORE_TYPE"】Core Version Check Error, Please Try Again Later..."
|
||||
SLOG_CLEAN
|
||||
del_lock
|
||||
exit 0
|
||||
if [ -z "$DIRECT_CORE_URL" ]; then
|
||||
lua /usr/share/openclash/openclash_version.lua "$github_address_mod" 2>/dev/null
|
||||
if [ "$CORE_TYPE" = "Oix" ]; then
|
||||
CORE_LV=$(jsonfilter -i /tmp/openclash_version_history.json -e "@.oix.ver" 2>/dev/null)
|
||||
elif [ "$CORE_TYPE" = "Smart" ]; then
|
||||
CORE_LV=$(jsonfilter -i /tmp/openclash_version_history.json -e "@.${RELEASE_BRANCH}.latest.core_smart" 2>/dev/null)
|
||||
else
|
||||
CORE_LV=$(jsonfilter -i /tmp/openclash_version_history.json -e "@.${RELEASE_BRANCH}.latest.core_meta" 2>/dev/null)
|
||||
fi
|
||||
if [ -z "$CORE_LV" ]; then
|
||||
LOG_ERROR "【"$CORE_TYPE"】Core Version Check Error, Please Try Again Later..."
|
||||
del_lock
|
||||
exit 0
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$small_flash_memory" != "1" ]; then
|
||||
@@ -70,23 +84,23 @@ TMP_FILE="${TARGET_CORE_PATH}.new.$$"
|
||||
if [ "$CORE_TYPE" = "Oix" ]; then
|
||||
CORE_URL_PATH=""
|
||||
DOWNLOAD_FILE="/tmp/clash_meta.gz"
|
||||
CORE_LV=$(sed -n 1p /tmp/clash_last_version 2>/dev/null)
|
||||
elif [ "$CORE_TYPE" = "Smart" ]; then
|
||||
CORE_URL_PATH="$RELEASE_BRANCH/smart"
|
||||
DOWNLOAD_FILE="/tmp/clash_meta.tar.gz"
|
||||
CORE_LV=$(sed -n 2p /tmp/clash_last_version 2>/dev/null)
|
||||
else
|
||||
CORE_URL_PATH="$RELEASE_BRANCH/meta"
|
||||
DOWNLOAD_FILE="/tmp/clash_meta.tar.gz"
|
||||
CORE_LV=$(sed -n 1p /tmp/clash_last_version 2>/dev/null)
|
||||
fi
|
||||
|
||||
[ "$C_CORE_TYPE" != "$CORE_TYPE" ] || [ -z "$C_CORE_TYPE" ] && restart=1
|
||||
|
||||
if [ "$CORE_CV" != "$CORE_LV" ] || [ -z "$CORE_CV" ]; then
|
||||
if [ -n "$DIRECT_CORE_URL" ] || [ "$CORE_CV" != "$CORE_LV" ] || [ -z "$CORE_CV" ]; then
|
||||
if [ "$CPU_MODEL" != 0 ]; then
|
||||
LOG_TIP "【$CORE_TYPE】Core Downloading, Please Try to Download and Upload Manually If Fails"
|
||||
if [ "$CORE_TYPE" = "Oix" ]; then
|
||||
LOG_TIP "【"$CORE_TYPE"】Core Downloading, Please Try to Download and Upload Manually If Fails"
|
||||
# If $2 is a full download URL, use it directly
|
||||
if [ -n "$2" ] && echo "$2" | grep -qE '^https?://'; then
|
||||
DOWNLOAD_URL="$2"
|
||||
elif [ "$CORE_TYPE" = "Oix" ]; then
|
||||
OIX_CORE_URL="https://github.com/vernesong/mihomo-oix/releases/download/Pre-Alpha/mihomo-${CPU_MODEL}-${CORE_LV}.gz"
|
||||
OIX_CORE_P_URL="https://dl.dler.io/mihomo-oix/mihomo-${CPU_MODEL}-${CORE_LV}.gz?tag=Pre-Alpha"
|
||||
if [ "$github_address_mod" != "0" ] && [ "$github_address_mod" != "https://cdn.jsdelivr.net/" ] && [ "$github_address_mod" != "https://fastly.jsdelivr.net/" ] && [ "$github_address_mod" != "https://testingcf.jsdelivr.net/" ]; then
|
||||
@@ -118,91 +132,85 @@ if [ "$CORE_CV" != "$CORE_LV" ] || [ -z "$CORE_CV" ]; then
|
||||
DOWNLOAD_RESULT=$?
|
||||
|
||||
if [ "$DOWNLOAD_RESULT" -eq 0 ]; then
|
||||
gzip -t "$DOWNLOAD_FILE" >/dev/null 2>&1
|
||||
gzip_test_err=$(gzip -t "$DOWNLOAD_FILE" 2>&1)
|
||||
|
||||
if [ "$?" -eq 0 ]; then
|
||||
LOG_TIP "【"$CORE_TYPE"】Core Download Successful, Start Update..."
|
||||
extract_success=true
|
||||
extract_err=""
|
||||
[ -s "$DOWNLOAD_FILE" ] && {
|
||||
if [ "$CORE_TYPE" = "Oix" ]; then
|
||||
gzip -dc "$DOWNLOAD_FILE" > "$TMP_FILE" 2>/dev/null || extract_success=false
|
||||
extract_err=$(gzip -dc "$DOWNLOAD_FILE" > "$TMP_FILE" 2>&1) || extract_success=false
|
||||
else
|
||||
tar zxvfo "$DOWNLOAD_FILE" -C /tmp >/dev/null 2>&1 || extract_success=false
|
||||
mv /tmp/clash "$TMP_FILE" >/dev/null 2>&1 || extract_success=false
|
||||
extract_err=$(tar zxvfo "$DOWNLOAD_FILE" -C /tmp 2>&1) || extract_success=false
|
||||
[ "$extract_success" = "true" ] && { extract_err=$(mv /tmp/clash "$TMP_FILE" 2>&1) || extract_success=false; }
|
||||
fi
|
||||
rm -rf "$DOWNLOAD_FILE" >/dev/null 2>&1
|
||||
chmod 4755 "$TMP_FILE" >/dev/null 2>&1 || extract_success=false
|
||||
"$TMP_FILE" -v >/dev/null 2>&1 || extract_success=false
|
||||
[ "$extract_success" = "true" ] && { extract_err=$(chmod 4755 "$TMP_FILE" 2>&1) || extract_success=false; }
|
||||
[ "$extract_success" = "true" ] && { extract_err=$("$TMP_FILE" -v 2>&1) || extract_success=false; }
|
||||
}
|
||||
|
||||
if [ "$extract_success" != "true" ]; then
|
||||
if [ "$retry_count" -lt "$max_retries" ]; then
|
||||
LOG_ERROR "【$retry_count/$max_retries】【"$CORE_TYPE"】Core Update Failed..."
|
||||
LOG_ERROR "【$retry_count/$max_retries】【"$CORE_TYPE"】Core Update Failed:【$(echo "$extract_err" | tr '\n' ' ' | head -c 300)】..."
|
||||
rm -rf "$TMP_FILE" >/dev/null 2>&1
|
||||
sleep 2
|
||||
continue
|
||||
else
|
||||
LOG_ERROR "【"$CORE_TYPE"】Core Update Failed, Please Make Sure Enough Flash Memory Space or Selected Correct Core Platform And Try Again!"
|
||||
LOG_ERROR "【"$CORE_TYPE"】Core Update Failed:【$(echo "$extract_err" | tr '\n' ' ' | head -c 300)】..."
|
||||
rm -rf "$TMP_FILE" >/dev/null 2>&1
|
||||
SLOG_CLEAN
|
||||
del_lock
|
||||
exit 0
|
||||
break
|
||||
fi
|
||||
fi
|
||||
|
||||
mv -f "$TMP_FILE" "$TARGET_CORE_PATH" >/dev/null 2>&1
|
||||
mv_err=$(mv -f "$TMP_FILE" "$TARGET_CORE_PATH" 2>&1)
|
||||
|
||||
if [ "$?" == "0" ]; then
|
||||
LOG_TIP "【"$CORE_TYPE"】Core Update Successful!"
|
||||
SLOG_CLEAN
|
||||
LOG_TIP "【"$CORE_TYPE"】Core Update Successful"
|
||||
UPDATE_SUCCESS=1
|
||||
restart=1
|
||||
break
|
||||
else
|
||||
if [ "$retry_count" -lt "$max_retries" ]; then
|
||||
LOG_ERROR "【$retry_count/$max_retries】【"$CORE_TYPE"】Core Update Failed..."
|
||||
LOG_ERROR "【$retry_count/$max_retries】【"$CORE_TYPE"】Core Move Failed:【$(echo "$mv_err" | tr '\n' ' ' | head -c 300)】"
|
||||
sleep 2
|
||||
continue
|
||||
else
|
||||
LOG_ERROR "【"$CORE_TYPE"】Core Update Failed, Please Make Sure Enough Flash Memory Space And Try Again!"
|
||||
SLOG_CLEAN
|
||||
LOG_ERROR "【"$CORE_TYPE"】Core Move Failed:【$(echo "$mv_err" | tr '\n' ' ' | head -c 300)】"
|
||||
break
|
||||
fi
|
||||
fi
|
||||
else
|
||||
if [ "$retry_count" -lt "$max_retries" ]; then
|
||||
LOG_ERROR "【$retry_count/$max_retries】【"$CORE_TYPE"】Core Update Failed..."
|
||||
LOG_ERROR "【$retry_count/$max_retries】【"$CORE_TYPE"】Core Verification Failed:【$(echo "$gzip_test_err" | tr '\n' ' ' | head -c 300)】"
|
||||
sleep 2
|
||||
continue
|
||||
else
|
||||
LOG_ERROR "【"$CORE_TYPE"】Core Update Failed, Please Check The Network or Try Again Later!"
|
||||
SLOG_CLEAN
|
||||
LOG_ERROR "【"$CORE_TYPE"】Core Verification Failed:【$(echo "$gzip_test_err" | tr '\n' ' ' | head -c 300)】"
|
||||
break
|
||||
fi
|
||||
fi
|
||||
elif [ "$DOWNLOAD_RESULT" -eq 2 ]; then
|
||||
LOG_TIP "【"$CORE_TYPE"】Core Has Not Been Updated, Stop Continuing Operation!"
|
||||
SLOG_CLEAN
|
||||
LOG_TIP "【"$CORE_TYPE"】Core Has Not Been Updated, Stop Continuing Operation"
|
||||
else
|
||||
if [ "$retry_count" -lt "$max_retries" ]; then
|
||||
LOG_ERROR "【$retry_count/$max_retries】【"$CORE_TYPE"】Core Download Failed..."
|
||||
LOG_ERROR "【$retry_count/$max_retries】【"$CORE_TYPE"】Core Download Failed, Please Check The Network or Try Again Later..."
|
||||
sleep 2
|
||||
continue
|
||||
else
|
||||
LOG_ERROR "【"$CORE_TYPE"】Core Download Failed, Please Check The Network or Try Again Later!"
|
||||
SLOG_CLEAN
|
||||
LOG_ERROR "【"$CORE_TYPE"】Core Download Failed, Please Check The Network or Try Again Later"
|
||||
break
|
||||
fi
|
||||
fi
|
||||
done
|
||||
else
|
||||
LOG_WARN "No Compiled Version Selected, Please Select In Update Page And Try Again!"
|
||||
SLOG_CLEAN
|
||||
fi
|
||||
else
|
||||
LOG_TIP "【"$CORE_TYPE"】Core Has Not Been Updated, Stop Continuing Operation!"
|
||||
SLOG_CLEAN
|
||||
LOG_TIP "【"$CORE_TYPE"】Core Has Not Been Updated, Stop Continuing Operation"
|
||||
fi
|
||||
|
||||
rm -rf "$TMP_FILE" >/dev/null 2>&1
|
||||
[ "$UPDATE_SUCCESS" = "1" ] && restart=1 || restart=0
|
||||
dec_job_counter_and_restart "$restart"
|
||||
del_lock
|
||||
@@ -54,7 +54,7 @@ EOF
|
||||
if [ "$SHOW_DOWNLOAD_PROGRESS" = "1" ] || [ "$SHOW_DOWNLOAD_PROGRESS" = "true" ]; then
|
||||
TEMP_LOG="/tmp/curl_log_$$"
|
||||
|
||||
LOG_OUT "Downloading:【$(basename "$DOWNLOAD_PATH") - 0%】"
|
||||
LOG_OUT "Downloading:【$(basename "$DOWNLOAD_PATH") - 0%】..."
|
||||
|
||||
(
|
||||
if [ -n "$SECRET_KEY" ] && [ -n "$ETAG_HEADER" ]; then
|
||||
@@ -101,7 +101,7 @@ EOF
|
||||
|
||||
if [ -n "$PROGRESS" ] && [ "$PROGRESS" -ne "$LAST_PROGRESS" ]; then
|
||||
if [ "$PROGRESS" -gt "$LAST_PROGRESS" ]; then
|
||||
LOG_OUT "Downloading:【$(basename "$DOWNLOAD_PATH") - ${PROGRESS}%】"
|
||||
LOG_OUT "Downloading:【$(basename "$DOWNLOAD_PATH") - ${PROGRESS}%】..."
|
||||
LAST_PROGRESS="$PROGRESS"
|
||||
fi
|
||||
fi
|
||||
@@ -114,7 +114,7 @@ EOF
|
||||
HTTP_CODE=$(grep -i "^HTTP" "$HEADER_TMP" 2>/dev/null | tail -1 | cut -d' ' -f2)
|
||||
|
||||
if [ "$EXIR_CODE" -eq 0 ] && [ "$LAST_PROGRESS" -ne 100 ]; then
|
||||
LOG_OUT "Downloading:【$(basename "$DOWNLOAD_PATH") - 100%】"
|
||||
LOG_OUT "Downloading:【$(basename "$DOWNLOAD_PATH") - 100%】..."
|
||||
fi
|
||||
|
||||
if [ "$EXIR_CODE" -ne 0 ]; then
|
||||
@@ -132,7 +132,6 @@ EOF
|
||||
OUTPUT=$(DOWNLOAD_FAILURE_OUTPUT "$EXIR_CODE" "$HTTP_CODE" "${OUTPUT:-}")
|
||||
LOG_OUT "【${DOWNLOAD_PATH}】Download Failed:【${OUTPUT}】"
|
||||
rm -f "$HEADER_TMP" "$DOWNLOAD_TMP"
|
||||
SLOG_CLEAN
|
||||
return 1
|
||||
fi
|
||||
else
|
||||
@@ -188,7 +187,6 @@ EOF
|
||||
OUTPUT=$(DOWNLOAD_FAILURE_OUTPUT "$EXIR_CODE" "$HTTP_CODE" "$OUTPUT")
|
||||
LOG_OUT "【${DOWNLOAD_PATH}】Download Failed:【${OUTPUT}】"
|
||||
rm -f "$HEADER_TMP" "$DOWNLOAD_TMP"
|
||||
SLOG_CLEAN
|
||||
return 1
|
||||
fi
|
||||
fi
|
||||
@@ -196,7 +194,6 @@ EOF
|
||||
if ! mv -f "$DOWNLOAD_TMP" "$DOWNLOAD_PATH"; then
|
||||
LOG_OUT "【${DOWNLOAD_PATH}】Download Failed:【Unable to save download file】"
|
||||
rm -f "$HEADER_TMP" "$DOWNLOAD_TMP"
|
||||
SLOG_CLEAN
|
||||
return 1
|
||||
fi
|
||||
NEW_ETAG=$(grep -i "^etag:" "$HEADER_TMP" 2>/dev/null | tail -1 | cut -d' ' -f2- | tr -d '\r\n' | sed 's/^"//;s/"$//')
|
||||
|
||||
@@ -794,7 +794,9 @@ EOF
|
||||
|
||||
sed -i -E 's/(([0-9]{1,3}\.){2})[0-9]{1,3}\.[0-9]{1,3}/\1*\.*/g' "$DEBUG_LOG" 2>/dev/null
|
||||
|
||||
sed -i -E 's/(:[0-9a-fA-F]{1,4}){3}/:*:*:*/' "$DEBUG_LOG" 2>/dev/null
|
||||
sed -i -E 's/::[0-9a-fA-F]{1,4}:(([0-9]{1,3}\.){3}[0-9]{1,3})/::*:\1/g' "$DEBUG_LOG" 2>/dev/null
|
||||
sed -i -E 's/([0-9a-fA-F]{1,4}):[0-9a-fA-F]{1,4}:[0-9a-fA-F]{1,4}:[0-9a-fA-F]{1,4}:[0-9a-fA-F]{1,4}(:[0-9a-fA-F]{1,4}){3}/\1:*:*:*:*\2/g' "$DEBUG_LOG" 2>/dev/null
|
||||
sed -i -E 's/([0-9a-fA-F]{1,4})(:[0-9a-fA-F]{1,4}){0,5}::([0-9a-fA-F]{1,4}(:[0-9a-fA-F]{1,4})*)?/\1:*::*/g' "$DEBUG_LOG" 2>/dev/null
|
||||
|
||||
sed -i 's/Downloading URL【[^】]*】/Downloading URL【*】/g' "$DEBUG_LOG" 2>/dev/null
|
||||
|
||||
|
||||
@@ -9,16 +9,6 @@ local json = require "luci.jsonc"
|
||||
local datatype = require "luci.cbi.datatypes"
|
||||
local addr = arg[1]
|
||||
|
||||
local function s(e)
|
||||
local t=0
|
||||
local a={' KB',' MB',' GB',' TB',' PB'}
|
||||
repeat
|
||||
e=e/1024
|
||||
t=t+1
|
||||
until(e<=1024)
|
||||
return string.format("%.1f",e)..a[t]
|
||||
end
|
||||
|
||||
local function debug_getcon()
|
||||
local info, ip, host, diag_info
|
||||
ip = fs.lanip()
|
||||
@@ -30,6 +20,7 @@ local function debug_getcon()
|
||||
info = json.parse(info)
|
||||
end
|
||||
if info then
|
||||
local conn_lines = {}
|
||||
for i = 1, #(info.connections) do
|
||||
if info.connections[i].metadata.host == "" then
|
||||
host = "Empty"
|
||||
@@ -37,13 +28,20 @@ local function debug_getcon()
|
||||
host = info.connections[i].metadata.host
|
||||
end
|
||||
if not addr then
|
||||
luci.sys.exec(string.format('echo "%s. SourceIP:【%s】 - Host:【%s】 - DestinationIP:【%s】 - Network:【%s】 - RulePayload:【%s】 - Lastchain:【%s】" >> /tmp/openclash_debug.log', i, (info.connections[i].metadata.sourceIP), host, (info.connections[i].metadata.destinationIP), (info.connections[i].metadata.network), (info.connections[i].rulePayload),(info.connections[i].chains[1])))
|
||||
conn_lines[#conn_lines + 1] = string.format("%d. SourceIP:【%s】 - Host:【%s】 - DestinationIP:【%s】 - Network:【%s】 - RulePayload:【%s】 - Lastchain:【%s】\n",
|
||||
i,
|
||||
tostring(info.connections[i].metadata.sourceIP),
|
||||
tostring(host),
|
||||
tostring(info.connections[i].metadata.destinationIP),
|
||||
tostring(info.connections[i].metadata.network),
|
||||
tostring(info.connections[i].rulePayload),
|
||||
tostring(info.connections[i].chains and info.connections[i].chains[1]))
|
||||
else
|
||||
if datatype.hostname(addr) and string.lower(addr) == host or datatype.ipaddr(addr) and addr == (info.connections[i].metadata.destinationIP) then
|
||||
print("id: "..(info.connections[i].id))
|
||||
print("start: "..(info.connections[i].start))
|
||||
print("download: "..s(info.connections[i].download))
|
||||
print("upload: "..s(info.connections[i].upload))
|
||||
print("download: "..fs.filesize(info.connections[i].download))
|
||||
print("upload: "..fs.filesize(info.connections[i].upload))
|
||||
print("rule: "..(info.connections[i].rule))
|
||||
print("rulePayload: "..(info.connections[i].rulePayload))
|
||||
print("chains: ")
|
||||
@@ -62,6 +60,10 @@ local function debug_getcon()
|
||||
end
|
||||
end
|
||||
end
|
||||
if not addr and #conn_lines > 0 then
|
||||
local existing = fs.readfile("/tmp/openclash_debug.log") or ""
|
||||
fs.writefile("/tmp/openclash_debug.log", existing .. table.concat(conn_lines))
|
||||
end
|
||||
end
|
||||
end
|
||||
os.exit(0)
|
||||
|
||||
@@ -57,7 +57,7 @@ EOF
|
||||
}
|
||||
|
||||
log_unzip_error() {
|
||||
LOG_OUT "Control Panel【$DASH_NAME - $DASH_TYPE】Unzip Error!" && SLOG_CLEAN
|
||||
LOG_OUT "Control Panel【$DASH_NAME - $DASH_TYPE】Unzip Error!"
|
||||
cleanup_dashboard_tmp
|
||||
del_lock
|
||||
exit 2
|
||||
@@ -121,7 +121,7 @@ EOF
|
||||
fi
|
||||
if mv "$NEW_FILE_DIR" "$TARGET_FILE_DIR" >/dev/null 2>&1 && validate_dashboard_dir "$TARGET_FILE_DIR"; then
|
||||
cleanup_dashboard_tmp
|
||||
LOG_OUT "Control Panel【$DASH_NAME - $DASH_TYPE】Download Successful!" && SLOG_CLEAN
|
||||
LOG_OUT "Control Panel【$DASH_NAME - $DASH_TYPE】Download Successful!"
|
||||
del_lock
|
||||
exit 0
|
||||
else
|
||||
@@ -137,7 +137,7 @@ EOF
|
||||
elif [ "$DOWNLOAD_RESULT" -eq 2 ]; then
|
||||
if validate_dashboard_dir "$UNPACK_FILE_DIR"; then
|
||||
cleanup_dashboard_tmp
|
||||
LOG_OUT "Control Panel【$DASH_NAME - $DASH_TYPE】Download Successful!" && SLOG_CLEAN
|
||||
LOG_OUT "Control Panel【$DASH_NAME - $DASH_TYPE】Download Successful!"
|
||||
del_lock
|
||||
exit 0
|
||||
else
|
||||
@@ -145,7 +145,7 @@ EOF
|
||||
fi
|
||||
else
|
||||
cleanup_dashboard_tmp
|
||||
LOG_OUT "Control Panel【$DASH_NAME - $DASH_TYPE】Download Error!" && SLOG_CLEAN
|
||||
LOG_OUT "Control Panel【$DASH_NAME - $DASH_TYPE】Download Error!"
|
||||
del_lock
|
||||
exit 1
|
||||
fi
|
||||
|
||||
@@ -174,6 +174,5 @@ case "$1" in
|
||||
;;
|
||||
esac
|
||||
|
||||
SLOG_CLEAN
|
||||
dec_job_counter_and_restart "$restart"
|
||||
del_lock
|
||||
@@ -56,6 +56,5 @@ fi
|
||||
|
||||
rm -rf /tmp/Model.bin >/dev/null 2>&1
|
||||
|
||||
SLOG_CLEAN
|
||||
dec_job_counter_and_restart "$restart"
|
||||
del_lock
|
||||
@@ -14,23 +14,29 @@ del_lock() {
|
||||
rm -rf "/tmp/lock/openclash_update.lock" 2>/dev/null
|
||||
}
|
||||
|
||||
early_exit() {
|
||||
dec_job_counter_and_restart "0"
|
||||
del_lock
|
||||
exit "${1:-0}"
|
||||
}
|
||||
|
||||
set_lock
|
||||
inc_job_counter
|
||||
|
||||
if [ -n "$1" ] && [ "$1" != "one_key_update" ]; then
|
||||
/usr/share/openclash/openclash_version.sh "$1" 2>/dev/null
|
||||
elif [ -n "$2" ]; then
|
||||
/usr/share/openclash/openclash_version.sh "$2" 2>/dev/null
|
||||
else
|
||||
/usr/share/openclash/openclash_version.sh 2>/dev/null
|
||||
RELEASE_BRANCH=$(uci_get_config "release_branch" || echo "master")
|
||||
|
||||
PLUGIN_DIRECT=0
|
||||
if [ -n "$3" ] && echo "$3" | grep -qE '^https?://'; then
|
||||
PLUGIN_DIRECT=1
|
||||
fi
|
||||
|
||||
if [ ! -f "/tmp/openclash_last_version" ]; then
|
||||
lua /usr/share/openclash/openclash_version.lua "$2" 2>/dev/null
|
||||
|
||||
PLUGIN_LATEST=$(jsonfilter -i /tmp/openclash_version_history.json -e "@.${RELEASE_BRANCH}.latest.plugin" 2>/dev/null)
|
||||
|
||||
if [ "$PLUGIN_DIRECT" -eq 0 ] && [ -z "$PLUGIN_LATEST" ]; then
|
||||
LOG_ERROR "Failed to get version information, please try again later..."
|
||||
SLOG_CLEAN
|
||||
dec_job_counter_and_restart "0"
|
||||
del_lock
|
||||
exit 0
|
||||
early_exit
|
||||
fi
|
||||
|
||||
version_compare() {
|
||||
@@ -59,7 +65,7 @@ run_with_timeout() {
|
||||
(
|
||||
sleep "$timeout_sec"
|
||||
kill $_pid 2>/dev/null
|
||||
sleep 0.5
|
||||
sleep 1
|
||||
kill -9 $_pid 2>/dev/null
|
||||
) &
|
||||
local _watchdog=$!
|
||||
@@ -70,36 +76,65 @@ run_with_timeout() {
|
||||
return $_ret
|
||||
}
|
||||
|
||||
LAST_OPVER="/tmp/openclash_last_version"
|
||||
LAST_VER=$(sed -n 1p "$LAST_OPVER" 2>/dev/null |sed "s/^v//g" |tr -d "\n")
|
||||
LAST_VER=$(echo "$PLUGIN_LATEST" |sed "s/^v//g" |tr -d "\n")
|
||||
if [ -x "/bin/opkg" ]; then
|
||||
OP_CV=$(rm -f /var/lock/opkg.lock && opkg status luci-app-openclash 2>/dev/null |grep 'Version' |awk -F 'Version: ' '{print $2}' 2>/dev/null)
|
||||
elif [ -x "/usr/bin/apk" ]; then
|
||||
OP_CV=$(rm -f /lib/apk/db/lock && apk list luci-app-openclash 2>/dev/null|grep "installed" | grep -oE '[0-9]+(\.[0-9]+)*' | head -1 2>/dev/null)
|
||||
fi
|
||||
OP_LV=$(sed -n 1p "$LAST_OPVER" 2>/dev/null |sed "s/^v//g" |tr -d "\n")
|
||||
RELEASE_BRANCH=$(uci_get_config "release_branch" || echo "master")
|
||||
OP_LV="$LAST_VER"
|
||||
github_address_mod=$(uci_get_config "github_address_mod" || echo 0)
|
||||
|
||||
#一键更新
|
||||
if [ "$1" = "one_key_update" ]; then
|
||||
if [ "$github_address_mod" = "0" ] && [ -z "$2" ]; then
|
||||
LOG_TIP "If the download fails, try setting the CDN in Overwrite Settings - General Settings - Github Address Modify Options"
|
||||
fi
|
||||
if [ -n "$2" ]; then
|
||||
/usr/share/openclash/openclash_core.sh "Meta" "$1" "$2" >/dev/null 2>&1
|
||||
github_address_mod="$2"
|
||||
else
|
||||
/usr/share/openclash/openclash_core.sh "Meta" "$1" >/dev/null 2>&1
|
||||
github_address_mod=0
|
||||
fi
|
||||
if [ "$PLUGIN_DIRECT" -eq 0 ]; then
|
||||
if [ "$github_address_mod" = "0" ] && [ -z "$2" ]; then
|
||||
LOG_TIP "If the download fails, try setting the CDN in Overwrite Settings - General Settings - GitHub Address Proxy Options"
|
||||
fi
|
||||
if [ -n "$2" ]; then
|
||||
github_address_mod="$2"
|
||||
else
|
||||
github_address_mod=0
|
||||
fi
|
||||
if echo "$github_address_mod" | grep -q "raw\.githubusercontent\.com"; then
|
||||
github_address_mod=0
|
||||
fi
|
||||
fi
|
||||
elif [ "$1" = "plugin_update" ]; then
|
||||
if [ "$PLUGIN_DIRECT" -eq 0 ]; then
|
||||
if [ "$github_address_mod" = "0" ] && [ -z "$2" ]; then
|
||||
LOG_TIP "If the download fails, try setting the CDN in Overwrite Settings - General Settings - GitHub Address Proxy Options"
|
||||
fi
|
||||
if [ -n "$2" ]; then
|
||||
github_address_mod="$2"
|
||||
fi
|
||||
if echo "$github_address_mod" | grep -q "raw\.githubusercontent\.com"; then
|
||||
github_address_mod=0
|
||||
fi
|
||||
fi
|
||||
else
|
||||
if [ "$github_address_mod" = "0" ]; then
|
||||
LOG_TIP "If the download fails, try setting the CDN in Overwrite Settings - General Settings - Github Address Modify Options"
|
||||
LOG_TIP "If the download fails, try setting the CDN in Overwrite Settings - General Settings - GitHub Address Proxy Options"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -n "$OP_CV" ] && [ -n "$OP_LV" ] && version_compare "$OP_CV" "$OP_LV" && [ -f "$LAST_OPVER" ]; then
|
||||
if [ "$PLUGIN_DIRECT" -eq 1 ]; then
|
||||
# Direct download URL (historical version / downgrade) — skip version compare
|
||||
if [ -x "/bin/opkg" ]; then
|
||||
DOWNLOAD_URL="$3"
|
||||
DOWNLOAD_PATH="/tmp/openclash.ipk"
|
||||
elif [ -x "/usr/bin/apk" ]; then
|
||||
DOWNLOAD_URL="$3"
|
||||
DOWNLOAD_PATH="/tmp/openclash.apk"
|
||||
fi
|
||||
LAST_VER=$(echo "$DOWNLOAD_URL" | grep -oE 'luci-app-openclash[_-][0-9]+(\.[0-9]+)*' | head -1 | sed 's/^luci-app-openclash[_-]//')
|
||||
LOG_TIP "Start downloading【OpenClash - v$LAST_VER】..."
|
||||
elif [ -n "$OP_CV" ] && [ -n "$OP_LV" ] && version_compare "$OP_CV" "$OP_LV" && [ -n "$PLUGIN_LATEST" ]; then
|
||||
LOG_TIP "Start downloading【OpenClash - v$LAST_VER】..."
|
||||
if [ "$github_address_mod" != "0" ]; then
|
||||
if [ "$github_address_mod" == "https://cdn.jsdelivr.net/" ] || [ "$github_address_mod" == "https://fastly.jsdelivr.net/" ] || [ "$github_address_mod" == "https://testingcf.jsdelivr.net/" ]; then
|
||||
@@ -128,6 +163,16 @@ if [ -n "$OP_CV" ] && [ -n "$OP_LV" ] && version_compare "$OP_CV" "$OP_LV" && [
|
||||
DOWNLOAD_PATH="/tmp/openclash.apk"
|
||||
fi
|
||||
fi
|
||||
else
|
||||
if [ -z "$PLUGIN_LATEST" ] || [ -z "$OP_CV" ] || [ -z "$OP_LV" ]; then
|
||||
LOG_ERROR "Failed to get version information, please try again later..."
|
||||
else
|
||||
LOG_TIP "OpenClash has not been updated, stop continuing!"
|
||||
fi
|
||||
early_exit
|
||||
fi
|
||||
|
||||
if [ -n "$DOWNLOAD_URL" ]; then
|
||||
|
||||
retry_count=0
|
||||
max_retries=3
|
||||
@@ -154,22 +199,25 @@ if [ -n "$OP_CV" ] && [ -n "$OP_LV" ] && version_compare "$OP_CV" "$OP_LV" && [
|
||||
max_update_retry=2
|
||||
while [ $update_retry -lt $max_update_retry ]; do
|
||||
update_retry=$((update_retry + 1))
|
||||
run_with_timeout 30 opkg update >/dev/null 2>&1
|
||||
opkg_update_err=$(run_with_timeout 30 opkg update 2>&1)
|
||||
opkg_ret=$?
|
||||
rm -f /var/lock/opkg.lock
|
||||
if [ $opkg_ret -eq 0 ]; then
|
||||
break
|
||||
fi
|
||||
if [ $update_retry -lt $max_update_retry ]; then
|
||||
LOG_ERROR "【$update_retry/$max_update_retry】【OpenClash - v$LAST_VER】opkg update failed or timed out, retrying..."
|
||||
LOG_ERROR "【$update_retry/$max_update_retry】【OpenClash - v$LAST_VER】opkg update failed or timed out:【$(echo "$opkg_update_err" | tr '\n' ' ' | head -c 300)】, retrying..."
|
||||
sleep 2
|
||||
else
|
||||
LOG_ERROR "【$update_retry/$max_update_retry】【OpenClash - v$LAST_VER】opkg update failed, trying pre update test..."
|
||||
LOG_ERROR "【$update_retry/$max_update_retry】【OpenClash - v$LAST_VER】opkg update failed:【$(echo "$opkg_update_err" | tr '\n' ' ' | head -c 300)】, trying pre update test..."
|
||||
fi
|
||||
done
|
||||
if [ -s "/tmp/openclash.ipk" ]; then
|
||||
if [ -n "$(opkg install /tmp/openclash.ipk --noaction 2>/dev/null |grep 'Upgrading luci-app-openclash on root' 2>/dev/null)" ]; then
|
||||
opkg_test_err=$(opkg --force-downgrade install /tmp/openclash.ipk --noaction 2>&1)
|
||||
if [ -n "$(echo "$opkg_test_err" | grep -E '(Upgrading|Downgrading) luci-app-openclash on root')" ]; then
|
||||
pre_test_success=true
|
||||
else
|
||||
LOG_ERROR "【$retry_count/$max_retries】【OpenClash - v$LAST_VER】Pre update test failed:【$(echo "$opkg_test_err" | tr '\n' ' ' | head -c 500)】..."
|
||||
fi
|
||||
fi
|
||||
elif [ -x "/usr/bin/apk" ]; then
|
||||
@@ -177,23 +225,25 @@ if [ -n "$OP_CV" ] && [ -n "$OP_LV" ] && version_compare "$OP_CV" "$OP_LV" && [
|
||||
max_update_retry=2
|
||||
while [ $update_retry -lt $max_update_retry ]; do
|
||||
update_retry=$((update_retry + 1))
|
||||
run_with_timeout 30 apk update >/dev/null 2>&1
|
||||
apk_update_err=$(run_with_timeout 30 apk update 2>&1)
|
||||
apk_ret=$?
|
||||
rm -f /lib/apk/db/lock
|
||||
if [ $apk_ret -eq 0 ]; then
|
||||
break
|
||||
fi
|
||||
if [ $update_retry -lt $max_update_retry ]; then
|
||||
LOG_ERROR "【$update_retry/$max_update_retry】【OpenClash - v$LAST_VER】apk update failed or timed out, retrying..."
|
||||
LOG_ERROR "【$update_retry/$max_update_retry】【OpenClash - v$LAST_VER】apk update failed or timed out:【$(echo "$apk_update_err" | tr '\n' ' ' | head -c 300)】, retrying..."
|
||||
sleep 2
|
||||
else
|
||||
LOG_ERROR "【$update_retry/$max_update_retry】【OpenClash - v$LAST_VER】apk update failed, trying pre update test..."
|
||||
LOG_ERROR "【$update_retry/$max_update_retry】【OpenClash - v$LAST_VER】apk update failed:【$(echo "$apk_update_err" | tr '\n' ' ' | head -c 300)】, trying pre update test..."
|
||||
fi
|
||||
done
|
||||
if [ -s "/tmp/openclash.apk" ]; then
|
||||
apk add -s -q --force-overwrite --clean-protected --allow-untrusted /tmp/openclash.apk >/dev/null 2>&1
|
||||
apk_test_err=$(apk add -s -q --force-overwrite --clean-protected --allow-untrusted /tmp/openclash.apk 2>&1)
|
||||
if [ $? -eq 0 ]; then
|
||||
pre_test_success=true
|
||||
else
|
||||
LOG_ERROR "【$retry_count/$max_retries】【OpenClash - v$LAST_VER】Pre update test failed:【$(echo "$apk_test_err" | tr '\n' ' ' | head -c 500)】..."
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
@@ -208,14 +258,11 @@ if [ -n "$OP_CV" ] && [ -n "$OP_LV" ] && version_compare "$OP_CV" "$OP_LV" && [
|
||||
continue
|
||||
else
|
||||
if [ -x "/bin/opkg" ]; then
|
||||
LOG_ERROR "【OpenClash - v$LAST_VER】Pre update test failed after 3 attempts, the file is saved in /tmp/openclash.ipk, please try to update manually with【opkg install /tmp/openclash.ipk】"
|
||||
LOG_ERROR "【OpenClash - v$LAST_VER】Pre update test failed after 3 attempts, the file is saved in /tmp/openclash.ipk, please try to update manually with【opkg --force-downgrade install /tmp/openclash.ipk】"
|
||||
elif [ -x "/usr/bin/apk" ]; then
|
||||
LOG_ERROR "【OpenClash - v$LAST_VER】Pre update test failed after 3 attempts, the file is saved in /tmp/openclash.apk, please try to update manually with【apk add -q --force-overwrite --clean-protected --allow-untrusted /tmp/openclash.apk】"
|
||||
fi
|
||||
SLOG_CLEAN
|
||||
dec_job_counter_and_restart "0"
|
||||
del_lock
|
||||
exit 0
|
||||
early_exit
|
||||
fi
|
||||
fi
|
||||
else
|
||||
@@ -227,10 +274,7 @@ if [ -n "$OP_CV" ] && [ -n "$OP_LV" ] && version_compare "$OP_CV" "$OP_LV" && [
|
||||
LOG_ERROR "【OpenClash - v$LAST_VER】Download Failed after 3 attempts, please check the network or try again later!"
|
||||
rm -rf /tmp/openclash.ipk >/dev/null 2>&1
|
||||
rm -rf /tmp/openclash.apk >/dev/null 2>&1
|
||||
dec_job_counter_and_restart "0"
|
||||
SLOG_CLEAN
|
||||
del_lock
|
||||
exit 0
|
||||
early_exit
|
||||
fi
|
||||
fi
|
||||
done
|
||||
@@ -299,9 +343,9 @@ install_missing_packages() {
|
||||
while [ $retry_count -lt $max_retries ]; do
|
||||
retry_count=$((retry_count + 1))
|
||||
if [ -x "/bin/opkg" ]; then
|
||||
opkg install "$pkg"
|
||||
pkg_err=$(opkg install "$pkg" 2>&1)
|
||||
elif [ -x "/usr/bin/apk" ]; then
|
||||
apk add "$pkg"
|
||||
pkg_err=$(apk add "$pkg" 2>&1)
|
||||
fi
|
||||
if [ $? -eq 0 ]; then
|
||||
break
|
||||
@@ -309,7 +353,7 @@ install_missing_packages() {
|
||||
if [ $retry_count -lt $max_retries ]; then
|
||||
sleep 2
|
||||
else
|
||||
LOG_ERROR "【$pkg】failed to install, please try to install it manually..."
|
||||
LOG_ERROR "【$pkg】failed to install:【$(echo "$pkg_err" | tr '\n' ' ' | head -c 300)】, please try to install it manually..."
|
||||
fi
|
||||
fi
|
||||
done
|
||||
@@ -333,14 +377,16 @@ while [ $install_retry_count -lt $max_install_retries ]; do
|
||||
installed_before="$installed_before $pkg"
|
||||
fi
|
||||
done
|
||||
opkg install /tmp/openclash.ipk
|
||||
opkg --force-downgrade install /tmp/openclash.ipk >/dev/null 2>&1
|
||||
install_err=$(cat /tmp/openclash_install.log 2>/dev/null)
|
||||
elif [ -x "/usr/bin/apk" ]; then
|
||||
for pkg in $packages_to_check; do
|
||||
if apk list "$pkg" |grep "installed" >/dev/null 2>&1; then
|
||||
installed_before="$installed_before $pkg"
|
||||
fi
|
||||
done
|
||||
apk add -q --force-overwrite --clean-protected --allow-untrusted /tmp/openclash.apk
|
||||
apk add -q --force-overwrite --clean-protected --allow-untrusted /tmp/openclash.apk >/tmp/openclash_install.log 2>&1
|
||||
install_err=$(cat /tmp/openclash_install.log 2>/dev/null)
|
||||
fi
|
||||
|
||||
sleep 2
|
||||
@@ -350,7 +396,7 @@ while [ $install_retry_count -lt $max_install_retries ]; do
|
||||
install_missing_packages "$installed_before"
|
||||
break
|
||||
else
|
||||
LOG_ERROR "【$install_retry_count/$max_install_retries】Installation failed..."
|
||||
LOG_ERROR "【$install_retry_count/$max_install_retries】Installation failed:【$(echo "$install_err" | tr '\n' ' ' | head -c 500)】..."
|
||||
if [ $install_retry_count -lt $max_install_retries ]; then
|
||||
sleep 3
|
||||
fi
|
||||
@@ -365,13 +411,12 @@ if [ "$install_success" = true ]; then
|
||||
fi
|
||||
else
|
||||
if [ -x "/bin/opkg" ]; then
|
||||
LOG_ERROR "OpenClash update failed after 3 attempts, the file is saved in /tmp/openclash.ipk, please try to update manually with【opkg install /tmp/openclash.ipk】"
|
||||
LOG_ERROR "OpenClash update failed after 3 attempts, the file is saved in /tmp/openclash.ipk, please try to update manually with【opkg --force-downgrade install /tmp/openclash.ipk】【$(echo "$install_err" | tr '\n' ' ' | head -c 500)】"
|
||||
elif [ -x "/usr/bin/apk" ]; then
|
||||
LOG_ERROR "OpenClash update failed after 3 attempts, the file is saved in /tmp/openclash.apk, please try to update manually with【apk add -q --force-overwrite --clean-protected --allow-untrusted /tmp/openclash.apk】"
|
||||
LOG_ERROR "OpenClash update failed after 3 attempts, the file is saved in /tmp/openclash.apk, please try to update manually with【apk add -q --force-overwrite --clean-protected --allow-untrusted /tmp/openclash.apk】【$(echo "$install_err" | tr '\n' ' ' | head -c 500)】"
|
||||
fi
|
||||
fi
|
||||
dec_job_counter_and_restart "0"
|
||||
SLOG_CLEAN
|
||||
del_update_lock
|
||||
EOF
|
||||
chmod 4755 /tmp/openclash_update.sh
|
||||
@@ -379,10 +424,7 @@ EOF
|
||||
if [ ! -f "/tmp/openclash_update.sh" ] || [ ! -s "/tmp/openclash_update.sh" ] || [ ! -x "/tmp/openclash_update.sh" ]; then
|
||||
LOG_ERROR "Failed to create update script!"
|
||||
rm -rf /tmp/openclash_update.sh
|
||||
dec_job_counter_and_restart "0"
|
||||
SLOG_CLEAN
|
||||
del_lock
|
||||
exit 1
|
||||
early_exit 1
|
||||
fi
|
||||
|
||||
retry_count=0
|
||||
@@ -413,14 +455,6 @@ EOF
|
||||
fi
|
||||
|
||||
(sleep 15; rm -f /tmp/openclash_update.sh) &
|
||||
else
|
||||
if [ ! -f "$LAST_OPVER" ] || [ -z "$OP_CV" ] || [ -z "$OP_LV" ]; then
|
||||
LOG_ERROR "Failed to get version information, please try again later..."
|
||||
else
|
||||
LOG_TIP "OpenClash has not been updated, stop continuing!"
|
||||
fi
|
||||
dec_job_counter_and_restart "0"
|
||||
SLOG_CLEAN
|
||||
fi
|
||||
|
||||
del_lock
|
||||
@@ -0,0 +1,644 @@
|
||||
#!/usr/bin/lua
|
||||
|
||||
require "nixio"
|
||||
require "luci.model.uci"
|
||||
local fs = require "luci.openclash"
|
||||
local json = require "luci.jsonc"
|
||||
|
||||
local M = {}
|
||||
|
||||
local VERSION_CACHE_FILE = "/tmp/openclash_version_history.json"
|
||||
local CDN_CACHE_FILE = "/tmp/openclash_cdn_info.json"
|
||||
|
||||
local function trim(s)
|
||||
if not s then return "" end
|
||||
return (s:gsub("^%s+", ""):gsub("%s+$", ""))
|
||||
end
|
||||
|
||||
function M.is_valid_version(s)
|
||||
if not s or s == "" then return false end
|
||||
s = trim(s)
|
||||
if s == "" then return false end
|
||||
if s:match("^<") then return false end
|
||||
return true
|
||||
end
|
||||
|
||||
function M.is_oix_mode()
|
||||
local oix_token = fs.uci_get_config("config", "oix_token") or ""
|
||||
return oix_token ~= ""
|
||||
end
|
||||
|
||||
function try_read(fd, maxlen)
|
||||
local pfds = {
|
||||
{ fd = fd, events = nixio.poll_flags("in", "hup", "err") }
|
||||
}
|
||||
local nfds = nixio.poll(pfds, 0)
|
||||
if nfds and nfds > 0 then
|
||||
local buf = fd:read(maxlen or 4096)
|
||||
if buf and #buf > 0 then
|
||||
return buf
|
||||
end
|
||||
end
|
||||
return nil
|
||||
end
|
||||
|
||||
local function read_json(path)
|
||||
if not fs.access(path) then return nil end
|
||||
local raw = fs.readfile(path)
|
||||
if not raw or raw == "" then return nil end
|
||||
local ok, parsed = pcall(json.parse, raw)
|
||||
if ok and parsed and type(parsed) == "table" then
|
||||
return parsed
|
||||
end
|
||||
return nil
|
||||
end
|
||||
|
||||
local function write_json(path, data)
|
||||
local tmp = path .. ".tmp"
|
||||
fs.writefile(tmp, json.stringify(data))
|
||||
os.rename(tmp, path)
|
||||
end
|
||||
|
||||
local function read_version_cache()
|
||||
return read_json(VERSION_CACHE_FILE)
|
||||
end
|
||||
|
||||
local function update_version_cache(updater)
|
||||
local parsed = read_version_cache() or {}
|
||||
updater(parsed)
|
||||
write_json(VERSION_CACHE_FILE, parsed)
|
||||
end
|
||||
|
||||
local DEFAULT_CDN_LIST = {
|
||||
"https://ghfast.top/",
|
||||
"https://github.dpik.top/",
|
||||
"https://gh-proxy.com/",
|
||||
"https://git.yylx.win/"
|
||||
}
|
||||
|
||||
local function cdn_list()
|
||||
local list = fs.cdn_list()
|
||||
if #list > 0 then return list end
|
||||
return DEFAULT_CDN_LIST
|
||||
end
|
||||
|
||||
local function raw_url(path)
|
||||
return "https://raw.githubusercontent.com/vernesong/OpenClash/" .. path
|
||||
end
|
||||
|
||||
local function build_fetch_urls(mod, path)
|
||||
if mod == "0" or mod == "" then
|
||||
local urls = { raw_url(path) }
|
||||
for _, cdn in ipairs(cdn_list()) do
|
||||
urls[#urls + 1] = cdn .. raw_url(path)
|
||||
end
|
||||
return urls
|
||||
end
|
||||
if mod == "https://cdn.jsdelivr.net/" or mod == "https://fastly.jsdelivr.net/" or mod == "https://testingcf.jsdelivr.net/" then
|
||||
return { mod .. "gh/vernesong/OpenClash@" .. path }
|
||||
end
|
||||
return { mod .. raw_url(path) }
|
||||
end
|
||||
|
||||
local function fork_curl(url, timeout)
|
||||
local fdi, fdo = nixio.pipe()
|
||||
if not fdi or not fdo then return nil end
|
||||
local cmd = string.format('curl -sL -m %d "%s" 2>/dev/null', timeout or 5, url)
|
||||
local child = nixio.fork()
|
||||
if child > 0 then
|
||||
fdo:close()
|
||||
return { pid = child, fdi = fdi, buf = "", done = false }
|
||||
elseif child == 0 then
|
||||
nixio.dup(fdo, nixio.stdout)
|
||||
fdi:close()
|
||||
fdo:close()
|
||||
nixio.exec("/bin/sh", "-c", cmd)
|
||||
else
|
||||
if fdi then fdi:close() end
|
||||
if fdo then fdo:close() end
|
||||
return nil
|
||||
end
|
||||
end
|
||||
|
||||
local MAX_URL_BATCH = 3
|
||||
|
||||
local function try_fetch(urls, validator)
|
||||
if not urls or #urls == 0 then return "" end
|
||||
local timeout = (#urls > 1) and 5 or 10
|
||||
local delay = 50000000
|
||||
local max_wait = 100
|
||||
local jobs = {}
|
||||
local active = 0
|
||||
local idx = 1
|
||||
local function launch_batch()
|
||||
local n = 0
|
||||
while idx <= #urls and n < MAX_URL_BATCH do
|
||||
local job = fork_curl(urls[idx], timeout)
|
||||
if job then
|
||||
jobs[#jobs + 1] = job
|
||||
active = active + 1
|
||||
end
|
||||
idx = idx + 1
|
||||
n = n + 1
|
||||
end
|
||||
end
|
||||
launch_batch()
|
||||
for _ = 1, max_wait do
|
||||
local winner = ""
|
||||
for _, job in ipairs(jobs) do
|
||||
if not job.done then
|
||||
local ok_r, buf = pcall(try_read, job.fdi, 4096)
|
||||
if ok_r and buf then job.buf = job.buf .. buf end
|
||||
local ok_w, wpid = pcall(nixio.waitpid, job.pid, "nohang")
|
||||
if ok_w and wpid then
|
||||
while true do
|
||||
local ok_b, b = pcall(try_read, job.fdi, 4096)
|
||||
if not ok_b or not b then break end
|
||||
job.buf = job.buf .. b
|
||||
end
|
||||
pcall(job.fdi.close, job.fdi)
|
||||
job.done = true
|
||||
active = active - 1
|
||||
if winner == "" and job.buf ~= "" and (not validator or validator(job.buf)) then
|
||||
winner = job.buf
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
if winner ~= "" then
|
||||
for _, job in ipairs(jobs) do
|
||||
if not job.done then
|
||||
pcall(job.fdi.close, job.fdi)
|
||||
nixio.kill(job.pid, 9)
|
||||
end
|
||||
end
|
||||
return trim(winner)
|
||||
end
|
||||
if active == 0 then
|
||||
if idx <= #urls then
|
||||
launch_batch()
|
||||
else
|
||||
break
|
||||
end
|
||||
end
|
||||
nixio.nanosleep(0, delay)
|
||||
delay = math.min(delay * 2, 200000000)
|
||||
end
|
||||
for _, job in ipairs(jobs) do
|
||||
if not job.done then
|
||||
pcall(job.fdi.close, job.fdi)
|
||||
nixio.kill(job.pid, 9)
|
||||
end
|
||||
end
|
||||
return ""
|
||||
end
|
||||
|
||||
function M.prepare_oix_cdn_data(force)
|
||||
if not M.is_oix_mode() then
|
||||
return false, "", ""
|
||||
end
|
||||
|
||||
local parsed = read_version_cache()
|
||||
if parsed and parsed.oix and parsed.oix.cached_at then
|
||||
local age = os.time() - parsed.oix.cached_at
|
||||
local ttl = parsed.oix.cache_ttl or 300
|
||||
if age < 5 or (not force and age < ttl) then
|
||||
return true, parsed.oix.ver or "", parsed.oix.error or ""
|
||||
end
|
||||
end
|
||||
|
||||
local function fork_oix_version(url)
|
||||
local fdi, fdo = nixio.pipe()
|
||||
if not fdi or not fdo then return nil end
|
||||
local cmd = string.format('curl -sL -m 3 --connect-timeout 3 "%s" 2>/dev/null', url)
|
||||
local child = nixio.fork()
|
||||
if child > 0 then
|
||||
fdo:close()
|
||||
return { pid = child, fdi = fdi, buf = "" }
|
||||
elseif child == 0 then
|
||||
nixio.dup(fdo, nixio.stdout)
|
||||
fdi:close()
|
||||
fdo:close()
|
||||
nixio.exec("/bin/sh", "-c", cmd)
|
||||
else
|
||||
if fdi then fdi:close() end
|
||||
if fdo then fdo:close() end
|
||||
return nil
|
||||
end
|
||||
end
|
||||
|
||||
local jobs = {}
|
||||
local dl_job = fork_oix_version("https://dl.dler.io/mihomo-oix/version.txt?tag=Pre-Alpha")
|
||||
if dl_job then jobs[#jobs + 1] = dl_job end
|
||||
local gh_job = fork_oix_version("https://github.com/vernesong/mihomo-oix/releases/download/Pre-Alpha/version.txt")
|
||||
if gh_job then jobs[#jobs + 1] = gh_job end
|
||||
|
||||
if #jobs == 0 then
|
||||
return true, "", "error"
|
||||
end
|
||||
|
||||
local ver = ""
|
||||
local delay = 50000000
|
||||
local max_wait = 40
|
||||
for _ = 1, max_wait do
|
||||
for _, job in ipairs(jobs) do
|
||||
if not job.done then
|
||||
local ok_r, buf = pcall(try_read, job.fdi, 4096)
|
||||
if ok_r and buf then job.buf = job.buf .. buf end
|
||||
local ok_w, wpid = pcall(nixio.waitpid, job.pid, "nohang")
|
||||
if ok_w and wpid then
|
||||
while true do
|
||||
local ok_b, b = pcall(try_read, job.fdi, 4096)
|
||||
if not ok_b or not b then break end
|
||||
job.buf = job.buf .. b
|
||||
end
|
||||
pcall(job.fdi.close, job.fdi)
|
||||
job.done = true
|
||||
end
|
||||
end
|
||||
end
|
||||
for _, job in ipairs(jobs) do
|
||||
if job.done and ver == "" then
|
||||
local candidate = trim(job.buf:gsub("[\n\r]+", ""))
|
||||
if M.is_valid_version(candidate) then
|
||||
ver = candidate
|
||||
end
|
||||
end
|
||||
end
|
||||
if ver ~= "" then
|
||||
for _, job in ipairs(jobs) do
|
||||
if not job.done then
|
||||
pcall(job.fdi.close, job.fdi)
|
||||
nixio.kill(job.pid, 9)
|
||||
end
|
||||
end
|
||||
update_version_cache(function(p) p.oix = { ver = ver, error = "", cache_ttl = 300, cached_at = os.time() } end)
|
||||
return true, ver, ""
|
||||
end
|
||||
local all_done = true
|
||||
for _, job in ipairs(jobs) do
|
||||
if not job.done then all_done = false break end
|
||||
end
|
||||
if all_done then break end
|
||||
nixio.nanosleep(0, delay)
|
||||
delay = math.min(delay * 2, 200000000)
|
||||
end
|
||||
|
||||
for _, job in ipairs(jobs) do
|
||||
if not job.done then
|
||||
pcall(job.fdi.close, job.fdi)
|
||||
nixio.kill(job.pid, 9)
|
||||
end
|
||||
end
|
||||
|
||||
update_version_cache(function(p) p.oix = { ver = "", error = "error", cache_ttl = 5, cached_at = os.time() } end)
|
||||
return true, "", "error"
|
||||
end
|
||||
|
||||
local function fork_file_fetch(sha, file_path, mod)
|
||||
local urls = build_fetch_urls(mod, sha .. "/" .. file_path)
|
||||
if #urls == 0 then return nil end
|
||||
return { children = {}, idx = 1, buf = "", done = false, launched = false, sha = sha, urls = urls }
|
||||
end
|
||||
|
||||
local function launch_file_batch(job)
|
||||
local timeout = (#job.urls > 1) and 5 or 10
|
||||
local n = 0
|
||||
while job.idx <= #job.urls and n < MAX_URL_BATCH do
|
||||
local child = fork_curl(job.urls[job.idx], timeout)
|
||||
if child then job.children[#job.children + 1] = child end
|
||||
job.idx = job.idx + 1
|
||||
n = n + 1
|
||||
end
|
||||
end
|
||||
|
||||
local function collect_fork_results(jobs, max_jobs)
|
||||
local results = {}
|
||||
local active = 0
|
||||
local delay = 50000000
|
||||
local max_iter = 250
|
||||
|
||||
for _ = 1, max_iter do
|
||||
while active < max_jobs do
|
||||
local launched = false
|
||||
for _, job in ipairs(jobs) do
|
||||
if not job.launched then
|
||||
job.launched = true
|
||||
active = active + 1
|
||||
launched = true
|
||||
launch_file_batch(job)
|
||||
if #job.children == 0 then
|
||||
job.done = true
|
||||
active = active - 1
|
||||
end
|
||||
break
|
||||
end
|
||||
end
|
||||
if not launched then break end
|
||||
end
|
||||
|
||||
for _, job in ipairs(jobs) do
|
||||
if job.launched and not job.done then
|
||||
local winner = ""
|
||||
local all_children_done = true
|
||||
for _, child in ipairs(job.children) do
|
||||
if not child.done then
|
||||
all_children_done = false
|
||||
local ok_r, buf = pcall(try_read, child.fdi, 4096)
|
||||
if ok_r and buf then child.buf = child.buf .. buf end
|
||||
local ok_w, wpid = pcall(nixio.waitpid, child.pid, "nohang")
|
||||
if ok_w and wpid then
|
||||
while true do
|
||||
local ok_b, b = pcall(try_read, child.fdi, 4096)
|
||||
if not ok_b or not b then break end
|
||||
child.buf = child.buf .. b
|
||||
end
|
||||
pcall(child.fdi.close, child.fdi)
|
||||
child.done = true
|
||||
if winner == "" and child.buf ~= "" then
|
||||
winner = child.buf
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
if winner ~= "" then
|
||||
for _, child in ipairs(job.children) do
|
||||
if not child.done then
|
||||
pcall(child.fdi.close, child.fdi)
|
||||
nixio.kill(child.pid, 9)
|
||||
end
|
||||
end
|
||||
job.done = true
|
||||
active = active - 1
|
||||
results[job.sha] = trim(winner)
|
||||
elseif all_children_done then
|
||||
if job.idx <= #job.urls then
|
||||
launch_file_batch(job)
|
||||
else
|
||||
job.done = true
|
||||
active = active - 1
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local all_done = true
|
||||
for _, job in ipairs(jobs) do
|
||||
if not job.done then all_done = false break end
|
||||
end
|
||||
if all_done then break end
|
||||
|
||||
nixio.nanosleep(0, delay)
|
||||
delay = math.min(delay * 2, 200000000)
|
||||
end
|
||||
|
||||
for _, job in ipairs(jobs) do
|
||||
if not job.done then
|
||||
if job.children then
|
||||
for _, child in ipairs(job.children) do
|
||||
if not child.done then
|
||||
pcall(child.fdi.close, child.fdi)
|
||||
nixio.kill(child.pid, 9)
|
||||
end
|
||||
end
|
||||
end
|
||||
job.done = true
|
||||
end
|
||||
end
|
||||
|
||||
return results
|
||||
end
|
||||
|
||||
local function html_unescape(s)
|
||||
if not s then return "" end
|
||||
s = s:gsub("&", "&")
|
||||
s = s:gsub("<", "<")
|
||||
s = s:gsub(">", ">")
|
||||
s = s:gsub(""", '"')
|
||||
s = s:gsub("'", "'")
|
||||
s = s:gsub("'", "'")
|
||||
return s
|
||||
end
|
||||
|
||||
local function build_feed_urls(mod, path)
|
||||
local feed = "https://github.com/vernesong/OpenClash/commits/" .. path .. ".atom"
|
||||
if mod == "0" or mod == "" then
|
||||
local urls = { feed }
|
||||
for _, cdn in ipairs(cdn_list()) do
|
||||
urls[#urls + 1] = cdn .. feed
|
||||
end
|
||||
return urls
|
||||
end
|
||||
if mod == "https://cdn.jsdelivr.net/" or mod == "https://fastly.jsdelivr.net/" or mod == "https://testingcf.jsdelivr.net/" then
|
||||
return { feed }
|
||||
end
|
||||
return { mod .. feed, feed }
|
||||
end
|
||||
|
||||
local function fetch_commit_feed(mod, path)
|
||||
return try_fetch(build_feed_urls(mod, path), function(buf)
|
||||
return buf:match("<entry") ~= nil
|
||||
end)
|
||||
end
|
||||
|
||||
local function parse_commit_feed(raw, max_count)
|
||||
local commits = {}
|
||||
if raw and raw ~= "" then
|
||||
local n = 0
|
||||
for entry in raw:gmatch("<entry>(.-)</entry>") do
|
||||
n = n + 1
|
||||
if n > max_count then break end
|
||||
local sha = entry:match("<id>[^<]*/([0-9a-f]+)</id>")
|
||||
if sha then
|
||||
local date = entry:match("<updated>(.-)</updated>") or ""
|
||||
local title = entry:match("<title>(.-)</title>") or ""
|
||||
title = trim(title)
|
||||
commits[#commits + 1] = { sha = sha, date = date, message = html_unescape(title) }
|
||||
end
|
||||
end
|
||||
end
|
||||
return commits
|
||||
end
|
||||
|
||||
function M.fetch_version_history(branch, force, cdn, latest_only)
|
||||
local result = { plugin = {}, core_meta = {}, core_smart = {}, latest = nil, error = nil, oix_ver = "" }
|
||||
local cur_oix = M.is_oix_mode()
|
||||
local skip_core = cur_oix
|
||||
local github_address_mod = fs.uci_get_config("config", "github_address_mod") or "0"
|
||||
if cdn and cdn ~= "" then
|
||||
github_address_mod = cdn
|
||||
if github_address_mod:match("raw%.githubusercontent%.com") then
|
||||
github_address_mod = "0"
|
||||
end
|
||||
end
|
||||
|
||||
if not force then
|
||||
local parsed = read_version_cache()
|
||||
if parsed and parsed[branch] and parsed[branch].cached_at then
|
||||
local blk = parsed[branch]
|
||||
local ttl = blk.cache_ttl or 300
|
||||
if os.time() - blk.cached_at < ttl and blk.oix == cur_oix then
|
||||
if latest_only then
|
||||
local lt = blk.latest
|
||||
if lt and lt.plugin and lt.plugin ~= "" and (cur_oix or (lt.core_meta and lt.core_meta ~= "")) then
|
||||
return blk
|
||||
end
|
||||
elseif blk.plugin and #blk.plugin > 0 then
|
||||
return blk
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if latest_only then
|
||||
local plugin_latest = ""
|
||||
local core_meta_latest = ""
|
||||
local core_smart_latest = ""
|
||||
|
||||
local plugin_raw = try_fetch(build_fetch_urls(github_address_mod, "package/" .. branch .. "/version"))
|
||||
if plugin_raw and plugin_raw ~= "" then
|
||||
plugin_latest = trim(plugin_raw:match("^[^\n\r]*") or "")
|
||||
end
|
||||
|
||||
if not cur_oix then
|
||||
local core_raw = try_fetch(build_fetch_urls(github_address_mod, "core/" .. branch .. "/core_version"))
|
||||
if core_raw and core_raw ~= "" then
|
||||
core_meta_latest = trim(core_raw:match("^[^\n\r]*") or "")
|
||||
local after = core_raw:match("[\n\r]+(.*)")
|
||||
if after then
|
||||
core_smart_latest = trim(after:match("^[^\n\r]*") or "")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
result.latest = { plugin = plugin_latest, core_meta = core_meta_latest, core_smart = core_smart_latest }
|
||||
if plugin_latest == "" then
|
||||
result.error = "network_error"
|
||||
end
|
||||
if cur_oix then
|
||||
M.prepare_oix_cdn_data(force)
|
||||
end
|
||||
result.cache_ttl = (plugin_latest == "") and 5 or 300
|
||||
result.cached_at = os.time()
|
||||
result.oix = cur_oix
|
||||
|
||||
update_version_cache(function(parsed)
|
||||
local blk = parsed[branch] or {}
|
||||
blk.latest = result.latest
|
||||
blk.error = result.error
|
||||
blk.cache_ttl = result.cache_ttl
|
||||
blk.cached_at = result.cached_at
|
||||
blk.oix = cur_oix
|
||||
blk.plugin = nil
|
||||
blk.core_meta = nil
|
||||
blk.core_smart = nil
|
||||
blk.oix_ver = nil
|
||||
parsed[branch] = blk
|
||||
end)
|
||||
|
||||
return result
|
||||
end
|
||||
|
||||
local plugin_feed = fetch_commit_feed(github_address_mod, "package/" .. branch .. "/version")
|
||||
local plugin_commits = parse_commit_feed(plugin_feed, 5)
|
||||
if #plugin_commits > 0 then
|
||||
local file_jobs = {}
|
||||
for _, c in ipairs(plugin_commits) do
|
||||
local job = fork_file_fetch(c.sha, branch .. "/version", github_address_mod)
|
||||
if job then file_jobs[#file_jobs + 1] = job end
|
||||
end
|
||||
|
||||
local file_results = collect_fork_results(file_jobs, 2)
|
||||
|
||||
for _, c in ipairs(plugin_commits) do
|
||||
local raw = file_results[c.sha]
|
||||
local ver
|
||||
if raw and raw ~= "" then
|
||||
ver = trim(raw:match("^[^\n\r]*") or "")
|
||||
if not M.is_valid_version(ver) then ver = nil end
|
||||
end
|
||||
result.plugin[#result.plugin + 1] = {
|
||||
version = ver,
|
||||
date = c.date,
|
||||
sha = c.sha,
|
||||
message = c.message
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
if not skip_core then
|
||||
local core_feed = fetch_commit_feed(github_address_mod, "core/" .. branch .. "/core_version")
|
||||
local core_commits = parse_commit_feed(core_feed, 5)
|
||||
if #core_commits > 0 then
|
||||
local file_jobs = {}
|
||||
for _, c in ipairs(core_commits) do
|
||||
local job = fork_file_fetch(c.sha, branch .. "/core_version", github_address_mod)
|
||||
if job then file_jobs[#file_jobs + 1] = job end
|
||||
end
|
||||
|
||||
local file_results = collect_fork_results(file_jobs, 2)
|
||||
|
||||
for _, c in ipairs(core_commits) do
|
||||
local content = file_results[c.sha]
|
||||
if content and content ~= "" then
|
||||
local meta_ver = content:match("^[^\n\r]*")
|
||||
local after_first = content:match("[\n\r]+(.*)")
|
||||
local smart_ver = after_first and after_first:match("^[^\n\r]*") or nil
|
||||
if meta_ver then
|
||||
meta_ver = trim(meta_ver)
|
||||
if M.is_valid_version(meta_ver) then
|
||||
result.core_meta[#result.core_meta + 1] = { version = meta_ver, date = c.date, sha = c.sha }
|
||||
end
|
||||
end
|
||||
if smart_ver then
|
||||
smart_ver = trim(smart_ver)
|
||||
if M.is_valid_version(smart_ver) then
|
||||
result.core_smart[#result.core_smart + 1] = { version = smart_ver, date = c.date, sha = c.sha }
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
result.latest = {
|
||||
plugin = (result.plugin[1] and result.plugin[1].version) or "",
|
||||
core_meta = (result.core_meta[1] and result.core_meta[1].version) or "",
|
||||
core_smart = (result.core_smart[1] and result.core_smart[1].version) or ""
|
||||
}
|
||||
|
||||
if cur_oix then
|
||||
local _, oix_ver = M.prepare_oix_cdn_data(force)
|
||||
if oix_ver and oix_ver ~= "" then
|
||||
result.oix_ver = oix_ver
|
||||
end
|
||||
end
|
||||
|
||||
local cache_ttl = 300
|
||||
if #result.plugin == 0 then
|
||||
if not plugin_feed or plugin_feed == "" then
|
||||
result.error = "network_error"
|
||||
cache_ttl = 5
|
||||
else
|
||||
result.error = "parse_error"
|
||||
cache_ttl = 5
|
||||
end
|
||||
end
|
||||
|
||||
result.cache_ttl = cache_ttl
|
||||
result.cached_at = os.time()
|
||||
result.oix = cur_oix
|
||||
|
||||
update_version_cache(function(parsed)
|
||||
parsed[branch] = result
|
||||
end)
|
||||
|
||||
return result
|
||||
end
|
||||
|
||||
if arg and arg[0] and arg[0]:match("openclash_version%.lua$") then
|
||||
local branch = fs.uci_get_config("config", "release_branch") or "master"
|
||||
M.fetch_version_history(branch, arg[2], arg[1], arg[3] ~= "0")
|
||||
end
|
||||
|
||||
return M
|
||||
@@ -1,67 +0,0 @@
|
||||
#!/bin/bash
|
||||
. /usr/share/openclash/openclash_curl.sh
|
||||
. /usr/share/openclash/uci.sh
|
||||
|
||||
set_lock() {
|
||||
exec 869>"/tmp/lock/openclash_version.lock" 2>/dev/null
|
||||
flock -x 869 2>/dev/null
|
||||
}
|
||||
|
||||
del_lock() {
|
||||
flock -u 869 2>/dev/null
|
||||
rm -rf "/tmp/lock/openclash_version.lock" 2>/dev/null
|
||||
}
|
||||
|
||||
set_lock
|
||||
|
||||
version_compare() {
|
||||
local current_ver="$1"
|
||||
local latest_ver="$2"
|
||||
|
||||
if echo "1.0.0" | sort -V >/dev/null 2>&1; then
|
||||
if [ "$(printf '%s\n%s\n' "$current_ver" "$latest_ver" | sort -V | head -n1)" = "$current_ver" ] && [ "$current_ver" != "$latest_ver" ]; then
|
||||
return 0
|
||||
fi
|
||||
else
|
||||
local cv_num=$(echo "$current_ver" | awk -F '.' '{print $2$3}' 2>/dev/null)
|
||||
local lv_num=$(echo "$latest_ver" | awk -F '.' '{print $2$3}' 2>/dev/null)
|
||||
if [ -n "$cv_num" ] && [ -n "$lv_num" ] && [ "$(expr "$lv_num" \> "$cv_num")" -eq 1 ]; then
|
||||
return 0
|
||||
fi
|
||||
fi
|
||||
return 1
|
||||
}
|
||||
|
||||
DOWNLOAD_FILE="/tmp/openclash_last_version"
|
||||
RELEASE_BRANCH=$(uci_get_config "release_branch" || echo "master")
|
||||
if [ -x "/bin/opkg" ]; then
|
||||
OP_CV=$(rm -f /var/lock/opkg.lock && opkg status luci-app-openclash 2>/dev/null |grep 'Version' |awk -F 'Version: ' '{print $2}' 2>/dev/null)
|
||||
elif [ -x "/usr/bin/apk" ]; then
|
||||
OP_CV=$(rm -f /lib/apk/db/lock && apk list luci-app-openclash 2>/dev/null|grep 'installed' | grep -oE '[0-9]+(\.[0-9]+)*' | head -1 2>/dev/null)
|
||||
fi
|
||||
OP_LV=$(sed -n 1p "$DOWNLOAD_FILE" 2>/dev/null |sed "s/^v//g" |tr -d "\n")
|
||||
github_address_mod=$(uci_get_config "github_address_mod" || echo 0)
|
||||
if [ -n "$1" ]; then
|
||||
github_address_mod="$1"
|
||||
fi
|
||||
|
||||
if [ "$github_address_mod" != "0" ]; then
|
||||
if [ "$github_address_mod" == "https://cdn.jsdelivr.net/" ] || [ "$github_address_mod" == "https://fastly.jsdelivr.net/" ] || [ "$github_address_mod" == "https://testingcf.jsdelivr.net/" ]; then
|
||||
DOWNLOAD_URL="${github_address_mod}gh/vernesong/OpenClash@package/${RELEASE_BRANCH}/version"
|
||||
else
|
||||
DOWNLOAD_URL="${github_address_mod}https://raw.githubusercontent.com/vernesong/OpenClash/package/${RELEASE_BRANCH}/version"
|
||||
fi
|
||||
else
|
||||
DOWNLOAD_URL="https://raw.githubusercontent.com/vernesong/OpenClash/package/${RELEASE_BRANCH}/version"
|
||||
fi
|
||||
|
||||
DOWNLOAD_FILE_CURL "$DOWNLOAD_URL" "$DOWNLOAD_FILE" "$DOWNLOAD_FILE"
|
||||
|
||||
if [ "$?" -eq 0 ]; then
|
||||
OP_LV=$(sed -n 1p $DOWNLOAD_FILE 2>/dev/null |awk -F 'v' '{print $2}' |awk -F '.' '{print $2$3}' 2>/dev/null)
|
||||
if [ -n "$OP_CV" ] && [ -n "$OP_LV" ] && version_compare "$OP_CV" "$OP_LV" && [ -f "$DOWNLOAD_FILE" ]; then
|
||||
sed -i '/^https:/,$d' $DOWNLOAD_FILE
|
||||
fi
|
||||
fi
|
||||
|
||||
del_lock
|
||||
@@ -244,7 +244,7 @@ fi
|
||||
LOG_WATCHDOG "Setting Firewall For Rules Order..."
|
||||
/etc/init.d/openclash reload "firewall"
|
||||
let FIREWALL_RELOAD++
|
||||
elif [ -n "$(ip tuntap list |grep utun)" ] && [ -z "$(ip route list table 354)" ]; then
|
||||
elif [ -n "$(ip link show utun 2>/dev/null)" ] && [ -z "$(ip route list table 354)" ]; then
|
||||
## 路由表检查
|
||||
LOG_WATCHDOG "Setting Firewall For IP Rules Table Recreate..."
|
||||
/etc/init.d/openclash reload "firewall"
|
||||
@@ -470,6 +470,5 @@ fi
|
||||
LOG_ERROR "Streaming Unlock Could not Work Because of Router-Self Proxy Disabled, Exiting..."
|
||||
fi
|
||||
|
||||
SLOG_CLEAN
|
||||
sleep 60
|
||||
done 2>/dev/null
|
||||
@@ -0,0 +1,13 @@
|
||||
# CDN proxy address list (one URL per line, "#" starts a comment)
|
||||
# Comment out a line with "#" to temporarily disable it
|
||||
https://ghfast.top/
|
||||
https://git.yylx.win/
|
||||
https://cdn.akaere.online/
|
||||
https://gh-proxy.com/
|
||||
https://gh.jasonzeng.dev/
|
||||
https://ghproxy.monkeyray.net/
|
||||
https://down.mxw.xx.kg/
|
||||
https://github.tbap.top/
|
||||
https://ghm.078465.xyz/
|
||||
https://gh.monlor.com/
|
||||
https://gh.idayer.com/
|
||||
@@ -35,6 +35,10 @@ ACL4SSR 规则 WithChinaIp WithGFW,ACL4SSR_WithChinaIp_WithGFW.ini,https://raw.g
|
||||
ACL4SSR 规则 WithGFW,ACL4SSR_WithGFW.ini,https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/config/ACL4SSR_WithGFW.ini
|
||||
eHpo1 规则,ehpo1_main.ini,https://gist.githubusercontent.com/tindy2013/1fa08640a9088ac8652dbd40c5d2715b/raw/ehpo1_main.ini
|
||||
Aethersailor 规则 标准版 Custom_Clash,Custom_Clash.ini,https://raw.githubusercontent.com/Aethersailor/Custom_OpenClash_Rules/refs/heads/main/cfg/Custom_Clash.ini
|
||||
Aethersailor 规则 标准版 故障转移,Custom_Clash_Fallback.ini,https://raw.githubusercontent.com/Aethersailor/Custom_OpenClash_Rules/refs/heads/main/cfg/Custom_Clash_Fallback.ini
|
||||
Aethersailor 规则 轻量版 Custom_Clash_Lite,Custom_Clash_Lite.ini,https://raw.githubusercontent.com/Aethersailor/Custom_OpenClash_Rules/refs/heads/main/cfg/Custom_Clash_Lite.ini
|
||||
Aethersailor 规则 轻量版 故障转移,Custom_Clash_Lite_Fallback.ini,https://raw.githubusercontent.com/Aethersailor/Custom_OpenClash_Rules/refs/heads/main/cfg/Custom_Clash_Lite_Fallback.ini
|
||||
Aethersailor 规则 极简版(GFW) Custom_Clash_GFW,Custom_Clash_GFW.ini,https://raw.githubusercontent.com/Aethersailor/Custom_OpenClash_Rules/refs/heads/main/cfg/Custom_Clash_GFW.ini
|
||||
Aethersailor 规则 极简版(GFW) 故障转移,Custom_Clash_GFW_Fallback.ini,https://raw.githubusercontent.com/Aethersailor/Custom_OpenClash_Rules/refs/heads/main/cfg/Custom_Clash_GFW_Fallback.ini
|
||||
Aethersailor 规则 重度分流版 Custom_Clash_Full,Custom_Clash_Full.ini,https://raw.githubusercontent.com/Aethersailor/Custom_OpenClash_Rules/refs/heads/main/cfg/Custom_Clash_Full.ini
|
||||
Aethersailor 规则 重度分流版 故障转移,Custom_Clash_Full_Fallback.ini,https://raw.githubusercontent.com/Aethersailor/Custom_OpenClash_Rules/refs/heads/main/cfg/Custom_Clash_Full_Fallback.ini
|
||||
@@ -92,7 +92,7 @@ if openclash_custom_overwrite; then
|
||||
write_ruby_part "$RUBY_YAML_PARSE"
|
||||
return
|
||||
fi
|
||||
RUBY_YAML_PARSE="Value = YAML.load_file('$1'); Value$2=$3; File.open('$1','w') {|f| YAML.dump(Value, f)}"
|
||||
RUBY_YAML_PARSE="Value = YAML.load_file('$1'); Value$2=$3; YAML.dump(Value, '$1')"
|
||||
run_ruby_part "$RUBY_YAML_PARSE"
|
||||
}
|
||||
|
||||
@@ -107,7 +107,7 @@ if openclash_custom_overwrite; then
|
||||
write_ruby_part "$RUBY_YAML_PARSE"
|
||||
return
|
||||
fi
|
||||
RUBY_YAML_PARSE="Value = YAML.load_file('$1'); if File::exist?('$3') then Value_1 = YAML.load_file('$3'); if not '$4'.empty? then Value$2=Value_1['$4']; else Value$2=Value_1 end else if not '$4'.empty? then Value.delete('$4'); end; end; File.open('$1','w') {|f| YAML.dump(Value, f)}"
|
||||
RUBY_YAML_PARSE="Value = YAML.load_file('$1'); if File::exist?('$3') then Value_1 = YAML.load_file('$3'); if not '$4'.empty? then Value$2=Value_1['$4']; else Value$2=Value_1 end else if not '$4'.empty? then Value.delete('$4'); end; end; YAML.dump(Value, '$1')"
|
||||
run_ruby_part "$RUBY_YAML_PARSE"
|
||||
}
|
||||
|
||||
@@ -122,7 +122,7 @@ if openclash_custom_overwrite; then
|
||||
write_ruby_part "$RUBY_YAML_PARSE"
|
||||
return
|
||||
fi
|
||||
RUBY_YAML_PARSE="Value = YAML.load_file('$1'); if File::exist?('$3') then Value_1 = YAML.load_file('$3'); if not Value$2 then Value$2 = {}; end; if Value_1$4 && Value_1$4.is_a?(Hash) then Value$2.merge!(Value_1$4) end end; File.open('$1','w') {|f| YAML.dump(Value, f)}"
|
||||
RUBY_YAML_PARSE="Value = YAML.load_file('$1'); if File::exist?('$3') then Value_1 = YAML.load_file('$3'); if not Value$2 then Value$2 = {}; end; if Value_1$4 && Value_1$4.is_a?(Hash) then Value$2.merge!(Value_1$4) end end; YAML.dump(Value, '$1')"
|
||||
run_ruby_part "$RUBY_YAML_PARSE"
|
||||
}
|
||||
|
||||
@@ -137,7 +137,7 @@ if openclash_custom_overwrite; then
|
||||
write_ruby_part "$RUBY_YAML_PARSE"
|
||||
return
|
||||
fi
|
||||
RUBY_YAML_PARSE="Value = YAML.load_file('$1'); if Value$2 then Value$2=Value$2.uniq; end; File.open('$1','w') {|f| YAML.dump(Value, f)}"
|
||||
RUBY_YAML_PARSE="Value = YAML.load_file('$1'); if Value$2 then Value$2=Value$2.uniq; end; YAML.dump(Value, '$1')"
|
||||
run_ruby_part "$RUBY_YAML_PARSE"
|
||||
}
|
||||
|
||||
@@ -152,7 +152,7 @@ if openclash_custom_overwrite; then
|
||||
write_ruby_part "$RUBY_YAML_PARSE"
|
||||
return
|
||||
fi
|
||||
RUBY_YAML_PARSE="Value = YAML.load_file('$1'); if not Value$2 then Value$2 = {}; end; Value$2.merge!({$3}); File.open('$1','w') {|f| YAML.dump(Value, f)}"
|
||||
RUBY_YAML_PARSE="Value = YAML.load_file('$1'); if not Value$2 then Value$2 = {}; end; Value$2.merge!({$3}); YAML.dump(Value, '$1')"
|
||||
run_ruby_part "$RUBY_YAML_PARSE"
|
||||
}
|
||||
|
||||
@@ -167,7 +167,7 @@ if openclash_custom_overwrite; then
|
||||
write_ruby_part "$RUBY_YAML_PARSE"
|
||||
return
|
||||
fi
|
||||
RUBY_YAML_PARSE="Value = YAML.load_file('$1'); if File::exist?('$4') then Value_1 = YAML.load_file('$4'); if not Value$2 or Value$2.nil? then Value$2 = []; end; if Value_1$5 && Value_1$5.is_a?(Array) then idx = [$3.to_i, 0].max; idx = [idx, Value$2.length].min; Value_1$5.reverse.each{|x| Value$2.insert(idx,x); idx += 1}; Value$2=Value$2.uniq end end; File.open('$1','w') {|f| YAML.dump(Value, f)}"
|
||||
RUBY_YAML_PARSE="Value = YAML.load_file('$1'); if File::exist?('$4') then Value_1 = YAML.load_file('$4'); if not Value$2 or Value$2.nil? then Value$2 = []; end; if Value_1$5 && Value_1$5.is_a?(Array) then idx = [$3.to_i, 0].max; idx = [idx, Value$2.length].min; Value_1$5.reverse.each{|x| Value$2.insert(idx,x); idx += 1}; Value$2=Value$2.uniq end end; YAML.dump(Value, '$1')"
|
||||
run_ruby_part "$RUBY_YAML_PARSE"
|
||||
}
|
||||
|
||||
@@ -182,7 +182,7 @@ if openclash_custom_overwrite; then
|
||||
write_ruby_part "$RUBY_YAML_PARSE"
|
||||
return
|
||||
fi
|
||||
RUBY_YAML_PARSE="Value = YAML.load_file('$1'); if File::exist?('$3') then Value_1 = YAML.load_file('$3'); if not Value$2 or Value$2.nil? then Value$2 = []; end; if Value_1$4 && Value_1$4.is_a?(Array) then Value$2=(Value_1$4+Value$2).uniq else Value$2=Value$2.uniq end end; File.open('$1','w') {|f| YAML.dump(Value, f)}"
|
||||
RUBY_YAML_PARSE="Value = YAML.load_file('$1'); if File::exist?('$3') then Value_1 = YAML.load_file('$3'); if not Value$2 or Value$2.nil? then Value$2 = []; end; if Value_1$4 && Value_1$4.is_a?(Array) then Value$2=(Value_1$4+Value$2).uniq else Value$2=Value$2.uniq end end; YAML.dump(Value, '$1')"
|
||||
run_ruby_part "$RUBY_YAML_PARSE"
|
||||
}
|
||||
|
||||
@@ -197,7 +197,7 @@ if openclash_custom_overwrite; then
|
||||
write_ruby_part "$RUBY_YAML_PARSE"
|
||||
return
|
||||
fi
|
||||
RUBY_YAML_PARSE="Value = YAML.load_file('$1'); if not Value$2 or Value$2.nil? then Value$2 = []; end; idx = [$3.to_i, 0].max; idx = [idx, Value$2.length].min; Value$2=Value$2.insert(idx,'$4').uniq; File.open('$1','w') {|f| YAML.dump(Value, f)}"
|
||||
RUBY_YAML_PARSE="Value = YAML.load_file('$1'); if not Value$2 or Value$2.nil? then Value$2 = []; end; idx = [$3.to_i, 0].max; idx = [idx, Value$2.length].min; Value$2=Value$2.insert(idx,'$4').uniq; YAML.dump(Value, '$1')"
|
||||
run_ruby_part "$RUBY_YAML_PARSE"
|
||||
}
|
||||
|
||||
@@ -212,7 +212,7 @@ if openclash_custom_overwrite; then
|
||||
write_ruby_part "$RUBY_YAML_PARSE"
|
||||
return
|
||||
fi
|
||||
RUBY_YAML_PARSE="Value = YAML.load_file('$1'); if not Value$2 or Value$2.nil? then Value$2 = []; end; idx = [$3.to_i, 0].max; idx = [idx, Value$2.length].min; Value$2=Value$2.insert(idx,$4).uniq; File.open('$1','w') {|f| YAML.dump(Value, f)}"
|
||||
RUBY_YAML_PARSE="Value = YAML.load_file('$1'); if not Value$2 or Value$2.nil? then Value$2 = []; end; idx = [$3.to_i, 0].max; idx = [idx, Value$2.length].min; Value$2=Value$2.insert(idx,$4).uniq; YAML.dump(Value, '$1')"
|
||||
run_ruby_part "$RUBY_YAML_PARSE"
|
||||
}
|
||||
|
||||
@@ -227,7 +227,7 @@ if openclash_custom_overwrite; then
|
||||
write_ruby_part "$RUBY_YAML_PARSE"
|
||||
return
|
||||
fi
|
||||
RUBY_YAML_PARSE="Value = YAML.load_file('$1'); if not Value$2 or Value$2.nil? then Value$2 = []; end; if $4.is_a?(Array) then idx = [$3.to_i, 0].max; idx = [idx, Value$2.length].min; $4.reverse.each{|x| Value$2=Value$2.insert(idx,x); idx += 1}; Value$2=Value$2.uniq end; File.open('$1','w') {|f| YAML.dump(Value, f)}"
|
||||
RUBY_YAML_PARSE="Value = YAML.load_file('$1'); if not Value$2 or Value$2.nil? then Value$2 = []; end; if $4.is_a?(Array) then idx = [$3.to_i, 0].max; idx = [idx, Value$2.length].min; $4.reverse.each{|x| Value$2=Value$2.insert(idx,x); idx += 1}; Value$2=Value$2.uniq end; YAML.dump(Value, '$1')"
|
||||
run_ruby_part "$RUBY_YAML_PARSE"
|
||||
}
|
||||
|
||||
@@ -247,9 +247,9 @@ if openclash_custom_overwrite; then
|
||||
return
|
||||
fi
|
||||
if [ -z "$2" ]; then
|
||||
RUBY_YAML_PARSE="Value = YAML.load_file('$1'); Value.delete('$3'); File.open('$1','w') {|f| YAML.dump(Value, f)}"
|
||||
RUBY_YAML_PARSE="Value = YAML.load_file('$1'); Value.delete('$3'); YAML.dump(Value, '$1')"
|
||||
else
|
||||
RUBY_YAML_PARSE="Value = YAML.load_file('$1'); if Value$2 then if Value$2.is_a?(Hash) then Value$2.delete('$3') elsif Value$2.is_a?(Array) then Value$2.delete('$3') end end; File.open('$1','w') {|f| YAML.dump(Value, f)}"
|
||||
RUBY_YAML_PARSE="Value = YAML.load_file('$1'); if Value$2 then if Value$2.is_a?(Hash) then Value$2.delete('$3') elsif Value$2.is_a?(Array) then Value$2.delete('$3') end end; YAML.dump(Value, '$1')"
|
||||
fi
|
||||
run_ruby_part "$RUBY_YAML_PARSE"
|
||||
}
|
||||
@@ -265,7 +265,7 @@ if openclash_custom_overwrite; then
|
||||
write_ruby_part "$RUBY_YAML_PARSE"
|
||||
return
|
||||
fi
|
||||
RUBY_YAML_PARSE="Value = YAML.load_file('$1'); if Value$2 && Value$2.is_a?(Hash) then if Value$2['$3'] && Value$2['$3'].is_a?(Hash) then Value$2['$3']$4 = '$5' end end; File.open('$1','w') {|f| YAML.dump(Value, f)}"
|
||||
RUBY_YAML_PARSE="Value = YAML.load_file('$1'); if Value$2 && Value$2.is_a?(Hash) then if Value$2['$3'] && Value$2['$3'].is_a?(Hash) then Value$2['$3']$4 = '$5' end end; YAML.dump(Value, '$1')"
|
||||
run_ruby_part "$RUBY_YAML_PARSE"
|
||||
}
|
||||
|
||||
@@ -288,9 +288,9 @@ if openclash_custom_overwrite; then
|
||||
return
|
||||
fi
|
||||
if [ -n "$3" ] && [ -n "$4" ] && [ -n "$5" ] && [ -n "$6" ]; then
|
||||
RUBY_YAML_PARSE="Value = YAML.load_file('$1'); if Value$2 && Value$2.is_a?(Array) then Value$2.map!{|x| if x.is_a?(Hash) && x$3 == '$4' then x$5='$6' end; x}; Value$2.uniq! end; File.open('$1','w') {|f| YAML.dump(Value, f)}"
|
||||
RUBY_YAML_PARSE="Value = YAML.load_file('$1'); if Value$2 && Value$2.is_a?(Array) then Value$2.map!{|x| if x.is_a?(Hash) && x$3 == '$4' then x$5='$6' end; x}; Value$2.uniq! end; YAML.dump(Value, '$1')"
|
||||
elif [ -z "$3" ] && [ -n "$4" ] && [ -z "$5" ] && [ -n "$6" ]; then
|
||||
RUBY_YAML_PARSE="Value = YAML.load_file('$1'); if Value$2 && Value$2.is_a?(Array) then Value$2.map!{|x| if x == '$4' then '$6' else x end}; Value$2.uniq! end; File.open('$1','w') {|f| YAML.dump(Value, f)}"
|
||||
RUBY_YAML_PARSE="Value = YAML.load_file('$1'); if Value$2 && Value$2.is_a?(Array) then Value$2.map!{|x| if x == '$4' then '$6' else x end}; Value$2.uniq! end; YAML.dump(Value, '$1')"
|
||||
else
|
||||
return
|
||||
fi
|
||||
|
||||
@@ -166,6 +166,7 @@ sys_dns_append()
|
||||
PROXY_GROUPS=$(ruby -ryaml -rYAML -I "/usr/share/openclash" -E UTF-8 -e "
|
||||
begin
|
||||
Value = YAML.load_file('$CONFIG_FILE')
|
||||
File.open('/tmp/yaml_change_marshal', 'wb') { |f| Marshal.dump(Value, f) }
|
||||
if Value.key?('proxy-groups') && Value['proxy-groups'].is_a?(Array)
|
||||
Value['proxy-groups'].each { |x| puts x['name'] if x.key?('name') }
|
||||
end
|
||||
@@ -328,7 +329,15 @@ end
|
||||
|
||||
begin
|
||||
config_file = '$5'
|
||||
Value = YAML.load_file(config_file)
|
||||
if File.exist?('/tmp/yaml_change_marshal')
|
||||
begin
|
||||
Value = Marshal.load(File.open('/tmp/yaml_change_marshal', 'rb') { |f| f.read })
|
||||
rescue
|
||||
Value = YAML.load_file(config_file)
|
||||
end
|
||||
else
|
||||
Value = YAML.load_file(config_file)
|
||||
end
|
||||
rescue Exception => e
|
||||
YAML.LOG_ERROR('Load File Failed,【%s】' % [e.message])
|
||||
exit
|
||||
@@ -811,9 +820,10 @@ rescue Exception => e
|
||||
YAML.LOG_ERROR('Config File Overwrite Failed,【%s】' % [e.message])
|
||||
ensure
|
||||
begin
|
||||
File.open(config_file, 'w') { |f| YAML.dump(Value, f) }
|
||||
YAML.dump(Value, config_file)
|
||||
rescue Exception => e
|
||||
YAML.LOG_ERROR('Write file failed:【%s】' % [e.message])
|
||||
end
|
||||
File.delete('/tmp/yaml_change_marshal') rescue nil
|
||||
end
|
||||
" 2>/dev/null >> $LOG_FILE
|
||||
@@ -1617,5 +1617,4 @@ ruby -ryaml -rYAML -I "/usr/share/openclash" -E UTF-8 -e "
|
||||
" >> $LOG_FILE
|
||||
|
||||
LOG_OUT "Config File【$CONFIG_NAME】Read Successful!"
|
||||
SLOG_CLEAN
|
||||
del_lock
|
||||
@@ -1852,12 +1852,33 @@ rm -rf $servers_name
|
||||
|
||||
|
||||
LOG_OUT "Proxies, Proxy-providers, Groups Edited Successful, Updating Config File【$CONFIG_NAME】..."
|
||||
config_hash=$(ruby -ryaml -rYAML -I "/usr/share/openclash" -E UTF-8 -e "Value = YAML.load_file('$CONFIG_FILE'); puts Value" 2>/dev/null)
|
||||
if [ "$config_hash" != "false" ] && [ -n "$config_hash" ]; then
|
||||
ruby_cover "$CONFIG_FILE" "['proxies']" "$SERVER_FILE" "proxies"
|
||||
ruby_cover "$CONFIG_FILE" "['proxy-providers']" "$PROXY_PROVIDER_FILE" "proxy-providers"
|
||||
ruby_cover "$CONFIG_FILE" "['proxy-groups']" "/tmp/yaml_groups.yaml" "proxy-groups"
|
||||
else
|
||||
config_hash=$(ruby -ryaml -rYAML -I "/usr/share/openclash" -E UTF-8 -e "
|
||||
begin
|
||||
Value = YAML.load_file('$CONFIG_FILE')
|
||||
{
|
||||
'proxies' => '$SERVER_FILE',
|
||||
'proxy-providers' => '$PROXY_PROVIDER_FILE',
|
||||
'proxy-groups' => '/tmp/yaml_groups.yaml'
|
||||
}.each do |key, src_file|
|
||||
begin
|
||||
if File.exist?(src_file)
|
||||
src = YAML.load_file(src_file)
|
||||
Value[key] = src[key]
|
||||
else
|
||||
Value.delete(key)
|
||||
end
|
||||
rescue Exception => e
|
||||
YAML.LOG_ERROR('Merge [' + key + '] Failed: ' + e.message)
|
||||
end
|
||||
end
|
||||
YAML.dump(Value, '$CONFIG_FILE')
|
||||
puts 'OK'
|
||||
rescue Exception => e
|
||||
YAML.LOG_ERROR('Update Config File Failed: ' + e.message)
|
||||
end
|
||||
" 2>/dev/null)
|
||||
|
||||
if [ "$config_hash" != "OK" ]; then
|
||||
cat "$SERVER_FILE" "$PROXY_PROVIDER_FILE" "/tmp/yaml_groups.yaml" > "$CONFIG_FILE" 2>/dev/null
|
||||
fi
|
||||
|
||||
@@ -1868,5 +1889,4 @@ rm -rf /tmp/Proxy_Server 2>/dev/null
|
||||
rm -rf /tmp/Proxy_Provider 2>/dev/null
|
||||
|
||||
LOG_OUT "Config File【$CONFIG_NAME】Write Successful!"
|
||||
SLOG_CLEAN
|
||||
del_lock
|
||||
@@ -387,27 +387,29 @@ yml_other_set()
|
||||
|
||||
# smart auto switch
|
||||
begin
|
||||
if ('${8}' == '1' or '${9}' == '1' or '${11}' != '0' or '${12}' != '0' or '${12}' == '1' or '${13}' == '1') and Value.key?('proxy-groups') and Value['proxy-groups'].is_a?(Array) then
|
||||
if ('${8}' == '1' or '${9}' == '1' or '${11}' != '0' or '${12}' != '0' or '${12}' == '1' or '${13}' == '1' or '${14}' != '0') and Value.key?('proxy-groups') and Value['proxy-groups'].is_a?(Array) then
|
||||
Value['proxy-groups'].each{|group|
|
||||
threads << Thread.new {
|
||||
if '${8}' == '1' and ['url-test', 'load-balance'].include?(group['type']) then
|
||||
group['type'] = 'smart';
|
||||
group['uselightgbm'] = true if '${12}' == '1';
|
||||
group['collectdata'] = true if '${9}' == '1';
|
||||
group['sample-rate'] = '${10}'.to_f if '${9}' == '1';
|
||||
end;
|
||||
if '${9}' == '1' and group['type'] == 'smart' then
|
||||
group['collectdata'] = true;
|
||||
group['sample-rate'] = '${10}'.to_f;
|
||||
end;
|
||||
if '${11}' != '0' and group['type'] == 'smart' then
|
||||
group['policy-priority'] = '${11}';
|
||||
end;
|
||||
if '${12}' == '1' and group['type'] == 'smart' then
|
||||
group['uselightgbm'] = true;
|
||||
end;
|
||||
if '${13}' == '1' and group['type'] == 'smart' then
|
||||
group['prefer-asn'] = true;
|
||||
if group['type'] == 'smart' then
|
||||
if '${9}' == '1' then
|
||||
group['collectdata'] = true;
|
||||
group['sample-rate'] = '${10}'.to_f;
|
||||
end;
|
||||
if '${11}' != '0'then
|
||||
group['policy-priority'] = '${11}';
|
||||
end;
|
||||
if '${12}' == '1' then
|
||||
group['uselightgbm'] = true;
|
||||
end;
|
||||
if '${13}' == '1' then
|
||||
group['prefer-asn'] = true;
|
||||
end;
|
||||
if '${14}' != '0' then
|
||||
group['tolerance'] = '${14}'.to_i;
|
||||
end;
|
||||
end;
|
||||
};
|
||||
};
|
||||
@@ -425,11 +427,11 @@ yml_other_set()
|
||||
YAML.LOG_ERROR('Config File Overwrite Failed,【%s】' % [e.message])
|
||||
ensure
|
||||
begin
|
||||
File.open('$2','w') {|f| YAML.dump(Value, f)};
|
||||
YAML.dump(Value, '$2');
|
||||
rescue Exception => e
|
||||
YAML.LOG_ERROR('Write file failed:【%s】' % [e.message])
|
||||
end
|
||||
end" 2>/dev/null >> $LOG_FILE
|
||||
}
|
||||
|
||||
yml_other_set "$1" "$2" "$3" "$4" "$5" "$6" "$7" "$8" "$9" "${10}" "${11}" "${12}" "${13}"
|
||||
yml_other_set "$1" "$2" "$3" "$4" "$5" "$6" "$7" "$8" "$9" "${10}" "${11}" "${12}" "${13}" "${14}"
|
||||
File diff suppressed because it is too large.
Load diff
Binary file not shown.
|
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 7.9 KiB |
+40
-40
@@ -1,23 +1,23 @@
|
||||
var CM6=(()=>{var Dk=Object.create;var es=Object.defineProperty;var Ik=Object.getOwnPropertyDescriptor;var Bk=Object.getOwnPropertyNames;var Nk=Object.getPrototypeOf,jk=Object.prototype.hasOwnProperty;var zk=(t,e,i)=>e in t?es(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i;var Yk=(t,e)=>()=>{try{return e||t((e={exports:{}}).exports,e),e.exports}catch(i){throw e=0,i}},qk=(t,e)=>{for(var i in e)es(t,i,{get:e[i],enumerable:!0})},bg=(t,e,i,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of Bk(e))!jk.call(t,r)&&r!==i&&es(t,r,{get:()=>e[r],enumerable:!(n=Ik(e,r))||n.enumerable});return t};var Wk=(t,e,i)=>(i=t!=null?Dk(Nk(t)):{},bg(e||!t||!t.__esModule?es(i,"default",{value:t,enumerable:!0}):i,t)),Vk=t=>bg(es({},"__esModule",{value:!0}),t);var K=(t,e,i)=>zk(t,typeof e!="symbol"?e+"":e,i);var Qk=Yk((CZ,vk)=>{function uk(t){return t instanceof Map?t.clear=t.delete=t.set=function(){throw new Error("map is read-only")}:t instanceof Set&&(t.add=t.clear=t.delete=function(){throw new Error("set is read-only")}),Object.freeze(t),Object.getOwnPropertyNames(t).forEach(e=>{let i=t[e],n=typeof i;(n==="object"||n==="function")&&!Object.isFrozen(i)&&uk(i)}),t}var ac=class{constructor(e){e.data===void 0&&(e.data={}),this.data=e.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}};function dk(t){return t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function on(t,...e){let i=Object.create(null);for(let n in t)i[n]=t[n];return e.forEach(function(n){for(let r in n)i[r]=n[r]}),i}var xL="</span>",ok=t=>!!t.scope,kL=(t,{prefix:e})=>{if(t.startsWith("language:"))return t.replace("language:","language-");if(t.includes(".")){let i=t.split(".");return[`${e}${i.shift()}`,...i.map((n,r)=>`${n}${"_".repeat(r+1)}`)].join(" ")}return`${e}${t}`},rg=class{constructor(e,i){this.buffer="",this.classPrefix=i.classPrefix,e.walk(this)}addText(e){this.buffer+=dk(e)}openNode(e){if(!ok(e))return;let i=kL(e.scope,{prefix:this.classPrefix});this.span(i)}closeNode(e){ok(e)&&(this.buffer+=xL)}value(){return this.buffer}span(e){this.buffer+=`<span class="${e}">`}},lk=(t={})=>{let e={children:[]};return Object.assign(e,t),e},sg=class t{constructor(){this.rootNode=lk(),this.stack=[this.rootNode]}get top(){return this.stack[this.stack.length-1]}get root(){return this.rootNode}add(e){this.top.children.push(e)}openNode(e){let i=lk({scope:e});this.add(i),this.stack.push(i)}closeNode(){if(this.stack.length>1)return this.stack.pop()}closeAllNodes(){for(;this.closeNode(););}toJSON(){return JSON.stringify(this.rootNode,null,4)}walk(e){return this.constructor._walk(e,this.rootNode)}static _walk(e,i){return typeof i=="string"?e.addText(i):i.children&&(e.openNode(i),i.children.forEach(n=>this._walk(e,n)),e.closeNode(i)),e}static _collapse(e){typeof e!="string"&&e.children&&(e.children.every(i=>typeof i=="string")?e.children=[e.children.join("")]:e.children.forEach(i=>{t._collapse(i)}))}},og=class extends sg{constructor(e){super(),this.options=e}addText(e){e!==""&&this.add(e)}startScope(e){this.openNode(e)}endScope(){this.closeNode()}__addSublanguage(e,i){let n=e.root;i&&(n.scope=`language:${i}`),this.add(n)}toHTML(){return new rg(this,this.options).value()}finalize(){return this.closeAllNodes(),!0}};function Qo(t){return t?typeof t=="string"?t:t.source:null}function pk(t){return Hn("(?=",t,")")}function wL(t){return Hn("(?:",t,")*")}function vL(t){return Hn("(?:",t,")?")}function Hn(...t){return t.map(i=>Qo(i)).join("")}function QL(t){let e=t[t.length-1];return typeof e=="object"&&e.constructor===Object?(t.splice(t.length-1,1),e):{}}function ag(...t){return"("+(QL(t).capture?"":"?:")+t.map(n=>Qo(n)).join("|")+")"}function gk(t){return new RegExp(t.toString()+"|").exec("").length-1}function PL(t,e){let i=t&&t.exec(e);return i&&i.index===0}var $L=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function cg(t,{joinWith:e}){let i=0;return t.map(n=>{i+=1;let r=i,s=Qo(n),o="";for(;s.length>0;){let l=$L.exec(s);if(!l){o+=s;break}o+=s.substring(0,l.index),s=s.substring(l.index+l[0].length),l[0][0]==="\\"&&l[1]?o+="\\"+String(Number(l[1])+r):(o+=l[0],l[0]==="("&&i++)}return o}).map(n=>`(${n})`).join(e)}var TL=/\b\B/,Ok="[a-zA-Z]\\w*",hg="[a-zA-Z_]\\w*",mk="\\b\\d+(\\.\\d+)?",bk="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",yk="\\b(0b[01]+)",CL="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",AL=(t={})=>{let e=/^#![ ]*\//;return t.binary&&(t.begin=Hn(e,/.*\b/,t.binary,/\b.*/)),on({scope:"meta",begin:e,end:/$/,relevance:0,"on:begin":(i,n)=>{i.index!==0&&n.ignoreMatch()}},t)},Po={begin:"\\\\[\\s\\S]",relevance:0},RL={scope:"string",begin:"'",end:"'",illegal:"\\n",contains:[Po]},EL={scope:"string",begin:'"',end:'"',illegal:"\\n",contains:[Po]},ML={begin:/\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|suLine truncated
|
||||
https://github.com/highlightjs/highlight.js/issues/2277`),te=P,Y=D),V===void 0&&(V=!0);let re={code:Y,language:te};E("before:highlight",re);let J=re.result?re.result:f(re.language,re.code,V);return J.code=re.code,E("after:highlight",J),J}function f(P,D,V,Y){let te=Object.create(null);function re(B,q){return B.keywords[q]}function J(){if(!H.keywords){Ye.addText(Pe);return}let B=0;H.keywordPatternRe.lastIndex=0;let q=H.keywordPatternRe.exec(Pe),ee="";for(;q;){ee+=Pe.substring(B,q.index);let Se=ii.case_insensitive?q[0].toLowerCase():q[0],He=re(H,Se);if(He){let[yi,_k]=He;if(Ye.addText(ee),ee="",te[Se]=(te[Se]||0)+1,te[Se]<=cX&&(Ao+=_k),yi.startsWith("_"))ee+=q[0];else{let Zk=ii.classNameAliases[yi]||yi;xe(q[0],Zk)}}else ee+=q[0];B=H.keywordPatternRe.lastIndex,q=H.keywordPatternRe.exec(Pe)}ee+=Pe.substring(B),Ye.addText(ee)}function ye(){if(Pe==="")return;let B=null;if(typeof H.subLanguage=="string"){if(!e[H.subLanguage]){Ye.addText(Pe);return}B=f(H.subLanguage,Pe,!0,mg[H.subLanguage]),mg[H.subLanguage]=B._top}else B=d(Pe,H.subLanguage.length?H.subLanguage:null);H.relevance>0&&(Ao+=B.relevance),Ye.__addSublanguage(B._emitter,B.language)}function ce(){H.subLanguage!=null?ye():J(),Pe=""}function xe(B,q){B!==""&&(Ye.startScope(q),Ye.addText(B),Ye.endScope())}function dt(B,q){let ee=1,Se=q.length-1;for(;ee<=Se;){if(!B._emit[ee]){ee++;continue}let He=ii.classNameAliases[B[ee]]||B[ee],yi=q[ee];He?xe(yi,He):(Pe=yi,J(),Pe=""),ee++}}function Nt(B,q){return B.scope&&typeof B.scope=="string"&&Ye.openNode(ii.classNameAliases[B.scope]||B.scope),B.beginScope&&(B.beginScope._wrap?(xe(Pe,ii.classNameAliases[B.beginScope._wrap]||B.beginScope._wrap),Pe=""):B.beginScope._multi&&(dt(B.beginScope,q),Pe="")),H=Object.create(B,{parent:{value:H}}),H}function Jr(B,q,ee){let Se=PL(B.endRe,ee);if(Se){if(B["on:end"]){let He=new ac(B);B["on:end"](q,He),He.isMatchIgnored&&(Se=!1)}if(Se){for(;B.endsParent&&B.parent;)B=B.parent;return B}}if(B.endsWithParent)return Jr(B.parent,q,ee)}function To(B){return H.matcher.regexIndex===0?(Pe+=B[0],1):(Oc=!0,0)}function Ek(B){let q=B[0],ee=B.rule,Se=new ac(ee),He=[ee.__beforeBegin,ee["on:begin"]];for(let yi of He)if(yi&&(yi(B,Se),Se.isMatchIgnored))return To(q);return ee.skip?Pe+=q:(ee.excludeBegin&&(Pe+=q),ce(),!ee.returnBegin&&!ee.excludeBegin&&(Pe=q)),Nt(ee,B),ee.returnBegin?0:q.length}function Mk(B){let q=B[0],ee=D.substring(B.index),Se=Jr(H,B,ee);if(!Se)return fk;let He=H;H.endScope&&H.endScope._wrap?(ce(),xe(q,H.endScope._wrap)):H.endScope&&H.endScope._multi?(ce(),dt(H.endScope,B)):He.skip?Pe+=q:(He.returnEnd||He.excludeEnd||(Pe+=q),ce(),He.excludeEnd&&(Pe=q));do H.scope&&Ye.closeNode(),!H.skip&&!H.subLanguage&&(Ao+=H.relevance),H=H.parent;while(H!==Se.parent);return Se.starts&&Nt(Se.starts,B),He.returnEnd?0:q.length}function Lk(){let B=[];for(let q=H;q!==ii;q=q.parent)q.scope&&B.unshift(q.scope);B.forEach(q=>Ye.openNode(q))}let Co={};function Og(B,q){let ee=q&&q[0];if(Pe+=B,ee==null)return ce(),0;if(Co.type==="begin"&&q.type==="end"&&Co.index===q.index&&ee===""){if(Pe+=D.slice(q.index,q.index+1),!r){let Se=new Error(`0 width match regex (${P})`);throw Se.languageName=P,Se.badRule=Co.rule,Se}return 1}if(Co=q,q.type==="begin")return Ek(q);if(q.type==="illegal"&&!V){let Se=new Error('Illegal lexeme "'+ee+'" for mode "'+(H.scope||"<unnamed>")+'"');throw Se.mode=H,Se}else if(q.type==="end"){let Se=Mk(q);if(Se!==fk)return Se}if(q.type==="illegal"&&ee==="")return Pe+=`
|
||||
`,1;if(gc>1e5&&gc>q.index*3)throw new Error("potential infinite loop, way more iterations than matches");return Pe+=ee,ee.length}let ii=C(P);if(!ii)throw Fn(s.replace("{}",P)),new Error('Unknown language: "'+P+'"');let Xk=oX(ii),pc="",H=Y||Xk,mg={},Ye=new l.__emitter(l);Lk();let Pe="",Ao=0,ln=0,gc=0,Oc=!1;try{if(ii.__emitTokens)ii.__emitTokens(D,Ye);else{for(H.matcher.considerAll();;){gc++,Oc?Oc=!1:H.matcher.considerAll(),H.matcher.lastIndex=ln;let B=H.matcher.exec(D);if(!B)break;let q=D.substring(ln,B.index),ee=Og(q,B);ln=B.index+ee}Og(D.substring(ln))}return Ye.finalize(),pc=Ye.toHTML(),{language:P,value:pc,relevance:Ao,illegal:!1,_emitter:Ye,_top:H}}catch(B){if(B.message&&B.message.includes("Illegal"))return{language:P,value:ng(D),illegal:!0,relevance:0,_illegalBy:{message:B.message,index:ln,context:D.slice(ln-100,ln+100),mode:B.mode,resultSoFar:pc},_emitter:Ye};if(r)return{language:P,value:ng(D),illegal:!1,relevance:0,errorRaised:B,_emitter:Ye,_top:H};throw B}}function u(P){let D={value:ng(P),illegal:!1,relevance:0,_top:o,_emitter:new l.__emitter(l)};return D._emitter.addText(P),D}function d(P,D){D=D||l.languages||Object.keys(e);let V=u(P),Y=D.filter(C).filter(N).map(ce=>f(ce,P,!1));Y.unshift(V);let te=Y.sort((ce,xe)=>{if(ce.relevance!==xe.relevance)return xe.relevance-ce.relevance;if(ce.language&&xe.language){if(C(ce.language).supersetOf===xe.language)return 1;if(C(xe.language).supersetOf===ce.language)return-1}return 0}),[re,J]=te,ye=re;return ye.secondBest=J,ye}function p(P,D,V){let Y=D&&i[D]||V;P.classList.add("hljs"),P.classList.add(`language-${Y}`)}function g(P){let D=null,V=h(P);if(a(V))return;if(E("before:highlightElement",{el:P,language:V}),P.dataset.highlighted){console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.",P);return}if(P.children.length>0&&(l.ignoreUnescapedHTML||(console.warn("One of your code blocks includes unescaped HTML. This is a potentially serious security risk."),console.warn("https://github.com/highlightjs/highlight.js/wiki/security"),console.warn("The element with unescaped HTML:"),console.warn(P)),l.throwUnescapedHTML))throw new lg("One of your code blocks includes unescaped HTML.",P.innerHTML);D=P;let Y=D.textContent,te=V?c(Y,{language:V,ignoreIllegals:!0}):d(Y);P.innerHTML=te.value,P.dataset.highlighted="yes",p(P,V,te.language),P.result={language:te.language,re:te.relevance,relevance:te.relevance},te.secondBest&&(P.secondBest={language:te.secondBest.language,relevance:te.secondBest.relevance}),E("after:highlightElement",{el:P,result:te,text:Y})}function m(P){l=hk(l,P)}let b=()=>{v(),Hr("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")};function y(){v(),Hr("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.")}let S=!1;function v(){function P(){v()}if(document.readyState==="loading"){S||window.addEventListener("DOMContentLoaded",P,!1),S=!0;return}document.querySelectorAll(l.cssSelector).forEach(g)}function x(P,D){let V=null;try{V=D(t)}catch(Y){if(Fn("Language definition for '{}' could not be registered.".replace("{}",P)),r)Fn(Y);else throw Y;V=o}V.name||(V.name=P),e[P]=V,V.rawDefinition=D.bind(null,t),V.aliases&&_(V.aliases,{languageName:P})}function w(P){delete e[P];for(let D of Object.keys(i))i[D]===P&&delete i[D]}function k(){return Object.keys(e)}function C(P){return P=(P||"").toLowerCase(),e[P]||e[i[P]]}function _(P,{languageName:D}){typeof P=="string"&&(P=[P]),P.forEach(V=>{i[V.toLowerCase()]=D})}function N(P){let D=C(P);return D&&!D.disableAutodetect}function R(P){P["before:highlightBlock"]&&!P["before:highlightElement"]&&(P["before:highlightElement"]=D=>{P["before:highlightBlock"](Object.assign({block:D.el},D))}),P["after:highlightBlock"]&&!P["after:highlightElement"]&&(P["after:highlightElement"]=D=>{P["after:highlightBlock"](Object.assign({block:D.el},D))})}function $(P){R(P),n.push(P)}function j(P){let D=n.indexOf(P);D!==-1&&n.splice(D,1)}function E(P,D){let V=P;n.forEach(function(Y){Y[V]&&Y[V](D)})}function U(P){return Hr("10.7.0","highlightBlock will be removed entirely in v12.0"),Hr("10.7.0","Please use highlightElement now."),g(P)}Object.assign(t,{highlight:c,highlightAuto:d,highlightAll:v,highlightElement:g,highlightBlock:U,configure:m,initHighlighting:b,initHighlightingOnLoad:y,registerLanguage:x,unregisterLanguage:w,listLanguages:k,getLanguage:C,registerAliases:_,autoDetection:N,inherit:hk,addPlugin:$,removePlugin:j}),t.debugMode=function(){r=!1},t.safeMode=function(){r=!0},t.versionString=aX,t.regex={concat:Hn,lookahead:pk,either:ag,optional:vL,anyNumberOfTimes:wL};for(let P in lc)typeof lc[P]=="object"&&uk(lc[P]);return Object.assign(t,lc),t},Kr=wk({});Kr.newInstance=()=>wk({});vk.exports=Kr;Kr.HighlightJS=Kr;Kr.default=Kr});var EX={};qk(EX,{Compartment:()=>ni,EditorState:()=>he,EditorView:()=>T,HighlightStyle:()=>Vt,MergeView:()=>Ja,StreamLanguage:()=>_s,autocompletion:()=>Fb,baseExtensions:()=>yX,bracketMatching:()=>Rf,closeBrackets:()=>Tu,closeBracketsKeymap:()=>Cu,
Line truncated
|
||||
var CM6=(()=>{var Nk=Object.create;var es=Object.defineProperty;var jk=Object.getOwnPropertyDescriptor;var zk=Object.getOwnPropertyNames;var Yk=Object.getPrototypeOf,qk=Object.prototype.hasOwnProperty;var Wk=(t,e,i)=>e in t?es(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i;var Vk=(t,e)=>()=>{try{return e||t((e={exports:{}}).exports,e),e.exports}catch(i){throw e=0,i}},Gk=(t,e)=>{for(var i in e)es(t,i,{get:e[i],enumerable:!0})},mg=(t,e,i,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of zk(e))!qk.call(t,r)&&r!==i&&es(t,r,{get:()=>e[r],enumerable:!(n=jk(e,r))||n.enumerable});return t};var Uk=(t,e,i)=>(i=t!=null?Nk(Yk(t)):{},mg(e||!t||!t.__esModule?es(i,"default",{value:t,enumerable:!0}):i,t)),Fk=t=>mg(es({},"__esModule",{value:!0}),t);var K=(t,e,i)=>Wk(t,typeof e!="symbol"?e+"":e,i);var vk=Vk((MZ,wk)=>{function fk(t){return t instanceof Map?t.clear=t.delete=t.set=function(){throw new Error("map is read-only")}:t instanceof Set&&(t.add=t.clear=t.delete=function(){throw new Error("set is read-only")}),Object.freeze(t),Object.getOwnPropertyNames(t).forEach(e=>{let i=t[e],n=typeof i;(n==="object"||n==="function")&&!Object.isFrozen(i)&&fk(i)}),t}var lc=class{constructor(e){e.data===void 0&&(e.data={}),this.data=e.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}};function uk(t){return t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function on(t,...e){let i=Object.create(null);for(let n in t)i[n]=t[n];return e.forEach(function(n){for(let r in n)i[r]=n[r]}),i}var vL="</span>",sk=t=>!!t.scope,QL=(t,{prefix:e})=>{if(t.startsWith("language:"))return t.replace("language:","language-");if(t.includes(".")){let i=t.split(".");return[`${e}${i.shift()}`,...i.map((n,r)=>`${n}${"_".repeat(r+1)}`)].join(" ")}return`${e}${t}`},ng=class{constructor(e,i){this.buffer="",this.classPrefix=i.classPrefix,e.walk(this)}addText(e){this.buffer+=uk(e)}openNode(e){if(!sk(e))return;let i=QL(e.scope,{prefix:this.classPrefix});this.span(i)}closeNode(e){sk(e)&&(this.buffer+=vL)}value(){return this.buffer}span(e){this.buffer+=`<span class="${e}">`}},ok=(t={})=>{let e={children:[]};return Object.assign(e,t),e},rg=class t{constructor(){this.rootNode=ok(),this.stack=[this.rootNode]}get top(){return this.stack[this.stack.length-1]}get root(){return this.rootNode}add(e){this.top.children.push(e)}openNode(e){let i=ok({scope:e});this.add(i),this.stack.push(i)}closeNode(){if(this.stack.length>1)return this.stack.pop()}closeAllNodes(){for(;this.closeNode(););}toJSON(){return JSON.stringify(this.rootNode,null,4)}walk(e){return this.constructor._walk(e,this.rootNode)}static _walk(e,i){return typeof i=="string"?e.addText(i):i.children&&(e.openNode(i),i.children.forEach(n=>this._walk(e,n)),e.closeNode(i)),e}static _collapse(e){typeof e!="string"&&e.children&&(e.children.every(i=>typeof i=="string")?e.children=[e.children.join("")]:e.children.forEach(i=>{t._collapse(i)}))}},sg=class extends rg{constructor(e){super(),this.options=e}addText(e){e!==""&&this.add(e)}startScope(e){this.openNode(e)}endScope(){this.closeNode()}__addSublanguage(e,i){let n=e.root;i&&(n.scope=`language:${i}`),this.add(n)}toHTML(){return new ng(this,this.options).value()}finalize(){return this.closeAllNodes(),!0}};function Qo(t){return t?typeof t=="string"?t:t.source:null}function dk(t){return Hn("(?=",t,")")}function PL(t){return Hn("(?:",t,")*")}function $L(t){return Hn("(?:",t,")?")}function Hn(...t){return t.map(i=>Qo(i)).join("")}function TL(t){let e=t[t.length-1];return typeof e=="object"&&e.constructor===Object?(t.splice(t.length-1,1),e):{}}function lg(...t){return"("+(TL(t).capture?"":"?:")+t.map(n=>Qo(n)).join("|")+")"}function pk(t){return new RegExp(t.toString()+"|").exec("").length-1}function CL(t,e){let i=t&&t.exec(e);return i&&i.index===0}var AL=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function ag(t,{joinWith:e}){let i=0;return t.map(n=>{i+=1;let r=i,s=Qo(n),o="";for(;s.length>0;){let l=AL.exec(s);if(!l){o+=s;break}o+=s.substring(0,l.index),s=s.substring(l.index+l[0].length),l[0][0]==="\\"&&l[1]?o+="\\"+String(Number(l[1])+r):(o+=l[0],l[0]==="("&&i++)}return o}).map(n=>`(${n})`).join(e)}var RL=/\b\B/,gk="[a-zA-Z]\\w*",cg="[a-zA-Z_]\\w*",Ok="\\b\\d+(\\.\\d+)?",mk="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",bk="\\b(0b[01]+)",EL="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",ML=(t={})=>{let e=/^#![ ]*\//;return t.binary&&(t.begin=Hn(e,/.*\b/,t.binary,/\b.*/)),on({scope:"meta",begin:e,end:/$/,relevance:0,"on:begin":(i,n)=>{i.index!==0&&n.ignoreMatch()}},t)},Po={begin:"\\\\[\\s\\S]",relevance:0},LL={scope:"string",begin:"'",end:"'",illegal:"\\n",contains:[Po]},XL={scope:"string",begin:'"',end:'"',illegal:"\\n",contains:[Po]},_L={begin:/\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|suLine truncated
|
||||
https://github.com/highlightjs/highlight.js/issues/2277`),te=P,Y=D),V===void 0&&(V=!0);let re={code:Y,language:te};E("before:highlight",re);let J=re.result?re.result:f(re.language,re.code,V);return J.code=re.code,E("after:highlight",J),J}function f(P,D,V,Y){let te=Object.create(null);function re(B,q){return B.keywords[q]}function J(){if(!H.keywords){Ye.addText(Pe);return}let B=0;H.keywordPatternRe.lastIndex=0;let q=H.keywordPatternRe.exec(Pe),ee="";for(;q;){ee+=Pe.substring(B,q.index);let Se=ii.case_insensitive?q[0].toLowerCase():q[0],He=re(H,Se);if(He){let[yi,Ik]=He;if(Ye.addText(ee),ee="",te[Se]=(te[Se]||0)+1,te[Se]<=uX&&(Co+=Ik),yi.startsWith("_"))ee+=q[0];else{let Bk=ii.classNameAliases[yi]||yi;xe(q[0],Bk)}}else ee+=q[0];B=H.keywordPatternRe.lastIndex,q=H.keywordPatternRe.exec(Pe)}ee+=Pe.substring(B),Ye.addText(ee)}function ye(){if(Pe==="")return;let B=null;if(typeof H.subLanguage=="string"){if(!e[H.subLanguage]){Ye.addText(Pe);return}B=f(H.subLanguage,Pe,!0,Og[H.subLanguage]),Og[H.subLanguage]=B._top}else B=d(Pe,H.subLanguage.length?H.subLanguage:null);H.relevance>0&&(Co+=B.relevance),Ye.__addSublanguage(B._emitter,B.language)}function ce(){H.subLanguage!=null?ye():J(),Pe=""}function xe(B,q){B!==""&&(Ye.startScope(q),Ye.addText(B),Ye.endScope())}function dt(B,q){let ee=1,Se=q.length-1;for(;ee<=Se;){if(!B._emit[ee]){ee++;continue}let He=ii.classNameAliases[B[ee]]||B[ee],yi=q[ee];He?xe(yi,He):(Pe=yi,J(),Pe=""),ee++}}function Nt(B,q){return B.scope&&typeof B.scope=="string"&&Ye.openNode(ii.classNameAliases[B.scope]||B.scope),B.beginScope&&(B.beginScope._wrap?(xe(Pe,ii.classNameAliases[B.beginScope._wrap]||B.beginScope._wrap),Pe=""):B.beginScope._multi&&(dt(B.beginScope,q),Pe="")),H=Object.create(B,{parent:{value:H}}),H}function Jr(B,q,ee){let Se=CL(B.endRe,ee);if(Se){if(B["on:end"]){let He=new lc(B);B["on:end"](q,He),He.isMatchIgnored&&(Se=!1)}if(Se){for(;B.endsParent&&B.parent;)B=B.parent;return B}}if(B.endsWithParent)return Jr(B.parent,q,ee)}function $o(B){return H.matcher.regexIndex===0?(Pe+=B[0],1):(gc=!0,0)}function Xk(B){let q=B[0],ee=B.rule,Se=new lc(ee),He=[ee.__beforeBegin,ee["on:begin"]];for(let yi of He)if(yi&&(yi(B,Se),Se.isMatchIgnored))return $o(q);return ee.skip?Pe+=q:(ee.excludeBegin&&(Pe+=q),ce(),!ee.returnBegin&&!ee.excludeBegin&&(Pe=q)),Nt(ee,B),ee.returnBegin?0:q.length}function _k(B){let q=B[0],ee=D.substring(B.index),Se=Jr(H,B,ee);if(!Se)return hk;let He=H;H.endScope&&H.endScope._wrap?(ce(),xe(q,H.endScope._wrap)):H.endScope&&H.endScope._multi?(ce(),dt(H.endScope,B)):He.skip?Pe+=q:(He.returnEnd||He.excludeEnd||(Pe+=q),ce(),He.excludeEnd&&(Pe=q));do H.scope&&Ye.closeNode(),!H.skip&&!H.subLanguage&&(Co+=H.relevance),H=H.parent;while(H!==Se.parent);return Se.starts&&Nt(Se.starts,B),He.returnEnd?0:q.length}function Zk(){let B=[];for(let q=H;q!==ii;q=q.parent)q.scope&&B.unshift(q.scope);B.forEach(q=>Ye.openNode(q))}let To={};function gg(B,q){let ee=q&&q[0];if(Pe+=B,ee==null)return ce(),0;if(To.type==="begin"&&q.type==="end"&&To.index===q.index&&ee===""){if(Pe+=D.slice(q.index,q.index+1),!r){let Se=new Error(`0 width match regex (${P})`);throw Se.languageName=P,Se.badRule=To.rule,Se}return 1}if(To=q,q.type==="begin")return Xk(q);if(q.type==="illegal"&&!V){let Se=new Error('Illegal lexeme "'+ee+'" for mode "'+(H.scope||"<unnamed>")+'"');throw Se.mode=H,Se}else if(q.type==="end"){let Se=_k(q);if(Se!==hk)return Se}if(q.type==="illegal"&&ee==="")return Pe+=`
|
||||
`,1;if(pc>1e5&&pc>q.index*3)throw new Error("potential infinite loop, way more iterations than matches");return Pe+=ee,ee.length}let ii=C(P);if(!ii)throw Fn(s.replace("{}",P)),new Error('Unknown language: "'+P+'"');let Dk=cX(ii),dc="",H=Y||Dk,Og={},Ye=new l.__emitter(l);Zk();let Pe="",Co=0,ln=0,pc=0,gc=!1;try{if(ii.__emitTokens)ii.__emitTokens(D,Ye);else{for(H.matcher.considerAll();;){pc++,gc?gc=!1:H.matcher.considerAll(),H.matcher.lastIndex=ln;let B=H.matcher.exec(D);if(!B)break;let q=D.substring(ln,B.index),ee=gg(q,B);ln=B.index+ee}gg(D.substring(ln))}return Ye.finalize(),dc=Ye.toHTML(),{language:P,value:dc,relevance:Co,illegal:!1,_emitter:Ye,_top:H}}catch(B){if(B.message&&B.message.includes("Illegal"))return{language:P,value:ig(D),illegal:!0,relevance:0,_illegalBy:{message:B.message,index:ln,context:D.slice(ln-100,ln+100),mode:B.mode,resultSoFar:dc},_emitter:Ye};if(r)return{language:P,value:ig(D),illegal:!1,relevance:0,errorRaised:B,_emitter:Ye,_top:H};throw B}}function u(P){let D={value:ig(P),illegal:!1,relevance:0,_top:o,_emitter:new l.__emitter(l)};return D._emitter.addText(P),D}function d(P,D){D=D||l.languages||Object.keys(e);let V=u(P),Y=D.filter(C).filter(N).map(ce=>f(ce,P,!1));Y.unshift(V);let te=Y.sort((ce,xe)=>{if(ce.relevance!==xe.relevance)return xe.relevance-ce.relevance;if(ce.language&&xe.language){if(C(ce.language).supersetOf===xe.language)return 1;if(C(xe.language).supersetOf===ce.language)return-1}return 0}),[re,J]=te,ye=re;return ye.secondBest=J,ye}function p(P,D,V){let Y=D&&i[D]||V;P.classList.add("hljs"),P.classList.add(`language-${Y}`)}function g(P){let D=null,V=h(P);if(a(V))return;if(E("before:highlightElement",{el:P,language:V}),P.dataset.highlighted){console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.",P);return}if(P.children.length>0&&(l.ignoreUnescapedHTML||(console.warn("One of your code blocks includes unescaped HTML. This is a potentially serious security risk."),console.warn("https://github.com/highlightjs/highlight.js/wiki/security"),console.warn("The element with unescaped HTML:"),console.warn(P)),l.throwUnescapedHTML))throw new og("One of your code blocks includes unescaped HTML.",P.innerHTML);D=P;let Y=D.textContent,te=V?c(Y,{language:V,ignoreIllegals:!0}):d(Y);P.innerHTML=te.value,P.dataset.highlighted="yes",p(P,V,te.language),P.result={language:te.language,re:te.relevance,relevance:te.relevance},te.secondBest&&(P.secondBest={language:te.secondBest.language,relevance:te.secondBest.relevance}),E("after:highlightElement",{el:P,result:te,text:Y})}function m(P){l=ck(l,P)}let b=()=>{v(),Hr("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")};function y(){v(),Hr("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.")}let S=!1;function v(){function P(){v()}if(document.readyState==="loading"){S||window.addEventListener("DOMContentLoaded",P,!1),S=!0;return}document.querySelectorAll(l.cssSelector).forEach(g)}function x(P,D){let V=null;try{V=D(t)}catch(Y){if(Fn("Language definition for '{}' could not be registered.".replace("{}",P)),r)Fn(Y);else throw Y;V=o}V.name||(V.name=P),e[P]=V,V.rawDefinition=D.bind(null,t),V.aliases&&_(V.aliases,{languageName:P})}function w(P){delete e[P];for(let D of Object.keys(i))i[D]===P&&delete i[D]}function k(){return Object.keys(e)}function C(P){return P=(P||"").toLowerCase(),e[P]||e[i[P]]}function _(P,{languageName:D}){typeof P=="string"&&(P=[P]),P.forEach(V=>{i[V.toLowerCase()]=D})}function N(P){let D=C(P);return D&&!D.disableAutodetect}function R(P){P["before:highlightBlock"]&&!P["before:highlightElement"]&&(P["before:highlightElement"]=D=>{P["before:highlightBlock"](Object.assign({block:D.el},D))}),P["after:highlightBlock"]&&!P["after:highlightElement"]&&(P["after:highlightElement"]=D=>{P["after:highlightBlock"](Object.assign({block:D.el},D))})}function $(P){R(P),n.push(P)}function j(P){let D=n.indexOf(P);D!==-1&&n.splice(D,1)}function E(P,D){let V=P;n.forEach(function(Y){Y[V]&&Y[V](D)})}function U(P){return Hr("10.7.0","highlightBlock will be removed entirely in v12.0"),Hr("10.7.0","Please use highlightElement now."),g(P)}Object.assign(t,{highlight:c,highlightAuto:d,highlightAll:v,highlightElement:g,highlightBlock:U,configure:m,initHighlighting:b,initHighlightingOnLoad:y,registerLanguage:x,unregisterLanguage:w,listLanguages:k,getLanguage:C,registerAliases:_,autoDetection:N,inherit:ck,addPlugin:$,removePlugin:j}),t.debugMode=function(){r=!1},t.safeMode=function(){r=!0},t.versionString=fX,t.regex={concat:Hn,lookahead:dk,either:lg,optional:$L,anyNumberOfTimes:PL};for(let P in oc)typeof oc[P]=="object"&&fk(oc[P]);return Object.assign(t,oc),t},Kr=kk({});Kr.newInstance=()=>kk({});wk.exports=Kr;Kr.HighlightJS=Kr;Kr.default=Kr});var _X={};Gk(_X,{Compartment:()=>ni,EditorState:()=>he,EditorView:()=>T,HighlightStyle:()=>Vt,MergeView:()=>Ka,StreamLanguage:()=>_s,autocompletion:()=>Ub,baseExtensions:()=>kX,bracketMatching:()=>Af,closeBrackets:()=>$u,closeBracketsKeymap:()=>Tu,
Line truncated
|
||||
`){[e,i]=ir(this,e,i);let r="";for(let s=0,o=0;s<=i&&o<this.text.length;o++){let l=this.text[o],a=s+l.length;s>e&&o&&(r+=n),e<a&&i>s&&(r+=l.slice(Math.max(0,e-s),i-s)),s=a+1}return r}flatten(e){for(let i of this.text)e.push(i)}scanIdentical(){return 0}static split(e,i){let n=[],r=-1;for(let s of e)n.push(s),r+=s.length+1,n.length==32&&(i.push(new t(n,r)),n=[],r=-1);return r>-1&&i.push(new t(n,r)),i}},Jn=class t extends ie{constructor(e,i){super(),this.children=e,this.length=i,this.lines=0;for(let n of e)this.lines+=n.lines}lineInner(e,i,n,r){for(let s=0;;s++){let o=this.children[s],l=r+o.length,a=n+o.lines-1;if((i?a:l)>=e)return o.lineInner(e,i,n,r);r=l+1,n=a+1}}decompose(e,i,n,r){for(let s=0,o=0;o<=i&&s<this.children.length;s++){let l=this.children[s],a=o+l.length;if(e<=a&&i>=o){let h=r&((o<=e?1:0)|(a>=i?2:0));o>=e&&a<=i&&!h?n.push(l):l.decompose(e-o,i-o,n,h)}o=a+1}}replace(e,i,n){if([e,i]=ir(this,e,i),n.lines<this.lines)for(let r=0,s=0;r<this.children.length;r++){let o=this.children[r],l=s+o.length;if(e>=s&&i<=l){let a=o.replace(e-s,i-s,n),h=this.lines-o.lines+a.lines;if(a.lines<h>>4&&a.lines>h>>6){let c=this.children.slice();return c[r]=a,new t(c,this.length-(i-e)+n.length)}return super.replace(s,l,a)}s=l+1}return super.replace(e,i,n)}sliceString(e,i=this.length,n=`
|
||||
`){[e,i]=ir(this,e,i);let r="";for(let s=0,o=0;s<this.children.length&&o<=i;s++){let l=this.children[s],a=o+l.length;o>e&&s&&(r+=n),e<a&&i>o&&(r+=l.sliceString(e-o,i-o,n)),o=a+1}return r}flatten(e){for(let i of this.children)i.flatten(e)}scanIdentical(e,i){if(!(e instanceof t))return 0;let n=0,[r,s,o,l]=i>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;r+=i,s+=i){if(r==o||s==l)return n;let a=this.children[r],h=e.children[s];if(a!=h)return n+a.scanIdentical(h,i);n+=a.length+1}}static from(e,i=e.reduce((n,r)=>n+r.length+1,-1)){let n=0;for(let d of e)n+=d.lines;if(n<32){let d=[];for(let p of e)p.flatten(d);return new wt(d,i)}let r=Math.max(32,n>>5),s=r<<1,o=r>>1,l=[],a=0,h=-1,c=[];function f(d){let p;if(d.lines>s&&d instanceof t)for(let g of d.children)f(g);else d.lines>o&&(a>o||!a)?(u(),l.push(d)):d instanceof wt&&a&&(p=c[c.length-1])instanceof wt&&d.lines+p.lines<=32?(a+=d.lines,h+=d.length+1,c[c.length-1]=new wt(p.text.concat(d.text),p.length+1+d.length)):(a+d.lines>r&&u(),a+=d.lines,h+=d.length+1,c.push(d))}function u(){a!=0&&(l.push(c.length==1?c[0]:t.from(c,h)),h=-1,a=c.length=0)}for(let d of e)f(d);return u(),l.length==1?l[0]:new t(l,i)}};ie.empty=new wt([""],0);function Fk(t){let e=-1;for(let i of t)e+=i.length+1;return e}function Mo(t,e,i=0,n=1e9){for(let r=0,s=0,o=!0;s<t.length&&r<=n;s++){let l=t[s],a=r+l.length;a>=i&&(a>n&&(l=l.slice(0,n-r)),r<i&&(l=l.slice(i-r)),o?(e[e.length-1]+=l,o=!1):e.push(l)),r=a+1}return e}function $g(t,e,i){return Mo(t,[""],e,i)}var hn=class{constructor(e,i=1){this.dir=i,this.done=!1,this.lineBreak=!1,this.value="",this.nodes=[e],this.offsets=[i>0?1:(e instanceof wt?e.text.length:e.children.length)<<1]}nextInner(e,i){for(this.done=this.lineBreak=!1;;){let n=this.nodes.length-1,r=this.nodes[n],s=this.offsets[n],o=s>>1,l=r instanceof wt?r.text.length:r.children.length;if(o==(i>0?l:0)){if(n==0)return this.done=!0,this.value="",this;i>0&&this.offsets[n-1]++,this.nodes.pop(),this.offsets.pop()}else if((s&1)==(i>0?0:1)){if(this.offsets[n]+=i,e==0)return this.lineBreak=!0,this.value=`
|
||||
`,this;e--}else if(r instanceof wt){let a=r.text[o+(i<0?-1:0)];if(this.offsets[n]+=i,a.length>Math.max(0,e))return this.value=e==0?a:i>0?a.slice(e):a.slice(0,a.length-e),this;e-=a.length}else{let a=r.children[o+(i<0?-1:0)];e>a.length?(e-=a.length,this.offsets[n]+=i):(i<0&&this.offsets[n]--,this.nodes.push(a),this.offsets.push(i>0?1:(a instanceof wt?a.text.length:a.children.length)<<1))}}}next(e=0){return e<0&&(this.nextInner(-e,-this.dir),e=this.value.length),this.nextInner(e,this.dir)}},Lo=class{constructor(e,i,n){this.value="",this.done=!1,this.cursor=new hn(e,i>n?-1:1),this.pos=i>n?e.length:0,this.from=Math.min(i,n),this.to=Math.max(i,n)}nextInner(e,i){if(i<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;e+=Math.max(0,i<0?this.pos-this.to:this.from-this.pos);let n=i<0?this.pos-this.from:this.to-this.pos;e>n&&(e=n),n-=e;let{value:r}=this.cursor.next(e);return this.pos+=(r.length+e)*i,this.value=r.length<=n?r:i<0?r.slice(r.length-n):r.slice(0,n),this.done=!this.value,this}next(e=0){return e<0?e=Math.max(e,this.from-this.pos):e>0&&(e=Math.min(e,this.to-this.pos)),this.nextInner(e,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&this.value!=""}},Xo=class{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:i,lineBreak:n,value:r}=this.inner.next(e);return i&&this.afterBreak?(this.value="",this.afterBreak=!1):i?(this.done=!0,this.value=""):n?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=r,this.afterBreak=!1),this}get lineBreak(){return!1}};typeof Symbol!="undefined"&&(ie.prototype[Symbol.iterator]=function(){return this.iter()},hn.prototype[Symbol.iterator]=Lo.prototype[Symbol.iterator]=Xo.prototype[Symbol.iterator]=function(){return this});var Sc=class{constructor(e,i,n,r){this.from=e,this.to=i,this.number=n,this.text=r}get length(){return this.to-this.from}};function ir(t,e,i){return e=Math.max(0,Math.min(t.length,e)),[e,Math.max(e,Math.min(t.length,i))]}function Xe(t,e,i=!0,n=!0){return wg(t,e,i,n)}function Hk(t){return t>=56320&&t<57344}function Kk(t){return t>=55296&&t<56320}function We(t,e){let i=t.charCodeAt(e);if(!Kk(i)||e+1==t.length)return i;let n=t.charCodeAt(e+1);return Hk(n)?(i-55296<<10)+(n-56320)+65536:i}function os(t){return t<=65535?String.fromCharCode(t):(t-=65536,String.fromCharCode((t>>10)+55296,(t&1023)+56320))}function vt(t){return t<65536?1:2}var xc=/\r\n?|\n/,De=(function(t){return t[t.Simple=0]="Simple",t[t.TrackDel=1]="TrackDel",t[t.TrackBefore=2]="TrackBefore",t[t.TrackAfter=3]="TrackAfter",t})(De||(De={})),Si=class t{constructor(e){this.sections=e}get length(){let e=0;for(let i=0;i<this.sections.length;i+=2)e+=this.sections[i];return e}get newLength(){let e=0;for(let i=0;i<this.sections.length;i+=2){let n=this.sections[i+1];e+=n<0?this.sections[i]:n}return e}get empty(){return this.sections.length==0||this.sections.length==2&&this.sections[1]<0}iterGaps(e){for(let i=0,n=0,r=0;i<this.sections.length;){let s=this.sections[i++],o=this.sections[i++];o<0?(e(n,r,s),r+=s):r+=o,n+=s}}iterChangedRanges(e,i=!1){kc(this,e,i)}get invertedDesc(){let e=[];for(let i=0;i<this.sections.length;){let n=this.sections[i++],r=this.sections[i++];r<0?e.push(n,r):e.push(r,n)}return new t(e)}composeDesc(e){return this.empty?e:e.empty?this:Mg(this,e)}mapDesc(e,i=!1){return e.empty?this:wc(this,e,i)}mapPos(e,i=-1,n=De.Simple){let r=0,s=0;for(let o=0;o<this.sections.length;){let l=this.sections[o++],a=this.sections[o++],h=r+l;if(a<0){if(h>e)return s+(e-r);s+=l}else{if(n!=De.Simple&&h>=e&&(n==De.TrackDel&&r<e&&h>e||n==De.TrackBefore&&r<e||n==De.TrackAfter&&h>e))return null;if(h>e||h==e&&i<0&&!l)return e==r||i<0?s:s+a;s+=a}r=h}if(e>r)throw new RangeError(`Position ${e} is out of range for changeset of length ${r}`);return s}touchesRange(e,i=e){for(let n=0,r=0;n<this.sections.length&&r<=i;){let s=this.sections[n++],o=this.sections[n++],l=r+s;if(o>=0&&r<=i&&l>=e)return r<e&&l>i?"cover":!0;r=l}return!1}toString(){let e="";for(let i=0;i<this.sections.length;){let n=this.sections[i++],r=this.sections[i++];e+=(e?" ":"")+n+(r>=0?":"+r:"")}return e}toJSON(){return this.sections}static fromJSON(e){if(!Array.isArray(e)||e.length%2||e.some(i=>typeof i!="number"))throw new RangeError("Invalid JSON representation of ChangeDesc");return new t(e)}static create(e){return new t(e)}},qe=class t extends Si{constructor(e,i){super(e),this.inserted=i}apply(e){if(this.length!=e.length)throw new RangeError("Applying change set to a document with the wrong length");return kc(this,(i,n,r,s,o)=>e=e.replace(r,r+(n-i),o),!1),e}mapDesc(e,i=!1){return wc(this,e,i,!0)}invert(e){let i=this.sections.slice(),n=[];for(let r=0,s=0;r<i.length;r+=2){let o=i[r],l=i[r+1];if(l>=0){i[r]=l,i[r+1]=o;let a=r>>1;for(;n.length<a;)n.push(ie.empty);n.push(o?e.slice(s,s+o):ie.empty)}s+=o}return new t(i,n)}compose(e){return this.empty?e:e.empty?this:Mg(this,e,!0)}map(e,i=!1){return e.empty?this:wc(this,e,i,!0)}iterChanges(e,i=!1){kc(this,e,i)}get desc
Line truncated
|
||||
`}get readOnly(){return this.facet(Bg)}phrase(e,...i){for(let n of this.facet(t.phrases))if(Object.prototype.hasOwnProperty.call(n,e)){e=n[e];break}return i.length&&(e=e.replace(/\$(\$|\d*)/g,(n,r)=>{if(r=="$")return"$";let s=+(r||1);return!s||s>i.length?n:i[s-1]})),e}languageDataAt(e,i,n=-1){let r=[];for(let s of this.facet(Xg))for(let o of s(this,i,n))Object.prototype.hasOwnProperty.call(o,e)&&r.push(o[e]);return r}charCategorizer(e){return lw(this.languageDataAt("wordChars",e).join(""))}wordAt(e){let{text:i,from:n,length:r}=this.doc.lineAt(e),s=this.charCategorizer(e),o=e-n,l=e-n;for(;o>0;){let a=Xe(i,o,!1);if(s(i.slice(a,o))!=ke.Word)break;o=a}for(;l<r;){let a=Xe(i,l);if(s(i.slice(l,a))!=ke.Word)break;l=a}return o==l?null:Q.range(o+n,l+n)}};he.allowMultipleSelections=Qc;he.tabSize=L.define({combine:t=>t.length?t[0]:4});he.lineSeparator=_g;he.readOnly=Bg;he.phrases=L.define({compare(t,e){let i=Object.keys(t),n=Object.keys(e);return i.length==n.length&&i.every(r=>t[r]==e[r])}});he.languageData=Xg;he.changeFilter=Zg;he.transactionFilter=Dg;he.transactionExtender=Ig;ni.reconfigure=W.define();function Ge(t,e,i={}){let n={};for(let r of t)for(let s of Object.keys(r)){let o=r[s],l=n[s];if(l===void 0)n[s]=o;else if(!(l===o||o===void 0))if(Object.hasOwnProperty.call(i,s))n[s]=i[s](l,o);else throw new Error("Config merge conflict for field "+s)}for(let r in e)n[r]===void 0&&(n[r]=e[r]);return n}var jt=class{eq(e){return this==e}range(e,i=e){return rs.create(e,i,this)}};jt.prototype.startSide=jt.prototype.endSide=0;jt.prototype.point=!1;jt.prototype.mapMode=De.TrackDel;var rs=class t{constructor(e,i,n){this.from=e,this.to=i,this.value=n}static create(e,i,n){return new t(e,i,n)}};function Ac(t,e){return t.from-e.from||t.value.startSide-e.value.startSide}var Rc=class t{constructor(e,i,n,r){this.from=e,this.to=i,this.value=n,this.maxPoint=r}get length(){return this.to[this.to.length-1]}findIndex(e,i,n,r=0){let s=n?this.to:this.from;for(let o=r,l=s.length;;){if(o==l)return o;let a=o+l>>1,h=s[a]-e||(n?this.value[a].endSide:this.value[a].startSide)-i;if(a==o)return h>=0?o:l;h>=0?l=a:o=a+1}}between(e,i,n,r){for(let s=this.findIndex(i,-1e9,!0),o=this.findIndex(n,1e9,!1,s);s<o;s++)if(r(this.from[s]+e,this.to[s]+e,this.value[s])===!1)return!1}map(e,i){let n=[],r=[],s=[],o=-1,l=-1;for(let a=0;a<this.value.length;a++){let h=this.value[a],c=this.from[a]+e,f=this.to[a]+e,u,d;if(c==f){let p=i.mapPos(c,h.startSide,h.mapMode);if(p==null||(u=d=p,h.startSide!=h.endSide&&(d=i.mapPos(c,h.endSide),d<u)))continue}else if(u=i.mapPos(c,h.startSide),d=i.mapPos(f,h.endSide),u>d||u==d&&h.startSide>0&&h.endSide<=0)continue;(d-u||h.endSide-h.startSide)<0||(o<0&&(o=u),h.point&&(l=Math.max(l,d-u)),n.push(h),r.push(u-o),s.push(d-o))}return{mapped:n.length?new t(r,s,n,l):null,pos:o}}},se=class t{constructor(e,i,n,r){this.chunkPos=e,this.chunk=i,this.nextLayer=n,this.maxPoint=r}static create(e,i,n,r){return new t(e,i,n,r)}get length(){let e=this.chunk.length-1;return e<0?0:Math.max(this.chunkEnd(e),this.nextLayer.length)}get size(){if(this.isEmpty)return 0;let e=this.nextLayer.size;for(let i of this.chunk)e+=i.value.length;return e}chunkEnd(e){return this.chunkPos[e]+this.chunk[e].length}update(e){let{add:i=[],sort:n=!1,filterFrom:r=0,filterTo:s=this.length}=e,o=e.filter;if(i.length==0&&!o)return this;if(n&&(i=i.slice().sort(Ac)),this.isEmpty)return i.length?t.of(i):this;let l=new Io(this,null,-1).goto(0),a=0,h=[],c=new Ee;for(;l.value||a<i.length;)if(a<i.length&&(l.from-i[a].from||l.startSide-i[a].value.startSide)>=0){let f=i[a++];c.addInner(f.from,f.to,f.value)||h.push(f)}else l.rangeIndex==1&&l.chunkIndex<this.chunk.length&&(a==i.length||this.chunkEnd(l.chunkIndex)<i[a].from)&&(!o||r>this.chunkEnd(l.chunkIndex)||s<this.chunkPos[l.chunkIndex])&&c.addChunk(this.chunkPos[l.chunkIndex],this.chunk[l.chunkIndex])?l.nextChunk():((!o||r>l.to||s<l.from||o(l.from,l.to,l.value))&&(c.addInner(l.from,l.to,l.value)||h.push(rs.create(l.from,l.to,l.value))),l.next());return c.finishInner(this.nextLayer.isEmpty&&!h.length?t.empty:this.nextLayer.update({add:h,filter:o,filterFrom:r,filterTo:s}))}map(e){if(e.empty||this.isEmpty)return this;let i=[],n=[],r=-1;for(let o=0;o<this.chunk.length;o++){let l=this.chunkPos[o],a=this.chunk[o],h=e.touchesRange(l,l+a.length);if(h===!1)r=Math.max(r,a.maxPoint),i.push(a),n.push(e.mapPos(l));else if(h===!0){let{mapped:c,pos:f}=a.map(l,e);c&&(r=Math.max(r,c.maxPoint),i.push(c),n.push(f))}}let s=this.nextLayer.map(e);return i.length==0?s:new t(n,i,s||t.empty,r)}between(e,i,n){if(!this.isEmpty){for(let r=0;r<this.chunk.length;r++){let s=this.chunkPos[r],o=this.chunk[r];if(i>=s&&e<=s+o.length&&o.between(s,e-s,i-s,n)===!1)return}this.nextLayer.between(e,i,n)}}iter(e=0){return ss.from([this]).goto(e)}get isEmpty(){return this.nextLayer==this}static iter(e,i=0){return ss.from(e).goto(i)}static compare(e,i,n,r,s=-1){let o=e.filter(f=>f.maxPoint>0||!f.isEmpty&&f.maxPoint>=s),l=i.filter(f=>f.maxPoint>0||!f.isEmpty&&f.maxPoint>=s),a=Ag(o,l
Line truncated
|
||||
`)}static newName(){let e=Yg[zg]||1;return Yg[zg]=e+1,"\u037C"+e.toString(36)}static mount(e,i,n){let r=e[Xc],s=n&&n.nonce;r?s&&r.setNonce(s):r=new _c(e,s),r.mount(Array.isArray(i)?i:[i],e)}},qg=new Map,_c=class{constructor(e,i){let n=e.ownerDocument||e,r=n.defaultView;if(!e.head&&e.adoptedStyleSheets&&r.CSSStyleSheet){let s=qg.get(n);if(s)return e[Xc]=s;this.sheet=new r.CSSStyleSheet,qg.set(n,this)}else this.styleTag=n.createElement("style"),i&&this.styleTag.setAttribute("nonce",i);this.modules=[],e[Xc]=this}mount(e,i){let n=this.sheet,r=0,s=0;for(let o=0;o<e.length;o++){let l=e[o],a=this.modules.indexOf(l);if(a<s&&a>-1&&(this.modules.splice(a,1),s--,a=-1),a==-1){if(this.modules.splice(s++,0,l),n)for(let h=0;h<l.rules.length;h++)n.insertRule(l.rules[h],r++)}else{for(;s<a;)r+=this.modules[s++].rules.length;r+=l.rules.length,s++}}if(n)i.adoptedStyleSheets.indexOf(this.sheet)<0&&(i.adoptedStyleSheets=[this.sheet,...i.adoptedStyleSheets]);else{let o="";for(let a=0;a<this.modules.length;a++)o+=this.modules[a].getRules()+`
|
||||
`;this.styleTag.textContent=o;let l=i.head||i;this.styleTag.parentNode!=l&&l.insertBefore(this.styleTag,l.firstChild)}}setNonce(e){this.styleTag&&this.styleTag.getAttribute("nonce")!=e&&this.styleTag.setAttribute("nonce",e)}};var xi={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},nr={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},cw=typeof navigator!="undefined"&&/Mac/.test(navigator.platform),hw=typeof navigator!="undefined"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(_e=0;_e<10;_e++)xi[48+_e]=xi[96+_e]=String(_e);var _e;for(_e=1;_e<=24;_e++)xi[_e+111]="F"+_e;var _e;for(_e=65;_e<=90;_e++)xi[_e]=String.fromCharCode(_e+32),nr[_e]=String.fromCharCode(_e);var _e;for(No in xi)nr.hasOwnProperty(No)||(nr[No]=xi[No]);var No;function Wg(t){var e=cw&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||hw&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",i=!e&&t.key||(t.shiftKey?nr:xi)[t.keyCode]||t.key||"Unidentified";return i=="Esc"&&(i="Escape"),i=="Del"&&(i="Delete"),i=="Left"&&(i="ArrowLeft"),i=="Up"&&(i="ArrowUp"),i=="Right"&&(i="ArrowRight"),i=="Down"&&(i="ArrowDown"),i}function Oe(){var t=arguments[0];typeof t=="string"&&(t=document.createElement(t));var e=1,i=arguments[1];if(i&&typeof i=="object"&&i.nodeType==null&&!Array.isArray(i)){for(var n in i)if(Object.prototype.hasOwnProperty.call(i,n)){var r=i[n];typeof r=="string"?t.setAttribute(n,r):r!=null&&(t[n]=r)}e++}for(;e<arguments.length;e++)Vg(t,arguments[e]);return t}function Vg(t,e){if(typeof e=="string")t.appendChild(document.createTextNode(e));else if(e!=null)if(e.nodeType!=null)t.appendChild(e);else if(Array.isArray(e))for(var i=0;i<e.length;i++)Vg(t,e[i]);else throw new RangeError("Unsupported child node: "+e)}var st=typeof navigator!="undefined"?navigator:{userAgent:"",vendor:"",platform:""},Yc=typeof document!="undefined"?document:{documentElement:{style:{}}},qc=/Edge\/(\d+)/.exec(st.userAgent),_O=/MSIE \d/.test(st.userAgent),Wc=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(st.userAgent),yl=!!(_O||Wc||qc),Gg=!yl&&/gecko\/(\d+)/i.test(st.userAgent),Zc=!yl&&/Chrome\/(\d+)/.exec(st.userAgent),Ug="webkitFontSmoothing"in Yc.documentElement.style,Vc=!yl&&/Apple Computer/.test(st.vendor),Fg=Vc&&(/Mobile\/\w+/.test(st.userAgent)||st.maxTouchPoints>2),I={mac:Fg||/Mac/.test(st.platform),windows:/Win/.test(st.platform),linux:/Linux|X11/.test(st.platform),ie:yl,ie_version:_O?Yc.documentMode||6:Wc?+Wc[1]:qc?+qc[1]:0,gecko:Gg,gecko_version:Gg?+(/Firefox\/(\d+)/.exec(st.userAgent)||[0,0])[1]:0,chrome:!!Zc,chrome_version:Zc?+Zc[1]:0,ios:Fg,android:/Android\b/.test(st.userAgent),webkit:Ug,webkit_version:Ug?+(/\bAppleWebKit\/(\d+)/.exec(st.userAgent)||[0,0])[1]:0,safari:Vc,safari_version:Vc?+(/\bVersion\/(\d+(\.\d+)?)/.exec(st.userAgent)||[0,0])[1]:0,tabSize:Yc.documentElement.style.tabSize!=null?"tab-size":"-moz-tab-size"};function ys(t){let e;return t.nodeType==11?e=t.getSelection?t:t.ownerDocument:e=t,e.getSelection()}function Gc(t,e){return e?t==e||t.contains(e.nodeType!=1?e.parentNode:e):!1}function Ko(t,e){if(!e.anchorNode)return!1;try{return Gc(t,e.anchorNode)}catch{return!1}}function cr(t){return t.nodeType==3?gn(t,0,t.nodeValue.length).getClientRects():t.nodeType==1?t.getClientRects():[]}function fs(t,e,i,n){return i?Hg(t,e,i,n,-1)||Hg(t,e,i,n,1):!1}function pn(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e}function rl(t){return t.nodeType==1&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(t.nodeName)}function Hg(t,e,i,n,r){for(;;){if(t==i&&e==n)return!0;if(e==(r<0?0:ai(t))){if(t.nodeName=="DIV")return!1;let s=t.parentNode;if(!s||s.nodeType!=1)return!1;e=pn(t)+(r<0?0:1),t=s}else if(t.nodeType==1){if(t=t.childNodes[e+(r<0?-1:0)],t.nodeType==1&&t.contentEditable=="false")return!1;e=r<0?ai(t):0}else return!1}}function ai(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function $s(t,e){let i=e?t.left:t.right;return{left:i,right:i,top:t.top,bottom:t.bottom}}function fw(t){let e=t.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:t.innerWidth,top:0,bottom:t.innerHeight}}function ZO(t,e){let i=e.width/t.offsetWidth,n=e.height/t.offsetHeight;return(i>.995&&i<1.005||!isFinite(i)||Math.abs(e.width-t.offsetWidth)<1)&&(i=1),(n>.995&&n<1.005||!isFinite(n)||Math.abs(e.height-t.offsetHeight)<1)&&(n=1),{scaleX:i,scaleY:n}}function uw(t,e,i,n,r,Line truncated
|
||||
`,r=t.state.doc.line(r.number+(i?1:-1)),s=t.bidiSpans(r),h=t.visualLineSide(r,!i)}if(a){if(!a(c))return l}else{if(!n)return h;a=n(c)}l=h}}function qw(t,e,i){let n=t.state.charCategorizer(e),r=n(i);return s=>{let o=n(s);return r==ke.Space&&(r=o),r==o}}function Ww(t,e,i,n){let r=e.head,s=i?1:-1;if(r==(i?t.state.doc.length:0))return Q.cursor(r,e.assoc);let o=e.goalColumn,l,a=t.contentDOM.getBoundingClientRect(),h=t.coordsAtPos(r,e.assoc||-1),c=t.documentTop;if(h)o==null&&(o=h.left-a.left),l=s<0?h.top:h.bottom;else{let d=t.viewState.lineBlockAt(r);o==null&&(o=Math.min(a.right-a.left,t.defaultCharacterWidth*(r-d.from))),l=(s<0?d.top:d.bottom)+c}let f=a.left+o,u=n!=null?n:t.viewState.heightOracle.textHeight>>1;for(let d=0;;d+=10){let p=l+(u+d)*s,g=gm(t,{x:f,y:p},!1,s);if(p<a.top||p>a.bottom||(s<0?g<r:g>r)){let m=t.docView.coordsForChar(g),b=!m||p<m.top?-1:1;return Q.cursor(g,b,void 0,o)}}}function gs(t,e,i){for(;;){let n=0;for(let r of t)r.between(e-1,e+1,(s,o,l)=>{if(e>s&&e<o){let a=n||i||(e-s<o-e?-1:1);e=a<0?s:o,n=a}});if(!n)return e}}function mm(t,e){let i=null;for(let n=0;n<e.ranges.length;n++){let r=e.ranges[n],s=null;if(r.empty){let o=gs(t,r.from,0);o!=r.from&&(s=Q.cursor(o,-1))}else{let o=gs(t,r.from,-1),l=gs(t,r.to,1);(o!=r.from||l!=r.to)&&(s=Q.range(r.from==r.anchor?o:l,r.from==r.head?o:l))}s&&(i||(i=e.ranges.slice()),i[n]=s)}return i?Q.create(i,e.mainIndex):e}function Ic(t,e,i){let n=gs(t.state.facet(Ts).map(r=>r(t)),i.from,e.head>i.from?-1:1);return n==i.from?i:Q.cursor(n,n<i.from?1:-1)}var as="\uFFFF",rh=class{constructor(e,i){this.points=e,this.text="",this.lineSeparator=i.facet(he.lineSeparator)}append(e){this.text+=e}lineBreak(){this.text+=as}readRange(e,i){if(!e)return this;let n=e.parentNode;for(let r=e;;){this.findPointBefore(n,r);let s=this.text.length;this.readNode(r);let o=r.nextSibling;if(o==i)break;let l=Qe.get(r),a=Qe.get(o);(l&&a?l.breakAfter:(l?l.breakAfter:rl(r))||rl(o)&&(r.nodeName!="BR"||r.cmIgnore)&&this.text.length>s)&&!Gw(o,i)&&this.lineBreak(),r=o}return this.findPointBefore(n,i),this}readTextNode(e){let i=e.nodeValue;for(let n of this.points)n.node==e&&(n.pos=this.text.length+Math.min(n.offset,i.length));for(let n=0,r=this.lineSeparator?null:/\r\n?|\n/g;;){let s=-1,o=1,l;if(this.lineSeparator?(s=i.indexOf(this.lineSeparator,n),o=this.lineSeparator.length):(l=r.exec(i))&&(s=l.index,o=l[0].length),this.append(i.slice(n,s<0?i.length:s)),s<0)break;if(this.lineBreak(),o>1)for(let a of this.points)a.node==e&&a.pos>this.text.length&&(a.pos-=o-1);n=s+o}}readNode(e){if(e.cmIgnore)return;let i=Qe.get(e),n=i&&i.overrideDOMText;if(n!=null){this.findPointInside(e,n.length);for(let r=n.iter();!r.next().done;)r.lineBreak?this.lineBreak():this.append(r.value)}else e.nodeType==3?this.readTextNode(e):e.nodeName=="BR"?e.nextSibling&&this.lineBreak():e.nodeType==1&&this.readRange(e.firstChild,null)}findPointBefore(e,i){for(let n of this.points)n.node==e&&e.childNodes[n.offset]==i&&(n.pos=this.text.length)}findPointInside(e,i){for(let n of this.points)(e.nodeType==3?n.node==e:e.contains(n.node))&&(n.pos=this.text.length+(Vw(e,n.node,n.offset)?i:0))}};function Vw(t,e,i){for(;;){if(!e||i<ai(e))return!1;if(e==t)return!0;i=pn(e)+1,e=e.parentNode}}function Gw(t,e){let i;for(;!(t==e||!t);t=t.nextSibling){let n=Qe.get(t);if(!(n!=null&&n.isWidget||t.cmIgnore))return!1;n&&(i||(i=[])).push(n)}if(i)for(let n of i){let r=n.overrideDOMText;if(r!=null&&r.length)return!1}return!0}var cl=class{constructor(e,i){this.node=e,this.offset=i,this.pos=-1}},sh=class{constructor(e,i,n,r){this.typeOver=r,this.bounds=null,this.text="",this.domChanged=i>-1;let{impreciseHead:s,impreciseAnchor:o}=e.docView;if(e.state.readOnly&&i>-1)this.newSel=null;else if(i>-1&&(this.bounds=e.docView.domBoundsAround(i,n,0))){let l=s||o?[]:Fw(e),a=new rh(l,e.state);a.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=a.text,this.newSel=Hw(l,this.bounds.from)}else{let l=e.observer.selectionRange,a=s&&s.node==l.focusNode&&s.offset==l.focusOffset||!Gc(e.contentDOM,l.focusNode)?e.state.selection.main.head:e.docView.posFromDOM(l.focusNode,l.focusOffset),h=o&&o.node==l.anchorNode&&o.offset==l.anchorOffset||!Gc(e.contentDOM,l.anchorNode)?e.state.selection.main.anchor:e.docView.posFromDOM(l.anchorNode,l.anchorOffset),c=e.viewport;if((I.ios||I.chrome)&&e.state.selection.main.empty&&a!=h&&(c.from>0||c.to<e.state.doc.length)){let f=Math.min(a,h),u=Math.max(a,h),d=c.from-f,p=c.to-u;(d==0||d==1||f==0)&&(p==0||p==-1||u==e.state.doc.length)&&(a=0,h=e.state.doc.length)}e.inputState.composing>-1&&e.state.selection.ranges.length>1?this.newSel=e.state.selection.replaceRange(Q.range(h,a)):this.newSel=Q.single(h,a)}}};function bm(t,e){let i,{newSel:n}=e,r=t.state.selection.main,s=t.inputState.lastKeyTime>Date.now()-100?t.inputState.lastKeyCode:-1;if(e.bounds){let{from:o,to:l}=e.bounds,a=r.from,h=null;(s===8||I.android&&e.text.length<l-o)&&(a=r.to,h="end");let c=ym(t.state.doc.sliceString(o,l,as),e.text,a-o,h);c&&(I.chrome&&s==13&&c.toB==c.from+2&&e.text.sl
Line truncated
|
||||
`&&t.lineWrapping&&(n&&(n=Q.single(n.main.anchor-1,n.main.head-1)),i={from:r.from,to:r.to,insert:ie.of([" "])}),i)return Ih(t,i,n,s);if(n&&!n.main.eq(r)){let o=!1,l="select";return t.inputState.lastSelectionTime>Date.now()-50&&(t.inputState.lastSelectionOrigin=="select"&&(o=!0),l=t.inputState.lastSelectionOrigin,l=="select.pointer"&&(n=mm(t.state.facet(Ts).map(a=>a(t)),n))),t.dispatch({selection:n,scrollIntoView:o,userEvent:l}),!0}else return!1}function Ih(t,e,i,n=-1){if(I.ios&&t.inputState.flushIOSKey(e))return!0;let r=t.state.selection.main;if(I.android&&(e.to==r.to&&(e.from==r.from||e.from==r.from-1&&t.state.sliceDoc(e.from,r.from)==" ")&&e.insert.length==1&&e.insert.lines==2&&ar(t.contentDOM,"Enter",13)||(e.from==r.from-1&&e.to==r.to&&e.insert.length==0||n==8&&e.insert.length<e.to-e.from&&e.to>r.head)&&ar(t.contentDOM,"Backspace",8)||e.from==r.from&&e.to==r.to+1&&e.insert.length==0&&ar(t.contentDOM,"Delete",46)))return!0;let s=e.insert.toString();t.inputState.composing>=0&&t.inputState.composing++;let o,l=()=>o||(o=Uw(t,e,i));return t.state.facet(rm).some(a=>a(t,e.from,e.to,s,l))||t.dispatch(l()),!0}function Uw(t,e,i){let n,r=t.state,s=r.selection.main,o=-1;if(e.from==e.to&&e.from<s.from||e.from>s.to){let a=e.from<s.from?-1:1,h=a<0?s.from:s.to,c=gs(r.facet(Ts).map(f=>f(t)),h,a);e.from==c&&(o=c)}if(o>-1)n={changes:e,selection:Q.cursor(e.from+e.insert.length,-1)};else if(e.from>=s.from&&e.to<=s.to&&e.to-e.from>=(s.to-s.from)/3&&(!i||i.main.empty&&i.main.from==e.from+e.insert.length)&&t.inputState.composing<0){let a=s.from<e.from?r.sliceDoc(s.from,e.from):"",h=s.to>e.to?r.sliceDoc(e.to,s.to):"";n=r.replaceSelection(t.state.toText(a+e.insert.sliceString(0,void 0,t.state.lineBreak)+h))}else{let a=r.changes(e),h=i&&i.main.to<=a.newLength?i.main:void 0;if(r.selection.ranges.length>1&&(t.inputState.composing>=0||t.inputState.compositionPendingChange)&&e.to<=s.to+10&&e.to>=s.to-10){let c=t.state.sliceDoc(e.from,e.to),f,u=i&&pm(t,i.main.head);if(u){let p=e.insert.length-(e.to-e.from);f={from:u.from,to:u.to-p}}else f=t.state.doc.lineAt(s.head);let d=s.to-e.to;n=r.changeByRange(p=>{if(p.from==s.from&&p.to==s.to)return{changes:a,range:h||p.map(a)};let g=p.to-d,m=g-c.length;if(t.state.sliceDoc(m,g)!=c||g>=f.from&&m<=f.to)return{range:p};let b=r.changes({from:m,to:g,insert:e.insert}),y=p.to-s.to;return{changes:b,range:h?Q.range(Math.max(0,h.anchor+y),Math.max(0,h.head+y)):p.map(b)}})}else n={changes:a,selection:h&&r.selection.replaceRange(h)}}let l="input.type";return(t.composing||t.inputState.compositionPendingChange&&t.inputState.compositionEndedAt>Date.now()-50)&&(t.inputState.compositionPendingChange=!1,l+=".compose",t.inputState.compositionFirstChange&&(l+=".start",t.inputState.compositionFirstChange=!1)),r.update(n,{userEvent:l,scrollIntoView:!0})}function ym(t,e,i,n){let r=Math.min(t.length,e.length),s=0;for(;s<r&&t.charCodeAt(s)==e.charCodeAt(s);)s++;if(s==r&&t.length==e.length)return null;let o=t.length,l=e.length;for(;o>0&&l>0&&t.charCodeAt(o-1)==e.charCodeAt(l-1);)o--,l--;if(n=="end"){let a=Math.max(0,s-Math.min(o,l));i-=o+a-s}if(o<s&&t.length<e.length){let a=i<=s&&i>=o?s-i:0;s-=a,l=s+(l-o),o=s}else if(l<s){let a=i<=s&&i>=l?s-i:0;s-=a,o=s+(o-l),l=s}return{from:s,toA:o,toB:l}}function Fw(t){let e=[];if(t.root.activeElement!=t.contentDOM)return e;let{anchorNode:i,anchorOffset:n,focusNode:r,focusOffset:s}=t.observer.selectionRange;return i&&(e.push(new cl(i,n)),(r!=i||s!=n)&&e.push(new cl(r,s))),e}function Hw(t,e){if(t.length==0)return null;let i=t[0].pos,n=t.length==2?t[1].pos:i;return i>-1&&n>-1?Q.single(i+e,n+e):null}var oh=class{setSelectionOrigin(e){this.lastSelectionOrigin=e,this.lastSelectionTime=Date.now()}constructor(e){this.view=e,this.lastKeyCode=0,this.lastKeyTime=0,this.lastTouchTime=0,this.lastFocusTime=0,this.lastScrollTop=0,this.lastScrollLeft=0,this.pendingIOSKey=void 0,this.tabFocusMode=-1,this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastContextMenu=0,this.scrollHandlers=[],this.handlers=Object.create(null),this.composing=-1,this.compositionFirstChange=null,this.compositionEndedAt=0,this.compositionPendingKey=!1,this.compositionPendingChange=!1,this.insertingText="",this.insertingTextAt=0,this.mouseSelection=null,this.draggedContent=null,this.handleEvent=this.handleEvent.bind(this),this.notifiedFocused=e.hasFocus,I.safari&&e.contentDOM.addEventListener("input",()=>null),I.gecko&&uv(e.contentDOM.ownerDocument)}handleEvent(e){!rv(this.view,e)||this.ignoreDuringComposition(e)||e.type=="keydown"&&this.keydown(e)||(this.view.updateState!=0?Promise.resolve().then(()=>this.runHandlers(e.type,e)):this.runHandlers(e.type,e))}runHandlers(e,i){let n=this.handlers[e];if(n){for(let r of n.observers)r(this.view,i);for(let r of n.handlers){if(i.defaultPrevented)break;if(r(this.view,i)){i.preventDefault();break}}}}ensureHandlers(e){let i=Kw(e),n=this.handlers,r=this.view.contentDOM;for(let s in i)if(s!="scroll"){let o=!i[s].handlers.length,l=n[s];l&&o!=!l.handlers.length&&(r.removeEventListe
Line truncated
|
||||
`))};if((I.mac||I.android)&&f.from==o-1&&/^\. ?$/.test(n.text)&&e.contentDOM.getAttribute("autocorrect")=="off"&&(f={from:l,to:a,insert:ie.of([n.text.replace("."," ")])}),this.pendingContextChange=f,!e.state.readOnly){let u=this.to-this.from+(f.to-f.from+f.insert.length);Ih(e,f,Q.single(this.toEditorPos(n.selectionStart,u),this.toEditorPos(n.selectionEnd,u)))}this.pendingContextChange&&(this.revertPending(e.state),this.setSelection(e.state)),f.from<f.to&&!f.insert.length&&e.inputState.composing>=0&&!/[\\p{Alphabetic}\\p{Number}_]/.test(i.text.slice(Math.max(0,n.updateRangeStart-1),Math.min(i.text.length,n.updateRangeStart+1)))&&this.handlers.compositionend(n)},this.handlers.characterboundsupdate=n=>{let r=[],s=null;for(let o=this.toEditorPos(n.rangeStart),l=this.toEditorPos(n.rangeEnd);o<l;o++){let a=e.coordsForChar(o);s=a&&new DOMRect(a.left,a.top,a.right-a.left,a.bottom-a.top)||s||new DOMRect,r.push(s)}i.updateCharacterBounds(n.rangeStart,r)},this.handlers.textformatupdate=n=>{let r=[];for(let s of n.getTextFormats()){let o=s.underlineStyle,l=s.underlineThickness;if(!/none/i.test(o)&&!/none/i.test(l)){let a=this.toEditorPos(s.rangeStart),h=this.toEditorPos(s.rangeEnd);if(a<h){let c=`text-decoration: underline ${/^[a-z]/.test(o)?o+" ":o=="Dashed"?"dashed ":o=="Squiggle"?"wavy ":""}${/thin/i.test(l)?1:2}px`;r.push(X.mark({attributes:{style:c}}).range(a,h))}}}e.dispatch({effects:cm.of(X.set(r))})},this.handlers.compositionstart=()=>{e.inputState.composing<0&&(e.inputState.composing=0,e.inputState.compositionFirstChange=!0)},this.handlers.compositionend=()=>{if(e.inputState.composing=-1,e.inputState.compositionFirstChange=null,this.composing){let{drifted:n}=this.composing;this.composing=null,n&&this.reset(e.state)}};for(let n in this.handlers)i.addEventListener(n,this.handlers[n]);this.measureReq={read:n=>{this.editContext.updateControlBounds(n.contentDOM.getBoundingClientRect());let r=ys(n.root);r&&r.rangeCount&&this.editContext.updateSelectionBounds(r.getRangeAt(0).getBoundingClientRect())}}}applyEdits(e){let i=0,n=!1,r=this.pendingContextChange;return e.changes.iterChanges((s,o,l,a,h)=>{if(n)return;let c=h.length-(o-s);if(r&&o>=r.to)if(r.from==s&&r.to==o&&r.insert.eq(h)){r=this.pendingContextChange=null,i+=c,this.to+=c;return}else r=null,this.revertPending(e.state);if(s+=i,o+=i,o<=this.from)this.from+=c,this.to+=c;else if(s<this.to){if(s<this.from||o>this.to||this.to-this.from+h.length>3e4){n=!0;return}this.editContext.updateText(this.toContextPos(s),this.toContextPos(o),h.toString()),this.to+=c}i+=c}),r&&!n&&this.revertPending(e.state),!n}update(e){let i=this.pendingContextChange,n=e.startState.selection.main;this.composing&&(this.composing.drifted||!e.changes.touchesRange(n.from,n.to)&&e.transactions.some(r=>!r.isUserEvent("input.type")&&r.changes.touchesRange(this.from,this.to)))?(this.composing.drifted=!0,this.composing.editorBase=e.changes.mapPos(this.composing.editorBase)):!this.applyEdits(e)||!this.rangeIsValid(e.state)?(this.pendingContextChange=null,this.reset(e.state)):(e.docChanged||e.selectionSet||i)&&this.setSelection(e.state),(e.geometryChanged||e.docChanged||e.selectionSet)&&e.view.requestMeasure(this.measureReq)}resetRange(e){let{head:i}=e.selection.main;this.from=Math.max(0,i-1e4),this.to=Math.min(e.doc.length,i+1e4)}reset(e){this.resetRange(e),this.editContext.updateText(0,this.editContext.text.length,e.doc.sliceString(this.from,this.to)),this.setSelection(e)}revertPending(e){let i=this.pendingContextChange;this.pendingContextChange=null,this.editContext.updateText(this.toContextPos(i.from),this.toContextPos(i.from+i.insert.length),e.doc.sliceString(i.from,i.to))}setSelection(e){let{main:i}=e.selection,n=this.toContextPos(Math.max(this.from,Math.min(this.to,i.anchor))),r=this.toContextPos(i.head);(this.editContext.selectionStart!=n||this.editContext.selectionEnd!=r)&&this.editContext.updateSelection(n,r)}rangeIsValid(e){let{head:i}=e.selection.main;return!(this.from>0&&i-this.from<500||this.to<e.doc.length&&this.to-i<500||this.to-this.from>1e4*3)}toEditorPos(e,i=this.to-this.from){e=Math.min(e,i);let n=this.composing;return n&&n.drifted?n.editorBase+(e-n.contextBase):e+this.from}toContextPos(e){let i=this.composing;return i&&i.drifted?i.contextBase+(e-i.editorBase):e-this.from}destroy(){for(let e in this.handlers)this.editContext.removeEventListener(e,this.handlers[e])}},T=class t{get state(){return this.viewState.state}get viewport(){return this.viewState.viewport}get visibleRanges(){return this.viewState.visibleRanges}get inView(){return this.viewState.inView}get composing(){return!!this.inputState&&this.inputState.composing>0}get compositionStarted(){return!!this.inputState&&this.inputState.composing>=0}get root(){return this._root}get win(){return this.dom.ownerDocument.defaultView||window}constructor(e={}){var i;this.plugins=[],this.pluginMap=new Map,this.editorAttrs={},this.contentAttrs={},this.bidiCache=[],this.destroyed=!1,this.updateState=2,this.measureScheduled=-1,this.measureR
Line truncated
|
||||
-\x7F-\x9F\xAD\u061C\u200B\u200E\u200F\u2028\u2029\u202D\u202E\u2066\u2067\u2069\uFEFF\uFFF9-\uFFFC]`,vh),Zv={0:"null",7:"bell",8:"backspace",10:"newline",11:"vertical tab",13:"carriage return",27:"escape",8203:"zero width space",8204:"zero width non-joiner",8205:"zero width joiner",8206:"left-to-right mark",8207:"right-to-left mark",8232:"line separator",8237:"left-to-right override",8238:"right-to-left override",8294:"left-to-right isolate",8295:"right-to-left isolate",8297:"pop directional isolate",8233:"paragraph separator",65279:"zero width no-break space",65532:"object replacement"},Nc=null;function Dv(){var t;if(Nc==null&&typeof document!="undefined"&&document.body){let e=document.body.style;Nc=((t=e.tabSize)!==null&&t!==void 0?t:e.MozTabSize)!=null}return Nc||!1}var il=L.define({combine(t){let e=Ge(t,{render:null,specialChars:_v,addSpecialChars:null});return(e.replaceTabs=!Dv())&&(e.specialChars=new RegExp(" |"+e.specialChars.source,vh)),e.addSpecialChars&&(e.specialChars=new RegExp(e.specialChars.source+"|"+e.addSpecialChars.source,vh)),e}});function jh(t={}){return[il.of(t),Iv()]}var TO=null;function Iv(){return TO||(TO=me.fromClass(class{constructor(t){this.view=t,this.decorations=X.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(t.state.facet(il)),this.decorations=this.decorator.createDeco(t)}makeDecorator(t){return new wh({regexp:t.specialChars,decoration:(e,i,n)=>{let{doc:r}=i.state,s=We(e[0],0);if(s==9){let o=r.lineAt(n),l=i.state.tabSize,a=rt(o.text,l,n-o.from);return X.replace({widget:new Ph((l-a%l)*this.view.defaultCharacterWidth/this.view.scaleX)})}return this.decorationCache[s]||(this.decorationCache[s]=X.replace({widget:new Qh(t,s)}))},boundary:t.replaceTabs?void 0:/[^]/})}update(t){let e=t.state.facet(il);t.startState.facet(il)!=e?(this.decorator=this.makeDecorator(e),this.decorations=this.decorator.createDeco(t.view)):this.decorations=this.decorator.updateDeco(t,this.decorations)}},{decorations:t=>t.decorations}))}var Bv="\u2022";function Nv(t){return t>=32?Bv:t==10?"\u2424":String.fromCharCode(9216+t)}var Qh=class extends Be{constructor(e,i){super(),this.options=e,this.code=i}eq(e){return e.code==this.code}toDOM(e){let i=Nv(this.code),n=e.state.phrase("Control character")+" "+(Zv[this.code]||"0x"+this.code.toString(16)),r=this.options.render&&this.options.render(this.code,n,i);if(r)return r;let s=document.createElement("span");return s.textContent=i,s.title=n,s.setAttribute("aria-label",n),s.className="cm-specialChar",s}ignoreEvent(){return!1}},Ph=class extends Be{constructor(e){super(),this.width=e}eq(e){return e.width==this.width}toDOM(){let e=document.createElement("span");return e.textContent=" ",e.className="cm-tab",e.style.width=this.width+"px",e}ignoreEvent(){return!1}};function zh(){return zv}var jv=X.line({class:"cm-activeLine"}),zv=me.fromClass(class{constructor(t){this.decorations=this.getDeco(t)}update(t){(t.docChanged||t.selectionSet)&&(this.decorations=this.getDeco(t.view))}getDeco(t){let e=-1,i=[];for(let n of t.state.selection.ranges){let r=t.lineBlockAt(n.head);r.from>e&&(i.push(jv.range(r.from)),e=r.from)}return X.set(i)}},{decorations:t=>t.decorations}),$h=class extends Be{constructor(e){super(),this.content=e}toDOM(e){let i=document.createElement("span");return i.className="cm-placeholder",i.style.pointerEvents="none",i.appendChild(typeof this.content=="string"?document.createTextNode(this.content):typeof this.content=="function"?this.content(e):this.content.cloneNode(!0)),i.setAttribute("aria-hidden","true"),i}coordsAt(e){let i=e.firstChild?cr(e.firstChild):[];if(!i.length)return null;let n=window.getComputedStyle(e.parentNode),r=$s(i[0],n.direction!="rtl"),s=parseInt(n.lineHeight);return r.bottom-r.top>s*1.5?{left:r.left,right:r.right,top:r.top,bottom:r.top+s}:r}ignoreEvent(){return!1}};function Dm(t){let e=me.fromClass(class{constructor(i){this.view=i,this.placeholder=t?X.set([X.widget({widget:new $h(t),side:1}).range(0)]):X.none}get decorations(){return this.view.state.doc.length?X.none:this.placeholder}},{decorations:i=>i.decorations});return typeof t=="string"?[e,T.contentAttributes.of({"aria-placeholder":t})]:e}var Th=2e3;function Yv(t,e,i){let n=Math.min(e.line,i.line),r=Math.max(e.line,i.line),s=[];if(e.off>Th||i.off>Th||e.col<0||i.col<0){let o=Math.min(e.off,i.off),l=Math.max(e.off,i.off);for(let a=n;a<=r;a++){let h=t.doc.line(a);h.length<=l&&s.push(Q.range(h.from+o,h.to+l))}}else{let o=Math.min(e.col,i.col),l=Math.max(e.col,i.col);for(let a=n;a<=r;a++){let h=t.doc.line(a),c=Bo(h.text,o,t.tabSize,!0);if(c<0)s.push(Q.cursor(h.to));else{let f=Bo(h.text,l,t.tabSize);s.push(Q.range(h.from+c,h.from+f))}}}return s}function qv(t,e){let i=t.coordsAtPos(t.viewport.from);return i?Math.round(Math.abs((i.left-e)/t.defaultCharacterWidth)):-1}function CO(t,e){let i=t.posAtCoords({x:e.clientX,y:e.clientY},!1),n=t.state.doc.lineAt(i),r=i-n.from,s=r>Th?-1:r==n.length?qv(t,e.clientX):rt(n.text,t.state.tabSize,i-n.from);return{line:n.numbe
Line truncated
|
||||
`){[e,i]=ir(this,e,i);let r="";for(let s=0,o=0;s<this.children.length&&o<=i;s++){let l=this.children[s],a=o+l.length;o>e&&s&&(r+=n),e<a&&i>o&&(r+=l.sliceString(e-o,i-o,n)),o=a+1}return r}flatten(e){for(let i of this.children)i.flatten(e)}scanIdentical(e,i){if(!(e instanceof t))return 0;let n=0,[r,s,o,l]=i>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;r+=i,s+=i){if(r==o||s==l)return n;let a=this.children[r],h=e.children[s];if(a!=h)return n+a.scanIdentical(h,i);n+=a.length+1}}static from(e,i=e.reduce((n,r)=>n+r.length+1,-1)){let n=0;for(let d of e)n+=d.lines;if(n<32){let d=[];for(let p of e)p.flatten(d);return new wt(d,i)}let r=Math.max(32,n>>5),s=r<<1,o=r>>1,l=[],a=0,h=-1,c=[];function f(d){let p;if(d.lines>s&&d instanceof t)for(let g of d.children)f(g);else d.lines>o&&(a>o||!a)?(u(),l.push(d)):d instanceof wt&&a&&(p=c[c.length-1])instanceof wt&&d.lines+p.lines<=32?(a+=d.lines,h+=d.length+1,c[c.length-1]=new wt(p.text.concat(d.text),p.length+1+d.length)):(a+d.lines>r&&u(),a+=d.lines,h+=d.length+1,c.push(d))}function u(){a!=0&&(l.push(c.length==1?c[0]:t.from(c,h)),h=-1,a=c.length=0)}for(let d of e)f(d);return u(),l.length==1?l[0]:new t(l,i)}};ie.empty=new wt([""],0);function Jk(t){let e=-1;for(let i of t)e+=i.length+1;return e}function Eo(t,e,i=0,n=1e9){for(let r=0,s=0,o=!0;s<t.length&&r<=n;s++){let l=t[s],a=r+l.length;a>=i&&(a>n&&(l=l.slice(0,n-r)),r<i&&(l=l.slice(i-r)),o?(e[e.length-1]+=l,o=!1):e.push(l)),r=a+1}return e}function Pg(t,e,i){return Eo(t,[""],e,i)}var hn=class{constructor(e,i=1){this.dir=i,this.done=!1,this.lineBreak=!1,this.value="",this.nodes=[e],this.offsets=[i>0?1:(e instanceof wt?e.text.length:e.children.length)<<1]}nextInner(e,i){for(this.done=this.lineBreak=!1;;){let n=this.nodes.length-1,r=this.nodes[n],s=this.offsets[n],o=s>>1,l=r instanceof wt?r.text.length:r.children.length;if(o==(i>0?l:0)){if(n==0)return this.done=!0,this.value="",this;i>0&&this.offsets[n-1]++,this.nodes.pop(),this.offsets.pop()}else if((s&1)==(i>0?0:1)){if(this.offsets[n]+=i,e==0)return this.lineBreak=!0,this.value=`
|
||||
`,this;e--}else if(r instanceof wt){let a=r.text[o+(i<0?-1:0)];if(this.offsets[n]+=i,a.length>Math.max(0,e))return this.value=e==0?a:i>0?a.slice(e):a.slice(0,a.length-e),this;e-=a.length}else{let a=r.children[o+(i<0?-1:0)];e>a.length?(e-=a.length,this.offsets[n]+=i):(i<0&&this.offsets[n]--,this.nodes.push(a),this.offsets.push(i>0?1:(a instanceof wt?a.text.length:a.children.length)<<1))}}}next(e=0){return e<0&&(this.nextInner(-e,-this.dir),e=this.value.length),this.nextInner(e,this.dir)}},Mo=class{constructor(e,i,n){this.value="",this.done=!1,this.cursor=new hn(e,i>n?-1:1),this.pos=i>n?e.length:0,this.from=Math.min(i,n),this.to=Math.max(i,n)}nextInner(e,i){if(i<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;e+=Math.max(0,i<0?this.pos-this.to:this.from-this.pos);let n=i<0?this.pos-this.from:this.to-this.pos;e>n&&(e=n),n-=e;let{value:r}=this.cursor.next(e);return this.pos+=(r.length+e)*i,this.value=r.length<=n?r:i<0?r.slice(r.length-n):r.slice(0,n),this.done=!this.value,this}next(e=0){return e<0?e=Math.max(e,this.from-this.pos):e>0&&(e=Math.min(e,this.to-this.pos)),this.nextInner(e,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&this.value!=""}},Lo=class{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:i,lineBreak:n,value:r}=this.inner.next(e);return i&&this.afterBreak?(this.value="",this.afterBreak=!1):i?(this.done=!0,this.value=""):n?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=r,this.afterBreak=!1),this}get lineBreak(){return!1}};typeof Symbol!="undefined"&&(ie.prototype[Symbol.iterator]=function(){return this.iter()},hn.prototype[Symbol.iterator]=Mo.prototype[Symbol.iterator]=Lo.prototype[Symbol.iterator]=function(){return this});var yc=class{constructor(e,i,n,r){this.from=e,this.to=i,this.number=n,this.text=r}get length(){return this.to-this.from}};function ir(t,e,i){return e=Math.max(0,Math.min(t.length,e)),[e,Math.max(e,Math.min(t.length,i))]}function Xe(t,e,i=!0,n=!0){return kg(t,e,i,n)}function ew(t){return t>=56320&&t<57344}function tw(t){return t>=55296&&t<56320}function We(t,e){let i=t.charCodeAt(e);if(!tw(i)||e+1==t.length)return i;let n=t.charCodeAt(e+1);return ew(n)?(i-55296<<10)+(n-56320)+65536:i}function os(t){return t<=65535?String.fromCharCode(t):(t-=65536,String.fromCharCode((t>>10)+55296,(t&1023)+56320))}function vt(t){return t<65536?1:2}var Sc=/\r\n?|\n/,De=(function(t){return t[t.Simple=0]="Simple",t[t.TrackDel=1]="TrackDel",t[t.TrackBefore=2]="TrackBefore",t[t.TrackAfter=3]="TrackAfter",t})(De||(De={})),Si=class t{constructor(e){this.sections=e}get length(){let e=0;for(let i=0;i<this.sections.length;i+=2)e+=this.sections[i];return e}get newLength(){let e=0;for(let i=0;i<this.sections.length;i+=2){let n=this.sections[i+1];e+=n<0?this.sections[i]:n}return e}get empty(){return this.sections.length==0||this.sections.length==2&&this.sections[1]<0}iterGaps(e){for(let i=0,n=0,r=0;i<this.sections.length;){let s=this.sections[i++],o=this.sections[i++];o<0?(e(n,r,s),r+=s):r+=o,n+=s}}iterChangedRanges(e,i=!1){xc(this,e,i)}get invertedDesc(){let e=[];for(let i=0;i<this.sections.length;){let n=this.sections[i++],r=this.sections[i++];r<0?e.push(n,r):e.push(r,n)}return new t(e)}composeDesc(e){return this.empty?e:e.empty?this:Eg(this,e)}mapDesc(e,i=!1){return e.empty?this:kc(this,e,i)}mapPos(e,i=-1,n=De.Simple){let r=0,s=0;for(let o=0;o<this.sections.length;){let l=this.sections[o++],a=this.sections[o++],h=r+l;if(a<0){if(h>e)return s+(e-r);s+=l}else{if(n!=De.Simple&&h>=e&&(n==De.TrackDel&&r<e&&h>e||n==De.TrackBefore&&r<e||n==De.TrackAfter&&h>e))return null;if(h>e||h==e&&i<0&&!l)return e==r||i<0?s:s+a;s+=a}r=h}if(e>r)throw new RangeError(`Position ${e} is out of range for changeset of length ${r}`);return s}touchesRange(e,i=e){for(let n=0,r=0;n<this.sections.length&&r<=i;){let s=this.sections[n++],o=this.sections[n++],l=r+s;if(o>=0&&r<=i&&l>=e)return r<e&&l>i?"cover":!0;r=l}return!1}toString(){let e="";for(let i=0;i<this.sections.length;){let n=this.sections[i++],r=this.sections[i++];e+=(e?" ":"")+n+(r>=0?":"+r:"")}return e}toJSON(){return this.sections}static fromJSON(e){if(!Array.isArray(e)||e.length%2||e.some(i=>typeof i!="number"))throw new RangeError("Invalid JSON representation of ChangeDesc");return new t(e)}static create(e){return new t(e)}},qe=class t extends Si{constructor(e,i){super(e),this.inserted=i}apply(e){if(this.length!=e.length)throw new RangeError("Applying change set to a document with the wrong length");return xc(this,(i,n,r,s,o)=>e=e.replace(r,r+(n-i),o),!1),e}mapDesc(e,i=!1){return kc(this,e,i,!0)}invert(e){let i=this.sections.slice(),n=[];for(let r=0,s=0;r<i.length;r+=2){let o=i[r],l=i[r+1];if(l>=0){i[r]=l,i[r+1]=o;let a=r>>1;for(;n.length<a;)n.push(ie.empty);n.push(o?e.slice(s,s+o):ie.empty)}s+=o}return new t(i,n)}compose(e){return this.empty?e:e.empty?this:Eg(this,e,!0)}map(e,i=!1){return e.empty?this:kc(this,e,i,!0)}iterChanges(e,i=!1){xc(this,e,i)}get desc
Line truncated
|
||||
`}get readOnly(){return this.facet(Ig)}phrase(e,...i){for(let n of this.facet(t.phrases))if(Object.prototype.hasOwnProperty.call(n,e)){e=n[e];break}return i.length&&(e=e.replace(/\$(\$|\d*)/g,(n,r)=>{if(r=="$")return"$";let s=+(r||1);return!s||s>i.length?n:i[s-1]})),e}languageDataAt(e,i,n=-1){let r=[];for(let s of this.facet(Lg))for(let o of s(this,i,n))Object.prototype.hasOwnProperty.call(o,e)&&r.push(o[e]);return r}charCategorizer(e){return hw(this.languageDataAt("wordChars",e).join(""))}wordAt(e){let{text:i,from:n,length:r}=this.doc.lineAt(e),s=this.charCategorizer(e),o=e-n,l=e-n;for(;o>0;){let a=Xe(i,o,!1);if(s(i.slice(a,o))!=ke.Word)break;o=a}for(;l<r;){let a=Xe(i,l);if(s(i.slice(l,a))!=ke.Word)break;l=a}return o==l?null:Q.range(o+n,l+n)}};he.allowMultipleSelections=vc;he.tabSize=L.define({combine:t=>t.length?t[0]:4});he.lineSeparator=Xg;he.readOnly=Ig;he.phrases=L.define({compare(t,e){let i=Object.keys(t),n=Object.keys(e);return i.length==n.length&&i.every(r=>t[r]==e[r])}});he.languageData=Lg;he.changeFilter=_g;he.transactionFilter=Zg;he.transactionExtender=Dg;ni.reconfigure=W.define();function Ge(t,e,i={}){let n={};for(let r of t)for(let s of Object.keys(r)){let o=r[s],l=n[s];if(l===void 0)n[s]=o;else if(!(l===o||o===void 0))if(Object.hasOwnProperty.call(i,s))n[s]=i[s](l,o);else throw new Error("Config merge conflict for field "+s)}for(let r in e)n[r]===void 0&&(n[r]=e[r]);return n}var jt=class{eq(e){return this==e}range(e,i=e){return rs.create(e,i,this)}};jt.prototype.startSide=jt.prototype.endSide=0;jt.prototype.point=!1;jt.prototype.mapMode=De.TrackDel;var rs=class t{constructor(e,i,n){this.from=e,this.to=i,this.value=n}static create(e,i,n){return new t(e,i,n)}};function Cc(t,e){return t.from-e.from||t.value.startSide-e.value.startSide}var Ac=class t{constructor(e,i,n,r){this.from=e,this.to=i,this.value=n,this.maxPoint=r}get length(){return this.to[this.to.length-1]}findIndex(e,i,n,r=0){let s=n?this.to:this.from;for(let o=r,l=s.length;;){if(o==l)return o;let a=o+l>>1,h=s[a]-e||(n?this.value[a].endSide:this.value[a].startSide)-i;if(a==o)return h>=0?o:l;h>=0?l=a:o=a+1}}between(e,i,n,r){for(let s=this.findIndex(i,-1e9,!0),o=this.findIndex(n,1e9,!1,s);s<o;s++)if(r(this.from[s]+e,this.to[s]+e,this.value[s])===!1)return!1}map(e,i){let n=[],r=[],s=[],o=-1,l=-1;for(let a=0;a<this.value.length;a++){let h=this.value[a],c=this.from[a]+e,f=this.to[a]+e,u,d;if(c==f){let p=i.mapPos(c,h.startSide,h.mapMode);if(p==null||(u=d=p,h.startSide!=h.endSide&&(d=i.mapPos(c,h.endSide),d<u)))continue}else if(u=i.mapPos(c,h.startSide),d=i.mapPos(f,h.endSide),u>d||u==d&&h.startSide>0&&h.endSide<=0)continue;(d-u||h.endSide-h.startSide)<0||(o<0&&(o=u),h.point&&(l=Math.max(l,d-u)),n.push(h),r.push(u-o),s.push(d-o))}return{mapped:n.length?new t(r,s,n,l):null,pos:o}}},se=class t{constructor(e,i,n,r){this.chunkPos=e,this.chunk=i,this.nextLayer=n,this.maxPoint=r}static create(e,i,n,r){return new t(e,i,n,r)}get length(){let e=this.chunk.length-1;return e<0?0:Math.max(this.chunkEnd(e),this.nextLayer.length)}get size(){if(this.isEmpty)return 0;let e=this.nextLayer.size;for(let i of this.chunk)e+=i.value.length;return e}chunkEnd(e){return this.chunkPos[e]+this.chunk[e].length}update(e){let{add:i=[],sort:n=!1,filterFrom:r=0,filterTo:s=this.length}=e,o=e.filter;if(i.length==0&&!o)return this;if(n&&(i=i.slice().sort(Cc)),this.isEmpty)return i.length?t.of(i):this;let l=new Do(this,null,-1).goto(0),a=0,h=[],c=new Ee;for(;l.value||a<i.length;)if(a<i.length&&(l.from-i[a].from||l.startSide-i[a].value.startSide)>=0){let f=i[a++];c.addInner(f.from,f.to,f.value)||h.push(f)}else l.rangeIndex==1&&l.chunkIndex<this.chunk.length&&(a==i.length||this.chunkEnd(l.chunkIndex)<i[a].from)&&(!o||r>this.chunkEnd(l.chunkIndex)||s<this.chunkPos[l.chunkIndex])&&c.addChunk(this.chunkPos[l.chunkIndex],this.chunk[l.chunkIndex])?l.nextChunk():((!o||r>l.to||s<l.from||o(l.from,l.to,l.value))&&(c.addInner(l.from,l.to,l.value)||h.push(rs.create(l.from,l.to,l.value))),l.next());return c.finishInner(this.nextLayer.isEmpty&&!h.length?t.empty:this.nextLayer.update({add:h,filter:o,filterFrom:r,filterTo:s}))}map(e){if(e.empty||this.isEmpty)return this;let i=[],n=[],r=-1;for(let o=0;o<this.chunk.length;o++){let l=this.chunkPos[o],a=this.chunk[o],h=e.touchesRange(l,l+a.length);if(h===!1)r=Math.max(r,a.maxPoint),i.push(a),n.push(e.mapPos(l));else if(h===!0){let{mapped:c,pos:f}=a.map(l,e);c&&(r=Math.max(r,c.maxPoint),i.push(c),n.push(f))}}let s=this.nextLayer.map(e);return i.length==0?s:new t(n,i,s||t.empty,r)}between(e,i,n){if(!this.isEmpty){for(let r=0;r<this.chunk.length;r++){let s=this.chunkPos[r],o=this.chunk[r];if(i>=s&&e<=s+o.length&&o.between(s,e-s,i-s,n)===!1)return}this.nextLayer.between(e,i,n)}}iter(e=0){return ss.from([this]).goto(e)}get isEmpty(){return this.nextLayer==this}static iter(e,i=0){return ss.from(e).goto(i)}static compare(e,i,n,r,s=-1){let o=e.filter(f=>f.maxPoint>0||!f.isEmpty&&f.maxPoint>=s),l=i.filter(f=>f.maxPoint>0||!f.isEmpty&&f.maxPoint>=s),a=Cg(o,l
Line truncated
|
||||
`)}static newName(){let e=zg[jg]||1;return zg[jg]=e+1,"\u037C"+e.toString(36)}static mount(e,i,n){let r=e[Lc],s=n&&n.nonce;r?s&&r.setNonce(s):r=new Xc(e,s),r.mount(Array.isArray(i)?i:[i],e)}},Yg=new Map,Xc=class{constructor(e,i){let n=e.ownerDocument||e,r=n.defaultView;if(!e.head&&e.adoptedStyleSheets&&r.CSSStyleSheet){let s=Yg.get(n);if(s)return e[Lc]=s;this.sheet=new r.CSSStyleSheet,Yg.set(n,this)}else this.styleTag=n.createElement("style"),i&&this.styleTag.setAttribute("nonce",i);this.modules=[],e[Lc]=this}mount(e,i){let n=this.sheet,r=0,s=0;for(let o=0;o<e.length;o++){let l=e[o],a=this.modules.indexOf(l);if(a<s&&a>-1&&(this.modules.splice(a,1),s--,a=-1),a==-1){if(this.modules.splice(s++,0,l),n)for(let h=0;h<l.rules.length;h++)n.insertRule(l.rules[h],r++)}else{for(;s<a;)r+=this.modules[s++].rules.length;r+=l.rules.length,s++}}if(n)i.adoptedStyleSheets.indexOf(this.sheet)<0&&(i.adoptedStyleSheets=[this.sheet,...i.adoptedStyleSheets]);else{let o="";for(let a=0;a<this.modules.length;a++)o+=this.modules[a].getRules()+`
|
||||
`;this.styleTag.textContent=o;let l=i.head||i;this.styleTag.parentNode!=l&&l.insertBefore(this.styleTag,l.firstChild)}}setNonce(e){this.styleTag&&this.styleTag.getAttribute("nonce")!=e&&this.styleTag.setAttribute("nonce",e)}};var xi={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},nr={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},uw=typeof navigator!="undefined"&&/Mac/.test(navigator.platform),dw=typeof navigator!="undefined"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(_e=0;_e<10;_e++)xi[48+_e]=xi[96+_e]=String(_e);var _e;for(_e=1;_e<=24;_e++)xi[_e+111]="F"+_e;var _e;for(_e=65;_e<=90;_e++)xi[_e]=String.fromCharCode(_e+32),nr[_e]=String.fromCharCode(_e);var _e;for(Bo in xi)nr.hasOwnProperty(Bo)||(nr[Bo]=xi[Bo]);var Bo;function qg(t){var e=uw&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||dw&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",i=!e&&t.key||(t.shiftKey?nr:xi)[t.keyCode]||t.key||"Unidentified";return i=="Esc"&&(i="Escape"),i=="Del"&&(i="Delete"),i=="Left"&&(i="ArrowLeft"),i=="Up"&&(i="ArrowUp"),i=="Right"&&(i="ArrowRight"),i=="Down"&&(i="ArrowDown"),i}function Oe(){var t=arguments[0];typeof t=="string"&&(t=document.createElement(t));var e=1,i=arguments[1];if(i&&typeof i=="object"&&i.nodeType==null&&!Array.isArray(i)){for(var n in i)if(Object.prototype.hasOwnProperty.call(i,n)){var r=i[n];typeof r=="string"?t.setAttribute(n,r):r!=null&&(t[n]=r)}e++}for(;e<arguments.length;e++)Wg(t,arguments[e]);return t}function Wg(t,e){if(typeof e=="string")t.appendChild(document.createTextNode(e));else if(e!=null)if(e.nodeType!=null)t.appendChild(e);else if(Array.isArray(e))for(var i=0;i<e.length;i++)Wg(t,e[i]);else throw new RangeError("Unsupported child node: "+e)}var st=typeof navigator!="undefined"?navigator:{userAgent:"",vendor:"",platform:""},zc=typeof document!="undefined"?document:{documentElement:{style:{}}},Yc=/Edge\/(\d+)/.exec(st.userAgent),XO=/MSIE \d/.test(st.userAgent),qc=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(st.userAgent),bl=!!(XO||qc||Yc),Vg=!bl&&/gecko\/(\d+)/i.test(st.userAgent),_c=!bl&&/Chrome\/(\d+)/.exec(st.userAgent),Gg="webkitFontSmoothing"in zc.documentElement.style,Wc=!bl&&/Apple Computer/.test(st.vendor),Ug=Wc&&(/Mobile\/\w+/.test(st.userAgent)||st.maxTouchPoints>2),I={mac:Ug||/Mac/.test(st.platform),windows:/Win/.test(st.platform),linux:/Linux|X11/.test(st.platform),ie:bl,ie_version:XO?zc.documentMode||6:qc?+qc[1]:Yc?+Yc[1]:0,gecko:Vg,gecko_version:Vg?+(/Firefox\/(\d+)/.exec(st.userAgent)||[0,0])[1]:0,chrome:!!_c,chrome_version:_c?+_c[1]:0,ios:Ug,android:/Android\b/.test(st.userAgent),webkit:Gg,webkit_version:Gg?+(/\bAppleWebKit\/(\d+)/.exec(st.userAgent)||[0,0])[1]:0,safari:Wc,safari_version:Wc?+(/\bVersion\/(\d+(\.\d+)?)/.exec(st.userAgent)||[0,0])[1]:0,tabSize:zc.documentElement.style.tabSize!=null?"tab-size":"-moz-tab-size"};function ys(t){let e;return t.nodeType==11?e=t.getSelection?t:t.ownerDocument:e=t,e.getSelection()}function Vc(t,e){return e?t==e||t.contains(e.nodeType!=1?e.parentNode:e):!1}function Ho(t,e){if(!e.anchorNode)return!1;try{return Vc(t,e.anchorNode)}catch{return!1}}function cr(t){return t.nodeType==3?gn(t,0,t.nodeValue.length).getClientRects():t.nodeType==1?t.getClientRects():[]}function fs(t,e,i,n){return i?Fg(t,e,i,n,-1)||Fg(t,e,i,n,1):!1}function pn(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e}function nl(t){return t.nodeType==1&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(t.nodeName)}function Fg(t,e,i,n,r){for(;;){if(t==i&&e==n)return!0;if(e==(r<0?0:ai(t))){if(t.nodeName=="DIV")return!1;let s=t.parentNode;if(!s||s.nodeType!=1)return!1;e=pn(t)+(r<0?0:1),t=s}else if(t.nodeType==1){if(t=t.childNodes[e+(r<0?-1:0)],t.nodeType==1&&t.contentEditable=="false")return!1;e=r<0?ai(t):0}else return!1}}function ai(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function $s(t,e){let i=e?t.left:t.right;return{left:i,right:i,top:t.top,bottom:t.bottom}}function pw(t){let e=t.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:t.innerWidth,top:0,bottom:t.innerHeight}}function _O(t,e){let i=e.width/t.offsetWidth,n=e.height/t.offsetHeight;return(i>.995&&i<1.005||!isFinite(i)||Math.abs(e.width-t.offsetWidth)<1)&&(i=1),(n>.995&&n<1.005||!isFinite(n)||Math.abs(e.height-t.offsetHeight)<1)&&(n=1),{scaleX:i,scaleY:n}}function gw(t,e,i,n,r,Line truncated
|
||||
`,r=t.state.doc.line(r.number+(i?1:-1)),s=t.bidiSpans(r),h=t.visualLineSide(r,!i)}if(a){if(!a(c))return l}else{if(!n)return h;a=n(c)}l=h}}function Gw(t,e,i){let n=t.state.charCategorizer(e),r=n(i);return s=>{let o=n(s);return r==ke.Space&&(r=o),r==o}}function Uw(t,e,i,n){let r=e.head,s=i?1:-1;if(r==(i?t.state.doc.length:0))return Q.cursor(r,e.assoc);let o=e.goalColumn,l,a=t.contentDOM.getBoundingClientRect(),h=t.coordsAtPos(r,e.assoc||-1),c=t.documentTop;if(h)o==null&&(o=h.left-a.left),l=s<0?h.top:h.bottom;else{let d=t.viewState.lineBlockAt(r);o==null&&(o=Math.min(a.right-a.left,t.defaultCharacterWidth*(r-d.from))),l=(s<0?d.top:d.bottom)+c}let f=a.left+o,u=n!=null?n:t.viewState.heightOracle.textHeight>>1;for(let d=0;;d+=10){let p=l+(u+d)*s,g=pm(t,{x:f,y:p},!1,s);if(p<a.top||p>a.bottom||(s<0?g<r:g>r)){let m=t.docView.coordsForChar(g),b=!m||p<m.top?-1:1;return Q.cursor(g,b,void 0,o)}}}function gs(t,e,i){for(;;){let n=0;for(let r of t)r.between(e-1,e+1,(s,o,l)=>{if(e>s&&e<o){let a=n||i||(e-s<o-e?-1:1);e=a<0?s:o,n=a}});if(!n)return e}}function Om(t,e){let i=null;for(let n=0;n<e.ranges.length;n++){let r=e.ranges[n],s=null;if(r.empty){let o=gs(t,r.from,0);o!=r.from&&(s=Q.cursor(o,-1))}else{let o=gs(t,r.from,-1),l=gs(t,r.to,1);(o!=r.from||l!=r.to)&&(s=Q.range(r.from==r.anchor?o:l,r.from==r.head?o:l))}s&&(i||(i=e.ranges.slice()),i[n]=s)}return i?Q.create(i,e.mainIndex):e}function Dc(t,e,i){let n=gs(t.state.facet(Ts).map(r=>r(t)),i.from,e.head>i.from?-1:1);return n==i.from?i:Q.cursor(n,n<i.from?1:-1)}var as="\uFFFF",nh=class{constructor(e,i){this.points=e,this.text="",this.lineSeparator=i.facet(he.lineSeparator)}append(e){this.text+=e}lineBreak(){this.text+=as}readRange(e,i){if(!e)return this;let n=e.parentNode;for(let r=e;;){this.findPointBefore(n,r);let s=this.text.length;this.readNode(r);let o=r.nextSibling;if(o==i)break;let l=Qe.get(r),a=Qe.get(o);(l&&a?l.breakAfter:(l?l.breakAfter:nl(r))||nl(o)&&(r.nodeName!="BR"||r.cmIgnore)&&this.text.length>s)&&!Hw(o,i)&&this.lineBreak(),r=o}return this.findPointBefore(n,i),this}readTextNode(e){let i=e.nodeValue;for(let n of this.points)n.node==e&&(n.pos=this.text.length+Math.min(n.offset,i.length));for(let n=0,r=this.lineSeparator?null:/\r\n?|\n/g;;){let s=-1,o=1,l;if(this.lineSeparator?(s=i.indexOf(this.lineSeparator,n),o=this.lineSeparator.length):(l=r.exec(i))&&(s=l.index,o=l[0].length),this.append(i.slice(n,s<0?i.length:s)),s<0)break;if(this.lineBreak(),o>1)for(let a of this.points)a.node==e&&a.pos>this.text.length&&(a.pos-=o-1);n=s+o}}readNode(e){if(e.cmIgnore)return;let i=Qe.get(e),n=i&&i.overrideDOMText;if(n!=null){this.findPointInside(e,n.length);for(let r=n.iter();!r.next().done;)r.lineBreak?this.lineBreak():this.append(r.value)}else e.nodeType==3?this.readTextNode(e):e.nodeName=="BR"?e.nextSibling&&this.lineBreak():e.nodeType==1&&this.readRange(e.firstChild,null)}findPointBefore(e,i){for(let n of this.points)n.node==e&&e.childNodes[n.offset]==i&&(n.pos=this.text.length)}findPointInside(e,i){for(let n of this.points)(e.nodeType==3?n.node==e:e.contains(n.node))&&(n.pos=this.text.length+(Fw(e,n.node,n.offset)?i:0))}};function Fw(t,e,i){for(;;){if(!e||i<ai(e))return!1;if(e==t)return!0;i=pn(e)+1,e=e.parentNode}}function Hw(t,e){let i;for(;!(t==e||!t);t=t.nextSibling){let n=Qe.get(t);if(!(n!=null&&n.isWidget||t.cmIgnore))return!1;n&&(i||(i=[])).push(n)}if(i)for(let n of i){let r=n.overrideDOMText;if(r!=null&&r.length)return!1}return!0}var al=class{constructor(e,i){this.node=e,this.offset=i,this.pos=-1}},rh=class{constructor(e,i,n,r){this.typeOver=r,this.bounds=null,this.text="",this.domChanged=i>-1;let{impreciseHead:s,impreciseAnchor:o}=e.docView;if(e.state.readOnly&&i>-1)this.newSel=null;else if(i>-1&&(this.bounds=e.docView.domBoundsAround(i,n,0))){let l=s||o?[]:Jw(e),a=new nh(l,e.state);a.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=a.text,this.newSel=ev(l,this.bounds.from)}else{let l=e.observer.selectionRange,a=s&&s.node==l.focusNode&&s.offset==l.focusOffset||!Vc(e.contentDOM,l.focusNode)?e.state.selection.main.head:e.docView.posFromDOM(l.focusNode,l.focusOffset),h=o&&o.node==l.anchorNode&&o.offset==l.anchorOffset||!Vc(e.contentDOM,l.anchorNode)?e.state.selection.main.anchor:e.docView.posFromDOM(l.anchorNode,l.anchorOffset),c=e.viewport;if((I.ios||I.chrome)&&e.state.selection.main.empty&&a!=h&&(c.from>0||c.to<e.state.doc.length)){let f=Math.min(a,h),u=Math.max(a,h),d=c.from-f,p=c.to-u;(d==0||d==1||f==0)&&(p==0||p==-1||u==e.state.doc.length)&&(a=0,h=e.state.doc.length)}e.inputState.composing>-1&&e.state.selection.ranges.length>1?this.newSel=e.state.selection.replaceRange(Q.range(h,a)):this.newSel=Q.single(h,a)}}};function mm(t,e){let i,{newSel:n}=e,r=t.state.selection.main,s=t.inputState.lastKeyTime>Date.now()-100?t.inputState.lastKeyCode:-1;if(e.bounds){let{from:o,to:l}=e.bounds,a=r.from,h=null;(s===8||I.android&&e.text.length<l-o)&&(a=r.to,h="end");let c=bm(t.state.doc.sliceString(o,l,as),e.text,a-o,h);c&&(I.chrome&&s==13&&c.toB==c.from+2&&e.text.sl
Line truncated
|
||||
`&&t.lineWrapping&&(n&&(n=Q.single(n.main.anchor-1,n.main.head-1)),i={from:r.from,to:r.to,insert:ie.of([" "])}),i)return Dh(t,i,n,s);if(n&&!n.main.eq(r)){let o=!1,l="select";return t.inputState.lastSelectionTime>Date.now()-50&&(t.inputState.lastSelectionOrigin=="select"&&(o=!0),l=t.inputState.lastSelectionOrigin,l=="select.pointer"&&(n=Om(t.state.facet(Ts).map(a=>a(t)),n))),t.dispatch({selection:n,scrollIntoView:o,userEvent:l}),!0}else return!1}function Dh(t,e,i,n=-1){if(I.ios&&t.inputState.flushIOSKey(e))return!0;let r=t.state.selection.main;if(I.android&&(e.to==r.to&&(e.from==r.from||e.from==r.from-1&&t.state.sliceDoc(e.from,r.from)==" ")&&e.insert.length==1&&e.insert.lines==2&&ar(t.contentDOM,"Enter",13)||(e.from==r.from-1&&e.to==r.to&&e.insert.length==0||n==8&&e.insert.length<e.to-e.from&&e.to>r.head)&&ar(t.contentDOM,"Backspace",8)||e.from==r.from&&e.to==r.to+1&&e.insert.length==0&&ar(t.contentDOM,"Delete",46)))return!0;let s=e.insert.toString();t.inputState.composing>=0&&t.inputState.composing++;let o,l=()=>o||(o=Kw(t,e,i));return t.state.facet(nm).some(a=>a(t,e.from,e.to,s,l))||t.dispatch(l()),!0}function Kw(t,e,i){let n,r=t.state,s=r.selection.main,o=-1;if(e.from==e.to&&e.from<s.from||e.from>s.to){let a=e.from<s.from?-1:1,h=a<0?s.from:s.to,c=gs(r.facet(Ts).map(f=>f(t)),h,a);e.from==c&&(o=c)}if(o>-1)n={changes:e,selection:Q.cursor(e.from+e.insert.length,-1)};else if(e.from>=s.from&&e.to<=s.to&&e.to-e.from>=(s.to-s.from)/3&&(!i||i.main.empty&&i.main.from==e.from+e.insert.length)&&t.inputState.composing<0){let a=s.from<e.from?r.sliceDoc(s.from,e.from):"",h=s.to>e.to?r.sliceDoc(e.to,s.to):"";n=r.replaceSelection(t.state.toText(a+e.insert.sliceString(0,void 0,t.state.lineBreak)+h))}else{let a=r.changes(e),h=i&&i.main.to<=a.newLength?i.main:void 0;if(r.selection.ranges.length>1&&(t.inputState.composing>=0||t.inputState.compositionPendingChange)&&e.to<=s.to+10&&e.to>=s.to-10){let c=t.state.sliceDoc(e.from,e.to),f,u=i&&dm(t,i.main.head);if(u){let p=e.insert.length-(e.to-e.from);f={from:u.from,to:u.to-p}}else f=t.state.doc.lineAt(s.head);let d=s.to-e.to;n=r.changeByRange(p=>{if(p.from==s.from&&p.to==s.to)return{changes:a,range:h||p.map(a)};let g=p.to-d,m=g-c.length;if(t.state.sliceDoc(m,g)!=c||g>=f.from&&m<=f.to)return{range:p};let b=r.changes({from:m,to:g,insert:e.insert}),y=p.to-s.to;return{changes:b,range:h?Q.range(Math.max(0,h.anchor+y),Math.max(0,h.head+y)):p.map(b)}})}else n={changes:a,selection:h&&r.selection.replaceRange(h)}}let l="input.type";return(t.composing||t.inputState.compositionPendingChange&&t.inputState.compositionEndedAt>Date.now()-50)&&(t.inputState.compositionPendingChange=!1,l+=".compose",t.inputState.compositionFirstChange&&(l+=".start",t.inputState.compositionFirstChange=!1)),r.update(n,{userEvent:l,scrollIntoView:!0})}function bm(t,e,i,n){let r=Math.min(t.length,e.length),s=0;for(;s<r&&t.charCodeAt(s)==e.charCodeAt(s);)s++;if(s==r&&t.length==e.length)return null;let o=t.length,l=e.length;for(;o>0&&l>0&&t.charCodeAt(o-1)==e.charCodeAt(l-1);)o--,l--;if(n=="end"){let a=Math.max(0,s-Math.min(o,l));i-=o+a-s}if(o<s&&t.length<e.length){let a=i<=s&&i>=o?s-i:0;s-=a,l=s+(l-o),o=s}else if(l<s){let a=i<=s&&i>=l?s-i:0;s-=a,o=s+(o-l),l=s}return{from:s,toA:o,toB:l}}function Jw(t){let e=[];if(t.root.activeElement!=t.contentDOM)return e;let{anchorNode:i,anchorOffset:n,focusNode:r,focusOffset:s}=t.observer.selectionRange;return i&&(e.push(new al(i,n)),(r!=i||s!=n)&&e.push(new al(r,s))),e}function ev(t,e){if(t.length==0)return null;let i=t[0].pos,n=t.length==2?t[1].pos:i;return i>-1&&n>-1?Q.single(i+e,n+e):null}var sh=class{setSelectionOrigin(e){this.lastSelectionOrigin=e,this.lastSelectionTime=Date.now()}constructor(e){this.view=e,this.lastKeyCode=0,this.lastKeyTime=0,this.lastTouchTime=0,this.lastFocusTime=0,this.lastScrollTop=0,this.lastScrollLeft=0,this.pendingIOSKey=void 0,this.tabFocusMode=-1,this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastContextMenu=0,this.scrollHandlers=[],this.handlers=Object.create(null),this.composing=-1,this.compositionFirstChange=null,this.compositionEndedAt=0,this.compositionPendingKey=!1,this.compositionPendingChange=!1,this.insertingText="",this.insertingTextAt=0,this.mouseSelection=null,this.draggedContent=null,this.handleEvent=this.handleEvent.bind(this),this.notifiedFocused=e.hasFocus,I.safari&&e.contentDOM.addEventListener("input",()=>null),I.gecko&&gv(e.contentDOM.ownerDocument)}handleEvent(e){!lv(this.view,e)||this.ignoreDuringComposition(e)||e.type=="keydown"&&this.keydown(e)||(this.view.updateState!=0?Promise.resolve().then(()=>this.runHandlers(e.type,e)):this.runHandlers(e.type,e))}runHandlers(e,i){let n=this.handlers[e];if(n){for(let r of n.observers)r(this.view,i);for(let r of n.handlers){if(i.defaultPrevented)break;if(r(this.view,i)){i.preventDefault();break}}}}ensureHandlers(e){let i=tv(e),n=this.handlers,r=this.view.contentDOM;for(let s in i)if(s!="scroll"){let o=!i[s].handlers.length,l=n[s];l&&o!=!l.handlers.length&&(r.removeEventListe
Line truncated
|
||||
`))};if((I.mac||I.android)&&f.from==o-1&&/^\. ?$/.test(n.text)&&e.contentDOM.getAttribute("autocorrect")=="off"&&(f={from:l,to:a,insert:ie.of([n.text.replace("."," ")])}),this.pendingContextChange=f,!e.state.readOnly){let u=this.to-this.from+(f.to-f.from+f.insert.length);Dh(e,f,Q.single(this.toEditorPos(n.selectionStart,u),this.toEditorPos(n.selectionEnd,u)))}this.pendingContextChange&&(this.revertPending(e.state),this.setSelection(e.state)),f.from<f.to&&!f.insert.length&&e.inputState.composing>=0&&!/[\\p{Alphabetic}\\p{Number}_]/.test(i.text.slice(Math.max(0,n.updateRangeStart-1),Math.min(i.text.length,n.updateRangeStart+1)))&&this.handlers.compositionend(n)},this.handlers.characterboundsupdate=n=>{let r=[],s=null;for(let o=this.toEditorPos(n.rangeStart),l=this.toEditorPos(n.rangeEnd);o<l;o++){let a=e.coordsForChar(o);s=a&&new DOMRect(a.left,a.top,a.right-a.left,a.bottom-a.top)||s||new DOMRect,r.push(s)}i.updateCharacterBounds(n.rangeStart,r)},this.handlers.textformatupdate=n=>{let r=[];for(let s of n.getTextFormats()){let o=s.underlineStyle,l=s.underlineThickness;if(!/none/i.test(o)&&!/none/i.test(l)){let a=this.toEditorPos(s.rangeStart),h=this.toEditorPos(s.rangeEnd);if(a<h){let c=`text-decoration: underline ${/^[a-z]/.test(o)?o+" ":o=="Dashed"?"dashed ":o=="Squiggle"?"wavy ":""}${/thin/i.test(l)?1:2}px`;r.push(X.mark({attributes:{style:c}}).range(a,h))}}}e.dispatch({effects:am.of(X.set(r))})},this.handlers.compositionstart=()=>{e.inputState.composing<0&&(e.inputState.composing=0,e.inputState.compositionFirstChange=!0)},this.handlers.compositionend=()=>{if(e.inputState.composing=-1,e.inputState.compositionFirstChange=null,this.composing){let{drifted:n}=this.composing;this.composing=null,n&&this.reset(e.state)}};for(let n in this.handlers)i.addEventListener(n,this.handlers[n]);this.measureReq={read:n=>{this.editContext.updateControlBounds(n.contentDOM.getBoundingClientRect());let r=ys(n.root);r&&r.rangeCount&&this.editContext.updateSelectionBounds(r.getRangeAt(0).getBoundingClientRect())}}}applyEdits(e){let i=0,n=!1,r=this.pendingContextChange;return e.changes.iterChanges((s,o,l,a,h)=>{if(n)return;let c=h.length-(o-s);if(r&&o>=r.to)if(r.from==s&&r.to==o&&r.insert.eq(h)){r=this.pendingContextChange=null,i+=c,this.to+=c;return}else r=null,this.revertPending(e.state);if(s+=i,o+=i,o<=this.from)this.from+=c,this.to+=c;else if(s<this.to){if(s<this.from||o>this.to||this.to-this.from+h.length>3e4){n=!0;return}this.editContext.updateText(this.toContextPos(s),this.toContextPos(o),h.toString()),this.to+=c}i+=c}),r&&!n&&this.revertPending(e.state),!n}update(e){let i=this.pendingContextChange,n=e.startState.selection.main;this.composing&&(this.composing.drifted||!e.changes.touchesRange(n.from,n.to)&&e.transactions.some(r=>!r.isUserEvent("input.type")&&r.changes.touchesRange(this.from,this.to)))?(this.composing.drifted=!0,this.composing.editorBase=e.changes.mapPos(this.composing.editorBase)):!this.applyEdits(e)||!this.rangeIsValid(e.state)?(this.pendingContextChange=null,this.reset(e.state)):(e.docChanged||e.selectionSet||i)&&this.setSelection(e.state),(e.geometryChanged||e.docChanged||e.selectionSet)&&e.view.requestMeasure(this.measureReq)}resetRange(e){let{head:i}=e.selection.main;this.from=Math.max(0,i-1e4),this.to=Math.min(e.doc.length,i+1e4)}reset(e){this.resetRange(e),this.editContext.updateText(0,this.editContext.text.length,e.doc.sliceString(this.from,this.to)),this.setSelection(e)}revertPending(e){let i=this.pendingContextChange;this.pendingContextChange=null,this.editContext.updateText(this.toContextPos(i.from),this.toContextPos(i.from+i.insert.length),e.doc.sliceString(i.from,i.to))}setSelection(e){let{main:i}=e.selection,n=this.toContextPos(Math.max(this.from,Math.min(this.to,i.anchor))),r=this.toContextPos(i.head);(this.editContext.selectionStart!=n||this.editContext.selectionEnd!=r)&&this.editContext.updateSelection(n,r)}rangeIsValid(e){let{head:i}=e.selection.main;return!(this.from>0&&i-this.from<500||this.to<e.doc.length&&this.to-i<500||this.to-this.from>1e4*3)}toEditorPos(e,i=this.to-this.from){e=Math.min(e,i);let n=this.composing;return n&&n.drifted?n.editorBase+(e-n.contextBase):e+this.from}toContextPos(e){let i=this.composing;return i&&i.drifted?i.contextBase+(e-i.editorBase):e-this.from}destroy(){for(let e in this.handlers)this.editContext.removeEventListener(e,this.handlers[e])}},T=class t{get state(){return this.viewState.state}get viewport(){return this.viewState.viewport}get visibleRanges(){return this.viewState.visibleRanges}get inView(){return this.viewState.inView}get composing(){return!!this.inputState&&this.inputState.composing>0}get compositionStarted(){return!!this.inputState&&this.inputState.composing>=0}get root(){return this._root}get win(){return this.dom.ownerDocument.defaultView||window}constructor(e={}){var i;this.plugins=[],this.pluginMap=new Map,this.editorAttrs={},this.contentAttrs={},this.bidiCache=[],this.destroyed=!1,this.updateState=2,this.measureScheduled=-1,this.measureR
Line truncated
|
||||
-\x7F-\x9F\xAD\u061C\u200B\u200E\u200F\u2028\u2029\u202D\u202E\u2066\u2067\u2069\uFEFF\uFFF9-\uFFFC]`,wh),Bv={0:"null",7:"bell",8:"backspace",10:"newline",11:"vertical tab",13:"carriage return",27:"escape",8203:"zero width space",8204:"zero width non-joiner",8205:"zero width joiner",8206:"left-to-right mark",8207:"right-to-left mark",8232:"line separator",8237:"left-to-right override",8238:"right-to-left override",8294:"left-to-right isolate",8295:"right-to-left isolate",8297:"pop directional isolate",8233:"paragraph separator",65279:"zero width no-break space",65532:"object replacement"},Bc=null;function Nv(){var t;if(Bc==null&&typeof document!="undefined"&&document.body){let e=document.body.style;Bc=((t=e.tabSize)!==null&&t!==void 0?t:e.MozTabSize)!=null}return Bc||!1}var tl=L.define({combine(t){let e=Ge(t,{render:null,specialChars:Iv,addSpecialChars:null});return(e.replaceTabs=!Nv())&&(e.specialChars=new RegExp(" |"+e.specialChars.source,wh)),e.addSpecialChars&&(e.specialChars=new RegExp(e.specialChars.source+"|"+e.addSpecialChars.source,wh)),e}});function Nh(t={}){return[tl.of(t),jv()]}var $O=null;function jv(){return $O||($O=me.fromClass(class{constructor(t){this.view=t,this.decorations=X.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(t.state.facet(tl)),this.decorations=this.decorator.createDeco(t)}makeDecorator(t){return new kh({regexp:t.specialChars,decoration:(e,i,n)=>{let{doc:r}=i.state,s=We(e[0],0);if(s==9){let o=r.lineAt(n),l=i.state.tabSize,a=rt(o.text,l,n-o.from);return X.replace({widget:new Qh((l-a%l)*this.view.defaultCharacterWidth/this.view.scaleX)})}return this.decorationCache[s]||(this.decorationCache[s]=X.replace({widget:new vh(t,s)}))},boundary:t.replaceTabs?void 0:/[^]/})}update(t){let e=t.state.facet(tl);t.startState.facet(tl)!=e?(this.decorator=this.makeDecorator(e),this.decorations=this.decorator.createDeco(t.view)):this.decorations=this.decorator.updateDeco(t,this.decorations)}},{decorations:t=>t.decorations}))}var zv="\u2022";function Yv(t){return t>=32?zv:t==10?"\u2424":String.fromCharCode(9216+t)}var vh=class extends Be{constructor(e,i){super(),this.options=e,this.code=i}eq(e){return e.code==this.code}toDOM(e){let i=Yv(this.code),n=e.state.phrase("Control character")+" "+(Bv[this.code]||"0x"+this.code.toString(16)),r=this.options.render&&this.options.render(this.code,n,i);if(r)return r;let s=document.createElement("span");return s.textContent=i,s.title=n,s.setAttribute("aria-label",n),s.className="cm-specialChar",s}ignoreEvent(){return!1}},Qh=class extends Be{constructor(e){super(),this.width=e}eq(e){return e.width==this.width}toDOM(){let e=document.createElement("span");return e.textContent=" ",e.className="cm-tab",e.style.width=this.width+"px",e}ignoreEvent(){return!1}};function jh(){return Wv}var qv=X.line({class:"cm-activeLine"}),Wv=me.fromClass(class{constructor(t){this.decorations=this.getDeco(t)}update(t){(t.docChanged||t.selectionSet)&&(this.decorations=this.getDeco(t.view))}getDeco(t){let e=-1,i=[];for(let n of t.state.selection.ranges){let r=t.lineBlockAt(n.head);r.from>e&&(i.push(qv.range(r.from)),e=r.from)}return X.set(i)}},{decorations:t=>t.decorations}),Ph=class extends Be{constructor(e){super(),this.content=e}toDOM(e){let i=document.createElement("span");return i.className="cm-placeholder",i.style.pointerEvents="none",i.appendChild(typeof this.content=="string"?document.createTextNode(this.content):typeof this.content=="function"?this.content(e):this.content.cloneNode(!0)),i.setAttribute("aria-hidden","true"),i}coordsAt(e){let i=e.firstChild?cr(e.firstChild):[];if(!i.length)return null;let n=window.getComputedStyle(e.parentNode),r=$s(i[0],n.direction!="rtl"),s=parseInt(n.lineHeight);return r.bottom-r.top>s*1.5?{left:r.left,right:r.right,top:r.top,bottom:r.top+s}:r}ignoreEvent(){return!1}};function Zm(t){let e=me.fromClass(class{constructor(i){this.view=i,this.placeholder=t?X.set([X.widget({widget:new Ph(t),side:1}).range(0)]):X.none}get decorations(){return this.view.state.doc.length?X.none:this.placeholder}},{decorations:i=>i.decorations});return typeof t=="string"?[e,T.contentAttributes.of({"aria-placeholder":t})]:e}var $h=2e3;function Vv(t,e,i){let n=Math.min(e.line,i.line),r=Math.max(e.line,i.line),s=[];if(e.off>$h||i.off>$h||e.col<0||i.col<0){let o=Math.min(e.off,i.off),l=Math.max(e.off,i.off);for(let a=n;a<=r;a++){let h=t.doc.line(a);h.length<=l&&s.push(Q.range(h.from+o,h.to+l))}}else{let o=Math.min(e.col,i.col),l=Math.max(e.col,i.col);for(let a=n;a<=r;a++){let h=t.doc.line(a),c=Io(h.text,o,t.tabSize,!0);if(c<0)s.push(Q.cursor(h.to));else{let f=Io(h.text,l,t.tabSize);s.push(Q.range(h.from+c,h.from+f))}}}return s}function Gv(t,e){let i=t.coordsAtPos(t.viewport.from);return i?Math.round(Math.abs((i.left-e)/t.defaultCharacterWidth)):-1}function TO(t,e){let i=t.posAtCoords({x:e.clientX,y:e.clientY},!1),n=t.state.doc.lineAt(i),r=i-n.from,s=r>$h?-1:r==n.length?Gv(t,e.clientX):rt(n.text,t.state.tabSize,i-n.from);return{line:n.numbe
Line truncated
|
||||
`&&(i="");else{let n=i.indexOf(`
|
||||
`);n>-1&&(i=i.slice(0,n))}return e+i.length<=this.to?i:i.slice(0,this.to-e)}nextLine(){let e=this.parsedPos,i=this.lineAfter(e),n=e+i.length;for(let r=this.rangeIndex;;){let s=this.ranges[r].to;if(s>=n||(i=i.slice(0,s-(n-i.length)),r++,r==this.ranges.length))break;let o=this.ranges[r].from,l=this.lineAfter(o);i+=l,n=o+l.length}return{line:i,end:n}}skipGapsTo(e,i,n){for(;;){let r=this.ranges[this.rangeIndex].to,s=e+i;if(n>0?r>s:r>=s)break;let o=this.ranges[++this.rangeIndex].from;i+=o-r}return i}moveRangeIndex(){for(;this.ranges[this.rangeIndex].to<this.parsedPos;)this.rangeIndex++}emitToken(e,i,n,r){let s=4;if(this.ranges.length>1){r=this.skipGapsTo(i,r,1),i+=r;let l=this.chunk.length;r=this.skipGapsTo(n,r,-1),n+=r,s+=this.chunk.length-l}let o=this.chunk.length-4;return this.lang.streamParser.mergeTokens&&s==4&&o>=0&&this.chunk[o]==e&&this.chunk[o+2]==i?this.chunk[o+2]=n:this.chunk.push(e,i,n,s),r}parseLine(e){let{line:i,end:n}=this.nextLine(),r=0,{streamParser:s}=this.lang,o=new Rl(i,e?e.state.tabSize:4,e?Wt(e.state):2);if(o.eol())s.blankLine(this.state,o.indentUnit);else for(;!o.eol();){let l=v0(s.token,o,this.state);if(l&&(r=this.emitToken(this.lang.tokenTable.resolve(l),this.parsedPos+o.start,this.parsedPos+o.pos,r)),o.start>1e4)break}this.parsedPos=n,this.moveRangeIndex(),this.parsedPos<this.to&&this.parsedPos++}finishChunk(){let e=ue.build({buffer:this.chunk,start:this.chunkStart,length:this.parsedPos-this.chunkStart,nodeSet:tP,topID:0,maxBufferLength:2048,reused:this.chunkReused});e=new ue(e.type,e.children,e.positions,e.length,[[this.lang.stateAfter,this.lang.streamParser.copyState(this.state)]]),this.chunks.push(e),this.chunkPos.push(this.chunkStart-this.ranges[0].from),this.chunk=[],this.chunkReused=void 0,this.chunkStart=this.parsedPos}finish(){return new ue(this.lang.topNode,this.chunks,this.chunkPos,this.parsedPos-this.ranges[0].from).balance()}};function v0(t,e,i){e.start=e.pos;for(let n=0;n<10;n++){let r=t(e,i);if(e.pos>e.start)return r}throw new Error("Stream parser failed to advance stream.")}var Lf=Object.create(null),Zs=[Ne.none],tP=new gr(Zs),o0=[],l0=Object.create(null),Q0=Object.create(null);for(let[t,e]of[["variable","variableName"],["variable-2","variableName.special"],["string-2","string.special"],["def","variableName.definition"],["tag","tagName"],["attribute","attributeName"],["type","typeName"],["builtin","variableName.standard"],["qualifier","modifier"],["error","invalid"],["header","heading"],["property","propertyName"]])Q0[t]=P0(Lf,e);var El=class{constructor(e){this.extra=e,this.table=Object.assign(Object.create(null),Q0)}resolve(e){return e?this.table[e]||(this.table[e]=P0(this.extra,e)):0}},iP=new El(Lf);function mf(t,e){o0.indexOf(t)>-1||(o0.push(t),console.warn(e))}function P0(t,e){let i=[];for(let l of e.split(" ")){let a=[];for(let h of l.split(".")){let c=t[h]||O[h];c?typeof c=="function"?a.length?a=a.map(c):mf(h,`Modifier ${h} used at start of tag`):a.length?mf(h,`Tag ${h} used as modifier`):a=Array.isArray(c)?c:[c]:mf(h,`Unknown highlighting tag ${h}`)}for(let h of a)i.push(h)}if(!i.length)return 0;let n=e.replace(/ /g,"_"),r=n+" "+i.map(l=>l.id),s=l0[r];if(s)return s.id;let o=l0[r]=Ne.define({id:Zs.length,name:n,props:[at({[n]:i})]});return Zs.push(o),o.id}function nP(t,e){let i=Ne.define({id:Zs.length,name:"Document",props:[Qi.add(()=>t),Et.add(()=>n=>e.getIndent(n))],top:!0});return Zs.push(i),i}var u_={rtl:X.mark({class:"cm-iso",inclusive:!0,attributes:{dir:"rtl"},bidiIsolate:we.RTL}),ltr:X.mark({class:"cm-iso",inclusive:!0,attributes:{dir:"ltr"},bidiIsolate:we.LTR}),auto:X.mark({class:"cm-iso",inclusive:!0,attributes:{dir:"auto"},bidiIsolate:null})};var Bf=t=>{let{state:e}=t,i=e.doc.lineAt(e.selection.main.from),n=jf(t.state,i.from);return n.line?rP(t):n.block?oP(t):!1};function Nf(t,e){return({state:i,dispatch:n})=>{if(i.readOnly)return!1;let r=t(e,i);return r?(n(i.update(r)),!0):!1}}var rP=Nf(cP,0);var sP=Nf(X0,0);var oP=Nf((t,e)=>X0(t,e,aP(e)),0);function jf(t,e){let i=t.languageDataAt("commentTokens",e);return i.length?i[0]:{}}var Bs=50;function lP(t,{open:e,close:i},n,r){let s=t.sliceDoc(n-Bs,n),o=t.sliceDoc(r,r+Bs),l=/\s*$/.exec(s)[0].length,a=/^\s*/.exec(o)[0].length,h=s.length-l;if(s.slice(h-e.length,h)==e&&o.slice(a,a+i.length)==i)return{open:{pos:n-l,margin:l&&1},close:{pos:r+a,margin:a&&1}};let c,f;r-n<=2*Bs?c=f=t.sliceDoc(n,r):(c=t.sliceDoc(n,n+Bs),f=t.sliceDoc(r-Bs,r));let u=/^\s*/.exec(c)[0].length,d=/\s*$/.exec(f)[0].length,p=f.length-d-i.length;return c.slice(u,u+e.length)==e&&f.slice(p,p+i.length)==i?{open:{pos:n+u+e.length,margin:/\s/.test(c.charAt(u+e.length))?1:0},close:{pos:r-d-i.length,margin:/\s/.test(f.charAt(p-1))?1:0}}:null}function aP(t){let e=[];for(let i of t.selection.ranges){let n=t.doc.lineAt(i.from),r=i.to<=n.to?n:t.doc.lineAt(i.to);r.from>n.from&&r.from==i.to&&(r=i.to==n.to+1?n:t.doc.lineAt(i.to-1));let s=e.length-1;s>=0&&e[s].to>n.from?e[s].to=r.to:e.push({from:n.from+/^\s*/.exec(n.text)[0].length,to:r.to})}return e}function X
Line truncated
|
||||
`+i.scrub(),s=this.advance(r);return s>-1&&s<r.length?this.complete(e,n,s):!1}finish(e,i){return(this.stage==2||this.stage==3)&&Js(i.content,this.pos)==i.content.length?this.complete(e,i,i.content.length):!1}complete(e,i,n){return e.addLeafElement(i,oe(A.LinkReference,this.start,this.start+n,this.elts)),!0}nextStage(e){return e?(this.pos=e.to-this.start,this.elts.push(e),this.stage++,!0):(e===!1&&(this.stage=-1),!1)}advance(e){for(;;){if(this.stage==-1)return-1;if(this.stage==0){if(!this.nextStage(Ly(e,this.pos,this.start,!0)))return-1;if(e.charCodeAt(this.pos)!=58)return this.stage=-1;this.elts.push(oe(A.LinkMark,this.pos+this.start,this.pos+this.start+1)),this.pos++}else if(this.stage==1){if(!this.nextStage(Ey(e,Js(e,this.pos),this.start)))return-1}else if(this.stage==2){let i=Js(e,this.pos),n=0;if(i>this.pos){let r=My(e,i,this.start);if(r){let s=Nu(e,r.to-this.start);s>0&&(this.nextStage(r),n=s)}}return n||(n=Nu(e,this.pos)),n>0&&n<e.length?n:-1}else return Nu(e,this.pos)}}};function Nu(t,e){for(;e<t.length;e++){let i=t.charCodeAt(e);if(i==10)break;if(!Dt(i))return-1}return e}var Gu=class{nextLine(e,i,n){let r=i.depth<e.stack.length?-1:wy(i),s=i.next;if(r<0)return!1;let o=oe(A.HeaderMark,e.lineStart+i.pos,e.lineStart+r);return e.nextLine(),e.addLeafElement(n,oe(s==61?A.SetextHeading1:A.SetextHeading2,n.start,e.prevLineEnd(),[...e.parser.parseInline(n.content,n.start),o])),!0}finish(){return!1}},$y={LinkReference(t,e){return e.content.charCodeAt(0)==91?new Vu(e):null},SetextHeading(){return new Gu}},_T=[(t,e)=>ky(e)>=0,(t,e)=>yy(e)>=0,(t,e)=>Sy(e)>=0,(t,e)=>td(e,t,!0)>=0,(t,e)=>id(e,t,!0)>=0,(t,e)=>ed(e,t,!0)>=0,(t,e)=>Py(e,t,!0)>=0],ZT={text:"",end:0},Uu=class{constructor(e,i,n,r){this.parser=e,this.input=i,this.ranges=r,this.line=new Yu,this.atEnd=!1,this.reusePlaceholders=new Map,this.stoppedAt=null,this.rangeI=0,this.to=r[r.length-1].to,this.lineStart=this.absoluteLineStart=this.absoluteLineEnd=r[0].from,this.block=sa.create(A.Document,0,this.lineStart,0,0),this.stack=[this.block],this.fragments=n.length?new Ku(n,i):null,this.readLine()}get parsedPos(){return this.absoluteLineStart}advance(){if(this.stoppedAt!=null&&this.absoluteLineStart>this.stoppedAt)return this.finish();let{line:e}=this;for(;;){for(let n=0;;){let r=e.depth<this.stack.length?this.stack[this.stack.length-1]:null;for(;n<e.markers.length&&(!r||e.markers[n].from<r.end);){let s=e.markers[n++];this.addNode(s.type,s.from,s.to)}if(!r)break;this.finishContext()}if(e.pos<e.text.length)break;if(!this.nextLine())return this.finish()}if(this.fragments&&this.reuseFragment(e.basePos))return null;e:for(;;){for(let n of this.parser.blockParsers)if(n){let r=n(this,e);if(r!=!1){if(r==!0)return null;e.forward();continue e}}break}let i=new zu(this.lineStart+e.pos,e.text.slice(e.pos));for(let n of this.parser.leafBlockParsers)if(n){let r=n(this,i);r&&i.parsers.push(r)}e:for(;this.nextLine()&&e.pos!=e.text.length;){if(e.indent<e.baseIndent+4){for(let n of this.parser.endLeafBlock)if(n(this,e,i))break e}for(let n of i.parsers)if(n.nextLine(this,e,i))return null;i.content+=`
|
||||
`+e.scrub();for(let n of e.markers)i.marks.push(n)}return this.finishLeaf(i),null}stopAt(e){if(this.stoppedAt!=null&&this.stoppedAt<e)throw new RangeError("Can't move stoppedAt forward");this.stoppedAt=e}reuseFragment(e){if(!this.fragments.moveTo(this.absoluteLineStart+e,this.absoluteLineStart)||!this.fragments.matches(this.block.hash))return!1;let i=this.fragments.takeNodes(this);return i?(this.absoluteLineStart+=i,this.lineStart=Xy(this.absoluteLineStart,this.ranges),this.moveRangeI(),this.absoluteLineStart<this.to?(this.lineStart++,this.absoluteLineStart++,this.readLine()):(this.atEnd=!0,this.readLine()),!0):!1}get depth(){return this.stack.length}parentType(e=this.depth-1){return this.parser.nodeSet.types[this.stack[e].type]}nextLine(){return this.lineStart+=this.line.text.length,this.absoluteLineEnd>=this.to?(this.absoluteLineStart=this.absoluteLineEnd,this.atEnd=!0,this.readLine(),!1):(this.lineStart++,this.absoluteLineStart=this.absoluteLineEnd+1,this.moveRangeI(),this.readLine(),!0)}peekLine(){return this.scanLine(this.absoluteLineEnd+1).text}moveRangeI(){for(;this.rangeI<this.ranges.length-1&&this.absoluteLineStart>=this.ranges[this.rangeI].to;)this.rangeI++,this.absoluteLineStart=Math.max(this.absoluteLineStart,this.ranges[this.rangeI].from)}scanLine(e){let i=ZT;if(i.end=e,e>=this.to)i.text="";else if(i.text=this.lineChunkAt(e),i.end+=i.text.length,this.ranges.length>1){let n=this.absoluteLineStart,r=this.rangeI;for(;this.ranges[r].to<i.end;){r++;let s=this.ranges[r].from,o=this.lineChunkAt(s);i.end=s+o.length,i.text=i.text.slice(0,this.ranges[r-1].to-n)+o,n=i.end-i.text.length}}return i}readLine(){let{line:e}=this,{text:i,end:n}=this.scanLine(this.absoluteLineStart);for(this.absoluteLineEnd=n,e.reset(i);e.depth<this.stack.length;e.depth++){let r=this.stack[e.depth],s=this.parser.skipContextMarkup[r.type];if(!s)throw new Error("Unhandled block context "+A[r.type]);let o=this.line.markers.length;if(!s(r,this,e)){this.line.markers.length>o&&(r.end=this.line.markers[this.line.markers.length-1].to),e.forward();break}e.forward()}}lineChunkAt(e){let i=this.input.chunk(e),n;if(this.input.lineChunks)n=i==`
|
||||
`);n>-1&&(i=i.slice(0,n))}return e+i.length<=this.to?i:i.slice(0,this.to-e)}nextLine(){let e=this.parsedPos,i=this.lineAfter(e),n=e+i.length;for(let r=this.rangeIndex;;){let s=this.ranges[r].to;if(s>=n||(i=i.slice(0,s-(n-i.length)),r++,r==this.ranges.length))break;let o=this.ranges[r].from,l=this.lineAfter(o);i+=l,n=o+l.length}return{line:i,end:n}}skipGapsTo(e,i,n){for(;;){let r=this.ranges[this.rangeIndex].to,s=e+i;if(n>0?r>s:r>=s)break;let o=this.ranges[++this.rangeIndex].from;i+=o-r}return i}moveRangeIndex(){for(;this.ranges[this.rangeIndex].to<this.parsedPos;)this.rangeIndex++}emitToken(e,i,n,r){let s=4;if(this.ranges.length>1){r=this.skipGapsTo(i,r,1),i+=r;let l=this.chunk.length;r=this.skipGapsTo(n,r,-1),n+=r,s+=this.chunk.length-l}let o=this.chunk.length-4;return this.lang.streamParser.mergeTokens&&s==4&&o>=0&&this.chunk[o]==e&&this.chunk[o+2]==i?this.chunk[o+2]=n:this.chunk.push(e,i,n,s),r}parseLine(e){let{line:i,end:n}=this.nextLine(),r=0,{streamParser:s}=this.lang,o=new Al(i,e?e.state.tabSize:4,e?Wt(e.state):2);if(o.eol())s.blankLine(this.state,o.indentUnit);else for(;!o.eol();){let l=w0(s.token,o,this.state);if(l&&(r=this.emitToken(this.lang.tokenTable.resolve(l),this.parsedPos+o.start,this.parsedPos+o.pos,r)),o.start>1e4)break}this.parsedPos=n,this.moveRangeIndex(),this.parsedPos<this.to&&this.parsedPos++}finishChunk(){let e=ue.build({buffer:this.chunk,start:this.chunkStart,length:this.parsedPos-this.chunkStart,nodeSet:rP,topID:0,maxBufferLength:2048,reused:this.chunkReused});e=new ue(e.type,e.children,e.positions,e.length,[[this.lang.stateAfter,this.lang.streamParser.copyState(this.state)]]),this.chunks.push(e),this.chunkPos.push(this.chunkStart-this.ranges[0].from),this.chunk=[],this.chunkReused=void 0,this.chunkStart=this.parsedPos}finish(){return new ue(this.lang.topNode,this.chunks,this.chunkPos,this.parsedPos-this.ranges[0].from).balance()}};function w0(t,e,i){e.start=e.pos;for(let n=0;n<10;n++){let r=t(e,i);if(e.pos>e.start)return r}throw new Error("Stream parser failed to advance stream.")}var Mf=Object.create(null),Zs=[Ne.none],rP=new gr(Zs),s0=[],o0=Object.create(null),v0=Object.create(null);for(let[t,e]of[["variable","variableName"],["variable-2","variableName.special"],["string-2","string.special"],["def","variableName.definition"],["tag","tagName"],["attribute","attributeName"],["type","typeName"],["builtin","variableName.standard"],["qualifier","modifier"],["error","invalid"],["header","heading"],["property","propertyName"]])v0[t]=Q0(Mf,e);var Rl=class{constructor(e){this.extra=e,this.table=Object.assign(Object.create(null),v0)}resolve(e){return e?this.table[e]||(this.table[e]=Q0(this.extra,e)):0}},sP=new Rl(Mf);function Of(t,e){s0.indexOf(t)>-1||(s0.push(t),console.warn(e))}function Q0(t,e){let i=[];for(let l of e.split(" ")){let a=[];for(let h of l.split(".")){let c=t[h]||O[h];c?typeof c=="function"?a.length?a=a.map(c):Of(h,`Modifier ${h} used at start of tag`):a.length?Of(h,`Tag ${h} used as modifier`):a=Array.isArray(c)?c:[c]:Of(h,`Unknown highlighting tag ${h}`)}for(let h of a)i.push(h)}if(!i.length)return 0;let n=e.replace(/ /g,"_"),r=n+" "+i.map(l=>l.id),s=o0[r];if(s)return s.id;let o=o0[r]=Ne.define({id:Zs.length,name:n,props:[at({[n]:i})]});return Zs.push(o),o.id}function oP(t,e){let i=Ne.define({id:Zs.length,name:"Document",props:[Qi.add(()=>t),Et.add(()=>n=>e.getIndent(n))],top:!0});return Zs.push(i),i}var O_={rtl:X.mark({class:"cm-iso",inclusive:!0,attributes:{dir:"rtl"},bidiIsolate:we.RTL}),ltr:X.mark({class:"cm-iso",inclusive:!0,attributes:{dir:"ltr"},bidiIsolate:we.LTR}),auto:X.mark({class:"cm-iso",inclusive:!0,attributes:{dir:"auto"},bidiIsolate:null})};var If=t=>{let{state:e}=t,i=e.doc.lineAt(e.selection.main.from),n=Nf(t.state,i.from);return n.line?lP(t):n.block?cP(t):!1};function Bf(t,e){return({state:i,dispatch:n})=>{if(i.readOnly)return!1;let r=t(e,i);return r?(n(i.update(r)),!0):!1}}var lP=Bf(uP,0);var aP=Bf(L0,0);var cP=Bf((t,e)=>L0(t,e,fP(e)),0);function Nf(t,e){let i=t.languageDataAt("commentTokens",e);return i.length?i[0]:{}}var Bs=50;function hP(t,{open:e,close:i},n,r){let s=t.sliceDoc(n-Bs,n),o=t.sliceDoc(r,r+Bs),l=/\s*$/.exec(s)[0].length,a=/^\s*/.exec(o)[0].length,h=s.length-l;if(s.slice(h-e.length,h)==e&&o.slice(a,a+i.length)==i)return{open:{pos:n-l,margin:l&&1},close:{pos:r+a,margin:a&&1}};let c,f;r-n<=2*Bs?c=f=t.sliceDoc(n,r):(c=t.sliceDoc(n,n+Bs),f=t.sliceDoc(r-Bs,r));let u=/^\s*/.exec(c)[0].length,d=/\s*$/.exec(f)[0].length,p=f.length-d-i.length;return c.slice(u,u+e.length)==e&&f.slice(p,p+i.length)==i?{open:{pos:n+u+e.length,margin:/\s/.test(c.charAt(u+e.length))?1:0},close:{pos:r-d-i.length,margin:/\s/.test(f.charAt(p-1))?1:0}}:null}function fP(t){let e=[];for(let i of t.selection.ranges){let n=t.doc.lineAt(i.from),r=i.to<=n.to?n:t.doc.lineAt(i.to);r.from>n.from&&r.from==i.to&&(r=i.to==n.to+1?n:t.doc.lineAt(i.to-1));let s=e.length-1;s>=0&&e[s].to>n.from?e[s].to=r.to:e.push({from:n.from+/^\s*/.exec(n.text)[0].length,to:r.to})}return e}function L
Line truncated
|
||||
`+i.scrub(),s=this.advance(r);return s>-1&&s<r.length?this.complete(e,n,s):!1}finish(e,i){return(this.stage==2||this.stage==3)&&Js(i.content,this.pos)==i.content.length?this.complete(e,i,i.content.length):!1}complete(e,i,n){return e.addLeafElement(i,oe(A.LinkReference,this.start,this.start+n,this.elts)),!0}nextStage(e){return e?(this.pos=e.to-this.start,this.elts.push(e),this.stage++,!0):(e===!1&&(this.stage=-1),!1)}advance(e){for(;;){if(this.stage==-1)return-1;if(this.stage==0){if(!this.nextStage(My(e,this.pos,this.start,!0)))return-1;if(e.charCodeAt(this.pos)!=58)return this.stage=-1;this.elts.push(oe(A.LinkMark,this.pos+this.start,this.pos+this.start+1)),this.pos++}else if(this.stage==1){if(!this.nextStage(Ry(e,Js(e,this.pos),this.start)))return-1}else if(this.stage==2){let i=Js(e,this.pos),n=0;if(i>this.pos){let r=Ey(e,i,this.start);if(r){let s=Bu(e,r.to-this.start);s>0&&(this.nextStage(r),n=s)}}return n||(n=Bu(e,this.pos)),n>0&&n<e.length?n:-1}else return Bu(e,this.pos)}}};function Bu(t,e){for(;e<t.length;e++){let i=t.charCodeAt(e);if(i==10)break;if(!Dt(i))return-1}return e}var Vu=class{nextLine(e,i,n){let r=i.depth<e.stack.length?-1:ky(i),s=i.next;if(r<0)return!1;let o=oe(A.HeaderMark,e.lineStart+i.pos,e.lineStart+r);return e.nextLine(),e.addLeafElement(n,oe(s==61?A.SetextHeading1:A.SetextHeading2,n.start,e.prevLineEnd(),[...e.parser.parseInline(n.content,n.start),o])),!0}finish(){return!1}},Py={LinkReference(t,e){return e.content.charCodeAt(0)==91?new Wu(e):null},SetextHeading(){return new Vu}},IT=[(t,e)=>xy(e)>=0,(t,e)=>by(e)>=0,(t,e)=>yy(e)>=0,(t,e)=>ed(e,t,!0)>=0,(t,e)=>td(e,t,!0)>=0,(t,e)=>Ju(e,t,!0)>=0,(t,e)=>Qy(e,t,!0)>=0],BT={text:"",end:0},Gu=class{constructor(e,i,n,r){this.parser=e,this.input=i,this.ranges=r,this.line=new zu,this.atEnd=!1,this.reusePlaceholders=new Map,this.stoppedAt=null,this.rangeI=0,this.to=r[r.length-1].to,this.lineStart=this.absoluteLineStart=this.absoluteLineEnd=r[0].from,this.block=ra.create(A.Document,0,this.lineStart,0,0),this.stack=[this.block],this.fragments=n.length?new Hu(n,i):null,this.readLine()}get parsedPos(){return this.absoluteLineStart}advance(){if(this.stoppedAt!=null&&this.absoluteLineStart>this.stoppedAt)return this.finish();let{line:e}=this;for(;;){for(let n=0;;){let r=e.depth<this.stack.length?this.stack[this.stack.length-1]:null;for(;n<e.markers.length&&(!r||e.markers[n].from<r.end);){let s=e.markers[n++];this.addNode(s.type,s.from,s.to)}if(!r)break;this.finishContext()}if(e.pos<e.text.length)break;if(!this.nextLine())return this.finish()}if(this.fragments&&this.reuseFragment(e.basePos))return null;e:for(;;){for(let n of this.parser.blockParsers)if(n){let r=n(this,e);if(r!=!1){if(r==!0)return null;e.forward();continue e}}break}let i=new ju(this.lineStart+e.pos,e.text.slice(e.pos));for(let n of this.parser.leafBlockParsers)if(n){let r=n(this,i);r&&i.parsers.push(r)}e:for(;this.nextLine()&&e.pos!=e.text.length;){if(e.indent<e.baseIndent+4){for(let n of this.parser.endLeafBlock)if(n(this,e,i))break e}for(let n of i.parsers)if(n.nextLine(this,e,i))return null;i.content+=`
|
||||
`+e.scrub();for(let n of e.markers)i.marks.push(n)}return this.finishLeaf(i),null}stopAt(e){if(this.stoppedAt!=null&&this.stoppedAt<e)throw new RangeError("Can't move stoppedAt forward");this.stoppedAt=e}reuseFragment(e){if(!this.fragments.moveTo(this.absoluteLineStart+e,this.absoluteLineStart)||!this.fragments.matches(this.block.hash))return!1;let i=this.fragments.takeNodes(this);return i?(this.absoluteLineStart+=i,this.lineStart=Ly(this.absoluteLineStart,this.ranges),this.moveRangeI(),this.absoluteLineStart<this.to?(this.lineStart++,this.absoluteLineStart++,this.readLine()):(this.atEnd=!0,this.readLine()),!0):!1}get depth(){return this.stack.length}parentType(e=this.depth-1){return this.parser.nodeSet.types[this.stack[e].type]}nextLine(){return this.lineStart+=this.line.text.length,this.absoluteLineEnd>=this.to?(this.absoluteLineStart=this.absoluteLineEnd,this.atEnd=!0,this.readLine(),!1):(this.lineStart++,this.absoluteLineStart=this.absoluteLineEnd+1,this.moveRangeI(),this.readLine(),!0)}peekLine(){return this.scanLine(this.absoluteLineEnd+1).text}moveRangeI(){for(;this.rangeI<this.ranges.length-1&&this.absoluteLineStart>=this.ranges[this.rangeI].to;)this.rangeI++,this.absoluteLineStart=Math.max(this.absoluteLineStart,this.ranges[this.rangeI].from)}scanLine(e){let i=BT;if(i.end=e,e>=this.to)i.text="";else if(i.text=this.lineChunkAt(e),i.end+=i.text.length,this.ranges.length>1){let n=this.absoluteLineStart,r=this.rangeI;for(;this.ranges[r].to<i.end;){r++;let s=this.ranges[r].from,o=this.lineChunkAt(s);i.end=s+o.length,i.text=i.text.slice(0,this.ranges[r-1].to-n)+o,n=i.end-i.text.length}}return i}readLine(){let{line:e}=this,{text:i,end:n}=this.scanLine(this.absoluteLineStart);for(this.absoluteLineEnd=n,e.reset(i);e.depth<this.stack.length;e.depth++){let r=this.stack[e.depth],s=this.parser.skipContextMarkup[r.type];if(!s)throw new Error("Unhandled block context "+A[r.type]);let o=this.line.markers.length;if(!s(r,this,e)){this.line.markers.length>o&&(r.end=this.line.markers[this.line.markers.length-1].to),e.forward();break}e.forward()}}lineChunkAt(e){let i=this.input.chunk(e),n;if(this.input.lineChunks)n=i==`
|
||||
`?"":i;else{let r=i.indexOf(`
|
||||
`);n=r<0?i:i.slice(0,r)}return e+n.length>this.to?n.slice(0,this.to-e):n}prevLineEnd(){return this.atEnd?this.lineStart:this.lineStart-1}startContext(e,i,n=0){this.block=sa.create(e,n,this.lineStart+i,this.block.hash,this.lineStart+this.line.text.length),this.stack.push(this.block)}startComposite(e,i,n=0){this.startContext(this.parser.getNodeType(e),i,n)}addNode(e,i,n){typeof e=="number"&&(e=new Me(this.parser.nodeSet.types[e],Rr,Rr,(n!=null?n:this.prevLineEnd())-i)),this.block.addChild(e,i-this.block.from)}addElement(e){this.block.addChild(e.toTree(this.parser.nodeSet),e.from-this.block.from)}addLeafElement(e,i){this.addNode(this.buffer.writeElements(Hu(i.children,e.marks),-i.from).finish(i.type,i.to-i.from),i.from)}finishContext(){let e=this.stack.pop(),i=this.stack[this.stack.length-1];i.addChild(e.toTree(this.parser.nodeSet),e.from-i.from),this.block=i}finish(){for(;this.stack.length>1;)this.finishContext();return this.addGaps(this.block.toTree(this.parser.nodeSet,this.lineStart))}addGaps(e){return this.ranges.length>1?Ty(this.ranges,0,e.topNode,this.ranges[0].from,this.reusePlaceholders):e}finishLeaf(e){for(let n of e.parsers)if(n.finish(this,e))return;let i=Hu(this.parser.parseInline(e.content,e.start),e.marks);this.addNode(this.buffer.writeElements(i,-e.start).finish(A.Paragraph,e.content.length),e.start)}elt(e,i,n,r){return typeof e=="string"?oe(this.parser.getNodeType(e),i,n,r):new la(e,i)}get buffer(){return new oa(this.parser.nodeSet)}};function Ty(t,e,i,n,r){let s=t[e].to,o=[],l=[],a=i.from+n;function h(c,f){for(;f?c>=s:c>s;){let u=t[e+1].from-s;n+=u,c+=u,e++,s=t[e].to}}for(let c=i.firstChild;c;c=c.nextSibling){h(c.from+n,!0);let f=c.from+n,u,d=r.get(c.tree);d?u=d:c.to+n>s?(u=Ty(t,e,c,n,r),h(c.to+n,!1)):u=c.toTree(),o.push(u),l.push(f-a)}return h(i.to+n,!1),new Me(i.type,o,l,i.to+n-a,i.tree?i.tree.propValues:void 0)}var to=class t extends ea{constructor(e,i,n,r,s,o,l,a,h){super(),this.nodeSet=e,this.blockParsers=i,this.leafBlockParsers=n,this.blockNames=r,this.endLeafBlock=s,this.skipContextMarkup=o,this.inlineParsers=l,this.inlineNames=a,this.wrappers=h,this.nodeTypes=Object.create(null);for(let c of e.types)this.nodeTypes[c.name]=c.id}createParse(e,i,n){let r=new Uu(this,e,i,n);for(let s of this.wrappers)r=s(r,e,i,n);return r}configure(e){let i=Fu(e);if(!i)return this;let{nodeSet:n,skipContextMarkup:r}=this,s=this.blockParsers.slice(),o=this.leafBlockParsers.slice(),l=this.blockNames.slice(),a=this.inlineParsers.slice(),h=this.inlineNames.slice(),c=this.endLeafBlock.slice(),f=this.wrappers;if(Ks(i.defineNodes)){r=Object.assign({},r);let u=n.types.slice(),d;for(let p of i.defineNodes){let{name:g,block:m,composite:b,style:y}=typeof p=="string"?{name:p}:p;if(u.some(x=>x.name==g))continue;b&&(r[u.length]=(x,w,k)=>b(w,k,x.value));let S=u.length,v=b?["Block","BlockContext"]:m?S>=A.ATXHeading1&&S<=A.SetextHeading2?["Block","LeafBlock","Heading"]:["Block","LeafBlock"]:void 0;u.push(tt.define({id:S,name:g,props:v&&[[de.group,v]]})),y&&(d||(d={}),Array.isArray(y)||y instanceof $e?d[g]=y:Object.assign(d,y))}n=new Us(u),d&&(n=n.extend(at(d)))}if(Ks(i.props)&&(n=n.extend(...i.props)),Ks(i.remove))for(let u of i.remove){let d=this.blockNames.indexOf(u),p=this.inlineNames.indexOf(u);d>-1&&(s[d]=o[d]=void 0),p>-1&&(a[p]=void 0)}if(Ks(i.parseBlock))for(let u of i.parseBlock){let d=l.indexOf(u.name);if(d>-1)s[d]=u.parse,o[d]=u.leaf;else{let p=u.before?ra(l,u.before):u.after?ra(l,u.after)+1:l.length-1;s.splice(p,0,u.parse),o.splice(p,0,u.leaf),l.splice(p,0,u.name)}u.endLeaf&&c.push(u.endLeaf)}if(Ks(i.parseInline))for(let u of i.parseInline){let d=h.indexOf(u.name);if(d>-1)a[d]=u.parse;else{let p=u.before?ra(h,u.before):u.after?ra(h,u.after)+1:h.length-1;a.splice(p,0,u.parse),h.splice(p,0,u.name)}}return i.wrap&&(f=f.concat(i.wrap)),new t(n,s,o,l,c,r,a,h,f)}getNodeType(e){let i=this.nodeTypes[e];if(i==null)throw new RangeError(`Unknown node type '${e}'`);return i}parseInline(e,i){let n=new no(this,e,i);e:for(let r=i;r<n.end;){let s=n.char(r);for(let o of this.inlineParsers)if(o){let l=o(n,s,r);if(l>=0){r=l;continue e}}r++}return n.resolveMarkers(0)}};function Ks(t){return t!=null&&t.length>0}function Fu(t){if(!Array.isArray(t))return t;if(t.length==0)return null;let e=Fu(t[0]);if(t.length==1)return e;let i=Fu(t.slice(1));if(!i||!e)return e||i;let n=(o,l)=>(o||Rr).concat(l||Rr),r=e.wrap,s=i.wrap;return{props:n(e.props,i.props),defineNodes:n(e.defineNodes,i.defineNodes),parseBlock:n(e.parseBlock,i.parseBlock),parseInline:n(e.parseInline,i.parseInline),remove:n(e.remove,i.remove),wrap:r?s?(o,l,a,h)=>r(s(o,l,a,h),l,a,h):r:s}}function ra(t,e){let i=t.indexOf(e);if(i<0)throw new RangeError(`Position specified relative to unknown parser ${e}`);return i}var Cy=[tt.none];for(let t=1,e;e=A[t];t++)Cy[t]=tt.define({id:t,name:e,props:t>=A.Escape?[]:[[de.group,t in by?["Block","BlockContext"]:["Block","LeafBlock"]]],top:e=="Document"});var Rr=[],oa=class{constructor(e){this.nodeSet=e,this.content=[],this.nodes=[]}write(e,i,n,
Line truncated
|
||||
`;)s--;this.fragmentEnd=s?s-1:0}let n=this.cursor;n||(n=this.cursor=this.fragment.tree.cursor(),n.firstChild());let r=e+this.fragment.offset;for(;n.to<=r;)if(!n.parent())return!1;for(;;){if(n.from>=r)return this.fragment.from<=i;if(!n.childAfter(r))return!1}}matches(e){let i=this.cursor.tree;return i&&i.prop(de.contextHash)==e}takeNodes(e){let i=this.cursor,n=this.fragment.offset,r=this.fragmentEnd-(this.fragment.openEnd?1:0),s=e.absoluteLineStart,o=s,l=e.block.children.length,a=o,h=l;for(;;){if(i.to-n>r){if(i.type.isAnonymous&&i.firstChild())continue;break}let c=Xy(i.from-n,e.ranges);if(i.to-n<=e.ranges[e.rangeI].to)e.addNode(i.tree,c);else{let f=new Me(e.parser.nodeSet.types[A.Paragraph],[],[],0,e.block.hashProp);e.reusePlaceholders.set(f,i.tree),e.addNode(f,c)}if(i.type.is("Block")&&(IT.indexOf(i.type.id)<0?(o=i.to-n,l=e.block.children.length):(o=a,l=h),a=i.to-n,h=e.block.children.length),!i.nextSibling())break}for(;e.block.children.length>l;)e.block.children.pop(),e.block.positions.pop();return o-s}};function Xy(t,e){let i=t;for(let n=1;n<e.length;n++){let r=e[n-1].to,s=e[n].from;r<t&&(i-=s-r)}return i}var BT=at({"Blockquote/...":O.quote,HorizontalRule:O.contentSeparator,"ATXHeading1/... SetextHeading1/...":O.heading1,"ATXHeading2/... SetextHeading2/...":O.heading2,"ATXHeading3/...":O.heading3,"ATXHeading4/...":O.heading4,"ATXHeading5/...":O.heading5,"ATXHeading6/...":O.heading6,"Comment CommentBlock":O.comment,Escape:O.escape,Entity:O.character,"Emphasis/...":O.emphasis,"StrongEmphasis/...":O.strong,"Link/... Image/...":O.link,"OrderedList/... BulletList/...":O.list,"BlockQuote/...":O.quote,"InlineCode CodeText":O.monospace,"URL Autolink":O.url,"HeaderMark HardBreak QuoteMark ListMark LinkMark EmphasisMark CodeMark":O.processingInstruction,"CodeInfo LinkLabel":O.labelName,LinkTitle:O.string,Paragraph:O.content}),_y=new to(new Us(Cy).extend(BT),Object.keys(na).map(t=>na[t]),Object.keys(na).map(t=>$y[t]),Object.keys(na),_T,by,Object.keys(ju).map(t=>ju[t]),Object.keys(ju),[]);function NT(t,e,i){let n=[];for(let r=t.firstChild,s=e;;r=r.nextSibling){let o=r?r.from:i;if(o>s&&n.push({from:s,to:o}),!r)break;s=r.to}return n}function Zy(t){let{codeParser:e,htmlParser:i}=t;return{wrap:oy((r,s)=>{let o=r.type.id;if(e&&(o==A.CodeBlock||o==A.FencedCode)){let l="";if(o==A.FencedCode){let h=r.node.getChild(A.CodeInfo);h&&(l=s.read(h.from,h.to))}let a=e(l);if(a)return{parser:a,overlay:h=>h.type.id==A.CodeText,bracketed:o==A.FencedCode}}else if(i&&(o==A.HTMLBlock||o==A.HTMLTag||o==A.CommentBlock))return{parser:i,overlay:NT(r.node,r.from,r.to)};return null})}}var jT={resolve:"Strikethrough",mark:"StrikethroughMark"},zT={defineNodes:[{name:"Strikethrough",style:{"Strikethrough/...":O.strikethrough}},{name:"StrikethroughMark",style:O.processingInstruction}],parseInline:[{name:"Strikethrough",parse(t,e,i){if(e!=126||t.char(i+1)!=126||t.char(i+2)==126)return-1;let n=t.slice(i-1,i),r=t.slice(i+2,i+3),s=/\s|^$/.test(n),o=/\s|^$/.test(r),l=io.test(n),a=io.test(r);return t.addDelimiter(jT,i,i+2,!o&&(!a||s||l),!s&&(!l||o||a))},after:"Emphasis"}]};function eo(t,e,i=0,n,r=0){let s=0,o=!0,l=-1,a=-1,h=!1,c=()=>{n.push(t.elt("TableCell",r+l,r+a,t.parser.parseInline(e.slice(l,a),r+l)))};for(let f=i;f<e.length;f++){let u=e.charCodeAt(f);u==124&&!h?((!o||l>-1)&&s++,o=!1,n&&(l>-1&&c(),n.push(t.elt("TableDelimiter",f+r,f+r+1))),l=a=-1):(h||u!=32&&u!=9)&&(l<0&&(l=f),a=f+1),h=!h&&u==92}return l>-1&&(s++,n&&c()),s}function fy(t,e){for(let i=e;i<t.length;i++){let n=t.charCodeAt(i);if(n==124)return!0;n==92&&i++}return!1}var Dy=/^\|?(\s*:?-+:?\s*\|)+(\s*:?-+:?\s*)?$/,ca=class{constructor(){this.rows=null}nextLine(e,i,n){if(this.rows==null){this.rows=!1;let r;if((i.next==45||i.next==58||i.next==124)&&Dy.test(r=i.text.slice(i.pos))){let s=[];eo(e,n.content,0,s,n.start)==eo(e,r,0)&&(this.rows=[e.elt("TableHeader",n.start,n.start+n.content.length,s),e.elt("TableDelimiter",e.lineStart+i.pos,e.lineStart+i.text.length)])}}else if(this.rows){let r=[];eo(e,i.text,i.pos,r,e.lineStart),this.rows.push(e.elt("TableRow",e.lineStart+i.pos,e.lineStart+i.text.length,r))}return!1}finish(e,i){return this.rows?(e.addLeafElement(i,e.elt("Table",i.start,i.start+i.content.length,this.rows)),!0):!1}},YT={defineNodes:[{name:"Table",block:!0},{name:"TableHeader",style:{"TableHeader/...":O.heading}},"TableRow",{name:"TableCell",style:O.content},{name:"TableDelimiter",style:O.processingInstruction}],parseBlock:[{name:"Table",leaf(t,e){return fy(e.content,0)?new ca:null},endLeaf(t,e,i){if(i.parsers.some(r=>r instanceof ca)||!fy(e.text,e.basePos))return!1;let n=t.peekLine();return Dy.test(n)&&eo(t,e.text,e.basePos)==eo(t,n,e.basePos)},before:"SetextHeading"}]},Ju=class{nextLine(){return!1}finish(e,i){return e.addLeafElement(i,e.elt("Task",i.start,i.start+i.content.length,[e.elt("TaskMarker",i.start,i.start+3),...e.parser.parseInline(i.content.slice(3),i.start+3)])),!0}},qT={defineNodes:[{name:"Task",block:!0,style:O.list},{name:"TaskMarker",style:O.atom}],parseBlock:[{name:
Line truncated
|
||||
`);n=r<0?i:i.slice(0,r)}return e+n.length>this.to?n.slice(0,this.to-e):n}prevLineEnd(){return this.atEnd?this.lineStart:this.lineStart-1}startContext(e,i,n=0){this.block=ra.create(e,n,this.lineStart+i,this.block.hash,this.lineStart+this.line.text.length),this.stack.push(this.block)}startComposite(e,i,n=0){this.startContext(this.parser.getNodeType(e),i,n)}addNode(e,i,n){typeof e=="number"&&(e=new Me(this.parser.nodeSet.types[e],Rr,Rr,(n!=null?n:this.prevLineEnd())-i)),this.block.addChild(e,i-this.block.from)}addElement(e){this.block.addChild(e.toTree(this.parser.nodeSet),e.from-this.block.from)}addLeafElement(e,i){this.addNode(this.buffer.writeElements(Fu(i.children,e.marks),-i.from).finish(i.type,i.to-i.from),i.from)}finishContext(){let e=this.stack.pop(),i=this.stack[this.stack.length-1];i.addChild(e.toTree(this.parser.nodeSet),e.from-i.from),this.block=i}finish(){for(;this.stack.length>1;)this.finishContext();return this.addGaps(this.block.toTree(this.parser.nodeSet,this.lineStart))}addGaps(e){return this.ranges.length>1?$y(this.ranges,0,e.topNode,this.ranges[0].from,this.reusePlaceholders):e}finishLeaf(e){for(let n of e.parsers)if(n.finish(this,e))return;let i=Fu(this.parser.parseInline(e.content,e.start),e.marks);this.addNode(this.buffer.writeElements(i,-e.start).finish(A.Paragraph,e.content.length),e.start)}elt(e,i,n,r){return typeof e=="string"?oe(this.parser.getNodeType(e),i,n,r):new oa(e,i)}get buffer(){return new sa(this.parser.nodeSet)}};function $y(t,e,i,n,r){let s=t[e].to,o=[],l=[],a=i.from+n;function h(c,f){for(;f?c>=s:c>s;){let u=t[e+1].from-s;n+=u,c+=u,e++,s=t[e].to}}for(let c=i.firstChild;c;c=c.nextSibling){h(c.from+n,!0);let f=c.from+n,u,d=r.get(c.tree);d?u=d:c.to+n>s?(u=$y(t,e,c,n,r),h(c.to+n,!1)):u=c.toTree(),o.push(u),l.push(f-a)}return h(i.to+n,!1),new Me(i.type,o,l,i.to+n-a,i.tree?i.tree.propValues:void 0)}var to=class t extends Jl{constructor(e,i,n,r,s,o,l,a,h){super(),this.nodeSet=e,this.blockParsers=i,this.leafBlockParsers=n,this.blockNames=r,this.endLeafBlock=s,this.skipContextMarkup=o,this.inlineParsers=l,this.inlineNames=a,this.wrappers=h,this.nodeTypes=Object.create(null);for(let c of e.types)this.nodeTypes[c.name]=c.id}createParse(e,i,n){let r=new Gu(this,e,i,n);for(let s of this.wrappers)r=s(r,e,i,n);return r}configure(e){let i=Uu(e);if(!i)return this;let{nodeSet:n,skipContextMarkup:r}=this,s=this.blockParsers.slice(),o=this.leafBlockParsers.slice(),l=this.blockNames.slice(),a=this.inlineParsers.slice(),h=this.inlineNames.slice(),c=this.endLeafBlock.slice(),f=this.wrappers;if(Ks(i.defineNodes)){r=Object.assign({},r);let u=n.types.slice(),d;for(let p of i.defineNodes){let{name:g,block:m,composite:b,style:y}=typeof p=="string"?{name:p}:p;if(u.some(x=>x.name==g))continue;b&&(r[u.length]=(x,w,k)=>b(w,k,x.value));let S=u.length,v=b?["Block","BlockContext"]:m?S>=A.ATXHeading1&&S<=A.SetextHeading2?["Block","LeafBlock","Heading"]:["Block","LeafBlock"]:void 0;u.push(tt.define({id:S,name:g,props:v&&[[de.group,v]]})),y&&(d||(d={}),Array.isArray(y)||y instanceof $e?d[g]=y:Object.assign(d,y))}n=new Us(u),d&&(n=n.extend(at(d)))}if(Ks(i.props)&&(n=n.extend(...i.props)),Ks(i.remove))for(let u of i.remove){let d=this.blockNames.indexOf(u),p=this.inlineNames.indexOf(u);d>-1&&(s[d]=o[d]=void 0),p>-1&&(a[p]=void 0)}if(Ks(i.parseBlock))for(let u of i.parseBlock){let d=l.indexOf(u.name);if(d>-1)s[d]=u.parse,o[d]=u.leaf;else{let p=u.before?na(l,u.before):u.after?na(l,u.after)+1:l.length-1;s.splice(p,0,u.parse),o.splice(p,0,u.leaf),l.splice(p,0,u.name)}u.endLeaf&&c.push(u.endLeaf)}if(Ks(i.parseInline))for(let u of i.parseInline){let d=h.indexOf(u.name);if(d>-1)a[d]=u.parse;else{let p=u.before?na(h,u.before):u.after?na(h,u.after)+1:h.length-1;a.splice(p,0,u.parse),h.splice(p,0,u.name)}}return i.wrap&&(f=f.concat(i.wrap)),new t(n,s,o,l,c,r,a,h,f)}getNodeType(e){let i=this.nodeTypes[e];if(i==null)throw new RangeError(`Unknown node type '${e}'`);return i}parseInline(e,i){let n=new no(this,e,i);e:for(let r=i;r<n.end;){let s=n.char(r);for(let o of this.inlineParsers)if(o){let l=o(n,s,r);if(l>=0){r=l;continue e}}r++}return n.resolveMarkers(0)}};function Ks(t){return t!=null&&t.length>0}function Uu(t){if(!Array.isArray(t))return t;if(t.length==0)return null;let e=Uu(t[0]);if(t.length==1)return e;let i=Uu(t.slice(1));if(!i||!e)return e||i;let n=(o,l)=>(o||Rr).concat(l||Rr),r=e.wrap,s=i.wrap;return{props:n(e.props,i.props),defineNodes:n(e.defineNodes,i.defineNodes),parseBlock:n(e.parseBlock,i.parseBlock),parseInline:n(e.parseInline,i.parseInline),remove:n(e.remove,i.remove),wrap:r?s?(o,l,a,h)=>r(s(o,l,a,h),l,a,h):r:s}}function na(t,e){let i=t.indexOf(e);if(i<0)throw new RangeError(`Position specified relative to unknown parser ${e}`);return i}var Ty=[tt.none];for(let t=1,e;e=A[t];t++)Ty[t]=tt.define({id:t,name:e,props:t>=A.Escape?[]:[[de.group,t in my?["Block","BlockContext"]:["Block","LeafBlock"]]],top:e=="Document"});var Rr=[],sa=class{constructor(e){this.nodeSet=e,this.content=[],this.nodes=[]}write(e,i,n,
Line truncated
|
||||
`;)s--;this.fragmentEnd=s?s-1:0}let n=this.cursor;n||(n=this.cursor=this.fragment.tree.cursor(),n.firstChild());let r=e+this.fragment.offset;for(;n.to<=r;)if(!n.parent())return!1;for(;;){if(n.from>=r)return this.fragment.from<=i;if(!n.childAfter(r))return!1}}matches(e){let i=this.cursor.tree;return i&&i.prop(de.contextHash)==e}takeNodes(e){let i=this.cursor,n=this.fragment.offset,r=this.fragmentEnd-(this.fragment.openEnd?1:0),s=e.absoluteLineStart,o=s,l=e.block.children.length,a=o,h=l;for(;;){if(i.to-n>r){if(i.type.isAnonymous&&i.firstChild())continue;break}let c=Ly(i.from-n,e.ranges);if(i.to-n<=e.ranges[e.rangeI].to)e.addNode(i.tree,c);else{let f=new Me(e.parser.nodeSet.types[A.Paragraph],[],[],0,e.block.hashProp);e.reusePlaceholders.set(f,i.tree),e.addNode(f,c)}if(i.type.is("Block")&&(jT.indexOf(i.type.id)<0?(o=i.to-n,l=e.block.children.length):(o=a,l=h),a=i.to-n,h=e.block.children.length),!i.nextSibling())break}for(;e.block.children.length>l;)e.block.children.pop(),e.block.positions.pop();return o-s}};function Ly(t,e){let i=t;for(let n=1;n<e.length;n++){let r=e[n-1].to,s=e[n].from;r<t&&(i-=s-r)}return i}var zT=at({"Blockquote/...":O.quote,HorizontalRule:O.contentSeparator,"ATXHeading1/... SetextHeading1/...":O.heading1,"ATXHeading2/... SetextHeading2/...":O.heading2,"ATXHeading3/...":O.heading3,"ATXHeading4/...":O.heading4,"ATXHeading5/...":O.heading5,"ATXHeading6/...":O.heading6,"Comment CommentBlock":O.comment,Escape:O.escape,Entity:O.character,"Emphasis/...":O.emphasis,"StrongEmphasis/...":O.strong,"Link/... Image/...":O.link,"OrderedList/... BulletList/...":O.list,"BlockQuote/...":O.quote,"InlineCode CodeText":O.monospace,"URL Autolink":O.url,"HeaderMark HardBreak QuoteMark ListMark LinkMark EmphasisMark CodeMark":O.processingInstruction,"CodeInfo LinkLabel":O.labelName,LinkTitle:O.string,Paragraph:O.content}),Xy=new to(new Us(Ty).extend(zT),Object.keys(ia).map(t=>ia[t]),Object.keys(ia).map(t=>Py[t]),Object.keys(ia),IT,my,Object.keys(Nu).map(t=>Nu[t]),Object.keys(Nu),[]);function YT(t,e,i){let n=[];for(let r=t.firstChild,s=e;;r=r.nextSibling){let o=r?r.from:i;if(o>s&&n.push({from:s,to:o}),!r)break;s=r.to}return n}function _y(t){let{codeParser:e,htmlParser:i}=t;return{wrap:sy((r,s)=>{let o=r.type.id;if(e&&(o==A.CodeBlock||o==A.FencedCode)){let l="";if(o==A.FencedCode){let h=r.node.getChild(A.CodeInfo);h&&(l=s.read(h.from,h.to))}let a=e(l);if(a)return{parser:a,overlay:h=>h.type.id==A.CodeText,bracketed:o==A.FencedCode}}else if(i&&(o==A.HTMLBlock||o==A.HTMLTag||o==A.CommentBlock))return{parser:i,overlay:YT(r.node,r.from,r.to)};return null})}}var qT={resolve:"Strikethrough",mark:"StrikethroughMark"},WT={defineNodes:[{name:"Strikethrough",style:{"Strikethrough/...":O.strikethrough}},{name:"StrikethroughMark",style:O.processingInstruction}],parseInline:[{name:"Strikethrough",parse(t,e,i){if(e!=126||t.char(i+1)!=126||t.char(i+2)==126)return-1;let n=t.slice(i-1,i),r=t.slice(i+2,i+3),s=/\s|^$/.test(n),o=/\s|^$/.test(r),l=io.test(n),a=io.test(r);return t.addDelimiter(qT,i,i+2,!o&&(!a||s||l),!s&&(!l||o||a))},after:"Emphasis"}]};function eo(t,e,i=0,n,r=0){let s=0,o=!0,l=-1,a=-1,h=!1,c=()=>{n.push(t.elt("TableCell",r+l,r+a,t.parser.parseInline(e.slice(l,a),r+l)))};for(let f=i;f<e.length;f++){let u=e.charCodeAt(f);u==124&&!h?((!o||l>-1)&&s++,o=!1,n&&(l>-1&&c(),n.push(t.elt("TableDelimiter",f+r,f+r+1))),l=a=-1):(h||u!=32&&u!=9)&&(l<0&&(l=f),a=f+1),h=!h&&u==92}return l>-1&&(s++,n&&c()),s}function hy(t,e){for(let i=e;i<t.length;i++){let n=t.charCodeAt(i);if(n==124)return!0;n==92&&i++}return!1}var Zy=/^\|?(\s*:?-+:?\s*\|)+(\s*:?-+:?\s*)?$/,aa=class{constructor(){this.rows=null}nextLine(e,i,n){if(this.rows==null){this.rows=!1;let r;if((i.next==45||i.next==58||i.next==124)&&Zy.test(r=i.text.slice(i.pos))){let s=[];eo(e,n.content,0,s,n.start)==eo(e,r,0)&&(this.rows=[e.elt("TableHeader",n.start,n.start+n.content.length,s),e.elt("TableDelimiter",e.lineStart+i.pos,e.lineStart+i.text.length)])}}else if(this.rows){let r=[];eo(e,i.text,i.pos,r,e.lineStart),this.rows.push(e.elt("TableRow",e.lineStart+i.pos,e.lineStart+i.text.length,r))}return!1}finish(e,i){return this.rows?(e.addLeafElement(i,e.elt("Table",i.start,i.start+i.content.length,this.rows)),!0):!1}},VT={defineNodes:[{name:"Table",block:!0},{name:"TableHeader",style:{"TableHeader/...":O.heading}},"TableRow",{name:"TableCell",style:O.content},{name:"TableDelimiter",style:O.processingInstruction}],parseBlock:[{name:"Table",leaf(t,e){return hy(e.content,0)?new aa:null},endLeaf(t,e,i){if(i.parsers.some(r=>r instanceof aa)||!hy(e.text,e.basePos))return!1;let n=t.peekLine();return Zy.test(n)&&eo(t,e.text,e.basePos)==eo(t,n,e.basePos)},before:"SetextHeading"}]},Ku=class{nextLine(){return!1}finish(e,i){return e.addLeafElement(i,e.elt("Task",i.start,i.start+i.content.length,[e.elt("TaskMarker",i.start,i.start+3),...e.parser.parseInline(i.content.slice(3),i.start+3)])),!0}},GT={defineNodes:[{name:"Task",block:!0,style:O.list},{name:"TaskMarker",style:O.atom}],parseBlock:[{name:
Line truncated
|
||||
\${}
|
||||
} catch (\${error}) {
|
||||
\${}
|
||||
@@ -29,15 +29,15 @@ https://github.com/highlightjs/highlight.js/issues/2277`),te=P,Y=D),V===void 0&&
|
||||
constructor(\${params}) {
|
||||
\${}
|
||||
}
|
||||
}`,{label:"class",detail:"definition",type:"keyword"}),M('import {${names}} from "${module}"\n${}',{label:"import",detail:"named",type:"keyword"}),M('import ${name} from "${module}"\n${}',{label:"import",detail:"default",type:"keyword"})],jA=P1.concat([M("interface ${name} {\n ${}\n}",{label:"interface",detail:"definition",type:"keyword"}),M("type ${name} = ${type}",{label:"type",detail:"definition",type:"keyword"}),M("enum ${name} {\n ${}\n}",{label:"enum",detail:"definition",type:"keyword"})]),w1=new mr,$1=new Set(["Script","Block","FunctionExpression","FunctionDeclaration","ArrowFunction","MethodDeclaration","ForStatement"]);function oo(t){return(e,i)=>{let n=e.node.getChild("VariableDefinition");return n&&i(n,t),!0}}var zA=["FunctionDeclaration"],YA={FunctionDeclaration:oo("function"),ClassDeclaration:oo("class"),ClassExpression:()=>!0,EnumDeclaration:oo("constant"),TypeAliasDeclaration:oo("type"),NamespaceDeclaration:oo("namespace"),VariableDefinition(t,e){t.matchContext(zA)||e(t,"variable")},TypeDefinition(t,e){e(t,"type")},__proto__:null};function T1(t,e){let i=w1.get(e);if(i)return i;let n=[],r=!0;function s(o,l){let a=t.sliceString(o.from,o.to);n.push({label:a,type:l})}return e.cursor(be.IncludeAnonymous).iterate(o=>{if(r)r=!1;else if(o.name){let l=YA[o.name];if(l&&l(o,s)||$1.has(o.name))return!1}else if(o.to-o.from>8192){for(let l of T1(t,o.node))n.push(l);return!1}}),w1.set(e,n),n}var v1=/^[\w$\xa1-\uffff][\w$\d\xa1-\uffff]*$/,C1=["TemplateString","String","RegExp","LineComment","BlockComment","VariableDefinition","TypeDefinition","Label","PropertyDefinition","PropertyName","PrivatePropertyDefinition","PrivatePropertyName","JSXText","JSXAttributeValue","JSXOpenTag","JSXCloseTag","JSXSelfClosingTag",".","?."];function qA(t){let e=fe(t.state).resolveInner(t.pos,-1);if(C1.indexOf(e.name)>-1)return null;let i=e.name=="VariableName"||e.to-e.from<20&&v1.test(t.state.sliceDoc(e.from,e.to));if(!i&&!t.explicit)return null;let n=[];for(let r=e;r;r=r.parent)$1.has(r.name)&&(n=n.concat(T1(t.state.doc,r)));return{options:n,from:i?e.from:t.pos,validFor:v1}}var Ft=qt.define({name:"javascript",parser:k1.configure({props:[Et.add({IfStatement:xr({except:/^\s*({|else\b)/}),TryStatement:xr({except:/^\s*({|catch\b|finally\b)/}),LabeledStatement:u0,SwitchBody:t=>{let e=t.textAfter,i=/^\s*\}/.test(e),n=/^\s*(case|default)\b/.test(e);return t.baseIndent+(i?0:n?1:2)*t.unit},Block:Ds({closing:"}"}),ArrowFunction:t=>t.baseIndent+t.unit,"TemplateString BlockComment":()=>null,"Statement Property":xr({except:/^\s*{/}),JSXElement(t){let e=/^\s*<\//.test(t.textAfter);return t.lineIndent(t.node.from)+(e?0:t.unit)},JSXEscape(t){let e=/\s*\}/.test(t.textAfter);return t.lineIndent(t.node.from)+(e?0:t.unit)},"JSXOpenTag JSXSelfClosingTag"(t){return t.column(t.node.from)+t.unit}}),Mt.add({"Block ClassBody SwitchBody EnumBody ObjectExpression ArrayExpression ObjectType":kr,BlockComment(t){return{from:t.from+2,to:t.to-2}},JSXElement(t){let e=t.firstChild;if(!e||e.name=="JSXSelfClosingTag")return null;let i=t.lastChild;return{from:e.to,to:i.type.isError?t.to:i.from}},"JSXSelfClosingTag JSXOpenTag"(t){var e;let i=(e=t.firstChild)===null||e===void 0?void 0:e.nextSibling,n=t.lastChild;return!i||i.type.isError?null:{from:i.to,to:n.type.isError?t.to:n.from}}})]}),languageData:{closeBrackets:{brackets:["(","[","{","'",'"',"`"]},commentTokens:{line:"//",block:{open:"/*",close:"*/"}},indentOnInput:/^\s*(?:case |default:|\{|\}|<\/)$/,wordChars:"$"}}),A1={test:t=>/^JSX/.test(t.name),facet:yr({commentTokens:{block:{open:"{/*",close:"*/}"}}})},md=Ft.configure({dialect:"ts"},"typescript"),bd=Ft.configure({dialect:"jsx",props:[Ml.add(t=>t.isTop?[A1]:void 0)]}),yd=Ft.configure({dialect:"jsx ts",props:[Ml.add(t=>t.isTop?[A1]:void 0)]},"typescript"),R1=t=>({label:t,type:"keyword"}),E1="break case const continue default delete export extends false finally in instanceof let new return static super switch this throw true typeof var yield".split(" ").map(R1),WA=E1.concat(["declare","implements","private","protected","public"].map(R1));function M1(t={}){let e=t.jsx?t.typescript?yd:bd:t.typescript?md:Ft,i=t.typescript?jA.concat(WA):P1.concat(E1);return new Pt(e,[Ft.data.of({autocomplete:Bb(C1,xu(i))}),Ft.data.of({autocomplete:qA}),t.jsx?UA:[]])}function VA(t){for(;;){if(t.name=="JSXOpenTag"||t.name=="JSXSelfClosingTag"||t.name=="JSXFragmentTag")return t;if(t.name=="JSXEscape"||!t.parent)return null;t=t.parent}}function Q1(t,e,i=t.length){for(let n=e==null?void 0:e.firstChild;n;n=n.nextSibling)if(n.name=="JSXIdentifier"||n.name=="JSXBuiltin"||n.name=="JSXNamespacedName"||n.name=="JSXMemberExpression")return t.sliceString(n.from,Math.min(n.to,i));return""}var GA=typeof navigator=="object"&&/Android\b/.test(navigator.userAgent),UA=T.inputHandler.of((t,e,i,n,r)=>{if((GA?t.composing:t.compositionStarted)||t.state.readOnly||e!=i||n!=">"&&n!="/"||!Ft.isActiveAt(t.state,e,-1))return!1;let s=r(),{state:o}=s,l=o.changeByRange(a=>{var h;let{head:c}=a,f=fe(o).resolveInn
Line truncated
|
||||
${a}`}let f=Xd(t.buffer,r[l],s[l],t.position,c);a+=`${" ".repeat(i.indent)}${_d((t.line+1).toString(),h)} | ${f.str}
|
||||
}`,{label:"class",detail:"definition",type:"keyword"}),M('import {${names}} from "${module}"\n${}',{label:"import",detail:"named",type:"keyword"}),M('import ${name} from "${module}"\n${}',{label:"import",detail:"default",type:"keyword"})],qA=Q1.concat([M("interface ${name} {\n ${}\n}",{label:"interface",detail:"definition",type:"keyword"}),M("type ${name} = ${type}",{label:"type",detail:"definition",type:"keyword"}),M("enum ${name} {\n ${}\n}",{label:"enum",detail:"definition",type:"keyword"})]),k1=new mr,P1=new Set(["Script","Block","FunctionExpression","FunctionDeclaration","ArrowFunction","MethodDeclaration","ForStatement"]);function oo(t){return(e,i)=>{let n=e.node.getChild("VariableDefinition");return n&&i(n,t),!0}}var WA=["FunctionDeclaration"],VA={FunctionDeclaration:oo("function"),ClassDeclaration:oo("class"),ClassExpression:()=>!0,EnumDeclaration:oo("constant"),TypeAliasDeclaration:oo("type"),NamespaceDeclaration:oo("namespace"),VariableDefinition(t,e){t.matchContext(WA)||e(t,"variable")},TypeDefinition(t,e){e(t,"type")},__proto__:null};function $1(t,e){let i=k1.get(e);if(i)return i;let n=[],r=!0;function s(o,l){let a=t.sliceString(o.from,o.to);n.push({label:a,type:l})}return e.cursor(be.IncludeAnonymous).iterate(o=>{if(r)r=!1;else if(o.name){let l=VA[o.name];if(l&&l(o,s)||P1.has(o.name))return!1}else if(o.to-o.from>8192){for(let l of $1(t,o.node))n.push(l);return!1}}),k1.set(e,n),n}var w1=/^[\w$\xa1-\uffff][\w$\d\xa1-\uffff]*$/,T1=["TemplateString","String","RegExp","LineComment","BlockComment","VariableDefinition","TypeDefinition","Label","PropertyDefinition","PropertyName","PrivatePropertyDefinition","PrivatePropertyName","JSXText","JSXAttributeValue","JSXOpenTag","JSXCloseTag","JSXSelfClosingTag",".","?."];function GA(t){let e=fe(t.state).resolveInner(t.pos,-1);if(T1.indexOf(e.name)>-1)return null;let i=e.name=="VariableName"||e.to-e.from<20&&w1.test(t.state.sliceDoc(e.from,e.to));if(!i&&!t.explicit)return null;let n=[];for(let r=e;r;r=r.parent)P1.has(r.name)&&(n=n.concat($1(t.state.doc,r)));return{options:n,from:i?e.from:t.pos,validFor:w1}}var Ft=qt.define({name:"javascript",parser:x1.configure({props:[Et.add({IfStatement:xr({except:/^\s*({|else\b)/}),TryStatement:xr({except:/^\s*({|catch\b|finally\b)/}),LabeledStatement:f0,SwitchBody:t=>{let e=t.textAfter,i=/^\s*\}/.test(e),n=/^\s*(case|default)\b/.test(e);return t.baseIndent+(i?0:n?1:2)*t.unit},Block:Ds({closing:"}"}),ArrowFunction:t=>t.baseIndent+t.unit,"TemplateString BlockComment":()=>null,"Statement Property":xr({except:/^\s*{/}),JSXElement(t){let e=/^\s*<\//.test(t.textAfter);return t.lineIndent(t.node.from)+(e?0:t.unit)},JSXEscape(t){let e=/\s*\}/.test(t.textAfter);return t.lineIndent(t.node.from)+(e?0:t.unit)},"JSXOpenTag JSXSelfClosingTag"(t){return t.column(t.node.from)+t.unit}}),Mt.add({"Block ClassBody SwitchBody EnumBody ObjectExpression ArrayExpression ObjectType":kr,BlockComment(t){return{from:t.from+2,to:t.to-2}},JSXElement(t){let e=t.firstChild;if(!e||e.name=="JSXSelfClosingTag")return null;let i=t.lastChild;return{from:e.to,to:i.type.isError?t.to:i.from}},"JSXSelfClosingTag JSXOpenTag"(t){var e;let i=(e=t.firstChild)===null||e===void 0?void 0:e.nextSibling,n=t.lastChild;return!i||i.type.isError?null:{from:i.to,to:n.type.isError?t.to:n.from}}})]}),languageData:{closeBrackets:{brackets:["(","[","{","'",'"',"`"]},commentTokens:{line:"//",block:{open:"/*",close:"*/"}},indentOnInput:/^\s*(?:case |default:|\{|\}|<\/)$/,wordChars:"$"}}),C1={test:t=>/^JSX/.test(t.name),facet:yr({commentTokens:{block:{open:"{/*",close:"*/}"}}})},Od=Ft.configure({dialect:"ts"},"typescript"),md=Ft.configure({dialect:"jsx",props:[El.add(t=>t.isTop?[C1]:void 0)]}),bd=Ft.configure({dialect:"jsx ts",props:[El.add(t=>t.isTop?[C1]:void 0)]},"typescript"),A1=t=>({label:t,type:"keyword"}),R1="break case const continue default delete export extends false finally in instanceof let new return static super switch this throw true typeof var yield".split(" ").map(A1),UA=R1.concat(["declare","implements","private","protected","public"].map(A1));function E1(t={}){let e=t.jsx?t.typescript?bd:md:t.typescript?Od:Ft,i=t.typescript?qA.concat(UA):Q1.concat(R1);return new Pt(e,[Ft.data.of({autocomplete:Ib(T1,Su(i))}),Ft.data.of({autocomplete:GA}),t.jsx?KA:[]])}function FA(t){for(;;){if(t.name=="JSXOpenTag"||t.name=="JSXSelfClosingTag"||t.name=="JSXFragmentTag")return t;if(t.name=="JSXEscape"||!t.parent)return null;t=t.parent}}function v1(t,e,i=t.length){for(let n=e==null?void 0:e.firstChild;n;n=n.nextSibling)if(n.name=="JSXIdentifier"||n.name=="JSXBuiltin"||n.name=="JSXNamespacedName"||n.name=="JSXMemberExpression")return t.sliceString(n.from,Math.min(n.to,i));return""}var HA=typeof navigator=="object"&&/Android\b/.test(navigator.userAgent),KA=T.inputHandler.of((t,e,i,n,r)=>{if((HA?t.composing:t.compositionStarted)||t.state.readOnly||e!=i||n!=">"&&n!="/"||!Ft.isActiveAt(t.state,e,-1))return!1;let s=r(),{state:o}=s,l=o.changeByRange(a=>{var h;let{head:c}=a,f=fe(o).resolveInn
Line truncated
|
||||
${a}`}let f=Ld(t.buffer,r[l],s[l],t.position,c);a+=`${" ".repeat(i.indent)}${Xd((t.line+1).toString(),h)} | ${f.str}
|
||||
`,a+=`${"-".repeat(i.indent+h+3+f.pos)}^
|
||||
`;for(let u=1;u<=i.linesAfter&&!(l+u>=s.length);u++){let d=Xd(t.buffer,r[l+u],s[l+u],t.position-(r[l]-r[l+u]),c);a+=`${" ".repeat(i.indent)}${_d((t.line+u+1).toString(),h)} | ${d.str}
|
||||
`}return a.replace(/\n$/,"")}function kS(t,e){let i="";return t.mark?(t.mark.name&&(i+=`in "${t.mark.name}" `),i+=`(${t.mark.line+1}:${t.mark.column+1})`,!e&&t.mark.snippet&&(i+=`
|
||||
`;for(let u=1;u<=i.linesAfter&&!(l+u>=s.length);u++){let d=Ld(t.buffer,r[l+u],s[l+u],t.position-(r[l]-r[l+u]),c);a+=`${" ".repeat(i.indent)}${Xd((t.line+u+1).toString(),h)} | ${d.str}
|
||||
`}return a.replace(/\n$/,"")}function xS(t,e){let i="";return t.mark?(t.mark.name&&(i+=`in "${t.mark.name}" `),i+=`(${t.mark.line+1}:${t.mark.column+1})`,!e&&t.mark.snippet&&(i+=`
|
||||
|
||||
${t.mark.snippet}`),`${t.reason} ${i}`):t.reason}var MS=class extends Error{constructor(e,i){super();K(this,"reason");K(this,"mark");this.name="YAMLException",this.reason=e,this.mark=i,this.message=kS(this,!1),Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}toString(e){return`${this.name}: ${kS(this,e)}`}};function Ca(t,e,i,n=""){let r=0,s=0;for(let l=0;l<e;l++){let a=t.charCodeAt(l);a===10?(r++,s=l+1):a===13&&(r++,t.charCodeAt(l+1)===10&&l++,s=l+1)}let o={name:n,buffer:t,position:e,line:r,column:e-s};throw o.snippet=Z2(o),new MS(i,o)}var D2=-1;function wS(t){switch(t){case 48:return"\0";case 97:return"\x07";case 98:return"\b";case 116:return" ";case 9:return" ";case 110:return`
|
||||
`;case 118:return"\v";case 102:return"\f";case 114:return"\r";case 101:return"\x1B";case 32:return" ";case 34:return'"';case 47:return"/";case 92:return"\\";case 78:return"\x85";case 95:return"\xA0";case 76:return"\u2028";case 80:return"\u2029";default:return""}}var LS=new Array(256),XS=new Array(256);for(let t=0;t<256;t++)LS[t]=wS(t)?1:0,XS[t]=wS(t);function I2(t){return t<=65535?String.fromCharCode(t):String.fromCharCode((t-65536>>10)+55296,(t-65536&1023)+56320)}function B2(t){return t>=48&&t<=57?t-48:(t|32)-97+10}function N2(t){return t===120?2:t===117?4:8}function wa(t,e,i){let n=0;for(;e<i;){let r=t.charCodeAt(e);if(r===10)n++,e++;else if(r===13)n++,e++,t.charCodeAt(e)===10&&e++;else if(r===32||r===9)e++;else break}return{position:e,breaks:n}}function Ud(t){return t===1?" ":`
|
||||
`.repeat(t-1)}function j2(t,e,i){let n="",r=e,s=e,o=e;for(;r<i;){let l=t.charCodeAt(r);if(l===10||l===13){n+=t.slice(s,o);let a=wa(t,r,i);n+=Ud(a.breaks),r=s=o=a.position}else r++,l!==32&&l!==9&&(o=r)}return n+t.slice(s,o)}function z2(t,e,i){let n="",r=e,s=e,o=e;for(;r<i;){let l=t.charCodeAt(r);if(l===39)n+=t.slice(s,r)+"'",r+=2,s=o=r;else if(l===10||l===13){n+=t.slice(s,o);let a=wa(t,r,i);n+=Ud(a.breaks),r=s=o=a.position}else r++,l!==32&&l!==9&&(o=r)}return n+t.slice(s,i)}function Y2(t,e,i){let n="",r=e,s=e,o=e;for(;r<i;){let l=t.charCodeAt(r);if(l===92){n+=t.slice(s,r),r++;let a=t.charCodeAt(r);if(a===10||a===13)r=wa(t,r,i).position;else if(a<256&&LS[a])n+=XS[a],r++;else{let h=N2(a),c=0;for(;h>0;h--){r++;let f=B2(t.charCodeAt(r));c=(c<<4)+f}n+=I2(c),r++}s=o=r}else if(l===10||l===13){n+=t.slice(s,o);let a=wa(t,r,i);n+=Ud(a.breaks),r=s=o=a.position}else r++,l!==32&&l!==9&&(o=r)}return n+t.slice(s,i)}function vS(t,e,i,n,r,s){let o=n<0?0:n,l=t.slice(e,i).replace(/\r\n?/g,`
|
||||
${t.mark.snippet}`),`${t.reason} ${i}`):t.reason}var ES=class extends Error{constructor(e,i){super();K(this,"reason");K(this,"mark");this.name="YAMLException",this.reason=e,this.mark=i,this.message=xS(this,!1),Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}toString(e){return`${this.name}: ${xS(this,e)}`}};function Ta(t,e,i,n=""){let r=0,s=0;for(let l=0;l<e;l++){let a=t.charCodeAt(l);a===10?(r++,s=l+1):a===13&&(r++,t.charCodeAt(l+1)===10&&l++,s=l+1)}let o={name:n,buffer:t,position:e,line:r,column:e-s};throw o.snippet=B2(o),new ES(i,o)}var N2=-1;function kS(t){switch(t){case 48:return"\0";case 97:return"\x07";case 98:return"\b";case 116:return" ";case 9:return" ";case 110:return`
|
||||
`;case 118:return"\v";case 102:return"\f";case 114:return"\r";case 101:return"\x1B";case 32:return" ";case 34:return'"';case 47:return"/";case 92:return"\\";case 78:return"\x85";case 95:return"\xA0";case 76:return"\u2028";case 80:return"\u2029";default:return""}}var MS=new Array(256),LS=new Array(256);for(let t=0;t<256;t++)MS[t]=kS(t)?1:0,LS[t]=kS(t);function j2(t){return t<=65535?String.fromCharCode(t):String.fromCharCode((t-65536>>10)+55296,(t-65536&1023)+56320)}function z2(t){return t>=48&&t<=57?t-48:(t|32)-97+10}function Y2(t){return t===120?2:t===117?4:8}function ka(t,e,i){let n=0;for(;e<i;){let r=t.charCodeAt(e);if(r===10)n++,e++;else if(r===13)n++,e++,t.charCodeAt(e)===10&&e++;else if(r===32||r===9)e++;else break}return{position:e,breaks:n}}function Gd(t){return t===1?" ":`
|
||||
`.repeat(t-1)}function q2(t,e,i){let n="",r=e,s=e,o=e;for(;r<i;){let l=t.charCodeAt(r);if(l===10||l===13){n+=t.slice(s,o);let a=ka(t,r,i);n+=Gd(a.breaks),r=s=o=a.position}else r++,l!==32&&l!==9&&(o=r)}return n+t.slice(s,o)}function W2(t,e,i){let n="",r=e,s=e,o=e;for(;r<i;){let l=t.charCodeAt(r);if(l===39)n+=t.slice(s,r)+"'",r+=2,s=o=r;else if(l===10||l===13){n+=t.slice(s,o);let a=ka(t,r,i);n+=Gd(a.breaks),r=s=o=a.position}else r++,l!==32&&l!==9&&(o=r)}return n+t.slice(s,i)}function V2(t,e,i){let n="",r=e,s=e,o=e;for(;r<i;){let l=t.charCodeAt(r);if(l===92){n+=t.slice(s,r),r++;let a=t.charCodeAt(r);if(a===10||a===13)r=ka(t,r,i).position;else if(a<256&&MS[a])n+=LS[a],r++;else{let h=Y2(a),c=0;for(;h>0;h--){r++;let f=z2(t.charCodeAt(r));c=(c<<4)+f}n+=j2(c),r++}s=o=r}else if(l===10||l===13){n+=t.slice(s,o);let a=ka(t,r,i);n+=Gd(a.breaks),r=s=o=a.position}else r++,l!==32&&l!==9&&(o=r)}return n+t.slice(s,i)}function wS(t,e,i,n,r,s){let o=n<0?0:n,l=t.slice(e,i).replace(/\r\n?/g,`
|
||||
`),a=l===""?[]:(l.endsWith(`
|
||||
`)?l.slice(0,-1):l).split(`
|
||||
`),h="",c=!1,f=0,u=!1;for(let d of a){let p=0;for(;p<o&&d.charCodeAt(p)===32;)p++;if(n<0||p>=d.length){f++;continue}let g=d.slice(o),m=g.charCodeAt(0);s?m===32||m===9?(u=!0,h+=`
|
||||
@@ -46,13 +46,13 @@ ${t.mark.snippet}`),`${t.reason} ${i}`):t.reason}var MS=class extends Error{cons
|
||||
`.repeat(f):h+=`
|
||||
`.repeat(c?1+f:f),h+=g,c=!0,f=0}return r===3?h+=`
|
||||
`.repeat(c?1+f:f):r!==2&&c&&(h+=`
|
||||
`),h}function q2(t,e){if(e.valueStart===D2)return"";let{valueStart:i,valueEnd:n}=e;if(e.fast)return t.slice(i,n);switch(e.style){case 2:return z2(t,i,n);case 3:return Y2(t,i,n);case 4:return vS(t,i,n,e.indent,e.chomping,!1);case 5:return vS(t,i,n,e.indent,e.chomping,!0);default:return j2(t,i,n)}}var W2={"!":"!","!!":"tag:yaml.org,2002:"};function _S(t,e){var s,o;if(t.startsWith("!<")&&t.endsWith(">"))return decodeURIComponent(t.slice(2,-1));let i=t.indexOf("!",1),n=i===-1?"!":t.slice(0,i+1),r=(o=(s=e==null?void 0:e[n])!=null?s:W2[n])!=null?o:n;return decodeURIComponent(r)+decodeURIComponent(t.slice(n.length))}var _r=-1,Fd={filename:"",schema:X2,json:!1,maxTotalMergeKeys:1e4,maxAliases:-1};function V2(t){return"tagStart"in t&&t.tagStart!==_r?t.tagStart:"anchorStart"in t&&t.anchorStart!==_r?t.anchorStart:"valueStart"in t&&t.valueStart!==_r?t.valueStart:"start"in t?t.start:0}function xt(t,e){Ca(t.source,t.position,e,t.filename)}function ZS(t,e,i,n){try{return i.finalize(n)}catch(r){if(r instanceof MS)throw r;Ca(t.source,e,r instanceof Error?r.message:String(r),t.filename)}}function ka(t,e,i){let n=t[i];if(n)return n;for(let r of e)if(i.startsWith(r.tagName))return r}function G2(t,e,i,n,r){let s=ka(e,i,n);if(s)return s;xt(t,`unknown ${r} tag !<${n}>`)}function U2(t,e){var s,o;let i=q2(t.source,e),n=e.tagStart===_r?"":t.source.slice(e.tagStart,e.tagEnd),r=t.schema.defaultScalarTag;if(n!==""){if(n==="!")return{value:i,tag:r};let l=_S(n,t.tagHandlers),a=ka(t.schema.exact.scalar,t.schema.prefix.scalar,l);if(a){let c=a.resolve(i,!0,l);return c===ae&&xt(t,`cannot resolve a node with !<${l}> explicit tag`),{value:c,tag:a}}let h=(s=ka(t.schema.exact.mapping,t.schema.prefix.mapping,l))!=null?s:ka(t.schema.exact.sequence,t.schema.prefix.sequence,l);if(h){i!==""&&xt(t,`cannot resolve a node with !<${l}> explicit tag`);let c=h.create(l);return{value:h.carrierIsResult?c:ZS(t,t.position,h,c),tag:h}}xt(t,`unknown scalar tag !<${l}>`)}if(e.style===1){let l=(o=t.schema.implicitScalarByFirstChar.get(i.charAt(0)))!=null?o:t.schema.implicitScalarAnyFirstChar;for(let a of l){let h=a.resolve(i,!1,a.tagName);if(h!==ae)return{value:h,tag:a}}}return{value:r.resolve(i,!1,r.tagName),tag:r}}function QS(t,e,i,n,r,s){let o=e.tagStart===_r?"":t.source.slice(e.tagStart,e.tagEnd),l=o===""||o==="!"?r:_S(o,t.tagHandlers);return{tagName:l,tag:G2(t,i,n,l,s)}}function DS(t){return t.nodeKind==="mapping"}function PS(t,e,i,n){var r;for(let s of n.keys(i)){if(t.maxTotalMergeKeys!==-1&&++t.totalMergeKeys>t.maxTotalMergeKeys&&xt(t,`merge keys exceeded maxTotalMergeKeys (${t.maxTotalMergeKeys})`),e.tag.has(e.value,s))continue;let o=e.tag.addPair(e.value,s,n.get(i,s));o&&xt(t,o),((r=e.overridable)!=null?r:e.overridable=new Set).add(s)}}function F2(t,e,i,n){if(t.position=e.keyPosition,DS(n))PS(t,e,i,n);else if(n.nodeKind==="sequence"&&Array.isArray(i))for(let r of i)PS(t,e,r,e.tag);else xt(t,"cannot merge mappings; the provided source object is unacceptable")}function H2(t,e,i,n,r){var o,l;if(t.position=e.keyPosition,i===qd){F2(t,e,n,r);return}!t.json&&e.tag.has(e.value,i)&&!((o=e.overridable)!=null&&o.has(i))&&xt(t,"duplicated mapping key");let s=e.tag.addPair(e.value,i,n);s&&xt(t,s),(l=e.overridable)==null||l.delete(i)}function Zd(t,e,i){let n=t.frames[t.frames.length-1];if(n.kind==="document")n.value=e,n.hasValue=!0;else if(n.kind==="sequence"){n.merge&&(DS(i)||xt(t,"cannot merge mappings; the provided source object is unacceptable"));let r=n.tag.addItem(n.value,e,n.index++);r&&xt(t,r)}else if(n.hasKey){let r=n.key;n.key=void 0,n.hasKey=!1,H2(t,n,r,e,i)}else n.key=e,n.keyPosition=t.position,n.hasKey=!0}function Dd(t,e,i,n,r){if(e.anchorStart!==_r){let s={value:i,tag:n,isValueFinal:r};return t.anchors.set(t.source.slice(e.anchorStart,e.anchorEnd),s),s}return null}function K2(t,e){let i={...Fd,...e,events:t,documents:[],eventIndex:0,position:0,frames:[],anchors:new Map,tagHandlers:Object.create(null),totalMergeKeys:0,aliasCount:0};for(;i.eventIndex<i.events.length;){let n=i.events[i.eventIndex++];switch(i.position=V2(n),n.type){case 1:i.anchors=new Map,i.aliasCount=0,i.tagHandlers=Object.create(null);for(let r of n.directives)r.kind==="tag"&&(i.tagHandlers[r.handle]=r.prefix);i.frames.push({kind:"document",position:i.position,value:void 0,hasValue:!1});break;case 4:{let{value:r,tag:s}=U2(i,n);Dd(i,n,r,s,!0),Zd(i,r,s);break}case 2:{let r=QS(i,n,i.schema.exact.sequence,i.schema.prefix.sequence,"tag:yaml.org,2002:seq","sequence"),s=r.tag.create(r.tagName),o=Dd(i,n,s,r.tag,r.tag.carrierIsResult),l=i.frames[i.frames.length-1],a=l!==void 0&&l.kind==="mapping"&&l.hasKey&&l.key===qd;i.frames.push({kind:"sequence",position:i.position,value:s,tag:r.tag,anchor:o,index:0,merge:a});break}case 3:{let r=QS(i,n,i.schema.exact.mapping,i.schema.prefix.mapping,"tag:yaml.org,2002:map","mapping"),s=r.tag.create(r.tagName),o=Dd(i,n,s,r.tag,r.tag.carrierIsResult);i.frames.push({kind:"mapping",position:i.position,value:s,tag:r.tag,anchor:o,key:void 0,keyPosition:i.position,hasK
Line truncated
|
||||
`:n=="r"?"\r":n=="t"?" ":"\\")}eq(e){return this.search==e.search&&this.replace==e.replace&&this.caseSensitive==e.caseSensitive&&this.regexp==e.regexp&&this.wholeWord==e.wholeWord}create(){return this.regexp?new tp(this):new ep(this)}getCursor(e,i=0,n){let r=e.doc?e:he.create({doc:e});return n==null&&(n=r.doc.length),this.regexp?Br(this,r,i,n):Ir(this,r,i,n)}},Da=class{constructor(e){this.spec=e}};function Ir(t,e,i,n){return new tn(e.doc,t.unquoted,i,n,t.caseSensitive?void 0:r=>r.toLowerCase(),t.wholeWord?DE(e.doc,e.charCategorizer(e.selection.main.head)):void 0)}function DE(t,e){return(i,n,r,s)=>((s>i||s+r.length<n)&&(s=Math.max(0,i-2),r=t.sliceString(s,Math.min(t.length,n+2))),(e(Ia(r,i-s))!=ke.Word||e(Ba(r,i-s))!=ke.Word)&&(e(Ba(r,n-s))!=ke.Word||e(Ia(r,n-s))!=ke.Word))}var ep=class extends Da{constructor(e){super(e)}nextMatch(e,i,n){let r=Ir(this.spec,e,n,e.doc.length).nextOverlapping();if(r.done){let s=Math.min(e.doc.length,i+this.spec.unquoted.length);r=Ir(this.spec,e,0,s).nextOverlapping()}return r.done||r.value.from==i&&r.value.to==n?null:r.value}prevMatchInRange(e,i,n){for(let r=n;;){let s=Math.max(i,r-1e4-this.spec.unquoted.length),o=Ir(this.spec,e,s,r),l=null;for(;!o.nextOverlapping().done;)l=o.value;if(l)return l;if(s==i)return null;r-=1e4}}prevMatch(e,i,n){let r=this.prevMatchInRange(e,0,i);return r||(r=this.prevMatchInRange(e,Math.max(0,n-this.spec.unquoted.length),e.doc.length)),r&&(r.from!=i||r.to!=n)?r:null}getReplacement(e){return this.spec.unquote(this.spec.replace)}matchAll(e,i){let n=Ir(this.spec,e,0,e.doc.length),r=[];for(;!n.next().done;){if(r.length>=i)return null;r.push(n.value)}return r}highlight(e,i,n,r){let s=Ir(this.spec,e,Math.max(0,i-this.spec.unquoted.length),Math.min(n+this.spec.unquoted.length,e.doc.length));for(;!s.next().done;)r(s.value.from,s.value.to)}};function Br(t,e,i,n){return new Ea(e.doc,t.search,{ignoreCase:!t.caseSensitive,test:t.wholeWord?IE(e.charCategorizer(e.selection.main.head)):void 0},i,n)}function Ia(t,e){return t.slice(Xe(t,e,!1),e)}function Ba(t,e){return t.slice(e,Xe(t,e))}function IE(t){return(e,i,n)=>!n[0].length||(t(Ia(n.input,n.index))!=ke.Word||t(Ba(n.input,n.index))!=ke.Word)&&(t(Ba(n.input,n.index+n[0].length))!=ke.Word||t(Ia(n.input,n.index+n[0].length))!=ke.Word)}var tp=class extends Da{nextMatch(e,i,n){let r=Br(this.spec,e,n,e.doc.length).next();return r.done&&(r=Br(this.spec,e,0,i).next()),r.done?null:r.value}prevMatchInRange(e,i,n){for(let r=1;;r++){let s=Math.max(i,n-r*1e4),o=Br(this.spec,e,s,n),l=null;for(;!o.next().done;)l=o.value;if(l&&(s==i||l.from>s+10))return l;if(s==i)return null}}prevMatch(e,i,n){return this.prevMatchInRange(e,0,i)||this.prevMatchInRange(e,n,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace).replace(/\$([$&\d+])/g,(i,n)=>n=="$"?"$":n=="&"?e.match[0]:n!="0"&&+n<e.match.length?e.match[n]:i)}matchAll(e,i){let n=Br(this.spec,e,0,e.doc.length),r=[];for(;!n.next().done;){if(r.length>=i)return null;r.push(n.value)}return r}highlight(e,i,n,r){let s=Br(this.spec,e,Math.max(0,i-250),Math.min(n+250,e.doc.length));for(;!s.next().done;)r(s.value.from,s.value.to)}},uo=W.define(),ap=W.define(),en=ge.define({create(t){return new fo(ip(t).create(),null)},update(t,e){for(let i of e.effects)i.is(uo)?t=new fo(i.value.create(),t.panel):i.is(ap)&&(t=new fo(t.query,i.value?cp:null));return t},provide:t=>mn.from(t,e=>e.panel)});var fo=class{constructor(e,i){this.query=e,this.panel=i}},BE=X.mark({class:"cm-searchMatch"}),NE=X.mark({class:"cm-searchMatch cm-searchMatch-selected"}),jE=me.fromClass(class{constructor(t){this.view=t,this.decorations=this.highlight(t.state.field(en))}update(t){let e=t.state.field(en);(e!=t.startState.field(en)||t.docChanged||t.selectionSet||t.viewportChanged)&&(this.decorations=this.highlight(e))}highlight({query:t,panel:e}){if(!e||!t.spec.valid)return X.none;let{view:i}=this,n=new Ee;for(let r=0,s=i.visibleRanges,o=s.length;r<o;r++){let{from:l,to:a}=s[r];for(;r<o-1&&a>s[r+1].from-500;)a=s[++r].to;t.highlight(i.state,l,a,(h,c)=>{let f=i.state.selection.ranges.some(u=>u.from==h&&u.to==c);n.add(h,c,f?NE:BE)})}return n.finish()}},{decorations:t=>t.decorations});function po(t){return e=>{let i=e.state.field(en,!1);return i&&i.query.spec.valid?t(e,i):ex(e)}}var Na=po((t,{query:e})=>{let{to:i}=t.state.selection.main,n=e.nextMatch(t.state,i,i);if(!n)return!1;let r=Q.single(n.from,n.to),s=t.state.facet(_n);return t.dispatch({selection:r,effects:[fp(t,n),s.scrollToMatch(r.main,t)],userEvent:"select.search"}),JS(t),!0}),ja=po((t,{query:e})=>{let{state:i}=t,{from:n}=i.selection.main,r=e.prevMatch(i,n,n);if(!r)return!1;let s=Q.single(r.from,r.to),o=t.state.facet(_n);return t.dispatch({selection:s,effects:[fp(t,r),o.scrollToMatch(s.main,t)],userEvent:"select.search"}),JS(t),!0}),zE=po((t,{query:e})=>{let i=e.matchAll(t.state,1e3);return!i||!i.length?!1:(t.dispatch({selection:Q.create(i.map(n=>Q.range(n.from,n.to))),userEvent:"select.search.matches"}),!0)}),YE=({state:t,dispatch:e})=>{let i=t.select
Line truncated
|
||||
]`).replace("lheading",Kx).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},VM=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,GM=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,ek=/^( {2,}|\\)\n(?!\s*$)/,UM=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,Fr=/[\p{P}\p{S}]/u,oc=/[\s\p{P}\p{S}]/u,eg=/[^\s\p{P}\p{S}]/u,FM=le(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,oc).getRegex(),tk=/(?!~)[\p{P}\p{S}]/u,HM=/(?!~)[\s\p{P}\p{S}]/u,KM=/(?:[^\s\p{P}\p{S}]|~)/u,JM=le(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",LM?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),ik=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,eL=le(ik,"u").replace(/punct/g,Fr).getRegex(),tL=le(ik,"u").replace(/punct/g,tk).getRegex(),nk="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",iL=le(nk,"gu").replace(/notPunctSpace/g,eg).replace(/punctSpace/g,oc).replace(/punct/g,Fr).getRegex(),nL=le(nk,"gu").replace(/notPunctSpace/g,KM).replace(/punctSpace/g,HM).replace(/punct/g,tk).getRegex(),rL=le("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,eg).replace(/punctSpace/g,oc).replace(/punct/g,Fr).getRegex(),sL=le(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,Fr).getRegex(),oL="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",lL=le(oL,"gu").replace(/notPunctSpace/g,eg).replace(/punctSpace/g,oc).replace(/punct/g,Fr).getRegex(),aL=le(/\\(punct)/,"gu").replace(/punct/g,Fr).getRegex(),cL=le(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),hL=le(Kp).replace("(?:-->|$)","-->").getRegex(),fL=le("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",hL).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),ic=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,uL=le(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label",ic).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),rk=le(/^!?\[(label)\]\[(ref)\]/).replace("label",ic).replace("ref",Hp).getRegex(),sk=le(/^!?\[(ref)\](?:\[\])?/).replace("ref",Hp).getRegex(),dL=le("reflink|nolink(?!\\()","g").replace("reflink",rk).replace("nolink",sk).getRegex(),Yx=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,tg={_backpedal:Vn,anyPunctuation:aL,autolink:cL,blockSkip:JM,br:ek,code:GM,del:Vn,delLDelim:Vn,delRDelim:Vn,emStrongLDelim:eL,emStrongRDelimAst:iL,emStrongRDelimUnd:rL,escape:VM,link:uL,nolink:sk,punctuation:FM,reflink:rk,reflinkSearch:dL,tag:fL,text:UM,url:Vn},pL={...tg,link:le(/^!?\[(label)\]\((.*?)\)/).replace("label",ic).getRegex(),reflink:le(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",ic).getRegex()},qp={...tg,emStrongRDelimAst:nL,emStrongLDelim:tL,delLDelim:sL,delRDelim:lL,url:le(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",Yx).replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:le(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",Yx).getRegex()},gL={...qp,br:le(ek).replace("{2,}","*").getRegex(),text:le(qp.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},ec={normal:Jp,gfm:qM,pedantic:WM},ko={normal:tg,gfm:qp,breaks:gL,pedantic:pL},OL={"&":"&","<":"<",">":">",'"':""","'":"'"},qx=t=>OL[t];function bi(t,e){if(e){if(nt.escapeTest.test(t))return t.replace(nt.escapeReplace,qx)}else if(nt.escapeTestNoEncode.tesLine truncated
|
||||
`),h}function G2(t,e){if(e.valueStart===N2)return"";let{valueStart:i,valueEnd:n}=e;if(e.fast)return t.slice(i,n);switch(e.style){case 2:return W2(t,i,n);case 3:return V2(t,i,n);case 4:return wS(t,i,n,e.indent,e.chomping,!1);case 5:return wS(t,i,n,e.indent,e.chomping,!0);default:return q2(t,i,n)}}var U2={"!":"!","!!":"tag:yaml.org,2002:"};function XS(t,e){var s,o;if(t.startsWith("!<")&&t.endsWith(">"))return decodeURIComponent(t.slice(2,-1));let i=t.indexOf("!",1),n=i===-1?"!":t.slice(0,i+1),r=(o=(s=e==null?void 0:e[n])!=null?s:U2[n])!=null?o:n;return decodeURIComponent(r)+decodeURIComponent(t.slice(n.length))}var _r=-1,Ud={filename:"",schema:D2,json:!1,maxTotalMergeKeys:1e4,maxAliases:-1};function F2(t){return"tagStart"in t&&t.tagStart!==_r?t.tagStart:"anchorStart"in t&&t.anchorStart!==_r?t.anchorStart:"valueStart"in t&&t.valueStart!==_r?t.valueStart:"start"in t?t.start:0}function xt(t,e){Ta(t.source,t.position,e,t.filename)}function _S(t,e,i,n){try{return i.finalize(n)}catch(r){if(r instanceof ES)throw r;Ta(t.source,e,r instanceof Error?r.message:String(r),t.filename)}}function xa(t,e,i){let n=t[i];if(n)return n;for(let r of e)if(i.startsWith(r.tagName))return r}function H2(t,e,i,n,r){let s=xa(e,i,n);if(s)return s;xt(t,`unknown ${r} tag !<${n}>`)}function K2(t,e){var s,o;let i=G2(t.source,e),n=e.tagStart===_r?"":t.source.slice(e.tagStart,e.tagEnd),r=t.schema.defaultScalarTag;if(n!==""){if(n==="!")return{value:i,tag:r};let l=XS(n,t.tagHandlers),a=xa(t.schema.exact.scalar,t.schema.prefix.scalar,l);if(a){let c=a.resolve(i,!0,l);return c===ae&&xt(t,`cannot resolve a node with !<${l}> explicit tag`),{value:c,tag:a}}let h=(s=xa(t.schema.exact.mapping,t.schema.prefix.mapping,l))!=null?s:xa(t.schema.exact.sequence,t.schema.prefix.sequence,l);if(h){i!==""&&xt(t,`cannot resolve a node with !<${l}> explicit tag`);let c=h.create(l);return{value:h.carrierIsResult?c:_S(t,t.position,h,c),tag:h}}xt(t,`unknown scalar tag !<${l}>`)}if(e.style===1){let l=(o=t.schema.implicitScalarByFirstChar.get(i.charAt(0)))!=null?o:t.schema.implicitScalarAnyFirstChar;for(let a of l){let h=a.resolve(i,!1,a.tagName);if(h!==ae)return{value:h,tag:a}}}return{value:r.resolve(i,!1,r.tagName),tag:r}}function vS(t,e,i,n,r,s){let o=e.tagStart===_r?"":t.source.slice(e.tagStart,e.tagEnd),l=o===""||o==="!"?r:XS(o,t.tagHandlers);return{tagName:l,tag:H2(t,i,n,l,s)}}function ZS(t){return t.nodeKind==="mapping"}function QS(t,e,i,n){var r;for(let s of n.keys(i)){if(t.maxTotalMergeKeys!==-1&&++t.totalMergeKeys>t.maxTotalMergeKeys&&xt(t,`merge keys exceeded maxTotalMergeKeys (${t.maxTotalMergeKeys})`),e.tag.has(e.value,s))continue;let o=e.tag.addPair(e.value,s,n.get(i,s));o&&xt(t,o),((r=e.overridable)!=null?r:e.overridable=new Set).add(s)}}function J2(t,e,i,n){if(t.position=e.keyPosition,ZS(n))QS(t,e,i,n);else if(n.nodeKind==="sequence"&&Array.isArray(i))for(let r of i)QS(t,e,r,e.tag);else xt(t,"cannot merge mappings; the provided source object is unacceptable")}function eE(t,e,i,n,r){var o,l;if(t.position=e.keyPosition,i===Yd){J2(t,e,n,r);return}!t.json&&e.tag.has(e.value,i)&&!((o=e.overridable)!=null&&o.has(i))&&xt(t,"duplicated mapping key");let s=e.tag.addPair(e.value,i,n);s&&xt(t,s),(l=e.overridable)==null||l.delete(i)}function _d(t,e,i){let n=t.frames[t.frames.length-1];if(n.kind==="document")n.value=e,n.hasValue=!0;else if(n.kind==="sequence"){n.merge&&(ZS(i)||xt(t,"cannot merge mappings; the provided source object is unacceptable"));let r=n.tag.addItem(n.value,e,n.index++);r&&xt(t,r)}else if(n.hasKey){let r=n.key;n.key=void 0,n.hasKey=!1,eE(t,n,r,e,i)}else n.key=e,n.keyPosition=t.position,n.hasKey=!0}function Zd(t,e,i,n,r){if(e.anchorStart!==_r){let s={value:i,tag:n,isValueFinal:r};return t.anchors.set(t.source.slice(e.anchorStart,e.anchorEnd),s),s}return null}function tE(t,e){let i={...Ud,...e,events:t,documents:[],eventIndex:0,position:0,frames:[],anchors:new Map,tagHandlers:Object.create(null),totalMergeKeys:0,aliasCount:0};for(;i.eventIndex<i.events.length;){let n=i.events[i.eventIndex++];switch(i.position=F2(n),n.type){case 1:i.anchors=new Map,i.aliasCount=0,i.tagHandlers=Object.create(null);for(let r of n.directives)r.kind==="tag"&&(i.tagHandlers[r.handle]=r.prefix);i.frames.push({kind:"document",position:i.position,value:void 0,hasValue:!1});break;case 4:{let{value:r,tag:s}=K2(i,n);Zd(i,n,r,s,!0),_d(i,r,s);break}case 2:{let r=vS(i,n,i.schema.exact.sequence,i.schema.prefix.sequence,"tag:yaml.org,2002:seq","sequence"),s=r.tag.create(r.tagName),o=Zd(i,n,s,r.tag,r.tag.carrierIsResult),l=i.frames[i.frames.length-1],a=l!==void 0&&l.kind==="mapping"&&l.hasKey&&l.key===Yd;i.frames.push({kind:"sequence",position:i.position,value:s,tag:r.tag,anchor:o,index:0,merge:a});break}case 3:{let r=vS(i,n,i.schema.exact.mapping,i.schema.prefix.mapping,"tag:yaml.org,2002:map","mapping"),s=r.tag.create(r.tagName),o=Zd(i,n,s,r.tag,r.tag.carrierIsResult);i.frames.push({kind:"mapping",position:i.position,value:s,tag:r.tag,anchor:o,key:void 0,keyPosition:i.position,hasK
Line truncated
|
||||
`:n=="r"?"\r":n=="t"?" ":"\\")}eq(e){return this.search==e.search&&this.replace==e.replace&&this.caseSensitive==e.caseSensitive&&this.regexp==e.regexp&&this.wholeWord==e.wholeWord}create(){return this.regexp?new ep(this):new Jd(this)}getCursor(e,i=0,n){let r=e.doc?e:he.create({doc:e});return n==null&&(n=r.doc.length),this.regexp?Br(this,r,i,n):Ir(this,r,i,n)}},Za=class{constructor(e){this.spec=e}};function Ir(t,e,i,n){return new tn(e.doc,t.unquoted,i,n,t.caseSensitive?void 0:r=>r.toLowerCase(),t.wholeWord?NE(e.doc,e.charCategorizer(e.selection.main.head)):void 0)}function NE(t,e){return(i,n,r,s)=>((s>i||s+r.length<n)&&(s=Math.max(0,i-2),r=t.sliceString(s,Math.min(t.length,n+2))),(e(Da(r,i-s))!=ke.Word||e(Ia(r,i-s))!=ke.Word)&&(e(Ia(r,n-s))!=ke.Word||e(Da(r,n-s))!=ke.Word))}var Jd=class extends Za{constructor(e){super(e)}nextMatch(e,i,n){let r=Ir(this.spec,e,n,e.doc.length).nextOverlapping();if(r.done){let s=Math.min(e.doc.length,i+this.spec.unquoted.length);r=Ir(this.spec,e,0,s).nextOverlapping()}return r.done||r.value.from==i&&r.value.to==n?null:r.value}prevMatchInRange(e,i,n){for(let r=n;;){let s=Math.max(i,r-1e4-this.spec.unquoted.length),o=Ir(this.spec,e,s,r),l=null;for(;!o.nextOverlapping().done;)l=o.value;if(l)return l;if(s==i)return null;r-=1e4}}prevMatch(e,i,n){let r=this.prevMatchInRange(e,0,i);return r||(r=this.prevMatchInRange(e,Math.max(0,n-this.spec.unquoted.length),e.doc.length)),r&&(r.from!=i||r.to!=n)?r:null}getReplacement(e){return this.spec.unquote(this.spec.replace)}matchAll(e,i){let n=Ir(this.spec,e,0,e.doc.length),r=[];for(;!n.next().done;){if(r.length>=i)return null;r.push(n.value)}return r}highlight(e,i,n,r){let s=Ir(this.spec,e,Math.max(0,i-this.spec.unquoted.length),Math.min(n+this.spec.unquoted.length,e.doc.length));for(;!s.next().done;)r(s.value.from,s.value.to)}};function Br(t,e,i,n){return new Ra(e.doc,t.search,{ignoreCase:!t.caseSensitive,test:t.wholeWord?jE(e.charCategorizer(e.selection.main.head)):void 0},i,n)}function Da(t,e){return t.slice(Xe(t,e,!1),e)}function Ia(t,e){return t.slice(e,Xe(t,e))}function jE(t){return(e,i,n)=>!n[0].length||(t(Da(n.input,n.index))!=ke.Word||t(Ia(n.input,n.index))!=ke.Word)&&(t(Ia(n.input,n.index+n[0].length))!=ke.Word||t(Da(n.input,n.index+n[0].length))!=ke.Word)}var ep=class extends Za{nextMatch(e,i,n){let r=Br(this.spec,e,n,e.doc.length).next();return r.done&&(r=Br(this.spec,e,0,i).next()),r.done?null:r.value}prevMatchInRange(e,i,n){for(let r=1;;r++){let s=Math.max(i,n-r*1e4),o=Br(this.spec,e,s,n),l=null;for(;!o.next().done;)l=o.value;if(l&&(s==i||l.from>s+10))return l;if(s==i)return null}}prevMatch(e,i,n){return this.prevMatchInRange(e,0,i)||this.prevMatchInRange(e,n,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace).replace(/\$([$&\d+])/g,(i,n)=>n=="$"?"$":n=="&"?e.match[0]:n!="0"&&+n<e.match.length?e.match[n]:i)}matchAll(e,i){let n=Br(this.spec,e,0,e.doc.length),r=[];for(;!n.next().done;){if(r.length>=i)return null;r.push(n.value)}return r}highlight(e,i,n,r){let s=Br(this.spec,e,Math.max(0,i-250),Math.min(n+250,e.doc.length));for(;!s.next().done;)r(s.value.from,s.value.to)}},uo=W.define(),lp=W.define(),en=ge.define({create(t){return new fo(tp(t).create(),null)},update(t,e){for(let i of e.effects)i.is(uo)?t=new fo(i.value.create(),t.panel):i.is(lp)&&(t=new fo(t.query,i.value?ap:null));return t},provide:t=>mn.from(t,e=>e.panel)});var fo=class{constructor(e,i){this.query=e,this.panel=i}},zE=X.mark({class:"cm-searchMatch"}),YE=X.mark({class:"cm-searchMatch cm-searchMatch-selected"}),qE=me.fromClass(class{constructor(t){this.view=t,this.decorations=this.highlight(t.state.field(en))}update(t){let e=t.state.field(en);(e!=t.startState.field(en)||t.docChanged||t.selectionSet||t.viewportChanged)&&(this.decorations=this.highlight(e))}highlight({query:t,panel:e}){if(!e||!t.spec.valid)return X.none;let{view:i}=this,n=new Ee;for(let r=0,s=i.visibleRanges,o=s.length;r<o;r++){let{from:l,to:a}=s[r];for(;r<o-1&&a>s[r+1].from-500;)a=s[++r].to;t.highlight(i.state,l,a,(h,c)=>{let f=i.state.selection.ranges.some(u=>u.from==h&&u.to==c);n.add(h,c,f?YE:zE)})}return n.finish()}},{decorations:t=>t.decorations});function po(t){return e=>{let i=e.state.field(en,!1);return i&&i.query.spec.valid?t(e,i):JS(e)}}var Ba=po((t,{query:e})=>{let{to:i}=t.state.selection.main,n=e.nextMatch(t.state,i,i);if(!n)return!1;let r=Q.single(n.from,n.to),s=t.state.facet(_n);return t.dispatch({selection:r,effects:[hp(t,n),s.scrollToMatch(r.main,t)],userEvent:"select.search"}),KS(t),!0}),Na=po((t,{query:e})=>{let{state:i}=t,{from:n}=i.selection.main,r=e.prevMatch(i,n,n);if(!r)return!1;let s=Q.single(r.from,r.to),o=t.state.facet(_n);return t.dispatch({selection:s,effects:[hp(t,r),o.scrollToMatch(s.main,t)],userEvent:"select.search"}),KS(t),!0}),WE=po((t,{query:e})=>{let i=e.matchAll(t.state,1e3);return!i||!i.length?!1:(t.dispatch({selection:Q.create(i.map(n=>Q.range(n.from,n.to))),userEvent:"select.search.matches"}),!0)}),VE=({state:t,dispatch:e})=>{let i=t.select
Line truncated
|
||||
]`).replace("lheading",Hx).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},FM=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,HM=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,Jx=/^( {2,}|\\)\n(?!\s*$)/,KM=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,Fr=/[\p{P}\p{S}]/u,sc=/[\s\p{P}\p{S}]/u,Jp=/[^\s\p{P}\p{S}]/u,JM=le(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,sc).getRegex(),ek=/(?!~)[\p{P}\p{S}]/u,eL=/(?!~)[\s\p{P}\p{S}]/u,tL=/(?:[^\s\p{P}\p{S}]|~)/u,iL=le(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",ZM?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),tk=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,nL=le(tk,"u").replace(/punct/g,Fr).getRegex(),rL=le(tk,"u").replace(/punct/g,ek).getRegex(),ik="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",sL=le(ik,"gu").replace(/notPunctSpace/g,Jp).replace(/punctSpace/g,sc).replace(/punct/g,Fr).getRegex(),oL=le(ik,"gu").replace(/notPunctSpace/g,tL).replace(/punctSpace/g,eL).replace(/punct/g,ek).getRegex(),lL=le("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,Jp).replace(/punctSpace/g,sc).replace(/punct/g,Fr).getRegex(),aL=le(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,Fr).getRegex(),cL="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",hL=le(cL,"gu").replace(/notPunctSpace/g,Jp).replace(/punctSpace/g,sc).replace(/punct/g,Fr).getRegex(),fL=le(/\\(punct)/,"gu").replace(/punct/g,Fr).getRegex(),uL=le(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),dL=le(Hp).replace("(?:-->|$)","-->").getRegex(),pL=le("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",dL).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),tc=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,gL=le(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label",tc).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),nk=le(/^!?\[(label)\]\[(ref)\]/).replace("label",tc).replace("ref",Fp).getRegex(),rk=le(/^!?\[(ref)\](?:\[\])?/).replace("ref",Fp).getRegex(),OL=le("reflink|nolink(?!\\()","g").replace("reflink",nk).replace("nolink",rk).getRegex(),zx=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,eg={_backpedal:Vn,anyPunctuation:fL,autolink:uL,blockSkip:iL,br:Jx,code:HM,del:Vn,delLDelim:Vn,delRDelim:Vn,emStrongLDelim:nL,emStrongRDelimAst:sL,emStrongRDelimUnd:lL,escape:FM,link:gL,nolink:rk,punctuation:JM,reflink:nk,reflinkSearch:OL,tag:pL,text:KM,url:Vn},mL={...eg,link:le(/^!?\[(label)\]\((.*?)\)/).replace("label",tc).getRegex(),reflink:le(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",tc).getRegex()},Yp={...eg,emStrongRDelimAst:oL,emStrongLDelim:rL,delLDelim:aL,delRDelim:hL,url:le(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",zx).replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:le(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",zx).getRegex()},bL={...Yp,br:le(Jx).replace("{2,}","*").getRegex(),text:le(Yp.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},Ja={normal:Kp,gfm:GM,pedantic:UM},ko={normal:eg,gfm:Yp,breaks:bL,pedantic:mL},yL={"&":"&","<":"<",">":">",'"':""","'":"'"},Yx=t=>yL[t];function bi(t,e){if(e){if(nt.escapeTest.test(t))return t.replace(nt.escapeReplace,Yx)}else if(nt.escapeTestNoEncode.tesLine truncated
|
||||
`),i=e.length-1;for(;i>=0&&nt.blankLine.test(e[i]);)i--;return e.length-i<=2?t:e.slice(0,i+1).join(`
|
||||
`)}function mL(t,e){if(t.indexOf(e[1])===-1)return-1;let i=0;for(let n=0;n<t.length;n++)if(t[n]==="\\")n++;else if(t[n]===e[0])i++;else if(t[n]===e[1]&&(i--,i<0))return n;return i>0?-2:-1}function bL(t,e=0){let i=e,n="";for(let r of t)if(r===" "){let s=4-i%4;n+=" ".repeat(s),i+=s}else n+=r,i++;return n}function Ux(t,e,i,n,r){let s=e.href,o=e.title||null,l=t[1].replace(r.other.outputLinkReplace,"$1");n.state.inLink=!0;let a={type:t[0].charAt(0)==="!"?"image":"link",raw:i,href:s,title:o,text:l,tokens:n.inlineTokens(l)};return n.state.inLink=!1,a}function yL(t,e,i){let n=t.match(i.other.indentCodeCompensation);if(n===null)return e;let r=n[1];return e.split(`
|
||||
`)}function SL(t,e){if(t.indexOf(e[1])===-1)return-1;let i=0;for(let n=0;n<t.length;n++)if(t[n]==="\\")n++;else if(t[n]===e[0])i++;else if(t[n]===e[1]&&(i--,i<0))return n;return i>0?-2:-1}function xL(t,e=0){let i=e,n="";for(let r of t)if(r===" "){let s=4-i%4;n+=" ".repeat(s),i+=s}else n+=r,i++;return n}function Gx(t,e,i,n,r){let s=e.href,o=e.title||null,l=t[1].replace(r.other.outputLinkReplace,"$1");n.state.inLink=!0;let a={type:t[0].charAt(0)==="!"?"image":"link",raw:i,href:s,title:o,text:l,tokens:n.inlineTokens(l)};return n.state.inLink=!1,a}function kL(t,e,i){let n=t.match(i.other.indentCodeCompensation);if(n===null)return e;let r=n[1];return e.split(`
|
||||
`).map(s=>{let o=s.match(i.other.beginningSpace);if(o===null)return s;let[l]=o;return l.length>=r.length?s.slice(r.length):s}).join(`
|
||||
`)}var nc=class{constructor(t){K(this,"options");K(this,"rules");K(this,"lexer");this.options=t||Un}space(t){let e=this.rules.block.newline.exec(t);if(e&&e[0].length>0)return{type:"space",raw:e[0]}}code(t){let e=this.rules.block.code.exec(t);if(e){let i=this.options.pedantic?e[0]:Gx(e[0]),n=i.replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:i,codeBlockStyle:"indented",text:n}}}fences(t){let e=this.rules.block.fences.exec(t);if(e){let i=e[0],n=yL(i,e[3]||"",this.rules);return{type:"code",raw:i,lang:e[2]?e[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):e[2],text:n}}}heading(t){let e=this.rules.block.heading.exec(t);if(e){let i=e[2].trim();if(this.rules.other.endingHash.test(i)){let n=sn(i,"#");(this.options.pedantic||!n||this.rules.other.endingSpaceChar.test(n))&&(i=n.trim())}return{type:"heading",raw:sn(e[0],`
|
||||
`)}var ic=class{constructor(t){K(this,"options");K(this,"rules");K(this,"lexer");this.options=t||Un}space(t){let e=this.rules.block.newline.exec(t);if(e&&e[0].length>0)return{type:"space",raw:e[0]}}code(t){let e=this.rules.block.code.exec(t);if(e){let i=this.options.pedantic?e[0]:Vx(e[0]),n=i.replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:i,codeBlockStyle:"indented",text:n}}}fences(t){let e=this.rules.block.fences.exec(t);if(e){let i=e[0],n=kL(i,e[3]||"",this.rules);return{type:"code",raw:i,lang:e[2]?e[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):e[2],text:n}}}heading(t){let e=this.rules.block.heading.exec(t);if(e){let i=e[2].trim();if(this.rules.other.endingHash.test(i)){let n=sn(i,"#");(this.options.pedantic||!n||this.rules.other.endingSpaceChar.test(n))&&(i=n.trim())}return{type:"heading",raw:sn(e[0],`
|
||||
`),depth:e[1].length,text:i,tokens:this.lexer.inline(i)}}}hr(t){let e=this.rules.block.hr.exec(t);if(e)return{type:"hr",raw:sn(e[0],`
|
||||
`)}}blockquote(t){let e=this.rules.block.blockquote.exec(t);if(e){let i=sn(e[0],`
|
||||
`).split(`
|
||||
@@ -65,19 +65,19 @@ ${c}`:c;let f=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTo
|
||||
`),g=this.blockquote(p);s[s.length-1]=g,n=n.substring(0,n.length-d.raw.length)+g.raw,r=r.substring(0,r.length-d.text.length)+g.text;break}else if((u==null?void 0:u.type)==="list"){let d=u,p=d.raw+`
|
||||
`+i.join(`
|
||||
`),g=this.list(p);s[s.length-1]=g,n=n.substring(0,n.length-u.raw.length)+g.raw,r=r.substring(0,r.length-d.raw.length)+g.raw,i=p.substring(s.at(-1).raw.length).split(`
|
||||
`);continue}}return{type:"blockquote",raw:n,tokens:s,text:r}}}list(t){let e=this.rules.block.list.exec(t);if(e){let i=e[1].trim(),n=i.length>1,r={type:"list",raw:"",ordered:n,start:n?+i.slice(0,-1):"",loose:!1,items:[]};i=n?`\\d{1,9}\\${i.slice(-1)}`:`\\${i}`,this.options.pedantic&&(i=n?i:"[*+-]");let s=this.rules.other.listItemRegex(i),o=!1;for(;t;){let a=!1,h="",c="";if(!(e=s.exec(t))||this.rules.block.hr.test(t))break;h=e[0],t=t.substring(h.length);let f=bL(e[2].split(`
|
||||
`);continue}}return{type:"blockquote",raw:n,tokens:s,text:r}}}list(t){let e=this.rules.block.list.exec(t);if(e){let i=e[1].trim(),n=i.length>1,r={type:"list",raw:"",ordered:n,start:n?+i.slice(0,-1):"",loose:!1,items:[]};i=n?`\\d{1,9}\\${i.slice(-1)}`:`\\${i}`,this.options.pedantic&&(i=n?i:"[*+-]");let s=this.rules.other.listItemRegex(i),o=!1;for(;t;){let a=!1,h="",c="";if(!(e=s.exec(t))||this.rules.block.hr.test(t))break;h=e[0],t=t.substring(h.length);let f=xL(e[2].split(`
|
||||
`,1)[0],e[1].length),u=t.split(`
|
||||
`,1)[0],d=!f.trim(),p=0;if(this.options.pedantic?(p=2,c=f.trimStart()):d?p=e[1].length+1:(p=f.search(this.rules.other.nonSpaceChar),p=p>4?1:p,c=f.slice(p),p+=e[1].length),d&&this.rules.other.blankLine.test(u)&&(h+=u+`
|
||||
`,t=t.substring(u.length+1),a=!0),!a){let g=this.rules.other.nextBulletRegex(p),m=this.rules.other.hrRegex(p),b=this.rules.other.fencesBeginRegex(p),y=this.rules.other.headingBeginRegex(p),S=this.rules.other.htmlBeginRegex(p),v=this.rules.other.blockquoteBeginRegex(p);for(;t;){let x=t.split(`
|
||||
`,1)[0],w;if(u=x,this.options.pedantic?(u=u.replace(this.rules.other.listReplaceNesting," "),w=u):w=u.replace(this.rules.other.tabCharGlobal," "),b.test(u)||y.test(u)||S.test(u)||v.test(u)||g.test(u)||m.test(u))break;if(w.search(this.rules.other.nonSpaceChar)>=p||!u.trim())c+=`
|
||||
`+w.slice(p);else{if(d||f.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||b.test(f)||y.test(f)||m.test(f))break;c+=`
|
||||
`+u}d=!u.trim(),h+=x+`
|
||||
`,t=t.substring(x.length+1),f=w.slice(p)}}r.loose||(o?r.loose=!0:this.rules.other.doubleBlankLine.test(h)&&(o=!0)),r.items.push({type:"list_item",raw:h,task:!!this.options.gfm&&this.rules.other.listIsTask.test(c),loose:!1,text:c,tokens:[]}),r.raw+=h}let l=r.items.at(-1);if(l)l.raw=l.raw.trimEnd(),l.text=l.text.trimEnd();else return;r.raw=r.raw.trimEnd();for(let a of r.items){this.lexer.state.top=!1,a.tokens=this.lexer.blockTokens(a.text,[]);let h=a.tokens[0];if(a.task&&((h==null?void 0:h.type)==="text"||(h==null?void 0:h.type)==="paragraph")){a.text=a.text.replace(this.rules.other.listReplaceTask,""),h.raw=h.raw.replace(this.rules.other.listReplaceTask,""),h.text=h.text.replace(this.rules.other.listReplaceTask,"");for(let f=this.lexer.inlineQueue.length-1;f>=0;f--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[f].src)){this.lexer.inlineQueue[f].src=this.lexer.inlineQueue[f].src.replace(this.rules.other.listReplaceTask,"");break}let c=this.rules.other.listTaskCheckbox.exec(a.raw);if(c){let f={type:"checkbox",raw:c[0]+" ",checked:c[0]!=="[ ]"};a.checked=f.checked,r.loose?a.tokens[0]&&["paragraph","text"].includes(a.tokens[0].type)&&"tokens"in a.tokens[0]&&a.tokens[0].tokens?(a.tokens[0].raw=f.raw+a.tokens[0].raw,a.tokens[0].text=f.raw+a.tokens[0].text,a.tokens[0].tokens.unshift(f)):a.tokens.unshift({type:"paragraph",raw:f.raw,text:f.raw,tokens:[f]}):a.tokens.unshift(f)}}else a.task&&(a.task=!1);if(!r.loose){let c=a.tokens.filter(u=>u.type==="space"),f=c.length>0&&c.some(u=>this.rules.other.anyLine.test(u.raw));r.loose=f}}if(r.loose)for(let a of r.items){a.loose=!0;for(let h of a.tokens)h.type==="text"&&(h.type="paragraph")}return r}}html(t){let e=this.rules.block.html.exec(t);if(e){let i=Gx(e[0]);return{type:"html",block:!0,raw:i,pre:e[1]==="pre"||e[1]==="script"||e[1]==="style",text:i}}}def(t){let e=this.rules.block.def.exec(t);if(e){let i=e[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),n=e[2]?e[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",r=e[3]?e[3].substring(1,e[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):e[3];return{type:"def",tag:i,raw:sn(e[0],`
|
||||
`),href:n,title:r}}}table(t){var o;let e=this.rules.block.table.exec(t);if(!e||!this.rules.other.tableDelimiter.test(e[2]))return;let i=Vx(e[1]),n=e[2].replace(this.rules.other.tableAlignChars,"").split("|"),r=(o=e[3])!=null&&o.trim()?e[3].replace(this.rules.other.tableRowBlankLine,"").split(`
|
||||
`,t=t.substring(x.length+1),f=w.slice(p)}}r.loose||(o?r.loose=!0:this.rules.other.doubleBlankLine.test(h)&&(o=!0)),r.items.push({type:"list_item",raw:h,task:!!this.options.gfm&&this.rules.other.listIsTask.test(c),loose:!1,text:c,tokens:[]}),r.raw+=h}let l=r.items.at(-1);if(l)l.raw=l.raw.trimEnd(),l.text=l.text.trimEnd();else return;r.raw=r.raw.trimEnd();for(let a of r.items){this.lexer.state.top=!1,a.tokens=this.lexer.blockTokens(a.text,[]);let h=a.tokens[0];if(a.task&&((h==null?void 0:h.type)==="text"||(h==null?void 0:h.type)==="paragraph")){a.text=a.text.replace(this.rules.other.listReplaceTask,""),h.raw=h.raw.replace(this.rules.other.listReplaceTask,""),h.text=h.text.replace(this.rules.other.listReplaceTask,"");for(let f=this.lexer.inlineQueue.length-1;f>=0;f--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[f].src)){this.lexer.inlineQueue[f].src=this.lexer.inlineQueue[f].src.replace(this.rules.other.listReplaceTask,"");break}let c=this.rules.other.listTaskCheckbox.exec(a.raw);if(c){let f={type:"checkbox",raw:c[0]+" ",checked:c[0]!=="[ ]"};a.checked=f.checked,r.loose?a.tokens[0]&&["paragraph","text"].includes(a.tokens[0].type)&&"tokens"in a.tokens[0]&&a.tokens[0].tokens?(a.tokens[0].raw=f.raw+a.tokens[0].raw,a.tokens[0].text=f.raw+a.tokens[0].text,a.tokens[0].tokens.unshift(f)):a.tokens.unshift({type:"paragraph",raw:f.raw,text:f.raw,tokens:[f]}):a.tokens.unshift(f)}}else a.task&&(a.task=!1);if(!r.loose){let c=a.tokens.filter(u=>u.type==="space"),f=c.length>0&&c.some(u=>this.rules.other.anyLine.test(u.raw));r.loose=f}}if(r.loose)for(let a of r.items){a.loose=!0;for(let h of a.tokens)h.type==="text"&&(h.type="paragraph")}return r}}html(t){let e=this.rules.block.html.exec(t);if(e){let i=Vx(e[0]);return{type:"html",block:!0,raw:i,pre:e[1]==="pre"||e[1]==="script"||e[1]==="style",text:i}}}def(t){let e=this.rules.block.def.exec(t);if(e){let i=e[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),n=e[2]?e[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",r=e[3]?e[3].substring(1,e[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):e[3];return{type:"def",tag:i,raw:sn(e[0],`
|
||||
`),href:n,title:r}}}table(t){var o;let e=this.rules.block.table.exec(t);if(!e||!this.rules.other.tableDelimiter.test(e[2]))return;let i=Wx(e[1]),n=e[2].replace(this.rules.other.tableAlignChars,"").split("|"),r=(o=e[3])!=null&&o.trim()?e[3].replace(this.rules.other.tableRowBlankLine,"").split(`
|
||||
`):[],s={type:"table",raw:sn(e[0],`
|
||||
`),header:[],align:[],rows:[]};if(i.length===n.length){for(let l of n)this.rules.other.tableAlignRight.test(l)?s.align.push("right"):this.rules.other.tableAlignCenter.test(l)?s.align.push("center"):this.rules.other.tableAlignLeft.test(l)?s.align.push("left"):s.align.push(null);for(let l=0;l<i.length;l++)s.header.push({text:i[l],tokens:this.lexer.inline(i[l]),header:!0,align:s.align[l]});for(let l of r)s.rows.push(Vx(l,s.header.length).map((a,h)=>({text:a,tokens:this.lexer.inline(a),header:!1,align:s.align[h]})));return s}}lheading(t){let e=this.rules.block.lheading.exec(t);if(e){let i=e[1].trim();return{type:"heading",raw:sn(e[0],`
|
||||
`),header:[],align:[],rows:[]};if(i.length===n.length){for(let l of n)this.rules.other.tableAlignRight.test(l)?s.align.push("right"):this.rules.other.tableAlignCenter.test(l)?s.align.push("center"):this.rules.other.tableAlignLeft.test(l)?s.align.push("left"):s.align.push(null);for(let l=0;l<i.length;l++)s.header.push({text:i[l],tokens:this.lexer.inline(i[l]),header:!0,align:s.align[l]});for(let l of r)s.rows.push(Wx(l,s.header.length).map((a,h)=>({text:a,tokens:this.lexer.inline(a),header:!1,align:s.align[h]})));return s}}lheading(t){let e=this.rules.block.lheading.exec(t);if(e){let i=e[1].trim();return{type:"heading",raw:sn(e[0],`
|
||||
`),depth:e[2].charAt(0)==="="?1:2,text:i,tokens:this.lexer.inline(i)}}}paragraph(t){let e=this.rules.block.paragraph.exec(t);if(e){let i=e[1].charAt(e[1].length-1)===`
|
||||
`?e[1].slice(0,-1):e[1];return{type:"paragraph",raw:e[0],text:i,tokens:this.lexer.inline(i)}}}text(t){let e=this.rules.block.text.exec(t);if(e)return{type:"text",raw:e[0],text:e[0],tokens:this.lexer.inline(e[0])}}escape(t){let e=this.rules.inline.escape.exec(t);if(e)return{type:"escape",raw:e[0],text:e[1]}}tag(t){let e=this.rules.inline.tag.exec(t);if(e)return!this.lexer.state.inLink&&this.rules.other.startATag.test(e[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(e[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(e[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(e[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:e[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:e[0]}}link(t){let e=this.rules.inline.link.exec(t);if(e){let i=e[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(i)){if(!this.rules.other.endAngleBracket.test(i))return;let s=sn(i.slice(0,-1),"\\");if((i.length-s.length)%2===0)return}else{let s=mL(e[2],"()");if(s===-2)return;if(s>-1){let o=(e[0].indexOf("!")===0?5:4)+e[1].length+s;e[2]=e[2].substring(0,s),e[0]=e[0].substring(0,o).trim(),e[3]=""}}let n=e[2],r="";if(this.options.pedantic){let s=this.rules.other.pedanticHrefTitle.exec(n);s&&(n=s[1],r=s[3])}else r=e[3]?e[3].slice(1,-1):"";return n=n.trim(),this.rules.other.startAngleBracket.test(n)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(i)?n=n.slice(1):n=n.slice(1,-1)),Ux(e,{href:n&&n.replace(this.rules.inline.anyPunctuation,"$1"),title:r&&r.replace(this.rules.inline.anyPunctuation,"$1")},e[0],this.lexer,this.rules)}}reflink(t,e){let i;if((i=this.rules.inline.reflink.exec(t))||(i=this.rules.inline.nolink.exec(t))){let n=(i[2]||i[1]).replace(this.rules.other.multipleSpaceGlobal," "),r=e[n.toLowerCase()];if(!r){let s=i[0].charAt(0);return{type:"text",raw:s,text:s}}return Ux(i,r,i[0],this.lexer,this.rules)}}emStrong(t,e,i=""){let n=this.rules.inline.emStrongLDelim.exec(t);if(!(!n||!n[1]&&!n[2]&&!n[3]&&!n[4]||n[4]&&i.match(this.rules.other.unicodeAlphaNumeric))&&(!(n[1]||n[3])||!i||this.rules.inline.punctuation.exec(i))){let r=[...n[0]].length-1,s,o,l=r,a=0,h=n[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(h.lastIndex=0,e=e.slice(-1*t.length+r);(n=h.exec(e))!==null;){if(s=n[1]||n[2]||n[3]||n[4]||n[5]||n[6],!s)continue;if(o=[...s].length,n[3]||n[4]){l+=o;continue}else if((n[5]||n[6])&&r%3&&!((r+o)%3)){a+=o;continue}if(l-=o,l>0)continue;o=Math.min(o,o+l+a);let c=[...n[0]][0].length,f=t.slice(0,r+n.index+c+o);if(Math.min(r,o)%2){let d=f.slice(1,-1);return{type:"em",raw:f,text:d,tokens:this.lexer.inlineTokens(d)}}let u=f.slice(2,-2);return{type:"strong",raw:f,text:u,tokens:this.lexer.inlineTokens(u)}}}}codespan(t){let e=this.rules.inline.code.exec(t);if(e){let i=e[2].replace(this.rules.other.newLineCharGlobal," "),n=this.rules.other.nonSpaceChar.test(i),r=this.rules.other.startingSpaceChar.test(i)&&this.rules.other.endingSpaceChar.test(i);return n&&r&&(i=i.substring(1,i.length-1)),{type:"codespan",raw:e[0],text:i}}}br(t){let e=this.rules.inline.br.exec(t);if(e)return{type:"br",raw:e[0]}}del(t,e,i=""){let n=this.rules.inline.delLDelim.exec(t);if(n&&(!n[1]||!i||this.rules.inline.punctuation.exec(i))){let r=[...n[0]].length-1,s,o,l=r,a=this.rules.inline.delRDelim;for(a.lastIndex=0,e=e.slice(-1*t.length+r);(n=a.exec(e))!==null;){if(s=n[1]||n[2]||n[3]||n[4]||n[5]||n[6],!s||(o=[...s].length,o!==r))continue;if(n[3]||n[4]){l+=o;continue}if(l-=o,l>0)continue;o=Math.min(o,o+l);let h=[...n[0]][0].length,c=t.slice(0,r+n.index+h+o),f=c.slice(r,-r);return{type:"del",raw:c,text:f,tokens:this.lexer.inlineTokens(f)}}}}autolink(t){let e=this.rules.inline.autolink.exec(t);if(e){let i,n;return e[2]==="@"?(i=e[1],n="mailto:"+i):(i=e[1],n=i),{type:"link",raw:e[0],text:i,href:n,tokens:[{type:"text",raw:i,text:i}]}}}url(t){var i,n;let e;if(e=this.rules.inline.url.exec(t)){let r,s;if(e[2]==="@")r=e[0],s="mailto:"+r;else{let o;do o=e[0],e[0]=(n=(i=this.rules.inline._backpedal.exec(e[0]))==null?void 0:i[0])!=null?n:"";while(o!==e[0]);r=e[0],e[1]==="www."?s="http://"+e[0]:s=e[0]}return{type:"link",raw:e[0],text:r,href:s,tokens:[{type:"text",raw:r,text:r}]}}}inlineText(t){let e=this.rules.inline.text.exec(t);if(e){let i=this.lexer.state.inRawBlock;return{type:"text",raw:e[0],text:e[0],escaped:i}}}},ei=class Wp{constructor(e){K(this,"tokens");K(this,"options");K(this,"state");K(this,"inlineQueue");K(this,"tokenizer");this.tokens=[],this.tokens.links=Object.create(null),this.options=e||Un,this.options.tokenizer=this.options.tokenizer||new nc,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let i={other:nt,block:ec.normal,inline:ko.normal};this.options.pedantic?(i.block=ec.pedantic,i.inline=ko.p
Line truncated
|
||||
`?e[1].slice(0,-1):e[1];return{type:"paragraph",raw:e[0],text:i,tokens:this.lexer.inline(i)}}}text(t){let e=this.rules.block.text.exec(t);if(e)return{type:"text",raw:e[0],text:e[0],tokens:this.lexer.inline(e[0])}}escape(t){let e=this.rules.inline.escape.exec(t);if(e)return{type:"escape",raw:e[0],text:e[1]}}tag(t){let e=this.rules.inline.tag.exec(t);if(e)return!this.lexer.state.inLink&&this.rules.other.startATag.test(e[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(e[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(e[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(e[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:e[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:e[0]}}link(t){let e=this.rules.inline.link.exec(t);if(e){let i=e[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(i)){if(!this.rules.other.endAngleBracket.test(i))return;let s=sn(i.slice(0,-1),"\\");if((i.length-s.length)%2===0)return}else{let s=SL(e[2],"()");if(s===-2)return;if(s>-1){let o=(e[0].indexOf("!")===0?5:4)+e[1].length+s;e[2]=e[2].substring(0,s),e[0]=e[0].substring(0,o).trim(),e[3]=""}}let n=e[2],r="";if(this.options.pedantic){let s=this.rules.other.pedanticHrefTitle.exec(n);s&&(n=s[1],r=s[3])}else r=e[3]?e[3].slice(1,-1):"";return n=n.trim(),this.rules.other.startAngleBracket.test(n)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(i)?n=n.slice(1):n=n.slice(1,-1)),Gx(e,{href:n&&n.replace(this.rules.inline.anyPunctuation,"$1"),title:r&&r.replace(this.rules.inline.anyPunctuation,"$1")},e[0],this.lexer,this.rules)}}reflink(t,e){let i;if((i=this.rules.inline.reflink.exec(t))||(i=this.rules.inline.nolink.exec(t))){let n=(i[2]||i[1]).replace(this.rules.other.multipleSpaceGlobal," "),r=e[n.toLowerCase()];if(!r){let s=i[0].charAt(0);return{type:"text",raw:s,text:s}}return Gx(i,r,i[0],this.lexer,this.rules)}}emStrong(t,e,i=""){let n=this.rules.inline.emStrongLDelim.exec(t);if(!(!n||!n[1]&&!n[2]&&!n[3]&&!n[4]||n[4]&&i.match(this.rules.other.unicodeAlphaNumeric))&&(!(n[1]||n[3])||!i||this.rules.inline.punctuation.exec(i))){let r=[...n[0]].length-1,s,o,l=r,a=0,h=n[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(h.lastIndex=0,e=e.slice(-1*t.length+r);(n=h.exec(e))!==null;){if(s=n[1]||n[2]||n[3]||n[4]||n[5]||n[6],!s)continue;if(o=[...s].length,n[3]||n[4]){l+=o;continue}else if((n[5]||n[6])&&r%3&&!((r+o)%3)){a+=o;continue}if(l-=o,l>0)continue;o=Math.min(o,o+l+a);let c=[...n[0]][0].length,f=t.slice(0,r+n.index+c+o);if(Math.min(r,o)%2){let d=f.slice(1,-1);return{type:"em",raw:f,text:d,tokens:this.lexer.inlineTokens(d)}}let u=f.slice(2,-2);return{type:"strong",raw:f,text:u,tokens:this.lexer.inlineTokens(u)}}}}codespan(t){let e=this.rules.inline.code.exec(t);if(e){let i=e[2].replace(this.rules.other.newLineCharGlobal," "),n=this.rules.other.nonSpaceChar.test(i),r=this.rules.other.startingSpaceChar.test(i)&&this.rules.other.endingSpaceChar.test(i);return n&&r&&(i=i.substring(1,i.length-1)),{type:"codespan",raw:e[0],text:i}}}br(t){let e=this.rules.inline.br.exec(t);if(e)return{type:"br",raw:e[0]}}del(t,e,i=""){let n=this.rules.inline.delLDelim.exec(t);if(n&&(!n[1]||!i||this.rules.inline.punctuation.exec(i))){let r=[...n[0]].length-1,s,o,l=r,a=this.rules.inline.delRDelim;for(a.lastIndex=0,e=e.slice(-1*t.length+r);(n=a.exec(e))!==null;){if(s=n[1]||n[2]||n[3]||n[4]||n[5]||n[6],!s||(o=[...s].length,o!==r))continue;if(n[3]||n[4]){l+=o;continue}if(l-=o,l>0)continue;o=Math.min(o,o+l);let h=[...n[0]][0].length,c=t.slice(0,r+n.index+h+o),f=c.slice(r,-r);return{type:"del",raw:c,text:f,tokens:this.lexer.inlineTokens(f)}}}}autolink(t){let e=this.rules.inline.autolink.exec(t);if(e){let i,n;return e[2]==="@"?(i=e[1],n="mailto:"+i):(i=e[1],n=i),{type:"link",raw:e[0],text:i,href:n,tokens:[{type:"text",raw:i,text:i}]}}}url(t){var i,n;let e;if(e=this.rules.inline.url.exec(t)){let r,s;if(e[2]==="@")r=e[0],s="mailto:"+r;else{let o;do o=e[0],e[0]=(n=(i=this.rules.inline._backpedal.exec(e[0]))==null?void 0:i[0])!=null?n:"";while(o!==e[0]);r=e[0],e[1]==="www."?s="http://"+e[0]:s=e[0]}return{type:"link",raw:e[0],text:r,href:s,tokens:[{type:"text",raw:r,text:r}]}}}inlineText(t){let e=this.rules.inline.text.exec(t);if(e){let i=this.lexer.state.inRawBlock;return{type:"text",raw:e[0],text:e[0],escaped:i}}}},ei=class qp{constructor(e){K(this,"tokens");K(this,"options");K(this,"state");K(this,"inlineQueue");K(this,"tokenizer");this.tokens=[],this.tokens.links=Object.create(null),this.options=e||Un,this.options.tokenizer=this.options.tokenizer||new ic,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let i={other:nt,block:Ja.normal,inline:ko.normal};this.options.pedantic?(i.block=Ja.pedantic,i.inline=ko.p
Line truncated
|
||||
`),this.blockTokens(e,this.tokens);for(let i=0;i<this.inlineQueue.length;i++){let n=this.inlineQueue[i];this.inlineTokens(n.src,n.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,i=[],n=!1){var s,o,l;this.tokenizer.lexer=this,this.options.pedantic&&(e=e.replace(nt.tabCharGlobal," ").replace(nt.spaceLine,""));let r=1/0;for(;e;){if(e.length<r)r=e.length;else{this.infiniteLoopError(e.charCodeAt(0));break}let a;if((o=(s=this.options.extensions)==null?void 0:s.block)!=null&&o.some(c=>(a=c.call({lexer:this},e,i))?(e=e.substring(a.raw.length),i.push(a),!0):!1))continue;if(a=this.tokenizer.space(e)){e=e.substring(a.raw.length);let c=i.at(-1);a.raw.length===1&&c!==void 0?c.raw+=`
|
||||
`:i.push(a);continue}if(a=this.tokenizer.code(e)){e=e.substring(a.raw.length);let c=i.at(-1);(c==null?void 0:c.type)==="paragraph"||(c==null?void 0:c.type)==="text"?(c.raw+=(c.raw.endsWith(`
|
||||
`)?"":`
|
||||
@@ -91,7 +91,7 @@ ${c}`:c;let f=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTo
|
||||
`+a.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=c.text):i.push(a),n=h.length!==e.length,e=e.substring(a.raw.length);continue}if(a=this.tokenizer.text(e)){e=e.substring(a.raw.length);let c=i.at(-1);(c==null?void 0:c.type)==="text"?(c.raw+=(c.raw.endsWith(`
|
||||
`)?"":`
|
||||
`)+a.raw,c.text+=`
|
||||
`+a.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=c.text):i.push(a);continue}if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return this.state.top=!0,i}inline(e,i=[]){return this.inlineQueue.push({src:e,tokens:i}),i}inlineTokens(e,i=[]){var h,c,f,u,d,p;this.tokenizer.lexer=this;let n=e,r=null;if(this.tokens.links){let g=Object.keys(this.tokens.links);if(g.length>0)for(;(r=this.tokenizer.rules.inline.reflinkSearch.exec(n))!==null;)g.includes(r[0].slice(r[0].lastIndexOf("[")+1,-1))&&(n=n.slice(0,r.index)+"["+"a".repeat(r[0].length-2)+"]"+n.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(r=this.tokenizer.rules.inline.anyPunctuation.exec(n))!==null;)n=n.slice(0,r.index)+"++"+n.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);let s;for(;(r=this.tokenizer.rules.inline.blockSkip.exec(n))!==null;)s=r[2]?r[2].length:0,n=n.slice(0,r.index+s)+"["+"a".repeat(r[0].length-s-2)+"]"+n.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);n=(f=(c=(h=this.options.hooks)==null?void 0:h.emStrongMask)==null?void 0:c.call({lexer:this},n))!=null?f:n;let o=!1,l="",a=1/0;for(;e;){if(e.length<a)a=e.length;else{this.infiniteLoopError(e.charCodeAt(0));break}o||(l=""),o=!1;let g;if((d=(u=this.options.extensions)==null?void 0:u.inline)!=null&&d.some(b=>(g=b.call({lexer:this},e,i))?(e=e.substring(g.raw.length),i.push(g),!0):!1))continue;if(g=this.tokenizer.escape(e)){e=e.substring(g.raw.length),i.push(g);continue}if(g=this.tokenizer.tag(e)){e=e.substring(g.raw.length),i.push(g);continue}if(g=this.tokenizer.link(e)){e=e.substring(g.raw.length),i.push(g);continue}if(g=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(g.raw.length);let b=i.at(-1);g.type==="text"&&(b==null?void 0:b.type)==="text"?(b.raw+=g.raw,b.text+=g.text):i.push(g);continue}if(g=this.tokenizer.emStrong(e,n,l)){e=e.substring(g.raw.length),i.push(g);continue}if(g=this.tokenizer.codespan(e)){e=e.substring(g.raw.length),i.push(g);continue}if(g=this.tokenizer.br(e)){e=e.substring(g.raw.length),i.push(g);continue}if(g=this.tokenizer.del(e,n,l)){e=e.substring(g.raw.length),i.push(g);continue}if(g=this.tokenizer.autolink(e)){e=e.substring(g.raw.length),i.push(g);continue}if(!this.state.inLink&&(g=this.tokenizer.url(e))){e=e.substring(g.raw.length),i.push(g);continue}let m=e;if((p=this.options.extensions)!=null&&p.startInline){let b=1/0,y=e.slice(1),S;this.options.extensions.startInline.forEach(v=>{S=v.call({lexer:this},y),typeof S=="number"&&S>=0&&(b=Math.min(b,S))}),b<1/0&&b>=0&&(m=e.substring(0,b+1))}if(g=this.tokenizer.inlineText(m)){e=e.substring(g.raw.length),g.raw.slice(-1)!=="_"&&(l=g.raw.slice(-1)),o=!0;let b=i.at(-1);(b==null?void 0:b.type)==="text"?(b.raw+=g.raw,b.text+=g.text):i.push(g);continue}if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return i}infiniteLoopError(e){let i="Infinite loop on byte: "+e;if(this.options.silent)console.error(i);else throw new Error(i)}},rc=class{constructor(t){K(this,"options");K(this,"parser");this.options=t||Un}space(t){return""}code({text:t,lang:e,escaped:i}){var s;let n=(s=(e||"").match(nt.notSpaceStart))==null?void 0:s[0],r=t.replace(nt.endingNewline,"")+`
|
||||
`+a.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=c.text):i.push(a);continue}if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return this.state.top=!0,i}inline(e,i=[]){return this.inlineQueue.push({src:e,tokens:i}),i}inlineTokens(e,i=[]){var h,c,f,u,d,p;this.tokenizer.lexer=this;let n=e,r=null;if(this.tokens.links){let g=Object.keys(this.tokens.links);if(g.length>0)for(;(r=this.tokenizer.rules.inline.reflinkSearch.exec(n))!==null;)g.includes(r[0].slice(r[0].lastIndexOf("[")+1,-1))&&(n=n.slice(0,r.index)+"["+"a".repeat(r[0].length-2)+"]"+n.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(r=this.tokenizer.rules.inline.anyPunctuation.exec(n))!==null;)n=n.slice(0,r.index)+"++"+n.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);let s;for(;(r=this.tokenizer.rules.inline.blockSkip.exec(n))!==null;)s=r[2]?r[2].length:0,n=n.slice(0,r.index+s)+"["+"a".repeat(r[0].length-s-2)+"]"+n.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);n=(f=(c=(h=this.options.hooks)==null?void 0:h.emStrongMask)==null?void 0:c.call({lexer:this},n))!=null?f:n;let o=!1,l="",a=1/0;for(;e;){if(e.length<a)a=e.length;else{this.infiniteLoopError(e.charCodeAt(0));break}o||(l=""),o=!1;let g;if((d=(u=this.options.extensions)==null?void 0:u.inline)!=null&&d.some(b=>(g=b.call({lexer:this},e,i))?(e=e.substring(g.raw.length),i.push(g),!0):!1))continue;if(g=this.tokenizer.escape(e)){e=e.substring(g.raw.length),i.push(g);continue}if(g=this.tokenizer.tag(e)){e=e.substring(g.raw.length),i.push(g);continue}if(g=this.tokenizer.link(e)){e=e.substring(g.raw.length),i.push(g);continue}if(g=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(g.raw.length);let b=i.at(-1);g.type==="text"&&(b==null?void 0:b.type)==="text"?(b.raw+=g.raw,b.text+=g.text):i.push(g);continue}if(g=this.tokenizer.emStrong(e,n,l)){e=e.substring(g.raw.length),i.push(g);continue}if(g=this.tokenizer.codespan(e)){e=e.substring(g.raw.length),i.push(g);continue}if(g=this.tokenizer.br(e)){e=e.substring(g.raw.length),i.push(g);continue}if(g=this.tokenizer.del(e,n,l)){e=e.substring(g.raw.length),i.push(g);continue}if(g=this.tokenizer.autolink(e)){e=e.substring(g.raw.length),i.push(g);continue}if(!this.state.inLink&&(g=this.tokenizer.url(e))){e=e.substring(g.raw.length),i.push(g);continue}let m=e;if((p=this.options.extensions)!=null&&p.startInline){let b=1/0,y=e.slice(1),S;this.options.extensions.startInline.forEach(v=>{S=v.call({lexer:this},y),typeof S=="number"&&S>=0&&(b=Math.min(b,S))}),b<1/0&&b>=0&&(m=e.substring(0,b+1))}if(g=this.tokenizer.inlineText(m)){e=e.substring(g.raw.length),g.raw.slice(-1)!=="_"&&(l=g.raw.slice(-1)),o=!0;let b=i.at(-1);(b==null?void 0:b.type)==="text"?(b.raw+=g.raw,b.text+=g.text):i.push(g);continue}if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return i}infiniteLoopError(e){let i="Infinite loop on byte: "+e;if(this.options.silent)console.error(i);else throw new Error(i)}},nc=class{constructor(t){K(this,"options");K(this,"parser");this.options=t||Un}space(t){return""}code({text:t,lang:e,escaped:i}){var s;let n=(s=(e||"").match(nt.notSpaceStart))==null?void 0:s[0],r=t.replace(nt.endingNewline,"")+`
|
||||
`;return n?'<pre><code class="language-'+bi(n)+'">'+(i?r:bi(r,!0))+`</code></pre>
|
||||
`:"<pre><code>"+(i?r:bi(r,!0))+`</code></pre>
|
||||
`}blockquote({tokens:t}){return`<blockquote>
|
||||
@@ -109,8 +109,8 @@ ${this.parser.parse(t)}</blockquote>
|
||||
`}tablerow({text:t}){return`<tr>
|
||||
${t}</tr>
|
||||
`}tablecell(t){let e=this.parser.parseInline(t.tokens),i=t.header?"th":"td";return(t.align?`<${i} align="${t.align}">`:`<${i}>`)+e+`</${i}>
|
||||
`}strong({tokens:t}){return`<strong>${this.parser.parseInline(t)}</strong>`}em({tokens:t}){return`<em>${this.parser.parseInline(t)}</em>`}codespan({text:t}){return`<code>${bi(t,!0)}</code>`}br(t){return"<br>"}del({tokens:t}){return`<del>${this.parser.parseInline(t)}</del>`}link({href:t,title:e,tokens:i}){let n=this.parser.parseInline(i),r=Wx(t);if(r===null)return n;t=r;let s='<a href="'+t+'"';return e&&(s+=' title="'+bi(e)+'"'),s+=">"+n+"</a>",s}image({href:t,title:e,text:i,tokens:n}){n&&(i=this.parser.parseInline(n,this.parser.textRenderer));let r=Wx(t);if(r===null)return bi(i);t=r;let s=`<img src="${t}" alt="${bi(i)}"`;return e&&(s+=` title="${bi(e)}"`),s+=">",s}text(t){return"tokens"in t&&t.tokens?this.parser.parseInline(t.tokens):"escaped"in t&&t.escaped?t.text:bi(t.text)}},ig=class{strong({text:t}){return t}em({text:t}){return t}codespan({text:t}){return t}del({text:t}){return t}html({text:t}){return t}text({text:t}){return t}link({text:t}){return""+t}image({text:t}){return""+t}br(){return""}checkbox({raw:t}){return t}},ti=class Vp{constructor(e){K(this,"options");K(this,"renderer");K(this,"textRenderer");this.options=e||Un,this.options.renderer=this.options.renderer||new rc,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new ig}static parse(e,i){return new Vp(i).parse(e)}static parseInline(e,i){return new Vp(i).parseInline(e)}parse(e){var n,r;this.renderer.parser=this;let i="";for(let s=0;s<e.length;s++){let o=e[s];if((r=(n=this.options.extensions)==null?void 0:n.renderers)!=null&&r[o.type]){let a=o,h=this.options.extensions.renderers[a.type].call({parser:this},a);if(h!==!1||!["space","hr","heading","code","table","blockquote","list","html","def","paragraph","text"].includes(a.type)){i+=h||"";continue}}let l=o;switch(l.type){case"space":{i+=this.renderer.space(l);break}case"hr":{i+=this.renderer.hr(l);break}case"heading":{i+=this.renderer.heading(l);break}case"code":{i+=this.renderer.code(l);break}case"table":{i+=this.renderer.table(l);break}case"blockquote":{i+=this.renderer.blockquote(l);break}case"list":{i+=this.renderer.list(l);break}case"checkbox":{i+=this.renderer.checkbox(l);break}case"html":{i+=this.renderer.html(l);break}case"def":{i+=this.renderer.def(l);break}case"paragraph":{i+=this.renderer.paragraph(l);break}case"text":{i+=this.renderer.text(l);break}default:{let a='Token with "'+l.type+'" type was not found.';if(this.options.silent)return console.error(a),"";throw new Error(a)}}}return i}parseInline(e,i=this.renderer){var r,s;this.renderer.parser=this;let n="";for(let o=0;o<e.length;o++){let l=e[o];if((s=(r=this.options.extensions)==null?void 0:r.renderers)!=null&&s[l.type]){let h=this.options.extensions.renderers[l.type].call({parser:this},l);if(h!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(l.type)){n+=h||"";continue}}let a=l;switch(a.type){case"escape":{n+=i.text(a);break}case"html":{n+=i.html(a);break}case"link":{n+=i.link(a);break}case"image":{n+=i.image(a);break}case"checkbox":{n+=i.checkbox(a);break}case"strong":{n+=i.strong(a);break}case"em":{n+=i.em(a);break}case"codespan":{n+=i.codespan(a);break}case"br":{n+=i.br(a);break}case"del":{n+=i.del(a);break}case"text":{n+=i.text(a);break}default:{let h='Token with "'+a.type+'" type was not found.';if(this.options.silent)return console.error(h),"";throw new Error(h)}}}return n}},tc,wo=(tc=class{constructor(t){K(this,"options");K(this,"block");this.options=t||Un}preprocess(t){return t}postprocess(t){return t}processAllTokens(t){return t}emStrongMask(t){return t}provideLexer(t=this.block){return t?ei.lex:ei.lexInline}provideParser(t=this.block){return t?ti.parse:ti.parseInline}},K(tc,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens","emStrongMask"])),K(tc,"passThroughHooksRespectAsync",new Set(["preprocess","postprocess","processAllTokens"])),tc),SL=class{constructor(...t){K(this,"defaults",Gp());K(this,"options",this.setOptions);K(this,"parse",this.parseMarkdown(!0));K(this,"parseInline",this.parseMarkdown(!1));K(this,"Parser",ti);K(this,"Renderer",rc);K(this,"TextRenderer",ig);K(this,"Lexer",ei);K(this,"Tokenizer",nc);K(this,"Hooks",wo);this.use(...t)}walkTokens(t,e){var n,r;let i=[];for(let s of t)switch(i=i.concat(e.call(this,s)),s.type){case"table":{let o=s;for(let l of o.header)i=i.concat(this.walkTokens(l.tokens,e));for(let l of o.rows)for(let a of l)i=i.concat(this.walkTokens(a.tokens,e));break}case"list":{let o=s;i=i.concat(this.walkTokens(o.items,e));break}default:{let o=s;(r=(n=this.defaults.extensions)==null?void 0:n.childTokens)!=null&&r[o.type]?this.defaults.extensions.childTokens[o.type].forEach(l=>{let a=o[l].flat(1/0);i=i.concat(this.walkTokens(a,e))}):o.tokens&&(i=i.concat(this.walkTokens(o.tokens,e)))}}return i}use(...t){let e=this.defaults.extensions||{renderers:{},childTokens:{}};return t.forEach(i=>{let n={...i};if(n.async=this.defaults.async||n.async||!1,i.extensions&&(i.extensLine truncated
|
||||
Please report this to https://github.com/markedjs/marked.`,t){let n="<p>An error occurred:</p><pre>"+bi(i.message+"",!0)+"</pre>";return e?Promise.resolve(n):n}if(e)return Promise.reject(i);throw i}}},Gn=new SL;function pe(t,e){return Gn.parse(t,e)}pe.options=pe.setOptions=function(t){return Gn.setOptions(t),pe.defaults=Gn.defaults,Fx(pe.defaults),pe};pe.getDefaults=Gp;pe.defaults=Un;pe.use=function(...t){return Gn.use(...t),pe.defaults=Gn.defaults,Fx(pe.defaults),pe};pe.walkTokens=function(t,e){return Gn.walkTokens(t,e)};pe.parseInline=Gn.parseInline;pe.Parser=ti;pe.parser=ti.parse;pe.Renderer=rc;pe.TextRenderer=ig;pe.Lexer=ei;pe.lexer=ei.lex;pe.Tokenizer=nc;pe.Hooks=wo;pe.parse=pe;var gZ=pe.options,OZ=pe.setOptions,mZ=pe.use,bZ=pe.walkTokens,yZ=pe.parseInline;var SZ=ti.parse,xZ=ei.lex;var Pk=Wk(Qk(),1);var Mi=Pk.default;function fg(t){let e="true false yes no null",i="[\\w#;/?:@&=+$,.~*'()[\\]]+",n={className:"attr",variants:[{begin:/[\w*@][\w*@ :()\./-]*:(?=[ \t]|$)/},{begin:/"[\w*@][\w*@ :()\./-]*":(?=[ \t]|$)/},{begin:/'[\w*@][\w*@ :()\./-]*':(?=[ \t]|$)/}]},r={className:"template-variable",variants:[{begin:/\{\{/,end:/\}\}/},{begin:/%\{/,end:/\}/}]},s={className:"string",relevance:0,begin:/'/,end:/'/,contains:[{match:/''/,scope:"char.escape",relevance:0}]},o={className:"string",relevance:0,variants:[{begin:/"/,end:/"/},{begin:/\S+/}],contains:[t.BACKSLASH_ESCAPE,r]},l=t.inherit(o,{variants:[{begin:/'/,end:/'/,contains:[{begin:/''/,relevance:0}]},{begin:/"/,end:/"/},{begin:/[^\s,{}[\]]+/}]}),u={className:"number",begin:"\\b"+"[0-9]{4}(-[0-9][0-9]){0,2}"+"([Tt \\t][0-9][0-9]?(:[0-9][0-9]){2})?"+"(\\.[0-9]*)?"+"([ \\t])*(Z|[-+][0-9][0-9]?(:[0-9][0-9])?)?"+"\\b"},d={end:",",endsWithParent:!0,excludeEnd:!0,keywords:e,relevance:0},p={begin:/\{/,end:/\}/,contains:[d],illegal:"\\n",relevance:0},g={begin:"\\[",end:"\\]",contains:[d],illegal:"\\n",relevance:0},m=[n,{className:"meta",begin:"^---\\s*$",relevance:10},{className:"string",begin:"[\\|>]([1-9]?[+-])?[ ]*\\n( +)[^ ][^\\n]*\\n(\\2[^\\n]+\\n?)*"},{begin:"<%[%=-]?",end:"[%-]?%>",subLanguage:"ruby",excludeBegin:!0,excludeEnd:!0,relevance:0},{className:"type",begin:"!\\w+!"+i},{className:"type",begin:"!<"+i+">"},{className:"type",begin:"!"+i},{className:"type",begin:"!!"+i},{className:"meta",begin:"&"+t.UNDERSCORE_IDENT_RE+"$"},{className:"meta",begin:"\\*"+t.UNDERSCORE_IDENT_RE+"$"},{className:"bullet",begin:"-(?=[ ]|$)",relevance:0},t.HASH_COMMENT_MODE,{beginKeywords:e,keywords:{literal:e}},u,{className:"number",begin:t.C_NUMBER_RE+"\\b",relevance:0},p,g,s,o],b=[...m];return b.pop(),b.push(l),d.contains=b,{name:"YAML",case_insensitive:!0,aliases:["yml"],contains:m}}function fc(t){let e=t.regex,i={},n={begin:/\$\{/,end:/\}/,contains:["self",{begin:/:-/,contains:[i]}]};Object.assign(i,{className:"variable",variants:[{begin:e.concat(/\$[\w\d#@][\w\d_]*/,"(?![\\w\\d])(?![$])")},n]});let r={className:"subst",begin:/\$\(/,end:/\)/,contains:[t.BACKSLASH_ESCAPE]},s=t.inherit(t.COMMENT(),{match:[/(^|\s)/,/#.*$/],scope:{2:"comment"}}),o={begin:/<<-?\s*(?=\w+)/,starts:{contains:[t.END_SAME_AS_BEGIN({begin:/(\w+)/,end:/(\w+)/,className:"string"})]}},l={className:"string",begin:/"/,end:/"/,contains:[t.BACKSLASH_ESCAPE,i,r]};r.contains.push(l);let a={match:/\\"/},h={className:"string",begin:/'/,end:/'/},c={match:/\\'/},f={begin:/\$?\(\(/,end:/\)\)/,contains:[{begin:/\d+#[0-9a-f]+/,className:"number"},t.NUMBER_MODE,i]},u=["fish","bash","zsh","sh","csh","ksh","tcsh","dash","scsh"],d=t.SHEBANG({binary:`(${u.join("|")})`,relevance:10}),p={className:"function",begin:/\w[\w\d_]*\s*\(\s*\)\s*\{/,returnBegin:!0,contains:[t.inherit(t.TITLE_MODE,{begin:/\w[\w\d_]*/})],relevance:0},g=["if","then","else","elif","fi","time","for","while","until","in","do","done","case","esac","coproc","function","select"],m=["true","false"],b={match:/(\/[a-z._-]+)+/},y=["break","cd","continue","eval","exec","exit","export","getopts","hash","pwd","readonly","return","shift","test","times","trap","umask","unset"],S=["alias","bind","builtin","caller","command","declare","echo","enable","help","let","local","logout","mapfile","printf","read","readarray","source","sudo","type","typeset","ulimit","unalias"],v=["autoload","bg","bindkey","bye","cap","chdir","clone","comparguments","compcall","compctl","compdescribe","compfiles","compgroups","compquote","comptags","comptry","compvalues","dirs","disable","disown","echotc","echoti","emulate","fc","fg","float","functions","getcap","getln","history","integer","jobs","kill","limit","log","noglob","popd","print","pushd","pushln","rehash","sched","setcap","setopt","stat","suspend","ttyctl","unfunction","unhash","unlimit","unsetopt","vared","wait","whence","where","which","zcompile","zformat","zftp","zle","zmodload","zparseopts","zprof","zpty","zregexparse","zsocket","zstyle","ztcp"],x=["chcon","chgrp","chown","chmod","cp","dd","df","dir","dircolors","ln","ls","mkdir","mkfifo","mknod","mktemp","mv","realpath","rm","rmdir","shred","sync","touch","truncate","vdir","
Line truncated
|
||||
`}strong({tokens:t}){return`<strong>${this.parser.parseInline(t)}</strong>`}em({tokens:t}){return`<em>${this.parser.parseInline(t)}</em>`}codespan({text:t}){return`<code>${bi(t,!0)}</code>`}br(t){return"<br>"}del({tokens:t}){return`<del>${this.parser.parseInline(t)}</del>`}link({href:t,title:e,tokens:i}){let n=this.parser.parseInline(i),r=qx(t);if(r===null)return n;t=r;let s='<a href="'+t+'"';return e&&(s+=' title="'+bi(e)+'"'),s+=">"+n+"</a>",s}image({href:t,title:e,text:i,tokens:n}){n&&(i=this.parser.parseInline(n,this.parser.textRenderer));let r=qx(t);if(r===null)return bi(i);t=r;let s=`<img src="${t}" alt="${bi(i)}"`;return e&&(s+=` title="${bi(e)}"`),s+=">",s}text(t){return"tokens"in t&&t.tokens?this.parser.parseInline(t.tokens):"escaped"in t&&t.escaped?t.text:bi(t.text)}},tg=class{strong({text:t}){return t}em({text:t}){return t}codespan({text:t}){return t}del({text:t}){return t}html({text:t}){return t}text({text:t}){return t}link({text:t}){return""+t}image({text:t}){return""+t}br(){return""}checkbox({raw:t}){return t}},ti=class Wp{constructor(e){K(this,"options");K(this,"renderer");K(this,"textRenderer");this.options=e||Un,this.options.renderer=this.options.renderer||new nc,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new tg}static parse(e,i){return new Wp(i).parse(e)}static parseInline(e,i){return new Wp(i).parseInline(e)}parse(e){var n,r;this.renderer.parser=this;let i="";for(let s=0;s<e.length;s++){let o=e[s];if((r=(n=this.options.extensions)==null?void 0:n.renderers)!=null&&r[o.type]){let a=o,h=this.options.extensions.renderers[a.type].call({parser:this},a);if(h!==!1||!["space","hr","heading","code","table","blockquote","list","html","def","paragraph","text"].includes(a.type)){i+=h||"";continue}}let l=o;switch(l.type){case"space":{i+=this.renderer.space(l);break}case"hr":{i+=this.renderer.hr(l);break}case"heading":{i+=this.renderer.heading(l);break}case"code":{i+=this.renderer.code(l);break}case"table":{i+=this.renderer.table(l);break}case"blockquote":{i+=this.renderer.blockquote(l);break}case"list":{i+=this.renderer.list(l);break}case"checkbox":{i+=this.renderer.checkbox(l);break}case"html":{i+=this.renderer.html(l);break}case"def":{i+=this.renderer.def(l);break}case"paragraph":{i+=this.renderer.paragraph(l);break}case"text":{i+=this.renderer.text(l);break}default:{let a='Token with "'+l.type+'" type was not found.';if(this.options.silent)return console.error(a),"";throw new Error(a)}}}return i}parseInline(e,i=this.renderer){var r,s;this.renderer.parser=this;let n="";for(let o=0;o<e.length;o++){let l=e[o];if((s=(r=this.options.extensions)==null?void 0:r.renderers)!=null&&s[l.type]){let h=this.options.extensions.renderers[l.type].call({parser:this},l);if(h!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(l.type)){n+=h||"";continue}}let a=l;switch(a.type){case"escape":{n+=i.text(a);break}case"html":{n+=i.html(a);break}case"link":{n+=i.link(a);break}case"image":{n+=i.image(a);break}case"checkbox":{n+=i.checkbox(a);break}case"strong":{n+=i.strong(a);break}case"em":{n+=i.em(a);break}case"codespan":{n+=i.codespan(a);break}case"br":{n+=i.br(a);break}case"del":{n+=i.del(a);break}case"text":{n+=i.text(a);break}default:{let h='Token with "'+a.type+'" type was not found.';if(this.options.silent)return console.error(h),"";throw new Error(h)}}}return n}},ec,wo=(ec=class{constructor(t){K(this,"options");K(this,"block");this.options=t||Un}preprocess(t){return t}postprocess(t){return t}processAllTokens(t){return t}emStrongMask(t){return t}provideLexer(t=this.block){return t?ei.lex:ei.lexInline}provideParser(t=this.block){return t?ti.parse:ti.parseInline}},K(ec,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens","emStrongMask"])),K(ec,"passThroughHooksRespectAsync",new Set(["preprocess","postprocess","processAllTokens"])),ec),wL=class{constructor(...t){K(this,"defaults",Vp());K(this,"options",this.setOptions);K(this,"parse",this.parseMarkdown(!0));K(this,"parseInline",this.parseMarkdown(!1));K(this,"Parser",ti);K(this,"Renderer",nc);K(this,"TextRenderer",tg);K(this,"Lexer",ei);K(this,"Tokenizer",ic);K(this,"Hooks",wo);this.use(...t)}walkTokens(t,e){var n,r;let i=[];for(let s of t)switch(i=i.concat(e.call(this,s)),s.type){case"table":{let o=s;for(let l of o.header)i=i.concat(this.walkTokens(l.tokens,e));for(let l of o.rows)for(let a of l)i=i.concat(this.walkTokens(a.tokens,e));break}case"list":{let o=s;i=i.concat(this.walkTokens(o.items,e));break}default:{let o=s;(r=(n=this.defaults.extensions)==null?void 0:n.childTokens)!=null&&r[o.type]?this.defaults.extensions.childTokens[o.type].forEach(l=>{let a=o[l].flat(1/0);i=i.concat(this.walkTokens(a,e))}):o.tokens&&(i=i.concat(this.walkTokens(o.tokens,e)))}}return i}use(...t){let e=this.defaults.extensions||{renderers:{},childTokens:{}};return t.forEach(i=>{let n={...i};if(n.async=this.defaults.async||n.async||!1,i.extensions&&(i.extensLine truncated
|
||||
Please report this to https://github.com/markedjs/marked.`,t){let n="<p>An error occurred:</p><pre>"+bi(i.message+"",!0)+"</pre>";return e?Promise.resolve(n):n}if(e)return Promise.reject(i);throw i}}},Gn=new wL;function pe(t,e){return Gn.parse(t,e)}pe.options=pe.setOptions=function(t){return Gn.setOptions(t),pe.defaults=Gn.defaults,Ux(pe.defaults),pe};pe.getDefaults=Vp;pe.defaults=Un;pe.use=function(...t){return Gn.use(...t),pe.defaults=Gn.defaults,Ux(pe.defaults),pe};pe.walkTokens=function(t,e){return Gn.walkTokens(t,e)};pe.parseInline=Gn.parseInline;pe.Parser=ti;pe.parser=ti.parse;pe.Renderer=nc;pe.TextRenderer=tg;pe.Lexer=ei;pe.lexer=ei.lex;pe.Tokenizer=ic;pe.Hooks=wo;pe.parse=pe;var yZ=pe.options,SZ=pe.setOptions,xZ=pe.use,kZ=pe.walkTokens,wZ=pe.parseInline;var vZ=ti.parse,QZ=ei.lex;var Qk=Uk(vk(),1);var Mi=Qk.default;function hg(t){let e="true false yes no null",i="[\\w#;/?:@&=+$,.~*'()[\\]]+",n={className:"attr",variants:[{begin:/[\w*@][\w*@ :()\./-]*:(?=[ \t]|$)/},{begin:/"[\w*@][\w*@ :()\./-]*":(?=[ \t]|$)/},{begin:/'[\w*@][\w*@ :()\./-]*':(?=[ \t]|$)/}]},r={className:"template-variable",variants:[{begin:/\{\{/,end:/\}\}/},{begin:/%\{/,end:/\}/}]},s={className:"string",relevance:0,begin:/'/,end:/'/,contains:[{match:/''/,scope:"char.escape",relevance:0}]},o={className:"string",relevance:0,variants:[{begin:/"/,end:/"/},{begin:/\S+/}],contains:[t.BACKSLASH_ESCAPE,r]},l=t.inherit(o,{variants:[{begin:/'/,end:/'/,contains:[{begin:/''/,relevance:0}]},{begin:/"/,end:/"/},{begin:/[^\s,{}[\]]+/}]}),u={className:"number",begin:"\\b"+"[0-9]{4}(-[0-9][0-9]){0,2}"+"([Tt \\t][0-9][0-9]?(:[0-9][0-9]){2})?"+"(\\.[0-9]*)?"+"([ \\t])*(Z|[-+][0-9][0-9]?(:[0-9][0-9])?)?"+"\\b"},d={end:",",endsWithParent:!0,excludeEnd:!0,keywords:e,relevance:0},p={begin:/\{/,end:/\}/,contains:[d],illegal:"\\n",relevance:0},g={begin:"\\[",end:"\\]",contains:[d],illegal:"\\n",relevance:0},m=[n,{className:"meta",begin:"^---\\s*$",relevance:10},{className:"string",begin:"[\\|>]([1-9]?[+-])?[ ]*\\n( +)[^ ][^\\n]*\\n(\\2[^\\n]+\\n?)*"},{begin:"<%[%=-]?",end:"[%-]?%>",subLanguage:"ruby",excludeBegin:!0,excludeEnd:!0,relevance:0},{className:"type",begin:"!\\w+!"+i},{className:"type",begin:"!<"+i+">"},{className:"type",begin:"!"+i},{className:"type",begin:"!!"+i},{className:"meta",begin:"&"+t.UNDERSCORE_IDENT_RE+"$"},{className:"meta",begin:"\\*"+t.UNDERSCORE_IDENT_RE+"$"},{className:"bullet",begin:"-(?=[ ]|$)",relevance:0},t.HASH_COMMENT_MODE,{beginKeywords:e,keywords:{literal:e}},u,{className:"number",begin:t.C_NUMBER_RE+"\\b",relevance:0},p,g,s,o],b=[...m];return b.pop(),b.push(l),d.contains=b,{name:"YAML",case_insensitive:!0,aliases:["yml"],contains:m}}function hc(t){let e=t.regex,i={},n={begin:/\$\{/,end:/\}/,contains:["self",{begin:/:-/,contains:[i]}]};Object.assign(i,{className:"variable",variants:[{begin:e.concat(/\$[\w\d#@][\w\d_]*/,"(?![\\w\\d])(?![$])")},n]});let r={className:"subst",begin:/\$\(/,end:/\)/,contains:[t.BACKSLASH_ESCAPE]},s=t.inherit(t.COMMENT(),{match:[/(^|\s)/,/#.*$/],scope:{2:"comment"}}),o={begin:/<<-?\s*(?=\w+)/,starts:{contains:[t.END_SAME_AS_BEGIN({begin:/(\w+)/,end:/(\w+)/,className:"string"})]}},l={className:"string",begin:/"/,end:/"/,contains:[t.BACKSLASH_ESCAPE,i,r]};r.contains.push(l);let a={match:/\\"/},h={className:"string",begin:/'/,end:/'/},c={match:/\\'/},f={begin:/\$?\(\(/,end:/\)\)/,contains:[{begin:/\d+#[0-9a-f]+/,className:"number"},t.NUMBER_MODE,i]},u=["fish","bash","zsh","sh","csh","ksh","tcsh","dash","scsh"],d=t.SHEBANG({binary:`(${u.join("|")})`,relevance:10}),p={className:"function",begin:/\w[\w\d_]*\s*\(\s*\)\s*\{/,returnBegin:!0,contains:[t.inherit(t.TITLE_MODE,{begin:/\w[\w\d_]*/})],relevance:0},g=["if","then","else","elif","fi","time","for","while","until","in","do","done","case","esac","coproc","function","select"],m=["true","false"],b={match:/(\/[a-z._-]+)+/},y=["break","cd","continue","eval","exec","exit","export","getopts","hash","pwd","readonly","return","shift","test","times","trap","umask","unset"],S=["alias","bind","builtin","caller","command","declare","echo","enable","help","let","local","logout","mapfile","printf","read","readarray","source","sudo","type","typeset","ulimit","unalias"],v=["autoload","bg","bindkey","bye","cap","chdir","clone","comparguments","compcall","compctl","compdescribe","compfiles","compgroups","compquote","comptags","comptry","compvalues","dirs","disable","disown","echotc","echoti","emulate","fc","fg","float","functions","getcap","getln","history","integer","jobs","kill","limit","log","noglob","popd","print","pushd","pushln","rehash","sched","setcap","setopt","stat","suspend","ttyctl","unfunction","unhash","unlimit","unsetopt","vared","wait","whence","where","which","zcompile","zformat","zftp","zle","zmodload","zparseopts","zprof","zpty","zregexparse","zsocket","zstyle","ztcp"],x=["chcon","chgrp","chown","chmod","cp","dd","df","dir","dircolors","ln","ls","mkdir","mkfifo","mknod","mktemp","mv","realpath","rm","rmdir","shred","sync","touch","truncate","vdir","
Line truncated
|
||||
display: block;
|
||||
overflow-x: auto;
|
||||
padding: 1em
|
||||
@@ -227,7 +227,7 @@ code.hljs {
|
||||
.hljs-tag {
|
||||
/* purposely ignored */
|
||||
|
||||
}`;var dg=`pre code.hljs {
|
||||
}`;var ug=`pre code.hljs {
|
||||
display: block;
|
||||
overflow-x: auto;
|
||||
padding: 1em
|
||||
@@ -343,7 +343,7 @@ code.hljs {
|
||||
.hljs-tag {
|
||||
/* purposely ignored */
|
||||
|
||||
}`;var Ae={timestamp:$e.define(),bracket:$e.define(),category:$e.define(),logString:$e.define(),logLink:$e.define(),levelInfo:$e.define(),levelWarning:$e.define(),levelError:$e.define(),levelDebug:$e.define(),levelTip:$e.define(),levelFatal:$e.define(),levelWatchdog:$e.define()};Mi.registerLanguage("yaml",fg);Mi.registerLanguage("yml",fg);Mi.registerLanguage("bash",fc);Mi.registerLanguage("sh",fc);Mi.registerLanguage("shell",fc);Mi.registerLanguage("json",$k);var uX=[{label:"port",type:"keyword",detail:"HTTP proxy port",info:"Invalid when mixed port is enabled"},{label:"socks-port",type:"keyword",detail:"SOCKS5 proxy port"},{label:"mixed-port",type:"keyword",detail:"HTTP/SOCKS mixed port",info:"Overrides port and socks-port when set"},{label:"redir-port",type:"keyword",detail:"Transparent proxy port"},{label:"tproxy-port",type:"keyword",detail:"TPROXY transparent proxy port"},{label:"mode",type:"keyword",detail:"Run mode: rule / global / direct"},{label:"log-level",type:"keyword",detail:"Log level: debug / info / warning / error / silent"},{label:"ipv6",type:"keyword",detail:"IPv6 traffic handling: true / false"},{label:"allow-lan",type:"keyword",detail:"Allow LAN connections: true / false"},{label:"bind-address",type:"keyword",detail:"Bind address, default *"},{label:"authentication",type:"keyword",detail:"HTTP/SOCKS authentication, array format"},{label:"external-controller",type:"keyword",detail:"RESTful API listen address"},{label:"external-ui",type:"keyword",detail:"Dashboard path"},{label:"secret",type:"keyword",detail:"API secret"},{label:"interface-name",type:"keyword",detail:"Outbound interface name"},{label:"routing-mark",type:"keyword",detail:"Routing mark"},{label:"hosts",type:"keyword",detail:"Custom hosts mapping"},{label:"profile",type:"keyword",detail:"Profiling configuration"},{label:"global-ua",type:"keyword",detail:"Global User-Agent"},{label:"unified-delay",type:"keyword",detail:"Unified delay: true / false"},{label:"tcp-concurrent",type:"keyword",detail:"TCP concurrent connections"},{label:"find-process-mode",type:"keyword",detail:"Find process mode: off / strict / always"},{label:"sniffing",type:"keyword",detail:"Domain sniffing: true / false"},{label:"keep-alive-interval",type:"keyword",detail:"TCP keep-alive interval (seconds)"},{label:"geodata-mode",type:"keyword",detail:"GEO data mode: true / false"},{label:"geodata-loader",type:"keyword",detail:"GEO loader: memconservative / standard"},{label:"geox-url",type:"keyword",detail:"GEOX custom URL template"},{label:"geosite",type:"keyword",detail:"GeoSite configuration"},{label:"geo-auto-update",type:"keyword",detail:"GEO auto update: true / false"},{label:"geo-update-interval",type:"keyword",detail:"GEO update interval (hours)"},{label:"tun",type:"keyword",detail:"TUN mode configuration"},{label:"enable",type:"property",detail:"Enable: true / false"},{label:"stack",type:"property",detail:"Protocol stack: system / gvisor / mixed"},{label:"device",type:"property",detail:"TUN device name"},{label:"dns-hijack",type:"property",detail:"DNS hijack address list"},{label:"auto-route",type:"property",detail:"Auto set route: true / false"},{label:"auto-detect-interface",type:"property",detail:"Auto detect interface: true / false"},{label:"mtu",type:"property",detail:"MTU value"},{label:"inet4-address",type:"property",detail:"IPv4 address range"},{label:"inet6-address",type:"property",detail:"IPv6 address range"},{label:"strict-route",type:"property",detail:"Strict route: true / false"},{label:"endpoint-independent-nat",type:"property",detail:"Endpoint-independent NAT: true / false"},{label:"udp-timeout",type:"property",detail:"UDP timeout"},{label:"dns",type:"keyword",detail:"DNS configuration"},{label:"nameserver",type:"property",detail:"DNS upstream servers"},{label:"fallback",type:"property",detail:"Fallback DNS servers"},{label:"fallback-filter",type:"property",detail:"Fallback filter configuration"},{label:"default-nameserver",type:"property",detail:"Default DNS servers"},{label:"nameserver-policy",type:"property",detail:"DNS by domain name"},{label:"proxy-server-nameserver",type:"property",detail:"Proxy DNS servers"},{label:"use-hosts",type:"property",detail:"Use hosts: true / false"},{label:"enhanced-mode",type:"property",detail:"DNS mode: normal / redir-host / fake-ip"},{label:"fake-ip-range",type:"property",detail:"Fake-IP address range"},{label:"fake-ip-filter",type:"property",detail:"Fake-IP filter domains"},{label:"type",type:"type",detail:"ss / ssr / vmess / trojan / snell / http / socks5 / hysteria / vless / tuic / wireguard"},{label:"server",type:"property",detail:"Server address"},{label:"name",type:"property",detail:"Proxy name"},{label:"password",type:"property",detail:"Password"},{label:"cipher",type:"property",detail:"Encryption method"},{label:"udp",type:"property",detail:"UDP relay: true / false"},{label:"xudp",type:"property",detail:"XUDP mode"},{label:"tfo",type:"property",detail:"TCP Fast Open: true / false"},{label:"mpt
Line truncated
|
||||
}`;var Ae={timestamp:$e.define(),bracket:$e.define(),category:$e.define(),logString:$e.define(),logLink:$e.define(),levelInfo:$e.define(),levelWarning:$e.define(),levelError:$e.define(),levelDebug:$e.define(),levelTip:$e.define(),levelFatal:$e.define(),levelWatchdog:$e.define()},$k=!1;function Ck(){$k||($k=!0,Mi.registerLanguage("yaml",hg),Mi.registerLanguage("yml",hg),Mi.registerLanguage("bash",hc),Mi.registerLanguage("sh",hc),Mi.registerLanguage("shell",hc),Mi.registerLanguage("json",Pk))}var gX=[{label:"port",type:"keyword",detail:"HTTP proxy port",info:"Invalid when mixed port is enabled"},{label:"socks-port",type:"keyword",detail:"SOCKS5 proxy port"},{label:"mixed-port",type:"keyword",detail:"HTTP/SOCKS mixed port",info:"Overrides port and socks-port when set"},{label:"redir-port",type:"keyword",detail:"Transparent proxy port"},{label:"tproxy-port",type:"keyword",detail:"TPROXY transparent proxy port"},{label:"mode",type:"keyword",detail:"Run mode: rule / global / direct"},{label:"log-level",type:"keyword",detail:"Log level: debug / info / warning / error / silent"},{label:"ipv6",type:"keyword",detail:"IPv6 traffic handling: true / false"},{label:"allow-lan",type:"keyword",detail:"Allow LAN connections: true / false"},{label:"bind-address",type:"keyword",detail:"Bind address, default *"},{label:"authentication",type:"keyword",detail:"HTTP/SOCKS authentication, array format"},{label:"external-controller",type:"keyword",detail:"RESTful API listen address"},{label:"external-ui",type:"keyword",detail:"Dashboard path"},{label:"secret",type:"keyword",detail:"API secret"},{label:"interface-name",type:"keyword",detail:"Outbound interface name"},{label:"routing-mark",type:"keyword",detail:"Routing mark"},{label:"hosts",type:"keyword",detail:"Custom hosts mapping"},{label:"profile",type:"keyword",detail:"Profiling configuration"},{label:"global-ua",type:"keyword",detail:"Global User-Agent"},{label:"unified-delay",type:"keyword",detail:"Unified delay: true / false"},{label:"tcp-concurrent",type:"keyword",detail:"TCP concurrent connections"},{label:"find-process-mode",type:"keyword",detail:"Find process mode: off / strict / always"},{label:"sniffing",type:"keyword",detail:"Domain sniffing: true / false"},{label:"keep-alive-interval",type:"keyword",detail:"TCP keep-alive interval (seconds)"},{label:"geodata-mode",type:"keyword",detail:"GEO data mode: true / false"},{label:"geodata-loader",type:"keyword",detail:"GEO loader: memconservative / standard"},{label:"geox-url",type:"keyword",detail:"GEOX custom URL template"},{label:"geosite",type:"keyword",detail:"GeoSite configuration"},{label:"geo-auto-update",type:"keyword",detail:"GEO auto update: true / false"},{label:"geo-update-interval",type:"keyword",detail:"GEO update interval (hours)"},{label:"tun",type:"keyword",detail:"TUN mode configuration"},{label:"enable",type:"property",detail:"Enable: true / false"},{label:"stack",type:"property",detail:"Protocol stack: system / gvisor / mixed"},{label:"device",type:"property",detail:"TUN device name"},{label:"dns-hijack",type:"property",detail:"DNS hijack address list"},{label:"auto-route",type:"property",detail:"Auto set route: true / false"},{label:"auto-detect-interface",type:"property",detail:"Auto detect interface: true / false"},{label:"mtu",type:"property",detail:"MTU value"},{label:"inet4-address",type:"property",detail:"IPv4 address range"},{label:"inet6-address",type:"property",detail:"IPv6 address range"},{label:"strict-route",type:"property",detail:"Strict route: true / false"},{label:"endpoint-independent-nat",type:"property",detail:"Endpoint-independent NAT: true / false"},{label:"udp-timeout",type:"property",detail:"UDP timeout"},{label:"dns",type:"keyword",detail:"DNS configuration"},{label:"nameserver",type:"property",detail:"DNS upstream servers"},{label:"fallback",type:"property",detail:"Fallback DNS servers"},{label:"fallback-filter",type:"property",detail:"Fallback filter configuration"},{label:"default-nameserver",type:"property",detail:"Default DNS servers"},{label:"nameserver-policy",type:"property",detail:"DNS by domain name"},{label:"proxy-server-nameserver",type:"property",detail:"Proxy DNS servers"},{label:"use-hosts",type:"property",detail:"Use hosts: true / false"},{label:"enhanced-mode",type:"property",detail:"DNS mode: normal / redir-host / fake-ip"},{label:"fake-ip-range",type:"property",detail:"Fake-IP address range"},{label:"fake-ip-filter",type:"property",detail:"Fake-IP filter domains"},{label:"type",type:"type",detail:"ss / ssr / vmess / trojan / snell / http / socks5 / hysteria / vless / tuic / wireguard"},{label:"server",type:"property",detail:"Server address"},{label:"name",type:"property",detail:"Proxy name"},{label:"password",type:"property",detail:"Password"},{label:"cipher",type:"property",detail:"Encryption method"},{label:"udp",type:"property",detail:"UDP relay: true / false"},{label:"xudp",type:"property",detail:"XUDP mode"},{label:"tfo",type:"property",detail:"TCP Fast
Line truncated
|
||||
mode: #{2}
|
||||
log-level: #{3}
|
||||
allow-lan: #{4}
|
||||
@@ -872,4 +872,4 @@ external-controller: 0.0.0.0:9093
|
||||
# mux: true
|
||||
# username: ""
|
||||
# password: ""
|
||||
#{}`,{label:"gost-relay-template",type:"snippet",detail:"GOST Relay node"})];function pX(t){let e=t.matchBefore(/[\w-]+/);if(!e||e.from===e.to&&!t.explicit)return null;let i=uX.filter(s=>s.label.toLowerCase().startsWith(e.text.toLowerCase())),n=dX.filter(s=>(s.label||s.name||"").toLowerCase().startsWith(e.text.toLowerCase())),r=[...i,...n];return r.length?{from:e.from,options:r,validFor:/^[\w-]*$/}:null}function gX(t=750){return Md(e=>{let i=[];try{qS(e.state.doc.toString(),{schema:Gd})}catch(n){let r=n.mark;if(r&&r.line!==void 0){let s=r.line+1;if(s<=e.state.doc.lines){let o=e.state.doc.line(s),l=Math.min(o.from+(r.column||0),o.to);i.push({from:l,to:Math.min(l+1,o.to),severity:"error",message:n.reason||n.message})}}else i.push({from:0,to:0,severity:"error",message:n.reason||n.message})}return i},typeof t=="number"?{delay:t}:void 0)}var uc=null,gg=null;function OX(){if(!window.levelTranslations){uc={},gg=/(?!)/;return}var t={},e=[];for(var i in window.levelTranslations)if(window.levelTranslations.hasOwnProperty(i)){var n=window.levelTranslations[i];t[n]=i,e.push(n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"))}uc=t,gg=new RegExp("^\\[("+e.join("|")+")\\]")}var mX=_s.define({tokenTable:{timestamp:Ae.timestamp,bracket:Ae.bracket,category:Ae.category,logString:Ae.logString,logLink:Ae.logLink,levelInfo:Ae.levelInfo,levelWarning:Ae.levelWarning,levelError:Ae.levelError,levelDebug:Ae.levelDebug,levelTip:Ae.levelTip,levelFatal:Ae.levelFatal,levelWatchdog:Ae.levelWatchdog},startState(){return{tabDone:!1}},token(t,e){if(t.sol()&&(e.tabDone=!1,t.match(/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/)))return"timestamp";if(t.eatSpace())return null;var i=t.peek();if(!i)return t.skipToEnd(),null;if(i==="\u3010"&&t.match(/\u3010[^\u3011]*\u3011/))return"bracket";if(e.tabDone)return t.next(),"logString";if(i==="["){uc===null&&OX();var n=t.match(gg);if(n){var r=uc[n[1]];if(r){var s="level"+r.charAt(0).toUpperCase()+r.slice(1);if(Ae[s])return s}return"category"}if(t.match(/\[[A-Z][^\]]*\]/))return"category"}return i!=="["&&(e.tabDone=!0),t.next(),"logString"}}),bX=Vt.define([{tag:Ae.timestamp,class:"cmt-log-timestamp"},{tag:Ae.bracket,class:"cmt-log-bracket"},{tag:Ae.category,class:"cmt-log-category"},{tag:Ae.logString,class:"cmt-log-string"},{tag:Ae.logLink,class:"cmt-log-link"},{tag:Ae.levelInfo,class:"cmt-log-level-info"},{tag:Ae.levelWarning,class:"cmt-log-level-warning"},{tag:Ae.levelError,class:"cmt-log-level-error"},{tag:Ae.levelDebug,class:"cmt-log-level-debug"},{tag:Ae.levelTip,class:"cmt-log-level-tip"},{tag:Ae.levelFatal,class:"cmt-log-level-fatal"},{tag:Ae.levelWatchdog,class:"cmt-log-level-watchdog"}]);function Tk(t=1e3){return me.fromClass(class{constructor(e){this._preload(e)}update(e){if(e.viewportChanged||e.docChanged){this._rafId&&cancelAnimationFrame(this._rafId);var i=this;this._rafId=requestAnimationFrame(function(){i._rafId=null,i._preload(e.view)})}}_preload(e){var i=e.state.doc,n=i.lineAt(e.viewport.to).number,r=Math.min(n+t,i.lines);a0(e.state,i.line(r).to,50)}})}function yX(t=[]){return[Gh(),zh(),Uh(),jh(),Bh(),Nh(),Yh(),qh(),Rf(),Af({placeholderDOM:null}),Pf(),zf(),op(),T.lineWrapping,Tu(),Tk(),wi.of([...Wf,...Yf,...hp,...Cu,...Tf,{key:"Tab",run:function(e){return Qu(e)||jl(e)}}]),...t]}var SX=T.baseTheme({".cm-line":{position:"relative"},".cm-oc-im::before":{content:'""',position:"absolute",top:0,left:"6px",right:0,height:"var(--oc-lh, 100%)",background:"var(--oc-im)",pointerEvents:"none",zIndex:"-1"},"&light":{"--oc-im-c":"#e1e4e8","--oc-im-ca":"#d0d7de"},"&dark":{"--oc-im-c":"#30363d","--oc-im-ca":"#484f58"}});function pg(t,e){let i=0;for(let n=0;n<t.length;n++)if(t[n]===" ")i++;else if(t[n]===" ")i+=e;else break;return i}function xX({highlightActiveBlock:t=!0,hideFirstIndent:e=!1,thickness:i=1,colors:n,deferMode:r="raf",buffer:s=1e3}={}){var o=n?T.baseTheme({"&light":{"--oc-im-c":n.light||"#e1e4e8","--oc-im-ca":n.activeLight||"#d0d7de"},"&dark":{"--oc-im-c":n.dark||"#30363d","--oc-im-ca":n.activeDark||"#484f58"}}):[];return[SX,o,me.fromClass(class{constructor(l){this._view=l,this._stepPx=null,this._measurePending=!1,this.decorations=this._build(l),this._scheduleMeasure(l)}update(l){this._view=l.view;var a=l.docChanged||l.viewportChanged||t&&l.selectionSet;if(a){if(r==="raf"&&l.viewportChanged&&!l.docChanged){this._rafId&&cancelAnimationFrame(this._rafId);var h=this;this._rafId=requestAnimationFrame(function(){h._rafId=null,h._stepPx=null,h._measurePending=!1,h.decorations=h._build(l.view),h._scheduleMeasure(l.view)});return}this._rafId&&(cancelAnimationFrame(this._rafId),this._rafId=null),this._stepPx=null,this._measurePending=!1,this.decorations=this._build(l.view),this._scheduleMeasure(l.view)}else this._measurePending&&(this._measurePending=!1,this.decorations=this._build(l.view))}_scheduleMeasure(l){this._measureId!==void 0&&l.cancelMeasure(this._measureId),this._measureId=l.requestMeasure(this._mkSpec())}_mkSpec(){var l=this;return{read:function(a){for(var h=a.state,c=Wt(h),f=h.tabSize,u=h.doc,d=u.lineAt(a
Line truncated
|
||||
#{}`,{label:"gost-relay-template",type:"snippet",detail:"GOST Relay node"})];function mX(t){let e=t.matchBefore(/[\w-]+/);if(!e||e.from===e.to&&!t.explicit)return null;let i=gX.filter(s=>s.label.toLowerCase().startsWith(e.text.toLowerCase())),n=OX.filter(s=>(s.label||s.name||"").toLowerCase().startsWith(e.text.toLowerCase())),r=[...i,...n];return r.length?{from:e.from,options:r,validFor:/^[\w-]*$/}:null}function bX(t=750){return Ed(e=>{let i=[];try{YS(e.state.doc.toString(),{schema:Vd})}catch(n){let r=n.mark;if(r&&r.line!==void 0){let s=r.line+1;if(s<=e.state.doc.lines){let o=e.state.doc.line(s),l=Math.min(o.from+(r.column||0),o.to);i.push({from:l,to:Math.min(l+1,o.to),severity:"error",message:n.reason||n.message})}}else i.push({from:0,to:0,severity:"error",message:n.reason||n.message})}return i},typeof t=="number"?{delay:t}:void 0)}var fc=null,pg=null;function yX(){if(!window.levelTranslations){fc={},pg=/(?!)/;return}var t={},e=[];for(var i in window.levelTranslations)if(window.levelTranslations.hasOwnProperty(i)){var n=window.levelTranslations[i];t[n]=i,e.push(n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"))}fc=t,pg=new RegExp("^\\[("+e.join("|")+")\\]")}var SX=_s.define({tokenTable:{timestamp:Ae.timestamp,bracket:Ae.bracket,category:Ae.category,logString:Ae.logString,logLink:Ae.logLink,levelInfo:Ae.levelInfo,levelWarning:Ae.levelWarning,levelError:Ae.levelError,levelDebug:Ae.levelDebug,levelTip:Ae.levelTip,levelFatal:Ae.levelFatal,levelWatchdog:Ae.levelWatchdog},startState(){return{tabDone:!1}},token(t,e){if(t.sol()&&(e.tabDone=!1,t.match(/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/)))return"timestamp";if(t.eatSpace())return null;var i=t.peek();if(!i)return t.skipToEnd(),null;if(i==="\u3010"&&t.match(/\u3010[^\u3011]*\u3011/))return"bracket";if(e.tabDone)return t.next(),"logString";if(i==="["){fc===null&&yX();var n=t.match(pg);if(n){var r=fc[n[1]];if(r){var s="level"+r.charAt(0).toUpperCase()+r.slice(1);if(Ae[s])return s}return"category"}if(t.match(/\[[A-Z][^\]]*\]/))return"category"}return i!=="["&&(e.tabDone=!0),t.next(),"logString"}}),xX=Vt.define([{tag:Ae.timestamp,class:"cmt-log-timestamp"},{tag:Ae.bracket,class:"cmt-log-bracket"},{tag:Ae.category,class:"cmt-log-category"},{tag:Ae.logString,class:"cmt-log-string"},{tag:Ae.logLink,class:"cmt-log-link"},{tag:Ae.levelInfo,class:"cmt-log-level-info"},{tag:Ae.levelWarning,class:"cmt-log-level-warning"},{tag:Ae.levelError,class:"cmt-log-level-error"},{tag:Ae.levelDebug,class:"cmt-log-level-debug"},{tag:Ae.levelTip,class:"cmt-log-level-tip"},{tag:Ae.levelFatal,class:"cmt-log-level-fatal"},{tag:Ae.levelWatchdog,class:"cmt-log-level-watchdog"}]);function Ak(t=1e3){return me.fromClass(class{constructor(e){this._preload(e)}update(e){if(e.viewportChanged||e.docChanged){this._rafId&&cancelAnimationFrame(this._rafId);var i=this;this._rafId=requestAnimationFrame(function(){i._rafId=null,i._preload(e.view)})}}_preload(e){var i=e.state.doc,n=i.lineAt(e.viewport.to).number,r=Math.min(n+t,i.lines);l0(e.state,i.line(r).to,50)}})}function kX(t=[]){return[Vh(),jh(),Gh(),Nh(),Ih(),Bh(),zh(),Yh(),Af(),Cf({placeholderDOM:null}),Qf(),jf(),sp(),T.lineWrapping,$u(),Ak(),wi.of([...qf,...zf,...cp,...Tu,...$f,{key:"Tab",run:function(e){return vu(e)||Nl(e)}}]),...t]}var wX=T.baseTheme({".cm-line":{position:"relative"},".cm-oc-im::before":{content:'""',position:"absolute",top:0,left:"6px",right:0,height:"var(--oc-lh, 100%)",background:"var(--oc-im)",pointerEvents:"none",zIndex:"-1"},"&light":{"--oc-im-c":"#e1e4e8","--oc-im-ca":"#d0d7de"},"&dark":{"--oc-im-c":"#30363d","--oc-im-ca":"#484f58"}});function dg(t,e){let i=0;for(let n=0;n<t.length;n++)if(t[n]===" ")i++;else if(t[n]===" ")i+=e;else break;return i}function vX({highlightActiveBlock:t=!0,hideFirstIndent:e=!1,thickness:i=1,colors:n,deferMode:r="raf",buffer:s=1e3}={}){var o=n?T.baseTheme({"&light":{"--oc-im-c":n.light||"#e1e4e8","--oc-im-ca":n.activeLight||"#d0d7de"},"&dark":{"--oc-im-c":n.dark||"#30363d","--oc-im-ca":n.activeDark||"#484f58"}}):[];return[wX,o,me.fromClass(class{constructor(l){this._view=l,this._stepPx=null,this._measurePending=!1,this.decorations=this._build(l),this._scheduleMeasure(l)}update(l){this._view=l.view;var a=l.docChanged||l.viewportChanged||t&&l.selectionSet;if(a){if(r==="raf"&&l.viewportChanged&&!l.docChanged){this._rafId&&cancelAnimationFrame(this._rafId);var h=this;this._rafId=requestAnimationFrame(function(){h._rafId=null,h._stepPx=null,h._measurePending=!1,h.decorations=h._build(l.view),h._scheduleMeasure(l.view)});return}this._rafId&&(cancelAnimationFrame(this._rafId),this._rafId=null),this._stepPx=null,this._measurePending=!1,this.decorations=this._build(l.view),this._scheduleMeasure(l.view)}else this._measurePending&&(this._measurePending=!1,this.decorations=this._build(l.view))}_scheduleMeasure(l){this._measureId!==void 0&&l.cancelMeasure(this._measureId),this._measureId=l.requestMeasure(this._mkSpec())}_mkSpec(){var l=this;return{read:function(a){for(var h=a.state,c=Wt(h),f=h.tabSize,u=h.doc,d=u.lineAt(a
Line truncated
|
||||
@@ -1,11 +1,38 @@
|
||||
// OpenClash shared utilities
|
||||
_ocGuard: { if (window._ocCommonLoaded) break _ocGuard; window._ocCommonLoaded = true; }
|
||||
|
||||
// ═══ Remove LuCI's global @media (prefers-reduced-motion: reduce) ═══
|
||||
(function() {
|
||||
var sheets = document.styleSheets;
|
||||
for (var i = sheets.length - 1; i >= 0; i--) {
|
||||
try {
|
||||
var rules = sheets[i].cssRules || sheets[i].rules;
|
||||
if (!rules) continue;
|
||||
for (var j = rules.length - 1; j >= 0; j--) {
|
||||
var rule = rules[j];
|
||||
if (rule.type === CSSRule.MEDIA_RULE &&
|
||||
/prefers-reduced-motion.*reduce/.test(rule.conditionText)) {
|
||||
sheets[i].deleteRule(j);
|
||||
}
|
||||
}
|
||||
} catch(e) {}
|
||||
}
|
||||
})();
|
||||
|
||||
// ═══ Internal helpers ═══
|
||||
|
||||
// Parse a CSS color string and return relative luminance (0-255).
|
||||
// Returns 128 for unparseable colors (sentinel: neither dark nor light).
|
||||
function _luminanceFromColor(color) {
|
||||
function luminanceFromColor(color) {
|
||||
var r, g, b;
|
||||
|
||||
if (color.indexOf('lab(') === 0) {
|
||||
var labM = color.match(/[\d.]+%?/g);
|
||||
if (labM && labM.length >= 1) {
|
||||
var L = parseFloat(labM[0]);
|
||||
return L * 2.55;
|
||||
}
|
||||
return 128;
|
||||
}
|
||||
|
||||
if (color[0] === '#') {
|
||||
if (color.length === 4) {
|
||||
r = parseInt(color[1] + color[1], 16);
|
||||
@@ -24,15 +51,14 @@ function _luminanceFromColor(color) {
|
||||
return 0.2126 * r + 0.7152 * g + 0.0722 * b;
|
||||
}
|
||||
|
||||
// Multi-signal dark-mode detection for initial load (runs in <head>,
|
||||
// before <body> exists). Covers Bootstrap 5.3, Argon, Material, and
|
||||
// generic LuCI themes. Defaults to light when no signal detected —
|
||||
// after DOM ready isDarkBackground(document.body) corrects if needed.
|
||||
function _detectInitialAutoDark() {
|
||||
function detectInitialAutoDark() {
|
||||
var html = document.documentElement,
|
||||
v, cls, lum;
|
||||
// 1. HTML data-* attributes (Bootstrap 5.3, Material, OpenClash, and generic)
|
||||
v = html.getAttribute('data-bs-theme') || html.getAttribute('data-theme') || html.getAttribute('data-darkmode');
|
||||
var bs = html.getAttribute('data-bs-theme'),
|
||||
th = html.getAttribute('data-theme'),
|
||||
dm = html.getAttribute('data-darkmode');
|
||||
v = bs || th || dm;
|
||||
if (v === 'dark' || v === 'dim' || v === 'true') return true;
|
||||
if (v === 'light' || v === 'false') return false;
|
||||
// 2. HTML class name (Argon dark-mode, generic theme-dark, etc.)
|
||||
@@ -52,42 +78,30 @@ function _detectInitialAutoDark() {
|
||||
checkBg = style.getPropertyValue('--bs-body-bg').trim()
|
||||
|| style.getPropertyValue('--body-bg').trim()
|
||||
|| style.getPropertyValue('--theme-bg').trim();
|
||||
if (checkBg && checkBg !== 'transparent' && checkBg !== 'rgba(0, 0, 0, 0)') return _luminanceFromColor(checkBg) < 128;
|
||||
if (checkBg && checkBg !== 'transparent' && checkBg !== 'rgba(0, 0, 0, 0)')
|
||||
return luminanceFromColor(checkBg) < 128;
|
||||
|
||||
// 5. System preference (ultimate fallback)
|
||||
if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) return true;
|
||||
|
||||
return false;
|
||||
return window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches;
|
||||
}
|
||||
|
||||
// Detect whether the given element sits on a dark background.
|
||||
// Explicit oc-theme → immediate. Auto → computed background-color
|
||||
// (fallback to <html> if element background is transparent).
|
||||
function isDarkBackground(element) {
|
||||
var cachedTheme = localStorage.getItem('oc-theme');
|
||||
if (cachedTheme === 'dark') {
|
||||
return true;
|
||||
} else if (cachedTheme === 'light') {
|
||||
return false;
|
||||
}
|
||||
if (cachedTheme === 'dark') return true;
|
||||
if (cachedTheme === 'light') return false;
|
||||
|
||||
var style = window.getComputedStyle(element);
|
||||
var bgColor = style.backgroundColor;
|
||||
if (!bgColor || bgColor === 'transparent' || bgColor === 'rgba(0, 0, 0, 0)') {
|
||||
bgColor = window.getComputedStyle(document.documentElement).backgroundColor;
|
||||
}
|
||||
var lum = _luminanceFromColor(bgColor);
|
||||
if (lum > 100 && lum < 156 && window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) {
|
||||
return true;
|
||||
}
|
||||
var lum = luminanceFromColor(bgColor);
|
||||
if (lum > 100 && lum < 156 && window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) return true;
|
||||
return lum < 128;
|
||||
}
|
||||
|
||||
// ═══ Theme system ═══
|
||||
|
||||
// Sets html[data-darkmode] and <meta name="color-scheme">.
|
||||
// Explicit dark/light → immediate. Auto → background detection
|
||||
// (isDarkBackground after DOM ready; _detectInitialAutoDark initially).
|
||||
function ocApplyRootTheme() {
|
||||
var t = localStorage.getItem('oc-theme') || 'auto',
|
||||
d;
|
||||
@@ -96,11 +110,7 @@ function ocApplyRootTheme() {
|
||||
} else if (t === 'light') {
|
||||
d = false;
|
||||
} else {
|
||||
if (document.body && document.readyState !== 'loading') {
|
||||
d = isDarkBackground(document.body);
|
||||
} else {
|
||||
d = _detectInitialAutoDark();
|
||||
}
|
||||
d = document.body ? isDarkBackground(document.body) : detectInitialAutoDark();
|
||||
}
|
||||
document.documentElement.setAttribute('data-darkmode', d ? 'true' : 'false');
|
||||
var m = document.querySelector('meta[name="color-scheme"]');
|
||||
@@ -112,8 +122,6 @@ function ocApplyRootTheme() {
|
||||
m.content = d ? 'dark' : 'light';
|
||||
}
|
||||
|
||||
// Idempotent theme initializer. First call registers DOMContentLoaded
|
||||
// listener (if page still loading); subsequent calls just re-apply.
|
||||
function ocInitTheme() {
|
||||
if (window._ocThemeInited) {
|
||||
ocUpdateTheme();
|
||||
@@ -121,25 +129,34 @@ function ocInitTheme() {
|
||||
}
|
||||
window._ocThemeInited = true;
|
||||
|
||||
if (document.readyState === 'loading') {
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
ocUpdateTheme();
|
||||
ocHideEmptyCbiElements();
|
||||
ocCenterCbiActions();
|
||||
});
|
||||
} else {
|
||||
ocUpdateTheme();
|
||||
ocApplyRootTheme();
|
||||
|
||||
var needsCorrection = (localStorage.getItem('oc-theme') || 'auto') === 'auto';
|
||||
|
||||
function _ocDomReady() {
|
||||
if (needsCorrection) ocApplyRootTheme();
|
||||
ocApplyEditorTheme();
|
||||
ocHideEmptyCbiElements();
|
||||
ocCenterCbiActions();
|
||||
}
|
||||
|
||||
if (document.readyState === 'loading') {
|
||||
document.addEventListener('DOMContentLoaded', _ocDomReady);
|
||||
} else {
|
||||
_ocDomReady();
|
||||
}
|
||||
}
|
||||
|
||||
// Respond to OS-level theme changes when oc-theme is 'auto'.
|
||||
if (window.matchMedia) {
|
||||
function ocUpdateTheme() {
|
||||
ocApplyRootTheme();
|
||||
ocApplyEditorTheme();
|
||||
}
|
||||
|
||||
if (window.matchMedia && !window._ocCommonLoaded) {
|
||||
window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', function() {
|
||||
if ((localStorage.getItem('oc-theme') || 'auto') === 'auto') {
|
||||
ocApplyRootTheme();
|
||||
if (document.readyState !== 'loading') ocUpdateTheme();
|
||||
if (document.body) ocUpdateTheme();
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -154,6 +171,49 @@ function winOpen(url) {
|
||||
return false;
|
||||
}
|
||||
|
||||
function ocGetLogColor(log) {
|
||||
for (var levelKey in window.levelTranslations) {
|
||||
var translatedText = '[' + window.levelTranslations[levelKey] + ']';
|
||||
if (log.indexOf(translatedText) >= 0) return "var(--" + levelKey + "-color)";
|
||||
}
|
||||
return "var(--info-color)";
|
||||
}
|
||||
|
||||
function imgerrorfuns(imgobj, imgSrc) {
|
||||
setTimeout(function() {
|
||||
imgobj.src = imgSrc;
|
||||
imgobj.loading = "lazy";
|
||||
}, 1000 * 10);
|
||||
}
|
||||
|
||||
function ocAnimateScroll(element) {
|
||||
if (!element) return;
|
||||
if (element._ocScrollAnimId) cancelAnimationFrame(element._ocScrollAnimId);
|
||||
var start = element.scrollTop;
|
||||
var duration = 500;
|
||||
var startTime = null;
|
||||
function step(timestamp) {
|
||||
if (!startTime) startTime = timestamp;
|
||||
var elapsed = timestamp - startTime;
|
||||
var progress = Math.min(elapsed / duration, 1);
|
||||
var eased = 1 - (1 - progress) * (1 - progress);
|
||||
var lastChild = element.lastElementChild || element.lastChild;
|
||||
var lastLineH = (lastChild && lastChild.offsetHeight) ? lastChild.offsetHeight : 0;
|
||||
var maxScroll = Math.max(0, element.scrollHeight - element.clientHeight);
|
||||
var target = Math.max(0, element.scrollHeight - (element.clientHeight + lastLineH) / 2);
|
||||
if (target > maxScroll) target = maxScroll;
|
||||
var distance = target - start;
|
||||
element.scrollTop = Math.round(start + distance * eased);
|
||||
if (progress < 1) {
|
||||
element._ocScrollAnimId = requestAnimationFrame(step);
|
||||
} else {
|
||||
element._ocScrollAnimId = null;
|
||||
element.style.willChange = '';
|
||||
}
|
||||
}
|
||||
element._ocScrollAnimId = requestAnimationFrame(step);
|
||||
}
|
||||
|
||||
function ocFormatUnixTime(unixTimestamp) {
|
||||
if (!unixTimestamp || unixTimestamp === 0) {
|
||||
return '--';
|
||||
@@ -383,10 +443,9 @@ window._cmWhenReady = function(cb) { cb(); };
|
||||
|
||||
// ═══ Theme — CM6 & CBI helpers ═══
|
||||
|
||||
// Apply theme to CodeMirror editors + highlight.js.
|
||||
function ocUpdateTheme() {
|
||||
ocApplyRootTheme();
|
||||
var isDark = isDarkBackground(document.body);
|
||||
// Apply CM6 editor themes + highlight.js theme based on current data-darkmode.
|
||||
function ocApplyEditorTheme() {
|
||||
var isDark = document.documentElement.getAttribute('data-darkmode') === 'true';
|
||||
if (typeof CM6 !== 'undefined' && CM6.dispatchTheme) {
|
||||
var editors = document.querySelectorAll('.cm-editor');
|
||||
for (var j = 0; j < editors.length; j++) {
|
||||
@@ -482,7 +541,7 @@ function ocRegisterEditorHotkeys() {
|
||||
}
|
||||
}
|
||||
}
|
||||
ocUpdateTheme();
|
||||
ocApplyEditorTheme();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -509,7 +568,7 @@ function ocRegisterEditorHotkeys() {
|
||||
_ocExitFullscreen();
|
||||
window._ocFullscreenActive = false;
|
||||
if (window.ConfigEditor) window.ConfigEditor.isFullscreen = false;
|
||||
ocUpdateTheme();
|
||||
ocApplyEditorTheme();
|
||||
}
|
||||
}, true);
|
||||
|
||||
@@ -604,6 +663,35 @@ function ocFallbackCopy(text, btnElement, successMessage, failMessage) {
|
||||
}
|
||||
}
|
||||
|
||||
function ocSetBtnLoading(btn, loading) {
|
||||
var svg = btn.querySelector('svg');
|
||||
if (loading) {
|
||||
if (svg && !btn.dataset.ocSvgHtml) {
|
||||
btn.dataset.ocSvgHtml = svg.outerHTML;
|
||||
var spinner = document.createElement('span');
|
||||
spinner.className = 'loading-spinner oc-btn-spinner';
|
||||
spinner.style.verticalAlign = 'middle';
|
||||
var svgW = parseInt(svg.getAttribute('width'), 10);
|
||||
var size = (!isNaN(svgW) && svgW > 0) ? svgW : 14;
|
||||
spinner.style.width = size + 'px';
|
||||
spinner.style.height = size + 'px';
|
||||
btn.replaceChild(spinner, svg);
|
||||
}
|
||||
btn.disabled = true;
|
||||
} else {
|
||||
btn.disabled = false;
|
||||
if (btn.dataset.ocSvgHtml) {
|
||||
var holder = document.createElement('span');
|
||||
holder.innerHTML = btn.dataset.ocSvgHtml;
|
||||
var newSvg = holder.firstChild;
|
||||
var cur = btn.querySelector('.loading-spinner');
|
||||
if (cur && newSvg) {
|
||||
btn.replaceChild(newSvg, cur);
|
||||
}
|
||||
delete btn.dataset.ocSvgHtml;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
ocApplyRootTheme();
|
||||
ocInitTheme();
|
||||
@@ -1,6 +1,9 @@
|
||||
// oc-icons.js — OpenClash unified SVG icon library
|
||||
// Include in HTM files: <script src="/luci-static/resources/openclash/js/oc-icons.js?v=<%=plugin_version%>"></script>
|
||||
(function() {
|
||||
if (window._ocIconsLoaded) return;
|
||||
window._ocIconsLoaded = true;
|
||||
|
||||
var SPRITE_ID = 'oc-icon-sprite';
|
||||
if (document.getElementById(SPRITE_ID)) return;
|
||||
|
||||
@@ -13,6 +16,8 @@
|
||||
svg.innerHTML = [
|
||||
'<symbol id="oc-icon-refresh" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M23 4v6h-6"/><path d="M20.49 15a9 9 0 1 1-2.12-9.36L23 10"/></symbol>',
|
||||
'<symbol id="oc-icon-close" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><line x1="18" y1="6" x2="6" y2="18"/><line x1="6" y1="6" x2="18" y2="18"/></symbol>',
|
||||
'<symbol id="oc-icon-player-pause" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M3 4h6v16h-6z"/><path d="M15 4h6v16h-6z"/></symbol>',
|
||||
'<symbol id="oc-icon-player-play" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M7 4v16l13 -8l-13 -8"/></symbol>',
|
||||
'<symbol id="oc-icon-copy" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><rect x="9" y="9" width="13" height="13" rx="2"/><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/></symbol>',
|
||||
'<symbol id="oc-icon-megaphone" viewBox="0 0 256 256" fill="currentColor"><path d="M228.54,86.66l-176.06-54A16,16,0,0,0,32,48V192a16,16,0,0,0,16,16,16,16,0,0,0,4.52-.65L136,181.73V192a16,16,0,0,0,16,16h32a16,16,0,0,0,16-16v-29.9l28.54-8.75A16.09,16.09,0,0,0,240,138V102A16.09,16.09,0,0,0,228.54,86.66ZM136,165,48,192V48l88,27Zm48,27H152V176.82L184,167Zm40-54-.11,0L152,160.08V79.92l71.89,22,.11,0v36Z"/></symbol>',
|
||||
'<symbol id="oc-icon-shield-check" viewBox="0 0 48 48" fill="none" stroke="currentColor" stroke-width="4" stroke-linejoin="round"><path d="M6 9.25564L24.0086 4L42 9.25564V20.0337C42 31.3622 34.7502 41.4194 24.0026 45.0005C13.2521 41.4195 6 31.36 6 20.0287V9.25564Z"/><path d="M15 23L22 30L34 18" stroke-linecap="round" stroke-linejoin="round"/></symbol>',
|
||||
@@ -20,14 +25,20 @@
|
||||
'<symbol id="oc-icon-home" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M9.75,20.25V14.25h4.5v6h6V11.25a0.75,0.75,0,0,0-0.22-0.53l-7.5-7.5a0.75,0.75,0,0,0-1.06,0l-7.5,7.5A0.75,0.75,0,0,0,3.75,11.25v9Z"/></symbol>',
|
||||
'<symbol id="oc-icon-globe" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="3" y1="12" x2="21" y2="12"/><circle cx="12" cy="12" r="9"/><path d="M15.75,12c0,6-3.75,9-3.75,9s-3.75-3-3.75-9,3.75-9,3.75-9S15.75,6,15.75,12Z"/></symbol>',
|
||||
'<symbol id="oc-icon-edit" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"/><path d="M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"/></symbol>',
|
||||
'<symbol id="oc-icon-upload" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><line x1="12" y1="5" x2="12" y2="19"/><line x1="5" y1="12" x2="19" y2="12"/></symbol>',
|
||||
'<symbol id="oc-icon-add" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><line x1="12" y1="5" x2="12" y2="19"/><line x1="5" y1="12" x2="19" y2="12"/></symbol>',
|
||||
'<symbol id="oc-icon-upload" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-2"/><path d="M7 9l5 -5l5 5"/><path d="M12 4l0 12"/></symbol>',
|
||||
'<symbol id="oc-icon-download" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/><polyline points="7,11 12,16 17,11"/><line x1="12" y1="2" x2="12" y2="16"/></symbol>',
|
||||
'<symbol id="oc-icon-save" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M19 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11l5 5v11a2 2 0 0 1-2 2z"/><polyline points="17,21 17,13 7,13 7,21"/><polyline points="7,3 7,8 15,8"/></symbol>',
|
||||
'<symbol id="oc-icon-switch" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><polyline points="17 1 21 5 17 9"/><path d="M3 11V9a4 4 0 0 1 4-4h14"/><polyline points="7 23 3 19 7 15"/><path d="M21 13v2a4 4 0 0 1-4 4H3"/></symbol>',
|
||||
'<symbol id="oc-icon-update" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M21 12a9 9 0 0 0-9-9 9.75 9.75 0 0 0-6.74 2.74L3 8"/><path d="M3 3v5h5"/><path d="M3 12a9 9 0 0 0 9 9 9.75 9.75 0 0 0 6.74-2.74L21 16"/><path d="M21 21v-5h-5"/></symbol>',
|
||||
'<symbol id="oc-icon-compare" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><rect x="2" y="3" width="8" height="18" rx="2"/><rect x="14" y="3" width="8" height="18" rx="2"/></symbol>',
|
||||
'<symbol id="oc-icon-restore" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><rect x="3" y="3" width="18" height="18" rx="2"/></symbol>',
|
||||
'<symbol id="oc-icon-help" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><circle cx="12" cy="12" r="10"/><path d="M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3"/><line x1="12" y1="17" x2="12.01" y2="17"/></symbol>',
|
||||
'<symbol id="oc-icon-list" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><rect x="4" y="4" width="16" height="16" rx="2"/><line x1="8" y1="8" x2="16" y2="8"/><line x1="8" y1="12" x2="16" y2="12"/><line x1="8" y1="16" x2="12" y2="16"/></symbol>',
|
||||
'<symbol id="oc-icon-zap" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><polygon points="13 2 3 14 12 14 11 22 21 10 13 10 13 2"/></symbol>',
|
||||
'<symbol id="oc-icon-gear" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><circle cx="12" cy="12" r="3"/><path d="M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 1 1-2.83 2.83l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-4 0v-.09a1.65 1.65 0 0 0-1-1.51 1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 1 1-2.83-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1 0-4h.09a1.65 1.65 0 0 0 1.51-1 1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 1 1 2.83-2.83l.06.06a1.65 1.65 0 0 0 1.82.33h.09a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 4 0v.09a1.65 1.65 0 0 0 1 1.51h.09a1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 1 1 2.83 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82v.09a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 0 4h-.09a1.65 1.65 0 0 0-1.51 1z"/></symbol>',
|
||||
'<symbol id="oc-icon-upload-feather" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/><polyline points="17,11 12,6 7,11"/><line x1="12" y1="18" x2="12" y2="6"/></symbol>',
|
||||
'<symbol id="oc-icon-clock-edit" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M21 12a9 9 0 1 0 -9.972 8.948c.32 .034 .644 .052 .972 .052"/><path d="M12 7v5l2 2"/><path d="M18.42 15.61a2.1 2.1 0 0 1 2.97 2.97l-3.39 3.42h-3v-3l3.42 -3.39"/></symbol>',
|
||||
'<symbol id="oc-icon-help" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M3 12a9 9 0 1 0 18 0a9 9 0 1 0 -18 0"/><path d="M12 17l0 .01"/><path d="M12 13.5a1.5 1.5 0 0 1 1 -1.5a2.6 2.6 0 1 0 -3 -4"/></symbol>',
|
||||
'<symbol id="oc-icon-chat" viewBox="0 0 48 48" fill="none" stroke="currentColor" stroke-width="4"><path d="M4 6H44V36H29L24 41L19 36H4V6Z"/><path d="M23 21H25.0025"/><path d="M33.001 21H34.9999"/><path d="M13.001 21H14.9999"/></symbol>',
|
||||
'<symbol id="oc-icon-overwrite" viewBox="0 0 256 256" fill="currentColor"><path d="M12,111l112,64a8,8,0,0,0,7.94,0l112-64a8,8,0,0,0,0-13.9l-112-64a8,8,0,0,0-7.94,0l-112,64A8,8,0,0,0,12,111ZM128,49.21,223.87,104,128,158.79,32.13,104ZM246.94,140A8,8,0,0,1,244,151L132,215a8,8,0,0,1-7.94,0L12,151A8,8,0,0,1,20,137.05l108,61.74,108-61.74A8,8,0,0,1,246.94,140Z"/></symbol>',
|
||||
'<symbol id="oc-icon-sun" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><circle cx="12" cy="12" r="5"/><line x1="12" y1="1" x2="12" y2="3"/><line x1="12" y1="21" x2="12" y2="23"/><line x1="4.22" y1="4.22" x2="5.64" y2="5.64"/><line x1="18.36" y1="18.36" x2="19.78" y2="19.78"/><line x1="1" y1="12" x2="3" y2="12"/><line x1="21" y1="12" x2="23" y2="12"/><line x1="4.22" y1="19.78" x2="5.64" y2="18.36"/><line x1="18.36" y1="5.64" x2="19.78" y2="4.22"/></symbol>',
|
||||
@@ -39,15 +50,16 @@
|
||||
'<symbol id="oc-icon-telegram" viewBox="0 0 256 256" fill="none" stroke="currentColor" stroke-width="20"><path d="M80,134.87,170.26,214a8,8,0,0,0,13.09-4.21L224,33.22a1,1,0,0,0-1.34-1.15L20,111.38A6.23,6.23,0,0,0,21,123.3Z" stroke-linecap="round" stroke-linejoin="round"/><line x1="80" y1="134.87" x2="223.41" y2="32.09" stroke-linecap="round" stroke-linejoin="round"/><path d="M124.37,173.78,93.76,205.54A8,8,0,0,1,80,200V134.87" stroke-linecap="round" stroke-linejoin="round"/></symbol>',
|
||||
'<symbol id="oc-icon-heart" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M20.84 4.61a5.5 5.5 0 0 0-7.78 0L12 5.67l-1.06-1.06a5.5 5.5 0 0 0-7.78 7.78l1.06 1.06L12 21.23l7.78-7.78 1.06-1.06a5.5 5.5 0 0 0 0-7.78z"/></symbol>',
|
||||
'<symbol id="oc-icon-settings" viewBox="0 0 48 48" fill="none" stroke="currentColor" stroke-width="4" stroke-linejoin="round"><path d="M18.2838 43.1713C14.9327 42.1736 11.9498 40.3213 9.58787 37.867C10.469 36.8227 11 35.4734 11 34.0001C11 30.6864 8.31371 28.0001 5 28.0001C4.79955 28.0001 4.60139 28.01 4.40599 28.0292C4.13979 26.7277 4 25.3803 4 24.0001C4 21.9095 4.32077 19.8938 4.91579 17.9995C4.94381 17.9999 4.97188 18.0001 5 18.0001C8.31371 18.0001 11 15.3138 11 12.0001C11 11.0488 10.7786 10.1493 10.3846 9.35011C12.6975 7.1995 15.5205 5.59002 18.6521 4.72314C19.6444 6.66819 21.6667 8.00013 24 8.00013C26.3333 8.00013 28.3556 6.66819 29.3479 4.72314C32.4795 5.59002 35.3025 7.1995 37.6154 9.35011C37.2214 10.1493 37 11.0488 37 12.0001C37 15.3138 39.6863 18.0001 43 18.0001C43.0281 18.0001 43.0562 17.9999 43.0842 17.9995C43.6792 19.8938 44 21.9095 44 24.0001C44 25.3803 43.8602 26.7277 43.594 28.0292C43.3986 28.01 43.2005 28.0001 43 28.0001C39.6863 28.0001 37 30.6864 37 34.0001C37 35.4734 37.531 36.8227 38.4121 37.867C36.0502 40.3213 33.0673 42.1736 29.7162 43.1713C28.9428 40.752 26.676 39.0001 24 39.0001C21.324 39.0001 19.0572 40.752 18.2838 43.1713Z"/><path d="M24 31C27.866 31 31 27.866 31 24C31 20.134 27.866 17 24 17C20.134 17 17 20.134 17 24C17 27.866 20.134 31 24 31Z"/></symbol>',
|
||||
'<symbol id="oc-icon-document" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><rect x="4" y="4" width="16" height="16" rx="2"/><line x1="8" y1="8" x2="16" y2="8"/><line x1="8" y1="12" x2="16" y2="12"/><line x1="8" y1="16" x2="12" y2="16"/></symbol>',
|
||||
'<symbol id="oc-icon-lightning" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><polygon points="13 2 3 14 12 14 11 22 21 10 13 10 13 2"/></symbol>',
|
||||
'<symbol id="oc-icon-alert-circle" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><line x1="12" y1="8" x2="12" y2="12"/><line x1="12" y1="16" x2="12" y2="16"/></symbol>',
|
||||
'<symbol id="oc-icon-bug" viewBox="2 4 20 19" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M9 9v-1a3 3 0 0 1 6 0v1"/><path d="M8 9h8a6 6 0 0 1 1 3v3a5 5 0 0 1 -10 0v-3a6 6 0 0 1 1 -3"/><path d="M3 13h4"/><path d="M17 13h4"/><path d="M12 20v-6"/><path d="M4 19l3.35 -2"/><path d="M20 19l-3.35 -2"/><path d="M4 7l3.75 2.4"/><path d="M20 7l-3.75 2.4"/></symbol>',
|
||||
'<symbol id="oc-icon-play-bugs" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M3.5 18a2.5 3 0 1 0 5 0a2.5 3 0 1 0 -5 0"/><path d="M2 17.5h1.5"/><path d="M8.5 17.5h1.5"/><path d="M9.5 14.5l-1.5 1.5"/><path d="M2.5 14.5l1.5 1.5"/><path d="M2.5 21.5l1.5 -1.5"/><path d="M8 20l1.5 1.5"/><path d="M15.5 16l6.5 -5l-11 -8"/><path d="M13 12.5l2 -1.5l-11 -8v8"/></symbol>',
|
||||
'<symbol id="oc-icon-link-tabler" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M9 15l6 -6"/><path d="M11 6l.463 -.536a5 5 0 0 1 7.071 7.072l-.534 .464"/><path d="M13 18l-.397 .534a5.068 5.068 0 0 1 -7.127 0a4.972 4.972 0 0 1 0 -7.071l.524 -.463"/></symbol>',
|
||||
'<symbol id="oc-icon-speedtest" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M5.636 19.364a9 9 0 1 1 12.728 0"/><path d="M16 9l-4 4"/></symbol>',
|
||||
'<symbol id="oc-icon-alert-circle" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M3 12a9 9 0 1 0 18 0a9 9 0 0 0 -18 0"/><path d="M12 8v4"/><path d="M12 16h.01"/></symbol>',
|
||||
'<symbol id="oc-icon-link" viewBox="0 0 48 48" fill="none" stroke="currentColor" stroke-width="4" stroke-linecap="round" stroke-linejoin="round"><path d="M26.2401 16.373L17.1001 7.23303C14.4388 4.57168 10.0653 4.6303 7.33158 7.36397C4.59791 10.0976 4.53929 14.4712 7.20064 17.1325L15.1359 25.0678"/><path d="M32.9027 23.0031L40.838 30.9384C43.4994 33.5998 43.4407 37.9733 40.7071 40.707C37.9734 43.4407 33.5999 43.4993 30.9385 40.8379L21.7985 31.6979"/><path d="M26.1093 26.1416C28.843 23.4079 28.9016 19.0344 26.2403 16.373"/><path d="M21.7989 21.7984C19.0652 24.5321 19.0066 28.9056 21.6679 31.5669"/></symbol>',
|
||||
'<symbol id="oc-icon-key" viewBox="0 0 16 16" fill="currentColor"><path d="M10.5 0a5.499 5.499 0 1 1-1.288 10.848l-.932.932a.749.749 0 0 1-.53.22H7v.75a.749.749 0 0 1-.22.53l-.5.5a.749.749 0 0 1-.53.22H5v.75a.749.749 0 0 1-.22.53l-.5.5a.749.749 0 0 1-.53.22h-2A1.75 1.75 0 0 1 0 14.25v-2c0-.199.079-.389.22-.53l4.932-4.932A5.5 5.5 0 0 1 10.5 0Zm-4 5.5c-.001.431.069.86.205 1.269a.75.75 0 0 1-.181.768L1.5 12.56v1.69c0 .138.112.25.25.25h1.69l.06-.06v-1.19a.75.75 0 0 1 .75-.75h1.19l.06-.06v-1.19a.75.75 0 0 1 .75-.75h1.19l1.023-1.025a.75.75 0 0 1 .768-.18A4 4 0 1 0 6.5 5.5ZM11 6a1 1 0 1 1 0-2 1 1 0 0 1 0 2Z"/></symbol>',
|
||||
'<symbol id="oc-icon-calculator" viewBox="0 0 48 48" fill="none" stroke="currentColor" stroke-width="4" stroke-linecap="round" stroke-linejoin="round"><path d="M28 32.5H42"/><path d="M28 41.5H42"/><path d="M6 13H22"/><path d="M14 5L14 21"/><path d="M42 5L6 41"/></symbol>',
|
||||
'<symbol id="oc-icon-chevron-down" viewBox="0 0 24 24" fill="currentColor"><polygon points="6,9 18,9 12,15"/></symbol>',
|
||||
'<symbol id="oc-icon-trash" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><polyline points="3 6 5 6 21 6"/><path d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h2a2 2 0 0 1 2 2v2"/></symbol>',
|
||||
'<symbol id="oc-icon-info" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><circle cx="12" cy="12" r="10"/><line x1="12" y1="16" x2="12" y2="12"/><line x1="12" y1="8" x2="12.01" y2="8"/></symbol>',
|
||||
'<symbol id="oc-icon-usage-help" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="7" width="18" height="13" rx="2"/><circle cx="9" cy="13" r="1"/><circle cx="15" cy="13" r="1"/><line x1="9" y1="17" x2="15" y2="17"/><path d="M12 3v4"/><circle cx="12" cy="3" r="1"/></symbol>',
|
||||
'<symbol id="oc-icon-eye" viewBox="0 0 256 256" fill="none" stroke="currentColor" stroke-width="12" stroke-linecap="round" stroke-linejoin="round"><path d="M128,56C48,56,16,128,16,128s32,72,112,72,112-72,112-72S208,56,128,56Z"/><circle cx="128" cy="128" r="40"/></symbol>',
|
||||
'<symbol id="oc-icon-eye-off" viewBox="0 0 256 256" fill="none" stroke="currentColor" stroke-width="12" stroke-linecap="round" stroke-linejoin="round"><line x1="48" y1="40" x2="208" y2="216"/><path d="M154.9,157.6A39.6,39.6,0,0,1,128,168a40,40,0,0,1-26.9-69.6"/><path d="M74,68.6C33.2,89.2,16,128,16,128s32,72,112,72a117.9,117.9,0,0,0,54-12.6"/><path d="M208.6,169.1C230.4,149.6,240,128,240,128S208,56,128,56a123.9,123.9,0,0,0-20.7,1.7"/><path d="M135.5,88.7a39.9,39.9,0,0,1,32.3,35.5"/></symbol>',
|
||||
@@ -59,9 +71,17 @@
|
||||
'<symbol id="oc-icon-gift" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><polyline points="20 12 20 22 4 22 4 12"/><rect x="2" y="7" width="20" height="5"/><line x1="12" y1="22" x2="12" y2="7"/><path d="M12 7H7.5a2.5 2.5 0 0 1 0-5C11 2 12 7 12 7z"/><path d="M12 7h4.5a2.5 2.5 0 0 0 0-5C13 2 12 7 12 7z"/></symbol>',
|
||||
'<symbol id="oc-icon-logout" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4"/><polyline points="16,17 21,12 16,7"/><line x1="21" y1="12" x2="9" y2="12"/></symbol>',
|
||||
'<symbol id="oc-icon-bell" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M18 8A6 6 0 0 0 6 8c0 7-3 9-3 9h18s-3-2-3-9"/><path d="M13.73 21a2 2 0 0 1-3.46 0"/></symbol>',
|
||||
'<symbol id="oc-icon-bell-phosphor" viewBox="0 0 256 256" fill="none" stroke="currentColor" stroke-width="2"><path d="M176,232a8,8,0,0,1-8,8H88a8,8,0,0,1,0-16h80A8,8,0,0,1,176,232Zm40-128a87.55,87.55,0,0,1-33.64,69.21A16.24,16.24,0,0,0,176,186v6a16,16,0,0,1-16,16H96a16,16,0,0,1-16-16v-6a16,16,0,0,0-6.23-12.66A87.59,87.59,0,0,1,40,104.49C39.74,56.83,78.26,17.14,125.88,16A88,88,0,0,1,216,104Zm-16,0a72,72,0,0,0-73.74-72c-39,.92-70.47,33.39-70.26,72.39a71.65,71.65,0,0,0,27.64,56.3A32,32,0,0,1,96,186v6h64v-6a32.15,32.15,0,0,1,12.47-25.35A71.65,71.65,0,0,0,200,104Zm-16.11-9.34a57.6,57.6,0,0,0-46.56-46.55,8,8,0,0,0-2.66,15.78c16.57,2.79,30.63,16.85,33.44,33.45A8,8,0,0,0,176,104a9,9,0,0,0,1.35-.11A8,8,0,0,0,183.89,94.66Z"/></symbol>',
|
||||
'<symbol id="oc-icon-key-oix" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M21 2l-2 2m-7.61 7.61a5.5 5.5 0 1 1-7.778 7.778 5.5 5.5 0 0 1 7.777-7.777zm0 0L15.5 7.5m0 0l3 3L22 7l-3-3m-3.5 3.5L19 4"/></symbol>',
|
||||
'<symbol id="oc-icon-chevron-oix" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5"><polyline points="6 9 12 15 18 9"/></symbol>',
|
||||
'<symbol id="oc-icon-badge" viewBox="0 0 48 48" fill="none" stroke="currentColor" stroke-width="4" stroke-linejoin="round"><path d="M9 40L4 17L14 22L24 8L34 22L44 17L39 40H9Z"/><path d="M24 33C26.2091 33 28 31.2091 28 29C28 26.7909 26.2091 25 24 25C21.7909 25 20 26.7909 20 29C20 31.2091 21.7909 33 24 33Z"/></symbol>'
|
||||
'<symbol id="oc-icon-badge" viewBox="0 0 48 48" fill="none" stroke="currentColor" stroke-width="4" stroke-linejoin="round"><path d="M9 40L4 17L14 22L24 8L34 22L44 17L39 40H9Z"/><path d="M24 33C26.2091 33 28 31.2091 28 29C28 26.7909 26.2091 25 24 25C21.7909 25 20 26.7909 20 29C20 31.2091 21.7909 33 24 33Z"/></symbol>',
|
||||
'<symbol id="oc-icon-brand-baidu" viewBox="0 0 24 24"><path fill="currentColor" d="M9.154 0C7.71 0 6.54 1.658 6.54 3.707c0 2.051 1.171 3.71 2.615 3.71 1.446 0 2.614-1.659 2.614-3.71C11.768 1.658 10.6 0 9.154 0zm7.025.594C14.86.58 13.347 2.589 13.2 3.927c-.187 1.745.25 3.487 2.179 3.735 1.933.25 3.175-1.806 3.422-3.364.252-1.555-.995-3.364-2.362-3.674a1.218 1.218 0 0 0-.261-.03zM3.582 5.535a2.811 2.811 0 0 0-.156.008c-2.118.19-2.428 3.24-2.428 3.24-.287 1.41.686 4.425 3.297 3.864 2.617-.561 2.262-3.68 2.183-4.362-.125-1.018-1.292-2.773-2.896-2.75zm16.534 1.753c-2.308 0-2.617 2.119-2.617 3.616 0 1.43.121 3.425 2.988 3.362 2.867-.063 2.553-3.238 2.553-3.988 0-.745-.62-2.99-2.924-2.99zm-8.264 2.478c-1.424.014-2.708.925-3.323 1.947-1.118 1.868-2.863 3.05-3.112 3.363-.25.309-3.61 2.116-2.864 5.42.746 3.301 3.365 3.237 3.365 3.237s1.93.19 4.171-.31c2.24-.495 4.17.123 4.17.123s5.233 1.748 6.665-1.616c1.43-3.364-.808-5.109-.808-5.109s-2.99-2.306-4.736-4.798c-1.072-1.665-2.348-2.268-3.528-2.257zm-2.234 3.84 1.542.024v8.197H7.758c-1.47-.291-2.055-1.292-2.13-1.462-.072-.173-.488-.976-.268-2.343.635-2.049 2.447-2.196 2.447-2.196h1.81zm3.964 2.39v3.881c.096.413.612.488.612.488h1.614v-4.343h1.689v5.782h-3.915c-1.517-.39-1.59-1.465-1.59-1.465v-4.317zm-5.458 1.147c-.66.197-.978.708-1.05.928-.076.22-.247.78-.1 1.269.294 1.095 1.248 1.144 1.248 1.144h1.37v-3.34z"/></symbol>',
|
||||
'<symbol id="oc-icon-brand-netease" viewBox="0 0 24 24"><path fill="currentColor" d="M13.046 9.388a3.919 3.919 0 0 0-.66.19c-.809.312-1.447.991-1.666 1.775a2.269 2.269 0 0 0-.074.81c.048.546.333 1.05.764 1.35a1.483 1.483 0 0 0 2.01-.286c.406-.531.355-1.183.24-1.636-.098-.387-.22-.816-.345-1.249a64.76 64.76 0 0 1-.269-.954zm-.82 10.07c-3.984 0-7.224-3.24-7.224-7.223 0-.98.226-3.02 1.884-4.822A7.188 7.188 0 0 1 9.502 5.6a.792.792 0 1 1 .587 1.472 5.619 5.619 0 0 0-2.795 2.462 5.538 5.538 0 0 0-.707 2.7 5.645 5.645 0 0 0 5.638 5.638c1.844 0 3.627-.953 4.542-2.428 1.042-1.68.772-3.931-.627-5.238a3.299 3.299 0 0 0-1.437-.777c.172.589.334 1.18.494 1.772.284 1.12.1 2.181-.519 2.989-.39.51-.956.888-1.592 1.064a3.038 3.038 0 0 1-2.58-.44 3.45 3.45 0 0 1-1.44-2.514c-.04-.467.002-.93.128-1.376.35-1.256 1.356-2.339 2.622-2.826a5.5 5.5 0 0 1 .823-.246l-.134-.505c-.37-1.371.25-2.579 1.547-3.007.329-.109.68-.145 1.025-.105.792.09 1.476.592 1.709 1.023.258.507-.096 1.153-.706 1.153a.788.788 0 0 1-.54-.213c-.088-.08-.163-.174-.259-.247a.825.825 0 0 0-.632-.166.807.807 0 0 0-.634.551c-.056.191-.031.406.02.595.07.256.159.597.217.82 1.11.098 2.162.54 2.97 1.296 1.974 1.844 2.35 4.886.892 7.233-1.197 1.93-3.509 3.177-5.889 3.177zM0 12c0 6.627 5.373 12 12 12s12-5.373 12-12S18.627 0 12 0 0 5.373 0 12Z"/></symbol>',
|
||||
'<symbol id="oc-icon-brand-github" viewBox="0 0 1024 1024"><path fill="currentColor" fill-rule="evenodd" d="M512 0C229.12 0 0 229.12 0 512c0 226.56 146.56 417.92 350.08 485.76 25.6 4.48 35.2-10.88 35.2-24.32 0-12.16-.64-52.48-.64-95.36-128.64 23.68-161.92-31.36-172.16-60.16-5.76-14.72-30.72-60.16-52.48-72.32-17.92-9.6-43.52-33.28-.64-33.92 40.32-.64 69.12 37.12 78.72 52.48 46.08 77.44 119.68 55.68 149.12 42.24 4.48-33.28 17.92-55.68 32.64-68.48-113.92-12.8-232.96-56.96-232.96-252.8 0-55.68 19.84-101.76 52.48-137.6-5.12-12.8-23.04-65.28 5.12-135.68 0 0 42.88-13.44 140.8 52.48 40.96-11.52 84.48-17.28 128-17.28s87.04 5.76 128 17.28c97.92-66.56 140.8-52.48 140.8-52.48 28.16 70.4 10.24 122.88 5.12 135.68 32.64 35.84 52.48 81.28 52.48 137.6 0 196.48-119.68 240-233.6 252.8 18.56 16 34.56 46.72 34.56 94.72 0 68.48-.64 123.52-.64 140.8 0 13.44 9.6 29.44 35.2 24.32C877.44 929.92 1024 737.92 1024 512 1024 229.12 794.88 0 512 0" clip-rule="evenodd"/></symbol>',
|
||||
'<symbol id="oc-icon-brand-youtube" viewBox="0 0 256 180"><path fill="red" d="M250.346 28.075A32.18 32.18 0 0 0 227.69 5.418C207.824 0 127.87 0 127.87 0S47.912.164 28.046 5.582A32.18 32.18 0 0 0 5.39 28.24c-6.009 35.298-8.34 89.084.165 122.97a32.18 32.18 0 0 0 22.656 22.657c19.866 5.418 99.822 5.418 99.822 5.418s79.955 0 99.82-5.418a32.18 32.18 0 0 0 22.657-22.657c6.338-35.348 8.291-89.1-.164-123.134Z"/><path fill="#FFF" d="m102.421 128.06 66.328-38.418-66.328-38.418z"/></symbol>',
|
||||
'<symbol id="oc-icon-package" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M16.5 9.4 7.55 4.24"/><path d="M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z"/><polyline points="3.29 7 12 12 20.71 7"/><line x1="12" y1="22" x2="12" y2="12"/></symbol>',
|
||||
'<symbol id="oc-icon-cpu" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="4" y="4" width="16" height="16" rx="2"/><rect x="9" y="9" width="6" height="6"/><line x1="9" y1="1" x2="9" y2="4"/><line x1="15" y1="1" x2="15" y2="4"/><line x1="9" y1="20" x2="9" y2="23"/><line x1="15" y1="20" x2="15" y2="23"/><line x1="20" y1="9" x2="23" y2="9"/><line x1="20" y1="14" x2="23" y2="14"/><line x1="1" y1="9" x2="4" y2="9"/><line x1="1" y1="14" x2="4" y2="14"/></symbol>',
|
||||
'<symbol id="oc-icon-history" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M12 8l0 4l2 2"/><path d="M3.05 11a9 9 0 1 1 .5 4m-.5 5v-5h5"/></symbol>'
|
||||
].join('');
|
||||
|
||||
document.body.insertBefore(svg, document.body.firstChild);
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// Guard: skip if already loaded (handles multi-template page loads)
|
||||
_ocGuard: { if (window._ocSubconverterLoaded) break _ocGuard; window._ocSubconverterLoaded = true; }
|
||||
(function(window, document) {
|
||||
'use strict';
|
||||
|
||||
|
||||
@@ -82,12 +82,17 @@ import jsonLang from "highlight.js/lib/languages/json"
|
||||
import githubLightCSS from "highlight.js/styles/github.css"
|
||||
import githubDarkCSS from "highlight.js/styles/github-dark-dimmed.css"
|
||||
|
||||
hljs.registerLanguage("yaml", yamlLang)
|
||||
hljs.registerLanguage("yml", yamlLang)
|
||||
hljs.registerLanguage("bash", bashLang)
|
||||
hljs.registerLanguage("sh", bashLang)
|
||||
hljs.registerLanguage("shell", bashLang)
|
||||
hljs.registerLanguage("json", jsonLang)
|
||||
var _ocHljsReady = false;
|
||||
function _ocEnsureHljs() {
|
||||
if (_ocHljsReady) return;
|
||||
_ocHljsReady = true;
|
||||
hljs.registerLanguage("yaml", yamlLang);
|
||||
hljs.registerLanguage("yml", yamlLang);
|
||||
hljs.registerLanguage("bash", bashLang);
|
||||
hljs.registerLanguage("sh", bashLang);
|
||||
hljs.registerLanguage("shell", bashLang);
|
||||
hljs.registerLanguage("json", jsonLang);
|
||||
}
|
||||
|
||||
// ============================================================
|
||||
// Mihomo / Clash YAML keyword completion
|
||||
@@ -930,8 +935,9 @@ function mirrorThemeScrollbar() {
|
||||
var thumbColor = 'rgba(' + r + ',' + g + ',' + b + ',0.60)';
|
||||
var thumbHover = 'rgba(' + r + ',' + g + ',' + b + ',0.70)';
|
||||
} else {
|
||||
var thumbColor = _isDarkMode() ? 'rgba(255,255,255,0.60)' : 'rgba(0,0,0,0.60)';
|
||||
var thumbHover = _isDarkMode() ? 'rgba(255,255,255,0.70)' : 'rgba(0,0,0,0.70)';
|
||||
var ocIsDark = _ocIsDark();
|
||||
var thumbColor = ocIsDark ? 'rgba(255,255,255,0.60)' : 'rgba(0,0,0,0.60)';
|
||||
var thumbHover = ocIsDark ? 'rgba(255,255,255,0.70)' : 'rgba(0,0,0,0.70)';
|
||||
}
|
||||
|
||||
if (!themeText) return;
|
||||
@@ -1032,14 +1038,11 @@ function toggleFullscreen(dom) {
|
||||
}
|
||||
|
||||
// ============================================================
|
||||
// Theme detection — reads localStorage then falls back to system preference
|
||||
// Theme helpers — read data-darkmode set by common.js
|
||||
// ============================================================
|
||||
|
||||
function _isDarkMode() {
|
||||
var theme = localStorage.getItem('oc-theme') || 'auto';
|
||||
if (theme === 'dark') return true;
|
||||
if (theme === 'light') return false;
|
||||
return window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches;
|
||||
function _ocIsDark() {
|
||||
return document.documentElement.getAttribute('data-darkmode') === 'true';
|
||||
}
|
||||
|
||||
// ============================================================
|
||||
@@ -1050,7 +1053,8 @@ var _hljsCSSInjected = false
|
||||
function injectHljsCSS() {
|
||||
if (_hljsCSSInjected) return
|
||||
_hljsCSSInjected = true
|
||||
var isDark = _isDarkMode()
|
||||
_ocEnsureHljs();
|
||||
var isDark = _ocIsDark()
|
||||
var style = document.createElement("style")
|
||||
style.id = "hljs-theme"
|
||||
style.textContent = isDark ? githubDarkCSS : githubLightCSS
|
||||
@@ -1067,25 +1071,32 @@ function escapeHtml(s) {
|
||||
return s.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """)
|
||||
}
|
||||
|
||||
marked.use({
|
||||
breaks: true,
|
||||
gfm: true,
|
||||
silent: true,
|
||||
renderer: {
|
||||
code: function(token) {
|
||||
var lang = token.lang || ""
|
||||
if (lang && hljs.getLanguage(lang)) {
|
||||
injectHljsCSS()
|
||||
var result = hljs.highlight(token.text, { language: lang, ignoreIllegals: true })
|
||||
return '<pre><code class="hljs language-' + lang + '"><span class="code-content">' + result.value + '</span></code></pre>'
|
||||
var _ocMarkedReady = false;
|
||||
function _ocEnsureMarked() {
|
||||
if (_ocMarkedReady) return;
|
||||
_ocMarkedReady = true;
|
||||
_ocEnsureHljs();
|
||||
marked.use({
|
||||
breaks: true,
|
||||
gfm: true,
|
||||
silent: true,
|
||||
renderer: {
|
||||
code: function(token) {
|
||||
var lang = token.lang || ""
|
||||
if (lang && hljs.getLanguage(lang)) {
|
||||
injectHljsCSS()
|
||||
var result = hljs.highlight(token.text, { language: lang, ignoreIllegals: true })
|
||||
return '<pre><code class="hljs language-' + lang + '"><span class="code-content">' + result.value + '</span></code></pre>'
|
||||
}
|
||||
return '<pre><code><span class="code-content">' + escapeHtml(token.text) + '</span></code></pre>'
|
||||
}
|
||||
return '<pre><code><span class="code-content">' + escapeHtml(token.text) + '</span></code></pre>'
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
function renderMarkdown(text) {
|
||||
if (!text) return ''
|
||||
_ocEnsureMarked();
|
||||
try { return marked.parse(text) } catch(e) { return text }
|
||||
}
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
"@lezer/lr": "1.4.2",
|
||||
"@fsegurai/codemirror-theme-bundle": "6.4.2",
|
||||
"@babel/runtime": "8.0.0",
|
||||
"js-yaml": "5.2.1",
|
||||
"js-yaml": "5.2.2",
|
||||
"marked": "18.0.5",
|
||||
"highlight.js": "11.11.1",
|
||||
"esbuild": "0.28.1",
|
||||
|
||||
@@ -7,8 +7,8 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=luci-app-passwall
|
||||
PKG_VERSION:=26.8.1
|
||||
PKG_RELEASE:=212
|
||||
PKG_VERSION:=26.8.10
|
||||
PKG_RELEASE:=213
|
||||
PKG_PO_VERSION:=$(PKG_VERSION)
|
||||
|
||||
PKG_CONFIG_DEPENDS:= \
|
||||
|
||||
@@ -1992,6 +1992,7 @@ function gen_config(var)
|
||||
end
|
||||
end
|
||||
dns.final = default_dns_flag
|
||||
dns.strategy = default_dns_flag == "remote" and remote_strategy or direct_strategy
|
||||
|
||||
--按分流顺序DNS
|
||||
if dns_domain_rules and #dns_domain_rules > 0 then
|
||||
@@ -2015,12 +2016,43 @@ function gen_config(var)
|
||||
dns_rule.disable_cache = nil
|
||||
end
|
||||
if value.outboundTag == "direct" then
|
||||
dns_rule.strategy = direct_strategy
|
||||
local block_rule
|
||||
if direct_strategy == "ipv4_only" then
|
||||
block_rule = api.clone(dns_rule)
|
||||
block_rule.query_type = { "AAAA" }
|
||||
elseif direct_strategy == "ipv6_only" then
|
||||
block_rule = api.clone(dns_rule)
|
||||
block_rule.query_type = { "A" }
|
||||
end
|
||||
if block_rule then
|
||||
block_rule.action = "predefined"
|
||||
block_rule.rcode = "NOERROR"
|
||||
block_rule.disable_cache = nil
|
||||
block_rule.server = nil
|
||||
table.insert(dns.rules, block_rule)
|
||||
end
|
||||
end
|
||||
if value.outboundTag ~= "block" and value.outboundTag ~= "direct" then
|
||||
dns_rule.server = "remote"
|
||||
dns_rule.rewrite_ttl = 30
|
||||
dns_rule.strategy = remote_strategy
|
||||
if true then
|
||||
local block_rule
|
||||
if remote_strategy == "ipv4_only" then
|
||||
block_rule = api.clone(dns_rule)
|
||||
block_rule.query_type = { "AAAA" }
|
||||
elseif remote_strategy == "ipv6_only" then
|
||||
block_rule = api.clone(dns_rule)
|
||||
block_rule.query_type = { "A" }
|
||||
end
|
||||
if block_rule then
|
||||
block_rule.action = "predefined"
|
||||
block_rule.rcode = "NOERROR"
|
||||
block_rule.disable_cache = nil
|
||||
block_rule.server = nil
|
||||
block_rule.rewrite_ttl = nil
|
||||
table.insert(dns.rules, block_rule)
|
||||
end
|
||||
end
|
||||
dns_rule.client_subnet = remote_dns_client_ip
|
||||
if value.outboundTag ~= COMMON.default_outbound_tag and (remote_server.address or remote_server.server) then
|
||||
local remote_dns_server = api.clone(remote_server)
|
||||
@@ -2033,9 +2065,13 @@ function gen_config(var)
|
||||
end
|
||||
if value.fakedns then
|
||||
local fakedns_dns_rule = api.clone(dns_rule)
|
||||
fakedns_dns_rule.query_type = {
|
||||
"A", "AAAA"
|
||||
}
|
||||
if remote_strategy == "ipv4_only" then
|
||||
fakedns_dns_rule.query_type = { "A" }
|
||||
elseif remote_strategy == "ipv6_only" then
|
||||
fakedns_dns_rule.query_type = { "AAAA" }
|
||||
else
|
||||
fakedns_dns_rule.query_type = { "A", "AAAA" }
|
||||
end
|
||||
fakedns_dns_rule.server = fakedns_tag
|
||||
fakedns_dns_rule.disable_cache = true
|
||||
table.insert(dns.rules, fakedns_dns_rule)
|
||||
@@ -2046,23 +2082,26 @@ function gen_config(var)
|
||||
end
|
||||
end
|
||||
if default_dns_flag == "remote" then
|
||||
local dns_rule_query_type = { "A", "AAAA" }
|
||||
if remote_strategy == "ipv4_only" then
|
||||
dns_rule_query_type = { "A" }
|
||||
elseif remote_strategy == "ipv6_only" then
|
||||
dns_rule_query_type = { "AAAA" }
|
||||
end
|
||||
if remote_dns_fake then
|
||||
-- When default is not direct and enable fakedns, default DNS use FakeDNS.
|
||||
local fakedns_dns_rule = {
|
||||
query_type = {
|
||||
"A", "AAAA"
|
||||
},
|
||||
query_type = dns_rule_query_type,
|
||||
server = fakedns_tag,
|
||||
disable_cache = true,
|
||||
rewrite_ttl = 30,
|
||||
strategy = remote_strategy,
|
||||
rewrite_ttl = 30
|
||||
}
|
||||
table.insert(dns.rules, fakedns_dns_rule)
|
||||
else
|
||||
local remote_dns_rule = {
|
||||
query_type = dns_rule_query_type,
|
||||
server = "remote",
|
||||
disable_cache = true,
|
||||
strategy = remote_strategy,
|
||||
}
|
||||
table.insert(dns.rules, remote_dns_rule)
|
||||
end
|
||||
|
||||
@@ -355,11 +355,11 @@ function gen_outbound(flag, node, tag, proxy_table)
|
||||
end
|
||||
if fragment and fragment_table and ({raw=1, ws=1, httpupgrade=1, grpc=1, xhttp=1})[TP] then
|
||||
finalmask.tcp = finalmask.tcp or {}
|
||||
finalmask.tcp[#finalmask.tcp+1] = api.clone(fragment_table)
|
||||
table.insert(finalmask.tcp, 1, api.clone(fragment_table))
|
||||
end
|
||||
if noise and noise_table and (TP == "mkcp" or (TP == "xhttp" and node.alpn == "h3")) then
|
||||
finalmask.udp = finalmask.udp or {}
|
||||
finalmask.udp[#finalmask.udp+1] = api.clone(noise_table)
|
||||
table.insert(finalmask.udp, 1, api.clone(noise_table))
|
||||
end
|
||||
if node.finalmask and node.finalmask ~= "" then
|
||||
local ok, fm = pcall(jsonc.parse, api.base64Decode(node.finalmask))
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=luci-app-passwall2
|
||||
PKG_VERSION:=26.8.7
|
||||
PKG_RELEASE:=76
|
||||
PKG_VERSION:=26.8.10
|
||||
PKG_RELEASE:=77
|
||||
PKG_PO_VERSION:=$(PKG_VERSION)
|
||||
|
||||
PKG_CONFIG_DEPENDS:= \
|
||||
|
||||
@@ -3,7 +3,7 @@ include $(TOPDIR)/rules.mk
|
||||
PKG_NAME:=luci-app-snmpd-ssl
|
||||
|
||||
LUCI_TITLE:=Net-SNMP LuCI interface with v3 support
|
||||
LUCI_DEPENDS:=+luci-base +snmpd-ssl
|
||||
LUCI_DEPENDS:=+luci-base
|
||||
LUCI_PKGARCH:=all
|
||||
|
||||
include $(TOPDIR)/feeds/luci/luci.mk
|
||||
|
||||
Reference in new issue
Block a user