@reviewflow/app 6.22.0 → 6.22.2
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/build/index-node.mjs
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { env } from 'node:process';
|
|
2
|
+
import { appLogger } from 'nightingale-app-console';
|
|
2
3
|
import { execFile, spawn, spawnSync } from 'node:child_process';
|
|
3
4
|
import { existsSync, readFileSync, statSync, mkdirSync, chmodSync, writeFileSync, renameSync } from 'node:fs';
|
|
4
5
|
import { homedir } from 'node:os';
|
|
@@ -316,44 +317,22 @@ const createGhTransport = () => createGitHubTransport(
|
|
|
316
317
|
createAuthenticatedSend({ readToken: readGhToken, sendRaw: sendWithToken })
|
|
317
318
|
);
|
|
318
319
|
|
|
319
|
-
const log = (level, message, fields = {}) => {
|
|
320
|
-
console.log(
|
|
321
|
-
JSON.stringify({
|
|
322
|
-
time: (/* @__PURE__ */ new Date()).toISOString(),
|
|
323
|
-
level,
|
|
324
|
-
message,
|
|
325
|
-
...fields
|
|
326
|
-
})
|
|
327
|
-
);
|
|
328
|
-
};
|
|
329
|
-
const errorMessage = (error) => error instanceof Error ? error.message : String(error);
|
|
330
|
-
|
|
331
320
|
const bindingsCache = createBindingsCache();
|
|
321
|
+
const editLogger = appLogger.child("edit", "Edit");
|
|
332
322
|
const operations = {
|
|
333
323
|
fetchPullRequestPart,
|
|
334
324
|
fetchPullRequestCandidates,
|
|
335
325
|
fetchPullRequestRevisions,
|
|
336
326
|
parsePullRequestEdit,
|
|
337
|
-
editPullRequest: (transport, request) => applyPullRequestEdit(transport, request, {
|
|
338
|
-
logger: {
|
|
339
|
-
warn: (message, context) => {
|
|
340
|
-
log("warn", message, {
|
|
341
|
-
context: { ...context, error: errorMessage(context.error) }
|
|
342
|
-
});
|
|
343
|
-
},
|
|
344
|
-
error: (message, context) => {
|
|
345
|
-
log("error", message, {
|
|
346
|
-
context: { ...context, error: errorMessage(context.error) }
|
|
347
|
-
});
|
|
348
|
-
}
|
|
349
|
-
}
|
|
350
|
-
}),
|
|
327
|
+
editPullRequest: (transport, request) => applyPullRequestEdit(transport, request, { logger: editLogger }),
|
|
351
328
|
readPullRequestDiff,
|
|
352
329
|
readFileAtSha,
|
|
353
330
|
readReadingOrder,
|
|
354
331
|
readImpacts: (request) => readImpacts({ ...request, cache: bindingsCache })
|
|
355
332
|
};
|
|
356
333
|
|
|
334
|
+
const errorMessage = (error) => error instanceof Error ? error.message : String(error);
|
|
335
|
+
|
|
357
336
|
const heartbeatMs = 25e3;
|
|
358
337
|
const formatEvent = (event, data) => `event: ${event}
|
|
359
338
|
data: ${JSON.stringify(data)}
|
|
@@ -398,6 +377,7 @@ const createEventHub = ({
|
|
|
398
377
|
|
|
399
378
|
const credentialsVersion = 1;
|
|
400
379
|
const credentialKeyBytes = 32;
|
|
380
|
+
const logger$3 = appLogger.child("credentials", "Credentials");
|
|
401
381
|
const cipherName = "aes-256-gcm";
|
|
402
382
|
const ivBytes = 12;
|
|
403
383
|
const empty = () => ({ version: credentialsVersion });
|
|
@@ -497,9 +477,9 @@ const createFileCredentialStore = (key, path = credentialsPath()) => ({
|
|
|
497
477
|
try {
|
|
498
478
|
writeDocument(path, encrypt(credentials, keyFor(path, key)));
|
|
499
479
|
} catch (error) {
|
|
500
|
-
|
|
480
|
+
logger$3.warn("could not encrypt the credentials file", {
|
|
501
481
|
path,
|
|
502
|
-
error
|
|
482
|
+
error
|
|
503
483
|
});
|
|
504
484
|
}
|
|
505
485
|
return credentials;
|
|
@@ -633,6 +613,7 @@ const normaliseReviewflowUrl = (url) => {
|
|
|
633
613
|
const withoutToken = (message, token) => token === "" ? message : message.split(token).join("[token]");
|
|
634
614
|
|
|
635
615
|
const tokenRefusedCode = "ERR_REVIEWFLOW_TOKEN_REFUSED";
|
|
616
|
+
const logger$2 = appLogger.child("reviewflow", "Reviewflow");
|
|
636
617
|
const refused = (message) => Object.assign(new Error(message), { code: tokenRefusedCode });
|
|
637
618
|
const createReviewflowService = ({
|
|
638
619
|
store,
|
|
@@ -641,11 +622,7 @@ const createReviewflowService = ({
|
|
|
641
622
|
url,
|
|
642
623
|
token,
|
|
643
624
|
signal,
|
|
644
|
-
logger:
|
|
645
|
-
warn: (message, { error }) => {
|
|
646
|
-
log("warn", message, { error: errorMessage(error) });
|
|
647
|
-
}
|
|
648
|
-
}
|
|
625
|
+
logger: logger$2
|
|
649
626
|
}),
|
|
650
627
|
now = () => /* @__PURE__ */ new Date()
|
|
651
628
|
} = {}) => {
|
|
@@ -716,7 +693,7 @@ const createReviewflowService = ({
|
|
|
716
693
|
emitBoard();
|
|
717
694
|
},
|
|
718
695
|
onBoardError: (account, message) => {
|
|
719
|
-
|
|
696
|
+
logger$2.warn("reviewflow board read failed", { account, error: message });
|
|
720
697
|
},
|
|
721
698
|
onPullRequestChanged: (change) => {
|
|
722
699
|
hub.broadcast("pullRequestChanged", change);
|
|
@@ -726,10 +703,9 @@ const createReviewflowService = ({
|
|
|
726
703
|
emitStatus();
|
|
727
704
|
},
|
|
728
705
|
onLog: ({ level, message, error, fields }) => {
|
|
729
|
-
|
|
730
|
-
level,
|
|
706
|
+
logger$2[level](
|
|
731
707
|
message,
|
|
732
|
-
error === void 0 ? fields : { ...fields, error
|
|
708
|
+
error === void 0 ? fields : { ...fields, error }
|
|
733
709
|
);
|
|
734
710
|
}
|
|
735
711
|
});
|
|
@@ -1281,6 +1257,7 @@ const serveStatic = async (distDirectory, pathname) => {
|
|
|
1281
1257
|
};
|
|
1282
1258
|
};
|
|
1283
1259
|
|
|
1260
|
+
const logger$1 = appLogger.child("server", "Server");
|
|
1284
1261
|
const preflightMaxAgeSeconds = 600;
|
|
1285
1262
|
const writeJson = (response, status, body) => {
|
|
1286
1263
|
response.writeHead(status, {
|
|
@@ -1300,7 +1277,7 @@ const handleRequest = async (options, request, response) => {
|
|
|
1300
1277
|
allowDevOrigins: options.allowDevOrigins === true
|
|
1301
1278
|
});
|
|
1302
1279
|
if (!verdict.allowed) {
|
|
1303
|
-
|
|
1280
|
+
logger$1.warn("request refused", {
|
|
1304
1281
|
method,
|
|
1305
1282
|
path: url.pathname,
|
|
1306
1283
|
reason: verdict.reason
|
|
@@ -1371,7 +1348,7 @@ const handleRequest = async (options, request, response) => {
|
|
|
1371
1348
|
}
|
|
1372
1349
|
writeJson(response, answer2.status, answer2.body);
|
|
1373
1350
|
if (answer2.status >= 400) {
|
|
1374
|
-
|
|
1351
|
+
logger$1.warn("request failed", {
|
|
1375
1352
|
method,
|
|
1376
1353
|
path: url.pathname,
|
|
1377
1354
|
status: answer2.status,
|
|
@@ -1396,11 +1373,11 @@ const handleRequest = async (options, request, response) => {
|
|
|
1396
1373
|
let status = 500;
|
|
1397
1374
|
if (tooLarge) status = 413;
|
|
1398
1375
|
else if (errorMessage(error) === "body is not json") status = 400;
|
|
1399
|
-
|
|
1376
|
+
logger$1.error("request failed", {
|
|
1400
1377
|
method,
|
|
1401
1378
|
path: url.pathname,
|
|
1402
1379
|
status,
|
|
1403
|
-
error
|
|
1380
|
+
error
|
|
1404
1381
|
});
|
|
1405
1382
|
if (!response.headersSent) {
|
|
1406
1383
|
writeJson(response, status, { error: errorMessage(error) });
|
|
@@ -1411,11 +1388,12 @@ const handleRequest = async (options, request, response) => {
|
|
|
1411
1388
|
};
|
|
1412
1389
|
const createAppServer = (options) => createServer((request, response) => {
|
|
1413
1390
|
handleRequest(options, request, response).catch((error) => {
|
|
1414
|
-
|
|
1391
|
+
logger$1.error("request crashed", { error });
|
|
1415
1392
|
response.destroy();
|
|
1416
1393
|
});
|
|
1417
1394
|
});
|
|
1418
1395
|
|
|
1396
|
+
const logger = appLogger.child("server", "Server");
|
|
1419
1397
|
const defaultPort = 7450;
|
|
1420
1398
|
const host = "127.0.0.1";
|
|
1421
1399
|
if (process.platform !== "darwin") {
|
|
@@ -1443,11 +1421,11 @@ const server = createAppServer({
|
|
|
1443
1421
|
allowDevOrigins: env.REVIEWFLOW_APP_DEV === "1"
|
|
1444
1422
|
});
|
|
1445
1423
|
server.on("error", (error) => {
|
|
1446
|
-
|
|
1424
|
+
logger.error("server failed", { error });
|
|
1447
1425
|
process.exitCode = 1;
|
|
1448
1426
|
});
|
|
1449
1427
|
server.listen(port, host, () => {
|
|
1450
|
-
|
|
1428
|
+
logger.info("reviewflow app server listening", {
|
|
1451
1429
|
url: `http://${host}:${String(port)}`,
|
|
1452
1430
|
configPath
|
|
1453
1431
|
});
|
|
@@ -1109,7 +1109,7 @@ __d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{v
|
|
|
1109
1109
|
__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"TextStrikethroughRegularIcon",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"TextStrikethroughDuotoneIcon",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"TextStrikethroughFillIcon",{enumerable:!0,get:function(){return o}});var t=r(d[0]);const c=(0,t.createIcon)("M224,128a8,8,0,0,1-8,8H175.93c9.19,7.11,16.07,17.2,16.07,32,0,13.34-7,25.7-19.75,34.79C160.33,211.31,144.61,216,128,216s-32.33-4.69-44.25-13.21C71,193.7,64,181.34,64,168a8,8,0,0,1,16,0c0,17.35,22,32,48,32s48-14.65,48-32c0-14.85-10.54-23.58-38.77-32H40a8,8,0,0,1,0-16H216A8,8,0,0,1,224,128ZM76.33,104a8,8,0,0,0,7.61-10.49A17.3,17.3,0,0,1,83.11,88c0-18.24,19.3-32,44.89-32,18.84,0,34.16,7.42,41,19.85a8,8,0,0,0,14-7.7C173.33,50.52,152.77,40,128,40,93.29,40,67.11,60.63,67.11,88a33.73,33.73,0,0,0,1.62,10.49A8,8,0,0,0,76.33,104Z"),n=(0,t.createDuotoneIcon)("M176,72l-55.31,51.05c-24-6.7-45.58-14.26-45.58-35,0-22.09,22-40,52.89-40C151.2,48,168.37,57.64,176,72Zm-55.31,51.05L72,168c0,22.09,25.07,40,56,40s56-17.91,56-40C184,138.43,150.52,131.4,120.69,123.05Z","M224,128a8,8,0,0,1-8,8H175.93c9.19,7.11,16.07,17.2,16.07,32,0,13.34-7,25.7-19.75,34.79C160.33,211.31,144.61,216,128,216s-32.33-4.69-44.25-13.21C71,193.7,64,181.34,64,168a8,8,0,0,1,16,0c0,17.35,22,32,48,32s48-14.65,48-32c0-14.85-10.54-23.58-38.77-32H40a8,8,0,0,1,0-16H216A8,8,0,0,1,224,128ZM76.33,104a8,8,0,0,0,7.61-10.49A17.3,17.3,0,0,1,83.11,88c0-18.24,19.3-32,44.89-32,18.84,0,34.16,7.42,41,19.85a8,8,0,0,0,14-7.7C173.33,50.52,152.77,40,128,40,93.29,40,67.11,60.63,67.11,88a33.73,33.73,0,0,0,1.62,10.49A8,8,0,0,0,76.33,104Z"),o=(0,t.createIcon)("M208,32H48A16,16,0,0,0,32,48V208a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V48A16,16,0,0,0,208,32ZM82.71,94.58C86,76.57,104.58,64,128,64c18.2,0,33.59,7.41,41.18,19.83a8,8,0,1,1-13.66,8.34C150.94,84.66,140.39,80,128,80c-15.3,0-27.73,7.33-29.55,17.42A8,8,0,0,1,90.59,104a7.76,7.76,0,0,1-1.43-.13A8,8,0,0,1,82.71,94.58ZM192,136H168.29A28.45,28.45,0,0,1,176,156c0,20.19-21.08,36-48,36-23.89,0-43.83-12.78-47.43-30.4a8,8,0,1,1,15.67-3.2c2,9.87,16,17.6,31.76,17.6,17.35,0,32-9.16,32-20,0-9.14-6.76-14.43-25.72-20H64a8,8,0,0,1,0-16H192a8,8,0,0,1,0,16Z")},1011,[361]);
|
|
1110
1110
|
__d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"enclosingFormatRange",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"toggleInlineFormat",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"setLineType",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"formattingKeymap",{enumerable:!0,get:function(){return p}});var t=r(d[0]),n=r(d[1]),o=r(d[2]),l=r(d[3]);const u={StrongEmphasis:"bold",Emphasis:"italic",InlineCode:"code",Strikethrough:"strikethrough",Link:"link"},c=(n,o,l)=>{for(let c=(0,t.syntaxTree)(n).resolveInner(o,-1);c;c=c.parent)if(u[c.name]===l)return{from:c.from,to:c.to};return null},s=(t,o,l)=>{const u=t+l.from,c=l.insert.length>o.length?l.insert.indexOf(o):-1;return-1===c?n.EditorSelection.range(u,u+l.insert.length):n.EditorSelection.range(u+c,u+c+o.length)},a=(t,l,u)=>{const a=l.empty?c(t,l.head,u):{from:l.from,to:l.to};if(null===a)return null;const f=t.doc.lineAt(a.from);if(t.doc.lineAt(a.to).number!==f.number)return null;const h=(0,o.inlineFormatChange)({text:f.text,from:a.from-f.from,to:a.to-f.from,format:u});return null===h?null:{changes:{from:f.from+h.from,to:f.from+h.to,insert:h.insert},range:l.empty?n.EditorSelection.cursor(f.from+h.selection):s(f.from,t.doc.sliceString(a.from,a.to),h)}},f=t=>({state:n,dispatch:o})=>{const l=[],u=n.changeByRange(o=>{const u=a(n,o,t);return null===u||l.some(t=>{return n=t,o=u.changes,n.from<o.to&&o.from<n.to;var n,o})?{range:o}:(l.push(u.changes),u)});return 0!==l.length&&(o(n.update(u,{scrollIntoView:!0})),!0)},h=t=>({state:o,dispatch:u})=>{const c=new Set,s=o.changeByRange(u=>{const s=o.doc.lineAt(u.head);if(c.has(s.from))return{range:n.EditorSelection.cursor(s.from)};const a=(0,l.applyLinePrefix)((0,l.stripLinePrefix)(s.text),t);return a===s.text?{range:u}:(c.add(s.from),{changes:{from:s.from,to:s.to,insert:a},range:n.EditorSelection.cursor(s.from)})});return 0!==c.size&&(u(o.update(s,{scrollIntoView:!0})),!0)},p=[{key:"Mod-b",run:f("bold")},{key:"Mod-i",run:f("italic")},{key:"Mod-e",run:f("code")},{key:"Mod-k",run:f("link")},{key:"Mod-Shift-x",run:f("strikethrough")}]},1012,[1013,994,1016,1017]);
|
|
1111
1111
|
__d(function(g,_r,_i,_a2,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"DocInput",{enumerable:!0,get:function(){return w}}),Object.defineProperty(_e,"HighlightStyle",{enumerable:!0,get:function(){return Ne}}),Object.defineProperty(_e,"IndentContext",{enumerable:!0,get:function(){return M}}),Object.defineProperty(_e,"LRLanguage",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"Language",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"LanguageDescription",{enumerable:!0,get:function(){return D}}),Object.defineProperty(_e,"LanguageSupport",{enumerable:!0,get:function(){return C}}),Object.defineProperty(_e,"ParseContext",{enumerable:!0,get:function(){return y}}),Object.defineProperty(_e,"StreamLanguage",{enumerable:!0,get:function(){return lt}}),Object.defineProperty(_e,"StringStream",{enumerable:!0,get:function(){return ot}}),Object.defineProperty(_e,"TreeIndentContext",{enumerable:!0,get:function(){return z}}),Object.defineProperty(_e,"bidiIsolates",{enumerable:!0,get:function(){return Dt}}),Object.defineProperty(_e,"bracketMatching",{enumerable:!0,get:function(){return Xe}}),Object.defineProperty(_e,"bracketMatchingHandle",{enumerable:!0,get:function(){return Ye}}),Object.defineProperty(_e,"codeFolding",{enumerable:!0,get:function(){return Se}}),Object.defineProperty(_e,"continuedIndent",{enumerable:!0,get:function(){return K}}),Object.defineProperty(_e,"defaultHighlightStyle",{enumerable:!0,get:function(){return We}}),Object.defineProperty(_e,"defineLanguageFacet",{enumerable:!0,get:function(){return a}}),Object.defineProperty(_e,"delimitedIndent",{enumerable:!0,get:function(){return q}}),Object.defineProperty(_e,"ensureSyntaxTree",{enumerable:!0,get:function(){return d}}),Object.defineProperty(_e,"flatIndent",{enumerable:!0,get:function(){return _}}),Object.defineProperty(_e,"foldAll",{enumerable:!0,get:function(){return be}}),Object.defineProperty(_e,"foldCode",{enumerable:!0,get:function(){return pe}}),Object.defineProperty(_e,"foldEffect",{enumerable:!0,get:function(){return oe}}),Object.defineProperty(_e,"foldGutter",{enumerable:!0,get:function(){return je}}),Object.defineProperty(_e,"foldInside",{enumerable:!0,get:function(){return ee}}),Object.defineProperty(_e,"foldKeymap",{enumerable:!0,get:function(){return ye}}),Object.defineProperty(_e,"foldNodeProp",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(_e,"foldService",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(_e,"foldState",{enumerable:!0,get:function(){return le}}),Object.defineProperty(_e,"foldable",{enumerable:!0,get:function(){return re}}),Object.defineProperty(_e,"foldedRanges",{enumerable:!0,get:function(){return ce}}),Object.defineProperty(_e,"forceParsing",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"getIndentUnit",{enumerable:!0,get:function(){return N}}),Object.defineProperty(_e,"getIndentation",{enumerable:!0,get:function(){return B}}),Object.defineProperty(_e,"highlightingFor",{enumerable:!0,get:function(){return Re}}),Object.defineProperty(_e,"indentNodeProp",{enumerable:!0,get:function(){return R}}),Object.defineProperty(_e,"indentOnInput",{enumerable:!0,get:function(){return X}}),Object.defineProperty(_e,"indentRange",{enumerable:!0,get:function(){return L}}),Object.defineProperty(_e,"indentService",{enumerable:!0,get:function(){return j}}),Object.defineProperty(_e,"indentString",{enumerable:!0,get:function(){return E}}),Object.defineProperty(_e,"indentUnit",{enumerable:!0,get:function(){return I}}),Object.defineProperty(_e,"language",{enumerable:!0,get:function(){return A}}),Object.defineProperty(_e,"languageDataProp",{enumerable:!0,get:function(){return s}}),Object.defineProperty(_e,"matchBrackets",{enumerable:!0,get:function(){return tt}}),Object.defineProperty(_e,"sublanguageProp",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"syntaxHighlighting",{enumerable:!0,get:function(){return Me}}),Object.defineProperty(_e,"syntaxParserRunning",{enumerable:!0,get:function(){return k}}),Object.defineProperty(_e,"syntaxTree",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"syntaxTreeAvailable",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"toggleFold",{enumerable:!0,get:function(){return ve}}),Object.defineProperty(_e,"unfoldAll",{enumerable:!0,get:function(){return ke}}),Object.defineProperty(_e,"unfoldCode",{enumerable:!0,get:function(){return ge}}),Object.defineProperty(_e,"unfoldEffect",{enumerable:!0,get:function(){return se}});var e,t=_r(_d[0]),n=_r(_d[1]),r=_r(_d[2]),i=_r(_d[3]),o=_r(_d[4]);const s=new t.NodeProp;function a(e){return n.Facet.define({combine:e?t=>t.concat(e):void 0})}const l=new t.NodeProp;class u{constructor(e,t,r=[],i=""){this.data=e,this.name=i,n.EditorState.prototype.hasOwnProperty("tree")||Object.defineProperty(n.EditorState.prototype,"tree",{get(){return f(this)}}),this.parser=t,this.extension=[A.of(this),n.EditorState.languageData.of((e,t,n)=>{let r=c(e,t,n),i=r.type.prop(s);if(!i)return[];let o=e.facet(i),a=r.type.prop(l);if(a){let i=r.resolve(t-r.from,n);for(let t of a)if(t.test(i,e)){let n=e.facet(t.facet);return"replace"==t.type?n:n.concat(o)}}return o})].concat(r)}isActiveAt(e,t,n=-1){return c(e,t,n).type.prop(s)==this.data}findRegions(e){let n=e.facet(A);if((null==n?void 0:n.data)==this.data)return[{from:0,to:e.doc.length}];if(!n||!n.allowsNesting)return[];let r=[],i=(e,n)=>{if(e.prop(s)==this.data)return void r.push({from:n,to:n+e.length});let o=e.prop(t.NodeProp.mounted);if(o){if(o.tree.prop(s)==this.data){if(o.overlay)for(let e of o.overlay)r.push({from:e.from+n,to:e.to+n});else r.push({from:n,to:n+e.length});return}if(o.overlay){let e=r.length;if(i(o.tree,o.overlay[0].from+n),r.length>e)return}}for(let r=0;r<e.children.length;r++){let o=e.children[r];o instanceof t.Tree&&i(o,e.positions[r]+n)}};return i(f(e),0),r}get allowsNesting(){return!0}}function c(e,n,r){let i=e.facet(A),o=f(e).topNode;if(!i||i.allowsNesting)for(let e=o;e;e=e.enter(n,r,t.IterMode.ExcludeBuffers|t.IterMode.EnterBracketed))e.type.isTop&&(o=e);return o}u.setState=n.StateEffect.define();class h extends u{constructor(e,t,n){super(e,t,[],n),this.parser=t}static define(e){let t=a(e.languageData);return new h(t,e.parser.configure({props:[s.add(e=>e.isTop?t:void 0)]}),e.name)}configure(e,t){return new h(this.data,this.parser.configure(e),t||this.name)}get allowsNesting(){return this.parser.hasWrappers()}}function f(e){let n=e.field(u.state,!1);return n?n.tree:t.Tree.empty}function d(e,t,n=50){var r;let i=null===(r=e.field(u.state,!1))||void 0===r?void 0:r.context;if(!i)return null;let o=i.viewport;i.updateViewport({from:0,to:t});let s=i.isDone(t)||i.work(n,t)?i.tree:null;return i.updateViewport(o),s}function p(e,t=e.doc.length){var n;return(null===(n=e.field(u.state,!1))||void 0===n?void 0:n.context.isDone(t))||!1}function b(e,t=e.viewport.to,n=100){let r=d(e.state,t,n);return r!=f(e.state)&&e.dispatch({}),!!r}function k(e){var t;return(null===(t=e.plugin(T))||void 0===t?void 0:t.isWorking())||!1}class w{constructor(e){this.doc=e,this.cursorPos=0,this.string="",this.cursor=e.iter()}get length(){return this.doc.length}syncTo(e){return this.string=this.cursor.next(e-this.cursorPos).value,this.cursorPos=e+this.string.length,this.cursorPos-this.string.length}chunk(e){return this.syncTo(e),this.string}get lineChunks(){return!0}read(e,t){let n=this.cursorPos-this.string.length;return e<n||t>=this.cursorPos?this.doc.sliceString(e,t):this.string.slice(e-n,t-n)}}let v=null;class y{constructor(e,t,n=[],r,i,o,s,a){this.parser=e,this.state=t,this.fragments=n,this.tree=r,this.treeLen=i,this.viewport=o,this.skipped=s,this.scheduleOn=a,this.parse=null,this.tempSkipped=[]}static create(e,n,r){return new y(e,n,[],t.Tree.empty,0,r,[],null)}startParse(){return this.parser.startParse(new w(this.state.doc),this.fragments)}work(e,n){return null!=n&&n>=this.state.doc.length&&(n=void 0),this.tree!=t.Tree.empty&&this.isDone(null!=n?n:this.state.doc.length)?(this.takeTree(),!0):this.withContext(()=>{var r;if("number"==typeof e){let t=Date.now()+e;e=()=>Date.now()>t}for(this.parse||(this.parse=this.startParse()),null!=n&&(null==this.parse.stoppedAt||this.parse.stoppedAt>n)&&n<this.state.doc.length&&this.parse.stopAt(n);;){let i=this.parse.advance();if(i){if(this.fragments=this.withoutTempSkipped(t.TreeFragment.addTree(i,this.fragments,null!=this.parse.stoppedAt)),this.treeLen=null!==(r=this.parse.stoppedAt)&&void 0!==r?r:this.state.doc.length,this.tree=i,this.parse=null,!(this.treeLen<(null!=n?n:this.state.doc.length)))return!0;this.parse=this.startParse()}if(e())return!1}})}takeTree(){let e,n;this.parse&&(e=this.parse.parsedPos)>=this.treeLen&&((null==this.parse.stoppedAt||this.parse.stoppedAt>e)&&this.parse.stopAt(e),this.withContext(()=>{for(;!(n=this.parse.advance()););}),this.treeLen=e,this.tree=n,this.fragments=this.withoutTempSkipped(t.TreeFragment.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(e){let t=v;v=this;try{return e()}finally{v=t}}withoutTempSkipped(e){for(let t;t=this.tempSkipped.pop();)e=P(e,t.from,t.to);return e}changes(e,n){let{fragments:r,tree:i,treeLen:o,viewport:s,skipped:a}=this;if(this.takeTree(),!e.empty){let n=[];if(e.iterChangedRanges((e,t,r,i)=>n.push({fromA:e,toA:t,fromB:r,toB:i})),r=t.TreeFragment.applyChanges(r,n),i=t.Tree.empty,o=0,s={from:e.mapPos(s.from,-1),to:e.mapPos(s.to,1)},this.skipped.length){a=[];for(let t of this.skipped){let n=e.mapPos(t.from,1),r=e.mapPos(t.to,-1);n<r&&a.push({from:n,to:r})}}}return new y(this.parser,n,r,i,o,s,a,this.scheduleOn)}updateViewport(e){if(this.viewport.from==e.from&&this.viewport.to==e.to)return!1;this.viewport=e;let t=this.skipped.length;for(let t=0;t<this.skipped.length;t++){let{from:n,to:r}=this.skipped[t];n<e.to&&r>e.from&&(this.fragments=P(this.fragments,n,r),this.skipped.splice(t--,1))}return!(this.skipped.length>=t)&&(this.reset(),!0)}reset(){this.parse&&(this.takeTree(),this.parse=null)}skipUntilInView(e,t){this.skipped.push({from:e,to:t})}static getSkippingParser(e){return new class extends t.Parser{createParse(n,r,i){let o=i[0].from,s=i[i.length-1].to;return{parsedPos:o,advance(){let n=v;if(n){for(let e of i)n.tempSkipped.push(e);e&&(n.scheduleOn=n.scheduleOn?Promise.all([n.scheduleOn,e]):e)}return this.parsedPos=s,new t.Tree(t.NodeType.none,[],[],s-o)},stoppedAt:null,stopAt(){}}}}}isDone(e){e=Math.min(e,this.state.doc.length);let t=this.fragments;return this.treeLen>=e&&t.length&&0==t[0].from&&t[0].to>=e}static get(){return v}}function P(e,n,r){return t.TreeFragment.applyChanges(e,[{fromA:n,toA:r,fromB:n,toB:r}])}class x{constructor(e){this.context=e,this.tree=e.tree}apply(e){if(!e.docChanged&&this.tree==this.context.tree)return this;let t=this.context.changes(e.changes,e.state),n=this.context.treeLen==e.startState.doc.length?void 0:Math.max(e.changes.mapPos(this.context.treeLen),t.viewport.to);return t.work(20,n)||t.takeTree(),new x(t)}static init(e){let t=Math.min(3e3,e.doc.length),n=y.create(e.facet(A).parser,e,{from:0,to:t});return n.work(20,t)||n.takeTree(),new x(n)}}u.state=n.StateField.define({create:x.init,update(e,t){for(let e of t.effects)if(e.is(u.setState))return e.value;return t.startState.facet(A)!=t.state.facet(A)?x.init(t.state):e.apply(t)}});let S=e=>{let t=setTimeout(()=>e(),500);return()=>clearTimeout(t)};"undefined"!=typeof requestIdleCallback&&(S=e=>{let t=-1,n=setTimeout(()=>{t=requestIdleCallback(e,{timeout:400})},100);return()=>t<0?clearTimeout(n):cancelIdleCallback(t)});const O="undefined"!=typeof navigator&&(null===(e=navigator.scheduling)||void 0===e?void 0:e.isInputPending)?()=>navigator.scheduling.isInputPending():null,T=r.ViewPlugin.fromClass(class{constructor(e){this.view=e,this.working=null,this.workScheduled=0,this.chunkEnd=-1,this.chunkBudget=-1,this.work=this.work.bind(this),this.scheduleWork()}update(e){let t=this.view.state.field(u.state).context;(t.updateViewport(e.view.viewport)||this.view.viewport.to>t.treeLen)&&this.scheduleWork(),(e.docChanged||e.selectionSet)&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(t)}scheduleWork(){if(this.working)return;let{state:e}=this.view,t=e.field(u.state);t.tree==t.context.tree&&t.context.isDone(e.doc.length)||(this.working=S(this.work))}work(e){this.working=null;let t=Date.now();if(this.chunkEnd<t&&(this.chunkEnd<0||this.view.hasFocus)&&(this.chunkEnd=t+3e4,this.chunkBudget=3e3),this.chunkBudget<=0)return;let{state:n,viewport:{to:r}}=this.view,i=n.field(u.state);if(i.tree==i.context.tree&&i.context.isDone(r+1e5))return;let o=Date.now()+Math.min(this.chunkBudget,100,e&&!O?Math.max(25,e.timeRemaining()-5):1e9),s=i.context.treeLen<r&&n.doc.length>r+1e3,a=i.context.work(()=>O&&O()||Date.now()>o,r+(s?0:1e5));this.chunkBudget-=Date.now()-t,(a||this.chunkBudget<=0)&&(i.context.takeTree(),this.view.dispatch({effects:u.setState.of(new x(i.context))})),this.chunkBudget>0&&(!a||s)&&this.scheduleWork(),this.checkAsyncSchedule(i.context)}checkAsyncSchedule(e){e.scheduleOn&&(this.workScheduled++,e.scheduleOn.then(()=>this.scheduleWork()).catch(e=>(0,r.logException)(this.view.state,e)).then(()=>this.workScheduled--),e.scheduleOn=null)}destroy(){this.working&&this.working()}isWorking(){return!!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork()}}}),A=n.Facet.define({combine:e=>e.length?e[0]:null,enables:e=>[u.state,T,r.EditorView.contentAttributes.compute([e],t=>{let n=t.facet(e);return n&&n.name?{"data-language":n.name}:{}})]});class C{constructor(e,t=[]){this.language=e,this.support=t,this.extension=[e,t]}}class D{constructor(e,t,n,r,i,o=void 0){this.name=e,this.alias=t,this.extensions=n,this.filename=r,this.loadFunc=i,this.support=o,this.loading=null}load(){return this.loading||(this.loading=this.loadFunc().then(e=>this.support=e,e=>{throw this.loading=null,e}))}static of(e){let{load:t,support:n}=e;if(!t){if(!n)throw new RangeError("Must pass either 'load' or 'support' to LanguageDescription.of");t=()=>Promise.resolve(n)}return new D(e.name,(e.alias||[]).concat(e.name).map(e=>e.toLowerCase()),e.extensions||[],e.filename,t,n)}static matchFilename(e,t){for(let n of e)if(n.filename&&n.filename.test(t))return n;let n=/\.([^.]+)$/.exec(t);if(n)for(let t of e)if(t.extensions.indexOf(n[1])>-1)return t;return null}static matchLanguageName(e,t,n=!0){t=t.toLowerCase();for(let n of e)if(n.alias.some(e=>e==t))return n;if(n)for(let n of e)for(let e of n.alias){let r=t.indexOf(e);if(r>-1&&(e.length>2||!/\w/.test(t[r-1])&&!/\w/.test(t[r+e.length])))return n}return null}}const j=n.Facet.define(),I=n.Facet.define({combine:e=>{if(!e.length)return" ";let t=e[0];if(!t||/\S/.test(t)||Array.from(t).some(e=>e!=t[0]))throw new Error("Invalid indent unit: "+JSON.stringify(e[0]));return t}});function N(e){let t=e.facet(I);return 9==t.charCodeAt(0)?e.tabSize*t.length:t.length}function E(e,t){let n="",r=e.tabSize,i=e.facet(I)[0];if("\t"==i){for(;t>=r;)n+="\t",t-=r;i=" "}for(let e=0;e<t;e++)n+=i;return n}function B(e,t){e instanceof n.EditorState&&(e=new M(e));for(let n of e.state.facet(j)){let r=n(e,t);if(void 0!==r)return r}let r=f(e.state);return r.length>=t?F(e,r,t):null}function L(e,t,n){let r=Object.create(null),i=new M(e,{overrideIndentation:e=>{var t;return null!==(t=r[e])&&void 0!==t?t:-1}}),o=[];for(let s=t;s<=n;){let t=e.doc.lineAt(s);s=t.to+1;let n=B(i,t.from);if(null==n)continue;/\S/.test(t.text)||(n=0);let a=/^\s*/.exec(t.text)[0],l=E(e,n);a!=l&&(r[t.from]=n,o.push({from:t.from,to:t.from+a.length,insert:l}))}return e.changes(o)}class M{constructor(e,t={}){this.state=e,this.options=t,this.unit=N(e)}lineAt(e,t=1){let n=this.state.doc.lineAt(e),{simulateBreak:r,simulateDoubleBreak:i}=this.options;return null!=r&&r>=n.from&&r<=n.to?i&&r==e?{text:"",from:e}:(t<0?r<e:r<=e)?{text:n.text.slice(r-n.from),from:r}:{text:n.text.slice(0,r-n.from),from:n.from}:n}textAfterPos(e,t=1){if(this.options.simulateDoubleBreak&&e==this.options.simulateBreak)return"";let{text:n,from:r}=this.lineAt(e,t);return n.slice(e-r,Math.min(n.length,e+100-r))}column(e,t=1){let{text:n,from:r}=this.lineAt(e,t),i=this.countColumn(n,e-r),o=this.options.overrideIndentation?this.options.overrideIndentation(r):-1;return o>-1&&(i+=o-this.countColumn(n,n.search(/\S|$/))),i}countColumn(e,t=e.length){return(0,n.countColumn)(e,this.state.tabSize,t)}lineIndent(e,t=1){let{text:n,from:r}=this.lineAt(e,t),i=this.options.overrideIndentation;if(i){let e=i(r);if(e>-1)return e}return this.countColumn(n,n.search(/\S|$/))}get simulatedBreak(){return this.options.simulateBreak||null}}const R=new t.NodeProp;function F(e,t,n){let r=t.resolveStack(n),i=t.resolveInner(n,-1).resolve(n,0).enterUnfinishedNodesBefore(n);if(i!=r.node){let e=[];for(let t=i;t&&!(t.from<r.node.from||t.to>r.node.to||t.from==r.node.from&&t.type==r.node.type);t=t.parent)e.push(t);for(let t=e.length-1;t>=0;t--)r={node:e[t],next:r}}return V(r,e,n)}function V(e,t,n){for(let r=e;r;r=r.next){let e=U(r.node);if(e)return e(z.create(t,n,r))}return 0}function W(e){return e.pos==e.options.simulateBreak&&e.options.simulateDoubleBreak}function U(e){let n=e.type.prop(R);if(n)return n;let r,i=e.firstChild;if(i&&(r=i.type.prop(t.NodeProp.closedBy))){let t=e.lastChild,n=t&&r.indexOf(t.name)>-1;return e=>J(e,!0,1,void 0,n&&!W(e)?t.from:void 0)}return null==e.parent?$:null}function $(){return 0}class z extends M{constructor(e,t,n){super(e.state,e.options),this.base=e,this.pos=t,this.context=n}get node(){return this.context.node}static create(e,t,n){return new z(e,t,n)}get textAfter(){return this.textAfterPos(this.pos)}get baseIndent(){return this.baseIndentFor(this.node)}baseIndentFor(e){let t=this.state.doc.lineAt(e.from);for(;;){let n=e.resolve(t.from);for(;n.parent&&n.parent.from==n.from;)n=n.parent;if(H(n,e))break;t=this.state.doc.lineAt(n.from)}return this.lineIndent(t.from)}continue(){return V(this.context.next,this.base,this.pos)}}function H(e,t){for(let n=t;n;n=n.parent)if(e==n)return!0;return!1}function G(e){let t=e.node,n=t.childAfter(t.from),r=t.lastChild;if(!n)return null;let i=e.options.simulateBreak,o=e.state.doc.lineAt(n.from),s=null==i||i<=o.from?o.to:Math.min(o.to,i);for(let e=n.to;;){let i=t.childAfter(e);if(!i||i==r)return null;if(!i.type.isSkipped){if(i.from>=s)return null;let e=/^ */.exec(o.text.slice(n.to-o.from))[0].length;return{from:n.from,to:n.to+e}}e=i.to}}function q({closing:e,align:t=!0,units:n=1}){return r=>J(r,t,n,e)}function J(e,t,n,r,i){let o=e.textAfter,s=o.match(/^\s*/)[0].length,a=r&&o.slice(s,s+r.length)==r||i==e.pos+s,l=t?G(e):null;return l?a?e.column(l.from):e.column(l.to):e.baseIndent+(a?0:e.unit*n)}const _=e=>e.baseIndent;function K({except:e,units:t=1}={}){return n=>{let r=e&&e.test(n.textAfter);return n.baseIndent+(r?0:t*n.unit)}}const Q=200;function X(){return n.EditorState.transactionFilter.of(e=>{if(!e.docChanged||!e.isUserEvent("input.type")&&!e.isUserEvent("input.complete"))return e;let t=e.startState.languageDataAt("indentOnInput",e.startState.selection.main.head);if(!t.length)return e;let n=e.newDoc,{head:r}=e.newSelection.main,i=n.lineAt(r);if(r>i.from+Q)return e;let o=n.sliceString(i.from,r);if(!t.some(e=>e.test(o)))return e;let{state:s}=e,a=-1,l=[];for(let{head:e}of s.selection.ranges){let t=s.doc.lineAt(e);if(t.from==a)continue;a=t.from;let n=B(s,t.from);if(null==n)continue;let r=/^\s*/.exec(t.text)[0],i=E(s,n);r!=i&&l.push({from:t.from,to:t.from+r.length,insert:i})}return l.length?[e,{changes:l,sequential:!0}]:e})}const Y=n.Facet.define(),Z=new t.NodeProp;function ee(e){let t=e.firstChild,n=e.lastChild;return t&&t.to<n.from?{from:t.to,to:n.type.isError?e.to:n.from}:null}function te(e,t,n){let r=f(e);if(r.length<n)return null;let i=null;for(let o=r.resolveStack(n,1);o;o=o.next){let s=o.node;if(s.to<=n||s.from>n)continue;if(i&&s.from<t)break;let a=s.type.prop(Z);if(a&&(s.to<r.length-50||r.length==e.doc.length||!ne(s))){let r=a(s,e);r&&r.from<=n&&r.from>=t&&r.to>n&&(i=r)}}return i}function ne(e){let t=e.lastChild;return t&&t.to==e.to&&t.type.isError}function re(e,t,n){for(let r of e.facet(Y)){let i=r(e,t,n);if(i)return i}return te(e,t,n)}function ie(e,t){let n=t.mapPos(e.from,1),r=t.mapPos(e.to,-1);return n>=r?void 0:{from:n,to:r}}const oe=n.StateEffect.define({map:ie}),se=n.StateEffect.define({map:ie});function ae(e){let t=[];for(let{head:n}of e.state.selection.ranges)t.some(e=>e.from<=n&&e.to>=n)||t.push(e.lineBlockAt(n));return t}const le=n.StateField.define({create:()=>r.Decoration.none,update(e,t){t.isUserEvent("delete")&&t.changes.iterChangedRanges((t,n)=>e=ue(e,t,n)),e=e.map(t.changes);let n=[];for(let r of t.effects)r.is(oe)&&!fe(e,r.value.from,r.value.to)?n.push(r.value):r.is(se)&&(e=e.update({filter:(e,t)=>r.value.from!=e||r.value.to!=t,filterFrom:r.value.from,filterTo:r.value.to}));if(n.length){let{preparePlaceholder:i}=t.state.facet(xe),o=n.map(e=>(i?r.Decoration.replace({widget:new Ae(i(t.state,e))}):Te).range(e.from,e.to));e=e.update({add:o})}return t.selection&&(e=ue(e,t.selection.main.head)),e},provide:e=>r.EditorView.decorations.from(e),toJSON(e,t){let n=[];return e.between(0,t.doc.length,(e,t)=>{n.push(e,t)}),n},fromJSON(e){if(!Array.isArray(e)||e.length%2)throw new RangeError("Invalid JSON for fold state");let t=[];for(let n=0;n<e.length;){let r=e[n++],i=e[n++];if("number"!=typeof r||"number"!=typeof i)throw new RangeError("Invalid JSON for fold state");t.push(Te.range(r,i))}return r.Decoration.set(t,!0)}});function ue(e,t,n=t){let r=!1;return e.between(t,n,(e,i)=>{e<n&&i>t&&(r=!0)}),r?e.update({filterFrom:t,filterTo:n,filter:(e,r)=>e>=n||r<=t}):e}function ce(e){return e.field(le,!1)||n.RangeSet.empty}function he(e,t,n){var r;let i=null;return null===(r=e.field(le,!1))||void 0===r||r.between(t,n,(e,t)=>{(!i||i.from>e)&&(i={from:e,to:t})}),i}function fe(e,t,n){let r=!1;return e.between(t,t,(e,i)=>{e==t&&i==n&&(r=!0)}),r}function de(e,t){return e.field(le,!1)?t:t.concat(n.StateEffect.appendConfig.of(Se()))}const pe=e=>{for(let t of ae(e)){let n=re(e.state,t.from,t.to);if(n)return e.dispatch({effects:de(e.state,[oe.of(n),me(e,n)])}),!0}return!1},ge=e=>{if(!e.state.field(le,!1))return!1;let t=[];for(let n of ae(e)){let r=he(e.state,n.from,n.to);r&&t.push(se.of(r),me(e,r,!1))}return t.length&&e.dispatch({effects:t}),t.length>0};function me(e,t,n=!0){let i=e.state.doc.lineAt(t.from).number,o=e.state.doc.lineAt(t.to).number;return r.EditorView.announce.of(`${e.state.phrase(n?"Folded lines":"Unfolded lines")} ${i} ${e.state.phrase("to")} ${o}.`)}const be=e=>{let{state:t}=e,n=[];for(let r=0;r<t.doc.length;){let i=e.lineBlockAt(r),o=re(t,i.from,i.to);o&&n.push(oe.of(o)),r=(o?e.lineBlockAt(o.to):i).to+1}return n.length&&e.dispatch({effects:de(e.state,n)}),!!n.length},ke=e=>{let t=e.state.field(le,!1);if(!t||!t.size)return!1;let n=[];return t.between(0,e.state.doc.length,(e,t)=>{n.push(se.of({from:e,to:t}))}),e.dispatch({effects:n}),!0};function we(e,t){for(let n=t;;){let r=re(e.state,n.from,n.to);if(r&&r.to>t.from)return r;if(!n.from)return null;n=e.lineBlockAt(n.from-1)}}const ve=e=>{let t=[];for(let n of ae(e)){let r=he(e.state,n.from,n.to);if(r)t.push(se.of(r),me(e,r,!1));else{let r=we(e,n);r&&t.push(oe.of(r),me(e,r))}}return t.length>0&&e.dispatch({effects:de(e.state,t)}),!!t.length},ye=[{key:"Ctrl-Shift-[",mac:"Cmd-Alt-[",run:pe},{key:"Ctrl-Shift-]",mac:"Cmd-Alt-]",run:ge},{key:"Ctrl-Alt-[",run:be},{key:"Ctrl-Alt-]",run:ke}],Pe={placeholderDOM:null,preparePlaceholder:null,placeholderText:"\u2026"},xe=n.Facet.define({combine:e=>(0,n.combineConfig)(e,Pe)});function Se(e){let t=[le,Ie];return e&&t.push(xe.of(e)),t}function Oe(e,t){let{state:n}=e,r=n.facet(xe),i=t=>{let n=e.lineBlockAt(e.posAtDOM(t.target)),r=he(e.state,n.from,n.to);r&&e.dispatch({effects:se.of(r)}),t.preventDefault()};if(r.placeholderDOM)return r.placeholderDOM(e,i,t);let o=document.createElement("span");return o.textContent=r.placeholderText,o.setAttribute("aria-label",n.phrase("folded code")),o.title=n.phrase("unfold"),o.className="cm-foldPlaceholder",o.onclick=i,o}const Te=r.Decoration.replace({widget:new class extends r.WidgetType{toDOM(e){return Oe(e,null)}}});class Ae extends r.WidgetType{constructor(e){super(),this.value=e}eq(e){return this.value==e.value}toDOM(e){return Oe(e,this.value)}}const Ce={openText:"\u2304",closedText:"\u203a",markerDOM:null,domEventHandlers:{},foldingChanged:()=>!1};class De extends r.GutterMarker{constructor(e,t){super(),this.config=e,this.open=t}eq(e){return this.config==e.config&&this.open==e.open}toDOM(e){if(this.config.markerDOM)return this.config.markerDOM(this.open);let t=document.createElement("span");return t.textContent=this.open?this.config.openText:this.config.closedText,t.title=e.state.phrase(this.open?"Fold line":"Unfold line"),t}}function je(e={}){let t=Object.assign({},Ce,e),i=new De(t,!0),o=new De(t,!1),s=r.ViewPlugin.fromClass(class{constructor(e){this.from=e.viewport.from,this.markers=this.buildMarkers(e)}update(e){(e.docChanged||e.viewportChanged||e.startState.facet(A)!=e.state.facet(A)||e.startState.field(le,!1)!=e.state.field(le,!1)||f(e.startState)!=f(e.state)||t.foldingChanged(e))&&(this.markers=this.buildMarkers(e.view))}buildMarkers(e){let t=new n.RangeSetBuilder;for(let n of e.viewportLineBlocks){let r=he(e.state,n.from,n.to)?o:re(e.state,n.from,n.to)?i:null;r&&t.add(n.from,n.from,r)}return t.finish()}}),{domEventHandlers:a}=t;return[s,(0,r.gutter)({class:"cm-foldGutter",markers(e){var t;return(null===(t=e.plugin(s))||void 0===t?void 0:t.markers)||n.RangeSet.empty},initialSpacer:()=>new De(t,!1),domEventHandlers:Object.assign({},a,{click:(e,t,n)=>{if(a.click&&a.click(e,t,n))return!0;let r=he(e.state,t.from,t.to);if(r)return e.dispatch({effects:se.of(r)}),!0;let i=re(e.state,t.from,t.to);return!!i&&(e.dispatch({effects:oe.of(i)}),!0)}})}),Se()]}const Ie=r.EditorView.baseTheme({".cm-foldPlaceholder":{backgroundColor:"#eee",border:"1px solid #ddd",color:"#888",borderRadius:".2em",margin:"0 1px",padding:"0 1px",cursor:"pointer"},".cm-foldGutter span":{padding:"0 1px",cursor:"pointer"}});class Ne{constructor(e,t){let n;function r(e){let t=o.StyleModule.newName();return(n||(n=Object.create(null)))["."+t]=e,t}this.specs=e;const a="string"==typeof t.all?t.all:t.all?r(t.all):void 0,l=t.scope;this.scope=l instanceof u?e=>e.prop(s)==l.data:l?e=>e==l:void 0,this.style=(0,i.tagHighlighter)(e.map(e=>({tag:e.tag,class:e.class||r(Object.assign({},e,{tag:null}))})),{all:a}).style,this.module=n?new o.StyleModule(n):null,this.themeType=t.themeType}static define(e,t){return new Ne(e,t||{})}}const Ee=n.Facet.define(),Be=n.Facet.define({combine:e=>e.length?[e[0]]:null});function Le(e){let t=e.facet(Ee);return t.length?t:e.facet(Be)}function Me(e,t){let n,i=[Ve];return e instanceof Ne&&(e.module&&i.push(r.EditorView.styleModule.of(e.module)),n=e.themeType),(null==t?void 0:t.fallback)?i.push(Be.of(e)):n?i.push(Ee.computeN([r.EditorView.darkTheme],t=>t.facet(r.EditorView.darkTheme)==("dark"==n)?[e]:[])):i.push(Ee.of(e)),i}function Re(e,t,n){let r=Le(e),i=null;if(r)for(let e of r)if(!e.scope||n&&e.scope(n)){let n=e.style(t);n&&(i=i?i+" "+n:n)}return i}class Fe{constructor(e){this.markCache=Object.create(null),this.tree=f(e.state),this.decorations=this.buildDeco(e,Le(e.state)),this.decoratedTo=e.viewport.to}update(e){let t=f(e.state),n=Le(e.state),r=n!=Le(e.startState),{viewport:i}=e.view,o=e.changes.mapPos(this.decoratedTo,1);t.length<i.to&&!r&&t.type==this.tree.type&&o>=i.to?(this.decorations=this.decorations.map(e.changes),this.decoratedTo=o):(t!=this.tree||e.viewportChanged||r)&&(this.tree=t,this.decorations=this.buildDeco(e.view,n),this.decoratedTo=i.to)}buildDeco(e,t){if(!t||!this.tree.length)return r.Decoration.none;let o=new n.RangeSetBuilder;for(let{from:n,to:s}of e.visibleRanges)(0,i.highlightTree)(this.tree,t,(e,t,n)=>{o.add(e,t,this.markCache[n]||(this.markCache[n]=r.Decoration.mark({class:n})))},n,s);return o.finish()}}const Ve=n.Prec.high(r.ViewPlugin.fromClass(Fe,{decorations:e=>e.decorations})),We=Ne.define([{tag:i.tags.meta,color:"#404740"},{tag:i.tags.link,textDecoration:"underline"},{tag:i.tags.heading,textDecoration:"underline",fontWeight:"bold"},{tag:i.tags.emphasis,fontStyle:"italic"},{tag:i.tags.strong,fontWeight:"bold"},{tag:i.tags.strikethrough,textDecoration:"line-through"},{tag:i.tags.keyword,color:"#708"},{tag:[i.tags.atom,i.tags.bool,i.tags.url,i.tags.contentSeparator,i.tags.labelName],color:"#219"},{tag:[i.tags.literal,i.tags.inserted],color:"#164"},{tag:[i.tags.string,i.tags.deleted],color:"#a11"},{tag:[i.tags.regexp,i.tags.escape,i.tags.special(i.tags.string)],color:"#e40"},{tag:i.tags.definition(i.tags.variableName),color:"#00f"},{tag:i.tags.local(i.tags.variableName),color:"#30a"},{tag:[i.tags.typeName,i.tags.namespace],color:"#085"},{tag:i.tags.className,color:"#167"},{tag:[i.tags.special(i.tags.variableName),i.tags.macroName],color:"#256"},{tag:i.tags.definition(i.tags.propertyName),color:"#00c"},{tag:i.tags.comment,color:"#940"},{tag:i.tags.invalid,color:"#f00"}]),Ue=r.EditorView.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}}),$e=1e4,ze="()[]{}",He=n.Facet.define({combine:e=>(0,n.combineConfig)(e,{afterCursor:!0,brackets:ze,maxScanDistance:$e,renderMatch:Je})}),Ge=r.Decoration.mark({class:"cm-matchingBracket"}),qe=r.Decoration.mark({class:"cm-nonmatchingBracket"});function Je(e){let t=[],n=e.matched?Ge:qe;return t.push(n.range(e.start.from,e.start.to)),e.end&&t.push(n.range(e.end.from,e.end.to)),t}function Ke(e){let t=[],n=e.facet(He);for(let r of e.selection.ranges){if(!r.empty)continue;let i=tt(e,r.head,-1,n)||r.head>0&&tt(e,r.head-1,1,n)||n.afterCursor&&(tt(e,r.head,1,n)||r.head<e.doc.length&&tt(e,r.head+1,-1,n));i&&(t=t.concat(n.renderMatch(i,e)))}return r.Decoration.set(t,!0)}const Qe=[r.ViewPlugin.fromClass(class{constructor(e){this.paused=!1,this.decorations=Ke(e.state)}update(e){(e.docChanged||e.selectionSet||this.paused)&&(e.view.composing?(this.decorations=this.decorations.map(e.changes),this.paused=!0):(this.decorations=Ke(e.state),this.paused=!1))}},{decorations:e=>e.decorations}),Ue];function Xe(e={}){return[He.of(e),Qe]}const Ye=new t.NodeProp;function Ze(e,n,r){let i=e.prop(n<0?t.NodeProp.openedBy:t.NodeProp.closedBy);if(i)return i;if(1==e.name.length){let t=r.indexOf(e.name);if(t>-1&&t%2==(n<0?1:0))return[r[t+n]]}return null}function et(e){let t=e.type.prop(Ye);return t?t(e.node):e}function tt(e,t,n,r={}){let i=r.maxScanDistance||$e,o=r.brackets||ze,s=f(e),a=s.resolveInner(t,n);for(let r=a;r;r=r.parent){let i=Ze(r.type,n,o);if(i&&r.from<r.to){let s=et(r);if(s&&(n>0?t>=s.from&&t<s.to:t>s.from&&t<=s.to))return nt(e,t,n,r,s,i,o)}}return rt(e,t,n,s,a.type,i,o)}function nt(e,t,n,r,i,o,s){let a=r.parent,l={from:i.from,to:i.to},u=0,c=null==a?void 0:a.cursor();if(c&&(n<0?c.childBefore(r.from):c.childAfter(r.to)))do{if(n<0?c.to<=r.from:c.from>=r.to){if(0==u&&o.indexOf(c.type.name)>-1&&c.from<c.to){let e=et(c);return{start:l,end:e?{from:e.from,to:e.to}:void 0,matched:!0}}if(Ze(c.type,n,s))u++;else if(Ze(c.type,-n,s)){if(0==u){let e=et(c);return{start:l,end:e&&e.from<e.to?{from:e.from,to:e.to}:void 0,matched:!1}}u--}}}while(n<0?c.prevSibling():c.nextSibling());return{start:l,matched:!1}}function rt(e,t,n,r,i,o,s){if(n<0?!t:t==e.doc.length)return null;let a=n<0?e.sliceDoc(t-1,t):e.sliceDoc(t,t+1),l=s.indexOf(a);if(l<0||l%2==0!=n>0)return null;let u={from:n<0?t-1:t,to:n>0?t+1:t},c=e.doc.iterRange(t,n>0?e.doc.length:0),h=0;for(let e=0;!c.next().done&&e<=o;){let o=c.value;n<0&&(e+=o.length);let a=t+e*n;for(let e=n>0?0:o.length-1,t=n>0?o.length:-1;e!=t;e+=n){let t=s.indexOf(o[e]);if(!(t<0||r.resolveInner(a+e,1).type!=i))if(t%2==0==n>0)h++;else{if(1==h)return{start:u,end:{from:a+e,to:a+e+1},matched:t>>1==l>>1};h--}}n>0&&(e+=o.length)}return c.done?{start:u,matched:!1}:null}function it(e,t,n,r=0,i=0){null==t&&-1==(t=e.search(/[^\s\u00a0]/))&&(t=e.length);let o=i;for(let i=r;i<t;i++)9==e.charCodeAt(i)?o+=n-o%n:o++;return o}class ot{constructor(e,t,n,r){this.string=e,this.tabSize=t,this.indentUnit=n,this.overrideIndent=r,this.pos=0,this.start=0,this.lastColumnPos=0,this.lastColumnValue=0}eol(){return this.pos>=this.string.length}sol(){return 0==this.pos}peek(){return this.string.charAt(this.pos)||void 0}next(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)}eat(e){let t,n=this.string.charAt(this.pos);if(t="string"==typeof e?n==e:n&&(e instanceof RegExp?e.test(n):e(n)),t)return++this.pos,n}eatWhile(e){let t=this.pos;for(;this.eat(e););return this.pos>t}eatSpace(){let e=this.pos;for(;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e}skipToEnd(){this.pos=this.string.length}skipTo(e){let t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0}backUp(e){this.pos-=e}column(){return this.lastColumnPos<this.start&&(this.lastColumnValue=it(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue}indentation(){var e;return null!==(e=this.overrideIndent)&&void 0!==e?e:it(this.string,null,this.tabSize)}match(e,t,n){if("string"==typeof e){let r=e=>n?e.toLowerCase():e;return r(this.string.substr(this.pos,e.length))==r(e)?(!1!==t&&(this.pos+=e.length),!0):null}{let n=this.string.slice(this.pos).match(e);return n&&n.index>0?null:(n&&!1!==t&&(this.pos+=n[0].length),n)}}current(){return this.string.slice(this.start,this.pos)}}function st(e){if("object"!=typeof e)return e;let t={};for(let n in e){let r=e[n];t[n]=r instanceof Array?r.slice():r}return t}const at=new WeakMap;class lt extends u{constructor(e){let n,r=a(e.languageData),i={name:(o=e).name||"",token:o.token,blankLine:o.blankLine||(()=>{}),startState:o.startState||(()=>!0),copyState:o.copyState||st,indent:o.indent||(()=>null),languageData:o.languageData||{},tokenTable:o.tokenTable||pt,mergeTokens:!1!==o.mergeTokens};var o;super(r,new class extends t.Parser{createParse(e,t,r){return new ft(n,e,t,r)}},[],e.name),this.topNode=St(r,this),n=this,this.streamParser=i,this.stateAfter=new t.NodeProp({perNode:!0}),this.tokenTable=e.tokenTable?new vt(i.tokenTable):yt}static define(e){return new lt(e)}getIndent(e){let t,{overrideIndentation:n}=e.options;n&&(t=at.get(e.state),null!=t&&t<e.pos-1e4&&(t=void 0));let r,i,o=ut(this,e.node.tree,e.node.from,e.node.from,null!=t?t:e.pos);if(o?(i=o.state,r=o.pos+1):(i=this.streamParser.startState(e.unit),r=e.node.from),e.pos-r>1e4)return null;for(;r<e.pos;){let t=e.state.doc.lineAt(r),o=Math.min(e.pos,t.to);if(t.length){let r=n?n(t.from):-1,s=new ot(t.text,e.state.tabSize,e.unit,r<0?void 0:r);for(;s.pos<o-t.from;)dt(this.streamParser.token,s,i)}else this.streamParser.blankLine(i,e.unit);if(o==e.pos)break;r=t.to+1}let s=e.lineAt(e.pos);return n&&null==t&&at.set(e.state,s.from),this.streamParser.indent(i,/^\s*(.*)/.exec(s.text)[1],e)}get allowsNesting(){return!1}}function ut(e,n,r,i,o){let s=r>=i&&r+n.length<=o&&n.prop(e.stateAfter);if(s)return{state:e.streamParser.copyState(s),pos:r+n.length};for(let s=n.children.length-1;s>=0;s--){let a=n.children[s],l=r+n.positions[s],u=a instanceof t.Tree&&l<o&&ut(e,a,l,i,o);if(u)return u}return null}function ct(e,n,r,i,o){if(o&&r<=0&&i>=n.length)return n;o||0!=r||n.type!=e.topNode||(o=!0);for(let s=n.children.length-1;s>=0;s--){let a,l=n.positions[s],u=n.children[s];if(l<i&&u instanceof t.Tree){if(!(a=ct(e,u,r-l,i-l,o)))break;return o?new t.Tree(n.type,n.children.slice(0,s).concat(a),n.positions.slice(0,s+1),l+a.length):a}}return null}function ht(e,n,r,i,o){for(let t of n){let n,o=t.from+(t.openStart?25:0),s=t.to-(t.openEnd?25:0),a=o<=r&&s>r&&ut(e,t.tree,0-t.offset,r,s);if(a&&a.pos<=i&&(n=ct(e,t.tree,r+t.offset,a.pos+t.offset,!1)))return{state:a.state,tree:n}}return{state:e.streamParser.startState(o?N(o):4),tree:t.Tree.empty}}class ft{constructor(e,t,n,r){this.lang=e,this.input=t,this.fragments=n,this.ranges=r,this.stoppedAt=null,this.chunks=[],this.chunkPos=[],this.chunk=[],this.chunkReused=void 0,this.rangeIndex=0,this.to=r[r.length-1].to;let i=y.get(),o=r[0].from,{state:s,tree:a}=ht(e,n,o,this.to,null==i?void 0:i.state);this.state=s,this.parsedPos=this.chunkStart=o+a.length;for(let e=0;e<a.children.length;e++)this.chunks.push(a.children[e]),this.chunkPos.push(a.positions[e]);i&&this.parsedPos<i.viewport.from-1e5&&r.some(e=>e.from<=i.viewport.from&&e.to>=i.viewport.from)&&(this.state=this.lang.streamParser.startState(N(i.state)),i.skipUntilInView(this.parsedPos,i.viewport.from),this.parsedPos=i.viewport.from),this.moveRangeIndex()}advance(){let e=y.get(),t=null==this.stoppedAt?this.to:Math.min(this.to,this.stoppedAt),n=Math.min(t,this.chunkStart+512);for(e&&(n=Math.min(n,e.viewport.to));this.parsedPos<n;)this.parseLine(e);return this.chunkStart<this.parsedPos&&this.finishChunk(),this.parsedPos>=t?this.finish():e&&this.parsedPos>=e.viewport.to?(e.skipUntilInView(this.parsedPos,t),this.finish()):null}stopAt(e){this.stoppedAt=e}lineAfter(e){let t=this.input.chunk(e);if(this.input.lineChunks)"\n"==t&&(t="");else{let e=t.indexOf("\n");e>-1&&(t=t.slice(0,e))}return e+t.length<=this.to?t:t.slice(0,this.to-e)}nextLine(){let e=this.parsedPos,t=this.lineAfter(e),n=e+t.length;for(let e=this.rangeIndex;;){let r=this.ranges[e].to;if(r>=n)break;if(t=t.slice(0,r-(n-t.length)),e++,e==this.ranges.length)break;let i=this.ranges[e].from,o=this.lineAfter(i);t+=o,n=i+o.length}return{line:t,end:n}}skipGapsTo(e,t,n){for(;;){let r=this.ranges[this.rangeIndex].to,i=e+t;if(n>0?r>i:r>=i)break;t+=this.ranges[++this.rangeIndex].from-r}return t}moveRangeIndex(){for(;this.ranges[this.rangeIndex].to<this.parsedPos;)this.rangeIndex++}emitToken(e,t,n,r){let i=4;if(this.ranges.length>1){t+=r=this.skipGapsTo(t,r,1);let e=this.chunk.length;n+=r=this.skipGapsTo(n,r,-1),i+=this.chunk.length-e}let o=this.chunk.length-4;return this.lang.streamParser.mergeTokens&&4==i&&o>=0&&this.chunk[o]==e&&this.chunk[o+2]==t?this.chunk[o+2]=n:this.chunk.push(e,t,n,i),r}parseLine(e){let{line:t,end:n}=this.nextLine(),r=0,{streamParser:i}=this.lang,o=new ot(t,e?e.state.tabSize:4,e?N(e.state):2);if(o.eol())i.blankLine(this.state,o.indentUnit);else for(;!o.eol();){let e=dt(i.token,o,this.state);if(e&&(r=this.emitToken(this.lang.tokenTable.resolve(e),this.parsedPos+o.start,this.parsedPos+o.pos,r)),o.start>1e4)break}this.parsedPos=n,this.moveRangeIndex(),this.parsedPos<this.to&&this.parsedPos++}finishChunk(){let e=t.Tree.build({buffer:this.chunk,start:this.chunkStart,length:this.parsedPos-this.chunkStart,nodeSet:mt,topID:0,maxBufferLength:512,reused:this.chunkReused});e=new t.Tree(e.type,e.children,e.positions,e.length,[[this.lang.stateAfter,this.lang.streamParser.copyState(this.state)]]),this.chunks.push(e),this.chunkPos.push(this.chunkStart-this.ranges[0].from),this.chunk=[],this.chunkReused=void 0,this.chunkStart=this.parsedPos}finish(){return new t.Tree(this.lang.topNode,this.chunks,this.chunkPos,this.parsedPos-this.ranges[0].from).balance()}}function dt(e,t,n){t.start=t.pos;for(let r=0;r<10;r++){let r=e(t,n);if(t.pos>t.start)return r}throw new Error("Stream parser failed to advance stream.")}const pt=Object.create(null),gt=[t.NodeType.none],mt=new t.NodeSet(gt),bt=[],kt=Object.create(null),wt=Object.create(null);for(let[e,t]of[["variable","variableName"],["variable-2","variableName.special"],["string-2","string.special"],["def","variableName.definition"],["tag","tagName"],["attribute","attributeName"],["type","typeName"],["builtin","variableName.standard"],["qualifier","modifier"],["error","invalid"],["header","heading"],["property","propertyName"]])wt[e]=xt(pt,t);class vt{constructor(e){this.extra=e,this.table=Object.assign(Object.create(null),wt)}resolve(e){return e?this.table[e]||(this.table[e]=xt(this.extra,e)):0}}const yt=new vt(pt);function Pt(e,t){bt.indexOf(e)>-1||(bt.push(e),console.warn(t))}function xt(e,n){let r=[];for(let t of n.split(" ")){let n=[];for(let r of t.split(".")){let t=e[r]||i.tags[r];t?"function"==typeof t?n.length?n=n.map(t):Pt(r,`Modifier ${r} used at start of tag`):n.length?Pt(r,`Tag ${r} used as modifier`):n=Array.isArray(t)?t:[t]:Pt(r,`Unknown highlighting tag ${r}`)}for(let e of n)r.push(e)}if(!r.length)return 0;let o=n.replace(/ /g,"_"),s=o+" "+r.map(e=>e.id),a=kt[s];if(a)return a.id;let l=kt[s]=t.NodeType.define({id:gt.length,name:o,props:[(0,i.styleTags)({[o]:r})]});return gt.push(l),l.id}function St(e,n){let r=t.NodeType.define({id:gt.length,name:"Document",props:[s.add(()=>e),R.add(()=>e=>n.getIndent(e))],top:!0});return gt.push(r),r}function Ot(e){return e.length<=4096&&/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac\ufb50-\ufdff]/.test(e)}function Tt(e){for(let t=e.iter();!t.next().done;)if(Ot(t.value))return!0;return!1}function At(e){let t=!1;return e.iterChanges((e,n,r,i,o)=>{!t&&Tt(o)&&(t=!0)}),t}const Ct=n.Facet.define({combine:e=>e.some(e=>e)});function Dt(e={}){let t=[jt];return e.alwaysIsolate&&t.push(Ct.of(!0)),t}const jt=r.ViewPlugin.fromClass(class{constructor(e){this.always=e.state.facet(Ct)||e.textDirection!=r.Direction.LTR||e.state.facet(r.EditorView.perLineTextDirection),this.hasRTL=!this.always&&Tt(e.state.doc),this.tree=f(e.state),this.decorations=this.always||this.hasRTL?It(e,this.tree,this.always):r.Decoration.none}update(e){let t=e.state.facet(Ct)||e.view.textDirection!=r.Direction.LTR||e.state.facet(r.EditorView.perLineTextDirection);if(t||this.hasRTL||!At(e.changes)||(this.hasRTL=!0),!t&&!this.hasRTL)return;let n=f(e.state);(t!=this.always||n!=this.tree||e.docChanged||e.viewportChanged)&&(this.tree=n,this.always=t,this.decorations=It(e.view,n,t))}},{provide:e=>{function t(t){var n,i;return null!==(i=null===(n=t.plugin(e))||void 0===n?void 0:n.decorations)&&void 0!==i?i:r.Decoration.none}return[r.EditorView.outerDecorations.of(t),n.Prec.lowest(r.EditorView.bidiIsolatedRanges.of(t))]}});function It(e,r,i){let o=new n.RangeSetBuilder,s=e.visibleRanges;i||(s=Nt(s,e.state.doc));for(let{from:e,to:n}of s)r.iterate({enter:e=>{let n=e.type.prop(t.NodeProp.isolate);n&&o.add(e.from,e.to,Et[n])},from:e,to:n});return o.finish()}function Nt(e,t){let n=t.iter(),r=0,i=[],o=null;for(let{from:t,to:s}of e)if(!(o&&o.to>t&&(t=o.to,t>=s)))for(r+n.value.length<t&&(n.next(t-(r+n.value.length)),r=t);;){let e=r,t=r+n.value.length;if(!n.lineBreak&&Ot(n.value)&&(o&&o.to>e-10?o.to=Math.min(s,t):i.push(o={from:e,to:Math.min(s,t)})),t>=s)break;r=t,n.next()}return i}const Et={rtl:r.Decoration.mark({class:"cm-iso",inclusive:!0,attributes:{dir:"rtl"},bidiIsolate:r.Direction.RTL}),ltr:r.Decoration.mark({class:"cm-iso",inclusive:!0,attributes:{dir:"ltr"},bidiIsolate:r.Direction.LTR}),auto:r.Decoration.mark({class:"cm-iso",inclusive:!0,attributes:{dir:"auto"},bidiIsolate:null})}},1013,[1014,994,993,1015,996]);
|
|
1112
|
-
__d(function(g,_r,_i,_a2,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"DefaultBufferLength",{enumerable:!0,get:function(){return e}}),Object.defineProperty(_e,"IterMode",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"MountedTree",{enumerable:!0,get:function(){return i}}),Object.defineProperty(_e,"NodeProp",{enumerable:!0,get:function(){return n}}),Object.defineProperty(_e,"NodeSet",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"NodeType",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"NodeWeakMap",{enumerable:!0,get:function(){return T}}),Object.defineProperty(_e,"Parser",{enumerable:!0,get:function(){return E}}),Object.defineProperty(_e,"Tree",{enumerable:!0,get:function(){return a}}),Object.defineProperty(_e,"TreeBuffer",{enumerable:!0,get:function(){return d}}),Object.defineProperty(_e,"TreeCursor",{enumerable:!0,get:function(){return S}}),Object.defineProperty(_e,"TreeFragment",{enumerable:!0,get:function(){return M}}),Object.defineProperty(_e,"parseMixed",{enumerable:!0,get:function(){return z}});const e=1024;let t=0;class r{constructor(e,t){this.from=e,this.to=t}}class n{constructor(e={}){this.id=t++,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"function"!=typeof e&&(e=o.match(e)),t=>{let r=e(t);return void 0===r?null:[this,r]}}}n.closedBy=new n({deserialize:e=>e.split(" ")}),n.openedBy=new n({deserialize:e=>e.split(" ")}),n.group=new n({deserialize:e=>e.split(" ")}),n.isolate=new n({deserialize:e=>{if(e&&"rtl"!=e&&"ltr"!=e&&"auto"!=e)throw new RangeError("Invalid value for isolate: "+e);return e||"auto"}}),n.contextHash=new n({perNode:!0}),n.lookAhead=new n({perNode:!0}),n.mounted=new n({perNode:!0});class i{constructor(e,t,r,n=!1){this.tree=e,this.overlay=t,this.parser=r,this.bracketed=n}static get(e){return e&&e.props&&e.props[n.mounted.id]}}const s=Object.create(null);class o{constructor(e,t,r,n=0){this.name=e,this.props=t,this.id=r,this.flags=n}static define(e){let t=e.props&&e.props.length?Object.create(null):s,r=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(null==e.name?8:0),n=new o(e.name||"",t,e.id,r);if(e.props)for(let r of e.props)if(Array.isArray(r)||(r=r(n)),r){if(r[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");t[r[0].id]=r[1]}return n}prop(e){return this.props[e.id]}get isTop(){return(1&this.flags)>0}get isSkipped(){return(2&this.flags)>0}get isError(){return(4&this.flags)>0}get isAnonymous(){return(8&this.flags)>0}is(e){if('string'==typeof e){if(this.name==e)return!0;let t=this.prop(n.group);return!!t&&t.indexOf(e)>-1}return this.id==e}static match(e){let t=Object.create(null);for(let r in e)for(let n of r.split(" "))t[n]=e[r];return e=>{for(let r=e.prop(n.group),i=-1;i<(r?r.length:0);i++){let n=t[i<0?e.name:r[i]];if(n)return n}}}}o.none=new o("",Object.create(null),0,8);class h{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 r of this.types){let n=null;for(let t of e){let e=t(r);if(e){n||(n=Object.assign({},r.props));let t=e[1],i=e[0];i.combine&&i.id in n&&(t=i.combine(n[i.id],t)),n[i.id]=t}}t.push(n?new o(r.name,n,r.id,r.flags):r)}return new h(t)}}const l=new WeakMap,f=new WeakMap;var u;!(function(e){e[e.ExcludeBuffers=1]="ExcludeBuffers",e[e.IncludeAnonymous=2]="IncludeAnonymous",e[e.IgnoreMounts=4]="IgnoreMounts",e[e.IgnoreOverlays=8]="IgnoreOverlays",e[e.EnterBracketed=16]="EnterBracketed"})(u||(u={}));class a{constructor(e,t,r,n,i){if(this.type=e,this.children=t,this.positions=r,this.length=n,this.props=null,i&&i.length){this.props=Object.create(null);for(let[e,t]of i)this.props["number"==typeof e?e:e.id]=t}}toString(){let e=i.get(this);if(e&&!e.overlay)return e.tree.toString();let t="";for(let e of this.children){let r=e.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 S(this.topNode,e)}cursorAt(e,t=0,r=0){let n=l.get(this)||this.topNode,i=new S(n);return i.moveTo(e,t),l.set(this,i._tree),i}get topNode(){return new y(this,0,0,null)}resolve(e,t=0){let r=m(l.get(this)||this.topNode,e,t,!1);return l.set(this,r),r}resolveInner(e,t=0){let r=m(f.get(this)||this.topNode,e,t,!0);return f.set(this,r),r}resolveStack(e,t=0){return C(this,e,t)}iterate(e){let{enter:t,leave:r,from:n=0,to:i=this.length}=e,s=e.mode||0,o=(s&u.IncludeAnonymous)>0;for(let e=this.cursor(s|u.IncludeAnonymous);;){let s=!1;if(e.from<=i&&e.to>=n&&(!o&&e.type.isAnonymous||!1!==t(e))){if(e.firstChild())continue;s=!0}for(;s&&r&&(o||!e.type.isAnonymous)&&r(e),!e.nextSibling();){if(!e.parent())return;s=!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:O(o.none,this.children,this.positions,0,this.children.length,0,this.length,(e,t,r)=>new a(this.type,e,t,r,this.propValues),e.makeTree||((e,t,r)=>new a(o.none,e,t,r)))}static build(e){return I(e)}}a.empty=new a(o.none,[],[],0);class p{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 p(this.buffer,this.index)}}class d{constructor(e,t,r){this.buffer=e,this.length=t,this.set=r}get type(){return o.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],r=this.buffer[e+3],n=this.set.types[t],i=n.name;if(/\W/.test(i)&&!n.isError&&(i=JSON.stringify(i)),r==(e+=4))return i;let s=[];for(;e<r;)s.push(this.childString(e)),e=this.buffer[e+3];return i+"("+s.join(",")+")"}findChild(e,t,r,n,i){let{buffer:s}=this,o=-1;for(let h=e;h!=t&&!(c(i,n,s[h+1],s[h+2])&&(o=h,r>0));h=s[h+3]);return o}slice(e,t,r){let n=this.buffer,i=new Uint16Array(t-e),s=0;for(let o=e,h=0;o<t;){i[h++]=n[o++],i[h++]=n[o++]-r;let t=i[h++]=n[o++]-r;i[h++]=n[o++]-e,s=Math.max(s,t)}return new d(i,s,this.set)}}function c(e,t,r,n){switch(e){case-2:return r<t;case-1:return n>=t&&r<t;case 0:return r<t&&n>t;case 1:return r<=t&&n>t;case 2:return n>t;case 4:return!0}}function m(e,t,r,n){for(var i;e.from==e.to||(r<1?e.from>=t:e.from>t)||(r>-1?e.to<=t:e.to<t);){let t=!n&&e instanceof y&&e.index<0?null:e.parent;if(!t)return e;e=t}let s=n?0:u.IgnoreOverlays;if(n)for(let n=e,o=n.parent;o;n=o,o=n.parent)n instanceof y&&n.index<0&&(null===(i=o.enter(t,r,s))||void 0===i?void 0:i.from)!=n.from&&(e=o);for(;;){let n=e.enter(t,r,s);if(!n)return e;e=n}}class b{cursor(e=0){return new S(this,e)}getChild(e,t=null,r=null){let n=x(this,e,t,r);return n.length?n[0]:null}getChildren(e,t=null,r=null){return x(this,e,t,r)}resolve(e,t=0){return m(this,e,t,!1)}resolveInner(e,t=0){return m(this,e,t,!0)}matchContext(e){return w(this.parent,e)}enterUnfinishedNodesBefore(e){let t=this.childBefore(e),r=this;for(;t;){let e=t.lastChild;if(!e||e.to!=t.to)break;e.type.isError&&e.from==e.to?(r=t,t=e.prevSibling):t=e}return r}get node(){return this}get next(){return this.parent}}class y extends b{constructor(e,t,r,n){super(),this._tree=e,this.from=t,this.index=r,this._parent=n}get type(){return this._tree.type}get name(){return this._tree.type.name}get to(){return this.from+this._tree.length}nextChild(e,t,r,n,s=0){for(let o=this;;){for(let{children:h,positions:l}=o._tree,f=t>0?h.length:-1;e!=f;e+=t){let f,p=h[e],m=l[e]+o.from;if(s&u.EnterBracketed&&p instanceof a&&(f=i.get(p))&&!f.overlay&&f.bracketed&&r>=m&&r<=m+p.length||c(n,r,m,m+p.length))if(p instanceof d){if(s&u.ExcludeBuffers)continue;let i=p.findChild(0,p.buffer.length,t,r-m,n);if(i>-1)return new _(new v(o,p,e,m),null,i)}else if(s&u.IncludeAnonymous||!p.type.isAnonymous||N(p)){let h;if(!(s&u.IgnoreMounts)&&(h=i.get(p))&&!h.overlay)return new y(h.tree,m,e,o);let l=new y(p,m,e,o);return s&u.IncludeAnonymous||!l.type.isAnonymous?l:l.nextChild(t<0?p.children.length-1:0,t,r,n,s)}}if(s&u.IncludeAnonymous||!o.type.isAnonymous)return null;if(e=o.index>=0?o.index+t: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,r=0){let n;if(!(r&u.IgnoreOverlays)&&(n=i.get(this._tree))&&n.overlay){let i=e-this.from,s=r&u.EnterBracketed&&n.bracketed;for(let{from:e,to:r}of n.overlay)if((t>0||s?e<=i:e<i)&&(t<0||s?r>=i:r>i))return new y(n.tree,n.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,e,t,r)}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 x(e,t,r,n){let i=e.cursor(),s=[];if(!i.firstChild())return s;if(null!=r)for(let e=!1;!e;)if(e=i.type.is(r),!i.nextSibling())return s;for(;;){if(null!=n&&i.type.is(n))return s;if(i.type.is(t)&&s.push(i.node),!i.nextSibling())return null==n?s:[]}}function w(e,t,r=t.length-1){for(let n=e;r>=0;n=n.parent){if(!n)return!1;if(!n.type.isAnonymous){if(t[r]&&t[r]!=n.name)return!1;r--}}return!0}class v{constructor(e,t,r,n){this.parent=e,this.buffer=t,this.index=r,this.start=n}}class _ extends b{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,r){super(),this.context=e,this._parent=t,this.index=r,this.type=e.buffer.set.types[e.buffer.buffer[r]]}child(e,t,r){let{buffer:n}=this.context,i=n.findChild(this.index+4,n.buffer[this.index+3],e,t-this.context.start,r);return i<0?null:new _(this.context,this,i)}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,r=0){if(r&u.ExcludeBuffers)return null;let{buffer:n}=this.context,i=n.findChild(this.index+4,n.buffer[this.index+3],t>0?1:-1,e-this.context.start,t);return i<0?null:new _(this.context,this,i)}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 _(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 _(this.context,this._parent,e.findChild(t,this.index,-1,0,4))}get tree(){return null}toTree(){let e=[],t=[],{buffer:r}=this.context,n=this.index+4,i=r.buffer[this.index+3];if(i>n){let s=r.buffer[this.index+1];e.push(r.slice(n,i,s)),t.push(0)}return new a(this.type,e,t,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function k(e){if(!e.length)return null;let t=0,r=e[0];for(let n=1;n<e.length;n++){let i=e[n];(i.from>r.from||i.to<r.to)&&(r=i,t=n)}let n=r instanceof y&&r.index<0?null:r.parent,i=e.slice();return n?i[t]=n:i.splice(t,1),new A(i,r)}class A{constructor(e,t){this.heads=e,this.node=t}get next(){return k(this.heads)}}function C(e,t,r){let n=e.resolveInner(t,r),s=null;for(let e=n instanceof y?n:n.context.parent;e;e=e.parent)if(e.index<0){let i=e.parent;(s||(s=[n])).push(i.resolve(t,r)),e=i}else{let o=i.get(e.tree);if(o&&o.overlay&&o.overlay[0].from<=t&&o.overlay[o.overlay.length-1].to>=t){let i=new y(o.tree,o.overlay[0].from+e.from,-1,e);(s||(s=[n])).push(m(i,t,r,!1))}}return s?k(s):n}class S{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&~u.EnterBracketed,e instanceof y)this.yieldNode(e);else{this._tree=e.context.parent,this.buffer=e.context;for(let t=e._parent;t;t=t._parent)this.stack.unshift(t.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)}yieldBuf(e,t){this.index=e;let{start:r,buffer:n}=this.buffer;return this.type=t||n.set.types[n.buffer[e]],this.from=r+n.buffer[e+1],this.to=r+n.buffer[e+2],!0}yield(e){return!!e&&(e instanceof y?(this.buffer=null,this.yieldNode(e)):(this.buffer=e.context,this.yieldBuf(e.index,e.type)))}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(e,t,r){if(!this.buffer)return this.yield(this._tree.nextChild(e<0?this._tree._tree.children.length-1:0,e,t,r,this.mode));let{buffer:n}=this.buffer,i=n.findChild(this.index+4,n.buffer[this.index+3],e,t-this.buffer.start,r);return!(i<0)&&(this.stack.push(this.index),this.yieldBuf(i))}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,r=this.mode){return this.buffer?!(r&u.ExcludeBuffers)&&this.enterChild(1,e,t):this.yield(this._tree.enter(e,t,r))}parent(){if(!this.buffer)return this.yieldNode(this.mode&u.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&u.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));let{buffer:t}=this.buffer,r=this.stack.length-1;if(e<0){let e=r<0?0:this.stack[r]+4;if(this.index!=e)return this.yieldBuf(t.findChild(e,this.index,-1,0,4))}else{let e=t.buffer[this.index+3];if(e<(r<0?t.buffer.length:t.buffer[this.stack[r]+3]))return this.yieldBuf(e)}return r<0&&this.yield(this.buffer.parent.nextChild(this.buffer.index+e,e,0,4,this.mode))}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(e){let t,r,{buffer:n}=this;if(n){if(e>0){if(this.index<n.buffer.buffer.length)return!1}else for(let e=0;e<this.index;e++)if(n.buffer.buffer[e+3]<this.index)return!1;({index:t,parent:r}=n)}else({index:t,_parent:r}=this._tree);for(;r;({index:t,_parent:r}=r))if(t>-1)for(let n=t+e,i=e<0?-1:r._tree.children.length;n!=i;n+=e){let e=r._tree.children[n];if(this.mode&u.IncludeAnonymous||e instanceof d||!e.type.isAnonymous||N(e))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,r=0;if(e&&e.context==this.buffer)e:for(let n=this.index,i=this.stack.length;i>=0;){for(let s=e;s;s=s._parent)if(s.index==n){if(n==this.index)return s;t=s,r=i+1;break e}n=this.stack[--i]}for(let e=r;e<this.stack.length;e++)t=new _(this.buffer,t,this.stack[e]);return this.bufferNode=new _(this.buffer,t,this.index)}get tree(){return this.buffer?null:this._tree._tree}iterate(e,t){for(let r=0;;){let n=!1;if(this.type.isAnonymous||!1!==e(this)){if(this.firstChild()){r++;continue}this.type.isAnonymous||(n=!0)}for(;;){if(n&&t&&t(this),n=this.type.isAnonymous,!r)return;if(this.nextSibling())break;this.parent(),r--,n=!0}}}matchContext(e){if(!this.buffer)return w(this.node.parent,e);let{buffer:t}=this.buffer,{types:r}=t.set;for(let n=e.length-1,i=this.stack.length-1;n>=0;i--){if(i<0)return w(this._tree,e,n);let s=r[t.buffer[this.stack[i]]];if(!s.isAnonymous){if(e[n]&&e[n]!=s.name)return!1;n--}}return!0}}function N(e){return e.children.some(e=>e instanceof d||!e.type.isAnonymous||N(e))}function I(t){var r;let{buffer:i,nodeSet:s,maxBufferLength:o=e,reused:h=[],minRepeatType:l=s.types.length}=t,f=Array.isArray(i)?new p(i,i.length):i,u=s.types,c=0,m=0;function b(e,t,r,n,i,a){let{id:p,start:A,end:C,size:S}=f,N=m,I=c;if(S<0){if(f.next(),-1==S){let t=h[p];return r.push(t),void n.push(A-e)}if(-3==S)return void(c=p);if(-4==S)return void(m=p);throw new RangeError(`Unrecognized record size: ${S}`)}let B,P,T=u[p],M=A-e;if(C-A<=o&&(P=_(f.pos-t,i))){let t=new Uint16Array(P.size-P.skip),r=f.pos-P.size,n=t.length;for(;f.pos>r;)n=k(P.start,t,n);B=new d(t,C-P.start,s),M=P.start-e}else{let e=f.pos-S;f.next();let t=[],r=[],n=p>=l?p:-1,i=0,s=C;for(;f.pos>e;)n>=0&&f.id==n&&f.size>=0?(f.end<=s-o&&(w(t,r,A,i,f.end,s,n,N,I),i=t.length,s=f.end),f.next()):a>2500?y(A,e,t,r):b(A,e,t,r,n,a+1);if(n>=0&&i>0&&i<t.length&&w(t,r,A,i,A,s,n,N,I),t.reverse(),r.reverse(),n>-1&&i>0){let e=x(T,I);B=O(T,t,r,0,t.length,0,C-A,e,e)}else B=v(T,t,r,C-A,N-C,I)}r.push(B),n.push(M)}function y(e,t,r,n){let i=[],h=0,l=-1;for(;f.pos>t;){let{id:e,start:t,end:r,size:n}=f;if(n>4)f.next();else{if(l>-1&&t<l)break;l<0&&(l=r-o),i.push(e,t,r),h++,f.next()}}if(h){let t=new Uint16Array(4*h),o=i[i.length-2];for(let e=i.length-3,r=0;e>=0;e-=3)t[r++]=i[e],t[r++]=i[e+1]-o,t[r++]=i[e+2]-o,t[r++]=r;r.push(new d(t,i[2]-o,s)),n.push(o-e)}}function x(e,t){return(r,i,s)=>{let o,h,l=0,f=r.length-1;if(f>=0&&(o=r[f])instanceof a){if(!f&&o.type==e&&o.length==s)return o;(h=o.prop(n.lookAhead))&&(l=i[f]+o.length+h)}return v(e,r,i,s,l,t)}}function w(e,t,r,n,i,o,h,l,f){let u=[],a=[];for(;e.length>n;)u.push(e.pop()),a.push(t.pop()+r-i);e.push(v(s.types[h],u,a,o-i,l-o,f)),t.push(i-r)}function v(e,t,r,i,s,o,h){if(o){let e=[n.contextHash,o];h=h?[e].concat(h):[e]}if(s>25){let e=[n.lookAhead,s];h=h?[e].concat(h):[e]}return new a(e,t,r,i,h)}function _(e,t){let r=f.fork(),n=0,i=0,s=0,h=r.end-o,u={size:0,start:0,skip:0};e:for(let o=r.pos-e;r.pos>o;){let e=r.size;if(r.id==t&&e>=0){u.size=n,u.start=i,u.skip=s,s+=4,n+=4,r.next();continue}let f=r.pos-e;if(e<0||f<o||r.start<h)break;let a=r.id>=l?4:0,p=r.start;for(r.next();r.pos>f;){if(r.size<0){if(-3!=r.size&&-4!=r.size)break e;a+=4}else r.id>=l&&(a+=4);r.next()}i=p,n+=e,s+=a}return(t<0||n==e)&&(u.size=n,u.start=i,u.skip=s),u.size>4?u:void 0}function k(e,t,r){let{id:n,start:i,end:s,size:o}=f;if(f.next(),o>=0&&n<l){let h=r;if(o>4){let n=f.pos-(o-4);for(;f.pos>n;)r=k(e,t,r)}t[--r]=h,t[--r]=s-e,t[--r]=i-e,t[--r]=n}else-3==o?c=n:-4==o&&(m=n);return r}let A=[],C=[];for(;f.pos>0;)b(t.start||0,t.bufferStart||0,A,C,-1,0);let S=null!==(r=t.length)&&void 0!==r?r:A.length?C[0]+A[0].length:0;return new a(u[t.topID],A.reverse(),C.reverse(),S)}const B=new WeakMap;function P(e,t){if(!e.isAnonymous||t instanceof d||t.type!=e)return 1;let r=B.get(t);if(null==r){r=1;for(let n of t.children){if(n.type!=e||!(n instanceof a)){r=1;break}r+=P(e,n)}B.set(t,r)}return r}function O(e,t,r,n,i,s,o,h,l){let f=0;for(let r=n;r<i;r++)f+=P(e,t[r]);let u=Math.ceil(1.5*f/8),a=[],p=[];return(function t(r,n,i,o,h){for(let f=i;f<o;){let i=f,d=n[f],c=P(e,r[f]);for(f++;f<o;f++){let t=P(e,r[f]);if(c+t>=u)break;c+=t}if(f==i+1){if(c>u){let e=r[i];t(e.children,e.positions,0,e.children.length,n[i]+h);continue}a.push(r[i])}else{let t=n[f-1]+r[f-1].length-d;a.push(O(e,r,n,i,f,d,t,null,l))}p.push(d+h-s)}})(t,r,n,i,0),(h||l)(a,p,o)}class T{constructor(){this.map=new WeakMap}setBuffer(e,t,r){let n=this.map.get(e);n||this.map.set(e,n=new Map),n.set(t,r)}getBuffer(e,t){let r=this.map.get(e);return r&&r.get(t)}set(e,t){e instanceof _?this.setBuffer(e.context.buffer,e.index,t):e instanceof y&&this.map.set(e.tree,t)}get(e){return e instanceof _?this.getBuffer(e.context.buffer,e.index):e instanceof y?this.map.get(e.tree):void 0}cursorSet(e,t){e.buffer?this.setBuffer(e.buffer.buffer,e.index,t):this.map.set(e.tree,t)}cursorGet(e){return e.buffer?this.getBuffer(e.buffer.buffer,e.index):this.map.get(e.tree)}}class M{constructor(e,t,r,n,i=!1,s=!1){this.from=e,this.to=t,this.tree=r,this.offset=n,this.open=(i?1:0)|(s?2:0)}get openStart(){return(1&this.open)>0}get openEnd(){return(2&this.open)>0}static addTree(e,t=[],r=!1){let n=[new M(0,e.length,e,0,!1,r)];for(let r of t)r.to>e.length&&n.push(r);return n}static applyChanges(e,t,r=128){if(!t.length)return e;let n=[],i=1,s=e.length?e[0]:null;for(let o=0,h=0,l=0;;o++){let f=o<t.length?t[o]:null,u=f?f.fromA:1e9;if(u-h>=r)for(;s&&s.from<u;){let t=s;if(h>=t.from||u<=t.to||l){let e=Math.max(t.from,h)-l,r=Math.min(t.to,u)-l;t=e>=r?null:new M(e,r,t.tree,t.offset+l,o>0,!!f)}if(t&&n.push(t),s.to>u)break;s=i<e.length?e[i++]:null}if(!f)break;h=f.toA,l=f.toA-f.toB}return n}}class E{startParse(e,t,n){return"string"==typeof e&&(e=new j(e)),n=n?n.length?n.map(e=>new r(e.from,e.to)):[new r(0,0)]:[new r(0,e.length)],this.createParse(e,t||[],n)}parse(e,t,r){let n=this.startParse(e,t,r);for(;;){let e=n.advance();if(e)return e}}}class j{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)}}function z(e){return(t,r,n,i)=>new U(t,e,r,n,i)}class F{constructor(e,t,r,n,i,s){this.parser=e,this.parse=t,this.overlay=r,this.bracketed=n,this.target=i,this.from=s}}function D(e){if(!e.length||e.some(e=>e.from>=e.to))throw new RangeError("Invalid inner parse ranges given: "+JSON.stringify(e))}class R{constructor(e,t,r,n,i,s,o,h){this.parser=e,this.predicate=t,this.mounts=r,this.index=n,this.start=i,this.bracketed=s,this.target=o,this.prev=h,this.depth=0,this.ranges=[]}}const W=new n({perNode:!0});class U{constructor(e,t,r,n,i){this.nest=t,this.input=r,this.fragments=n,this.ranges=i,this.inner=[],this.innerDone=0,this.baseTree=null,this.stoppedAt=null,this.baseParse=e}advance(){if(this.baseParse){let e=this.baseParse.advance();if(!e)return null;if(this.baseParse=null,this.baseTree=e,this.startInner(),null!=this.stoppedAt)for(let e of this.inner)e.parse.stopAt(this.stoppedAt)}if(this.innerDone==this.inner.length){let e=this.baseTree;return null!=this.stoppedAt&&(e=new a(e.type,e.children,e.positions,e.length,e.propValues.concat([[W,this.stoppedAt]]))),e}let e=this.inner[this.innerDone],t=e.parse.advance();if(t){this.innerDone++;let r=Object.assign(Object.create(null),e.target.props);r[n.mounted.id]=new i(t,e.overlay,e.parser,e.bracketed),e.target.props=r}return null}get parsedPos(){if(this.baseParse)return 0;let e=this.input.length;for(let t=this.innerDone;t<this.inner.length;t++)this.inner[t].from<e&&(e=Math.min(e,this.inner[t].parse.parsedPos));return e}stopAt(e){if(this.stoppedAt=e,this.baseParse)this.baseParse.stopAt(e);else for(let t=this.innerDone;t<this.inner.length;t++)this.inner[t].parse.stopAt(e)}startInner(){let e=new G(this.fragments),t=null,n=null,i=new S(new y(this.baseTree,this.ranges[0].from,0,null),u.IncludeAnonymous|u.IgnoreMounts);e:for(let s,o;;){let h,l=!0;if(null!=this.stoppedAt&&i.from>=this.stoppedAt)l=!1;else if(e.hasNode(i)){if(t){let e=t.mounts.find(e=>e.frag.from<=i.from&&e.frag.to>=i.to&&e.mount.overlay);if(e)for(let r of e.mount.overlay){let n=r.from+e.pos,s=r.to+e.pos;n>=i.from&&s<=i.to&&!t.ranges.some(e=>e.from<s&&e.to>n)&&t.ranges.push({from:n,to:s})}}l=!1}else if(n&&(o=L(n.ranges,i.from,i.to)))l=2!=o;else if(!i.type.isAnonymous&&(s=this.nest(i,this.input))&&(i.from<i.to||!s.overlay)){i.tree||(V(i),t&&t.depth++,n&&n.depth++);let o=e.findMounts(i.from,s.parser);if("function"==typeof s.overlay)t=new R(s.parser,s.overlay,o,this.inner.length,i.from,!!s.bracketed,i.tree,t);else{let e=$(this.ranges,s.overlay||(i.from<i.to?[new r(i.from,i.to)]:[]));e.length&&D(e),!e.length&&s.overlay||this.inner.push(new F(s.parser,e.length?s.parser.startParse(this.input,K(o,e),e):s.parser.startParse(""),s.overlay?s.overlay.map(e=>new r(e.from-i.from,e.to-i.from)):null,!!s.bracketed,i.tree,e.length?e[0].from:i.from)),s.overlay?e.length&&(n={ranges:e,depth:0,prev:n}):l=!1}}else if(t&&(h=t.predicate(i))&&(!0===h&&(h=new r(i.from,i.to)),h.from<h.to)){let e=t.ranges.length-1;e>=0&&t.ranges[e].to==h.from?t.ranges[e]={from:t.ranges[e].from,to:h.to}:t.ranges.push(h)}if(l&&i.firstChild())t&&t.depth++,n&&n.depth++;else for(;!i.nextSibling();){if(!i.parent())break e;if(t&&! --t.depth){let e=$(this.ranges,t.ranges);e.length&&(D(e),this.inner.splice(t.index,0,new F(t.parser,t.parser.startParse(this.input,K(t.mounts,e),e),t.ranges.map(e=>new r(e.from-t.start,e.to-t.start)),t.bracketed,t.target,e[0].from))),t=t.prev}n&&! --n.depth&&(n=n.prev)}}}}function L(e,t,r){for(let n of e){if(n.from>=r)break;if(n.to>t)return n.from<=t&&n.to>=r?2:1}return 0}function J(e,t,r,n,i,s){if(t<r){let o=e.buffer[t+1];n.push(e.slice(t,r,o)),i.push(o-s)}}function V(e){let{node:t}=e,r=[],n=t.context.buffer;do{r.push(e.index),e.parent()}while(!e.tree);let i=e.tree,s=i.children.indexOf(n),h=i.children[s],l=h.buffer,f=[s];i.children[s]=(function e(n,i,s,o,u,p){let d=r[p],c=[],m=[];J(h,n,d,c,m,o);let b=l[d+1],y=l[d+2];f.push(c.length);let x=p?e(d+4,l[d+3],h.set.types[l[d]],b,y-b,p-1):t.toTree();return c.push(x),m.push(b-o),J(h,l[d+3],i,c,m,o),new a(s,c,m,u)})(0,l.length,o.none,0,h.length,r.length-1);for(let t of f){let r=e.tree.children[t],n=e.tree.positions[t];e.yield(new y(r,n+e.from,t,e._tree))}}class H{constructor(e,t){this.offset=t,this.done=!1,this.cursor=e.cursor(u.IncludeAnonymous|u.IgnoreMounts)}moveTo(e){let{cursor:t}=this,r=e-this.offset;for(;!this.done&&t.from<r;)if(t.to>=e&&t.enter(r,1,u.IgnoreOverlays|u.ExcludeBuffers));else{if(!(t.to<=e))break;t.next(!1)||(this.done=!0)}}hasNode(e){if(this.moveTo(e.from),!this.done&&this.cursor.from+this.offset==e.from&&this.cursor.tree)for(let t=this.cursor.tree;;){if(t==e.tree)return!0;if(!(t.children.length&&0==t.positions[0]&&t.children[0]instanceof a))break;t=t.children[0]}return!1}}class G{constructor(e){var t;if(this.fragments=e,this.curTo=0,this.fragI=0,e.length){let r=this.curFrag=e[0];this.curTo=null!==(t=r.tree.prop(W))&&void 0!==t?t:r.to,this.inner=new H(r.tree,-r.offset)}else this.curFrag=this.inner=null}hasNode(e){for(;this.curFrag&&e.from>=this.curTo;)this.nextFrag();return this.curFrag&&this.curFrag.from<=e.from&&this.curTo>=e.to&&this.inner.hasNode(e)}nextFrag(){var e;if(this.fragI++,this.fragI==this.fragments.length)this.curFrag=this.inner=null;else{let t=this.curFrag=this.fragments[this.fragI];this.curTo=null!==(e=t.tree.prop(W))&&void 0!==e?e:t.to,this.inner=new H(t.tree,-t.offset)}}findMounts(e,t){var r;let i=[];if(this.inner){this.inner.cursor.moveTo(e,1);for(let e=this.inner.cursor.node;e;e=e.parent){let s=null===(r=e.tree)||void 0===r?void 0:r.prop(n.mounted);if(s&&s.parser==t)for(let t=this.fragI;t<this.fragments.length;t++){let r=this.fragments[t];if(r.from>=e.to)break;r.tree==this.curFrag.tree&&i.push({frag:r,pos:e.from-r.offset,mount:s})}}}return i}}function $(e,t){let n=null,i=t;for(let s=1,o=0;s<e.length;s++){let h=e[s-1].to,l=e[s].from;for(;o<i.length;o++){let e=i[o];if(e.from>=l)break;e.to<=h||(n||(i=n=t.slice()),e.from<h?(n[o]=new r(e.from,h),e.to>l&&n.splice(o+1,0,new r(l,e.to))):e.to>l?n[o--]=new r(l,e.to):n.splice(o--,1))}}return i}function q(e,t,n,i){let s=0,o=0,h=!1,l=!1,f=-1e9,u=[];for(;;){let a=s==e.length?1e9:h?e[s].to:e[s].from,p=o==t.length?1e9:l?t[o].to:t[o].from;if(h!=l){let e=Math.max(f,n),t=Math.min(a,p,i);e<t&&u.push(new r(e,t))}if(f=Math.min(a,p),1e9==f)break;a==f&&(h?(h=!1,s++):h=!0),p==f&&(l?(l=!1,o++):l=!0)}return u}function K(e,t){let n=[];for(let{pos:i,mount:s,frag:o}of e){let e=i+(s.overlay?s.overlay[0].from:0),h=e+s.tree.length,l=Math.max(o.from,e),f=Math.min(o.to,h);if(s.overlay){let h=q(t,s.overlay.map(e=>new r(e.from+i,e.to+i)),l,f);for(let t=0,r=l;;t++){let i=t==h.length,l=i?f:h[t].from;if(l>r&&n.push(new M(r,l,s.tree,-e,o.from>=r||o.openStart,o.to<=l||o.openEnd)),i)break;r=h[t].to}}else n.push(new M(l,f,s.tree,-e,o.from>=e||o.openStart,o.to<=h||o.openEnd))}return n}},1014,[]);
|
|
1112
|
+
__d(function(g,_r,_i,_a2,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"DefaultBufferLength",{enumerable:!0,get:function(){return e}}),Object.defineProperty(_e,"IterMode",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"MountedTree",{enumerable:!0,get:function(){return i}}),Object.defineProperty(_e,"NodeProp",{enumerable:!0,get:function(){return n}}),Object.defineProperty(_e,"NodeSet",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"NodeType",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"NodeWeakMap",{enumerable:!0,get:function(){return M}}),Object.defineProperty(_e,"Parser",{enumerable:!0,get:function(){return E}}),Object.defineProperty(_e,"Tree",{enumerable:!0,get:function(){return a}}),Object.defineProperty(_e,"TreeBuffer",{enumerable:!0,get:function(){return d}}),Object.defineProperty(_e,"TreeCursor",{enumerable:!0,get:function(){return S}}),Object.defineProperty(_e,"TreeFragment",{enumerable:!0,get:function(){return T}}),Object.defineProperty(_e,"parseMixed",{enumerable:!0,get:function(){return j}});const e=1024;let t=0;class r{constructor(e,t){this.from=e,this.to=t}}class n{constructor(e={}){this.id=t++,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"function"!=typeof e&&(e=o.match(e)),t=>{let r=e(t);return void 0===r?null:[this,r]}}}n.closedBy=new n({deserialize:e=>e.split(" ")}),n.openedBy=new n({deserialize:e=>e.split(" ")}),n.group=new n({deserialize:e=>e.split(" ")}),n.isolate=new n({deserialize:e=>{if(e&&"rtl"!=e&&"ltr"!=e&&"auto"!=e)throw new RangeError("Invalid value for isolate: "+e);return e||"auto"}}),n.contextHash=new n({perNode:!0}),n.lookAhead=new n({perNode:!0}),n.mounted=new n({perNode:!0});class i{constructor(e,t,r,n=!1){this.tree=e,this.overlay=t,this.parser=r,this.bracketed=n}static get(e){return e&&e.props&&e.props[n.mounted.id]}}const s=Object.create(null);class o{constructor(e,t,r,n=0){this.name=e,this.props=t,this.id=r,this.flags=n}static define(e){let t=e.props&&e.props.length?Object.create(null):s,r=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(null==e.name?8:0),n=new o(e.name||"",t,e.id,r);if(e.props)for(let r of e.props)if(Array.isArray(r)||(r=r(n)),r){if(r[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");t[r[0].id]=r[1]}return n}prop(e){return this.props[e.id]}get isTop(){return(1&this.flags)>0}get isSkipped(){return(2&this.flags)>0}get isError(){return(4&this.flags)>0}get isAnonymous(){return(8&this.flags)>0}is(e){if('string'==typeof e){if(this.name==e)return!0;let t=this.prop(n.group);return!!t&&t.indexOf(e)>-1}return this.id==e}static match(e){let t=Object.create(null);for(let r in e)for(let n of r.split(" "))t[n]=e[r];return e=>{for(let r=e.prop(n.group),i=-1;i<(r?r.length:0);i++){let n=t[i<0?e.name:r[i]];if(n)return n}}}}o.none=new o("",Object.create(null),0,8);class h{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 r of this.types){let n=null;for(let t of e){let e=t(r);if(e){n||(n=Object.assign({},r.props));let t=e[1],i=e[0];i.combine&&i.id in n&&(t=i.combine(n[i.id],t)),n[i.id]=t}}t.push(n?new o(r.name,n,r.id,r.flags):r)}return new h(t)}}const f=new WeakMap,l=new WeakMap;var u;!(function(e){e[e.ExcludeBuffers=1]="ExcludeBuffers",e[e.IncludeAnonymous=2]="IncludeAnonymous",e[e.IgnoreMounts=4]="IgnoreMounts",e[e.IgnoreOverlays=8]="IgnoreOverlays",e[e.EnterBracketed=16]="EnterBracketed"})(u||(u={}));class a{constructor(e,t,r,n,i){if(this.type=e,this.children=t,this.positions=r,this.length=n,this.props=null,i&&i.length){this.props=Object.create(null);for(let[e,t]of i)this.props["number"==typeof e?e:e.id]=t}}toString(){let e=i.get(this);if(e&&!e.overlay)return e.tree.toString();let t="";for(let e of this.children){let r=e.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 S(this.topNode,e)}cursorAt(e,t=0,r=0){let n=f.get(this)||this.topNode,i=new S(n);return i.moveTo(e,t),f.set(this,i._tree),i}get topNode(){return new y(this,0,0,null)}resolve(e,t=0){let r=m(f.get(this)||this.topNode,e,t,!1);return f.set(this,r),r}resolveInner(e,t=0){let r=m(l.get(this)||this.topNode,e,t,!0);return l.set(this,r),r}resolveStack(e,t=0){return C(this,e,t)}iterate(e){let{enter:t,leave:r,from:n=0,to:i=this.length}=e,s=e.mode||0,o=(s&u.IncludeAnonymous)>0;for(let e=this.cursor(s|u.IncludeAnonymous);;){let s=!1;if(e.from<=i&&e.to>=n&&(!o&&e.type.isAnonymous||!1!==t(e))){if(e.firstChild())continue;s=!0}for(;s&&r&&(o||!e.type.isAnonymous)&&r(e),!e.nextSibling();){if(!e.parent())return;s=!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:O(o.none,this.children,this.positions,0,this.children.length,0,this.length,(e,t,r)=>new a(this.type,e,t,r,this.propValues),e.makeTree||((e,t,r)=>new a(o.none,e,t,r)))}static build(e){return N(e)}}a.empty=new a(o.none,[],[],0);class p{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 p(this.buffer,this.index)}}class d{constructor(e,t,r){this.buffer=e,this.length=t,this.set=r}get type(){return o.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],r=this.buffer[e+3],n=this.set.types[t],i=n.name;if(/\W/.test(i)&&!n.isError&&(i=JSON.stringify(i)),r==(e+=4))return i;let s=[];for(;e<r;)s.push(this.childString(e)),e=this.buffer[e+3];return i+"("+s.join(",")+")"}findChild(e,t,r,n,i){let{buffer:s}=this,o=-1;for(let h=e;h!=t&&!(c(i,n,s[h+1],s[h+2])&&(o=h,r>0));h=s[h+3]);return o}slice(e,t,r){let n=this.buffer,i=new Uint16Array(t-e),s=0;for(let o=e,h=0;o<t;){i[h++]=n[o++],i[h++]=n[o++]-r;let t=i[h++]=n[o++]-r;i[h++]=n[o++]-e,s=Math.max(s,t)}return new d(i,s,this.set)}}function c(e,t,r,n){switch(e){case-2:return r<t;case-1:return n>=t&&r<t;case 0:return r<t&&n>t;case 1:return r<=t&&n>t;case 2:return n>t;case 4:return!0}}function m(e,t,r,n){for(var i;e.from==e.to||(r<1?e.from>=t:e.from>t)||(r>-1?e.to<=t:e.to<t);){let t=!n&&e instanceof y&&e.index<0?null:e.parent;if(!t)return e;e=t}let s=n?0:u.IgnoreOverlays;if(n)for(let n=e,o=n.parent;o;n=o,o=n.parent)n instanceof y&&n.index<0&&(null===(i=o.enter(t,r,s))||void 0===i?void 0:i.from)!=n.from&&(e=o);for(;;){let n=e.enter(t,r,s);if(!n)return e;e=n}}class b{cursor(e=0){return new S(this,e)}getChild(e,t=null,r=null){let n=x(this,e,t,r);return n.length?n[0]:null}getChildren(e,t=null,r=null){return x(this,e,t,r)}resolve(e,t=0){return m(this,e,t,!1)}resolveInner(e,t=0){return m(this,e,t,!0)}matchContext(e){return w(this.parent,e)}enterUnfinishedNodesBefore(e){let t=this.childBefore(e),r=this;for(;t;){let e=t.lastChild;if(!e||e.to!=t.to)break;e.type.isError&&e.from==e.to?(r=t,t=e.prevSibling):t=e}return r}get node(){return this}get next(){return this.parent}}class y extends b{constructor(e,t,r,n){super(),this._tree=e,this.from=t,this.index=r,this._parent=n}get type(){return this._tree.type}get name(){return this._tree.type.name}get to(){return this.from+this._tree.length}nextChild(e,t,r,n,s=0){for(let o=this;;){for(let{children:h,positions:f}=o._tree,l=t>0?h.length:-1;e!=l;e+=t){let l,p=h[e],m=f[e]+o.from;if(s&u.EnterBracketed&&p instanceof a&&(l=i.get(p))&&!l.overlay&&l.bracketed&&r>=m&&r<=m+p.length||c(n,r,m,m+p.length))if(p instanceof d){if(s&u.ExcludeBuffers)continue;let i=p.findChild(0,p.buffer.length,t,r-m,n);if(i>-1)return new _(new v(o,p,e,m),null,i)}else if(s&u.IncludeAnonymous||!p.type.isAnonymous||I(p)){let h;if(!(s&u.IgnoreMounts)&&(h=i.get(p))&&!h.overlay)return new y(h.tree,m,e,o);let f=new y(p,m,e,o);return s&u.IncludeAnonymous||!f.type.isAnonymous?f:f.nextChild(t<0?p.children.length-1:0,t,r,n,s)}}if(s&u.IncludeAnonymous||!o.type.isAnonymous)return null;if(e=o.index>=0?o.index+t: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,r=0){let n;if(!(r&u.IgnoreOverlays)&&(n=i.get(this._tree))&&n.overlay){let i=e-this.from,s=r&u.EnterBracketed&&n.bracketed;for(let{from:e,to:r}of n.overlay)if((t>0||s?e<=i:e<i)&&(t<0||s?r>=i:r>i))return new y(n.tree,n.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,e,t,r)}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 x(e,t,r,n){let i=e.cursor(),s=[];if(!i.firstChild())return s;if(null!=r)for(let e=!1;!e;)if(e=i.type.is(r),!i.nextSibling())return s;for(;;){if(null!=n&&i.type.is(n))return s;if(i.type.is(t)&&s.push(i.node),!i.nextSibling())return null==n?s:[]}}function w(e,t,r=t.length-1){for(let n=e;r>=0;n=n.parent){if(!n)return!1;if(!n.type.isAnonymous){if(t[r]&&t[r]!=n.name)return!1;r--}}return!0}class v{constructor(e,t,r,n){this.parent=e,this.buffer=t,this.index=r,this.start=n}}class _ extends b{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,r){super(),this.context=e,this._parent=t,this.index=r,this.type=e.buffer.set.types[e.buffer.buffer[r]]}child(e,t,r){let{buffer:n}=this.context,i=n.findChild(this.index+4,n.buffer[this.index+3],e,t-this.context.start,r);return i<0?null:new _(this.context,this,i)}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,r=0){if(r&u.ExcludeBuffers)return null;let{buffer:n}=this.context,i=n.findChild(this.index+4,n.buffer[this.index+3],t>0?1:-1,e-this.context.start,t);return i<0?null:new _(this.context,this,i)}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 _(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 _(this.context,this._parent,e.findChild(t,this.index,-1,0,4))}get tree(){return null}toTree(){let e=[],t=[],{buffer:r}=this.context,n=this.index+4,i=r.buffer[this.index+3];if(i>n){let s=r.buffer[this.index+1];e.push(r.slice(n,i,s)),t.push(0)}return new a(this.type,e,t,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function k(e){if(!e.length)return null;let t=0,r=e[0];for(let n=1;n<e.length;n++){let i=e[n];(i.from>r.from||i.to<r.to)&&(r=i,t=n)}let n=r instanceof y&&r.index<0?null:r.parent,i=e.slice();return n?i[t]=n:i.splice(t,1),new A(i,r)}class A{constructor(e,t){this.heads=e,this.node=t}get next(){return k(this.heads)}}function C(e,t,r){let n=e.resolveInner(t,r),s=null;for(let e=n instanceof y?n:n.context.parent;e;e=e.parent)if(e.index<0){let i=e.parent;(s||(s=[n])).push(i.resolve(t,r)),e=i}else{let o=i.get(e.tree);if(o&&o.overlay&&o.overlay[0].from<=t&&o.overlay[o.overlay.length-1].to>=t){let i=new y(o.tree,o.overlay[0].from+e.from,-1,e);(s||(s=[n])).push(m(i,t,r,!1))}}return s?k(s):n}class S{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&~u.EnterBracketed,e instanceof y)this.yieldNode(e);else{this._tree=e.context.parent,this.buffer=e.context;for(let t=e._parent;t;t=t._parent)this.stack.unshift(t.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)}yieldBuf(e,t){this.index=e;let{start:r,buffer:n}=this.buffer;return this.type=t||n.set.types[n.buffer[e]],this.from=r+n.buffer[e+1],this.to=r+n.buffer[e+2],!0}yield(e){return!!e&&(e instanceof y?(this.buffer=null,this.yieldNode(e)):(this.buffer=e.context,this.yieldBuf(e.index,e.type)))}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(e,t,r){if(!this.buffer)return this.yield(this._tree.nextChild(e<0?this._tree._tree.children.length-1:0,e,t,r,this.mode));let{buffer:n}=this.buffer,i=n.findChild(this.index+4,n.buffer[this.index+3],e,t-this.buffer.start,r);return!(i<0)&&(this.stack.push(this.index),this.yieldBuf(i))}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,r=this.mode){return this.buffer?!(r&u.ExcludeBuffers)&&this.enterChild(1,e,t):this.yield(this._tree.enter(e,t,r))}parent(){if(!this.buffer)return this.yieldNode(this.mode&u.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&u.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));let{buffer:t}=this.buffer,r=this.stack.length-1;if(e<0){let e=r<0?0:this.stack[r]+4;if(this.index!=e)return this.yieldBuf(t.findChild(e,this.index,-1,0,4))}else{let e=t.buffer[this.index+3];if(e<(r<0?t.buffer.length:t.buffer[this.stack[r]+3]))return this.yieldBuf(e)}return r<0&&this.yield(this.buffer.parent.nextChild(this.buffer.index+e,e,0,4,this.mode))}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(e){let t,r,{buffer:n}=this;if(n){if(e>0){if(this.index<n.buffer.buffer.length)return!1}else for(let e=0;e<this.index;e++)if(n.buffer.buffer[e+3]<this.index)return!1;({index:t,parent:r}=n)}else({index:t,_parent:r}=this._tree);for(;r;({index:t,_parent:r}=r))if(t>-1)for(let n=t+e,i=e<0?-1:r._tree.children.length;n!=i;n+=e){let e=r._tree.children[n];if(this.mode&u.IncludeAnonymous||e instanceof d||!e.type.isAnonymous||I(e))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,r=0;if(e&&e.context==this.buffer)e:for(let n=this.index,i=this.stack.length;i>=0;){for(let s=e;s;s=s._parent)if(s.index==n){if(n==this.index)return s;t=s,r=i+1;break e}n=this.stack[--i]}for(let e=r;e<this.stack.length;e++)t=new _(this.buffer,t,this.stack[e]);return this.bufferNode=new _(this.buffer,t,this.index)}get tree(){return this.buffer?null:this._tree._tree}iterate(e,t){for(let r=0;;){let n=!1;if(this.type.isAnonymous||!1!==e(this)){if(this.firstChild()){r++;continue}this.type.isAnonymous||(n=!0)}for(;;){if(n&&t&&t(this),n=this.type.isAnonymous,!r)return;if(this.nextSibling())break;this.parent(),r--,n=!0}}}matchContext(e){if(!this.buffer)return w(this.node.parent,e);let{buffer:t}=this.buffer,{types:r}=t.set;for(let n=e.length-1,i=this.stack.length-1;n>=0;i--){if(i<0)return w(this._tree,e,n);let s=r[t.buffer[this.stack[i]]];if(!s.isAnonymous){if(e[n]&&e[n]!=s.name)return!1;n--}}return!0}}function I(e){return e.children.some(e=>e instanceof d||!e.type.isAnonymous||I(e))}function N(t){var r;let{buffer:i,nodeSet:s,maxBufferLength:o=e,reused:h=[],minRepeatType:f=s.types.length}=t,l=Array.isArray(i)?new p(i,i.length):i,u=s.types,c=0,m=0;function b(e,t,r,n,i,a){let{id:p,start:A,end:C,size:S}=l,I=m,N=c;if(S<0){if(l.next(),-1==S){let t=h[p];return r.push(t),void n.push(A-e)}if(-3==S)return void(c=p);if(-4==S)return void(m=p);throw new RangeError(`Unrecognized record size: ${S}`)}let B,P,M=u[p],T=A-e;if(C-A<=o&&(P=_(l.pos-t,i))){let t=new Uint16Array(P.size-P.skip),r=l.pos-P.size,n=t.length;for(;l.pos>r;)n=k(P.start,t,n);B=new d(t,C-P.start,s),T=P.start-e}else{let e=l.pos-S;l.next();let t=[],r=[],n=p>=f?p:-1,i=0,u=C,d=I;for(;l.pos>e;)n>=0&&l.id==n&&l.size>=0?(l.end<=u-o&&(w(t,r,A,i,l.end,u,n,d,N),i=t.length,u=l.end,d=m),l.next()):a>2500?y(A,e,t,r):(n>=0&&-1==l.size&&h[l.id].type==s.types[n]&&(i<t.length&&w(t,r,A,i,l.end,u,n,d,N),i=t.length+1,u=l.start,d=m),b(A,e,t,r,n,a+1));if(n>=0&&i>0&&i<t.length&&w(t,r,A,i,A,u,n,d,N),t.reverse(),r.reverse(),n>-1&&i>0){let e=x(M,N);B=O(M,t,r,0,t.length,0,C-A,e,e)}else B=v(M,t,r,C-A,I-C,N)}r.push(B),n.push(T)}function y(e,t,r,n){let i=[],h=0,f=-1;for(;l.pos>t;){let{id:e,start:t,end:r,size:n}=l;if(n>4)l.next();else{if(f>-1&&t<f)break;f<0&&(f=r-o),i.push(e,t,r),h++,l.next()}}if(h){let t=new Uint16Array(4*h),o=i[i.length-2];for(let e=i.length-3,r=0;e>=0;e-=3)t[r++]=i[e],t[r++]=i[e+1]-o,t[r++]=i[e+2]-o,t[r++]=r;r.push(new d(t,i[2]-o,s)),n.push(o-e)}}function x(e,t){return(r,i,s)=>{let o,h,f=0,l=r.length-1;if(l>=0&&(o=r[l])instanceof a){if(!l&&o.type==e&&o.length==s)return o;(h=o.prop(n.lookAhead))&&(f=i[l]+o.length+h-s)}return v(e,r,i,s,f,t)}}function w(e,t,r,n,i,o,h,f,l){let u=[],a=[];for(;e.length>n;)u.push(e.pop()),a.push(t.pop()+r-i);e.push(v(s.types[h],u,a,o-i,f-o,l)),t.push(i-r)}function v(e,t,r,i,s,o,h){if(o){let e=[n.contextHash,o];h=h?[e].concat(h):[e]}if(s>25){let e=[n.lookAhead,s];h=h?[e].concat(h):[e]}return new a(e,t,r,i,h)}function _(e,t){let r=l.fork(),n=0,i=0,s=0,h=r.end-o,u={size:0,start:0,skip:0};e:for(let o=r.pos-e;r.pos>o;){let e=r.size;if(r.id==t&&e>=0){u.size=n,u.start=i,u.skip=s,s+=4,n+=4,r.next();continue}let l=r.pos-e;if(e<0||l<o||r.start<h)break;let a=r.id>=f?4:0,p=r.start;for(r.next();r.pos>l;){if(r.size<0){if(-3!=r.size&&-4!=r.size)break e;a+=4}else r.id>=f&&(a+=4);r.next()}i=p,n+=e,s+=a}return(t<0||n==e)&&(u.size=n,u.start=i,u.skip=s),u.size>4?u:void 0}function k(e,t,r){let{id:n,start:i,end:s,size:o}=l;if(l.next(),o>=0&&n<f){let h=r;if(o>4){let n=l.pos-(o-4);for(;l.pos>n;)r=k(e,t,r)}t[--r]=h,t[--r]=s-e,t[--r]=i-e,t[--r]=n}else-3==o?c=n:-4==o&&(m=n);return r}let A=[],C=[];for(;l.pos>0;)b(t.start||0,t.bufferStart||0,A,C,-1,0);let S=null!==(r=t.length)&&void 0!==r?r:A.length?C[0]+A[0].length:0;return new a(u[t.topID],A.reverse(),C.reverse(),S)}const B=new WeakMap;function P(e,t){if(!e.isAnonymous||t instanceof d||t.type!=e)return 1;let r=B.get(t);if(null==r){r=1;for(let n of t.children){if(n.type!=e||!(n instanceof a)){r=1;break}r+=P(e,n)}B.set(t,r)}return r}function O(e,t,r,n,i,s,o,h,f){let l=0;for(let r=n;r<i;r++)l+=P(e,t[r]);let u=Math.ceil(1.5*l/8),a=[],p=[];return(function t(r,n,i,o,h){for(let l=i;l<o;){let i=l,d=n[l],c=P(e,r[l]);for(l++;l<o;l++){let t=P(e,r[l]);if(c+t>=u)break;c+=t}if(l==i+1){if(c>u){let e=r[i];t(e.children,e.positions,0,e.children.length,n[i]+h);continue}a.push(r[i])}else{let t=n[l-1]+r[l-1].length-d;a.push(O(e,r,n,i,l,d,t,null,f))}p.push(d+h-s)}})(t,r,n,i,0),(h||f)(a,p,o)}class M{constructor(){this.map=new WeakMap}setBuffer(e,t,r){let n=this.map.get(e);n||this.map.set(e,n=new Map),n.set(t,r)}getBuffer(e,t){let r=this.map.get(e);return r&&r.get(t)}set(e,t){e instanceof _?this.setBuffer(e.context.buffer,e.index,t):e instanceof y&&this.map.set(e.tree,t)}get(e){return e instanceof _?this.getBuffer(e.context.buffer,e.index):e instanceof y?this.map.get(e.tree):void 0}cursorSet(e,t){e.buffer?this.setBuffer(e.buffer.buffer,e.index,t):this.map.set(e.tree,t)}cursorGet(e){return e.buffer?this.getBuffer(e.buffer.buffer,e.index):this.map.get(e.tree)}}class T{constructor(e,t,r,n,i=!1,s=!1){this.from=e,this.to=t,this.tree=r,this.offset=n,this.open=(i?1:0)|(s?2:0)}get openStart(){return(1&this.open)>0}get openEnd(){return(2&this.open)>0}static addTree(e,t=[],r=!1){let n=[new T(0,e.length,e,0,!1,r)];for(let r of t)r.to>e.length&&n.push(r);return n}static applyChanges(e,t,r=128){if(!t.length)return e;let n=[],i=1,s=e.length?e[0]:null;for(let o=0,h=0,f=0;;o++){let l=o<t.length?t[o]:null,u=l?l.fromA:1e9;if(u-h>=r)for(;s&&s.from<u;){let t=s;if(h>=t.from||u<=t.to||f){let e=Math.max(t.from,h)-f,r=Math.min(t.to,u)-f;t=e>=r?null:new T(e,r,t.tree,t.offset+f,o>0,!!l)}if(t&&n.push(t),s.to>u)break;s=i<e.length?e[i++]:null}if(!l)break;h=l.toA,f=l.toA-l.toB}return n}}class E{startParse(e,t,n){return"string"==typeof e&&(e=new z(e)),n=n?n.length?n.map(e=>new r(e.from,e.to)):[new r(0,0)]:[new r(0,e.length)],this.createParse(e,t||[],n)}parse(e,t,r){let n=this.startParse(e,t,r);for(;;){let e=n.advance();if(e)return e}}}class z{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)}}function j(e){return(t,r,n,i)=>new U(t,e,r,n,i)}class F{constructor(e,t,r,n,i,s){this.parser=e,this.parse=t,this.overlay=r,this.bracketed=n,this.target=i,this.from=s}}function D(e){if(!e.length||e.some(e=>e.from>=e.to))throw new RangeError("Invalid inner parse ranges given: "+JSON.stringify(e))}class R{constructor(e,t,r,n,i,s,o,h){this.parser=e,this.predicate=t,this.mounts=r,this.index=n,this.start=i,this.bracketed=s,this.target=o,this.prev=h,this.depth=0,this.ranges=[]}}const W=new n({perNode:!0});class U{constructor(e,t,r,n,i){this.nest=t,this.input=r,this.fragments=n,this.ranges=i,this.inner=[],this.innerDone=0,this.baseTree=null,this.stoppedAt=null,this.baseParse=e}advance(){if(this.baseParse){let e=this.baseParse.advance();if(!e)return null;if(this.baseParse=null,this.baseTree=e,this.startInner(),null!=this.stoppedAt)for(let e of this.inner)e.parse.stopAt(this.stoppedAt)}if(this.innerDone==this.inner.length){let e=this.baseTree;return null!=this.stoppedAt&&(e=new a(e.type,e.children,e.positions,e.length,e.propValues.concat([[W,this.stoppedAt]]))),e}let e=this.inner[this.innerDone],t=e.parse.advance();if(t){this.innerDone++;let r=Object.assign(Object.create(null),e.target.props);r[n.mounted.id]=new i(t,e.overlay,e.parser,e.bracketed),e.target.props=r}return null}get parsedPos(){if(this.baseParse)return 0;let e=this.input.length;for(let t=this.innerDone;t<this.inner.length;t++)this.inner[t].from<e&&(e=Math.min(e,this.inner[t].parse.parsedPos));return e}stopAt(e){if(this.stoppedAt=e,this.baseParse)this.baseParse.stopAt(e);else for(let t=this.innerDone;t<this.inner.length;t++)this.inner[t].parse.stopAt(e)}startInner(){let e=new $(this.fragments),t=null,n=null,i=new S(new y(this.baseTree,this.ranges[0].from,0,null),u.IncludeAnonymous|u.IgnoreMounts);e:for(let s,o;;){let h,f=!0;if(null!=this.stoppedAt&&i.from>=this.stoppedAt)f=!1;else if(e.hasNode(i)){if(t){let e=t.mounts.find(e=>e.frag.from<=i.from&&e.frag.to>=i.to&&e.mount.overlay);if(e)for(let r of e.mount.overlay){let n=r.from+e.pos,s=r.to+e.pos;n>=i.from&&s<=i.to&&!t.ranges.some(e=>e.from<s&&e.to>n)&&t.ranges.push({from:n,to:s})}}f=!1}else if(n&&(o=L(n.ranges,i.from,i.to)))f=2!=o;else if(!i.type.isAnonymous&&(s=this.nest(i,this.input))&&(i.from<i.to||!s.overlay)){i.tree||(V(i),t&&t.depth++,n&&n.depth++);let o=e.findMounts(i.from,s.parser);if("function"==typeof s.overlay)t=new R(s.parser,s.overlay,o,this.inner.length,i.from,!!s.bracketed,i.tree,t);else{let e=q(this.ranges,s.overlay||(i.from<i.to?[new r(i.from,i.to)]:[]));e.length&&D(e),!e.length&&s.overlay||this.inner.push(new F(s.parser,e.length?s.parser.startParse(this.input,Q(o,e),e):s.parser.startParse(""),s.overlay?s.overlay.map(e=>new r(e.from-i.from,e.to-i.from)):null,!!s.bracketed,i.tree,e.length?e[0].from:i.from)),s.overlay?e.length&&(n={ranges:e,depth:0,prev:n}):f=!1}}else if(t&&(h=t.predicate(i))&&(!0===h&&(h=new r(i.from,i.to)),h.from<h.to)){let e=t.ranges.length-1;e>=0&&t.ranges[e].to==h.from?t.ranges[e]={from:t.ranges[e].from,to:h.to}:t.ranges.push(h)}if(f&&i.firstChild())t&&t.depth++,n&&n.depth++;else for(;!i.nextSibling();){if(!i.parent())break e;if(t&&! --t.depth){let e=q(this.ranges,t.ranges);e.length&&(D(e),this.inner.splice(t.index,0,new F(t.parser,t.parser.startParse(this.input,Q(t.mounts,e),e),t.ranges.map(e=>new r(e.from-t.start,e.to-t.start)),t.bracketed,t.target,e[0].from))),t=t.prev}n&&! --n.depth&&(n=n.prev)}}}}function L(e,t,r){for(let n of e){if(n.from>=r)break;if(n.to>t)return n.from<=t&&n.to>=r?2:1}return 0}function J(e,t,r,n,i,s){if(t<r){let o=e.buffer[t+1];n.push(e.slice(t,r,o)),i.push(o-s)}}function V(e){let{node:t}=e,r=[],n=t.context.buffer;do{r.push(e.index),e.parent()}while(!e.tree);let i=e.tree,s=i.children.indexOf(n),h=i.children[s],f=h.buffer,l=[s];i.children[s]=(function e(n,i,s,o,u,p){let d=r[p],c=[],m=[];J(h,n,d,c,m,o);let b=f[d+1],y=f[d+2];l.push(c.length);let x=p?e(d+4,f[d+3],h.set.types[f[d]],b,y-b,p-1):t.toTree();return c.push(x),m.push(b-o),J(h,f[d+3],i,c,m,o),new a(s,c,m,u)})(0,f.length,o.none,0,h.length,r.length-1);for(let t of l){let r=e.tree.children[t],n=e.tree.positions[t];e.yield(new y(r,n+e.from,t,e._tree))}}class H{constructor(e,t){this.offset=t,this.done=!1,this.cursor=e.cursor(u.IncludeAnonymous|u.IgnoreMounts|u.ExcludeBuffers)}moveTo(e){let{cursor:t}=this,r=e-this.offset;for(;!this.done&&t.from<r;)if(t.to>=r&&t.enter(r,1,u.IncludeAnonymous|u.IgnoreMounts|u.IgnoreOverlays|u.ExcludeBuffers));else{if(!(t.to<=r))break;t.next(!1)||(this.done=!0)}}hasNode(e){if(this.moveTo(e.from),!this.done&&this.cursor.from+this.offset==e.from&&this.cursor.tree)for(let t=this.cursor.tree;;){if(t==e.tree)return!0;if(!(t.children.length&&0==t.positions[0]&&t.children[0]instanceof a))break;t=t.children[0]}return!1}}function G(e){let t=e.tree.prop(W);return null==t?e.to:Math.min(e.to,t-e.offset)}class ${constructor(e){if(this.fragments=e,this.curTo=0,this.fragI=0,e.length){let t=this.curFrag=e[0];this.curTo=G(t),this.inner=new H(t.tree,-t.offset)}else this.curFrag=this.inner=null}hasNode(e){for(;this.curFrag&&e.from>=this.curTo;)this.nextFrag();return this.curFrag&&this.curFrag.from<=e.from&&this.curTo>=e.to&&this.inner.hasNode(e)}nextFrag(){if(this.fragI++,this.fragI==this.fragments.length)this.curFrag=this.inner=null;else{let e=this.curFrag=this.fragments[this.fragI];this.curTo=G(e),this.inner=new H(e.tree,-e.offset)}}findMounts(e,t){var r;let i=[];if(this.inner){this.inner.cursor.moveTo(e,1);for(let e=this.inner.cursor.node;e;e=e.parent){let s=null===(r=e.tree)||void 0===r?void 0:r.prop(n.mounted);if(s&&s.parser==t)for(let t=this.fragI;t<this.fragments.length;t++){let r=this.fragments[t];if(r.from>=e.to)break;r.tree==this.curFrag.tree&&i.push({frag:r,pos:e.from-r.offset,mount:s})}}}return i}}function q(e,t){let n=null,i=t;for(let s=1,o=0;s<e.length;s++){let h=e[s-1].to,f=e[s].from;for(;o<i.length;o++){let e=i[o];if(e.from>=f)break;e.to<=h||(n||(i=n=t.slice()),e.from<h?(n[o]=new r(e.from,h),e.to>f&&n.splice(o+1,0,new r(f,e.to))):e.to>f?n[o--]=new r(f,e.to):n.splice(o--,1))}}return i}function K(e,t,n,i){let s=0,o=0,h=!1,f=!1,l=-1e9,u=[];for(;;){let a=s==e.length?1e9:h?e[s].to:e[s].from,p=o==t.length?1e9:f?t[o].to:t[o].from;if(h!=f){let e=Math.max(l,n),t=Math.min(a,p,i);e<t&&u.push(new r(e,t))}if(l=Math.min(a,p),1e9==l)break;a==l&&(h?(h=!1,s++):h=!0),p==l&&(f?(f=!1,o++):f=!0)}return u}function Q(e,t){let n=[];for(let{pos:i,mount:s,frag:o}of e){let e=i+(s.overlay?s.overlay[0].from:0),h=e+s.tree.length,f=Math.max(o.from,e),l=Math.min(o.to,h);if(s.overlay){let h=K(t,s.overlay.map(e=>new r(e.from+i,e.to+i)),f,l);for(let t=0,r=f;;t++){let i=t==h.length,f=i?l:h[t].from;if(f>r&&n.push(new T(r,f,s.tree,-e,o.from>=r||o.openStart,o.to<=f||o.openEnd)),i)break;r=h[t].to}}else n.push(new T(f,l,s.tree,-e,o.from>=e||o.openStart,o.to<=h||o.openEnd))}return n}},1014,[]);
|
|
1113
1113
|
__d(function(g,r,_i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"Tag",{enumerable:!0,get:function(){return a}}),Object.defineProperty(_e,"classHighlighter",{enumerable:!0,get:function(){return E}}),Object.defineProperty(_e,"getStyleTags",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"highlightCode",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"highlightTree",{enumerable:!0,get:function(){return m}}),Object.defineProperty(_e,"styleTags",{enumerable:!0,get:function(){return s}}),Object.defineProperty(_e,"tagHighlighter",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"tags",{enumerable:!0,get:function(){return q}});var e=r(d[0]);let t=0;class a{constructor(e,a,n,i){this.name=e,this.set=a,this.base=n,this.modified=i,this.id=t++}toString(){let{name:e}=this;for(let t of this.modified)t.name&&(e=`${t.name}(${e})`);return e}static define(e,t){let n="string"==typeof e?e:"?";if(e instanceof a&&(t=e),null==t?void 0:t.base)throw new Error("Can not derive from a modified tag");let i=new a(n,[],null,[]);if(i.set.push(i),t)for(let e of t.set)i.set.push(e);return i}static defineModifier(e){let t=new i(e);return e=>e.modified.indexOf(t)>-1?e:i.get(e.base||e,e.modified.concat(t).sort((e,t)=>e.id-t.id))}}let n=0;class i{constructor(e){this.name=e,this.instances=[],this.id=n++}static get(e,t){if(!t.length)return e;let n=t[0].instances.find(a=>{return a.base==e&&(n=t,i=a.modified,n.length==i.length&&n.every((e,t)=>e==i[t]));var n,i});if(n)return n;let s=[],l=new a(e.name,s,e,t);for(let e of t)e.instances.push(l);let c=o(t);for(let t of e.set)if(!t.modified.length)for(let e of c)s.push(i.get(t,e));return l}}function o(e){let t=[[]];for(let a=0;a<e.length;a++)for(let n=0,i=t.length;n<i;n++)t.push(t[n].concat(e[a]));return t.sort((e,t)=>t.length-e.length)}function s(e){let t=Object.create(null);for(let a in e){let n=e[a];Array.isArray(n)||(n=[n]);for(let e of a.split(" "))if(e){let a=[],i=2,o=e;for(let t=0;;){if("..."==o&&t>0&&t+3==e.length){i=1;break}let n=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(o);if(!n)throw new RangeError("Invalid path: "+e);if(a.push("*"==n[0]?"":'"'==n[0][0]?JSON.parse(n[0]):n[0]),t+=n[0].length,t==e.length)break;let s=e[t++];if(t==e.length&&"!"==s){i=0;break}if("/"!=s)throw new RangeError("Invalid path: "+e);o=e.slice(t)}let s=a.length-1,l=a[s];if(!l)throw new RangeError("Invalid path: "+e);let h=new c(n,i,s>0?a.slice(0,s):null);t[l]=h.sort(t[l])}}return l.add(t)}const l=new e.NodeProp({combine(e,t){let a,n,i;for(;e||t;){if(!e||t&&e.depth>=t.depth?(i=t,t=t.next):(i=e,e=e.next),a&&a.mode==i.mode&&!i.context&&!a.context)continue;let o=new c(i.tags,i.mode,i.context);a?a.next=o:n=o,a=o}return n}});class c{constructor(e,t,a,n){this.tags=e,this.mode=t,this.context=a,this.next=n}get opaque(){return 0==this.mode}get inherit(){return 1==this.mode}sort(e){return!e||e.depth<this.depth?(this.next=e,this):(e.next=this.sort(e.next),e)}get depth(){return this.context?this.context.length:0}}function h(e,t){let a=Object.create(null);for(let t of e)if(Array.isArray(t.tag))for(let e of t.tag)a[e.id]=t.class;else a[t.tag.id]=t.class;let{scope:n,all:i=null}=t||{};return{style:e=>{let t=i;for(let n of e)for(let e of n.set){let n=a[e.id];if(n){t=t?t+" "+n:n;break}}return t},scope:n}}function f(e,t){let a=null;for(let n of e){let e=n.style(t);e&&(a=a?a+" "+e:e)}return a}function m(e,t,a,n=0,i=e.length){let o=new p(n,Array.isArray(t)?t:[t],a);o.highlightRange(e.cursor(),n,i,"",o.highlighters),o.flush(i)}function u(e,t,a,n,i,o=0,s=e.length){let l=o;function c(t,a){if(!(t<=l)){for(let o=e.slice(l,t),s=0;;){let e=o.indexOf("\n",s),t=e<0?o.length:e;if(t>s&&n(o.slice(s,t),a),e<0)break;i(),s=e+1}l=t}}m(t,a,(e,t,a)=>{c(e,""),c(t,a)},o,s),c(s,"")}c.empty=new c([],2,null);class p{constructor(e,t,a){this.at=e,this.highlighters=t,this.span=a,this.class=""}startSpan(e,t){t!=this.class&&(this.flush(e),e>this.at&&(this.at=e),this.class=t)}flush(e){e>this.at&&this.class&&this.span(this.at,e,this.class)}highlightRange(t,a,n,i,o){let{type:s,from:l,to:h}=t;if(l>=n||h<=a)return;s.isTop&&(o=this.highlighters.filter(e=>!e.scope||e.scope(s)));let m=i,u=b(t)||c.empty,p=f(o,u.tags);if(p&&(m&&(m+=" "),m+=p,1==u.mode&&(i+=(i?" ":"")+p)),this.startSpan(Math.max(a,l),m),u.opaque)return;let k=t.tree&&t.tree.prop(e.NodeProp.mounted);if(k&&k.overlay){let e=t.node.enter(k.overlay[0].from+l,1),s=this.highlighters.filter(e=>!e.scope||e.scope(k.tree.type)),c=t.firstChild();for(let f=0,u=l;;f++){let p=f<k.overlay.length?k.overlay[f]:null,b=p?p.from+l:h,y=Math.max(a,u),N=Math.min(n,b);if(y<N&&c)for(;t.from<N&&(this.highlightRange(t,y,N,i,o),this.startSpan(Math.min(N,t.to),m),!(t.to>=b)&&t.nextSibling()););if(!p||b>n)break;u=p.to+l,u>a&&(this.highlightRange(e.cursor(),Math.max(a,p.from+l),Math.min(n,u),"",s),this.startSpan(Math.min(n,u),m))}c&&t.parent()}else if(t.firstChild()){k&&(i="");do{if(!(t.to<=a)){if(t.from>=n)break;this.highlightRange(t,a,n,i,o),this.startSpan(Math.min(n,t.to),m)}}while(t.nextSibling());t.parent()}}}function b(e){let t=e.type.prop(l);for(;t&&t.context&&!e.matchContext(t.context);)t=t.next;return t||null}const k=a.define,y=k(),N=k(),x=k(N),v=k(N),w=k(),O=k(w),M=k(w),S=k(),j=k(S),P=k(),C=k(),R=k(),A=k(R),T=k(),q={comment:y,lineComment:k(y),blockComment:k(y),docComment:k(y),name:N,variableName:k(N),typeName:x,tagName:k(x),propertyName:v,attributeName:k(v),className:k(N),labelName:k(N),namespace:k(N),macroName:k(N),literal:w,string:O,docString:k(O),character:k(O),attributeValue:k(O),number:M,integer:k(M),float:k(M),bool:k(w),regexp:k(w),escape:k(w),color:k(w),url:k(w),keyword:P,self:k(P),null:k(P),atom:k(P),unit:k(P),modifier:k(P),operatorKeyword:k(P),controlKeyword:k(P),definitionKeyword:k(P),moduleKeyword:k(P),operator:C,derefOperator:k(C),arithmeticOperator:k(C),logicOperator:k(C),bitwiseOperator:k(C),compareOperator:k(C),updateOperator:k(C),definitionOperator:k(C),typeOperator:k(C),controlOperator:k(C),punctuation:R,separator:k(R),bracket:A,angleBracket:k(A),squareBracket:k(A),paren:k(A),brace:k(A),content:S,heading:j,heading1:k(j),heading2:k(j),heading3:k(j),heading4:k(j),heading5:k(j),heading6:k(j),contentSeparator:k(S),list:k(S),quote:k(S),emphasis:k(S),strong:k(S),link:k(S),monospace:k(S),strikethrough:k(S),inserted:k(),deleted:k(),changed:k(),invalid:k(),meta:T,documentMeta:k(T),annotation:k(T),processingInstruction:k(T),definition:a.defineModifier("definition"),constant:a.defineModifier("constant"),function:a.defineModifier("function"),standard:a.defineModifier("standard"),local:a.defineModifier("local"),special:a.defineModifier("special")};for(let e in q){let t=q[e];t instanceof a&&(t.name=e)}const E=h([{tag:q.link,class:"tok-link"},{tag:q.heading,class:"tok-heading"},{tag:q.emphasis,class:"tok-emphasis"},{tag:q.strong,class:"tok-strong"},{tag:q.keyword,class:"tok-keyword"},{tag:q.atom,class:"tok-atom"},{tag:q.bool,class:"tok-bool"},{tag:q.url,class:"tok-url"},{tag:q.labelName,class:"tok-labelName"},{tag:q.inserted,class:"tok-inserted"},{tag:q.deleted,class:"tok-deleted"},{tag:q.literal,class:"tok-literal"},{tag:q.string,class:"tok-string"},{tag:q.number,class:"tok-number"},{tag:[q.regexp,q.escape,q.special(q.string)],class:"tok-string2"},{tag:q.variableName,class:"tok-variableName"},{tag:q.local(q.variableName),class:"tok-variableName tok-local"},{tag:q.definition(q.variableName),class:"tok-variableName tok-definition"},{tag:q.special(q.variableName),class:"tok-variableName2"},{tag:q.definition(q.propertyName),class:"tok-propertyName tok-definition"},{tag:q.typeName,class:"tok-typeName"},{tag:q.namespace,class:"tok-namespace"},{tag:q.className,class:"tok-className"},{tag:q.macroName,class:"tok-macroName"},{tag:q.propertyName,class:"tok-propertyName"},{tag:q.operator,class:"tok-operator"},{tag:q.comment,class:"tok-comment"},{tag:q.meta,class:"tok-meta"},{tag:q.invalid,class:"tok-invalid"},{tag:q.punctuation,class:"tok-punctuation"}])},1015,[1014]);
|
|
1114
1114
|
__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"inlineFormatChange",{enumerable:!0,get:function(){return s}});const t={bold:"**",italic:"*",code:"`",strikethrough:"~~"},n=(t,n,o)=>{const l=o.charAt(0);let c=n;for(;c>0&&t.charAt(c-1)===l;)c--;return n-c},o=(t,n,o)=>{const l=o.charAt(0);let c=n;for(;c<t.length&&t.charAt(c)===l;)c++;return c-n},l=(t,n)=>"italic"===t?1===n||3===n:"code"===t?1===n:n>=2,c=/^\[(?<label>[^\]]+)\]\([^)]+\)$/u,s=({text:s,from:h,to:u,format:f})=>{const b=s.slice(h,u);if(""===b)return null;if("link"===f){const t=c.exec(b)?.groups?.label,n=t??`[${b}](url)`;return{insert:n,from:h,to:u,selection:h+n.length}}const $=t[f],A=Math.min(n(s,h,$),o(s,u,$));if(l(f,A))return{insert:b,from:h-$.length,to:u+$.length,selection:h-$.length+b.length};const _=Math.min(o(b,0,$),n(b,b.length,$));if(l(f,_)&&b.length>2*_){const t=b.slice($.length,-$.length);return{insert:t,from:h,to:u,selection:h+t.length}}const p=`${$}${b}${$}`;return{insert:p,from:h,to:u,selection:h+p.length}}},1016,[]);
|
|
1115
1115
|
__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"stripLinePrefix",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"applyLinePrefix",{enumerable:!0,get:function(){return u}});const t=t=>t.replace(/^(?:-{3,}|\*{3,}|_{3,})\s*$/u,"").replace(/^#{1,6}\s/u,"").replace(/^[-*+]\s\[[ x]\]\s/iu,"").replace(/^[-*+]\s/u,"").replace(/^\d+\.\s/u,"").replace(/^>+\s?/u,"").replace(/^```\w*\s*/u,""),u=(t,u)=>{switch(u){case"paragraph":default:return t;case"h1":return`# ${t}`;case"h2":return`## ${t}`;case"h3":return`### ${t}`;case"ul":return`- ${t}`;case"ol":return`1. ${t}`;case"task":return`- [ ] ${t}`;case"quote":return`> ${t}`;case"code":return`\`\`\`\n${t}\n\`\`\``}}},1017,[]);
|
package/client/index.html
CHANGED
|
@@ -34,6 +34,6 @@
|
|
|
34
34
|
</noscript>
|
|
35
35
|
<!-- The root element for your Expo app. -->
|
|
36
36
|
<div id="root"></div>
|
|
37
|
-
<script src="/_expo/static/js/web/__expo-metro-runtime-1f8f5d3ca6b7f58204d51e14506d73fb.js" defer></script><script src="/_expo/static/js/web/__common-edea2c7718fddaf3a2043fadeabab584.js" defer></script><script src="/_expo/static/js/web/AppEntry-
|
|
37
|
+
<script src="/_expo/static/js/web/__expo-metro-runtime-1f8f5d3ca6b7f58204d51e14506d73fb.js" defer></script><script src="/_expo/static/js/web/__common-edea2c7718fddaf3a2043fadeabab584.js" defer></script><script src="/_expo/static/js/web/AppEntry-5631ffef29e14c51e35ea01c7bfdd90c.js" defer></script>
|
|
38
38
|
</body>
|
|
39
39
|
</html>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reviewflow/app",
|
|
3
|
-
"version": "6.22.
|
|
3
|
+
"version": "6.22.2",
|
|
4
4
|
"description": "reviewflow app: review any GitHub pull request locally (npx @reviewflow/app), a loopback server on 127.0.0.1:7450 over your gh login serving the expo app",
|
|
5
5
|
"homepage": "https://github.com/christophehurpeau/reviewflow",
|
|
6
6
|
"license": "ISC",
|
|
@@ -34,7 +34,8 @@
|
|
|
34
34
|
"access": "public"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@reviewflow/sdk": "6.22.0"
|
|
37
|
+
"@reviewflow/sdk": "6.22.0",
|
|
38
|
+
"nightingale-app-console": "18.2.0"
|
|
38
39
|
},
|
|
39
40
|
"devDependencies": {
|
|
40
41
|
"@pob/rollup-esbuild": "11.4.0",
|