playwright-core 1.58.0-alpha-2025-12-16 → 1.58.0-alpha-2025-12-17
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/lib/generated/injectedScriptSource.js +1 -1
- package/lib/server/agent/actionRunner.js +56 -16
- package/lib/server/agent/agent.js +19 -8
- package/lib/server/agent/codegen.js +2 -0
- package/lib/server/agent/context.js +17 -20
- package/lib/server/bidi/bidiExecutionContext.js +9 -6
- package/lib/server/progress.js +7 -3
- package/lib/server/trace/viewer/traceViewer.js +17 -13
- package/lib/utils/isomorphic/trace/traceModel.js +4 -4
- package/lib/vite/traceViewer/assets/{codeMirrorModule-Dqdugjpa.js → codeMirrorModule-DqqhreXd.js} +1 -1
- package/lib/vite/traceViewer/assets/{defaultSettingsView-DIraU59a.js → defaultSettingsView-B-IIHg_U.js} +8 -8
- package/lib/vite/traceViewer/{index.D-mekvnz.js → index.CVDmenYz.js} +1 -1
- package/lib/vite/traceViewer/index.html +2 -2
- package/lib/vite/traceViewer/sw.bundle.js +4 -4
- package/lib/vite/traceViewer/uiMode.html +2 -2
- package/lib/vite/traceViewer/{uiMode.BL60hFRS.js → uiMode.yq3WDGll.js} +3 -3
- package/package.json +1 -1
- package/types/protocol.d.ts +54 -54
|
@@ -18,13 +18,25 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
19
|
var actionRunner_exports = {};
|
|
20
20
|
__export(actionRunner_exports, {
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
generateActionTimeout: () => generateActionTimeout,
|
|
22
|
+
performActionTimeout: () => performActionTimeout,
|
|
23
|
+
runAction: () => runAction
|
|
23
24
|
});
|
|
24
25
|
module.exports = __toCommonJS(actionRunner_exports);
|
|
25
26
|
var import_expectUtils = require("../utils/expectUtils");
|
|
26
|
-
var
|
|
27
|
-
|
|
27
|
+
var import_time = require("../../utils/isomorphic/time");
|
|
28
|
+
var import_progress = require("../progress");
|
|
29
|
+
async function runAction(parentProgress, mode, page, action, secrets) {
|
|
30
|
+
const timeout = mode === "generate" ? generateActionTimeout(action) : performActionTimeout(action);
|
|
31
|
+
const mt = (0, import_time.monotonicTime)();
|
|
32
|
+
const deadline = mt + timeout;
|
|
33
|
+
const minDeadline = parentProgress.deadline ? Math.min(parentProgress.deadline, deadline) : deadline;
|
|
34
|
+
const pc = new import_progress.ProgressController();
|
|
35
|
+
return await pc.run(async (progress) => {
|
|
36
|
+
return await innerRunAction(progress, page, action, secrets);
|
|
37
|
+
}, minDeadline - mt);
|
|
38
|
+
}
|
|
39
|
+
async function innerRunAction(progress, page, action, secrets) {
|
|
28
40
|
const frame = page.mainFrame();
|
|
29
41
|
switch (action.method) {
|
|
30
42
|
case "click":
|
|
@@ -63,7 +75,7 @@ async function runAction(progress, page, action, secrets) {
|
|
|
63
75
|
await frame.uncheck(progress, action.selector, { ...strictTrue });
|
|
64
76
|
break;
|
|
65
77
|
case "expectVisible": {
|
|
66
|
-
const result = await frame.expect(progress, action.selector, { expression: "to.be.visible", isNot: false }
|
|
78
|
+
const result = await frame.expect(progress, action.selector, { expression: "to.be.visible", isNot: false });
|
|
67
79
|
if (result.errorMessage)
|
|
68
80
|
throw new Error(result.errorMessage);
|
|
69
81
|
break;
|
|
@@ -72,28 +84,56 @@ async function runAction(progress, page, action, secrets) {
|
|
|
72
84
|
let result;
|
|
73
85
|
if (action.type === "textbox" || action.type === "combobox" || action.type === "slider") {
|
|
74
86
|
const expectedText = (0, import_expectUtils.serializeExpectedTextValues)([action.value]);
|
|
75
|
-
result = await frame.expect(progress, action.selector, { expression: "to.have.value", expectedText, isNot: false }
|
|
87
|
+
result = await frame.expect(progress, action.selector, { expression: "to.have.value", expectedText, isNot: false });
|
|
76
88
|
} else if (action.type === "checkbox" || action.type === "radio") {
|
|
77
|
-
const expectedValue =
|
|
78
|
-
result = await frame.expect(progress, action.selector, { expression: "to.be.checked", expectedValue, isNot: false }
|
|
89
|
+
const expectedValue = { checked: action.value === "true" };
|
|
90
|
+
result = await frame.expect(progress, action.selector, { selector: action.selector, expression: "to.be.checked", expectedValue, isNot: false });
|
|
79
91
|
} else {
|
|
80
92
|
throw new Error(`Unsupported element type: ${action.type}`);
|
|
81
93
|
}
|
|
82
|
-
if (result.
|
|
94
|
+
if (!result.matches)
|
|
83
95
|
throw new Error(result.errorMessage);
|
|
84
96
|
break;
|
|
85
97
|
}
|
|
86
98
|
}
|
|
87
99
|
}
|
|
88
|
-
function
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
100
|
+
function generateActionTimeout(action) {
|
|
101
|
+
switch (action.method) {
|
|
102
|
+
case "click":
|
|
103
|
+
case "drag":
|
|
104
|
+
case "hover":
|
|
105
|
+
case "selectOption":
|
|
106
|
+
case "pressKey":
|
|
107
|
+
case "pressSequentially":
|
|
108
|
+
case "fill":
|
|
109
|
+
case "setChecked":
|
|
110
|
+
return 5e3;
|
|
111
|
+
case "expectVisible":
|
|
112
|
+
case "expectValue":
|
|
113
|
+
return 1;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
function performActionTimeout(action) {
|
|
117
|
+
switch (action.method) {
|
|
118
|
+
case "click":
|
|
119
|
+
case "drag":
|
|
120
|
+
case "hover":
|
|
121
|
+
case "selectOption":
|
|
122
|
+
case "pressKey":
|
|
123
|
+
case "pressSequentially":
|
|
124
|
+
case "fill":
|
|
125
|
+
case "setChecked":
|
|
126
|
+
return 0;
|
|
127
|
+
// no timeout
|
|
128
|
+
case "expectVisible":
|
|
129
|
+
case "expectValue":
|
|
130
|
+
return 5e3;
|
|
131
|
+
}
|
|
93
132
|
}
|
|
94
133
|
const strictTrue = { strict: true };
|
|
95
134
|
// Annotate the CommonJS export names for ESM import in node:
|
|
96
135
|
0 && (module.exports = {
|
|
97
|
-
|
|
98
|
-
|
|
136
|
+
generateActionTimeout,
|
|
137
|
+
performActionTimeout,
|
|
138
|
+
runAction
|
|
99
139
|
});
|
|
@@ -41,9 +41,9 @@ var import_context = require("./context");
|
|
|
41
41
|
var import_page = require("../page");
|
|
42
42
|
async function pagePerform(progress, page, options) {
|
|
43
43
|
const context = new import_context.Context(progress, page);
|
|
44
|
-
if (await cachedPerform(context, options))
|
|
44
|
+
if (await cachedPerform(progress, context, options))
|
|
45
45
|
return { turns: 0, inputTokens: 0, outputTokens: 0 };
|
|
46
|
-
const { usage } = await perform(context, options.task, void 0, options);
|
|
46
|
+
const { usage } = await perform(progress, context, options.task, void 0, options);
|
|
47
47
|
await updateCache(context, options);
|
|
48
48
|
return usage;
|
|
49
49
|
}
|
|
@@ -55,11 +55,11 @@ Extract the following information from the page. Do not perform any actions, jus
|
|
|
55
55
|
|
|
56
56
|
### Query
|
|
57
57
|
${options.query}`;
|
|
58
|
-
const { result, usage } = await perform(context, task, options.schema, options);
|
|
58
|
+
const { result, usage } = await perform(progress, context, task, options.schema, options);
|
|
59
59
|
return { result, usage };
|
|
60
60
|
}
|
|
61
|
-
async function perform(context, userTask, resultSchema, options = {}) {
|
|
62
|
-
const {
|
|
61
|
+
async function perform(progress, context, userTask, resultSchema, options = {}) {
|
|
62
|
+
const { page } = context;
|
|
63
63
|
const browserContext = page.browserContext;
|
|
64
64
|
if (!browserContext._options.agent)
|
|
65
65
|
throw new Error(`page.perform() and page.extract() require the agent to be set on the browser context`);
|
|
@@ -75,6 +75,11 @@ async function perform(context, userTask, resultSchema, options = {}) {
|
|
|
75
75
|
callTool,
|
|
76
76
|
tools,
|
|
77
77
|
...limits,
|
|
78
|
+
onBeforeTurn: ({ conversation }) => {
|
|
79
|
+
const userMessage = conversation.messages.find((m) => m.role === "user");
|
|
80
|
+
page.emit(import_page.Page.Events.AgentTurn, { role: "user", message: userMessage?.content ?? "" });
|
|
81
|
+
return "continue";
|
|
82
|
+
},
|
|
78
83
|
onAfterTurn: ({ assistantMessage, totalUsage }) => {
|
|
79
84
|
++turns;
|
|
80
85
|
const usage2 = { inputTokens: totalUsage.input, outputTokens: totalUsage.output };
|
|
@@ -95,6 +100,10 @@ async function perform(context, userTask, resultSchema, options = {}) {
|
|
|
95
100
|
return "break";
|
|
96
101
|
return "continue";
|
|
97
102
|
},
|
|
103
|
+
onToolCallError: ({ toolCall, error }) => {
|
|
104
|
+
page.emit(import_page.Page.Events.AgentTurn, { role: "user", message: `tool "${toolCall.name}" failed: ${error.message}` });
|
|
105
|
+
return "continue";
|
|
106
|
+
},
|
|
98
107
|
...options
|
|
99
108
|
});
|
|
100
109
|
const task = `${userTask}
|
|
@@ -113,7 +122,7 @@ ${full}
|
|
|
113
122
|
};
|
|
114
123
|
}
|
|
115
124
|
const allCaches = /* @__PURE__ */ new Map();
|
|
116
|
-
async function cachedPerform(context, options) {
|
|
125
|
+
async function cachedPerform(progress, context, options) {
|
|
117
126
|
if (!context.options?.cacheFile || context.options.cacheMode === "ignore" || context.options.cacheMode === "update")
|
|
118
127
|
return false;
|
|
119
128
|
const cache = await cachedActions(context.options.cacheFile);
|
|
@@ -125,7 +134,7 @@ async function cachedPerform(context, options) {
|
|
|
125
134
|
return false;
|
|
126
135
|
}
|
|
127
136
|
for (const action of entry.actions)
|
|
128
|
-
await (0, import_actionRunner.runAction)(
|
|
137
|
+
await (0, import_actionRunner.runAction)(progress, "run", context.page, action, context.options.secrets ?? []);
|
|
129
138
|
return true;
|
|
130
139
|
}
|
|
131
140
|
async function updateCache(context, options) {
|
|
@@ -138,7 +147,9 @@ async function updateCache(context, options) {
|
|
|
138
147
|
timestamp: Date.now(),
|
|
139
148
|
actions: context.actions
|
|
140
149
|
};
|
|
141
|
-
|
|
150
|
+
const entries = Object.entries(cache);
|
|
151
|
+
entries.sort((e1, e2) => e1[0].localeCompare(e2[0]));
|
|
152
|
+
await import_fs.default.promises.writeFile(cacheFile, JSON.stringify(Object.fromEntries(entries), void 0, 2));
|
|
142
153
|
}
|
|
143
154
|
async function cachedActions(cacheFile) {
|
|
144
155
|
let cache = allCaches.get(cacheFile);
|
|
@@ -72,6 +72,8 @@ async function generateCode(sdkLanguage, action) {
|
|
|
72
72
|
}
|
|
73
73
|
case "expectValue": {
|
|
74
74
|
const locator = (0, import_locatorGenerators.asLocator)(sdkLanguage, action.selector);
|
|
75
|
+
if (action.type === "checkbox" || action.type === "radio")
|
|
76
|
+
return `await expect(page.${locator}).toBeChecked({ checked: ${action.value === "true"} });`;
|
|
75
77
|
return `await expect(page.${locator}).toHaveValue(${(0, import_stringUtils.escapeWithQuotes)(action.value)});`;
|
|
76
78
|
}
|
|
77
79
|
}
|
|
@@ -25,9 +25,9 @@ var import_browserContext = require("../browserContext");
|
|
|
25
25
|
var import_actionRunner = require("./actionRunner");
|
|
26
26
|
var import_codegen = require("./codegen");
|
|
27
27
|
class Context {
|
|
28
|
-
constructor(
|
|
28
|
+
constructor(apiCallProgress, page) {
|
|
29
29
|
this.actions = [];
|
|
30
|
-
this.
|
|
30
|
+
this._progress = apiCallProgress;
|
|
31
31
|
this.page = page;
|
|
32
32
|
this.options = page.browserContext._options.agent;
|
|
33
33
|
this.sdkLanguage = page.browserContext._browser.sdkLanguage();
|
|
@@ -44,18 +44,15 @@ class Context {
|
|
|
44
44
|
return await this.runActionsAndWait([action]);
|
|
45
45
|
}
|
|
46
46
|
async runActionsAndWait(action) {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
} catch (e) {
|
|
57
|
-
return await this.snapshotResult(e);
|
|
58
|
-
}
|
|
47
|
+
const error = await this.waitForCompletion(async () => {
|
|
48
|
+
for (const a of action) {
|
|
49
|
+
await (0, import_actionRunner.runAction)(this._progress, "generate", this.page, a, this.options?.secrets ?? []);
|
|
50
|
+
const code = await (0, import_codegen.generateCode)(this.sdkLanguage, a);
|
|
51
|
+
this.actions.push({ ...a, code, intent: this._callIntent });
|
|
52
|
+
}
|
|
53
|
+
return void 0;
|
|
54
|
+
}).catch((error2) => error2);
|
|
55
|
+
return await this.snapshotResult(error);
|
|
59
56
|
}
|
|
60
57
|
async waitForCompletion(callback) {
|
|
61
58
|
const requests = [];
|
|
@@ -67,13 +64,13 @@ class Context {
|
|
|
67
64
|
let result;
|
|
68
65
|
try {
|
|
69
66
|
result = await callback();
|
|
70
|
-
await this.
|
|
67
|
+
await this._progress.wait(500);
|
|
71
68
|
} finally {
|
|
72
69
|
disposeListeners();
|
|
73
70
|
}
|
|
74
71
|
const requestedNavigation = requests.some((request) => request.isNavigationRequest());
|
|
75
72
|
if (requestedNavigation) {
|
|
76
|
-
await this.page.mainFrame().waitForLoadState(this.
|
|
73
|
+
await this.page.mainFrame().waitForLoadState(this._progress, "load");
|
|
77
74
|
return result;
|
|
78
75
|
}
|
|
79
76
|
const promises = [];
|
|
@@ -83,13 +80,13 @@ class Context {
|
|
|
83
80
|
else
|
|
84
81
|
promises.push(request.response());
|
|
85
82
|
}
|
|
86
|
-
await this.
|
|
83
|
+
await this._progress.race(promises, { timeout: 5e3 });
|
|
87
84
|
if (requests.length)
|
|
88
|
-
await this.
|
|
85
|
+
await this._progress.wait(500);
|
|
89
86
|
return result;
|
|
90
87
|
}
|
|
91
88
|
async snapshotResult(error) {
|
|
92
|
-
let { full } = await this.page.snapshotForAI(this.
|
|
89
|
+
let { full } = await this.page.snapshotForAI(this._progress);
|
|
93
90
|
full = this._redactText(full);
|
|
94
91
|
const text = [];
|
|
95
92
|
if (error)
|
|
@@ -116,7 +113,7 @@ ${full}`);
|
|
|
116
113
|
async refSelectors(params) {
|
|
117
114
|
return Promise.all(params.map(async (param) => {
|
|
118
115
|
try {
|
|
119
|
-
const { resolvedSelector } = await this.page.mainFrame().resolveSelector(this.
|
|
116
|
+
const { resolvedSelector } = await this.page.mainFrame().resolveSelector(this._progress, `aria-ref=${param.ref}`);
|
|
120
117
|
return resolvedSelector;
|
|
121
118
|
} catch (e) {
|
|
122
119
|
throw new Error(`Ref ${param.ref} not found in the current page snapshot. Try capturing new snapshot.`);
|
|
@@ -123,7 +123,10 @@ class BidiExecutionContext {
|
|
|
123
123
|
}
|
|
124
124
|
return names2;
|
|
125
125
|
});
|
|
126
|
-
const values = await Promise.all(names.map((name) =>
|
|
126
|
+
const values = await Promise.all(names.map(async (name) => {
|
|
127
|
+
const value = await this._rawCallFunction("(object, name) => object[name]", [{ handle: handle._objectId }, { type: "string", value: name }], true, false);
|
|
128
|
+
return createHandle(handle._context, value);
|
|
129
|
+
}));
|
|
127
130
|
const map = /* @__PURE__ */ new Map();
|
|
128
131
|
for (let i = 0; i < names.length; i++)
|
|
129
132
|
map.set(names[i], values[i]);
|
|
@@ -152,7 +155,7 @@ class BidiExecutionContext {
|
|
|
152
155
|
return createHandle(context, result);
|
|
153
156
|
}
|
|
154
157
|
async contentFrameIdForFrame(handle) {
|
|
155
|
-
const contentWindow = await this._rawCallFunction("e => e.contentWindow", { handle: handle._objectId });
|
|
158
|
+
const contentWindow = await this._rawCallFunction("e => e.contentWindow", [{ handle: handle._objectId }]);
|
|
156
159
|
if (contentWindow?.type === "window")
|
|
157
160
|
return contentWindow.value.context;
|
|
158
161
|
return null;
|
|
@@ -166,17 +169,17 @@ class BidiExecutionContext {
|
|
|
166
169
|
return null;
|
|
167
170
|
}
|
|
168
171
|
async _remoteValueForReference(reference, createHandle2) {
|
|
169
|
-
return await this._rawCallFunction("e => e", reference, createHandle2);
|
|
172
|
+
return await this._rawCallFunction("e => e", [reference], createHandle2);
|
|
170
173
|
}
|
|
171
|
-
async _rawCallFunction(functionDeclaration,
|
|
174
|
+
async _rawCallFunction(functionDeclaration, args, createHandle2, awaitPromise = true) {
|
|
172
175
|
const response = await this._session.send("script.callFunction", {
|
|
173
176
|
functionDeclaration,
|
|
174
177
|
target: this._target,
|
|
175
|
-
arguments:
|
|
178
|
+
arguments: args,
|
|
176
179
|
// "Root" is necessary for the handle to be returned.
|
|
177
180
|
resultOwnership: createHandle2 ? bidi.Script.ResultOwnership.Root : bidi.Script.ResultOwnership.None,
|
|
178
181
|
serializationOptions: { maxObjectDepth: 0, maxDomDepth: 0 },
|
|
179
|
-
awaitPromise
|
|
182
|
+
awaitPromise,
|
|
180
183
|
userActivation: true
|
|
181
184
|
});
|
|
182
185
|
if (response.type === "exception")
|
package/lib/server/progress.js
CHANGED
|
@@ -44,9 +44,11 @@ class ProgressController {
|
|
|
44
44
|
await this._donePromise;
|
|
45
45
|
}
|
|
46
46
|
async run(task, timeout) {
|
|
47
|
+
const deadline = timeout ? (0, import_utils.monotonicTime)() + timeout : 0;
|
|
47
48
|
(0, import_utils.assert)(this._state === "before");
|
|
48
49
|
this._state = "running";
|
|
49
50
|
const progress = {
|
|
51
|
+
deadline,
|
|
50
52
|
log: (message) => {
|
|
51
53
|
if (this._state === "running")
|
|
52
54
|
this.metadata.log.push(message);
|
|
@@ -55,7 +57,9 @@ class ProgressController {
|
|
|
55
57
|
metadata: this.metadata,
|
|
56
58
|
race: (promise, options) => {
|
|
57
59
|
const promises = Array.isArray(promise) ? promise : [promise];
|
|
58
|
-
const
|
|
60
|
+
const mt = (0, import_utils.monotonicTime)();
|
|
61
|
+
const dl = options?.timeout ? mt + options.timeout : 0;
|
|
62
|
+
const timerPromise = dl && (!deadline || dl < deadline) ? new Promise((f) => setTimeout(f, dl - mt)) : null;
|
|
59
63
|
return Promise.race([...promises, ...timerPromise ? [timerPromise] : [], this._forceAbortPromise]);
|
|
60
64
|
},
|
|
61
65
|
wait: async (timeout2) => {
|
|
@@ -65,7 +69,7 @@ class ProgressController {
|
|
|
65
69
|
}
|
|
66
70
|
};
|
|
67
71
|
let timer;
|
|
68
|
-
if (
|
|
72
|
+
if (deadline) {
|
|
69
73
|
const timeoutError = new import_errors.TimeoutError(`Timeout ${timeout}ms exceeded.`);
|
|
70
74
|
timer = setTimeout(() => {
|
|
71
75
|
if (this.metadata.pauseStartTime && !this.metadata.pauseEndTime)
|
|
@@ -75,7 +79,7 @@ class ProgressController {
|
|
|
75
79
|
this._state = { error: timeoutError };
|
|
76
80
|
this._forceAbortPromise.reject(timeoutError);
|
|
77
81
|
}
|
|
78
|
-
},
|
|
82
|
+
}, deadline - (0, import_utils.monotonicTime)());
|
|
79
83
|
}
|
|
80
84
|
try {
|
|
81
85
|
const result = await task(progress);
|
|
@@ -47,20 +47,21 @@ var import_launchApp2 = require("../../launchApp");
|
|
|
47
47
|
var import_playwright = require("../../playwright");
|
|
48
48
|
var import_progress = require("../../progress");
|
|
49
49
|
const tracesDirMarker = "traces.dir";
|
|
50
|
-
function validateTraceUrl(
|
|
51
|
-
if (!
|
|
52
|
-
return
|
|
53
|
-
if (
|
|
54
|
-
return
|
|
55
|
-
|
|
56
|
-
|
|
50
|
+
function validateTraceUrl(traceFileOrUrl) {
|
|
51
|
+
if (!traceFileOrUrl)
|
|
52
|
+
return traceFileOrUrl;
|
|
53
|
+
if (traceFileOrUrl.startsWith("http://") || traceFileOrUrl.startsWith("https://"))
|
|
54
|
+
return traceFileOrUrl;
|
|
55
|
+
let traceFile = traceFileOrUrl;
|
|
56
|
+
if (traceFile.endsWith(".json"))
|
|
57
|
+
return toFilePathUrl(traceFile);
|
|
57
58
|
try {
|
|
58
|
-
const stat = import_fs.default.statSync(
|
|
59
|
+
const stat = import_fs.default.statSync(traceFile);
|
|
59
60
|
if (stat.isDirectory())
|
|
60
|
-
|
|
61
|
-
return
|
|
61
|
+
traceFile = import_path.default.join(traceFile, tracesDirMarker);
|
|
62
|
+
return toFilePathUrl(traceFile);
|
|
62
63
|
} catch {
|
|
63
|
-
throw new Error(`Trace file ${
|
|
64
|
+
throw new Error(`Trace file ${traceFileOrUrl} does not exist!`);
|
|
64
65
|
}
|
|
65
66
|
}
|
|
66
67
|
async function startTraceViewerServer(options) {
|
|
@@ -221,15 +222,18 @@ function traceDescriptor(traceDir, tracePrefix) {
|
|
|
221
222
|
};
|
|
222
223
|
for (const name of import_fs.default.readdirSync(traceDir)) {
|
|
223
224
|
if (!tracePrefix || name.startsWith(tracePrefix))
|
|
224
|
-
result.entries.push({ name, path: import_path.default.join(traceDir, name) });
|
|
225
|
+
result.entries.push({ name, path: toFilePathUrl(import_path.default.join(traceDir, name)) });
|
|
225
226
|
}
|
|
226
227
|
const resourcesDir = import_path.default.join(traceDir, "resources");
|
|
227
228
|
if (import_fs.default.existsSync(resourcesDir)) {
|
|
228
229
|
for (const name of import_fs.default.readdirSync(resourcesDir))
|
|
229
|
-
result.entries.push({ name: "resources/" + name, path: import_path.default.join(resourcesDir, name) });
|
|
230
|
+
result.entries.push({ name: "resources/" + name, path: toFilePathUrl(import_path.default.join(resourcesDir, name)) });
|
|
230
231
|
}
|
|
231
232
|
return result;
|
|
232
233
|
}
|
|
234
|
+
function toFilePathUrl(filePath) {
|
|
235
|
+
return `file?path=${encodeURIComponent(filePath)}`;
|
|
236
|
+
}
|
|
233
237
|
// Annotate the CommonJS export names for ESM import in node:
|
|
234
238
|
0 && (module.exports = {
|
|
235
239
|
installRootRedirect,
|
|
@@ -34,10 +34,10 @@ const prevByEndTimeSymbol = Symbol("prevByEndTime");
|
|
|
34
34
|
const nextByStartTimeSymbol = Symbol("nextByStartTime");
|
|
35
35
|
const eventsSymbol = Symbol("events");
|
|
36
36
|
class TraceModel {
|
|
37
|
-
constructor(
|
|
37
|
+
constructor(traceUri, contexts) {
|
|
38
38
|
contexts.forEach((contextEntry) => indexModel(contextEntry));
|
|
39
39
|
const libraryContext = contexts.find((context2) => context2.origin === "library");
|
|
40
|
-
this.
|
|
40
|
+
this.traceUri = traceUri;
|
|
41
41
|
this.browserName = libraryContext?.browserName || "";
|
|
42
42
|
this.sdkLanguage = libraryContext?.sdkLanguage;
|
|
43
43
|
this.channel = libraryContext?.channel;
|
|
@@ -57,7 +57,7 @@ class TraceModel {
|
|
|
57
57
|
this.hasSource = contexts.some((c) => c.hasSource);
|
|
58
58
|
this.hasStepData = contexts.some((context2) => context2.origin === "testRunner");
|
|
59
59
|
this.resources = [...contexts.map((c) => c.resources)].flat();
|
|
60
|
-
this.attachments = this.actions.flatMap((action) => action.attachments?.map((attachment) => ({ ...attachment, callId: action.callId,
|
|
60
|
+
this.attachments = this.actions.flatMap((action) => action.attachments?.map((attachment) => ({ ...attachment, callId: action.callId, traceUri })) ?? []);
|
|
61
61
|
this.visibleAttachments = this.attachments.filter((attachment) => !attachment.name.startsWith("_"));
|
|
62
62
|
this.events.sort((a1, a2) => a1.time - a2.time);
|
|
63
63
|
this.resources.sort((a1, a2) => a1._monotonicTime - a2._monotonicTime);
|
|
@@ -72,7 +72,7 @@ class TraceModel {
|
|
|
72
72
|
}
|
|
73
73
|
createRelativeUrl(path) {
|
|
74
74
|
const url = new URL("http://localhost/" + path);
|
|
75
|
-
url.searchParams.set("trace", this.
|
|
75
|
+
url.searchParams.set("trace", this.traceUri);
|
|
76
76
|
return url.toString().substring("http://localhost/".length);
|
|
77
77
|
}
|
|
78
78
|
failedAction() {
|
package/lib/vite/traceViewer/assets/{codeMirrorModule-Dqdugjpa.js → codeMirrorModule-DqqhreXd.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{v as Ju}from"./defaultSettingsView-DIraU59a.js";var vi={exports:{}},Zu=vi.exports,pa;function mt(){return pa||(pa=1,(function(ct,xt){(function(b,pe){ct.exports=pe()})(Zu,(function(){var b=navigator.userAgent,pe=navigator.platform,_=/gecko\/\d/i.test(b),te=/MSIE \d/.test(b),oe=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(b),Q=/Edge\/(\d+)/.exec(b),k=te||oe||Q,I=k&&(te?document.documentMode||6:+(Q||oe)[1]),Y=!Q&&/WebKit\//.test(b),ne=Y&&/Qt\/\d+\.\d+/.test(b),S=!Q&&/Chrome\/(\d+)/.exec(b),R=S&&+S[1],A=/Opera\//.test(b),V=/Apple Computer/.test(navigator.vendor),ue=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(b),O=/PhantomJS/.test(b),w=V&&(/Mobile\/\w+/.test(b)||navigator.maxTouchPoints>2),M=/Android/.test(b),N=w||M||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(b),z=w||/Mac/.test(pe),X=/\bCrOS\b/.test(b),q=/win/i.test(pe),p=A&&b.match(/Version\/(\d*\.\d*)/);p&&(p=Number(p[1])),p&&p>=15&&(A=!1,Y=!0);var W=z&&(ne||A&&(p==null||p<12.11)),J=_||k&&I>=9;function P(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var $=function(e,t){var n=e.className,r=P(t).exec(n);if(r){var i=n.slice(r.index+r[0].length);e.className=n.slice(0,r.index)+(i?r[1]+i:"")}};function F(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function G(e,t){return F(e).appendChild(t)}function c(e,t,n,r){var i=document.createElement(e);if(n&&(i.className=n),r&&(i.style.cssText=r),typeof t=="string")i.appendChild(document.createTextNode(t));else if(t)for(var o=0;o<t.length;++o)i.appendChild(t[o]);return i}function T(e,t,n,r){var i=c(e,t,n,r);return i.setAttribute("role","presentation"),i}var C;document.createRange?C=function(e,t,n,r){var i=document.createRange();return i.setEnd(r||e,n),i.setStart(e,t),i}:C=function(e,t,n){var r=document.body.createTextRange();try{r.moveToElementText(e.parentNode)}catch{return r}return r.collapse(!0),r.moveEnd("character",n),r.moveStart("character",t),r};function g(e,t){if(t.nodeType==3&&(t=t.parentNode),e.contains)return e.contains(t);do if(t.nodeType==11&&(t=t.host),t==e)return!0;while(t=t.parentNode)}function y(e){var t=e.ownerDocument||e,n;try{n=e.activeElement}catch{n=t.body||null}for(;n&&n.shadowRoot&&n.shadowRoot.activeElement;)n=n.shadowRoot.activeElement;return n}function j(e,t){var n=e.className;P(t).test(n)||(e.className+=(n?" ":"")+t)}function de(e,t){for(var n=e.split(" "),r=0;r<n.length;r++)n[r]&&!P(n[r]).test(t)&&(t+=" "+n[r]);return t}var v=function(e){e.select()};w?v=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:k&&(v=function(e){try{e.select()}catch{}});function d(e){return e.display.wrapper.ownerDocument}function fe(e){return Te(e.display.wrapper)}function Te(e){return e.getRootNode?e.getRootNode():e.ownerDocument}function le(e){return d(e).defaultView}function xe(e){var t=Array.prototype.slice.call(arguments,1);return function(){return e.apply(null,t)}}function Me(e,t,n){t||(t={});for(var r in e)e.hasOwnProperty(r)&&(n!==!1||!t.hasOwnProperty(r))&&(t[r]=e[r]);return t}function Fe(e,t,n,r,i){t==null&&(t=e.search(/[^\s\u00a0]/),t==-1&&(t=e.length));for(var o=r||0,l=i||0;;){var a=e.indexOf(" ",o);if(a<0||a>=t)return l+(t-o);l+=a-o,l+=n-l%n,o=a+1}}var Ce=function(){this.id=null,this.f=null,this.time=0,this.handler=xe(this.onTimeout,this)};Ce.prototype.onTimeout=function(e){e.id=0,e.time<=+new Date?e.f():setTimeout(e.handler,e.time-+new Date)},Ce.prototype.set=function(e,t){this.f=t;var n=+new Date+e;(!this.id||n<this.time)&&(clearTimeout(this.id),this.id=setTimeout(this.handler,e),this.time=n)};function ve(e,t){for(var n=0;n<e.length;++n)if(e[n]==t)return n;return-1}var Oe=50,qe={toString:function(){return"CodeMirror.Pass"}},Ve={scroll:!1},dt={origin:"*mouse"},Pe={origin:"+move"};function _e(e,t,n){for(var r=0,i=0;;){var o=e.indexOf(" ",r);o==-1&&(o=e.length);var l=o-r;if(o==e.length||i+l>=t)return r+Math.min(l,t-i);if(i+=o-r,i+=n-i%n,r=o+1,i>=t)return r}}var Ue=[""];function et(e){for(;Ue.length<=e;)Ue.push(we(Ue)+" ");return Ue[e]}function we(e){return e[e.length-1]}function Ie(e,t){for(var n=[],r=0;r<e.length;r++)n[r]=t(e[r],r);return n}function E(e,t,n){for(var r=0,i=n(t);r<e.length&&n(e[r])<=i;)r++;e.splice(r,0,t)}function ee(){}function K(e,t){var n;return Object.create?n=Object.create(e):(ee.prototype=e,n=new ee),t&&Me(t,n),n}var ze=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;function me(e){return/\w/.test(e)||e>""&&(e.toUpperCase()!=e.toLowerCase()||ze.test(e))}function De(e,t){return t?t.source.indexOf("\\w")>-1&&me(e)?!0:t.test(e):me(e)}function be(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}var Be=/[\u0300-\u036f\u0483-\u0489\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u065e\u0670\u06d6-\u06dc\u06de-\u06e4\u06e7\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0900-\u0902\u093c\u0941-\u0948\u094d\u0951-\u0955\u0962\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2\u09e3\u0a01\u0a02\u0a3c\u0a41\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a70\u0a71\u0a75\u0a81\u0a82\u0abc\u0ac1-\u0ac5\u0ac7\u0ac8\u0acd\u0ae2\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0d3e\u0d41-\u0d44\u0d4d\u0d57\u0d62\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0f18\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86\u0f87\u0f90-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039\u103a\u103d\u103e\u1058\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085\u1086\u108d\u109d\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193b\u1a17\u1a18\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80\u1b81\u1ba2-\u1ba5\u1ba8\u1ba9\u1c2c-\u1c33\u1c36\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1dc0-\u1de6\u1dfd-\u1dff\u200c\u200d\u20d0-\u20f0\u2cef-\u2cf1\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua66f-\ua672\ua67c\ua67d\ua6f0\ua6f1\ua802\ua806\ua80b\ua825\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\uaa29-\uaa2e\uaa31\uaa32\uaa35\uaa36\uaa43\uaa4c\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uabe5\uabe8\uabed\udc00-\udfff\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\uff9e\uff9f]/;function Ne(e){return e.charCodeAt(0)>=768&&Be.test(e)}function Mt(e,t,n){for(;(n<0?t>0:t<e.length)&&Ne(e.charAt(t));)t+=n;return t}function Pt(e,t,n){for(var r=t>n?-1:1;;){if(t==n)return t;var i=(t+n)/2,o=r<0?Math.ceil(i):Math.floor(i);if(o==t)return e(o)?t:n;e(o)?n=o:t=o+r}}function or(e,t,n,r){if(!e)return r(t,n,"ltr",0);for(var i=!1,o=0;o<e.length;++o){var l=e[o];(l.from<n&&l.to>t||t==n&&l.to==t)&&(r(Math.max(l.from,t),Math.min(l.to,n),l.level==1?"rtl":"ltr",o),i=!0)}i||r(t,n,"ltr")}var br=null;function lr(e,t,n){var r;br=null;for(var i=0;i<e.length;++i){var o=e[i];if(o.from<t&&o.to>t)return i;o.to==t&&(o.from!=o.to&&n=="before"?r=i:br=i),o.from==t&&(o.from!=o.to&&n!="before"?r=i:br=i)}return r??br}var mi=(function(){var e="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",t="nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111";function n(u){return u<=247?e.charAt(u):1424<=u&&u<=1524?"R":1536<=u&&u<=1785?t.charAt(u-1536):1774<=u&&u<=2220?"r":8192<=u&&u<=8203?"w":u==8204?"b":"L"}var r=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,i=/[stwN]/,o=/[LRr]/,l=/[Lb1n]/,a=/[1n]/;function s(u,h,x){this.level=u,this.from=h,this.to=x}return function(u,h){var x=h=="ltr"?"L":"R";if(u.length==0||h=="ltr"&&!r.test(u))return!1;for(var D=u.length,L=[],H=0;H<D;++H)L.push(n(u.charCodeAt(H)));for(var Z=0,ie=x;Z<D;++Z){var ae=L[Z];ae=="m"?L[Z]=ie:ie=ae}for(var he=0,se=x;he<D;++he){var ge=L[he];ge=="1"&&se=="r"?L[he]="n":o.test(ge)&&(se=ge,ge=="r"&&(L[he]="R"))}for(var Le=1,ke=L[0];Le<D-1;++Le){var Ee=L[Le];Ee=="+"&&ke=="1"&&L[Le+1]=="1"?L[Le]="1":Ee==","&&ke==L[Le+1]&&(ke=="1"||ke=="n")&&(L[Le]=ke),ke=Ee}for(var Ke=0;Ke<D;++Ke){var st=L[Ke];if(st==",")L[Ke]="N";else if(st=="%"){var Xe=void 0;for(Xe=Ke+1;Xe<D&&L[Xe]=="%";++Xe);for(var Nt=Ke&&L[Ke-1]=="!"||Xe<D&&L[Xe]=="1"?"1":"N",Tt=Ke;Tt<Xe;++Tt)L[Tt]=Nt;Ke=Xe-1}}for(var tt=0,Ct=x;tt<D;++tt){var ft=L[tt];Ct=="L"&&ft=="1"?L[tt]="L":o.test(ft)&&(Ct=ft)}for(var nt=0;nt<D;++nt)if(i.test(L[nt])){var rt=void 0;for(rt=nt+1;rt<D&&i.test(L[rt]);++rt);for(var Ze=(nt?L[nt-1]:x)=="L",Dt=(rt<D?L[rt]:x)=="L",nn=Ze==Dt?Ze?"L":"R":x,yr=nt;yr<rt;++yr)L[yr]=nn;nt=rt-1}for(var vt=[],Jt,ut=0;ut<D;)if(l.test(L[ut])){var co=ut;for(++ut;ut<D&&l.test(L[ut]);++ut);vt.push(new s(0,co,ut))}else{var ir=ut,Ar=vt.length,Nr=h=="rtl"?1:0;for(++ut;ut<D&&L[ut]!="L";++ut);for(var bt=ir;bt<ut;)if(a.test(L[bt])){ir<bt&&(vt.splice(Ar,0,new s(1,ir,bt)),Ar+=Nr);var on=bt;for(++bt;bt<ut&&a.test(L[bt]);++bt);vt.splice(Ar,0,new s(2,on,bt)),Ar+=Nr,ir=bt}else++bt;ir<ut&&vt.splice(Ar,0,new s(1,ir,ut))}return h=="ltr"&&(vt[0].level==1&&(Jt=u.match(/^\s+/))&&(vt[0].from=Jt[0].length,vt.unshift(new s(0,0,Jt[0].length))),we(vt).level==1&&(Jt=u.match(/\s+$/))&&(we(vt).to-=Jt[0].length,vt.push(new s(0,D-Jt[0].length,D)))),h=="rtl"?vt.reverse():vt}})();function Re(e,t){var n=e.order;return n==null&&(n=e.order=mi(e.text,t)),n}var Bn=[],Se=function(e,t,n){if(e.addEventListener)e.addEventListener(t,n,!1);else if(e.attachEvent)e.attachEvent("on"+t,n);else{var r=e._handlers||(e._handlers={});r[t]=(r[t]||Bn).concat(n)}};function Zt(e,t){return e._handlers&&e._handlers[t]||Bn}function ht(e,t,n){if(e.removeEventListener)e.removeEventListener(t,n,!1);else if(e.detachEvent)e.detachEvent("on"+t,n);else{var r=e._handlers,i=r&&r[t];if(i){var o=ve(i,n);o>-1&&(r[t]=i.slice(0,o).concat(i.slice(o+1)))}}}function Ye(e,t){var n=Zt(e,t);if(n.length)for(var r=Array.prototype.slice.call(arguments,2),i=0;i<n.length;++i)n[i].apply(null,r)}function Qe(e,t,n){return typeof t=="string"&&(t={type:t,preventDefault:function(){this.defaultPrevented=!0}}),Ye(e,n||t.type,e,t),kt(t)||t.codemirrorIgnore}function It(e){var t=e._handlers&&e._handlers.cursorActivity;if(t)for(var n=e.curOp.cursorActivityHandlers||(e.curOp.cursorActivityHandlers=[]),r=0;r<t.length;++r)ve(n,t[r])==-1&&n.push(t[r])}function Ft(e,t){return Zt(e,t).length>0}function Bt(e){e.prototype.on=function(t,n){Se(this,t,n)},e.prototype.off=function(t,n){ht(this,t,n)}}function pt(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function Er(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function kt(e){return e.defaultPrevented!=null?e.defaultPrevented:e.returnValue==!1}function ar(e){pt(e),Er(e)}function ln(e){return e.target||e.srcElement}function Rt(e){var t=e.which;return t==null&&(e.button&1?t=1:e.button&2?t=3:e.button&4&&(t=2)),z&&e.ctrlKey&&t==1&&(t=3),t}var xi=(function(){if(k&&I<9)return!1;var e=c("div");return"draggable"in e||"dragDrop"in e})(),Or;function Rn(e){if(Or==null){var t=c("span","");G(e,c("span",[t,document.createTextNode("x")])),e.firstChild.offsetHeight!=0&&(Or=t.offsetWidth<=1&&t.offsetHeight>2&&!(k&&I<8))}var n=Or?c("span",""):c("span"," ",null,"display: inline-block; width: 1px; margin-right: -1px");return n.setAttribute("cm-text",""),n}var an;function sr(e){if(an!=null)return an;var t=G(e,document.createTextNode("AخA")),n=C(t,0,1).getBoundingClientRect(),r=C(t,1,2).getBoundingClientRect();return F(e),!n||n.left==n.right?!1:an=r.right-n.right<3}var zt=`
|
|
1
|
+
import{v as Ju}from"./defaultSettingsView-B-IIHg_U.js";var vi={exports:{}},Zu=vi.exports,pa;function mt(){return pa||(pa=1,(function(ct,xt){(function(b,pe){ct.exports=pe()})(Zu,(function(){var b=navigator.userAgent,pe=navigator.platform,_=/gecko\/\d/i.test(b),te=/MSIE \d/.test(b),oe=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(b),Q=/Edge\/(\d+)/.exec(b),k=te||oe||Q,I=k&&(te?document.documentMode||6:+(Q||oe)[1]),Y=!Q&&/WebKit\//.test(b),ne=Y&&/Qt\/\d+\.\d+/.test(b),S=!Q&&/Chrome\/(\d+)/.exec(b),R=S&&+S[1],A=/Opera\//.test(b),V=/Apple Computer/.test(navigator.vendor),ue=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(b),O=/PhantomJS/.test(b),w=V&&(/Mobile\/\w+/.test(b)||navigator.maxTouchPoints>2),M=/Android/.test(b),N=w||M||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(b),z=w||/Mac/.test(pe),X=/\bCrOS\b/.test(b),q=/win/i.test(pe),p=A&&b.match(/Version\/(\d*\.\d*)/);p&&(p=Number(p[1])),p&&p>=15&&(A=!1,Y=!0);var W=z&&(ne||A&&(p==null||p<12.11)),J=_||k&&I>=9;function P(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var $=function(e,t){var n=e.className,r=P(t).exec(n);if(r){var i=n.slice(r.index+r[0].length);e.className=n.slice(0,r.index)+(i?r[1]+i:"")}};function F(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function G(e,t){return F(e).appendChild(t)}function c(e,t,n,r){var i=document.createElement(e);if(n&&(i.className=n),r&&(i.style.cssText=r),typeof t=="string")i.appendChild(document.createTextNode(t));else if(t)for(var o=0;o<t.length;++o)i.appendChild(t[o]);return i}function T(e,t,n,r){var i=c(e,t,n,r);return i.setAttribute("role","presentation"),i}var C;document.createRange?C=function(e,t,n,r){var i=document.createRange();return i.setEnd(r||e,n),i.setStart(e,t),i}:C=function(e,t,n){var r=document.body.createTextRange();try{r.moveToElementText(e.parentNode)}catch{return r}return r.collapse(!0),r.moveEnd("character",n),r.moveStart("character",t),r};function g(e,t){if(t.nodeType==3&&(t=t.parentNode),e.contains)return e.contains(t);do if(t.nodeType==11&&(t=t.host),t==e)return!0;while(t=t.parentNode)}function y(e){var t=e.ownerDocument||e,n;try{n=e.activeElement}catch{n=t.body||null}for(;n&&n.shadowRoot&&n.shadowRoot.activeElement;)n=n.shadowRoot.activeElement;return n}function j(e,t){var n=e.className;P(t).test(n)||(e.className+=(n?" ":"")+t)}function de(e,t){for(var n=e.split(" "),r=0;r<n.length;r++)n[r]&&!P(n[r]).test(t)&&(t+=" "+n[r]);return t}var v=function(e){e.select()};w?v=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:k&&(v=function(e){try{e.select()}catch{}});function d(e){return e.display.wrapper.ownerDocument}function fe(e){return Te(e.display.wrapper)}function Te(e){return e.getRootNode?e.getRootNode():e.ownerDocument}function le(e){return d(e).defaultView}function xe(e){var t=Array.prototype.slice.call(arguments,1);return function(){return e.apply(null,t)}}function Me(e,t,n){t||(t={});for(var r in e)e.hasOwnProperty(r)&&(n!==!1||!t.hasOwnProperty(r))&&(t[r]=e[r]);return t}function Fe(e,t,n,r,i){t==null&&(t=e.search(/[^\s\u00a0]/),t==-1&&(t=e.length));for(var o=r||0,l=i||0;;){var a=e.indexOf(" ",o);if(a<0||a>=t)return l+(t-o);l+=a-o,l+=n-l%n,o=a+1}}var Ce=function(){this.id=null,this.f=null,this.time=0,this.handler=xe(this.onTimeout,this)};Ce.prototype.onTimeout=function(e){e.id=0,e.time<=+new Date?e.f():setTimeout(e.handler,e.time-+new Date)},Ce.prototype.set=function(e,t){this.f=t;var n=+new Date+e;(!this.id||n<this.time)&&(clearTimeout(this.id),this.id=setTimeout(this.handler,e),this.time=n)};function ve(e,t){for(var n=0;n<e.length;++n)if(e[n]==t)return n;return-1}var Oe=50,qe={toString:function(){return"CodeMirror.Pass"}},Ve={scroll:!1},dt={origin:"*mouse"},Pe={origin:"+move"};function _e(e,t,n){for(var r=0,i=0;;){var o=e.indexOf(" ",r);o==-1&&(o=e.length);var l=o-r;if(o==e.length||i+l>=t)return r+Math.min(l,t-i);if(i+=o-r,i+=n-i%n,r=o+1,i>=t)return r}}var Ue=[""];function et(e){for(;Ue.length<=e;)Ue.push(we(Ue)+" ");return Ue[e]}function we(e){return e[e.length-1]}function Ie(e,t){for(var n=[],r=0;r<e.length;r++)n[r]=t(e[r],r);return n}function E(e,t,n){for(var r=0,i=n(t);r<e.length&&n(e[r])<=i;)r++;e.splice(r,0,t)}function ee(){}function K(e,t){var n;return Object.create?n=Object.create(e):(ee.prototype=e,n=new ee),t&&Me(t,n),n}var ze=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;function me(e){return/\w/.test(e)||e>""&&(e.toUpperCase()!=e.toLowerCase()||ze.test(e))}function De(e,t){return t?t.source.indexOf("\\w")>-1&&me(e)?!0:t.test(e):me(e)}function be(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}var Be=/[\u0300-\u036f\u0483-\u0489\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u065e\u0670\u06d6-\u06dc\u06de-\u06e4\u06e7\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0900-\u0902\u093c\u0941-\u0948\u094d\u0951-\u0955\u0962\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2\u09e3\u0a01\u0a02\u0a3c\u0a41\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a70\u0a71\u0a75\u0a81\u0a82\u0abc\u0ac1-\u0ac5\u0ac7\u0ac8\u0acd\u0ae2\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0d3e\u0d41-\u0d44\u0d4d\u0d57\u0d62\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0f18\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86\u0f87\u0f90-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039\u103a\u103d\u103e\u1058\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085\u1086\u108d\u109d\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193b\u1a17\u1a18\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80\u1b81\u1ba2-\u1ba5\u1ba8\u1ba9\u1c2c-\u1c33\u1c36\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1dc0-\u1de6\u1dfd-\u1dff\u200c\u200d\u20d0-\u20f0\u2cef-\u2cf1\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua66f-\ua672\ua67c\ua67d\ua6f0\ua6f1\ua802\ua806\ua80b\ua825\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\uaa29-\uaa2e\uaa31\uaa32\uaa35\uaa36\uaa43\uaa4c\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uabe5\uabe8\uabed\udc00-\udfff\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\uff9e\uff9f]/;function Ne(e){return e.charCodeAt(0)>=768&&Be.test(e)}function Mt(e,t,n){for(;(n<0?t>0:t<e.length)&&Ne(e.charAt(t));)t+=n;return t}function Pt(e,t,n){for(var r=t>n?-1:1;;){if(t==n)return t;var i=(t+n)/2,o=r<0?Math.ceil(i):Math.floor(i);if(o==t)return e(o)?t:n;e(o)?n=o:t=o+r}}function or(e,t,n,r){if(!e)return r(t,n,"ltr",0);for(var i=!1,o=0;o<e.length;++o){var l=e[o];(l.from<n&&l.to>t||t==n&&l.to==t)&&(r(Math.max(l.from,t),Math.min(l.to,n),l.level==1?"rtl":"ltr",o),i=!0)}i||r(t,n,"ltr")}var br=null;function lr(e,t,n){var r;br=null;for(var i=0;i<e.length;++i){var o=e[i];if(o.from<t&&o.to>t)return i;o.to==t&&(o.from!=o.to&&n=="before"?r=i:br=i),o.from==t&&(o.from!=o.to&&n!="before"?r=i:br=i)}return r??br}var mi=(function(){var e="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",t="nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111";function n(u){return u<=247?e.charAt(u):1424<=u&&u<=1524?"R":1536<=u&&u<=1785?t.charAt(u-1536):1774<=u&&u<=2220?"r":8192<=u&&u<=8203?"w":u==8204?"b":"L"}var r=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,i=/[stwN]/,o=/[LRr]/,l=/[Lb1n]/,a=/[1n]/;function s(u,h,x){this.level=u,this.from=h,this.to=x}return function(u,h){var x=h=="ltr"?"L":"R";if(u.length==0||h=="ltr"&&!r.test(u))return!1;for(var D=u.length,L=[],H=0;H<D;++H)L.push(n(u.charCodeAt(H)));for(var Z=0,ie=x;Z<D;++Z){var ae=L[Z];ae=="m"?L[Z]=ie:ie=ae}for(var he=0,se=x;he<D;++he){var ge=L[he];ge=="1"&&se=="r"?L[he]="n":o.test(ge)&&(se=ge,ge=="r"&&(L[he]="R"))}for(var Le=1,ke=L[0];Le<D-1;++Le){var Ee=L[Le];Ee=="+"&&ke=="1"&&L[Le+1]=="1"?L[Le]="1":Ee==","&&ke==L[Le+1]&&(ke=="1"||ke=="n")&&(L[Le]=ke),ke=Ee}for(var Ke=0;Ke<D;++Ke){var st=L[Ke];if(st==",")L[Ke]="N";else if(st=="%"){var Xe=void 0;for(Xe=Ke+1;Xe<D&&L[Xe]=="%";++Xe);for(var Nt=Ke&&L[Ke-1]=="!"||Xe<D&&L[Xe]=="1"?"1":"N",Tt=Ke;Tt<Xe;++Tt)L[Tt]=Nt;Ke=Xe-1}}for(var tt=0,Ct=x;tt<D;++tt){var ft=L[tt];Ct=="L"&&ft=="1"?L[tt]="L":o.test(ft)&&(Ct=ft)}for(var nt=0;nt<D;++nt)if(i.test(L[nt])){var rt=void 0;for(rt=nt+1;rt<D&&i.test(L[rt]);++rt);for(var Ze=(nt?L[nt-1]:x)=="L",Dt=(rt<D?L[rt]:x)=="L",nn=Ze==Dt?Ze?"L":"R":x,yr=nt;yr<rt;++yr)L[yr]=nn;nt=rt-1}for(var vt=[],Jt,ut=0;ut<D;)if(l.test(L[ut])){var co=ut;for(++ut;ut<D&&l.test(L[ut]);++ut);vt.push(new s(0,co,ut))}else{var ir=ut,Ar=vt.length,Nr=h=="rtl"?1:0;for(++ut;ut<D&&L[ut]!="L";++ut);for(var bt=ir;bt<ut;)if(a.test(L[bt])){ir<bt&&(vt.splice(Ar,0,new s(1,ir,bt)),Ar+=Nr);var on=bt;for(++bt;bt<ut&&a.test(L[bt]);++bt);vt.splice(Ar,0,new s(2,on,bt)),Ar+=Nr,ir=bt}else++bt;ir<ut&&vt.splice(Ar,0,new s(1,ir,ut))}return h=="ltr"&&(vt[0].level==1&&(Jt=u.match(/^\s+/))&&(vt[0].from=Jt[0].length,vt.unshift(new s(0,0,Jt[0].length))),we(vt).level==1&&(Jt=u.match(/\s+$/))&&(we(vt).to-=Jt[0].length,vt.push(new s(0,D-Jt[0].length,D)))),h=="rtl"?vt.reverse():vt}})();function Re(e,t){var n=e.order;return n==null&&(n=e.order=mi(e.text,t)),n}var Bn=[],Se=function(e,t,n){if(e.addEventListener)e.addEventListener(t,n,!1);else if(e.attachEvent)e.attachEvent("on"+t,n);else{var r=e._handlers||(e._handlers={});r[t]=(r[t]||Bn).concat(n)}};function Zt(e,t){return e._handlers&&e._handlers[t]||Bn}function ht(e,t,n){if(e.removeEventListener)e.removeEventListener(t,n,!1);else if(e.detachEvent)e.detachEvent("on"+t,n);else{var r=e._handlers,i=r&&r[t];if(i){var o=ve(i,n);o>-1&&(r[t]=i.slice(0,o).concat(i.slice(o+1)))}}}function Ye(e,t){var n=Zt(e,t);if(n.length)for(var r=Array.prototype.slice.call(arguments,2),i=0;i<n.length;++i)n[i].apply(null,r)}function Qe(e,t,n){return typeof t=="string"&&(t={type:t,preventDefault:function(){this.defaultPrevented=!0}}),Ye(e,n||t.type,e,t),kt(t)||t.codemirrorIgnore}function It(e){var t=e._handlers&&e._handlers.cursorActivity;if(t)for(var n=e.curOp.cursorActivityHandlers||(e.curOp.cursorActivityHandlers=[]),r=0;r<t.length;++r)ve(n,t[r])==-1&&n.push(t[r])}function Ft(e,t){return Zt(e,t).length>0}function Bt(e){e.prototype.on=function(t,n){Se(this,t,n)},e.prototype.off=function(t,n){ht(this,t,n)}}function pt(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function Er(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function kt(e){return e.defaultPrevented!=null?e.defaultPrevented:e.returnValue==!1}function ar(e){pt(e),Er(e)}function ln(e){return e.target||e.srcElement}function Rt(e){var t=e.which;return t==null&&(e.button&1?t=1:e.button&2?t=3:e.button&4&&(t=2)),z&&e.ctrlKey&&t==1&&(t=3),t}var xi=(function(){if(k&&I<9)return!1;var e=c("div");return"draggable"in e||"dragDrop"in e})(),Or;function Rn(e){if(Or==null){var t=c("span","");G(e,c("span",[t,document.createTextNode("x")])),e.firstChild.offsetHeight!=0&&(Or=t.offsetWidth<=1&&t.offsetHeight>2&&!(k&&I<8))}var n=Or?c("span",""):c("span"," ",null,"display: inline-block; width: 1px; margin-right: -1px");return n.setAttribute("cm-text",""),n}var an;function sr(e){if(an!=null)return an;var t=G(e,document.createTextNode("AخA")),n=C(t,0,1).getBoundingClientRect(),r=C(t,1,2).getBoundingClientRect();return F(e),!n||n.left==n.right?!1:an=r.right-n.right<3}var zt=`
|
|
2
2
|
|
|
3
3
|
b`.split(/\n/).length!=3?function(e){for(var t=0,n=[],r=e.length;t<=r;){var i=e.indexOf(`
|
|
4
4
|
`,t);i==-1&&(i=e.length);var o=e.slice(t,e.charAt(i-1)=="\r"?i-1:i),l=o.indexOf("\r");l!=-1?(n.push(o.slice(0,l)),t+=l+1):(n.push(o),t=i+1)}return n}:function(e){return e.split(/\r\n?|\n/)},ur=window.getSelection?function(e){try{return e.selectionStart!=e.selectionEnd}catch{return!1}}:function(e){var t;try{t=e.ownerDocument.selection.createRange()}catch{}return!t||t.parentElement()!=e?!1:t.compareEndPoints("StartToEnd",t)!=0},Wn=(function(){var e=c("div");return"oncopy"in e?!0:(e.setAttribute("oncopy","return;"),typeof e.oncopy=="function")})(),Wt=null;function yi(e){if(Wt!=null)return Wt;var t=G(e,c("span","x")),n=t.getBoundingClientRect(),r=C(t,0,1).getBoundingClientRect();return Wt=Math.abs(n.left-r.left)>1}var Pr={},Ht={};function _t(e,t){arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2)),Pr[e]=t}function kr(e,t){Ht[e]=t}function Ir(e){if(typeof e=="string"&&Ht.hasOwnProperty(e))e=Ht[e];else if(e&&typeof e.name=="string"&&Ht.hasOwnProperty(e.name)){var t=Ht[e.name];typeof t=="string"&&(t={name:t}),e=K(t,e),e.name=t.name}else{if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return Ir("application/xml");if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return Ir("application/json")}return typeof e=="string"?{name:e}:e||{name:"null"}}function zr(e,t){t=Ir(t);var n=Pr[t.name];if(!n)return zr(e,"text/plain");var r=n(e,t);if(fr.hasOwnProperty(t.name)){var i=fr[t.name];for(var o in i)i.hasOwnProperty(o)&&(r.hasOwnProperty(o)&&(r["_"+o]=r[o]),r[o]=i[o])}if(r.name=t.name,t.helperType&&(r.helperType=t.helperType),t.modeProps)for(var l in t.modeProps)r[l]=t.modeProps[l];return r}var fr={};function Br(e,t){var n=fr.hasOwnProperty(e)?fr[e]:fr[e]={};Me(t,n)}function Gt(e,t){if(t===!0)return t;if(e.copyState)return e.copyState(t);var n={};for(var r in t){var i=t[r];i instanceof Array&&(i=i.concat([])),n[r]=i}return n}function sn(e,t){for(var n;e.innerMode&&(n=e.innerMode(t),!(!n||n.mode==e));)t=n.state,e=n.mode;return n||{mode:e,state:t}}function Rr(e,t,n){return e.startState?e.startState(t,n):!0}var Je=function(e,t,n){this.pos=this.start=0,this.string=e,this.tabSize=t||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0,this.lineOracle=n};Je.prototype.eol=function(){return this.pos>=this.string.length},Je.prototype.sol=function(){return this.pos==this.lineStart},Je.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},Je.prototype.next=function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},Je.prototype.eat=function(e){var t=this.string.charAt(this.pos),n;if(typeof e=="string"?n=t==e:n=t&&(e.test?e.test(t):e(t)),n)return++this.pos,t},Je.prototype.eatWhile=function(e){for(var t=this.pos;this.eat(e););return this.pos>t},Je.prototype.eatSpace=function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},Je.prototype.skipToEnd=function(){this.pos=this.string.length},Je.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0},Je.prototype.backUp=function(e){this.pos-=e},Je.prototype.column=function(){return this.lastColumnPos<this.start&&(this.lastColumnValue=Fe(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue-(this.lineStart?Fe(this.string,this.lineStart,this.tabSize):0)},Je.prototype.indentation=function(){return Fe(this.string,null,this.tabSize)-(this.lineStart?Fe(this.string,this.lineStart,this.tabSize):0)},Je.prototype.match=function(e,t,n){if(typeof e=="string"){var r=function(l){return n?l.toLowerCase():l},i=this.string.substr(this.pos,e.length);if(r(i)==r(e))return t!==!1&&(this.pos+=e.length),!0}else{var o=this.string.slice(this.pos).match(e);return o&&o.index>0?null:(o&&t!==!1&&(this.pos+=o[0].length),o)}},Je.prototype.current=function(){return this.string.slice(this.start,this.pos)},Je.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},Je.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)},Je.prototype.baseToken=function(){var e=this.lineOracle;return e&&e.baseToken(this.pos)};function ye(e,t){if(t-=e.first,t<0||t>=e.size)throw new Error("There is no line "+(t+e.first)+" in the document.");for(var n=e;!n.lines;)for(var r=0;;++r){var i=n.children[r],o=i.chunkSize();if(t<o){n=i;break}t-=o}return n.lines[t]}function Vt(e,t,n){var r=[],i=t.line;return e.iter(t.line,n.line+1,function(o){var l=o.text;i==n.line&&(l=l.slice(0,n.ch)),i==t.line&&(l=l.slice(t.ch)),r.push(l),++i}),r}function un(e,t,n){var r=[];return e.iter(t,n,function(i){r.push(i.text)}),r}function Et(e,t){var n=t-e.height;if(n)for(var r=e;r;r=r.parent)r.height+=n}function f(e){if(e.parent==null)return null;for(var t=e.parent,n=ve(t.lines,e),r=t.parent;r;t=r,r=r.parent)for(var i=0;r.children[i]!=t;++i)n+=r.children[i].chunkSize();return n+t.first}function m(e,t){var n=e.first;e:do{for(var r=0;r<e.children.length;++r){var i=e.children[r],o=i.height;if(t<o){e=i;continue e}t-=o,n+=i.chunkSize()}return n}while(!e.lines);for(var l=0;l<e.lines.length;++l){var a=e.lines[l],s=a.height;if(t<s)break;t-=s}return n+l}function U(e,t){return t>=e.first&&t<e.first+e.size}function re(e,t){return String(e.lineNumberFormatter(t+e.firstLineNumber))}function B(e,t,n){if(n===void 0&&(n=null),!(this instanceof B))return new B(e,t,n);this.line=e,this.ch=t,this.sticky=n}function ce(e,t){return e.line-t.line||e.ch-t.ch}function We(e,t){return e.sticky==t.sticky&&ce(e,t)==0}function it(e){return B(e.line,e.ch)}function wt(e,t){return ce(e,t)<0?t:e}function Wr(e,t){return ce(e,t)<0?e:t}function go(e,t){return Math.max(e.first,Math.min(t,e.first+e.size-1))}function Ae(e,t){if(t.line<e.first)return B(e.first,0);var n=e.first+e.size-1;return t.line>n?B(n,ye(e,n).text.length):Za(t,ye(e,t.line).text.length)}function Za(e,t){var n=e.ch;return n==null||n>t?B(e.line,t):n<0?B(e.line,0):e}function vo(e,t){for(var n=[],r=0;r<t.length;r++)n[r]=Ae(e,t[r]);return n}var Hn=function(e,t){this.state=e,this.lookAhead=t},Xt=function(e,t,n,r){this.state=t,this.doc=e,this.line=n,this.maxLookAhead=r||0,this.baseTokens=null,this.baseTokenPos=1};Xt.prototype.lookAhead=function(e){var t=this.doc.getLine(this.line+e);return t!=null&&e>this.maxLookAhead&&(this.maxLookAhead=e),t},Xt.prototype.baseToken=function(e){if(!this.baseTokens)return null;for(;this.baseTokens[this.baseTokenPos]<=e;)this.baseTokenPos+=2;var t=this.baseTokens[this.baseTokenPos+1];return{type:t&&t.replace(/( |^)overlay .*/,""),size:this.baseTokens[this.baseTokenPos]-e}},Xt.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},Xt.fromSaved=function(e,t,n){return t instanceof Hn?new Xt(e,Gt(e.mode,t.state),n,t.lookAhead):new Xt(e,Gt(e.mode,t),n)},Xt.prototype.save=function(e){var t=e!==!1?Gt(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new Hn(t,this.maxLookAhead):t};function mo(e,t,n,r){var i=[e.state.modeGen],o={};So(e,t.text,e.doc.mode,n,function(u,h){return i.push(u,h)},o,r);for(var l=n.state,a=function(u){n.baseTokens=i;var h=e.state.overlays[u],x=1,D=0;n.state=!0,So(e,t.text,h.mode,n,function(L,H){for(var Z=x;D<L;){var ie=i[x];ie>L&&i.splice(x,1,L,i[x+1],ie),x+=2,D=Math.min(L,ie)}if(H)if(h.opaque)i.splice(Z,x-Z,L,"overlay "+H),x=Z+2;else for(;Z<x;Z+=2){var ae=i[Z+1];i[Z+1]=(ae?ae+" ":"")+"overlay "+H}},o),n.state=l,n.baseTokens=null,n.baseTokenPos=1},s=0;s<e.state.overlays.length;++s)a(s);return{styles:i,classes:o.bgClass||o.textClass?o:null}}function xo(e,t,n){if(!t.styles||t.styles[0]!=e.state.modeGen){var r=fn(e,f(t)),i=t.text.length>e.options.maxHighlightLength&&Gt(e.doc.mode,r.state),o=mo(e,t,r);i&&(r.state=i),t.stateAfter=r.save(!i),t.styles=o.styles,o.classes?t.styleClasses=o.classes:t.styleClasses&&(t.styleClasses=null),n===e.doc.highlightFrontier&&(e.doc.modeFrontier=Math.max(e.doc.modeFrontier,++e.doc.highlightFrontier))}return t.styles}function fn(e,t,n){var r=e.doc,i=e.display;if(!r.mode.startState)return new Xt(r,!0,t);var o=Va(e,t,n),l=o>r.first&&ye(r,o-1).stateAfter,a=l?Xt.fromSaved(r,l,o):new Xt(r,Rr(r.mode),o);return r.iter(o,t,function(s){bi(e,s.text,a);var u=a.line;s.stateAfter=u==t-1||u%5==0||u>=i.viewFrom&&u<i.viewTo?a.save():null,a.nextLine()}),n&&(r.modeFrontier=a.line),a}function bi(e,t,n,r){var i=e.doc.mode,o=new Je(t,e.options.tabSize,n);for(o.start=o.pos=r||0,t==""&&yo(i,n.state);!o.eol();)ki(i,o,n.state),o.start=o.pos}function yo(e,t){if(e.blankLine)return e.blankLine(t);if(e.innerMode){var n=sn(e,t);if(n.mode.blankLine)return n.mode.blankLine(n.state)}}function ki(e,t,n,r){for(var i=0;i<10;i++){r&&(r[0]=sn(e,n).mode);var o=e.token(t,n);if(t.pos>t.start)return o}throw new Error("Mode "+e.name+" failed to advance stream.")}var bo=function(e,t,n){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=t||null,this.state=n};function ko(e,t,n,r){var i=e.doc,o=i.mode,l;t=Ae(i,t);var a=ye(i,t.line),s=fn(e,t.line,n),u=new Je(a.text,e.options.tabSize,s),h;for(r&&(h=[]);(r||u.pos<t.ch)&&!u.eol();)u.start=u.pos,l=ki(o,u,s.state),r&&h.push(new bo(u,l,Gt(i.mode,s.state)));return r?h:new bo(u,l,s.state)}function wo(e,t){if(e)for(;;){var n=e.match(/(?:^|\s+)line-(background-)?(\S+)/);if(!n)break;e=e.slice(0,n.index)+e.slice(n.index+n[0].length);var r=n[1]?"bgClass":"textClass";t[r]==null?t[r]=n[2]:new RegExp("(?:^|\\s)"+n[2]+"(?:$|\\s)").test(t[r])||(t[r]+=" "+n[2])}return e}function So(e,t,n,r,i,o,l){var a=n.flattenSpans;a==null&&(a=e.options.flattenSpans);var s=0,u=null,h=new Je(t,e.options.tabSize,r),x,D=e.options.addModeClass&&[null];for(t==""&&wo(yo(n,r.state),o);!h.eol();){if(h.pos>e.options.maxHighlightLength?(a=!1,l&&bi(e,t,r,h.pos),h.pos=t.length,x=null):x=wo(ki(n,h,r.state,D),o),D){var L=D[0].name;L&&(x="m-"+(x?L+" "+x:L))}if(!a||u!=x){for(;s<h.start;)s=Math.min(h.start,s+5e3),i(s,u);u=x}h.start=h.pos}for(;s<h.pos;){var H=Math.min(h.pos,s+5e3);i(H,u),s=H}}function Va(e,t,n){for(var r,i,o=e.doc,l=n?-1:t-(e.doc.mode.innerMode?1e3:100),a=t;a>l;--a){if(a<=o.first)return o.first;var s=ye(o,a-1),u=s.stateAfter;if(u&&(!n||a+(u instanceof Hn?u.lookAhead:0)<=o.modeFrontier))return a;var h=Fe(s.text,null,e.options.tabSize);(i==null||r>h)&&(i=a-1,r=h)}return i}function $a(e,t){if(e.modeFrontier=Math.min(e.modeFrontier,t),!(e.highlightFrontier<t-10)){for(var n=e.first,r=t-1;r>n;r--){var i=ye(e,r).stateAfter;if(i&&(!(i instanceof Hn)||r+i.lookAhead<t)){n=r+1;break}}e.highlightFrontier=Math.min(e.highlightFrontier,n)}}var Lo=!1,$t=!1;function es(){Lo=!0}function ts(){$t=!0}function _n(e,t,n){this.marker=e,this.from=t,this.to=n}function cn(e,t){if(e)for(var n=0;n<e.length;++n){var r=e[n];if(r.marker==t)return r}}function rs(e,t){for(var n,r=0;r<e.length;++r)e[r]!=t&&(n||(n=[])).push(e[r]);return n}function ns(e,t,n){var r=n&&window.WeakSet&&(n.markedSpans||(n.markedSpans=new WeakSet));r&&e.markedSpans&&r.has(e.markedSpans)?e.markedSpans.push(t):(e.markedSpans=e.markedSpans?e.markedSpans.concat([t]):[t],r&&r.add(e.markedSpans)),t.marker.attachLine(e)}function is(e,t,n){var r;if(e)for(var i=0;i<e.length;++i){var o=e[i],l=o.marker,a=o.from==null||(l.inclusiveLeft?o.from<=t:o.from<t);if(a||o.from==t&&l.type=="bookmark"&&(!n||!o.marker.insertLeft)){var s=o.to==null||(l.inclusiveRight?o.to>=t:o.to>t);(r||(r=[])).push(new _n(l,o.from,s?null:o.to))}}return r}function os(e,t,n){var r;if(e)for(var i=0;i<e.length;++i){var o=e[i],l=o.marker,a=o.to==null||(l.inclusiveRight?o.to>=t:o.to>t);if(a||o.from==t&&l.type=="bookmark"&&(!n||o.marker.insertLeft)){var s=o.from==null||(l.inclusiveLeft?o.from<=t:o.from<t);(r||(r=[])).push(new _n(l,s?null:o.from-t,o.to==null?null:o.to-t))}}return r}function wi(e,t){if(t.full)return null;var n=U(e,t.from.line)&&ye(e,t.from.line).markedSpans,r=U(e,t.to.line)&&ye(e,t.to.line).markedSpans;if(!n&&!r)return null;var i=t.from.ch,o=t.to.ch,l=ce(t.from,t.to)==0,a=is(n,i,l),s=os(r,o,l),u=t.text.length==1,h=we(t.text).length+(u?i:0);if(a)for(var x=0;x<a.length;++x){var D=a[x];if(D.to==null){var L=cn(s,D.marker);L?u&&(D.to=L.to==null?null:L.to+h):D.to=i}}if(s)for(var H=0;H<s.length;++H){var Z=s[H];if(Z.to!=null&&(Z.to+=h),Z.from==null){var ie=cn(a,Z.marker);ie||(Z.from=h,u&&(a||(a=[])).push(Z))}else Z.from+=h,u&&(a||(a=[])).push(Z)}a&&(a=To(a)),s&&s!=a&&(s=To(s));var ae=[a];if(!u){var he=t.text.length-2,se;if(he>0&&a)for(var ge=0;ge<a.length;++ge)a[ge].to==null&&(se||(se=[])).push(new _n(a[ge].marker,null,null));for(var Le=0;Le<he;++Le)ae.push(se);ae.push(s)}return ae}function To(e){for(var t=0;t<e.length;++t){var n=e[t];n.from!=null&&n.from==n.to&&n.marker.clearWhenEmpty!==!1&&e.splice(t--,1)}return e.length?e:null}function ls(e,t,n){var r=null;if(e.iter(t.line,n.line+1,function(L){if(L.markedSpans)for(var H=0;H<L.markedSpans.length;++H){var Z=L.markedSpans[H].marker;Z.readOnly&&(!r||ve(r,Z)==-1)&&(r||(r=[])).push(Z)}}),!r)return null;for(var i=[{from:t,to:n}],o=0;o<r.length;++o)for(var l=r[o],a=l.find(0),s=0;s<i.length;++s){var u=i[s];if(!(ce(u.to,a.from)<0||ce(u.from,a.to)>0)){var h=[s,1],x=ce(u.from,a.from),D=ce(u.to,a.to);(x<0||!l.inclusiveLeft&&!x)&&h.push({from:u.from,to:a.from}),(D>0||!l.inclusiveRight&&!D)&&h.push({from:a.to,to:u.to}),i.splice.apply(i,h),s+=h.length-3}}return i}function Co(e){var t=e.markedSpans;if(t){for(var n=0;n<t.length;++n)t[n].marker.detachLine(e);e.markedSpans=null}}function Do(e,t){if(t){for(var n=0;n<t.length;++n)t[n].marker.attachLine(e);e.markedSpans=t}}function qn(e){return e.inclusiveLeft?-1:0}function jn(e){return e.inclusiveRight?1:0}function Si(e,t){var n=e.lines.length-t.lines.length;if(n!=0)return n;var r=e.find(),i=t.find(),o=ce(r.from,i.from)||qn(e)-qn(t);if(o)return-o;var l=ce(r.to,i.to)||jn(e)-jn(t);return l||t.id-e.id}function Mo(e,t){var n=$t&&e.markedSpans,r;if(n)for(var i=void 0,o=0;o<n.length;++o)i=n[o],i.marker.collapsed&&(t?i.from:i.to)==null&&(!r||Si(r,i.marker)<0)&&(r=i.marker);return r}function Fo(e){return Mo(e,!0)}function Kn(e){return Mo(e,!1)}function as(e,t){var n=$t&&e.markedSpans,r;if(n)for(var i=0;i<n.length;++i){var o=n[i];o.marker.collapsed&&(o.from==null||o.from<t)&&(o.to==null||o.to>t)&&(!r||Si(r,o.marker)<0)&&(r=o.marker)}return r}function Ao(e,t,n,r,i){var o=ye(e,t),l=$t&&o.markedSpans;if(l)for(var a=0;a<l.length;++a){var s=l[a];if(s.marker.collapsed){var u=s.marker.find(0),h=ce(u.from,n)||qn(s.marker)-qn(i),x=ce(u.to,r)||jn(s.marker)-jn(i);if(!(h>=0&&x<=0||h<=0&&x>=0)&&(h<=0&&(s.marker.inclusiveRight&&i.inclusiveLeft?ce(u.to,n)>=0:ce(u.to,n)>0)||h>=0&&(s.marker.inclusiveRight&&i.inclusiveLeft?ce(u.from,r)<=0:ce(u.from,r)<0)))return!0}}}function qt(e){for(var t;t=Fo(e);)e=t.find(-1,!0).line;return e}function ss(e){for(var t;t=Kn(e);)e=t.find(1,!0).line;return e}function us(e){for(var t,n;t=Kn(e);)e=t.find(1,!0).line,(n||(n=[])).push(e);return n}function Li(e,t){var n=ye(e,t),r=qt(n);return n==r?t:f(r)}function No(e,t){if(t>e.lastLine())return t;var n=ye(e,t),r;if(!cr(e,n))return t;for(;r=Kn(n);)n=r.find(1,!0).line;return f(n)+1}function cr(e,t){var n=$t&&t.markedSpans;if(n){for(var r=void 0,i=0;i<n.length;++i)if(r=n[i],!!r.marker.collapsed){if(r.from==null)return!0;if(!r.marker.widgetNode&&r.from==0&&r.marker.inclusiveLeft&&Ti(e,t,r))return!0}}}function Ti(e,t,n){if(n.to==null){var r=n.marker.find(1,!0);return Ti(e,r.line,cn(r.line.markedSpans,n.marker))}if(n.marker.inclusiveRight&&n.to==t.text.length)return!0;for(var i=void 0,o=0;o<t.markedSpans.length;++o)if(i=t.markedSpans[o],i.marker.collapsed&&!i.marker.widgetNode&&i.from==n.to&&(i.to==null||i.to!=n.from)&&(i.marker.inclusiveLeft||n.marker.inclusiveRight)&&Ti(e,t,i))return!0}function er(e){e=qt(e);for(var t=0,n=e.parent,r=0;r<n.lines.length;++r){var i=n.lines[r];if(i==e)break;t+=i.height}for(var o=n.parent;o;n=o,o=n.parent)for(var l=0;l<o.children.length;++l){var a=o.children[l];if(a==n)break;t+=a.height}return t}function Un(e){if(e.height==0)return 0;for(var t=e.text.length,n,r=e;n=Fo(r);){var i=n.find(0,!0);r=i.from.line,t+=i.from.ch-i.to.ch}for(r=e;n=Kn(r);){var o=n.find(0,!0);t-=r.text.length-o.from.ch,r=o.to.line,t+=r.text.length-o.to.ch}return t}function Ci(e){var t=e.display,n=e.doc;t.maxLine=ye(n,n.first),t.maxLineLength=Un(t.maxLine),t.maxLineChanged=!0,n.iter(function(r){var i=Un(r);i>t.maxLineLength&&(t.maxLineLength=i,t.maxLine=r)})}var Hr=function(e,t,n){this.text=e,Do(this,t),this.height=n?n(this):1};Hr.prototype.lineNo=function(){return f(this)},Bt(Hr);function fs(e,t,n,r){e.text=t,e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null),e.order!=null&&(e.order=null),Co(e),Do(e,n);var i=r?r(e):1;i!=e.height&&Et(e,i)}function cs(e){e.parent=null,Co(e)}var ds={},hs={};function Eo(e,t){if(!e||/^\s*$/.test(e))return null;var n=t.addModeClass?hs:ds;return n[e]||(n[e]=e.replace(/\S+/g,"cm-$&"))}function Oo(e,t){var n=T("span",null,null,Y?"padding-right: .1px":null),r={pre:T("pre",[n],"CodeMirror-line"),content:n,col:0,pos:0,cm:e,trailingSpace:!1,splitSpaces:e.getOption("lineWrapping")};t.measure={};for(var i=0;i<=(t.rest?t.rest.length:0);i++){var o=i?t.rest[i-1]:t.line,l=void 0;r.pos=0,r.addToken=gs,sr(e.display.measure)&&(l=Re(o,e.doc.direction))&&(r.addToken=ms(r.addToken,l)),r.map=[];var a=t!=e.display.externalMeasured&&f(o);xs(o,r,xo(e,o,a)),o.styleClasses&&(o.styleClasses.bgClass&&(r.bgClass=de(o.styleClasses.bgClass,r.bgClass||"")),o.styleClasses.textClass&&(r.textClass=de(o.styleClasses.textClass,r.textClass||""))),r.map.length==0&&r.map.push(0,0,r.content.appendChild(Rn(e.display.measure))),i==0?(t.measure.map=r.map,t.measure.cache={}):((t.measure.maps||(t.measure.maps=[])).push(r.map),(t.measure.caches||(t.measure.caches=[])).push({}))}if(Y){var s=r.content.lastChild;(/\bcm-tab\b/.test(s.className)||s.querySelector&&s.querySelector(".cm-tab"))&&(r.content.className="cm-tab-wrap-hack")}return Ye(e,"renderLine",e,t.line,r.pre),r.pre.className&&(r.textClass=de(r.pre.className,r.textClass||"")),r}function ps(e){var t=c("span","•","cm-invalidchar");return t.title="\\u"+e.charCodeAt(0).toString(16),t.setAttribute("aria-label",t.title),t}function gs(e,t,n,r,i,o,l){if(t){var a=e.splitSpaces?vs(t,e.trailingSpace):t,s=e.cm.state.specialChars,u=!1,h;if(!s.test(t))e.col+=t.length,h=document.createTextNode(a),e.map.push(e.pos,e.pos+t.length,h),k&&I<9&&(u=!0),e.pos+=t.length;else{h=document.createDocumentFragment();for(var x=0;;){s.lastIndex=x;var D=s.exec(t),L=D?D.index-x:t.length-x;if(L){var H=document.createTextNode(a.slice(x,x+L));k&&I<9?h.appendChild(c("span",[H])):h.appendChild(H),e.map.push(e.pos,e.pos+L,H),e.col+=L,e.pos+=L}if(!D)break;x+=L+1;var Z=void 0;if(D[0]==" "){var ie=e.cm.options.tabSize,ae=ie-e.col%ie;Z=h.appendChild(c("span",et(ae),"cm-tab")),Z.setAttribute("role","presentation"),Z.setAttribute("cm-text"," "),e.col+=ae}else D[0]=="\r"||D[0]==`
|