@astralyn/sash 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +23 -0
- package/README.md +6 -3
- package/dist/commands/lifecycle.js +0 -16
- package/dist/commands/status.js +1 -6
- package/dist/commands/web.js +40 -12
- package/dist/contracts.js +16 -0
- package/dist/daemon/app.js +10 -3
- package/dist/daemon/errors.js +3 -1
- package/dist/daemon/handlers/daemon.js +15 -0
- package/dist/daemon/router.js +16 -8
- package/dist/daemon/server.js +1 -1
- package/dist/daemon/web-auth.js +52 -0
- package/dist/daemon-auth.js +2 -2
- package/dist/daemon-client.js +6 -0
- package/dist/daemon-http.js +1 -0
- package/dist/log-follow.js +2 -1
- package/dist/managed-state-transaction.js +6 -8
- package/dist/mihomo-config.js +5 -8
- package/dist/sash-client.js +24 -3
- package/dist/settings-service.js +14 -18
- package/dist/settings.js +5 -1
- package/dist/status.js +0 -24
- package/dist/ui/assets/{CodeEditorModal-CFEnWsyh.js → CodeEditorModal-D1zn-jRS.js} +1 -1
- package/dist/ui/assets/{ConnectionsView-DNGmZBSU.js → ConnectionsView-CfaOG2JV.js} +1 -1
- package/dist/ui/assets/{LogsView-fSiaxQ13.js → LogsView-BDiRATXN.js} +1 -1
- package/dist/ui/assets/{PaginationFooter-B3kHzRfB.js → PaginationFooter-DTytr1iu.js} +1 -1
- package/dist/ui/assets/{ProfileEditorDialog-BydoZthX.js → ProfileEditorDialog-CyyP6OF1.js} +1 -1
- package/dist/ui/assets/{ProfilesView-Btc1DOxE.js → ProfilesView-hFa7-O72.js} +2 -2
- package/dist/ui/assets/{RulesView-D9vZBiJ1.js → RulesView-CjEyCN1A.js} +1 -1
- package/dist/ui/assets/SettingsFileDialog-CjBSyH4K.js +1 -0
- package/dist/ui/assets/SettingsView-D5QvJId6.css +1 -0
- package/dist/ui/assets/SettingsView-DsRntRfn.js +2 -0
- package/dist/ui/assets/{0be242294f7d791af850c6df38ac78a0-2cL6Ntwf.woff2 → e2a57555d97d0b02b45d9418eb6ee295-D9nhF3rM.woff2} +0 -0
- package/dist/ui/assets/index-CxQTf_P9.css +1 -0
- package/dist/ui/assets/index-_mb4OfYp.js +19 -0
- package/dist/ui/assets/{theme-BNq4FkXS.js → theme-BwDBMsKO.js} +1 -1
- package/dist/ui/index.html +2 -2
- package/dist/web-bootstrap.js +113 -0
- package/docs/backend.md +12 -4
- package/docs/frontend.md +13 -3
- package/docs/usage.md +10 -36
- package/package.json +8 -4
- package/dist/tun-guidance.js +0 -11
- package/dist/ui/assets/SettingsFileDialog-CNFEAVs4.js +0 -1
- package/dist/ui/assets/SettingsView-BlDhZkXQ.js +0 -2
- package/dist/ui/assets/SettingsView-CngS3vBM.css +0 -1
- package/dist/ui/assets/index-B61V60w_.js +0 -19
- package/dist/ui/assets/index-bkyxJG8J.css +0 -1
package/dist/settings-service.js
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { commitManagedStateTransaction } from "./managed-state-transaction.js";
|
|
2
2
|
import { ProfileConflictError, } from "./profile-service.js";
|
|
3
3
|
import { sameSettings, validateSettingsCandidate } from "./settings.js";
|
|
4
|
-
import { tunPrivilegeGuidance } from "./tun-guidance.js";
|
|
5
4
|
export class SettingsInputError extends Error {
|
|
6
5
|
}
|
|
6
|
+
export class SettingsConflictError extends Error {
|
|
7
|
+
}
|
|
7
8
|
export class CoreUnhealthyError extends Error {
|
|
8
9
|
}
|
|
9
|
-
const CORE_SETTING_KEYS = ["mixedPort", "controller", "secret", "
|
|
10
|
+
const CORE_SETTING_KEYS = ["mixedPort", "controller", "secret", "allowLan"];
|
|
10
11
|
export class SettingsService {
|
|
11
12
|
options;
|
|
12
13
|
constructor(options) {
|
|
@@ -29,12 +30,10 @@ export class SettingsService {
|
|
|
29
30
|
if (coreChanged || daemonChanged) {
|
|
30
31
|
const staged = { ...candidate, systemProxy: previous.systemProxy };
|
|
31
32
|
committed = coreChanged
|
|
32
|
-
? await this.commitCoreChange(previous, staged
|
|
33
|
-
verifyTun: candidate.tun && !previous.tun,
|
|
34
|
-
})
|
|
33
|
+
? await this.commitCoreChange(previous, staged)
|
|
35
34
|
: await this.commitSettingsOnly(previous, staged);
|
|
36
35
|
}
|
|
37
|
-
if (proxyChanged) {
|
|
36
|
+
if (proxyChanged || patch.systemProxy === false) {
|
|
38
37
|
committed = await this.commitSystemProxy(committed, candidate);
|
|
39
38
|
}
|
|
40
39
|
return { settings: committed, restartRequired };
|
|
@@ -75,7 +74,7 @@ export class SettingsService {
|
|
|
75
74
|
return candidate;
|
|
76
75
|
});
|
|
77
76
|
}
|
|
78
|
-
async commitCoreChange(previous, candidate
|
|
77
|
+
async commitCoreChange(previous, candidate) {
|
|
79
78
|
for (let attempt = 0;; attempt += 1) {
|
|
80
79
|
const prepared = await this.options.profiles.prepareActiveConfig(candidate, previous);
|
|
81
80
|
let retryableProfileConflict;
|
|
@@ -86,7 +85,7 @@ export class SettingsService {
|
|
|
86
85
|
try {
|
|
87
86
|
return await this.options.profiles.withPreparedActivePublication(prepared, async (publication) => {
|
|
88
87
|
callbackEntered = true;
|
|
89
|
-
return this.commitCoreSettings(previous, candidate,
|
|
88
|
+
return this.commitCoreSettings(previous, candidate, publication);
|
|
90
89
|
});
|
|
91
90
|
}
|
|
92
91
|
catch (err) {
|
|
@@ -109,7 +108,9 @@ export class SettingsService {
|
|
|
109
108
|
this.assertCurrent(previous);
|
|
110
109
|
this.options.setRuntime(candidate);
|
|
111
110
|
try {
|
|
112
|
-
|
|
111
|
+
if (!sameSettings(previous, candidate)) {
|
|
112
|
+
await commitManagedStateTransaction(this.options.layout, { settings: candidate }, undefined);
|
|
113
|
+
}
|
|
113
114
|
}
|
|
114
115
|
catch (err) {
|
|
115
116
|
this.options.setRuntime(previous);
|
|
@@ -150,7 +151,7 @@ export class SettingsService {
|
|
|
150
151
|
}
|
|
151
152
|
});
|
|
152
153
|
}
|
|
153
|
-
async commitCoreSettings(previous, candidate,
|
|
154
|
+
async commitCoreSettings(previous, candidate, publication) {
|
|
154
155
|
const wasRunning = this.options.supervisor?.isRunning() ?? false;
|
|
155
156
|
this.options.setRuntime(candidate);
|
|
156
157
|
try {
|
|
@@ -170,12 +171,7 @@ export class SettingsService {
|
|
|
170
171
|
applyRuntime: async () => {
|
|
171
172
|
if (!wasRunning)
|
|
172
173
|
return;
|
|
173
|
-
|
|
174
|
-
if (opts.verifyTun && result.tunActive !== true) {
|
|
175
|
-
throw new Error(result.tunActive === false
|
|
176
|
-
? `TUN did not become active. ${tunPrivilegeGuidance("activation-rolled-back", { root: this.options.layout.root })}`
|
|
177
|
-
: `TUN activation could not be verified through the Core controller. ${tunPrivilegeGuidance("activation-rolled-back", { root: this.options.layout.root })}`);
|
|
178
|
-
}
|
|
174
|
+
await this.requireLifecycle().restart();
|
|
179
175
|
},
|
|
180
176
|
}, undefined);
|
|
181
177
|
this.options.setCommitted(candidate);
|
|
@@ -205,7 +201,7 @@ export class SettingsService {
|
|
|
205
201
|
}
|
|
206
202
|
}
|
|
207
203
|
if (rollbackErrors.length)
|
|
208
|
-
throw new Error(`${err.message}; ${rollbackErrors.join("; ")}
|
|
204
|
+
throw new Error(`${err.message}; ${rollbackErrors.join("; ")}`, { cause: err });
|
|
209
205
|
throw err;
|
|
210
206
|
}
|
|
211
207
|
}
|
|
@@ -216,7 +212,7 @@ export class SettingsService {
|
|
|
216
212
|
}
|
|
217
213
|
assertCurrent(previous) {
|
|
218
214
|
if (!sameSettings(this.options.getCommitted(), previous)) {
|
|
219
|
-
throw new
|
|
215
|
+
throw new SettingsConflictError("Settings changed while preparing configuration");
|
|
220
216
|
}
|
|
221
217
|
}
|
|
222
218
|
}
|
package/dist/settings.js
CHANGED
|
@@ -175,6 +175,9 @@ function parseSettings(document, file, allowMissing) {
|
|
|
175
175
|
const secret = readRequiredField(document, "secret", DEFAULT_SETTINGS.secret, allowMissing, file, parseSecret);
|
|
176
176
|
const tun = readRequiredField(document, "tun", DEFAULT_SETTINGS.tun, allowMissing, file, parseBoolean);
|
|
177
177
|
const allowLan = readRequiredField(document, "allowLan", DEFAULT_SETTINGS.allowLan, allowMissing, file, parseBoolean);
|
|
178
|
+
if (tun.value && !allowMissing) {
|
|
179
|
+
throw invalidSettings(file, "TUN is unavailable in this release; tun must be false");
|
|
180
|
+
}
|
|
178
181
|
const daemonPort = readRequiredField(document, "daemonPort", DEFAULT_SETTINGS.daemonPort, allowMissing, file, parsePort);
|
|
179
182
|
const daemonSecret = readRequiredField(document, "daemonSecret", DEFAULT_SETTINGS.daemonSecret, allowMissing, file, parseSecret);
|
|
180
183
|
const systemProxy = readRequiredField(document, "systemProxy", DEFAULT_SETTINGS.systemProxy, allowMissing, file, parseBoolean);
|
|
@@ -185,6 +188,7 @@ function parseSettings(document, file, allowMissing) {
|
|
|
185
188
|
controller.value !== document.controller ||
|
|
186
189
|
secret.missing ||
|
|
187
190
|
tun.missing ||
|
|
191
|
+
tun.value ||
|
|
188
192
|
allowLan.missing ||
|
|
189
193
|
daemonPort.missing ||
|
|
190
194
|
daemonSecret.missing ||
|
|
@@ -205,7 +209,7 @@ function parseSettings(document, file, allowMissing) {
|
|
|
205
209
|
mixedPort: mixedPort.value,
|
|
206
210
|
controller: controller.value,
|
|
207
211
|
secret: normalizedSecret,
|
|
208
|
-
tun:
|
|
212
|
+
tun: false,
|
|
209
213
|
allowLan: allowLan.value,
|
|
210
214
|
daemonPort: daemonPort.value,
|
|
211
215
|
daemonSecret: normalizedDaemonSecret,
|
package/dist/status.js
CHANGED
|
@@ -243,30 +243,6 @@ export function runtimeStatusHeadline(status) {
|
|
|
243
243
|
text: `sashd running (PID=${status.daemon.pid}), core stopped`,
|
|
244
244
|
};
|
|
245
245
|
}
|
|
246
|
-
export function formatTunObservation(status) {
|
|
247
|
-
if (!status.tun.desired) {
|
|
248
|
-
if (status.tun.active === true)
|
|
249
|
-
return "off (runtime active)";
|
|
250
|
-
return status.tun.active === null && status.core.running !== false
|
|
251
|
-
? "off (runtime unknown)"
|
|
252
|
-
: "off";
|
|
253
|
-
}
|
|
254
|
-
if (status.core.running === false)
|
|
255
|
-
return "on (core stopped)";
|
|
256
|
-
if (status.core.running === null)
|
|
257
|
-
return "on (runtime unknown)";
|
|
258
|
-
if (status.tun.active === true)
|
|
259
|
-
return "on (active)";
|
|
260
|
-
if (status.tun.active === false)
|
|
261
|
-
return "on (inactive)";
|
|
262
|
-
return "on (unverified)";
|
|
263
|
-
}
|
|
264
|
-
export function shouldShowTunGuidance(status) {
|
|
265
|
-
return (status.tun.desired &&
|
|
266
|
-
status.core.running === true &&
|
|
267
|
-
status.core.healthy === true &&
|
|
268
|
-
status.tun.active !== true);
|
|
269
|
-
}
|
|
270
246
|
export function formatObservedProxy(state) {
|
|
271
247
|
if (state.enabled === null)
|
|
272
248
|
return "unknown";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{d as ju,L as Uu,w as _u,J as Gu,C as Yu,M as Ju,N as Xu,O as Qu,o as Wn,m as Zu,T as ed,a as td,b as id,e as Dt,Q as nd,n as Ll,g as mi,c as as,i as hs,u as Hn,t as _t,f as rd,ak as sd,S as od,p as El,A as ld,_ as ad}from"./index-B61V60w_.js";import{i as hd}from"./theme-BNq4FkXS.js";const cd=1024;let fd=0,cs=class{constructor(e,t){this.from=e,this.to=t}};class U{constructor(e={}){this.id=fd++,this.perNode=!!e.perNode,this.deserialize=e.deserialize||(()=>{throw new Error("This node type doesn't define a deserialize function")}),this.combine=e.combine||null}add(e){if(this.perNode)throw new RangeError("Can't add per-node props to node types");return typeof e!="function"&&(e=Ve.match(e)),t=>{let i=e(t);return i===void 0?null:[this,i]}}}U.closedBy=new U({deserialize:n=>n.split(" ")});U.openedBy=new U({deserialize:n=>n.split(" ")});U.group=new U({deserialize:n=>n.split(" ")});U.isolate=new U({deserialize:n=>{if(n&&n!="rtl"&&n!="ltr"&&n!="auto")throw new RangeError("Invalid value for isolate: "+n);return n||"auto"}});U.contextHash=new U({perNode:!0});U.lookAhead=new U({perNode:!0});U.mounted=new U({perNode:!0});class Qi{constructor(e,t,i,r=!1){this.tree=e,this.overlay=t,this.parser=i,this.bracketed=r}static get(e){return e&&e.props&&e.props[U.mounted.id]}}const ud=Object.create(null);class Ve{constructor(e,t,i,r=0){this.name=e,this.props=t,this.id=i,this.flags=r}static define(e){let t=e.props&&e.props.length?Object.create(null):ud,i=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(e.name==null?8:0),r=new Ve(e.name||"",t,e.id,i);if(e.props){for(let s of e.props)if(Array.isArray(s)||(s=s(r)),s){if(s[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");t[s[0].id]=s[1]}}return r}prop(e){return this.props[e.id]}get isTop(){return(this.flags&1)>0}get isSkipped(){return(this.flags&2)>0}get isError(){return(this.flags&4)>0}get isAnonymous(){return(this.flags&8)>0}is(e){if(typeof e=="string"){if(this.name==e)return!0;let t=this.prop(U.group);return t?t.indexOf(e)>-1:!1}return this.id==e}static match(e){let t=Object.create(null);for(let i in e)for(let r of i.split(" "))t[r]=e[i];return i=>{for(let r=i.prop(U.group),s=-1;s<(r?r.length:0);s++){let o=t[s<0?i.name:r[s]];if(o)return o}}}}Ve.none=new Ve("",Object.create(null),0,8);class Eo{constructor(e){this.types=e;for(let t=0;t<e.length;t++)if(e[t].id!=t)throw new RangeError("Node type ids should correspond to array positions when creating a node set")}extend(...e){let t=[];for(let i of this.types){let r=null;for(let s of e){let o=s(i);if(o){r||(r=Object.assign({},i.props));let l=o[1],a=o[0];a.combine&&a.id in r&&(l=a.combine(r[a.id],l)),r[a.id]=l}}t.push(r?new Ve(i.name,r,i.id,i.flags):i)}return new Eo(t)}}const Vn=new WeakMap,Rl=new WeakMap;var de;(function(n){n[n.ExcludeBuffers=1]="ExcludeBuffers",n[n.IncludeAnonymous=2]="IncludeAnonymous",n[n.IgnoreMounts=4]="IgnoreMounts",n[n.IgnoreOverlays=8]="IgnoreOverlays",n[n.EnterBracketed=16]="EnterBracketed"})(de||(de={}));class ae{constructor(e,t,i,r,s){if(this.type=e,this.children=t,this.positions=i,this.length=r,this.props=null,s&&s.length){this.props=Object.create(null);for(let[o,l]of s)this.props[typeof o=="number"?o:o.id]=l}}toString(){let e=Qi.get(this);if(e&&!e.overlay)return e.tree.toString();let t="";for(let i of this.children){let r=i.toString();r&&(t&&(t+=","),t+=r)}return this.type.name?(/\W/.test(this.type.name)&&!this.type.isError?JSON.stringify(this.type.name):this.type.name)+(t.length?"("+t+")":""):t}cursor(e=0){return new Fs(this.topNode,e)}cursorAt(e,t=0,i=0){let r=Vn.get(this)||this.topNode,s=new Fs(r);return s.moveTo(e,t),Vn.set(this,s._tree),s}get topNode(){return new Ye(this,0,0,null)}resolve(e,t=0){let i=on(Vn.get(this)||this.topNode,e,t,!1);return Vn.set(this,i),i}resolveInner(e,t=0){let i=on(Rl.get(this)||this.topNode,e,t,!0);return Rl.set(this,i),i}resolveStack(e,t=0){return md(this,e,t)}iterate(e){let{enter:t,leave:i,from:r=0,to:s=this.length}=e,o=e.mode||0,l=(o&de.IncludeAnonymous)>0;for(let a=this.cursor(o|de.IncludeAnonymous);;){let h=!1;if(a.from<=s&&a.to>=r&&(!l&&a.type.isAnonymous||t(a)!==!1)){if(a.firstChild())continue;h=!0}for(;h&&i&&(l||!a.type.isAnonymous)&&i(a),!a.nextSibling();){if(!a.parent())return;h=!0}}}prop(e){return e.perNode?this.props?this.props[e.id]:void 0:this.type.prop(e)}get propValues(){let e=[];if(this.props)for(let t in this.props)e.push([+t,this.props[t]]);return e}balance(e={}){return this.children.length<=8?this:Io(Ve.none,this.children,this.positions,0,this.children.length,0,this.length,(t,i,r)=>new ae(this.type,t,i,r,this.propValues),e.makeTree||((t,i,r)=>new ae(Ve.none,t,i,r)))}static build(e){return gd(e)}}ae.empty=new ae(Ve.none,[],[],0);class Ro{constructor(e,t){this.buffer=e,this.index=t}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}get pos(){return this.index}next(){this.index-=4}fork(){return new Ro(this.buffer,this.index)}}class Nt{constructor(e,t,i){this.buffer=e,this.length=t,this.set=i}get type(){return Ve.none}toString(){let e=[];for(let t=0;t<this.buffer.length;)e.push(this.childString(t)),t=this.buffer[t+3];return e.join(",")}childString(e){let t=this.buffer[e],i=this.buffer[e+3],r=this.set.types[t],s=r.name;if(/\W/.test(s)&&!r.isError&&(s=JSON.stringify(s)),e+=4,i==e)return s;let o=[];for(;e<i;)o.push(this.childString(e)),e=this.buffer[e+3];return s+"("+o.join(",")+")"}findChild(e,t,i,r,s){let{buffer:o}=this,l=-1;for(let a=e;a!=t&&!(kh(s,r,o[a+1],o[a+2])&&(l=a,i>0));a=o[a+3]);return l}slice(e,t,i){let r=this.buffer,s=new Uint16Array(t-e),o=0;for(let l=e,a=0;l<t;){s[a++]=r[l++],s[a++]=r[l++]-i;let h=s[a++]=r[l++]-i;s[a++]=r[l++]-e,o=Math.max(o,h)}return new Nt(s,o,this.set)}}function kh(n,e,t,i){switch(n){case-2:return t<e;case-1:return i>=e&&t<e;case 0:return t<e&&i>e;case 1:return t<=e&&i>e;case 2:return i>e;case 4:return!0}}function on(n,e,t,i){for(var r;n.from==n.to||(t<1?n.from>=e:n.from>e)||(t>-1?n.to<=e:n.to<e);){let o=!i&&n instanceof Ye&&n.index<0?null:n.parent;if(!o)return n;n=o}let s=i?0:de.IgnoreOverlays;if(i)for(let o=n,l=o.parent;l;o=l,l=o.parent)o instanceof Ye&&o.index<0&&((r=l.enter(e,t,s))===null||r===void 0?void 0:r.from)!=o.from&&(n=l);for(;;){let o=n.enter(e,t,s);if(!o)return n;n=o}}class vh{cursor(e=0){return new Fs(this,e)}getChild(e,t=null,i=null){let r=Pl(this,e,t,i);return r.length?r[0]:null}getChildren(e,t=null,i=null){return Pl(this,e,t,i)}resolve(e,t=0){return on(this,e,t,!1)}resolveInner(e,t=0){return on(this,e,t,!0)}matchContext(e){return Vs(this.parent,e)}enterUnfinishedNodesBefore(e){let t=this.childBefore(e),i=this;for(;t;){let r=t.lastChild;if(!r||r.to!=t.to)break;r.type.isError&&r.from==r.to?(i=t,t=r.prevSibling):t=r}return i}get node(){return this}get next(){return this.parent}}class Ye extends vh{constructor(e,t,i,r){super(),this._tree=e,this.from=t,this.index=i,this._parent=r}get type(){return this._tree.type}get name(){return this._tree.type.name}get to(){return this.from+this._tree.length}nextChild(e,t,i,r,s=0){for(let o=this;;){for(let{children:l,positions:a}=o._tree,h=t>0?l.length:-1;e!=h;e+=t){let c=l[e],f=a[e]+o.from,u;if(!(!(s&de.EnterBracketed&&c instanceof ae&&(u=Qi.get(c))&&!u.overlay&&u.bracketed&&i>=f&&i<=f+c.length)&&!kh(r,i,f,f+c.length))){if(c instanceof Nt){if(s&de.ExcludeBuffers)continue;let p=c.findChild(0,c.buffer.length,t,i-f,r);if(p>-1)return new Rt(new dd(o,c,e,f),null,p)}else if(s&de.IncludeAnonymous||!c.type.isAnonymous||Po(c)){let p;if(!(s&de.IgnoreMounts)&&(p=Qi.get(c))&&!p.overlay)return new Ye(p.tree,f,e,o);let m=new Ye(c,f,e,o);return s&de.IncludeAnonymous||!m.type.isAnonymous?m:m.nextChild(t<0?c.children.length-1:0,t,i,r,s)}}}if(s&de.IncludeAnonymous||!o.type.isAnonymous||(o.index>=0?e=o.index+t:e=t<0?-1:o._parent._tree.children.length,o=o._parent,!o))return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this._tree.children.length-1,-1,0,4)}childAfter(e){return this.nextChild(0,1,e,2)}childBefore(e){return this.nextChild(this._tree.children.length-1,-1,e,-2)}prop(e){return this._tree.prop(e)}enter(e,t,i=0){let r;if(!(i&de.IgnoreOverlays)&&(r=Qi.get(this._tree))&&r.overlay){let s=e-this.from,o=i&de.EnterBracketed&&r.bracketed;for(let{from:l,to:a}of r.overlay)if((t>0||o?l<=s:l<s)&&(t<0||o?a>=s:a>s))return new Ye(r.tree,r.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,e,t,i)}nextSignificantParent(){let e=this;for(;e.type.isAnonymous&&e._parent;)e=e._parent;return e}get parent(){return this._parent?this._parent.nextSignificantParent():null}get nextSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}get prevSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}get tree(){return this._tree}toTree(){return this._tree}toString(){return this._tree.toString()}}function Pl(n,e,t,i){let r=n.cursor(),s=[];if(!r.firstChild())return s;if(t!=null){for(let o=!1;!o;)if(o=r.type.is(t),!r.nextSibling())return s}for(;;){if(i!=null&&r.type.is(i))return s;if(r.type.is(e)&&s.push(r.node),!r.nextSibling())return i==null?s:[]}}function Vs(n,e,t=e.length-1){for(let i=n;t>=0;i=i.parent){if(!i)return!1;if(!i.type.isAnonymous){if(e[t]&&e[t]!=i.name)return!1;t--}}return!0}class dd{constructor(e,t,i,r){this.parent=e,this.buffer=t,this.index=i,this.start=r}}class Rt extends vh{get name(){return this.type.name}get from(){return this.context.start+this.context.buffer.buffer[this.index+1]}get to(){return this.context.start+this.context.buffer.buffer[this.index+2]}constructor(e,t,i){super(),this.context=e,this._parent=t,this.index=i,this.type=e.buffer.set.types[e.buffer.buffer[i]]}child(e,t,i){let{buffer:r}=this.context,s=r.findChild(this.index+4,r.buffer[this.index+3],e,t-this.context.start,i);return s<0?null:new Rt(this.context,this,s)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(e){return this.child(1,e,2)}childBefore(e){return this.child(-1,e,-2)}prop(e){return this.type.prop(e)}enter(e,t,i=0){if(i&de.ExcludeBuffers)return null;let{buffer:r}=this.context,s=r.findChild(this.index+4,r.buffer[this.index+3],t>0?1:-1,e-this.context.start,t);return s<0?null:new Rt(this.context,this,s)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(e){return this._parent?null:this.context.parent.nextChild(this.context.index+e,e,0,4)}get nextSibling(){let{buffer:e}=this.context,t=e.buffer[this.index+3];return t<(this._parent?e.buffer[this._parent.index+3]:e.buffer.length)?new Rt(this.context,this._parent,t):this.externalSibling(1)}get prevSibling(){let{buffer:e}=this.context,t=this._parent?this._parent.index+4:0;return this.index==t?this.externalSibling(-1):new Rt(this.context,this._parent,e.findChild(t,this.index,-1,0,4))}get tree(){return null}toTree(){let e=[],t=[],{buffer:i}=this.context,r=this.index+4,s=i.buffer[this.index+3];if(s>r){let o=i.buffer[this.index+1];e.push(i.slice(r,s,o)),t.push(0)}return new ae(this.type,e,t,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function Sh(n){if(!n.length)return null;let e=0,t=n[0];for(let s=1;s<n.length;s++){let o=n[s];(o.from>t.from||o.to<t.to)&&(t=o,e=s)}let i=t instanceof Ye&&t.index<0?null:t.parent,r=n.slice();return i?r[e]=i:r.splice(e,1),new pd(r,t)}class pd{constructor(e,t){this.heads=e,this.node=t}get next(){return Sh(this.heads)}}function md(n,e,t){let i=n.resolveInner(e,t),r=null;for(let s=i instanceof Ye?i:i.context.parent;s;s=s.parent)if(s.index<0){let o=s.parent;(r||(r=[i])).push(o.resolve(e,t)),s=o}else{let o=Qi.get(s.tree);if(o&&o.overlay&&o.overlay[0].from<=e&&o.overlay[o.overlay.length-1].to>=e){let l=new Ye(o.tree,o.overlay[0].from+s.from,-1,s);(r||(r=[i])).push(on(l,e,t,!1))}}return r?Sh(r):i}class Fs{get name(){return this.type.name}constructor(e,t=0){if(this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,this.mode=t&~de.EnterBracketed,e instanceof Ye)this.yieldNode(e);else{this._tree=e.context.parent,this.buffer=e.context;for(let i=e._parent;i;i=i._parent)this.stack.unshift(i.index);this.bufferNode=e,this.yieldBuf(e.index)}}yieldNode(e){return e?(this._tree=e,this.type=e.type,this.from=e.from,this.to=e.to,!0):!1}yieldBuf(e,t){this.index=e;let{start:i,buffer:r}=this.buffer;return this.type=t||r.set.types[r.buffer[e]],this.from=i+r.buffer[e+1],this.to=i+r.buffer[e+2],!0}yield(e){return e?e instanceof Ye?(this.buffer=null,this.yieldNode(e)):(this.buffer=e.context,this.yieldBuf(e.index,e.type)):!1}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(e,t,i){if(!this.buffer)return this.yield(this._tree.nextChild(e<0?this._tree._tree.children.length-1:0,e,t,i,this.mode));let{buffer:r}=this.buffer,s=r.findChild(this.index+4,r.buffer[this.index+3],e,t-this.buffer.start,i);return s<0?!1:(this.stack.push(this.index),this.yieldBuf(s))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(e){return this.enterChild(1,e,2)}childBefore(e){return this.enterChild(-1,e,-2)}enter(e,t,i=this.mode){return this.buffer?i&de.ExcludeBuffers?!1:this.enterChild(1,e,t):this.yield(this._tree.enter(e,t,i))}parent(){if(!this.buffer)return this.yieldNode(this.mode&de.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&de.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(e)}sibling(e){if(!this.buffer)return this._tree._parent?this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+e,e,0,4,this.mode)):!1;let{buffer:t}=this.buffer,i=this.stack.length-1;if(e<0){let r=i<0?0:this.stack[i]+4;if(this.index!=r)return this.yieldBuf(t.findChild(r,this.index,-1,0,4))}else{let r=t.buffer[this.index+3];if(r<(i<0?t.buffer.length:t.buffer[this.stack[i]+3]))return this.yieldBuf(r)}return i<0?this.yield(this.buffer.parent.nextChild(this.buffer.index+e,e,0,4,this.mode)):!1}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(e){let t,i,{buffer:r}=this;if(r){if(e>0){if(this.index<r.buffer.buffer.length)return!1}else for(let s=0;s<this.index;s++)if(r.buffer.buffer[s+3]<this.index)return!1;({index:t,parent:i}=r)}else({index:t,_parent:i}=this._tree);for(;i;{index:t,_parent:i}=i)if(t>-1)for(let s=t+e,o=e<0?-1:i._tree.children.length;s!=o;s+=e){let l=i._tree.children[s];if(this.mode&de.IncludeAnonymous||l instanceof Nt||!l.type.isAnonymous||Po(l))return!1}return!0}move(e,t){if(t&&this.enterChild(e,0,4))return!0;for(;;){if(this.sibling(e))return!0;if(this.atLastNode(e)||!this.parent())return!1}}next(e=!0){return this.move(1,e)}prev(e=!0){return this.move(-1,e)}moveTo(e,t=0){for(;(this.from==this.to||(t<1?this.from>=e:this.from>e)||(t>-1?this.to<=e:this.to<e))&&this.parent(););for(;this.enterChild(1,e,t););return this}get node(){if(!this.buffer)return this._tree;let e=this.bufferNode,t=null,i=0;if(e&&e.context==this.buffer)e:for(let r=this.index,s=this.stack.length;s>=0;){for(let o=e;o;o=o._parent)if(o.index==r){if(r==this.index)return o;t=o,i=s+1;break e}r=this.stack[--s]}for(let r=i;r<this.stack.length;r++)t=new Rt(this.buffer,t,this.stack[r]);return this.bufferNode=new Rt(this.buffer,t,this.index)}get tree(){return this.buffer?null:this._tree._tree}iterate(e,t){for(let i=0;;){let r=!1;if(this.type.isAnonymous||e(this)!==!1){if(this.firstChild()){i++;continue}this.type.isAnonymous||(r=!0)}for(;;){if(r&&t&&t(this),r=this.type.isAnonymous,!i)return;if(this.nextSibling())break;this.parent(),i--,r=!0}}}matchContext(e){if(!this.buffer)return Vs(this.node.parent,e);let{buffer:t}=this.buffer,{types:i}=t.set;for(let r=e.length-1,s=this.stack.length-1;r>=0;s--){if(s<0)return Vs(this._tree,e,r);let o=i[t.buffer[this.stack[s]]];if(!o.isAnonymous){if(e[r]&&e[r]!=o.name)return!1;r--}}return!0}}function Po(n){return n.children.some(e=>e instanceof Nt||!e.type.isAnonymous||Po(e))}function gd(n){var e;let{buffer:t,nodeSet:i,maxBufferLength:r=cd,reused:s=[],minRepeatType:o=i.types.length}=n,l=Array.isArray(t)?new Ro(t,t.length):t,a=i.types,h=0,c=0;function f(T,O,w,D,b,Q){let{id:q,start:V,end:_,size:K}=l,X=c,we=h;if(K<0)if(l.next(),K==-1){let W=s[q];w.push(W),D.push(V-T);return}else if(K==-3){h=q;return}else if(K==-4){c=q;return}else throw new RangeError(`Unrecognized record size: ${K}`);let fe=a[q],Oe,ee,H=V-T;if(_-V<=r&&(ee=x(l.pos-O,b))){let W=new Uint16Array(ee.size-ee.skip),z=l.pos-ee.size,te=W.length;for(;l.pos>z;)te=k(ee.start,W,te);Oe=new Nt(W,_-ee.start,i),H=ee.start-T}else{let W=l.pos-K;l.next();let z=[],te=[],yt=q>=o?q:-1,Z=0,ye=_;for(;l.pos>W;)yt>=0&&l.id==yt&&l.size>=0?(l.end<=ye-r&&(m(z,te,V,Z,l.end,ye,yt,X,we),Z=z.length,ye=l.end),l.next()):Q>2500?u(V,W,z,te):f(V,W,z,te,yt,Q+1);if(yt>=0&&Z>0&&Z<z.length&&m(z,te,V,Z,V,ye,yt,X,we),z.reverse(),te.reverse(),yt>-1&&Z>0){let hi=p(fe,we);Oe=Io(fe,z,te,0,z.length,0,_-V,hi,hi)}else Oe=g(fe,z,te,_-V,X-_,we)}w.push(Oe),D.push(H)}function u(T,O,w,D){let b=[],Q=0,q=-1;for(;l.pos>O;){let{id:V,start:_,end:K,size:X}=l;if(X>4)l.next();else{if(q>-1&&_<q)break;q<0&&(q=K-r),b.push(V,_,K),Q++,l.next()}}if(Q){let V=new Uint16Array(Q*4),_=b[b.length-2];for(let K=b.length-3,X=0;K>=0;K-=3)V[X++]=b[K],V[X++]=b[K+1]-_,V[X++]=b[K+2]-_,V[X++]=X;w.push(new Nt(V,b[2]-_,i)),D.push(_-T)}}function p(T,O){return(w,D,b)=>{let Q=0,q=w.length-1,V,_;if(q>=0&&(V=w[q])instanceof ae){if(!q&&V.type==T&&V.length==b)return V;(_=V.prop(U.lookAhead))&&(Q=D[q]+V.length+_)}return g(T,w,D,b,Q,O)}}function m(T,O,w,D,b,Q,q,V,_){let K=[],X=[];for(;T.length>D;)K.push(T.pop()),X.push(O.pop()+w-b);T.push(g(i.types[q],K,X,Q-b,V-Q,_)),O.push(b-w)}function g(T,O,w,D,b,Q,q){if(Q){let V=[U.contextHash,Q];q=q?[V].concat(q):[V]}if(b>25){let V=[U.lookAhead,b];q=q?[V].concat(q):[V]}return new ae(T,O,w,D,q)}function x(T,O){let w=l.fork(),D=0,b=0,Q=0,q=w.end-r,V={size:0,start:0,skip:0};e:for(let _=w.pos-T;w.pos>_;){let K=w.size;if(w.id==O&&K>=0){V.size=D,V.start=b,V.skip=Q,Q+=4,D+=4,w.next();continue}let X=w.pos-K;if(K<0||X<_||w.start<q)break;let we=w.id>=o?4:0,fe=w.start;for(w.next();w.pos>X;){if(w.size<0)if(w.size==-3||w.size==-4)we+=4;else break e;else w.id>=o&&(we+=4);w.next()}b=fe,D+=K,Q+=we}return(O<0||D==T)&&(V.size=D,V.start=b,V.skip=Q),V.size>4?V:void 0}function k(T,O,w){let{id:D,start:b,end:Q,size:q}=l;if(l.next(),q>=0&&D<o){let V=w;if(q>4){let _=l.pos-(q-4);for(;l.pos>_;)w=k(T,O,w)}O[--w]=V,O[--w]=Q-T,O[--w]=b-T,O[--w]=D}else q==-3?h=D:q==-4&&(c=D);return w}let M=[],A=[];for(;l.pos>0;)f(n.start||0,n.bufferStart||0,M,A,-1,0);let I=(e=n.length)!==null&&e!==void 0?e:M.length?A[0]+M[0].length:0;return new ae(a[n.topID],M.reverse(),A.reverse(),I)}const Il=new WeakMap;function ar(n,e){if(!n.isAnonymous||e instanceof Nt||e.type!=n)return 1;let t=Il.get(e);if(t==null){t=1;for(let i of e.children){if(i.type!=n||!(i instanceof ae)){t=1;break}t+=ar(n,i)}Il.set(e,t)}return t}function Io(n,e,t,i,r,s,o,l,a){let h=0;for(let m=i;m<r;m++)h+=ar(n,e[m]);let c=Math.ceil(h*1.5/8),f=[],u=[];function p(m,g,x,k,M){for(let A=x;A<k;){let I=A,T=g[A],O=ar(n,m[A]);for(A++;A<k;A++){let w=ar(n,m[A]);if(O+w>=c)break;O+=w}if(A==I+1){if(O>c){let w=m[I];p(w.children,w.positions,0,w.children.length,g[I]+M);continue}f.push(m[I])}else{let w=g[A-1]+m[A-1].length-T;f.push(Io(n,m,g,I,A,T,w,null,a))}u.push(T+M-s)}}return p(e,t,i,r,0),(l||a)(f,u,o)}class ei{constructor(e,t,i,r,s=!1,o=!1){this.from=e,this.to=t,this.tree=i,this.offset=r,this.open=(s?1:0)|(o?2:0)}get openStart(){return(this.open&1)>0}get openEnd(){return(this.open&2)>0}static addTree(e,t=[],i=!1){let r=[new ei(0,e.length,e,0,!1,i)];for(let s of t)s.to>e.length&&r.push(s);return r}static applyChanges(e,t,i=128){if(!t.length)return e;let r=[],s=1,o=e.length?e[0]:null;for(let l=0,a=0,h=0;;l++){let c=l<t.length?t[l]:null,f=c?c.fromA:1e9;if(f-a>=i)for(;o&&o.from<f;){let u=o;if(a>=u.from||f<=u.to||h){let p=Math.max(u.from,a)-h,m=Math.min(u.to,f)-h;u=p>=m?null:new ei(p,m,u.tree,u.offset+h,l>0,!!c)}if(u&&r.push(u),o.to>f)break;o=s<e.length?e[s++]:null}if(!c)break;a=c.toA,h=c.toA-c.toB}return r}}class Ch{startParse(e,t,i){return typeof e=="string"&&(e=new yd(e)),i=i?i.length?i.map(r=>new cs(r.from,r.to)):[new cs(0,0)]:[new cs(0,e.length)],this.createParse(e,t||[],i)}parse(e,t,i){let r=this.startParse(e,t,i);for(;;){let s=r.advance();if(s)return s}}}class yd{constructor(e){this.string=e}get length(){return this.string.length}chunk(e){return this.string.slice(e)}get lineChunks(){return!1}read(e,t){return this.string.slice(e,t)}}new U({perNode:!0});let zs=[],Ah=[];(()=>{let n="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,1n,9,16,o,,x,1i,3,,i,,7,a,2,t,3,1k,,,7,2,2,2,3,9,,a,2,q,,2,3,1k,,,5,4,2,2,3,3,,u,2,3,,b,3,1k,,,8,,3,,3,k,2,m,6,,3,1k,,,7,2,2,2,3,7,3,a,2,u,,1n,5,3,3,,4,9,,14,5,1j,,,7,,3,,4,7,2,b,2,t,3,1k,,,7,,3,,4,7,2,b,2,f,,c,4,1j,2,,7,,3,,4,9,,a,2,t,3,1y,,4,6,,,,8,i,2,1p,,,8,c,8,2q,,,a,b,7,21,2,r,,,,,,4,2,1d,k,,2,5,b,,10,9,,2u,b,,6,n,4,4,3,g,4,d,,,3,6,,f,,jj,3,qa,4,s,3,t,2,u,2,1s,w,9,,19,3,,,39,2,y,,3a,c,4,c,63,5,1l,a,,,,,2,o,2,,1c,1a,2,c,k,5,1b,h,12,9,c,3,u,d,1k,e,1c,k,48,3,,l,4,,6,,2,3,5i,1s,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,n,5,4,,2b,2,1e,i,q,i,d,,12,8,p,d,18,4,1b,e,10,,1v,e,c,,8,2,1a,,1f,,,3,2,2,5,2,,,15,5,5,2,6k,8,,2,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,1t,5,8t,2,25,6,1y,b,1d,4,3e,3,1h,f,15,,2,2,a,4,19,b,7,,1p,3,10,e,g,2,18,,c,3,1c,e,8,4,,2,2k,c,6,,2,,4d,c,l,4,1j,2,,7,2,2,2,3,9,,a,2,2,7,3,5,1v,9,,,2,,,4,,5,,,e,2,2a,i,n,,29,k,6j,7,2,9,r,2,2a,h,2y,d,2t,3,2,a,74,f,6t,6,,2,2,4,,,,2,3x,7,2,7,3,,s,a,14,7,,4,8,,9,b,1a,g,5i,8,5j,8,,8,2a,m,,e,3e,6,3,,,2,,7,,,1u,5,,2,,5,9n,4,9,2,,,1c,7,3,5,n,,44l,,6,f,8ug,i,1xc,5,1n,7,t4,,,1j,7,4,29,,b,2,f57,2,3mp,1a,2,n,f2,5,3,6,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,2s,,4g,7,af,,1p,4,e4,4,72,2,6r,,2,,7,2,5,,d6,7,31,7,240,5".split(",").map(e=>e?parseInt(e,36):1);for(let e=0,t=0;e<n.length;e++)(e%2?Ah:zs).push(t=t+n[e])})();function bd(n){if(n<768)return!1;for(let e=0,t=zs.length;;){let i=e+t>>1;if(n<zs[i])t=i;else if(n>=Ah[i])e=i+1;else return!0;if(e==t)return!1}}function Nl(n){return n>=127462&&n<=127487}const Wl=8205;function xd(n,e,t=!0,i=!0){return(t?Mh:wd)(n,e,i)}function Mh(n,e,t){if(e==n.length)return e;e&&Th(n.charCodeAt(e))&&Dh(n.charCodeAt(e-1))&&e--;let i=fs(n,e);for(e+=Hl(i);e<n.length;){let r=fs(n,e);if(i==Wl||r==Wl||t&&bd(r))e+=Hl(r),i=r;else if(Nl(r)){let s=0,o=e-2;for(;o>=0&&Nl(fs(n,o));)s++,o-=2;if(s%2==0)break;e+=2}else break}return e}function wd(n,e,t){for(;e>1;){let i=Mh(n,e-2,t);if(i<e)return i;e--}return 0}function fs(n,e){let t=n.charCodeAt(e);if(!Dh(t)||e+1==n.length)return t;let i=n.charCodeAt(e+1);return Th(i)?(t-55296<<10)+(i-56320)+65536:t}function Th(n){return n>=56320&&n<57344}function Dh(n){return n>=55296&&n<56320}function Hl(n){return n<65536?1:2}class J{lineAt(e){if(e<0||e>this.length)throw new RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)throw new RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,t,i){[e,t]=Bi(this,e,t);let r=[];return this.decompose(0,e,r,2),i.length&&i.decompose(0,i.length,r,3),this.decompose(t,this.length,r,1),at.from(r,this.length-(t-e)+i.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,t=this.length){[e,t]=Bi(this,e,t);let i=[];return this.decompose(e,t,i,0),at.from(i,t-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let t=this.scanIdentical(e,1),i=this.length-this.scanIdentical(e,-1),r=new Zi(this),s=new Zi(e);for(let o=t,l=t;;){if(r.next(o),s.next(o),o=0,r.lineBreak!=s.lineBreak||r.done!=s.done||r.value!=s.value)return!1;if(l+=r.value.length,r.done||l>=i)return!0}}iter(e=1){return new Zi(this,e)}iterRange(e,t=this.length){return new Oh(this,e,t)}iterLines(e,t){let i;if(e==null)i=this.iter();else{t==null&&(t=this.lines+1);let r=this.line(e).from;i=this.iterRange(r,Math.max(r,t==this.lines+1?this.length:t<=1?0:this.line(t-1).to))}return new Bh(i)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}constructor(){}static of(e){if(e.length==0)throw new RangeError("A document must have at least one line");return e.length==1&&!e[0]?J.empty:e.length<=32?new ue(e):at.from(ue.split(e,[]))}}class ue extends J{constructor(e,t=kd(e)){super(),this.text=e,this.length=t}get lines(){return this.text.length}get children(){return null}lineInner(e,t,i,r){for(let s=0;;s++){let o=this.text[s],l=r+o.length;if((t?i:l)>=e)return new vd(r,l,i,o);r=l+1,i++}}decompose(e,t,i,r){let s=e<=0&&t>=this.length?this:new ue(Vl(this.text,e,t),Math.min(t,this.length)-Math.max(0,e));if(r&1){let o=i.pop(),l=hr(s.text,o.text.slice(),0,s.length);if(l.length<=32)i.push(new ue(l,o.length+s.length));else{let a=l.length>>1;i.push(new ue(l.slice(0,a)),new ue(l.slice(a)))}}else i.push(s)}replace(e,t,i){if(!(i instanceof ue))return super.replace(e,t,i);[e,t]=Bi(this,e,t);let r=hr(this.text,hr(i.text,Vl(this.text,0,e)),t),s=this.length+i.length-(t-e);return r.length<=32?new ue(r,s):at.from(ue.split(r,[]),s)}sliceString(e,t=this.length,i=`
|
|
1
|
+
import{d as ju,L as Uu,w as _u,J as Gu,C as Yu,M as Ju,N as Xu,O as Qu,o as Wn,m as Zu,T as ed,a as td,b as id,e as Dt,Q as nd,n as Ll,g as mi,c as as,i as hs,u as Hn,t as _t,f as rd,ai as sd,S as od,p as El,A as ld,_ as ad}from"./index-_mb4OfYp.js";import{i as hd}from"./theme-BwDBMsKO.js";const cd=1024;let fd=0,cs=class{constructor(e,t){this.from=e,this.to=t}};class U{constructor(e={}){this.id=fd++,this.perNode=!!e.perNode,this.deserialize=e.deserialize||(()=>{throw new Error("This node type doesn't define a deserialize function")}),this.combine=e.combine||null}add(e){if(this.perNode)throw new RangeError("Can't add per-node props to node types");return typeof e!="function"&&(e=Ve.match(e)),t=>{let i=e(t);return i===void 0?null:[this,i]}}}U.closedBy=new U({deserialize:n=>n.split(" ")});U.openedBy=new U({deserialize:n=>n.split(" ")});U.group=new U({deserialize:n=>n.split(" ")});U.isolate=new U({deserialize:n=>{if(n&&n!="rtl"&&n!="ltr"&&n!="auto")throw new RangeError("Invalid value for isolate: "+n);return n||"auto"}});U.contextHash=new U({perNode:!0});U.lookAhead=new U({perNode:!0});U.mounted=new U({perNode:!0});class Qi{constructor(e,t,i,r=!1){this.tree=e,this.overlay=t,this.parser=i,this.bracketed=r}static get(e){return e&&e.props&&e.props[U.mounted.id]}}const ud=Object.create(null);class Ve{constructor(e,t,i,r=0){this.name=e,this.props=t,this.id=i,this.flags=r}static define(e){let t=e.props&&e.props.length?Object.create(null):ud,i=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(e.name==null?8:0),r=new Ve(e.name||"",t,e.id,i);if(e.props){for(let s of e.props)if(Array.isArray(s)||(s=s(r)),s){if(s[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");t[s[0].id]=s[1]}}return r}prop(e){return this.props[e.id]}get isTop(){return(this.flags&1)>0}get isSkipped(){return(this.flags&2)>0}get isError(){return(this.flags&4)>0}get isAnonymous(){return(this.flags&8)>0}is(e){if(typeof e=="string"){if(this.name==e)return!0;let t=this.prop(U.group);return t?t.indexOf(e)>-1:!1}return this.id==e}static match(e){let t=Object.create(null);for(let i in e)for(let r of i.split(" "))t[r]=e[i];return i=>{for(let r=i.prop(U.group),s=-1;s<(r?r.length:0);s++){let o=t[s<0?i.name:r[s]];if(o)return o}}}}Ve.none=new Ve("",Object.create(null),0,8);class Eo{constructor(e){this.types=e;for(let t=0;t<e.length;t++)if(e[t].id!=t)throw new RangeError("Node type ids should correspond to array positions when creating a node set")}extend(...e){let t=[];for(let i of this.types){let r=null;for(let s of e){let o=s(i);if(o){r||(r=Object.assign({},i.props));let l=o[1],a=o[0];a.combine&&a.id in r&&(l=a.combine(r[a.id],l)),r[a.id]=l}}t.push(r?new Ve(i.name,r,i.id,i.flags):i)}return new Eo(t)}}const Vn=new WeakMap,Rl=new WeakMap;var de;(function(n){n[n.ExcludeBuffers=1]="ExcludeBuffers",n[n.IncludeAnonymous=2]="IncludeAnonymous",n[n.IgnoreMounts=4]="IgnoreMounts",n[n.IgnoreOverlays=8]="IgnoreOverlays",n[n.EnterBracketed=16]="EnterBracketed"})(de||(de={}));class ae{constructor(e,t,i,r,s){if(this.type=e,this.children=t,this.positions=i,this.length=r,this.props=null,s&&s.length){this.props=Object.create(null);for(let[o,l]of s)this.props[typeof o=="number"?o:o.id]=l}}toString(){let e=Qi.get(this);if(e&&!e.overlay)return e.tree.toString();let t="";for(let i of this.children){let r=i.toString();r&&(t&&(t+=","),t+=r)}return this.type.name?(/\W/.test(this.type.name)&&!this.type.isError?JSON.stringify(this.type.name):this.type.name)+(t.length?"("+t+")":""):t}cursor(e=0){return new Fs(this.topNode,e)}cursorAt(e,t=0,i=0){let r=Vn.get(this)||this.topNode,s=new Fs(r);return s.moveTo(e,t),Vn.set(this,s._tree),s}get topNode(){return new Ye(this,0,0,null)}resolve(e,t=0){let i=on(Vn.get(this)||this.topNode,e,t,!1);return Vn.set(this,i),i}resolveInner(e,t=0){let i=on(Rl.get(this)||this.topNode,e,t,!0);return Rl.set(this,i),i}resolveStack(e,t=0){return md(this,e,t)}iterate(e){let{enter:t,leave:i,from:r=0,to:s=this.length}=e,o=e.mode||0,l=(o&de.IncludeAnonymous)>0;for(let a=this.cursor(o|de.IncludeAnonymous);;){let h=!1;if(a.from<=s&&a.to>=r&&(!l&&a.type.isAnonymous||t(a)!==!1)){if(a.firstChild())continue;h=!0}for(;h&&i&&(l||!a.type.isAnonymous)&&i(a),!a.nextSibling();){if(!a.parent())return;h=!0}}}prop(e){return e.perNode?this.props?this.props[e.id]:void 0:this.type.prop(e)}get propValues(){let e=[];if(this.props)for(let t in this.props)e.push([+t,this.props[t]]);return e}balance(e={}){return this.children.length<=8?this:Io(Ve.none,this.children,this.positions,0,this.children.length,0,this.length,(t,i,r)=>new ae(this.type,t,i,r,this.propValues),e.makeTree||((t,i,r)=>new ae(Ve.none,t,i,r)))}static build(e){return gd(e)}}ae.empty=new ae(Ve.none,[],[],0);class Ro{constructor(e,t){this.buffer=e,this.index=t}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}get pos(){return this.index}next(){this.index-=4}fork(){return new Ro(this.buffer,this.index)}}class Nt{constructor(e,t,i){this.buffer=e,this.length=t,this.set=i}get type(){return Ve.none}toString(){let e=[];for(let t=0;t<this.buffer.length;)e.push(this.childString(t)),t=this.buffer[t+3];return e.join(",")}childString(e){let t=this.buffer[e],i=this.buffer[e+3],r=this.set.types[t],s=r.name;if(/\W/.test(s)&&!r.isError&&(s=JSON.stringify(s)),e+=4,i==e)return s;let o=[];for(;e<i;)o.push(this.childString(e)),e=this.buffer[e+3];return s+"("+o.join(",")+")"}findChild(e,t,i,r,s){let{buffer:o}=this,l=-1;for(let a=e;a!=t&&!(kh(s,r,o[a+1],o[a+2])&&(l=a,i>0));a=o[a+3]);return l}slice(e,t,i){let r=this.buffer,s=new Uint16Array(t-e),o=0;for(let l=e,a=0;l<t;){s[a++]=r[l++],s[a++]=r[l++]-i;let h=s[a++]=r[l++]-i;s[a++]=r[l++]-e,o=Math.max(o,h)}return new Nt(s,o,this.set)}}function kh(n,e,t,i){switch(n){case-2:return t<e;case-1:return i>=e&&t<e;case 0:return t<e&&i>e;case 1:return t<=e&&i>e;case 2:return i>e;case 4:return!0}}function on(n,e,t,i){for(var r;n.from==n.to||(t<1?n.from>=e:n.from>e)||(t>-1?n.to<=e:n.to<e);){let o=!i&&n instanceof Ye&&n.index<0?null:n.parent;if(!o)return n;n=o}let s=i?0:de.IgnoreOverlays;if(i)for(let o=n,l=o.parent;l;o=l,l=o.parent)o instanceof Ye&&o.index<0&&((r=l.enter(e,t,s))===null||r===void 0?void 0:r.from)!=o.from&&(n=l);for(;;){let o=n.enter(e,t,s);if(!o)return n;n=o}}class vh{cursor(e=0){return new Fs(this,e)}getChild(e,t=null,i=null){let r=Pl(this,e,t,i);return r.length?r[0]:null}getChildren(e,t=null,i=null){return Pl(this,e,t,i)}resolve(e,t=0){return on(this,e,t,!1)}resolveInner(e,t=0){return on(this,e,t,!0)}matchContext(e){return Vs(this.parent,e)}enterUnfinishedNodesBefore(e){let t=this.childBefore(e),i=this;for(;t;){let r=t.lastChild;if(!r||r.to!=t.to)break;r.type.isError&&r.from==r.to?(i=t,t=r.prevSibling):t=r}return i}get node(){return this}get next(){return this.parent}}class Ye extends vh{constructor(e,t,i,r){super(),this._tree=e,this.from=t,this.index=i,this._parent=r}get type(){return this._tree.type}get name(){return this._tree.type.name}get to(){return this.from+this._tree.length}nextChild(e,t,i,r,s=0){for(let o=this;;){for(let{children:l,positions:a}=o._tree,h=t>0?l.length:-1;e!=h;e+=t){let c=l[e],f=a[e]+o.from,u;if(!(!(s&de.EnterBracketed&&c instanceof ae&&(u=Qi.get(c))&&!u.overlay&&u.bracketed&&i>=f&&i<=f+c.length)&&!kh(r,i,f,f+c.length))){if(c instanceof Nt){if(s&de.ExcludeBuffers)continue;let p=c.findChild(0,c.buffer.length,t,i-f,r);if(p>-1)return new Rt(new dd(o,c,e,f),null,p)}else if(s&de.IncludeAnonymous||!c.type.isAnonymous||Po(c)){let p;if(!(s&de.IgnoreMounts)&&(p=Qi.get(c))&&!p.overlay)return new Ye(p.tree,f,e,o);let m=new Ye(c,f,e,o);return s&de.IncludeAnonymous||!m.type.isAnonymous?m:m.nextChild(t<0?c.children.length-1:0,t,i,r,s)}}}if(s&de.IncludeAnonymous||!o.type.isAnonymous||(o.index>=0?e=o.index+t:e=t<0?-1:o._parent._tree.children.length,o=o._parent,!o))return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this._tree.children.length-1,-1,0,4)}childAfter(e){return this.nextChild(0,1,e,2)}childBefore(e){return this.nextChild(this._tree.children.length-1,-1,e,-2)}prop(e){return this._tree.prop(e)}enter(e,t,i=0){let r;if(!(i&de.IgnoreOverlays)&&(r=Qi.get(this._tree))&&r.overlay){let s=e-this.from,o=i&de.EnterBracketed&&r.bracketed;for(let{from:l,to:a}of r.overlay)if((t>0||o?l<=s:l<s)&&(t<0||o?a>=s:a>s))return new Ye(r.tree,r.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,e,t,i)}nextSignificantParent(){let e=this;for(;e.type.isAnonymous&&e._parent;)e=e._parent;return e}get parent(){return this._parent?this._parent.nextSignificantParent():null}get nextSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}get prevSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}get tree(){return this._tree}toTree(){return this._tree}toString(){return this._tree.toString()}}function Pl(n,e,t,i){let r=n.cursor(),s=[];if(!r.firstChild())return s;if(t!=null){for(let o=!1;!o;)if(o=r.type.is(t),!r.nextSibling())return s}for(;;){if(i!=null&&r.type.is(i))return s;if(r.type.is(e)&&s.push(r.node),!r.nextSibling())return i==null?s:[]}}function Vs(n,e,t=e.length-1){for(let i=n;t>=0;i=i.parent){if(!i)return!1;if(!i.type.isAnonymous){if(e[t]&&e[t]!=i.name)return!1;t--}}return!0}class dd{constructor(e,t,i,r){this.parent=e,this.buffer=t,this.index=i,this.start=r}}class Rt extends vh{get name(){return this.type.name}get from(){return this.context.start+this.context.buffer.buffer[this.index+1]}get to(){return this.context.start+this.context.buffer.buffer[this.index+2]}constructor(e,t,i){super(),this.context=e,this._parent=t,this.index=i,this.type=e.buffer.set.types[e.buffer.buffer[i]]}child(e,t,i){let{buffer:r}=this.context,s=r.findChild(this.index+4,r.buffer[this.index+3],e,t-this.context.start,i);return s<0?null:new Rt(this.context,this,s)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(e){return this.child(1,e,2)}childBefore(e){return this.child(-1,e,-2)}prop(e){return this.type.prop(e)}enter(e,t,i=0){if(i&de.ExcludeBuffers)return null;let{buffer:r}=this.context,s=r.findChild(this.index+4,r.buffer[this.index+3],t>0?1:-1,e-this.context.start,t);return s<0?null:new Rt(this.context,this,s)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(e){return this._parent?null:this.context.parent.nextChild(this.context.index+e,e,0,4)}get nextSibling(){let{buffer:e}=this.context,t=e.buffer[this.index+3];return t<(this._parent?e.buffer[this._parent.index+3]:e.buffer.length)?new Rt(this.context,this._parent,t):this.externalSibling(1)}get prevSibling(){let{buffer:e}=this.context,t=this._parent?this._parent.index+4:0;return this.index==t?this.externalSibling(-1):new Rt(this.context,this._parent,e.findChild(t,this.index,-1,0,4))}get tree(){return null}toTree(){let e=[],t=[],{buffer:i}=this.context,r=this.index+4,s=i.buffer[this.index+3];if(s>r){let o=i.buffer[this.index+1];e.push(i.slice(r,s,o)),t.push(0)}return new ae(this.type,e,t,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function Sh(n){if(!n.length)return null;let e=0,t=n[0];for(let s=1;s<n.length;s++){let o=n[s];(o.from>t.from||o.to<t.to)&&(t=o,e=s)}let i=t instanceof Ye&&t.index<0?null:t.parent,r=n.slice();return i?r[e]=i:r.splice(e,1),new pd(r,t)}class pd{constructor(e,t){this.heads=e,this.node=t}get next(){return Sh(this.heads)}}function md(n,e,t){let i=n.resolveInner(e,t),r=null;for(let s=i instanceof Ye?i:i.context.parent;s;s=s.parent)if(s.index<0){let o=s.parent;(r||(r=[i])).push(o.resolve(e,t)),s=o}else{let o=Qi.get(s.tree);if(o&&o.overlay&&o.overlay[0].from<=e&&o.overlay[o.overlay.length-1].to>=e){let l=new Ye(o.tree,o.overlay[0].from+s.from,-1,s);(r||(r=[i])).push(on(l,e,t,!1))}}return r?Sh(r):i}class Fs{get name(){return this.type.name}constructor(e,t=0){if(this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,this.mode=t&~de.EnterBracketed,e instanceof Ye)this.yieldNode(e);else{this._tree=e.context.parent,this.buffer=e.context;for(let i=e._parent;i;i=i._parent)this.stack.unshift(i.index);this.bufferNode=e,this.yieldBuf(e.index)}}yieldNode(e){return e?(this._tree=e,this.type=e.type,this.from=e.from,this.to=e.to,!0):!1}yieldBuf(e,t){this.index=e;let{start:i,buffer:r}=this.buffer;return this.type=t||r.set.types[r.buffer[e]],this.from=i+r.buffer[e+1],this.to=i+r.buffer[e+2],!0}yield(e){return e?e instanceof Ye?(this.buffer=null,this.yieldNode(e)):(this.buffer=e.context,this.yieldBuf(e.index,e.type)):!1}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(e,t,i){if(!this.buffer)return this.yield(this._tree.nextChild(e<0?this._tree._tree.children.length-1:0,e,t,i,this.mode));let{buffer:r}=this.buffer,s=r.findChild(this.index+4,r.buffer[this.index+3],e,t-this.buffer.start,i);return s<0?!1:(this.stack.push(this.index),this.yieldBuf(s))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(e){return this.enterChild(1,e,2)}childBefore(e){return this.enterChild(-1,e,-2)}enter(e,t,i=this.mode){return this.buffer?i&de.ExcludeBuffers?!1:this.enterChild(1,e,t):this.yield(this._tree.enter(e,t,i))}parent(){if(!this.buffer)return this.yieldNode(this.mode&de.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&de.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(e)}sibling(e){if(!this.buffer)return this._tree._parent?this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+e,e,0,4,this.mode)):!1;let{buffer:t}=this.buffer,i=this.stack.length-1;if(e<0){let r=i<0?0:this.stack[i]+4;if(this.index!=r)return this.yieldBuf(t.findChild(r,this.index,-1,0,4))}else{let r=t.buffer[this.index+3];if(r<(i<0?t.buffer.length:t.buffer[this.stack[i]+3]))return this.yieldBuf(r)}return i<0?this.yield(this.buffer.parent.nextChild(this.buffer.index+e,e,0,4,this.mode)):!1}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(e){let t,i,{buffer:r}=this;if(r){if(e>0){if(this.index<r.buffer.buffer.length)return!1}else for(let s=0;s<this.index;s++)if(r.buffer.buffer[s+3]<this.index)return!1;({index:t,parent:i}=r)}else({index:t,_parent:i}=this._tree);for(;i;{index:t,_parent:i}=i)if(t>-1)for(let s=t+e,o=e<0?-1:i._tree.children.length;s!=o;s+=e){let l=i._tree.children[s];if(this.mode&de.IncludeAnonymous||l instanceof Nt||!l.type.isAnonymous||Po(l))return!1}return!0}move(e,t){if(t&&this.enterChild(e,0,4))return!0;for(;;){if(this.sibling(e))return!0;if(this.atLastNode(e)||!this.parent())return!1}}next(e=!0){return this.move(1,e)}prev(e=!0){return this.move(-1,e)}moveTo(e,t=0){for(;(this.from==this.to||(t<1?this.from>=e:this.from>e)||(t>-1?this.to<=e:this.to<e))&&this.parent(););for(;this.enterChild(1,e,t););return this}get node(){if(!this.buffer)return this._tree;let e=this.bufferNode,t=null,i=0;if(e&&e.context==this.buffer)e:for(let r=this.index,s=this.stack.length;s>=0;){for(let o=e;o;o=o._parent)if(o.index==r){if(r==this.index)return o;t=o,i=s+1;break e}r=this.stack[--s]}for(let r=i;r<this.stack.length;r++)t=new Rt(this.buffer,t,this.stack[r]);return this.bufferNode=new Rt(this.buffer,t,this.index)}get tree(){return this.buffer?null:this._tree._tree}iterate(e,t){for(let i=0;;){let r=!1;if(this.type.isAnonymous||e(this)!==!1){if(this.firstChild()){i++;continue}this.type.isAnonymous||(r=!0)}for(;;){if(r&&t&&t(this),r=this.type.isAnonymous,!i)return;if(this.nextSibling())break;this.parent(),i--,r=!0}}}matchContext(e){if(!this.buffer)return Vs(this.node.parent,e);let{buffer:t}=this.buffer,{types:i}=t.set;for(let r=e.length-1,s=this.stack.length-1;r>=0;s--){if(s<0)return Vs(this._tree,e,r);let o=i[t.buffer[this.stack[s]]];if(!o.isAnonymous){if(e[r]&&e[r]!=o.name)return!1;r--}}return!0}}function Po(n){return n.children.some(e=>e instanceof Nt||!e.type.isAnonymous||Po(e))}function gd(n){var e;let{buffer:t,nodeSet:i,maxBufferLength:r=cd,reused:s=[],minRepeatType:o=i.types.length}=n,l=Array.isArray(t)?new Ro(t,t.length):t,a=i.types,h=0,c=0;function f(T,O,w,D,b,Q){let{id:q,start:V,end:_,size:K}=l,X=c,we=h;if(K<0)if(l.next(),K==-1){let W=s[q];w.push(W),D.push(V-T);return}else if(K==-3){h=q;return}else if(K==-4){c=q;return}else throw new RangeError(`Unrecognized record size: ${K}`);let fe=a[q],Oe,ee,H=V-T;if(_-V<=r&&(ee=x(l.pos-O,b))){let W=new Uint16Array(ee.size-ee.skip),z=l.pos-ee.size,te=W.length;for(;l.pos>z;)te=k(ee.start,W,te);Oe=new Nt(W,_-ee.start,i),H=ee.start-T}else{let W=l.pos-K;l.next();let z=[],te=[],yt=q>=o?q:-1,Z=0,ye=_;for(;l.pos>W;)yt>=0&&l.id==yt&&l.size>=0?(l.end<=ye-r&&(m(z,te,V,Z,l.end,ye,yt,X,we),Z=z.length,ye=l.end),l.next()):Q>2500?u(V,W,z,te):f(V,W,z,te,yt,Q+1);if(yt>=0&&Z>0&&Z<z.length&&m(z,te,V,Z,V,ye,yt,X,we),z.reverse(),te.reverse(),yt>-1&&Z>0){let hi=p(fe,we);Oe=Io(fe,z,te,0,z.length,0,_-V,hi,hi)}else Oe=g(fe,z,te,_-V,X-_,we)}w.push(Oe),D.push(H)}function u(T,O,w,D){let b=[],Q=0,q=-1;for(;l.pos>O;){let{id:V,start:_,end:K,size:X}=l;if(X>4)l.next();else{if(q>-1&&_<q)break;q<0&&(q=K-r),b.push(V,_,K),Q++,l.next()}}if(Q){let V=new Uint16Array(Q*4),_=b[b.length-2];for(let K=b.length-3,X=0;K>=0;K-=3)V[X++]=b[K],V[X++]=b[K+1]-_,V[X++]=b[K+2]-_,V[X++]=X;w.push(new Nt(V,b[2]-_,i)),D.push(_-T)}}function p(T,O){return(w,D,b)=>{let Q=0,q=w.length-1,V,_;if(q>=0&&(V=w[q])instanceof ae){if(!q&&V.type==T&&V.length==b)return V;(_=V.prop(U.lookAhead))&&(Q=D[q]+V.length+_)}return g(T,w,D,b,Q,O)}}function m(T,O,w,D,b,Q,q,V,_){let K=[],X=[];for(;T.length>D;)K.push(T.pop()),X.push(O.pop()+w-b);T.push(g(i.types[q],K,X,Q-b,V-Q,_)),O.push(b-w)}function g(T,O,w,D,b,Q,q){if(Q){let V=[U.contextHash,Q];q=q?[V].concat(q):[V]}if(b>25){let V=[U.lookAhead,b];q=q?[V].concat(q):[V]}return new ae(T,O,w,D,q)}function x(T,O){let w=l.fork(),D=0,b=0,Q=0,q=w.end-r,V={size:0,start:0,skip:0};e:for(let _=w.pos-T;w.pos>_;){let K=w.size;if(w.id==O&&K>=0){V.size=D,V.start=b,V.skip=Q,Q+=4,D+=4,w.next();continue}let X=w.pos-K;if(K<0||X<_||w.start<q)break;let we=w.id>=o?4:0,fe=w.start;for(w.next();w.pos>X;){if(w.size<0)if(w.size==-3||w.size==-4)we+=4;else break e;else w.id>=o&&(we+=4);w.next()}b=fe,D+=K,Q+=we}return(O<0||D==T)&&(V.size=D,V.start=b,V.skip=Q),V.size>4?V:void 0}function k(T,O,w){let{id:D,start:b,end:Q,size:q}=l;if(l.next(),q>=0&&D<o){let V=w;if(q>4){let _=l.pos-(q-4);for(;l.pos>_;)w=k(T,O,w)}O[--w]=V,O[--w]=Q-T,O[--w]=b-T,O[--w]=D}else q==-3?h=D:q==-4&&(c=D);return w}let M=[],A=[];for(;l.pos>0;)f(n.start||0,n.bufferStart||0,M,A,-1,0);let I=(e=n.length)!==null&&e!==void 0?e:M.length?A[0]+M[0].length:0;return new ae(a[n.topID],M.reverse(),A.reverse(),I)}const Il=new WeakMap;function ar(n,e){if(!n.isAnonymous||e instanceof Nt||e.type!=n)return 1;let t=Il.get(e);if(t==null){t=1;for(let i of e.children){if(i.type!=n||!(i instanceof ae)){t=1;break}t+=ar(n,i)}Il.set(e,t)}return t}function Io(n,e,t,i,r,s,o,l,a){let h=0;for(let m=i;m<r;m++)h+=ar(n,e[m]);let c=Math.ceil(h*1.5/8),f=[],u=[];function p(m,g,x,k,M){for(let A=x;A<k;){let I=A,T=g[A],O=ar(n,m[A]);for(A++;A<k;A++){let w=ar(n,m[A]);if(O+w>=c)break;O+=w}if(A==I+1){if(O>c){let w=m[I];p(w.children,w.positions,0,w.children.length,g[I]+M);continue}f.push(m[I])}else{let w=g[A-1]+m[A-1].length-T;f.push(Io(n,m,g,I,A,T,w,null,a))}u.push(T+M-s)}}return p(e,t,i,r,0),(l||a)(f,u,o)}class ei{constructor(e,t,i,r,s=!1,o=!1){this.from=e,this.to=t,this.tree=i,this.offset=r,this.open=(s?1:0)|(o?2:0)}get openStart(){return(this.open&1)>0}get openEnd(){return(this.open&2)>0}static addTree(e,t=[],i=!1){let r=[new ei(0,e.length,e,0,!1,i)];for(let s of t)s.to>e.length&&r.push(s);return r}static applyChanges(e,t,i=128){if(!t.length)return e;let r=[],s=1,o=e.length?e[0]:null;for(let l=0,a=0,h=0;;l++){let c=l<t.length?t[l]:null,f=c?c.fromA:1e9;if(f-a>=i)for(;o&&o.from<f;){let u=o;if(a>=u.from||f<=u.to||h){let p=Math.max(u.from,a)-h,m=Math.min(u.to,f)-h;u=p>=m?null:new ei(p,m,u.tree,u.offset+h,l>0,!!c)}if(u&&r.push(u),o.to>f)break;o=s<e.length?e[s++]:null}if(!c)break;a=c.toA,h=c.toA-c.toB}return r}}class Ch{startParse(e,t,i){return typeof e=="string"&&(e=new yd(e)),i=i?i.length?i.map(r=>new cs(r.from,r.to)):[new cs(0,0)]:[new cs(0,e.length)],this.createParse(e,t||[],i)}parse(e,t,i){let r=this.startParse(e,t,i);for(;;){let s=r.advance();if(s)return s}}}class yd{constructor(e){this.string=e}get length(){return this.string.length}chunk(e){return this.string.slice(e)}get lineChunks(){return!1}read(e,t){return this.string.slice(e,t)}}new U({perNode:!0});let zs=[],Ah=[];(()=>{let n="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,1n,9,16,o,,x,1i,3,,i,,7,a,2,t,3,1k,,,7,2,2,2,3,9,,a,2,q,,2,3,1k,,,5,4,2,2,3,3,,u,2,3,,b,3,1k,,,8,,3,,3,k,2,m,6,,3,1k,,,7,2,2,2,3,7,3,a,2,u,,1n,5,3,3,,4,9,,14,5,1j,,,7,,3,,4,7,2,b,2,t,3,1k,,,7,,3,,4,7,2,b,2,f,,c,4,1j,2,,7,,3,,4,9,,a,2,t,3,1y,,4,6,,,,8,i,2,1p,,,8,c,8,2q,,,a,b,7,21,2,r,,,,,,4,2,1d,k,,2,5,b,,10,9,,2u,b,,6,n,4,4,3,g,4,d,,,3,6,,f,,jj,3,qa,4,s,3,t,2,u,2,1s,w,9,,19,3,,,39,2,y,,3a,c,4,c,63,5,1l,a,,,,,2,o,2,,1c,1a,2,c,k,5,1b,h,12,9,c,3,u,d,1k,e,1c,k,48,3,,l,4,,6,,2,3,5i,1s,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,n,5,4,,2b,2,1e,i,q,i,d,,12,8,p,d,18,4,1b,e,10,,1v,e,c,,8,2,1a,,1f,,,3,2,2,5,2,,,15,5,5,2,6k,8,,2,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,1t,5,8t,2,25,6,1y,b,1d,4,3e,3,1h,f,15,,2,2,a,4,19,b,7,,1p,3,10,e,g,2,18,,c,3,1c,e,8,4,,2,2k,c,6,,2,,4d,c,l,4,1j,2,,7,2,2,2,3,9,,a,2,2,7,3,5,1v,9,,,2,,,4,,5,,,e,2,2a,i,n,,29,k,6j,7,2,9,r,2,2a,h,2y,d,2t,3,2,a,74,f,6t,6,,2,2,4,,,,2,3x,7,2,7,3,,s,a,14,7,,4,8,,9,b,1a,g,5i,8,5j,8,,8,2a,m,,e,3e,6,3,,,2,,7,,,1u,5,,2,,5,9n,4,9,2,,,1c,7,3,5,n,,44l,,6,f,8ug,i,1xc,5,1n,7,t4,,,1j,7,4,29,,b,2,f57,2,3mp,1a,2,n,f2,5,3,6,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,2s,,4g,7,af,,1p,4,e4,4,72,2,6r,,2,,7,2,5,,d6,7,31,7,240,5".split(",").map(e=>e?parseInt(e,36):1);for(let e=0,t=0;e<n.length;e++)(e%2?Ah:zs).push(t=t+n[e])})();function bd(n){if(n<768)return!1;for(let e=0,t=zs.length;;){let i=e+t>>1;if(n<zs[i])t=i;else if(n>=Ah[i])e=i+1;else return!0;if(e==t)return!1}}function Nl(n){return n>=127462&&n<=127487}const Wl=8205;function xd(n,e,t=!0,i=!0){return(t?Mh:wd)(n,e,i)}function Mh(n,e,t){if(e==n.length)return e;e&&Th(n.charCodeAt(e))&&Dh(n.charCodeAt(e-1))&&e--;let i=fs(n,e);for(e+=Hl(i);e<n.length;){let r=fs(n,e);if(i==Wl||r==Wl||t&&bd(r))e+=Hl(r),i=r;else if(Nl(r)){let s=0,o=e-2;for(;o>=0&&Nl(fs(n,o));)s++,o-=2;if(s%2==0)break;e+=2}else break}return e}function wd(n,e,t){for(;e>1;){let i=Mh(n,e-2,t);if(i<e)return i;e--}return 0}function fs(n,e){let t=n.charCodeAt(e);if(!Dh(t)||e+1==n.length)return t;let i=n.charCodeAt(e+1);return Th(i)?(t-55296<<10)+(i-56320)+65536:t}function Th(n){return n>=56320&&n<57344}function Dh(n){return n>=55296&&n<56320}function Hl(n){return n<65536?1:2}class J{lineAt(e){if(e<0||e>this.length)throw new RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)throw new RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,t,i){[e,t]=Bi(this,e,t);let r=[];return this.decompose(0,e,r,2),i.length&&i.decompose(0,i.length,r,3),this.decompose(t,this.length,r,1),at.from(r,this.length-(t-e)+i.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,t=this.length){[e,t]=Bi(this,e,t);let i=[];return this.decompose(e,t,i,0),at.from(i,t-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let t=this.scanIdentical(e,1),i=this.length-this.scanIdentical(e,-1),r=new Zi(this),s=new Zi(e);for(let o=t,l=t;;){if(r.next(o),s.next(o),o=0,r.lineBreak!=s.lineBreak||r.done!=s.done||r.value!=s.value)return!1;if(l+=r.value.length,r.done||l>=i)return!0}}iter(e=1){return new Zi(this,e)}iterRange(e,t=this.length){return new Oh(this,e,t)}iterLines(e,t){let i;if(e==null)i=this.iter();else{t==null&&(t=this.lines+1);let r=this.line(e).from;i=this.iterRange(r,Math.max(r,t==this.lines+1?this.length:t<=1?0:this.line(t-1).to))}return new Bh(i)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}constructor(){}static of(e){if(e.length==0)throw new RangeError("A document must have at least one line");return e.length==1&&!e[0]?J.empty:e.length<=32?new ue(e):at.from(ue.split(e,[]))}}class ue extends J{constructor(e,t=kd(e)){super(),this.text=e,this.length=t}get lines(){return this.text.length}get children(){return null}lineInner(e,t,i,r){for(let s=0;;s++){let o=this.text[s],l=r+o.length;if((t?i:l)>=e)return new vd(r,l,i,o);r=l+1,i++}}decompose(e,t,i,r){let s=e<=0&&t>=this.length?this:new ue(Vl(this.text,e,t),Math.min(t,this.length)-Math.max(0,e));if(r&1){let o=i.pop(),l=hr(s.text,o.text.slice(),0,s.length);if(l.length<=32)i.push(new ue(l,o.length+s.length));else{let a=l.length>>1;i.push(new ue(l.slice(0,a)),new ue(l.slice(a)))}}else i.push(s)}replace(e,t,i){if(!(i instanceof ue))return super.replace(e,t,i);[e,t]=Bi(this,e,t);let r=hr(this.text,hr(i.text,Vl(this.text,0,e)),t),s=this.length+i.length-(t-e);return r.length<=32?new ue(r,s):at.from(ue.split(r,[]),s)}sliceString(e,t=this.length,i=`
|
|
2
2
|
`){[e,t]=Bi(this,e,t);let r="";for(let s=0,o=0;s<=t&&o<this.text.length;o++){let l=this.text[o],a=s+l.length;s>e&&o&&(r+=i),e<a&&t>s&&(r+=l.slice(Math.max(0,e-s),t-s)),s=a+1}return r}flatten(e){for(let t of this.text)e.push(t)}scanIdentical(){return 0}static split(e,t){let i=[],r=-1;for(let s of e)i.push(s),r+=s.length+1,i.length==32&&(t.push(new ue(i,r)),i=[],r=-1);return r>-1&&t.push(new ue(i,r)),t}}class at extends J{constructor(e,t){super(),this.children=e,this.length=t,this.lines=0;for(let i of e)this.lines+=i.lines}lineInner(e,t,i,r){for(let s=0;;s++){let o=this.children[s],l=r+o.length,a=i+o.lines-1;if((t?a:l)>=e)return o.lineInner(e,t,i,r);r=l+1,i=a+1}}decompose(e,t,i,r){for(let s=0,o=0;o<=t&&s<this.children.length;s++){let l=this.children[s],a=o+l.length;if(e<=a&&t>=o){let h=r&((o<=e?1:0)|(a>=t?2:0));o>=e&&a<=t&&!h?i.push(l):l.decompose(e-o,t-o,i,h)}o=a+1}}replace(e,t,i){if([e,t]=Bi(this,e,t),i.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&&t<=l){let a=o.replace(e-s,t-s,i),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 at(c,this.length-(t-e)+i.length)}return super.replace(s,l,a)}s=l+1}return super.replace(e,t,i)}sliceString(e,t=this.length,i=`
|
|
3
3
|
`){[e,t]=Bi(this,e,t);let r="";for(let s=0,o=0;s<this.children.length&&o<=t;s++){let l=this.children[s],a=o+l.length;o>e&&s&&(r+=i),e<a&&t>o&&(r+=l.sliceString(e-o,t-o,i)),o=a+1}return r}flatten(e){for(let t of this.children)t.flatten(e)}scanIdentical(e,t){if(!(e instanceof at))return 0;let i=0,[r,s,o,l]=t>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;r+=t,s+=t){if(r==o||s==l)return i;let a=this.children[r],h=e.children[s];if(a!=h)return i+a.scanIdentical(h,t);i+=a.length+1}}static from(e,t=e.reduce((i,r)=>i+r.length+1,-1)){let i=0;for(let p of e)i+=p.lines;if(i<32){let p=[];for(let m of e)m.flatten(p);return new ue(p,t)}let r=Math.max(32,i>>5),s=r<<1,o=r>>1,l=[],a=0,h=-1,c=[];function f(p){let m;if(p.lines>s&&p instanceof at)for(let g of p.children)f(g);else p.lines>o&&(a>o||!a)?(u(),l.push(p)):p instanceof ue&&a&&(m=c[c.length-1])instanceof ue&&p.lines+m.lines<=32?(a+=p.lines,h+=p.length+1,c[c.length-1]=new ue(m.text.concat(p.text),m.length+1+p.length)):(a+p.lines>r&&u(),a+=p.lines,h+=p.length+1,c.push(p))}function u(){a!=0&&(l.push(c.length==1?c[0]:at.from(c,h)),h=-1,a=c.length=0)}for(let p of e)f(p);return u(),l.length==1?l[0]:new at(l,t)}}J.empty=new ue([""],0);function kd(n){let e=-1;for(let t of n)e+=t.length+1;return e}function hr(n,e,t=0,i=1e9){for(let r=0,s=0,o=!0;s<n.length&&r<=i;s++){let l=n[s],a=r+l.length;a>=t&&(a>i&&(l=l.slice(0,i-r)),r<t&&(l=l.slice(t-r)),o?(e[e.length-1]+=l,o=!1):e.push(l)),r=a+1}return e}function Vl(n,e,t){return hr(n,[""],e,t)}class Zi{constructor(e,t=1){this.dir=t,this.done=!1,this.lineBreak=!1,this.value="",this.nodes=[e],this.offsets=[t>0?1:(e instanceof ue?e.text.length:e.children.length)<<1]}nextInner(e,t){for(this.done=this.lineBreak=!1;;){let i=this.nodes.length-1,r=this.nodes[i],s=this.offsets[i],o=s>>1,l=r instanceof ue?r.text.length:r.children.length;if(o==(t>0?l:0)){if(i==0)return this.done=!0,this.value="",this;t>0&&this.offsets[i-1]++,this.nodes.pop(),this.offsets.pop()}else if((s&1)==(t>0?0:1)){if(this.offsets[i]+=t,e==0)return this.lineBreak=!0,this.value=`
|
|
4
4
|
`,this;e--}else if(r instanceof ue){let a=r.text[o+(t<0?-1:0)];if(this.offsets[i]+=t,a.length>Math.max(0,e))return this.value=e==0?a:t>0?a.slice(e):a.slice(0,a.length-e),this;e-=a.length}else{let a=r.children[o+(t<0?-1:0)];e>a.length?(e-=a.length,this.offsets[i]+=t):(t<0&&this.offsets[i]--,this.nodes.push(a),this.offsets.push(t>0?1:(a instanceof ue?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)}}class Oh{constructor(e,t,i){this.value="",this.done=!1,this.cursor=new Zi(e,t>i?-1:1),this.pos=t>i?e.length:0,this.from=Math.min(t,i),this.to=Math.max(t,i)}nextInner(e,t){if(t<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;e+=Math.max(0,t<0?this.pos-this.to:this.from-this.pos);let i=t<0?this.pos-this.from:this.to-this.pos;e>i&&(e=i),i-=e;let{value:r}=this.cursor.next(e);return this.pos+=(r.length+e)*t,this.value=r.length<=i?r:t<0?r.slice(r.length-i):r.slice(0,i),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!=""}}class Bh{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:t,lineBreak:i,value:r}=this.inner.next(e);return t&&this.afterBreak?(this.value="",this.afterBreak=!1):t?(this.done=!0,this.value=""):i?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=r,this.afterBreak=!1),this}get lineBreak(){return!1}}typeof Symbol<"u"&&(J.prototype[Symbol.iterator]=function(){return this.iter()},Zi.prototype[Symbol.iterator]=Oh.prototype[Symbol.iterator]=Bh.prototype[Symbol.iterator]=function(){return this});class vd{constructor(e,t,i,r){this.from=e,this.to=t,this.number=i,this.text=r}get length(){return this.to-this.from}}function Bi(n,e,t){return e=Math.max(0,Math.min(n.length,e)),[e,Math.max(e,Math.min(n.length,t))]}function xe(n,e,t=!0,i=!0){return xd(n,e,t,i)}function Sd(n){return n>=56320&&n<57344}function Cd(n){return n>=55296&&n<56320}function Pe(n,e){let t=n.charCodeAt(e);if(!Cd(t)||e+1==n.length)return t;let i=n.charCodeAt(e+1);return Sd(i)?(t-55296<<10)+(i-56320)+65536:t}function No(n){return n<=65535?String.fromCharCode(n):(n-=65536,String.fromCharCode((n>>10)+55296,(n&1023)+56320))}function ht(n){return n<65536?1:2}const qs=/\r\n?|\n/;var Le=(function(n){return n[n.Simple=0]="Simple",n[n.TrackDel=1]="TrackDel",n[n.TrackBefore=2]="TrackBefore",n[n.TrackAfter=3]="TrackAfter",n})(Le||(Le={}));class pt{constructor(e){this.sections=e}get length(){let e=0;for(let t=0;t<this.sections.length;t+=2)e+=this.sections[t];return e}get newLength(){let e=0;for(let t=0;t<this.sections.length;t+=2){let i=this.sections[t+1];e+=i<0?this.sections[t]:i}return e}get empty(){return this.sections.length==0||this.sections.length==2&&this.sections[1]<0}iterGaps(e){for(let t=0,i=0,r=0;t<this.sections.length;){let s=this.sections[t++],o=this.sections[t++];o<0?(e(i,r,s),r+=s):r+=o,i+=s}}iterChangedRanges(e,t=!1){$s(this,e,t)}get invertedDesc(){let e=[];for(let t=0;t<this.sections.length;){let i=this.sections[t++],r=this.sections[t++];r<0?e.push(i,r):e.push(r,i)}return new pt(e)}composeDesc(e){return this.empty?e:e.empty?this:Lh(this,e)}mapDesc(e,t=!1){return e.empty?this:Ks(this,e,t)}mapPos(e,t=-1,i=Le.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(i!=Le.Simple&&h>=e&&(i==Le.TrackDel&&r<e&&h>e||i==Le.TrackBefore&&r<e||i==Le.TrackAfter&&h>e))return null;if(h>e||h==e&&t<0&&!l)return e==r||t<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,t=e){for(let i=0,r=0;i<this.sections.length&&r<=t;){let s=this.sections[i++],o=this.sections[i++],l=r+s;if(o>=0&&r<=t&&l>=e)return r<e&&l>t?"cover":!0;r=l}return!1}toString(){let e="";for(let t=0;t<this.sections.length;){let i=this.sections[t++],r=this.sections[t++];e+=(e?" ":"")+i+(r>=0?":"+r:"")}return e}toJSON(){return this.sections}static fromJSON(e){if(!Array.isArray(e)||e.length%2||e.some(t=>typeof t!="number"))throw new RangeError("Invalid JSON representation of ChangeDesc");return new pt(e)}static create(e){return new pt(e)}}class me extends pt{constructor(e,t){super(e),this.inserted=t}apply(e){if(this.length!=e.length)throw new RangeError("Applying change set to a document with the wrong length");return $s(this,(t,i,r,s,o)=>e=e.replace(r,r+(i-t),o),!1),e}mapDesc(e,t=!1){return Ks(this,e,t,!0)}invert(e){let t=this.sections.slice(),i=[];for(let r=0,s=0;r<t.length;r+=2){let o=t[r],l=t[r+1];if(l>=0){t[r]=l,t[r+1]=o;let a=r>>1;for(;i.length<a;)i.push(J.empty);i.push(o?e.slice(s,s+o):J.empty)}s+=o}return new me(t,i)}compose(e){return this.empty?e:e.empty?this:Lh(this,e,!0)}map(e,t=!1){return e.empty?this:Ks(this,e,t,!0)}iterChanges(e,t=!1){$s(this,e,t)}get desc(){return pt.create(this.sections)}filter(e){let t=[],i=[],r=[],s=new ln(this);e:for(let o=0,l=0;;){let a=o==e.length?1e9:e[o++];for(;l<a||l==a&&s.len==0;){if(s.done)break e;let c=Math.min(s.len,a-l);Ae(r,c,-1);let f=s.ins==-1?-1:s.off==0?s.ins:0;Ae(t,c,f),f>0&&Pt(i,t,s.text),s.forward(c),l+=c}let h=e[o++];for(;l<h;){if(s.done)break e;let c=Math.min(s.len,h-l);Ae(t,c,-1),Ae(r,c,s.ins==-1?-1:s.off==0?s.ins:0),s.forward(c),l+=c}}return{changes:new me(t,i),filtered:pt.create(r)}}toJSON(){let e=[];for(let t=0;t<this.sections.length;t+=2){let i=this.sections[t],r=this.sections[t+1];r<0?e.push(i):r==0?e.push([i]):e.push([i].concat(this.inserted[t>>1].toJSON()))}return e}static of(e,t,i){let r=[],s=[],o=0,l=null;function a(c=!1){if(!c&&!r.length)return;o<t&&Ae(r,t-o,-1);let f=new me(r,s);l=l?l.compose(f.map(l)):f,r=[],s=[],o=0}function h(c){if(Array.isArray(c))for(let f of c)h(f);else if(c instanceof me){if(c.length!=t)throw new RangeError(`Mismatched change set length (got ${c.length}, expected ${t})`);a(),l=l?l.compose(c.map(l)):c}else{let{from:f,to:u=f,insert:p}=c;if(f>u||f<0||u>t)throw new RangeError(`Invalid change range ${f} to ${u} (in doc of length ${t})`);let m=p?typeof p=="string"?J.of(p.split(i||qs)):p:J.empty,g=m.length;if(f==u&&g==0)return;f<o&&a(),f>o&&Ae(r,f-o,-1),Ae(r,u-f,g),Pt(s,r,m),o=u}}return h(e),a(!l),l}static empty(e){return new me(e?[e,-1]:[],[])}static fromJSON(e){if(!Array.isArray(e))throw new RangeError("Invalid JSON representation of ChangeSet");let t=[],i=[];for(let r=0;r<e.length;r++){let s=e[r];if(typeof s=="number")t.push(s,-1);else{if(!Array.isArray(s)||typeof s[0]!="number"||s.some((o,l)=>l&&typeof o!="string"))throw new RangeError("Invalid JSON representation of ChangeSet");if(s.length==1)t.push(s[0],0);else{for(;i.length<r;)i.push(J.empty);i[r]=J.of(s.slice(1)),t.push(s[0],i[r].length)}}}return new me(t,i)}static createSet(e,t){return new me(e,t)}}function Ae(n,e,t,i=!1){if(e==0&&t<=0)return;let r=n.length-2;r>=0&&t<=0&&t==n[r+1]?n[r]+=e:r>=0&&e==0&&n[r]==0?n[r+1]+=t:i?(n[r]+=e,n[r+1]+=t):n.push(e,t)}function Pt(n,e,t){if(t.length==0)return;let i=e.length-2>>1;if(i<n.length)n[n.length-1]=n[n.length-1].append(t);else{for(;n.length<i;)n.push(J.empty);n.push(t)}}function $s(n,e,t){let i=n.inserted;for(let r=0,s=0,o=0;o<n.sections.length;){let l=n.sections[o++],a=n.sections[o++];if(a<0)r+=l,s+=l;else{let h=r,c=s,f=J.empty;for(;h+=l,c+=a,a&&i&&(f=f.append(i[o-2>>1])),!(t||o==n.sections.length||n.sections[o+1]<0);)l=n.sections[o++],a=n.sections[o++];e(r,h,s,c,f),r=h,s=c}}}function Ks(n,e,t,i=!1){let r=[],s=i?[]:null,o=new ln(n),l=new ln(e);for(let a=-1;;){if(o.done&&l.len||l.done&&o.len)throw new Error("Mismatched change set lengths");if(o.ins==-1&&l.ins==-1){let h=Math.min(o.len,l.len);Ae(r,h,-1),o.forward(h),l.forward(h)}else if(l.ins>=0&&(o.ins<0||a==o.i||o.off==0&&(l.len<o.len||l.len==o.len&&!t))){let h=l.len;for(Ae(r,l.ins,-1);h;){let c=Math.min(o.len,h);o.ins>=0&&a<o.i&&o.len<=c&&(Ae(r,0,o.ins),s&&Pt(s,r,o.text),a=o.i),o.forward(c),h-=c}l.next()}else if(o.ins>=0){let h=0,c=o.len;for(;c;)if(l.ins==-1){let f=Math.min(c,l.len);h+=f,c-=f,l.forward(f)}else if(l.ins==0&&l.len<c)c-=l.len,l.next();else break;Ae(r,h,a<o.i?o.ins:0),s&&a<o.i&&Pt(s,r,o.text),a=o.i,o.forward(o.len-c)}else{if(o.done&&l.done)return s?me.createSet(r,s):pt.create(r);throw new Error("Mismatched change set lengths")}}}function Lh(n,e,t=!1){let i=[],r=t?[]:null,s=new ln(n),o=new ln(e);for(let l=!1;;){if(s.done&&o.done)return r?me.createSet(i,r):pt.create(i);if(s.ins==0)Ae(i,s.len,0,l),s.next();else if(o.len==0&&!o.done)Ae(i,0,o.ins,l),r&&Pt(r,i,o.text),o.next();else{if(s.done||o.done)throw new Error("Mismatched change set lengths");{let a=Math.min(s.len2,o.len),h=i.length;if(s.ins==-1){let c=o.ins==-1?-1:o.off?0:o.ins;Ae(i,a,c,l),r&&c&&Pt(r,i,o.text)}else o.ins==-1?(Ae(i,s.off?0:s.len,a,l),r&&Pt(r,i,s.textBit(a))):(Ae(i,s.off?0:s.len,o.off?0:o.ins,l),r&&!o.off&&Pt(r,i,o.text));l=(s.ins>a||o.ins>=0&&o.len>a)&&(l||i.length>h),s.forward2(a),o.forward(a)}}}}class ln{constructor(e){this.set=e,this.i=0,this.next()}next(){let{sections:e}=this.set;this.i<e.length?(this.len=e[this.i++],this.ins=e[this.i++]):(this.len=0,this.ins=-2),this.off=0}get done(){return this.ins==-2}get len2(){return this.ins<0?this.len:this.ins}get text(){let{inserted:e}=this.set,t=this.i-2>>1;return t>=e.length?J.empty:e[t]}textBit(e){let{inserted:t}=this.set,i=this.i-2>>1;return i>=t.length&&!e?J.empty:t[i].slice(this.off,e==null?void 0:this.off+e)}forward(e){e==this.len?this.next():(this.len-=e,this.off+=e)}forward2(e){this.ins==-1?this.forward(e):e==this.ins?this.next():(this.ins-=e,this.off+=e)}}class Lt{constructor(e,t,i,r){this.from=e,this.to=t,this.flags=i,this.goalColumn=r}get anchor(){return this.flags&32?this.to:this.from}get head(){return this.flags&32?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return this.flags&8?-1:this.flags&16?1:0}get undirectional(){return(this.flags&64)>0}get bidiLevel(){let e=this.flags&7;return e==7?null:e}map(e,t=-1){let i,r;return this.empty?i=r=e.mapPos(this.from,t):(i=e.mapPos(this.from,1),r=e.mapPos(this.to,-1)),i==this.from&&r==this.to?this:new Lt(i,r,this.flags,this.goalColumn)}extend(e,t=e,i=0){if(e<=this.anchor&&t>=this.anchor)return C.range(e,t,void 0,void 0,i);let r=Math.abs(e-this.anchor)>Math.abs(t-this.anchor)?e:t;return C.range(this.anchor,r,void 0,void 0,i)}eq(e,t=!1){return this.anchor==e.anchor&&this.head==e.head&&this.goalColumn==e.goalColumn&&(!t||!this.empty||this.assoc==e.assoc)}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(e){if(!e||typeof e.anchor!="number"||typeof e.head!="number")throw new RangeError("Invalid JSON representation for SelectionRange");return C.range(e.anchor,e.head)}static create(e,t,i,r){return new Lt(e,t,i,r)}}class C{constructor(e,t){this.ranges=e,this.mainIndex=t}map(e,t=-1){return e.empty?this:C.create(this.ranges.map(i=>i.map(e,t)),this.mainIndex)}eq(e,t=!1){if(this.ranges.length!=e.ranges.length||this.mainIndex!=e.mainIndex)return!1;for(let i=0;i<this.ranges.length;i++)if(!this.ranges[i].eq(e.ranges[i],t))return!1;return!0}get main(){return this.ranges[this.mainIndex]}asSingle(){return this.ranges.length==1?this:new C([this.main],0)}addRange(e,t=!0){return C.create([e].concat(this.ranges),t?0:this.mainIndex+1)}replaceRange(e,t=this.mainIndex){let i=this.ranges.slice();return i[t]=e,C.create(i,this.mainIndex)}toJSON(){return{ranges:this.ranges.map(e=>e.toJSON()),main:this.mainIndex}}static fromJSON(e){if(!e||!Array.isArray(e.ranges)||typeof e.main!="number"||e.main>=e.ranges.length)throw new RangeError("Invalid JSON representation for EditorSelection");return new C(e.ranges.map(t=>Lt.fromJSON(t)),e.main)}static single(e,t=e){return new C([C.range(e,t)],0)}static create(e,t=0){if(e.length==0)throw new RangeError("A selection needs at least one range");for(let i=0,r=0;r<e.length;r++){let s=e[r];if(s.empty?s.from<=i:s.from<i)return C.normalized(e.slice(),t);i=s.to}return new C(e,t)}static cursor(e,t=0,i,r){return Lt.create(e,e,(t==0?0:t<0?8:16)|(i==null?7:Math.min(6,i)),r)}static range(e,t,i,r,s){let o=r==null?7:Math.min(6,r);return!s&&e!=t&&(s=t<e?1:-1),s&&(o|=s<0?8:16),t<e?Lt.create(t,e,o|32,i):Lt.create(e,t,o,i)}static undirectionalRange(e,t){return Lt.create(e,t,64,void 0)}static normalized(e,t=0){let i=e[t];e.sort((r,s)=>r.from-s.from),t=e.indexOf(i);for(let r=1;r<e.length;r++){let s=e[r],o=e[r-1];if(s.empty?s.from<=o.to:s.from<o.to){let l=o.from,a=Math.max(s.to,o.to);r<=t&&t--,e.splice(--r,2,s.anchor>s.head?C.range(a,l):C.range(l,a))}}return new C(e,t)}}function Eh(n,e){for(let t of n.ranges)if(t.to>e)throw new RangeError("Selection points outside of document")}let Wo=0;class R{constructor(e,t,i,r,s){this.combine=e,this.compareInput=t,this.compare=i,this.isStatic=r,this.id=Wo++,this.default=e([]),this.extensions=typeof s=="function"?s(this):s}get reader(){return this}static define(e={}){return new R(e.combine||(t=>t),e.compareInput||((t,i)=>t===i),e.compare||(e.combine?(t,i)=>t===i:Ho),!!e.static,e.enables)}of(e){return new cr([],this,0,e)}compute(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new cr(e,this,1,t)}computeN(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new cr(e,this,2,t)}from(e,t){return t||(t=i=>i),this.compute([e],i=>t(i.field(e)))}}function Ho(n,e){return n==e||n.length==e.length&&n.every((t,i)=>t===e[i])}class cr{constructor(e,t,i,r){this.dependencies=e,this.facet=t,this.type=i,this.value=r,this.id=Wo++}dynamicSlot(e){var t;let i=this.value,r=this.facet.compareInput,s=this.id,o=e[s]>>1,l=this.type==2,a=!1,h=!1,c=[];for(let f of this.dependencies)f=="doc"?a=!0:f=="selection"?h=!0:(((t=e[f.id])!==null&&t!==void 0?t:1)&1)==0&&c.push(e[f.id]);return{create(f){return f.values[o]=i(f),1},update(f,u){if(a&&u.docChanged||h&&(u.docChanged||u.selection)||js(f,c)){let p=i(f);if(l?!Fl(p,f.values[o],r):!r(p,f.values[o]))return f.values[o]=p,1}return 0},reconfigure:(f,u)=>{let p,m=u.config.address[s];if(m!=null){let g=xr(u,m);if(this.dependencies.every(x=>x instanceof R?u.facet(x)===f.facet(x):x instanceof Te?u.field(x,!1)==f.field(x,!1):!0)||(l?Fl(p=i(f),g,r):r(p=i(f),g)))return f.values[o]=g,0}else p=i(f);return f.values[o]=p,1}}}get extension(){return this}}function Fl(n,e,t){if(n.length!=e.length)return!1;for(let i=0;i<n.length;i++)if(!t(n[i],e[i]))return!1;return!0}function js(n,e){let t=!1;for(let i of e)en(n,i)&1&&(t=!0);return t}function Ad(n,e,t){let i=t.map(a=>n[a.id]),r=t.map(a=>a.type),s=i.filter(a=>!(a&1)),o=n[e.id]>>1;function l(a){let h=[];for(let c=0;c<i.length;c++){let f=xr(a,i[c]);if(r[c]==2)for(let u of f)h.push(u);else h.push(f)}return e.combine(h)}return{create(a){for(let h of i)en(a,h);return a.values[o]=l(a),1},update(a,h){if(!js(a,s))return 0;let c=l(a);return e.compare(c,a.values[o])?0:(a.values[o]=c,1)},reconfigure(a,h){let c=js(a,i),f=h.config.facets[e.id],u=h.facet(e);if(f&&!c&&Ho(t,f))return a.values[o]=u,0;let p=l(a);return e.compare(p,u)?(a.values[o]=u,0):(a.values[o]=p,1)}}}const Fn=R.define({static:!0});class Te{constructor(e,t,i,r,s){this.id=e,this.createF=t,this.updateF=i,this.compareF=r,this.spec=s,this.provides=void 0}static define(e){let t=new Te(Wo++,e.create,e.update,e.compare||((i,r)=>i===r),e);return e.provide&&(t.provides=e.provide(t)),t}create(e){let t=e.facet(Fn).find(i=>i.field==this);return(t?.create||this.createF)(e)}slot(e){let t=e[this.id]>>1;return{create:i=>(i.values[t]=this.create(i),1),update:(i,r)=>{let s=i.values[t],o=this.updateF(s,r);return this.compareF(s,o)?0:(i.values[t]=o,1)},reconfigure:(i,r)=>{let s=i.facet(Fn),o=r.facet(Fn),l;return(l=s.find(a=>a.field==this))&&l!=o.find(a=>a.field==this)?(i.values[t]=l.create(i),1):r.config.address[this.id]!=null?(i.values[t]=r.field(this),0):(i.values[t]=this.create(i),1)}}}init(e){return[this,Fn.of({field:this,create:e})]}get extension(){return this}}const Jt={lowest:4,low:3,default:2,high:1,highest:0};function Ki(n){return e=>new Rh(e,n)}const ai={highest:Ki(Jt.highest),high:Ki(Jt.high),default:Ki(Jt.default),low:Ki(Jt.low),lowest:Ki(Jt.lowest)};class Rh{constructor(e,t){this.inner=e,this.prec=t}get extension(){return this}}class zr{of(e){return new Us(this,e)}reconfigure(e){return zr.reconfigure.of({compartment:this,extension:e})}get(e){return e.config.compartments.get(this)}}class Us{constructor(e,t){this.compartment=e,this.inner=t}get extension(){return this}}class br{constructor(e,t,i,r,s,o){for(this.base=e,this.compartments=t,this.dynamicSlots=i,this.address=r,this.staticValues=s,this.facets=o,this.statusTemplate=[];this.statusTemplate.length<i.length;)this.statusTemplate.push(0)}staticFacet(e){let t=this.address[e.id];return t==null?e.default:this.staticValues[t>>1]}static resolve(e,t,i){let r=[],s=Object.create(null),o=new Map;for(let u of Md(e,t,o))u instanceof Te?r.push(u):(s[u.facet.id]||(s[u.facet.id]=[])).push(u);let l=Object.create(null),a=[],h=[];for(let u of r)l[u.id]=h.length<<1,h.push(p=>u.slot(p));let c=i?.config.facets;for(let u in s){let p=s[u],m=p[0].facet,g=c&&c[u]||[];if(p.every(x=>x.type==0))if(l[m.id]=a.length<<1|1,Ho(g,p))a.push(i.facet(m));else{let x=m.combine(p.map(k=>k.value));a.push(i&&m.compare(x,i.facet(m))?i.facet(m):x)}else{for(let x of p)x.type==0?(l[x.id]=a.length<<1|1,a.push(x.value)):(l[x.id]=h.length<<1,h.push(k=>x.dynamicSlot(k)));l[m.id]=h.length<<1,h.push(x=>Ad(x,m,p))}}let f=h.map(u=>u(l));return new br(e,o,f,l,a,s)}}function Md(n,e,t){let i=[[],[],[],[],[]],r=new Map;function s(o,l){let a=r.get(o);if(a!=null){if(a<=l)return;let h=i[a].indexOf(o);h>-1&&i[a].splice(h,1),o instanceof Us&&t.delete(o.compartment)}if(r.set(o,l),Array.isArray(o))for(let h of o)s(h,l);else if(o instanceof Us){if(t.has(o.compartment))throw new RangeError("Duplicate use of compartment in extensions");let h=e.get(o.compartment)||o.inner;t.set(o.compartment,h),s(h,l)}else if(o instanceof Rh)s(o.inner,o.prec);else if(o instanceof Te)i[l].push(o),o.provides&&s(o.provides,l);else if(o instanceof cr)i[l].push(o),o.facet.extensions&&s(o.facet.extensions,Jt.default);else{let h=o.extension;if(!h)throw new Error(`Unrecognized extension value in extension set (${o}).`);if(h==o)throw new Error(`Unrecognized extension value in extension set (${o}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);s(h,l)}}return s(n,Jt.default),i.reduce((o,l)=>o.concat(l))}function en(n,e){if(e&1)return 2;let t=e>>1,i=n.status[t];if(i==4)throw new Error("Cyclic dependency between fields and/or facets");if(i&2)return i;n.status[t]=4;let r=n.computeSlot(n,n.config.dynamicSlots[t]);return n.status[t]=2|r}function xr(n,e){return e&1?n.config.staticValues[e>>1]:n.values[e>>1]}const Ph=R.define(),_s=R.define({combine:n=>n.some(e=>e),static:!0}),Ih=R.define({combine:n=>n.length?n[0]:void 0,static:!0}),Nh=R.define(),Wh=R.define(),Hh=R.define(),Vh=R.define({combine:n=>n.length?n[0]:!1});class Ct{constructor(e,t){this.type=e,this.value=t}static define(){return new Td}}class Td{of(e){return new Ct(this,e)}}class Dd{constructor(e){this.map=e}of(e){return new $(this,e)}}class ${constructor(e,t){this.type=e,this.value=t}map(e){let t=this.type.map(this.value,e);return t===void 0?void 0:t==this.value?this:new $(this.type,t)}is(e){return this.type==e}static define(e={}){return new Dd(e.map||(t=>t))}static mapEffects(e,t){if(!e.length)return e;let i=[];for(let r of e){let s=r.map(t);s&&i.push(s)}return i}}$.reconfigure=$.define();$.appendConfig=$.define();class ge{constructor(e,t,i,r,s,o){this.startState=e,this.changes=t,this.selection=i,this.effects=r,this.annotations=s,this.scrollIntoView=o,this._doc=null,this._state=null,i&&Eh(i,t.newLength),s.some(l=>l.type==ge.time)||(this.annotations=s.concat(ge.time.of(Date.now())))}static create(e,t,i,r,s,o){return new ge(e,t,i,r,s,o)}get newDoc(){return this._doc||(this._doc=this.changes.apply(this.startState.doc))}get newSelection(){return this.selection||this.startState.selection.map(this.changes)}get state(){return this._state||this.startState.applyTransaction(this),this._state}annotation(e){for(let t of this.annotations)if(t.type==e)return t.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(e){let t=this.annotation(ge.userEvent);return!!(t&&(t==e||t.length>e.length&&t.slice(0,e.length)==e&&t[e.length]=="."))}}ge.time=Ct.define();ge.userEvent=Ct.define();ge.addToHistory=Ct.define();ge.remote=Ct.define();function Od(n,e){let t=[];for(let i=0,r=0;;){let s,o;if(i<n.length&&(r==e.length||e[r]>=n[i]))s=n[i++],o=n[i++];else if(r<e.length)s=e[r++],o=e[r++];else return t;!t.length||t[t.length-1]<s?t.push(s,o):t[t.length-1]<o&&(t[t.length-1]=o)}}function Fh(n,e,t){var i;let r,s,o;return t?(r=e.changes,s=me.empty(e.changes.length),o=n.changes.compose(e.changes)):(r=e.changes.map(n.changes),s=n.changes.mapDesc(e.changes,!0),o=n.changes.compose(r)),{changes:o,selection:e.selection?e.selection.map(s):(i=n.selection)===null||i===void 0?void 0:i.map(r),effects:$.mapEffects(n.effects,r).concat($.mapEffects(e.effects,s)),annotations:n.annotations.length?n.annotations.concat(e.annotations):e.annotations,scrollIntoView:n.scrollIntoView||e.scrollIntoView}}function Gs(n,e,t){let i=e.selection,r=Ci(e.annotations);return e.userEvent&&(r=r.concat(ge.userEvent.of(e.userEvent))),{changes:e.changes instanceof me?e.changes:me.of(e.changes||[],t,n.facet(Ih)),selection:i&&(i instanceof C?i:C.single(i.anchor,i.head)),effects:Ci(e.effects),annotations:r,scrollIntoView:!!e.scrollIntoView}}function zh(n,e,t){let i=Gs(n,e.length?e[0]:{},n.doc.length);e.length&&e[0].filter===!1&&(t=!1);for(let s=1;s<e.length;s++){e[s].filter===!1&&(t=!1);let o=!!e[s].sequential;i=Fh(i,Gs(n,e[s],o?i.changes.newLength:n.doc.length),o)}let r=ge.create(n,i.changes,i.selection,i.effects,i.annotations,i.scrollIntoView);return Ld(t?Bd(r):r)}function Bd(n){let e=n.startState,t=!0;for(let r of e.facet(Nh)){let s=r(n);if(s===!1){t=!1;break}Array.isArray(s)&&(t=t===!0?s:Od(t,s))}if(t!==!0){let r,s;if(t===!1)s=n.changes.invertedDesc,r=me.empty(e.doc.length);else{let o=n.changes.filter(t);r=o.changes,s=o.filtered.mapDesc(o.changes).invertedDesc}n=ge.create(e,r,n.selection&&n.selection.map(s),$.mapEffects(n.effects,s),n.annotations,n.scrollIntoView)}let i=e.facet(Wh);for(let r=i.length-1;r>=0;r--){let s=i[r](n);s instanceof ge?n=s:Array.isArray(s)&&s.length==1&&s[0]instanceof ge?n=s[0]:n=zh(e,Ci(s),!1)}return n}function Ld(n){let e=n.startState,t=e.facet(Hh),i=n;for(let r=t.length-1;r>=0;r--){let s=t[r](n);s&&Object.keys(s).length&&(i=Fh(i,Gs(e,s,n.changes.newLength),!0))}return i==n?n:ge.create(e,n.changes,n.selection,i.effects,i.annotations,i.scrollIntoView)}const Ed=[];function Ci(n){return n==null?Ed:Array.isArray(n)?n:[n]}var he=(function(n){return n[n.Word=0]="Word",n[n.Space=1]="Space",n[n.Other=2]="Other",n})(he||(he={}));const Rd=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let Ys;try{Ys=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch{}function Pd(n){if(Ys)return Ys.test(n);for(let e=0;e<n.length;e++){let t=n[e];if(/\w/.test(t)||t>""&&(t.toUpperCase()!=t.toLowerCase()||Rd.test(t)))return!0}return!1}function Id(n){return e=>{if(!/\S/.test(e))return he.Space;if(Pd(e))return he.Word;for(let t=0;t<n.length;t++)if(e.indexOf(n[t])>-1)return he.Word;return he.Other}}class Y{constructor(e,t,i,r,s,o){this.config=e,this.doc=t,this.selection=i,this.values=r,this.status=e.statusTemplate.slice(),this.computeSlot=s,o&&(o._state=this);for(let l=0;l<this.config.dynamicSlots.length;l++)en(this,l<<1);this.computeSlot=null}field(e,t=!0){let i=this.config.address[e.id];if(i==null){if(t)throw new RangeError("Field is not present in this state");return}return en(this,i),xr(this,i)}update(...e){return zh(this,e,!0)}applyTransaction(e){let t=this.config,{base:i,compartments:r}=t;for(let l of e.effects)l.is(zr.reconfigure)?(t&&(r=new Map,t.compartments.forEach((a,h)=>r.set(h,a)),t=null),r.set(l.value.compartment,l.value.extension)):l.is($.reconfigure)?(t=null,i=l.value):l.is($.appendConfig)&&(t=null,i=Ci(i).concat(l.value));let s;t?s=e.startState.values.slice():(t=br.resolve(i,r,this),s=new Y(t,this.doc,this.selection,t.dynamicSlots.map(()=>null),(a,h)=>h.reconfigure(a,this),null).values);let o=e.startState.facet(_s)?e.newSelection:e.newSelection.asSingle();new Y(t,e.newDoc,o,s,(l,a)=>a.update(l,e),e)}replaceSelection(e){return typeof e=="string"&&(e=this.toText(e)),this.changeByRange(t=>({changes:{from:t.from,to:t.to,insert:e},range:C.cursor(t.from+e.length)}))}changeByRange(e){let t=this.selection,i=e(t.ranges[0]),r=this.changes(i.changes),s=[i.range],o=Ci(i.effects);for(let l=1;l<t.ranges.length;l++){let a=e(t.ranges[l]),h=this.changes(a.changes),c=h.map(r);for(let u=0;u<l;u++)s[u]=s[u].map(c);let f=r.mapDesc(h,!0);s.push(a.range.map(f)),r=r.compose(c),o=$.mapEffects(o,c).concat($.mapEffects(Ci(a.effects),f))}return{changes:r,selection:C.create(s,t.mainIndex),effects:o}}changes(e=[]){return e instanceof me?e:me.of(e,this.doc.length,this.facet(Y.lineSeparator))}toText(e){return J.of(e.split(this.facet(Y.lineSeparator)||qs))}sliceDoc(e=0,t=this.doc.length){return this.doc.sliceString(e,t,this.lineBreak)}facet(e){let t=this.config.address[e.id];return t==null?e.default:(en(this,t),xr(this,t))}toJSON(e){let t={doc:this.sliceDoc(),selection:this.selection.toJSON()};if(e)for(let i in e){let r=e[i];r instanceof Te&&this.config.address[r.id]!=null&&(t[i]=r.spec.toJSON(this.field(e[i]),this))}return t}static fromJSON(e,t={},i){if(!e||typeof e.doc!="string")throw new RangeError("Invalid JSON representation for EditorState");let r=[];if(i){for(let s in i)if(Object.prototype.hasOwnProperty.call(e,s)){let o=i[s],l=e[s];r.push(o.init(a=>o.spec.fromJSON(l,a)))}}return Y.create({doc:e.doc,selection:C.fromJSON(e.selection),extensions:t.extensions?r.concat([t.extensions]):r})}static create(e={}){let t=br.resolve(e.extensions||[],new Map),i=e.doc instanceof J?e.doc:J.of((e.doc||"").split(t.staticFacet(Y.lineSeparator)||qs)),r=e.selection?e.selection instanceof C?e.selection:C.single(e.selection.anchor,e.selection.head):C.single(0);return Eh(r,i.length),t.staticFacet(_s)||(r=r.asSingle()),new Y(t,i,r,t.dynamicSlots.map(()=>null),(s,o)=>o.create(s),null)}get tabSize(){return this.facet(Y.tabSize)}get lineBreak(){return this.facet(Y.lineSeparator)||`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{d as Q,w as M,o as u,c as p,a as c,b as Z,e as o,I as m,f as J,u as a,t as s,v as R,g as i,h as x,s as T,P as W,n as y,F as B,r as N,i as D,j as F,k as X,l as Y,m as tt,E as et,p as h,q as _,x as at,y as A,z as H,A as st,B as ot,_ as nt}from"./index-
|
|
1
|
+
import{d as Q,w as M,o as u,c as p,a as c,b as Z,e as o,I as m,f as J,u as a,t as s,v as R,g as i,h as x,s as T,P as W,n as y,F as B,r as N,i as D,j as F,k as X,l as Y,m as tt,E as et,p as h,q as _,x as at,y as A,z as H,A as st,B as ot,_ as nt}from"./index-_mb4OfYp.js";import{P as lt}from"./PaginationFooter-DTytr1iu.js";const it={class:"connections-view"},ct={class:"search-box connection-search"},rt=["aria-label","placeholder"],ut={class:"connection-totals mono"},dt={class:"connections-control"},pt=["aria-label"],mt=["title"],vt=["title"],ht=["title"],_t=["title"],ft={class:"control-actions"},gt=["disabled"],bt={class:"connection-list"},yt={class:"connection-main"},wt=["title"],Ct={class:"connection-tags"},kt={class:"connection-tag tag-network"},Pt=["title"],xt=["title"],Tt={class:"connection-tag tag-time"},At={class:"connection-tag tag-traffic mono"},zt=["aria-label","title","onClick"],I=80,Bt=Q({__name:"ConnectionsView",setup(Dt){const w=h(""),v=h(1),d=h("time"),f=h(!0),r=h(!1),g=h([]);function L(){r.value||(g.value=[...T.connections]),r.value=!r.value}function C(e){d.value===e?f.value=!f.value:(d.value=e,f.value=!0)}function k(e){return{active:d.value===e,reverse:d.value===e&&!f.value}}const b=_(()=>r.value?g.value:T.connections);function O(e,n){const t=l=>!!l?.toLowerCase().includes(n);return t(e.metadata.host)||t(e.metadata.destinationIP)||t(e.metadata.sourceIP)||t(e.metadata.processPath)||t(e.metadata.network)||t(e.rule)||t(e.rulePayload)||e.chains.some(l=>t(l))}const P=_(()=>{const e=w.value.trim().toLowerCase(),n=e?b.value.filter(l=>O(l,e)):[...b.value],t=l=>d.value==="upload"?l.upload:d.value==="download"?l.download:d.value==="host"?z(l):l.start;return n.map(l=>({connection:l,key:t(l)})).sort((l,E)=>{const U=l.key<E.key?-1:l.key>E.key?1:0;return f.value?-U:U}).map(l=>l.connection)}),S=_(()=>Math.max(1,Math.ceil(P.value.length/I))),V=_(()=>(v.value-1)*I),q=_(()=>Math.min(V.value+I,P.value.length)),j=_(()=>P.value.slice(V.value,q.value));M(w,()=>{v.value=1}),M(S,e=>{v.value=Math.min(v.value,e)},{immediate:!0});function z(e){return e.metadata.host?e.metadata.host:`${e.metadata.destinationIP}:${e.metadata.destinationPort}`}function $(e){const n=e.metadata.processPath;return n?n.split(/[\\/]/).pop()??n:"-"}async function G(e){try{await at(e),r.value&&(g.value=g.value.filter(n=>n.id!==e)),A.success(s("toast.connClosed"))}catch(n){A.error(s("toast.failed",{msg:H(n)}))}}async function K(){const e=b.value.length;if(await st({title:s("connections.closeAll"),message:s("connections.closeAllConfirm",{n:e}),confirmText:s("common.confirm"),cancelText:s("common.cancel"),danger:!0}))try{await ot(),g.value=[],A.success(s("toast.connAllClosed"))}catch(t){A.error(s("toast.failed",{msg:H(t)}))}}return(e,n)=>(u(),p("div",it,[c(W,{title:a(s)("page.connections.title")},{default:Z(()=>[o("div",ct,[c(m,{name:"search",size:13}),J(o("input",{"onUpdate:modelValue":n[0]||(n[0]=t=>w.value=t),type:"search","aria-label":a(s)("connections.searchPlaceholder"),placeholder:a(s)("connections.searchPlaceholder")},null,8,rt),[[R,w.value]])]),o("div",ut,i(a(s)("connections.totalShort",{up:a(x)(a(T).connectionsUploadTotal),down:a(x)(a(T).connectionsDownloadTotal)})),1)]),_:1},8,["title"]),o("div",dt,[o("div",{class:"sort-labels",role:"toolbar","aria-label":a(s)("connections.colAction")},[o("button",{type:"button",class:y(["sort-label-btn",k("time")]),title:a(s)("connections.sortTime"),onClick:n[1]||(n[1]=t=>C("time"))},[c(m,{name:"timer",size:13}),o("span",null,i(a(s)("connections.sortTime")),1)],10,mt),o("button",{type:"button",class:y(["sort-label-btn",k("upload")]),title:a(s)("connections.sortUpload"),onClick:n[2]||(n[2]=t=>C("upload"))},[c(m,{name:"upload",size:13}),o("span",null,i(a(s)("connections.sortUpload")),1)],10,vt),o("button",{type:"button",class:y(["sort-label-btn",k("download")]),title:a(s)("connections.sortDownload"),onClick:n[3]||(n[3]=t=>C("download"))},[c(m,{name:"download",size:13}),o("span",null,i(a(s)("connections.sortDownload")),1)],10,ht),o("button",{type:"button",class:y(["sort-label-btn",k("host")]),title:a(s)("connections.sortHost"),onClick:n[4]||(n[4]=t=>C("host"))},[c(m,{name:"monitor",size:13}),o("span",null,i(a(s)("connections.sortHost")),1)],10,_t)],8,pt),o("div",ft,[o("button",{type:"button",class:y(["btn btn-sm btn-pause",{"btn-paused":r.value}]),onClick:L},[c(m,{name:r.value?"play":"pause",size:13},null,8,["name"]),o("span",null,i(r.value?a(s)("connections.resume"):a(s)("connections.pause")),1)],2),o("button",{type:"button",class:"btn btn-sm btn-danger",disabled:b.value.length===0,onClick:K},i(a(s)("connections.closeAll"))+" ("+i(b.value.length)+") ",9,gt)])]),o("div",bt,[(u(!0),p(B,null,N(j.value,t=>(u(),p("article",{key:t.id,class:"connection-row"},[o("div",yt,[o("div",{class:"connection-host mono",title:z(t)},i(z(t)),9,wt),o("div",Ct,[o("span",kt,i(t.metadata.network.toUpperCase()),1),$(t)!=="-"?(u(),p("span",{key:0,class:"connection-tag tag-process",title:t.metadata.processPath},i($(t)),9,Pt)):D("",!0),(u(!0),p(B,null,N(t.chains,l=>(u(),p("span",{key:l,class:"connection-tag tag-chain"},i(l),1))),128)),o("span",{class:"connection-tag tag-rule",title:t.rulePayload},[F(i(t.rule||"-"),1),t.rulePayload?(u(),p(B,{key:0},[F(","+i(t.rulePayload),1)],64)):D("",!0)],8,xt),o("span",Tt,i(a(X)(t.start,a(Y))),1),o("span",At," ↑"+i(a(x)(t.upload))+" ↓"+i(a(x)(t.download)),1)])]),o("button",{type:"button",class:"connection-close","aria-label":a(s)("connections.closeTitle"),title:a(s)("connections.closeTitle"),onClick:l=>G(t.id)},[c(m,{name:"x",size:18})],8,zt)]))),128)),P.value.length===0?(u(),tt(et,{key:0,icon:"swap",title:a(s)("connections.empty")},null,8,["title"])):D("",!0)]),c(lt,{page:v.value,"onUpdate:page":n[5]||(n[5]=t=>v.value=t),pages:S.value},null,8,["page","pages"])]))}}),Vt=nt(Bt,[["__scopeId","data-v-12653872"]]);export{Vt as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{d as A,w as D,s as i,C as I,D as N,o as c,c as u,a as b,b as U,e as n,I as w,f as L,u as a,t as s,v as q,F as C,r as k,g as d,G as z,H as x,P as R,i as V,n as S,q as B,p as v,J as G,_ as E}from"./index-
|
|
1
|
+
import{d as A,w as D,s as i,C as I,D as N,o as c,c as u,a as b,b as U,e as n,I as w,f as L,u as a,t as s,v as q,F as C,r as k,g as d,G as z,H as x,P as R,i as V,n as S,q as B,p as v,J as G,_ as E}from"./index-_mb4OfYp.js";const J={class:"logs-view"},Q={class:"search-box logs-search"},$=["aria-label","placeholder"],j=["aria-label"],K=["value"],O=["disabled"],W=["aria-pressed"],X=["aria-label"],Y={key:0,class:"log-empty text-muted"},Z={class:"log-payload"},ee={key:0,class:"log-time mono"},le=A({__name:"LogsView",setup(ae){const F=["all","info","warning","error","debug"],T=B(()=>{const l={rule:s("overview.modeRule"),global:s("overview.modeGlobal"),direct:s("overview.modeDirect")};return s("logs.modeLabel",{mode:l[i.mode]??i.mode})}),m=v("all"),g=v(""),t=v(!1),f=v(null),p=v(!0);let r=null,_=!1;const y=B(()=>{const l=g.value.trim().toLowerCase();return i.logs.filter(o=>(m.value==="all"||o.type.toLowerCase()===m.value)&&(!l||o.payload.toLowerCase().includes(l)))});function H(l){const o=l.toLowerCase();return o==="error"?"alert":o==="warning"?"info":o==="debug"?"terminal":"check-circle"}function M(){const l=f.value;l&&(p.value=l.scrollHeight-l.scrollTop-l.clientHeight<40)}async function h(){await G(),!(_||t.value||!p.value)&&(r!==null&&cancelAnimationFrame(r),r=requestAnimationFrame(()=>{r=null;const l=f.value;l&&!_&&!t.value&&p.value&&(l.scrollTop=l.scrollHeight)}))}function P(){t.value=!t.value,t.value||h()}return D(()=>i.logs.at(-1)?.id,()=>{!t.value&&p.value&&h()}),I(()=>{h()}),N(()=>{_=!0,r!==null&&cancelAnimationFrame(r)}),(l,o)=>(c(),u("div",J,[b(R,{title:a(s)("page.logs.title"),desc:T.value},{default:U(()=>[n("div",Q,[b(w,{name:"search",size:13}),L(n("input",{"onUpdate:modelValue":o[0]||(o[0]=e=>g.value=e),type:"search","aria-label":a(s)("logs.searchPlaceholder"),placeholder:a(s)("logs.searchPlaceholder")},null,8,$),[[q,g.value]])]),L(n("select",{"onUpdate:modelValue":o[1]||(o[1]=e=>m.value=e),class:"input input-sm level-select","aria-label":a(s)("logs.levelLabel")},[(c(),u(C,null,k(F,e=>n("option",{key:e,value:e},d(e==="all"?a(s)("logs.levelAll"):e.toUpperCase()),9,K)),64))],8,j),[[z,m.value]]),n("button",{type:"button",class:"btn btn-sm log-clear",disabled:a(i).logs.length===0,onClick:o[2]||(o[2]=(...e)=>a(x)&&a(x)(...e))},d(a(s)("common.clear")),9,O),n("button",{type:"button",class:"btn btn-sm log-pause","aria-pressed":t.value,onClick:P},d(t.value?a(s)("logs.resume"):a(s)("logs.pause")),9,W)]),_:1},8,["title","desc"]),n("div",{ref_key:"paneRef",ref:f,class:"log-pane",role:"log",tabindex:"0","aria-live":"off","aria-atomic":"false","aria-label":a(s)("page.logs.title"),onScroll:M},[y.value.length===0?(c(),u("div",Y,d(a(i).logs.length===0?a(s)("logs.listening"):a(s)("logs.empty")),1)):V("",!0),(c(!0),u(C,null,k(y.value,e=>(c(),u("div",{key:e.id,class:S(["log-line",`lv-${e.type.toLowerCase()}`])},[b(w,{name:H(e.type),size:13,class:"log-icon"},null,8,["name"]),n("span",Z,d(e.payload),1),e.time?(c(),u("span",ee,d(e.time),1)):V("",!0)],2))),128))],40,X)]))}}),oe=E(le,[["__scopeId","data-v-a97e5fe8"]]);export{oe as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{d as c,a5 as r,o as l,c as p,e as o,g as s,u as n,t as i,i as m,a6 as u,_ as g}from"./index-
|
|
1
|
+
import{d as c,a5 as r,o as l,c as p,e as o,g as s,u as n,t as i,i as m,a6 as u,_ as g}from"./index-_mb4OfYp.js";const b={key:0,class:"pagination-footer"},_={class:"pagination-summary"},v={class:"pagination-actions"},f=["disabled"],y=["disabled"],k=c({__name:"PaginationFooter",props:u({pages:{}},{page:{required:!0},pageModifiers:{}}),emits:["update:page"],setup(t){const e=r(t,"page");return(x,a)=>t.pages>1?(l(),p("footer",b,[o("span",_,s(n(i)("common.pageSummary",{page:e.value,total:t.pages})),1),o("div",v,[o("button",{type:"button",class:"btn btn-secondary btn-sm",disabled:e.value===1,onClick:a[0]||(a[0]=d=>e.value-=1)},s(n(i)("common.previous")),9,f),o("button",{type:"button",class:"btn btn-secondary btn-sm",disabled:e.value===t.pages,onClick:a[1]||(a[1]=d=>e.value+=1)},s(n(i)("common.next")),9,y)])])):m("",!0)}}),B=g(k,[["__scopeId","data-v-c2140dca"]]);export{B as P};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{d as g,C as y,
|
|
1
|
+
import{d as g,C as y,ad as C,z as f,o as h,m as w,u as d,t,p as r,ag as x,y as m}from"./index-_mb4OfYp.js";import{C as B}from"./CodeEditorModal-D1zn-jRS.js";import"./theme-BwDBMsKO.js";const b=g({__name:"ProfileEditorDialog",props:{profileId:{},profileName:{},isRemote:{type:Boolean}},emits:["close"],setup(l,{emit:v}){const n=l,i=v,s=r(""),c=r(!0),a=r(!1),u=r(null);y(async()=>{try{const e=await C.getProfileContent(n.profileId);s.value=e.content}catch(e){u.value=f(e)}finally{c.value=!1}});async function p(e){if(!a.value){a.value=!0;try{await x(n.profileId,e),m.success(t("toast.profileSaved",{name:n.profileName})),i("close")}catch(o){m.error(t("toast.failed",{msg:f(o)}))}finally{a.value=!1}}}return(e,o)=>(h(),w(B,{title:l.profileName,"aria-label":d(t)("editor.title"),hint:l.isRemote?d(t)("editor.remoteWarning"):void 0,content:s.value,language:"yaml",loading:c.value,"load-error":u.value,saving:a.value,onSave:p,onClose:o[0]||(o[0]=E=>i("close"))},null,8,["title","aria-label","hint","content","loading","load-error","saving"]))}});export{b as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./ProfileEditorDialog-
|
|
2
|
-
import{d as R,K as ae,L as te,C as O,M as le,N as se,O as oe,o as u,m as K,T as ie,a as m,b as ne,e as s,Q as P,g as r,u as l,t as e,f as q,R as F,v as H,S as re,p as f,U as de,y as n,z as A,_ as Q,V as ce,c as _,I as h,n as L,E as ue,F as fe,r as me,s as C,h as N,W as pe,i as T,X as ve,Y as be,Z as ye,q as B,k as _e,l as he,$ as ge,a0 as ke,a1 as we,a2 as $e,A as Ce,a3 as Pe,a4 as Ie}from"./index-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./ProfileEditorDialog-CyyP6OF1.js","./index-_mb4OfYp.js","./index-CxQTf_P9.css","./CodeEditorModal-D1zn-jRS.js","./theme-BwDBMsKO.js","./CodeEditorModal-6m0TJWyF.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{d as R,K as ae,L as te,C as O,M as le,N as se,O as oe,o as u,m as K,T as ie,a as m,b as ne,e as s,Q as P,g as r,u as l,t as e,f as q,R as F,v as H,S as re,p as f,U as de,y as n,z as A,_ as Q,V as ce,c as _,I as h,n as L,E as ue,F as fe,r as me,s as C,h as N,W as pe,i as T,X as ve,Y as be,Z as ye,q as B,k as _e,l as he,$ as ge,a0 as ke,a1 as we,a2 as $e,A as Ce,a3 as Pe,a4 as Ie}from"./index-_mb4OfYp.js";const xe=["disabled","onKeydown"],Ae={class:"rename-actions"},Ee=["disabled"],Te=["disabled"],ze=R({__name:"ProfileRenameDialog",props:{profile:{}},emits:["close"],setup(S,{emit:V}){const b=S,d=V,y=ae(),g=`${y}-title`,I=`${y}-input`,z=f(null),p=f(null),k=b.profile.name,w=f(k),$=f(!1),{open:i,close:U}=te({container:z,initialFocus:()=>(p.value?.select(),p.value),onEscape:()=>d("close")});O(()=>{le(),i()}),se(()=>{U(),oe()});async function D(){const x=w.value.trim();if(!(!x||x===k||$.value)){$.value=!0;try{await de(b.profile.id,x),n.success(e("toast.settingSaved")),d("close")}catch(c){n.error(e("toast.failed",{msg:A(c)}))}finally{$.value=!1}}}return(x,c)=>(u(),K(ie,{to:"body"},[m(re,{name:"fade",appear:""},{default:ne(()=>[s("div",{class:"rename-overlay",onClick:c[2]||(c[2]=P(E=>d("close"),["self"]))},[s("div",{ref_key:"dialogElement",ref:z,class:"rename-dialog card",role:"dialog","aria-modal":"true","aria-labelledby":g},[s("h3",{id:g,class:"rename-title"},r(l(e)("profiles.renameTitle")),1),s("label",{class:"rename-label",for:I},r(l(e)("profiles.nameLabel")),1),q(s("input",{id:I,ref_key:"inputElement",ref:p,"onUpdate:modelValue":c[0]||(c[0]=E=>w.value=E),class:"input rename-input",type:"text",maxlength:"120",disabled:$.value,onKeydown:F(P(D,["prevent"]),["enter"])},null,40,xe),[[H,w.value]]),s("div",Ae,[s("button",{type:"button",class:"btn btn-secondary btn-sm",disabled:$.value,onClick:c[1]||(c[1]=E=>d("close"))},r(l(e)("common.cancel")),9,Ee),s("button",{type:"button",class:"btn btn-primary btn-sm",disabled:$.value||!w.value.trim()||w.value.trim()===l(k),onClick:D},r(l(e)("common.save")),9,Te)])],512)])]),_:1})]))}}),De=Q(ze,[["__scopeId","data-v-67fe66f9"]]),Ue={class:"profiles-view"},Le=["aria-busy"],Fe={class:"dl-input-wrap"},Ve=["placeholder","aria-label","disabled"],Me=["title","aria-label","disabled"],Be={class:"dl-actions"},Ke=["disabled"],Se=["disabled"],Ne=["disabled"],Re=["aria-label"],Oe={key:0,class:"empty-panel"},qe=["aria-busy"],He=["aria-current","aria-disabled","title","onClick","onKeydown"],Qe={class:"profile-name-row"},We=["title"],Xe=["title"],Ye={key:0,class:"profile-usage"},Ze={class:"usage-nums"},je={class:"mono"},Ge={key:0,class:"mono usage-expire"},Je=["aria-label","aria-valuenow"],ea=["title"],aa={class:"profile-error-text"},ta={class:"profile-actions"},la=["title","aria-label","disabled","onClick"],sa=["title","aria-label","disabled","onClick"],oa=["title","aria-label","disabled","onClick"],ia=["title","aria-label","disabled","onClick"],na=R({__name:"ProfilesView",setup(S){const V=be(()=>ye(()=>import("./ProfileEditorDialog-CyyP6OF1.js"),__vite__mapDeps([0,1,2,3,4,5]),import.meta.url)),b=f(""),d=f(!1),y=f(!1),g=f(!1),I=f(""),z=f(null),p=f(null),k=f(null),w=B(()=>C.profiles),$=B(()=>C.profiles.some(t=>t.url!=="")),i=B(()=>C.operations.profileMutation);function U(t){if(!t.url)return e("profiles.localFile");try{return new URL(t.url).hostname||t.url}catch{return t.url}}function D(t){const o=new Date(t.updatedAt).getTime();return!Number.isFinite(o)||o<=0?e("profiles.neverUpdated"):_e(t.updatedAt,he.value)}function x(t){return(t.subInfo?.upload??0)+(t.subInfo?.download??0)}function c(t){const o=t.subInfo?.total??0;return o<=0?0:Math.min(100,Math.round(x(t)/o*100))}O(()=>{ce().catch(()=>{})});async function E(){const t=b.value.trim();if(!(!t||d.value)){d.value=!0;try{const o=await ge(t);b.value="",o.activated?n.success(e("toast.profileActivated",{name:o.profile.name,n:o.proxyCount??0})):n.success(e("toast.profileAdded",{name:o.profile.name}))}catch(o){n.error(e("toast.failed",{msg:A(o)}))}finally{d.value=!1}}}async function W(t){if(!I.value){I.value=t.id;try{await ke(t.id),n.success(e("toast.profileUpdated",{name:t.name}))}catch(o){n.error(e("toast.failed",{msg:A(o)}))}finally{I.value=""}}}async function X(){if(!y.value){y.value=!0;try{const t=await we();t.failed.length===0?n.success(e("toast.profilesUpdateAllOk",{n:t.updated})):n.error(e("toast.profilesUpdateAllPartial",{n:t.updated,f:t.failed.length}))}catch(t){n.error(e("toast.failed",{msg:A(t)}))}finally{y.value=!1}}}async function M(t){if(!(i.value||t.id===C.activeProfileId))try{const o=await $e(t.id);n.success(e("toast.profileActivated",{name:t.name,n:o.proxyCount}))}catch(o){n.error(e("toast.failed",{msg:A(o)}))}}function Y(t){i.value||(p.value=t)}async function Z(t){if(!(i.value||!await Ce({title:e("profiles.deleteConfirmTitle"),message:e("profiles.deleteConfirmMsg",{name:t.name}),confirmText:e("common.confirm"),cancelText:e("common.cancel"),danger:!0})))try{await Pe(t.id),n.success(e("toast.profileDeleted",{name:t.name}))}catch(a){n.error(e("toast.failed",{msg:A(a)}))}}function j(t){const o=t.target,a=o.files?.[0];o.value="",!(!a||g.value)&&(g.value=!0,(async()=>{try{const v=await a.text(),J=a.name.replace(/\.(ya?ml)$/i,"")||"imported",ee=await Ie(J,v);n.success(e("toast.profileImported",{name:ee.profile.name}))}catch(v){n.error(e("toast.failed",{msg:A(v)}))}finally{g.value=!1}})())}async function G(){try{const t=await navigator.clipboard.readText();t.trim()&&(b.value=t.trim())}catch{n.error(e("toast.pasteFailed"))}}return(t,o)=>(u(),_("div",Ue,[s("div",{class:"dl-panel","aria-busy":d.value||y.value||g.value||i.value},[s("div",Fe,[q(s("input",{"onUpdate:modelValue":o[0]||(o[0]=a=>b.value=a),type:"url",class:"input dl-input",placeholder:l(e)("profiles.downloadPlaceholder"),"aria-label":l(e)("profiles.downloadPlaceholder"),disabled:d.value||i.value,spellcheck:"false",onKeyup:F(E,["enter"])},null,40,Ve),[[H,b.value]]),s("button",{type:"button",class:"icon-btn dl-paste",title:l(e)("profiles.paste"),"aria-label":l(e)("profiles.paste"),disabled:d.value||i.value,onClick:G},[m(h,{name:"clipboard",size:15})],8,Me)]),s("div",Be,[s("button",{type:"button",class:"btn btn-secondary dl-action-primary",disabled:d.value||i.value||!b.value.trim(),onClick:E},[m(h,{name:"download",size:14}),s("span",null,r(d.value?l(e)("profiles.downloading"):l(e)("profiles.download")),1)],8,Ke),s("button",{type:"button",class:"btn btn-secondary",disabled:y.value||i.value||!$.value,onClick:X},[m(h,{name:"refresh",size:14,class:L({spin:y.value})},null,8,["class"]),s("span",null,r(l(e)("profiles.updateAll")),1)],8,Se),s("button",{type:"button",class:"btn btn-secondary",disabled:g.value||i.value,onClick:o[1]||(o[1]=a=>z.value?.click())},[m(h,{name:"upload",size:14}),s("span",null,r(l(e)("profiles.import")),1)],8,Ne)]),s("input",{ref_key:"fileInput",ref:z,type:"file",accept:".yaml,.yml",class:"hidden-file","aria-label":l(e)("profiles.import"),onChange:j},null,40,Re)],8,Le),w.value.length===0?(u(),_("div",Oe,[m(ue,{icon:"layers",title:l(e)("profiles.emptyTitle"),hint:l(e)("profiles.emptyHint")},null,8,["title","hint"])])):(u(),_("div",{key:1,class:"profiles-grid","aria-busy":i.value},[(u(!0),_(fe,null,me(w.value,a=>(u(),_("article",{key:a.id,class:L(["profile-card",{active:a.id===l(C).activeProfileId,busy:i.value}])},[s("div",{class:"profile-card-main",role:"button",tabindex:"0","aria-current":a.id===l(C).activeProfileId?"true":void 0,"aria-disabled":i.value||a.id===l(C).activeProfileId,title:a.id===l(C).activeProfileId?void 0:l(e)("profiles.clickToUse"),onClick:v=>M(a),onKeydown:[F(P(v=>M(a),["prevent"]),["enter"]),F(P(v=>M(a),["prevent"]),["space"])]},[s("div",Qe,[s("span",{class:"profile-name",title:a.name},r(a.name),9,We)]),s("div",{class:"profile-source",title:`${U(a)} · ${D(a)}`},r(U(a))+" · "+r(D(a)),9,Xe),a.subInfo?(u(),_("div",Ye,[s("div",Ze,[s("span",je,r(l(N)(x(a)))+" / "+r(l(N)(a.subInfo.total)),1),a.subInfo.expire?(u(),_("span",Ge,r(l(pe)(a.subInfo.expire)),1)):T("",!0)]),s("div",{class:"usage-bar",role:"progressbar","aria-label":l(e)("profiles.usageLabel"),"aria-valuemin":"0","aria-valuemax":"100","aria-valuenow":c(a)},[s("div",{class:L(["usage-fill",{"usage-fill-hot":c(a)>=90}]),style:ve({width:`${c(a)}%`})},null,6)],8,Je)])):T("",!0),a.lastError?(u(),_("div",{key:1,class:"profile-error",title:a.lastError,role:"status"},[m(h,{name:"alert",size:13}),s("span",aa,r(a.lastError),1)],8,ea)):T("",!0)],40,He),s("div",ta,[s("button",{type:"button",class:"icon-btn",title:l(e)("profiles.rename"),"aria-label":`${l(e)("profiles.rename")}: ${a.name}`,disabled:i.value,onClick:P(v=>k.value=a,["stop"])},[m(h,{name:"pencil",size:14})],8,la),s("button",{type:"button",class:"icon-btn",title:l(e)("profiles.edit"),"aria-label":`${l(e)("profiles.edit")}: ${a.name}`,disabled:i.value,onClick:P(v=>Y(a),["stop"])},[m(h,{name:"code",size:14})],8,sa),a.url?(u(),_("button",{key:0,type:"button",class:"icon-btn",title:l(e)("profiles.update"),"aria-label":`${l(e)("profiles.update")}: ${a.name}`,disabled:i.value,onClick:P(v=>W(a),["stop"])},[m(h,{name:"refresh",size:14,class:L({spin:I.value===a.id})},null,8,["class"])],8,oa)):T("",!0),s("button",{type:"button",class:"icon-btn danger-hover",title:l(e)("profiles.delete"),"aria-label":`${l(e)("profiles.delete")}: ${a.name}`,disabled:i.value,onClick:P(v=>Z(a),["stop"])},[m(h,{name:"trash",size:14})],8,ia)])],2))),128))],8,qe)),k.value?(u(),K(De,{key:2,profile:k.value,onClose:o[2]||(o[2]=a=>k.value=null)},null,8,["profile"])):T("",!0),p.value?(u(),K(l(V),{key:3,"profile-id":p.value.id,"profile-name":p.value.name,"is-remote":p.value.url!=="",onClose:o[3]||(o[3]=a=>p.value=null)},null,8,["profile-id","profile-name","is-remote"])):T("",!0)]))}}),da=Q(na,[["__scopeId","data-v-77f96f8d"]]);export{da as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{d as f,w as p,s as b,o as u,c as h,a as _,b as P,e,I as w,f as k,u as l,t,v as $,g as r,P as C,F as I,r as V,m as E,E as R,i as T,p as y,q as i,_ as B}from"./index-
|
|
1
|
+
import{d as f,w as p,s as b,o as u,c as h,a as _,b as P,e,I as w,f as k,u as l,t,v as $,g as r,P as C,F as I,r as V,m as E,E as R,i as T,p as y,q as i,_ as B}from"./index-_mb4OfYp.js";import{P as M}from"./PaginationFooter-DTytr1iu.js";const F={class:"search-box rule-search"},L=["aria-label","placeholder"],N={class:"badge badge-neutral"},S={class:"table-wrap rule-list"},q={class:"data-table"},D={class:"idx"},U=["data-label"],z=["data-label"],A={class:"badge badge-neutral"},G=["data-label","title"],H=["data-label"],K={class:"badge badge-accent"},m=80,Q=f({__name:"RulesView",setup(Z){const d=y(""),c=y(1),g=i(()=>b.rules.map((a,o)=>({rule:a,originalIndex:o,key:`${a.type}\0${a.payload}\0${a.proxy}\0${o}`,searchKey:`${a.type??""}\0${a.payload??""}\0${a.proxy??""}`.toLowerCase()}))),n=i(()=>{const a=d.value.trim().toLowerCase();return a?g.value.filter(({searchKey:o})=>o.includes(a)):g.value}),v=i(()=>Math.max(1,Math.ceil(n.value.length/m))),x=i(()=>{const a=(c.value-1)*m;return n.value.slice(a,a+m)});return p(d,()=>{c.value=1}),p(()=>b.rules,()=>{c.value=1}),p(v,a=>{c.value=Math.min(c.value,a)},{immediate:!0}),(a,o)=>(u(),h("div",null,[_(C,{title:l(t)("page.rules.title"),desc:l(t)("page.rules.desc")},{default:P(()=>[e("div",F,[_(w,{name:"search",size:13}),k(e("input",{"onUpdate:modelValue":o[0]||(o[0]=s=>d.value=s),type:"search","aria-label":l(t)("rules.searchPlaceholder"),placeholder:l(t)("rules.searchPlaceholder")},null,8,L),[[$,d.value]])]),e("span",N,r(l(t)("common.rulesCount",{n:n.value.length})),1)]),_:1},8,["title","desc"]),e("div",S,[e("table",q,[e("thead",null,[e("tr",null,[e("th",D,r(l(t)("rules.colIndex")),1),e("th",null,r(l(t)("rules.colType")),1),e("th",null,r(l(t)("rules.colPayload")),1),e("th",null,r(l(t)("rules.colTarget")),1)])]),e("tbody",null,[(u(!0),h(I,null,V(x.value,s=>(u(),h("tr",{key:s.key},[e("td",{class:"cell-mono text-muted idx","data-label":l(t)("rules.colIndex")},r(s.originalIndex+1),9,U),e("td",{"data-label":l(t)("rules.colType")},[e("span",A,r(s.rule.type),1)],8,z),e("td",{class:"cell-mono cell-truncate","data-label":l(t)("rules.colPayload"),title:s.rule.payload||"-"},r(s.rule.payload||"-"),9,G),e("td",{"data-label":l(t)("rules.colTarget")},[e("span",K,r(s.rule.proxy),1)],8,H)]))),128))])]),n.value.length===0?(u(),E(R,{key:0,icon:"list-filter",title:l(t)("rules.empty")},null,8,["title"])):T("",!0)]),_(M,{page:c.value,"onUpdate:page":o[1]||(o[1]=s=>c.value=s),pages:v.value},null,8,["page","pages"])]))}}),O=B(Q,[["__scopeId","data-v-6cf63293"]]);export{O as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{d as m,C as p,ad as c,z as d,o as y,m as S,u as f,t as a,p as n,ah as _,y as o}from"./index-_mb4OfYp.js";import{C as h}from"./CodeEditorModal-D1zn-jRS.js";import"./theme-BwDBMsKO.js";const B=m({__name:"SettingsFileDialog",emits:["close"],setup(C,{emit:v}){const r=v,l=n(""),i=n(!0),s=n(!1),u=n(null);p(async()=>{try{const e=await c.getSettingsFile();l.value=e.content}catch(e){u.value=d(e)}finally{i.value=!1}});async function g(e){if(!s.value){s.value=!0;try{const t=await c.saveSettingsFile(e);await _(),t.restartRequired?o.success(a("toast.settingsSavedRestart")):o.success(a("toast.settingSaved")),r("close")}catch(t){o.error(a("toast.failed",{msg:d(t)}))}finally{s.value=!1}}}return(e,t)=>(y(),S(h,{title:f(a)("settings.fileTitle"),hint:f(a)("settings.fileHint"),content:l.value,language:"json",layout:"constrained",loading:i.value,"load-error":u.value,saving:s.value,onSave:g,onClose:t[0]||(t[0]=w=>r("close"))},null,8,["title","hint","content","loading","load-error","saving"]))}});export{B as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.ui-card[data-v-042826e5]{min-width:0}.ui-card-head[data-v-042826e5]{display:flex;min-height:28px;align-items:flex-end;justify-content:space-between;gap:16px;margin-bottom:5px}.ui-card-heading[data-v-042826e5]{min-width:0}.ui-card-title[data-v-042826e5]{color:var(--text-primary);font-size:18px;font-weight:400;line-height:1.4}.ui-card-desc[data-v-042826e5]{margin-top:1px;color:var(--text-muted);font-size:14px;line-height:1.35}.ui-card-actions[data-v-042826e5]{display:flex;align-items:center;flex-shrink:0;flex-wrap:wrap;justify-content:flex-end;gap:7px}.ui-card-body[data-v-042826e5]{padding:6px 10px;background:var(--bg-panel);border-radius:3px}@media(max-width:520px){.ui-card-head[data-v-042826e5]{flex-wrap:wrap}.ui-card-body[data-v-042826e5]{padding:6px 8px}}.switch[data-v-306af9c5]{position:relative;width:34px;height:20px;flex-shrink:0;padding:0;border:0;border-radius:var(--radius-full);background:var(--switch-off);cursor:pointer;transition:background var(--motion-normal) var(--ease-standard),opacity var(--motion-fast) var(--ease-standard)}.switch[data-v-306af9c5]:hover:not(:disabled){background:color-mix(in srgb,var(--switch-off) 84%,var(--text-primary))}.switch.on[data-v-306af9c5]{background:var(--switch-on)}.switch.on[data-v-306af9c5]:hover:not(:disabled){background:color-mix(in srgb,var(--switch-on) 84%,#000000)}.switch[data-v-306af9c5]:disabled{cursor:not-allowed;opacity:.48}.knob[data-v-306af9c5]{position:absolute;top:3px;left:3px;width:14px;height:14px;border-radius:var(--radius-full);background:var(--switch-knob);box-shadow:var(--shadow-switch);transition:background var(--motion-normal) var(--ease-standard),transform var(--motion-normal) var(--ease-spring)}.switch.on .knob[data-v-306af9c5]{transform:translate(14px)}.settings-grid[data-v-80d90b9c]{display:grid;width:min(1046px,100%);grid-template-columns:1fr;gap:12px;margin:0 auto}.settings-card[data-v-80d90b9c]{min-width:0}.preference-control[data-v-80d90b9c]{display:grid;width:min(360px,48%);grid-template-columns:repeat(3,minmax(0,1fr));flex-shrink:0;gap:0}.language-control[data-v-80d90b9c]{grid-template-columns:repeat(2,minmax(0,1fr))}.preference-control .segmented-item[data-v-80d90b9c]{min-height:27px;border:0;border-radius:0;font-size:14px}.preference-control .segmented-item[data-v-80d90b9c]:first-child{border-radius:5px 0 0 5px}.preference-control .segmented-item[data-v-80d90b9c]:last-child{border-radius:0 5px 5px 0}.setting-row[data-v-80d90b9c]{display:flex;min-height:43px;align-items:center;justify-content:space-between;gap:24px;padding:6px 5px;border-bottom:0;transition:background var(--motion-fast) var(--ease-standard)}.setting-row[data-v-80d90b9c]:first-child{margin-top:-2px}.setting-row[data-v-80d90b9c]:last-child{border-bottom:0}.setting-row[data-v-80d90b9c]:hover{background:var(--general-row-hover);border-radius:3px}.danger-row .setting-name[data-v-80d90b9c]{color:var(--danger)}.setting-info[data-v-80d90b9c]{display:flex;min-width:0;flex-direction:column;gap:2px}.setting-name[data-v-80d90b9c]{color:var(--text-primary);font-size:16px;font-weight:400}.setting-desc[data-v-80d90b9c]{max-width:630px;color:var(--text-muted);font-size:14px;line-height:1.35}.setting-action[data-v-80d90b9c]{display:flex;align-items:center;flex-shrink:0;gap:8px}.port-input[data-v-80d90b9c]{width:96px;font-family:var(--font-mono);appearance:textfield;-moz-appearance:textfield}.port-input[data-v-80d90b9c]::-webkit-outer-spin-button,.port-input[data-v-80d90b9c]::-webkit-inner-spin-button{margin:0;-webkit-appearance:none}.interrupt-save[data-v-80d90b9c]{color:var(--warning);background:transparent;border-color:var(--warning-border)}.danger-action[data-v-80d90b9c]{color:var(--danger);background:transparent;border-color:var(--danger-border)}.interrupt-save[data-v-80d90b9c]:hover:not(:disabled){background:var(--warning-soft)}.danger-action[data-v-80d90b9c]:hover:not(:disabled){background:var(--danger-soft)}.info-grid[data-v-80d90b9c]{display:grid;grid-template-columns:1fr}.info-item[data-v-80d90b9c]{display:flex;min-width:0;min-height:39px;align-items:center;justify-content:space-between;gap:12px;padding:6px 5px;border-bottom:0}.info-item[data-v-80d90b9c]:last-child{border-bottom:0}.info-item dt[data-v-80d90b9c]{flex-shrink:0;color:var(--text-secondary);font-size:16px}.info-item dd[data-v-80d90b9c]{min-width:0;overflow:hidden;color:var(--text-primary);font-size:16px;font-weight:400;text-overflow:ellipsis;white-space:nowrap}@media(max-width:760px){.preference-control .segmented-item[data-v-80d90b9c],.setting-action .btn[data-v-80d90b9c]{min-height:40px}}@media(max-width:480px){.settings-grid[data-v-80d90b9c]{gap:12px}.preference-control[data-v-80d90b9c]{width:100%}.preference-control .segmented-item[data-v-80d90b9c]{min-height:40px;font-size:14px}.setting-row[data-v-80d90b9c]{min-height:0;align-items:stretch;flex-direction:column;gap:11px;padding:13px 8px}.setting-action[data-v-80d90b9c]{align-self:stretch;justify-content:flex-end}.port-action[data-v-80d90b9c]{display:grid;grid-template-columns:minmax(0,1fr) auto auto}.port-input[data-v-80d90b9c]{width:100%;min-height:44px;text-align:left}.setting-action .btn[data-v-80d90b9c]{min-height:44px}.info-item[data-v-80d90b9c]{min-height:0;align-items:flex-start;flex-direction:column;gap:3px;padding:10px 8px}.info-item dd[data-v-80d90b9c]{width:100%}}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./SettingsFileDialog-CjBSyH4K.js","./index-_mb4OfYp.js","./index-CxQTf_P9.css","./CodeEditorModal-D1zn-jRS.js","./theme-BwDBMsKO.js","./CodeEditorModal-6m0TJWyF.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{d as D,o as g,c as h,e as s,g as a,i as y,a7 as E,_ as S,n as p,u as t,t as e,p as k,s as l,w as q,a8 as H,a as u,b as C,I as P,j as Y,P as Z,m as G,l as $,f as J,v as K,a9 as Q,Y as W,Z as X,aa as tt,q as N,ab as st,ac as et,y as v,ad as A,ae as M,z as x,af as at}from"./index-_mb4OfYp.js";import{t as b,s as it}from"./theme-BwDBMsKO.js";const nt={class:"ui-card"},ot={key:0,class:"ui-card-head"},lt={class:"ui-card-heading"},dt={key:0,class:"ui-card-title"},ct={key:1,class:"ui-card-desc"},rt={key:0,class:"ui-card-actions"},ut={class:"ui-card-body"},gt=D({__name:"UiCard",props:{title:{},desc:{}},setup(o){return(m,r)=>(g(),h("section",nt,[o.title||o.desc||m.$slots.actions?(g(),h("header",ot,[s("div",lt,[o.title?(g(),h("h2",dt,a(o.title),1)):y("",!0),o.desc?(g(),h("p",ct,a(o.desc),1)):y("",!0)]),m.$slots.actions?(g(),h("div",rt,[E(m.$slots,"actions",{},void 0)])):y("",!0)])):y("",!0),s("div",ut,[E(m.$slots,"default",{},void 0)])]))}}),T=S(gt,[["__scopeId","data-v-042826e5"]]),mt=["aria-checked","aria-label","disabled"],_t=D({__name:"UiSwitch",props:{modelValue:{type:Boolean},disabled:{type:Boolean},label:{}},emits:["update:modelValue"],setup(o){return(m,r)=>(g(),h("button",{type:"button",role:"switch","aria-checked":o.modelValue,"aria-label":o.label??t(e)("common.toggle"),class:p(["switch",{on:o.modelValue}]),disabled:o.disabled,onClick:r[0]||(r[0]=f=>m.$emit("update:modelValue",!o.modelValue))},[...r[1]||(r[1]=[s("span",{class:"knob","aria-hidden":"true"},null,-1)])],10,mt))}}),vt=S(_t,[["__scopeId","data-v-306af9c5"]]),pt={class:"settings-grid"},ht={class:"setting-row"},bt={class:"setting-info"},ft={class:"setting-name"},yt={class:"setting-desc"},wt=["aria-label"],kt=["aria-pressed"],Ct=["aria-pressed"],$t=["aria-pressed"],Tt={class:"setting-row"},Vt={class:"setting-info"},Pt={class:"setting-name"},xt={class:"setting-desc"},Dt=["aria-label"],St=["aria-pressed"],Lt=["aria-pressed"],zt={class:"setting-row interrupt-row"},Bt={class:"setting-info"},It={class:"setting-name",for:"mixed-port"},Ut={class:"setting-desc"},Et={class:"setting-action port-action"},Nt=["aria-label","disabled"],At=["disabled"],Mt=["disabled"],Rt={class:"setting-row"},Ft={class:"setting-info"},Ot={class:"setting-name"},jt={class:"setting-desc"},qt={class:"setting-action"},Ht={class:"setting-row danger-row"},Yt={class:"setting-info"},Zt={class:"setting-name"},Gt={class:"setting-desc"},Jt={class:"setting-action"},Kt=["disabled"],Qt={class:"setting-row"},Wt={class:"setting-info"},Xt={class:"setting-name"},ts={class:"setting-desc"},ss={class:"setting-action"},es=["disabled"],as={class:"info-grid"},is={class:"info-item"},ns={class:"mono"},os={class:"info-item"},ls={class:"mono"},ds={class:"info-item"},cs={class:"mono"},rs=D({__name:"SettingsView",setup(o){const m=W(()=>X(()=>import("./SettingsFileDialog-CjBSyH4K.js"),__vite__mapDeps([0,1,2,3,4,5]),import.meta.url)),r=k(!1),f=k(l.status?.settings.mixedPort??7890),d=k(f.value),_=k(!1),{restarting:L,restartCore:z}=tt(),w=k(!1);q(()=>l.status?.settings.mixedPort,n=>{if(n===void 0)return;const i=f.value;f.value=n,d.value=H(d.value,i,n,_.value)});const B=N(()=>st(d.value,f.value)),I=N(()=>Number.isInteger(d.value)&&d.value>=1&&d.value<=65535&&B.value);function V(n){n!==b.value&&it(n)}function U(n){n!==$.value&&(et(n),v.success(e("toast.langSwitched")))}function R(){d.value=f.value}async function F(){if(!(!I.value||_.value)){_.value=!0;try{const n=await A.patchSettings({mixedPort:d.value});l.status&&(l.status={...l.status,settings:n.settings}),await M(),v.success(e("toast.portSaved"))}catch(n){v.error(e("toast.failed",{msg:x(n)}))}finally{_.value=!1}}}async function O(n){try{await at(n)?v.success(e("toast.settingSaved")):v.info(e("toast.settingSavedUnverified"))}catch(i){v.error(e("toast.failed",{msg:x(i)}))}}async function j(){if(!w.value){w.value=!0;try{const n=await A.reloadCoreConfig();await M(),v.success(e("toast.configReloaded",{n:n.proxyCount}))}catch(n){v.error(e("toast.failed",{msg:x(n)}))}finally{w.value=!1}}}return(n,i)=>(g(),h("div",null,[u(Z,{title:t(e)("page.settings.title"),desc:t(e)("page.settings.desc")},{default:C(()=>[s("button",{type:"button",class:"btn btn-secondary btn-sm",onClick:i[0]||(i[0]=c=>r.value=!0)},[u(P,{name:"code",size:14}),Y(" "+a(t(e)("settings.editFile")),1)])]),_:1},8,["title","desc"]),r.value?(g(),G(t(m),{key:0,onClose:i[1]||(i[1]=c=>r.value=!1)})):y("",!0),s("div",pt,[u(T,{title:t(e)("settings.appearanceTitle"),class:"settings-card"},{default:C(()=>[s("div",ht,[s("div",bt,[s("span",ft,a(t(e)("settings.themeTitle")),1),s("span",yt,a(t(e)("settings.appearanceDesc")),1)]),s("div",{class:"segmented preference-control",role:"group","aria-label":t(e)("settings.appearanceTitle")},[s("button",{type:"button",class:p(["segmented-item",{active:t(b)==="system"}]),"aria-pressed":t(b)==="system",onClick:i[2]||(i[2]=c=>V("system"))},a(t(e)("theme.system")),11,kt),s("button",{type:"button",class:p(["segmented-item",{active:t(b)==="light"}]),"aria-pressed":t(b)==="light",onClick:i[3]||(i[3]=c=>V("light"))},a(t(e)("theme.light")),11,Ct),s("button",{type:"button",class:p(["segmented-item",{active:t(b)==="dark"}]),"aria-pressed":t(b)==="dark",onClick:i[4]||(i[4]=c=>V("dark"))},a(t(e)("theme.dark")),11,$t)],8,wt)]),s("div",Tt,[s("div",Vt,[s("span",Pt,a(t(e)("settings.langTitle")),1),s("span",xt,a(t(e)("settings.langDesc")),1)]),s("div",{class:"segmented preference-control language-control",role:"group","aria-label":t(e)("settings.langTitle")},[s("button",{type:"button",class:p(["segmented-item",{active:t($)==="zh"}]),"aria-pressed":t($)==="zh",onClick:i[5]||(i[5]=c=>U("zh"))}," 中文 ",10,St),s("button",{type:"button",class:p(["segmented-item",{active:t($)==="en"}]),"aria-pressed":t($)==="en",onClick:i[6]||(i[6]=c=>U("en"))}," English ",10,Lt)],8,Dt)])]),_:1},8,["title"]),u(T,{title:t(e)("settings.networkTitle"),class:"settings-card"},{default:C(()=>[s("div",zt,[s("div",Bt,[s("label",It,a(t(e)("settings.mixedPortTitle")),1),s("span",Ut,a(t(e)("settings.mixedPortDesc")),1)]),s("div",Et,[J(s("input",{id:"mixed-port","onUpdate:modelValue":i[7]||(i[7]=c=>d.value=c),type:"number",min:"1",max:"65535",class:"input input-sm port-input","aria-label":t(e)("settings.mixedPortTitle"),disabled:_.value||!t(l).status},null,8,Nt),[[K,d.value,void 0,{number:!0}]]),B.value?(g(),h("button",{key:0,type:"button",class:"btn btn-secondary btn-sm",disabled:_.value||!t(l).status,onClick:R},a(t(e)("common.reset")),9,At)):y("",!0),s("button",{type:"button",class:"btn btn-secondary btn-sm interrupt-save",disabled:_.value||!I.value||!t(l).status,onClick:F},a(_.value?t(e)("common.loading"):t(e)("common.save")),9,Mt)])]),s("div",Rt,[s("div",Ft,[s("span",Ot,a(t(e)("settings.allowLanTitle")),1),s("span",jt,a(t(e)("settings.allowLanDesc")),1)]),s("div",qt,[u(vt,{"model-value":t(l).status?.settings.allowLan??!1,label:t(e)("settings.allowLanTitle"),disabled:t(l).operations.networkSetting||!t(l).status,"onUpdate:modelValue":O},null,8,["model-value","label","disabled"])])])]),_:1},8,["title"]),u(T,{title:t(e)("settings.coreTitle"),class:"settings-card"},{default:C(()=>[s("div",Ht,[s("div",Yt,[s("span",Zt,a(t(e)("settings.restartTitle")),1),s("span",Gt,a(t(e)("settings.restartDesc")),1)]),s("div",Jt,[s("button",{type:"button",class:"btn btn-sm danger-action",disabled:t(L),onClick:i[8]||(i[8]=(...c)=>t(z)&&t(z)(...c))},[u(P,{name:"power",size:13,class:p({spin:t(L)})},null,8,["class"]),s("span",null,a(t(e)("settings.restartBtn")),1)],8,Kt)])]),s("div",Qt,[s("div",Wt,[s("span",Xt,a(t(e)("settings.reloadTitle")),1),s("span",ts,a(t(e)("settings.reloadDesc")),1)]),s("div",ss,[s("button",{type:"button",class:"btn btn-secondary btn-sm",disabled:w.value,onClick:j},[u(P,{name:"refresh",size:13,class:p({spin:w.value})},null,8,["class"]),s("span",null,a(t(e)("settings.reloadBtn")),1)],8,es)])])]),_:1},8,["title"]),u(T,{title:t(e)("settings.aboutTitle"),class:"settings-card runtime-card"},{default:C(()=>[s("dl",as,[s("div",is,[s("dt",null,a(t(e)("overview.daemonPort")),1),s("dd",ns,"127.0.0.1:"+a(t(l).status?.settings.daemonPort??19090),1)]),s("div",os,[s("dt",null,a(t(e)("overview.controller")),1),s("dd",ls,a(t(l).status?.settings.controller||"-"),1)]),s("div",ds,[s("dt",null,a(t(e)("settings.coreVersion")),1),s("dd",cs,a(t(Q)||"-"),1)])])]),_:1},8,["title"])])]))}}),ms=S(rs,[["__scopeId","data-v-80d90b9c"]]);export{ms as default};
|