diff --git a/assets/0-m-TzLBhx.js b/assets/0-m-TzLBhx.js new file mode 100644 index 0000000..92a06b2 --- /dev/null +++ b/assets/0-m-TzLBhx.js @@ -0,0 +1,16 @@ +import{a as o,b as e,r as s,c as t}from"./sprites-C5dmJ2Us.js";import"./index-DLwFTXQh.js";import{a as r}from"./texts-D4Uwcsjn.js";const n=0;const i="console.log";const d="Press the door";const p=` +${o({pos:"50, center().y"})} +${e({pos:"width() - 50, center().y"})} + +${s()} +${t(n)} + +${r("WASD or arrow keys to move")} +`;const m=` +/** + * console.log() outputs a message to the console + */ + +// change the message below and press "Run" +console.log('Hello, World!') +`;export{d as hint,n as level,p as prescript,m as script,i as title}; diff --git a/assets/1-BC_hyZ-_.js b/assets/1-BC_hyZ-_.js new file mode 100644 index 0000000..ed90664 --- /dev/null +++ b/assets/1-BC_hyZ-_.js @@ -0,0 +1,15 @@ +import{a as e,l as t,r as s,c as r}from"./sprites-C5dmJ2Us.js";import"./index-DLwFTXQh.js";import{a as i}from"./texts-D4Uwcsjn.js";const n=1;const m="Single-line Comments";const c="Delete the `//` and press Run";const p=` +${e({pos:"50, 100"})} +${t()} + +${s()} +${r(n)} + +${i("Uncomment the exit")} +`;const d=` +/** + * A single-line comment starts with 2 forward slashes + */ + +// add([sprite('exit'), pos(center()), area(), 'exit']) +`;export{c as hint,n as level,p as prescript,d as script,m as title}; diff --git a/assets/10-EikJBxWh.js b/assets/10-EikJBxWh.js new file mode 100644 index 0000000..fc6534f --- /dev/null +++ b/assets/10-EikJBxWh.js @@ -0,0 +1,24 @@ +import{a as e,b as t,d as o,c as n}from"./sprites-C5dmJ2Us.js";import"./index-DLwFTXQh.js";import{a}from"./texts-D4Uwcsjn.js";const s=10;const p="Function Expressions";const m="Use a negative number";const l=` +${e()} +${t({pos:"center().x, 550"})} + +${o()} +${n(s)} + +${a("Move me again")} +`;const d=` +/** + * A function expression can omit the function name + * to create an anonymous function + */ + +const player = get('player')[0] + +const movePlayer = function () { + player.move(0, 0) +} + +player.onUpdate(() => movePlayer()) +`;const y=` +get('player')[0]?.moveTo(width() - 50, 75) +`;export{m as hint,s as level,y as postscript,l as prescript,d as script,p as title}; diff --git a/assets/11-Crs753y0.js b/assets/11-Crs753y0.js new file mode 100644 index 0000000..24a6177 --- /dev/null +++ b/assets/11-Crs753y0.js @@ -0,0 +1,46 @@ +import{a as t,b as e,d as o,c as i}from"./sprites-C5dmJ2Us.js";import"./index-DLwFTXQh.js";import{a as s}from"./texts-D4Uwcsjn.js";const n=11;const p="Function Hoisting";const d=` +${t()} +${e()} + +${o()} +${i(n)} + +${s("Move at the right time")} +`;const l=` +/** + * Hoisting is where function declarations are moved to + * the top of the scope before execution + * + * Note: hoisting does not apply to function expressions + */ + +const player = get('player')[0] + +player.onUpdate(() => movePlayer()) + +function movePlayer() { + player.move(velocityX, velocityY) +} + +const velocityX = 0 +const velocityY = 0 +`;const y=` +get('player')[0]?.moveTo(40, 70) +const exit = get('exit')[0] + +const x = 40 +const y = 560 +const duration = 3 + +if (exit) { + exit.moveTo(x, y) + addTween() +} + +async function addTween() { + for (let i = 0; i < Number.MAX_SAFE_INTEGER; i++) { + await tween(exit.pos, vec2(width() - x, y), duration, (pos) => (exit.pos = pos)) + await tween(exit.pos, vec2(x, y), duration, (pos) => (exit.pos = pos)) + } +} +`;export{n as level,y as postscript,d as prescript,l as script,p as title}; diff --git a/assets/12-BAR1QHDL.js b/assets/12-BAR1QHDL.js new file mode 100644 index 0000000..31986be --- /dev/null +++ b/assets/12-BAR1QHDL.js @@ -0,0 +1,24 @@ +import{l as r,a as t,e as a,r as o,c as n,f as i}from"./sprites-C5dmJ2Us.js";import"./index-DLwFTXQh.js";import{a as d}from"./texts-D4Uwcsjn.js";const s=12;const g="Variables";const e=(new Date().getFullYear()+s)*31337;const w=String(e);const y=` +${r()} + +${t({pos:"100, 100"})} +${a({pos:"center()",obj:JSON.stringify({password:e})})} + +${o()} +${n(s)} +${i(e)} + +${d("Update password & go to key")} +`;const m=` +/** + * A variable stores data + * 'const' cannot be reassigned, whereas 'let' can be reassigned + */ + +const key = get('key')[0] + +// password = (current_year + current_level_number) * 31337 +let password + +key.password = password +`;export{w as hint,s as level,y as prescript,m as script,g as title}; diff --git a/assets/13-CLAialfw.js b/assets/13-CLAialfw.js new file mode 100644 index 0000000..6bd3822 --- /dev/null +++ b/assets/13-CLAialfw.js @@ -0,0 +1,36 @@ +import{l as t,a as o,e as r,r as i,c as l,f as n}from"./sprites-C5dmJ2Us.js";import"./index-DLwFTXQh.js";import{a as c}from"./texts-D4Uwcsjn.js";const s=13;const $="Template Literals";const m='"hash": "${hash}"';const a=Array(10).fill(void 0).map(()=>"286755fad04869ca523320acce0dc6a4").join("");const e=` +{ + "level": ${s}, + "hash": "${a}" +} +`;const y=` +${t()} + +${o({pos:"100, 100"})} +${r({pos:"center()",obj:JSON.stringify({password:e,hash:a})})} + +${i()} +${l(s)} +${n(e)} + +${c("Multiline password")} +`;const v=` +/** + * A template literal allows variables to be interpolated in a string + */ + +const key = get('key')[0] + +const level = ${s} +const hash = key.hash + +// pass in hash +const password = \` +{ + "level": \${level}, + "hash": "" +} +\` + +key.password = password +`;export{m as hint,s as level,y as prescript,v as script,$ as title}; diff --git a/assets/14-B7hnjGD8.js b/assets/14-B7hnjGD8.js new file mode 100644 index 0000000..c165197 --- /dev/null +++ b/assets/14-B7hnjGD8.js @@ -0,0 +1,23 @@ +import{l as r,a as e,e as o,r as a,c as t,f as p}from"./sprites-C5dmJ2Us.js";import"./index-DLwFTXQh.js";import{a as i}from"./texts-D4Uwcsjn.js";const n=14;const w="For Loop";const y="Array(42).fill().map(...).join('')";const s=Array.from(Array(42).keys()).map(()=>"answer").join("");const m=` +${r()} + +${e({pos:"100, 100"})} +${o({pos:"center()",obj:JSON.stringify({password:s})})} + +${a()} +${t(n)} +${p(s)} + +${i("Repeat the password")} +`;const f=` +/** + * A for loop repeats a block of code + */ + +const key = get('key')[0] + +// password = 'answer' repeated 42 times +let password = 'answer' + 'answer' + +key.password = password +`;export{y as hint,n as level,m as prescript,f as script,w as title}; diff --git a/assets/15-C6TqAxNI.js b/assets/15-C6TqAxNI.js new file mode 100644 index 0000000..6420c29 --- /dev/null +++ b/assets/15-C6TqAxNI.js @@ -0,0 +1,74 @@ +import{g as t,h as s,a as i,b as r,r as p,c as a}from"./sprites-C5dmJ2Us.js";import"./index-DLwFTXQh.js";import{a as n}from"./texts-D4Uwcsjn.js";const c=15;const m="forEach";const o=` +const map = [ + ' ', + ' ', + '^^^^^ ^^^', + ' ', + '^ ^^^^ ', + '^ ^^^', + ' ^ ', + '^^^^ ^^^ ', +] +`;const e=o.split("^").length-1;const h=`There are ${e} spikes`;const k=` +${t()} +${s()} + +${i()} +${r()} + +${p()} +${a(c)} + +${o} +const TILE_SIZE = 64 + +map.forEach((row, rowIndex) => { + row.split('').forEach((column, columnIndex) => { + if (column === '^') { + add([ + sprite('spike'), + area(), + pos(TILE_SIZE * columnIndex, TILE_SIZE * rowIndex), + opacity(0), + 'spike', + ]) + } + }) +}) + +onCollide('player', 'spike', (player, spike) => { + play('hit') + spike.opacity = 1 + player.destroy() + addKaboom(player.pos) +}) + +onUpdate(() => { + const player = get('player')[0] + if (!player) { + return + } + + const { x, y } = player.pos + if (x < 0 || y < 0 || x > width() || y > height()) { + player.moveTo(40, 80) + } + + if (get('spike').length < ${e}) { + throw new Error('There must be ' + ${e} + ' spikes!') + } +}) + +${n("Invisible spikes")} +`;const f=` +/** + * forEach() is an iterative method + */ + +const spikes = get('spike') +const firstSpike = spikes[0] +firstSpike.opacity = 1 +`;const E=` +get('exit')[0]?.moveTo(550, 550) +get('player')[0]?.moveTo(50, 70) +`;export{h as hint,c as level,E as postscript,k as prescript,f as script,m as title}; diff --git a/assets/16-BSeuXE2Q.js b/assets/16-BSeuXE2Q.js new file mode 100644 index 0000000..84fd938 --- /dev/null +++ b/assets/16-BSeuXE2Q.js @@ -0,0 +1,76 @@ +import{i as e,j as o,g as t,a,b as n,r,c as s}from"./sprites-C5dmJ2Us.js";import"./index-DLwFTXQh.js";import{a as d}from"./texts-D4Uwcsjn.js";const c=16;const p="Loops";const m="Use for loops to add blocks around enemy";const E=` +${e()} +${o()} +${t()} + +${a()} +${n()} + +${r()} +${s(c)} + +const ENEMY_SPEED = 500 + +let cancelEnemyUpdate; + +function addEnemy() { + const enemy = add([ + sprite('enemy'), + pos(center()), + area(), + body(), + 'enemy', + ]) + + cancelEnemyUpdate = enemy.onUpdate(() => { + const player = get('player')[0] + if (player) { + const dir = player.pos.sub(enemy.pos).unit() + enemy.move(dir.scale(ENEMY_SPEED)) + } + }).cancel + + return enemy +} + +addEnemy() + +onCollide('player', 'enemy', (player, enemy) => { + if (typeof cancelEnemyUpdate === 'function') { + cancelEnemyUpdate() + } + play('hit') + player.destroy() + addKaboom(player.pos) +}) + +onDestroy('enemy', () => { + addEnemy() +}) + +${d("Block yourself")} +`;const b=` +/** + * Can you build a fortress to block the enemy? + */ + +const block = { + width: 64, + height: 64, +} + +function addBlock(x, y) { + add([ + sprite('block'), + pos(x, y), + area(), + body({ isStatic: true }), + ]) +} + +addBlock(block.width * 3, block.height * 3) +`;const f=` +get('enemy')[0]?.moveTo(center()) +get('exit')[0]?.moveTo(550, 550) +get('player')[0]?.moveTo(50, 70) +`;export{m as hint,c as level,f as postscript,E as prescript,b as script,p as title}; diff --git a/assets/17-CcNbyCdP.js b/assets/17-CcNbyCdP.js new file mode 100644 index 0000000..934a2ae --- /dev/null +++ b/assets/17-CcNbyCdP.js @@ -0,0 +1,21 @@ +import{l as t,a as e,r as o,c as s}from"./sprites-C5dmJ2Us.js";import"./index-DLwFTXQh.js";import{a as i}from"./texts-D4Uwcsjn.js";const r=17;const m="setTimeout";const d="2nd argument of setTimeout() is delay in ms";const p=` +${t()} +${e({pos:"center()"})} + +${o()} +${s(r)} + +${i("How to not wait?")} +`;const l=` +/** + * setTimeout() executes a function once the timer expires + */ + +const MILLISECOND = 1 +const SECOND = MILLISECOND * 1000 +const MINUTE = SECOND * 60 + +setTimeout(() => { + add([sprite('exit'), area(), 'exit']) +}, 5 * MINUTE) +`;export{d as hint,r as level,p as prescript,l as script,m as title}; diff --git a/assets/18-lISP770N.js b/assets/18-lISP770N.js new file mode 100644 index 0000000..70ca678 --- /dev/null +++ b/assets/18-lISP770N.js @@ -0,0 +1,25 @@ +import{a as t,b as e,r as i,c as s}from"./sprites-C5dmJ2Us.js";import"./index-DLwFTXQh.js";import{a as n}from"./texts-D4Uwcsjn.js";const o=18;const d="setInterval";const l="2nd argument of setInterval() is delay in ms";const p=` +${t({pos:"center()"})} +${e()} + +${i(50)} +${s(o)} + +${n("Exit in a loop")} +`;const m=` +/** + * setInterval() calls a function at specified periods + */ + +const MILLISECOND = 1 +const SECOND = MILLISECOND * 1000 + +const exit = get('exit')[0] + +setInterval(() => { + exit.moveTo( + randi(width()), + randi(height()), + ) +}, 2 * SECOND) +`;export{l as hint,o as level,p as prescript,m as script,d as title}; diff --git a/assets/19-CMNubQrS.js b/assets/19-CMNubQrS.js new file mode 100644 index 0000000..df6c427 --- /dev/null +++ b/assets/19-CMNubQrS.js @@ -0,0 +1,56 @@ +import{l as e,k as t,a as s,r as o,c as a}from"./sprites-C5dmJ2Us.js";import"./index-DLwFTXQh.js";const r=19;const y="Repetition is key";const d="Use setInterval()";const l=` +${e()} +${t()} + +${s({pos:"center()"})} + +let keys = 420 + +const getMessage = () => 'Collect ' + keys + ' more key' + (keys !== 1 ? 's' : '') + +add([rect(width(), 32), color(0, 0, 0), z(100)]) +const message = add([text(getMessage()), z(100)]) + +function addKey() { + add([ + sprite('key'), + pos(randi(width()), randi(height())), + area(), + anchor('center'), + 'key', + ]) +} + +addKey() + +${o()} +${a(r)} + +onCollide('key', 'player', (key) => { + keys-- + key.destroy() + message.text = getMessage() + + if (keys) { + addKey() + } else { + add([sprite('exit'), pos(center()), area(), 'exit']) + } +}) + +onAdd('exit', () => { + if (keys) { + destroyAll('exit') + } +}) +`;const c=` +/** + * Can we speed things up? + */ + +function collectKey() { + const player = get('player')[0] + const key = get('key')[0] + key && player.moveTo(key.pos) +} +`;export{d as hint,r as level,l as prescript,c as script,y as title}; diff --git a/assets/2-BEevrkhn.js b/assets/2-BEevrkhn.js new file mode 100644 index 0000000..80d47ab --- /dev/null +++ b/assets/2-BEevrkhn.js @@ -0,0 +1,19 @@ +import{m as t,b as e,c as r,r as s}from"./sprites-C5dmJ2Us.js";import"./index-DLwFTXQh.js";import{a as o}from"./texts-D4Uwcsjn.js";const i=2;const l="Multi-line Comments";const m=` +${t()} +${e({pos:"center()"})} +${r(i)} +${o("Uncomment the player")} +`;const c=` +// Multi-line comments start with /* and end with */ + +/* +add([ + sprite('player'), + pos(50, 50), + area(), + 'player', +]) +*/ +`;const d=` +${s()} +`;export{i as level,d as postscript,m as prescript,c as script,l as title}; diff --git a/assets/20-D-iOKw_o.js b/assets/20-D-iOKw_o.js new file mode 100644 index 0000000..3da9e7d --- /dev/null +++ b/assets/20-D-iOKw_o.js @@ -0,0 +1,61 @@ +import{i as t,a as o,b as s,r as a,c as i}from"./sprites-C5dmJ2Us.js";import"./index-DLwFTXQh.js";import{a as l}from"./texts-D4Uwcsjn.js";const r=20;const d="Properties";const m="Edit the body's mass";const e=1e3;const b=` +${t()} +${o({pos:"95, 100"})} +${s()} + +${a()} +${i(r)} + +${l("Sokoban")} + +const player = get('player')[0] +player.moveTo = () => {} + +const map = [ + '###########', + '###########', + '## ##', + '######## ##', + '## ##', + '###########', + '## ####', + '## #### ##', + '## # ##', + '###########', + '###########', +] + +const tileSize = 64 + +const level = addLevel(map, { + tileWidth: tileSize, + tileHeight: tileSize, + pos: vec2(-tileSize, -tileSize), + tiles: { + '#': () => [ + sprite('block'), + area(), + body({ mass: ${e} }), + 'block' + ], + } +}) + +onUpdate(() => { + level.get('block').forEach((block) => { + if (block.mass < 1) { + throw new Error('Block mass cannot be less than 1') + } + }) +}) +`;const k=` +/** + * A property is an association between an object key and its value + */ + +onCollide('block', 'player', (block) => { + block.mass = ${e} +}) +`;const y=` +get('exit')[0]?.moveTo(480, 480) +`;export{m as hint,r as level,y as postscript,b as prescript,k as script,d as title}; diff --git a/assets/21-Dk_5345y.js b/assets/21-Dk_5345y.js new file mode 100644 index 0000000..6526e79 --- /dev/null +++ b/assets/21-Dk_5345y.js @@ -0,0 +1,53 @@ +import{i as t,a as e,b as o,d as i,c as a}from"./sprites-C5dmJ2Us.js";import"./index-DLwFTXQh.js";import{a as s}from"./texts-D4Uwcsjn.js";const n=21;const c="Methods";const m="Call the methods in a for loop";const d=` +${t()} +${e({pos:"95, 100"})} +${o()} + +${i()} +${a(n)} + +${s("Exit the maze")} + +const player = get('player')[0] +player.moveTo = () => {} + +const map = [ + '#########', + '# #', + '####### #', + '# #', + '# #######', + '# #', + '####### #', + '# #', + '#########', +] + +addLevel(map, { + tileWidth: 64, + tileHeight: 64, + tiles: { + '#': () => [ + sprite('block'), + area(), + body({ isStatic: true }), + ], + } +}) +`;const h=` +/** + * A method is a function defined within an object + */ + +const player = get('player')[0] +const SPEED = 300 + +player.moveUp = function() { this.move(0, -SPEED) } +player.moveLeft = function() { this.move(-SPEED, 0) } +player.moveDown = function() { this.move(0, SPEED) } +player.moveRight = function() { this.move(SPEED, 0) } + +player.moveRight() +`;const v=` +get('exit')[0]?.moveTo(95, 480) +`;export{m as hint,n as level,v as postscript,d as prescript,h as script,c as title}; diff --git a/assets/22-OzhFl_Xi.js b/assets/22-OzhFl_Xi.js new file mode 100644 index 0000000..4dd2a4c --- /dev/null +++ b/assets/22-OzhFl_Xi.js @@ -0,0 +1,23 @@ +import{l as e,a as r,e as a,r as o,c as i,f as n}from"./sprites-C5dmJ2Us.js";import"./index-DLwFTXQh.js";import{a as d}from"./texts-D4Uwcsjn.js";const t=22;const y="JSON.stringify";const g="{ level: _, year: _ }";const s=JSON.stringify({level:t,year:new Date().getFullYear()});const f=` +${e()} + +${r({pos:"100, 100"})} +${a({pos:"center()",obj:JSON.stringify({password:s})})} + +${o()} +${i(t)} +${n(s)} + +${d("Stringify the password")} +`;const w=` +/** + * JSON.stringify() converts data into a string + */ + +const key = get('key')[0] + +// password = JSON string of object containing "level" and "year" +let password + +key.password = password +`;export{g as hint,t as level,f as prescript,w as script,y as title}; diff --git a/assets/23-B2K0bVQx.js b/assets/23-B2K0bVQx.js new file mode 100644 index 0000000..d627e56 --- /dev/null +++ b/assets/23-B2K0bVQx.js @@ -0,0 +1,23 @@ +import{l as o,a as t,e,r,c as a,f as n}from"./sprites-C5dmJ2Us.js";import"./index-DLwFTXQh.js";import{a as i}from"./texts-D4Uwcsjn.js";const p=23;const g="JSON.parse";const w="console.log(key.json)";const s=btoa(String(Date.now()));const d=JSON.stringify({password:s});const m=` +${o()} + +${t({pos:"100, 100"})} +${e({pos:"center()",obj:JSON.stringify({json:d})})} + +${r()} +${a(p)} +${n(s)} + +${i("Parse the password")} +`;const $=` +/** + * JSON.parse() converts string into data + */ + +const key = get('key')[0] + +// parse the "password" from \`key.json\` +let password + +key.password = password +`;export{w as hint,p as level,m as prescript,$ as script,g as title}; diff --git a/assets/24-DVa_QBqx.js b/assets/24-DVa_QBqx.js new file mode 100644 index 0000000..3240c24 --- /dev/null +++ b/assets/24-DVa_QBqx.js @@ -0,0 +1,25 @@ +import{a as e,b as t,c as n}from"./sprites-C5dmJ2Us.js";import"./index-DLwFTXQh.js";import{a as s}from"./texts-D4Uwcsjn.js";const o=24;const i="addEventListener";const c="addEventListener('click', callback)";const l=` +${e({pos:"50, 100"})} +${t({pos:"center()"})} + +${n(o)} + +onKeyPress(() => { + debug.log('Key press disabled!') +}) + +${s("Listen to click")} +`;const p=` +/** + * addEventListener() allows you to add an event handler + */ + +const player = get('player')[0] +const event = '' + +function callback() { + player.moveTo(mousePos()) +} + +addEventListener(event, null) +`;export{c as hint,o as level,l as prescript,p as script,i as title}; diff --git a/assets/25-CbPebhTh.js b/assets/25-CbPebhTh.js new file mode 100644 index 0000000..63e42d4 --- /dev/null +++ b/assets/25-CbPebhTh.js @@ -0,0 +1,81 @@ +import{n as e,j as s,g as o,b as t,c as n,a}from"./sprites-C5dmJ2Us.js";import"./index-DLwFTXQh.js";const c=25;const r="Last stand";const g="addEventListener('click', ...)";const l=` +${e()} +${s()} +${o()} + +${t({pos:"center()"})} + +${n(c)} + +let seconds = 30 +const getMessage = () => 'Player spawns in ' + seconds + ' sec' + +wait(seconds, () => { + ${a({pos:"center()"})} +}) + +add([rect(width(), 32), color(0, 0, 0), z(100)]) +const message = add([text(getMessage()), z(100)]) + +const cancelMessageLoop = loop(1, () => { + if (seconds <= 0) { + message.text = 'Player spawned' + cancelMessageLoop() + } else { + seconds-- + message.text = getMessage() + } +}).cancel + +const cancelEnemyLoop = loop(1, () => { + const enemy = add([ + sprite('enemy'), + pos(randi(2) ? 0 : width(), randi(2) ? 0 : height()), + anchor('center'), + area({ scale: 0.9 }), + body(), + 'enemy', + ]) + + enemy.onUpdate(() => { + const ENEMY_SPEED = 100 + const exit = get('exit')[0] + if (exit) { + const dir = exit.pos.sub(enemy.pos).unit() + enemy.move(dir.scale(ENEMY_SPEED)) + } + }) +}).cancel + +onUpdate('egg', (egg) => { + const SPEED = 300 + egg.move(egg.dir.scale(SPEED)) +}) + +onCollide('exit', 'enemy', (exit, enemy) => { + cancelEnemyLoop() + play('hit') + exit.destroy() + enemy.destroy() + addKaboom(exit.pos) +}) + +onCollide('egg', 'enemy', (egg, enemy) => { + play('hit') + egg.destroy() + enemy.destroy() + addKaboom(egg.pos) +}) +`;const p=` +function shoot() { + add([ + pos(center()), + sprite('egg'), + anchor('center'), + area({ scale: 0.7 }), + offscreen({ destroy: true }), + 'egg', + { dir: mousePos().sub(center()).unit() }, + ]) +} +`;export{g as hint,c as level,l as prescript,p as script,r as title}; diff --git a/assets/26-BOb4J8Ly.js b/assets/26-BOb4J8Ly.js new file mode 100644 index 0000000..0f8bcdc --- /dev/null +++ b/assets/26-BOb4J8Ly.js @@ -0,0 +1,22 @@ +import{l as s,a as o,e as r,r as t,c as i,f as a}from"./sprites-C5dmJ2Us.js";import"./index-DLwFTXQh.js";import{a as l}from"./texts-D4Uwcsjn.js";const d=26;const m="Fullfilled Promise";const u="key.promise.then(...)";const e=btoa(String(Date.now()));const y=` +${s()} + +${o({pos:"100, 100"})} +${r({pos:"center()",obj:`{ promise: Promise.resolve('${e}') }`})} + +${t()} +${i(d)} +${a(e)} + +${l("Pass the Promise")} +`;const P=` +/** + * A Promise produces a value in the future + * If a Promise succeeded, it will produce a resolved value + */ + +const key = get('key')[0] + +// set \`key.password\` to the resolved value of \`key.promise\` +key.promise +`;export{u as hint,d as level,y as prescript,P as script,m as title}; diff --git a/assets/27-JBRJsvuZ.js b/assets/27-JBRJsvuZ.js new file mode 100644 index 0000000..b7d26bd --- /dev/null +++ b/assets/27-JBRJsvuZ.js @@ -0,0 +1,24 @@ +import{l as o,a as s,e as t,r,c as i,f as a}from"./sprites-C5dmJ2Us.js";import"./index-DLwFTXQh.js";import{a as c}from"./texts-D4Uwcsjn.js";const n=27;const l="Rejected Promise";const P="key.promise.catch(...)";const e=btoa(String(Date.now()));const u=` +${o()} + +${s({pos:"100, 100"})} +${t({pos:"center()",obj:`{ promise: Promise.reject('${e}') }`})} + +${r()} +${i(n)} +${a(e)} + +${c("Catch the Promise")} + +window.isPromise = (value) => value instanceof Promise +`;const y=` +/** + * A Promise produces a value in the future + * If a Promise failed, it will produce a rejected value + */ + +const key = get('key')[0] + +// set \`key.password\` to the rejected value of \`key.promise\` +key.promise +`;export{P as hint,n as level,u as prescript,y as script,l as title}; diff --git a/assets/28-CYF1k5UE.js b/assets/28-CYF1k5UE.js new file mode 100644 index 0000000..e166a87 --- /dev/null +++ b/assets/28-CYF1k5UE.js @@ -0,0 +1,17 @@ +import{l as o,a as s,e as r,r as t,c as a,f as i}from"./sprites-C5dmJ2Us.js";import"./index-DLwFTXQh.js";import{a as c}from"./texts-D4Uwcsjn.js";const n=28;const l="Promise methods";const y="key.promise.then(...).catch(...)";const e=Date.now();const $=` +${o()} + +${s({pos:"100, 100"})} +${r({pos:"center()",obj:`{ promise: randi(2) ? Promise.resolve(${e}) : Promise.reject(${e}) }`})} + +${t()} +${a(n)} +${i(e)} + +${c("then or catch")} +`;const h=` +const key = get('key')[0] + +// set \`key.password\` to the resolved or rejected value of \`key.promise\` +key.promise +`;export{y as hint,n as level,$ as prescript,h as script,l as title}; diff --git a/assets/29-BAYtqtua.js b/assets/29-BAYtqtua.js new file mode 100644 index 0000000..ea6faa9 --- /dev/null +++ b/assets/29-BAYtqtua.js @@ -0,0 +1,27 @@ +import{l as s,a as o,e as a,r,c as t,f as i}from"./sprites-C5dmJ2Us.js";import"./index-DLwFTXQh.js";import{a as n}from"./texts-D4Uwcsjn.js";const c=29;const l="Async/await";const m="Google Async/await";const e=Date.now();const w=` +${s()} + +${o({pos:"100, 100"})} +${a({pos:"center()",obj:`{ promise: randi(2) ? Promise.resolve(${e}) : Promise.reject(${e}) }`})} + +${r()} +${t(c)} +${i(e)} + +${n("Bye Bye Bye")} +`;const $=` +/** + * \`await\` pauses an async function execution and + * waits for a Promise to resolve before continuing + */ + +const key = get('key')[0] + +async function main() { + // password = resolved or rejected value of \`key.promise\` + let password + key.password = password +} + +main() +`;export{m as hint,c as level,w as prescript,$ as script,l as title}; diff --git a/assets/3-XCibOsEL.js b/assets/3-XCibOsEL.js new file mode 100644 index 0000000..02e3fde --- /dev/null +++ b/assets/3-XCibOsEL.js @@ -0,0 +1,12 @@ +import{a as r,b as e,c as t,r as o}from"./sprites-C5dmJ2Us.js";import"./index-DLwFTXQh.js";const s=3;const a="Errors";const c=` +${r({pos:"50, 100"})} +${e({pos:"center()"})} +${t(s)} +${o()} +`;const p=` +/** + * Errors interfere with the execution of the program + */ + +throw new Error('Remove the error') +`;export{s as level,c as prescript,p as script,a as title}; diff --git a/assets/30-BIMWgUGC.js b/assets/30-BIMWgUGC.js new file mode 100644 index 0000000..3f158ac --- /dev/null +++ b/assets/30-BIMWgUGC.js @@ -0,0 +1,23 @@ +import{l as e,a as t,e as o,r,c as a,f as c}from"./sprites-C5dmJ2Us.js";import"./index-DLwFTXQh.js";import{a as d}from"./texts-D4Uwcsjn.js";const s="swordfish";const i=30;const h="fetch";const l="Google JavaScript Fetch API";const w=` +${e()} + +${t({pos:"100, 100"})} +${o({pos:"center()",obj:JSON.stringify({password:s})})} + +${r()} +${a(i)} +${c(s)} + +${d("Fetch the password")} +`;const m=` +/** + * fetch() makes a request for a resource + */ + +const key = get('key')[0] + +// GET the password from "/data/password.json" +let password + +key.password = password +`;export{l as hint,i as level,w as prescript,m as script,h as title}; diff --git a/assets/4-CmTixa7I.js b/assets/4-CmTixa7I.js new file mode 100644 index 0000000..0e6d44c --- /dev/null +++ b/assets/4-CmTixa7I.js @@ -0,0 +1,19 @@ +import{a as t,l as e,r as i,c as s}from"./sprites-C5dmJ2Us.js";import"./index-DLwFTXQh.js";const r=4;const a="Strings";const c=` +${t({pos:"center()"})} +${e()} + +${i()} +${s(r)} +`;const l=` +/** + * A string is text inside single or double quotes + */ + +const exit = 'exite' + +add([ + sprite(exit), + area(), + "exit", +]) +`;export{r as level,c as prescript,l as script,a as title}; diff --git a/assets/5-BW4Fwo9K.js b/assets/5-BW4Fwo9K.js new file mode 100644 index 0000000..2958510 --- /dev/null +++ b/assets/5-BW4Fwo9K.js @@ -0,0 +1,20 @@ +import{a as t,l as e,r as i,c as r}from"./sprites-C5dmJ2Us.js";import"./index-DLwFTXQh.js";import{a as o}from"./texts-D4Uwcsjn.js";const s=5;const d="Numbers";const c="Change the coordinates";const l=` +${t({pos:"500, 500"})} +${e()} + +${i()} +${r(s)} + +${o("Exit not in view?")} +`;const m=` +/** + * A number represents floating-point digits like 42 or -13.37 + */ + +add([ + sprite('exit'), + area(), + 'exit', + pos(-9999, -9999), +]) +`;export{c as hint,s as level,l as prescript,m as script,d as title}; diff --git a/assets/6-DSJnDQXJ.js b/assets/6-DSJnDQXJ.js new file mode 100644 index 0000000..0cc1d87 --- /dev/null +++ b/assets/6-DSJnDQXJ.js @@ -0,0 +1,21 @@ +import{a as t,l as e,r as o,c as r}from"./sprites-C5dmJ2Us.js";import"./index-DLwFTXQh.js";import{a as s}from"./texts-D4Uwcsjn.js";const a=6;const p="Booleans";const c="What's the opposite of false?";const d=` +${t({pos:"center()"})} +${e()} + +${o()} +${r(a)} + +${s("Exit is not truthy")} +`;const f=` +/** + * A boolean can either be true or false + */ + +if (false) { + add([ + sprite('exit'), + area(), + 'exit', + ]) +} +`;export{c as hint,a as level,d as prescript,f as script,p as title}; diff --git a/assets/7-DEe-T0-M.js b/assets/7-DEe-T0-M.js new file mode 100644 index 0000000..143b1d0 --- /dev/null +++ b/assets/7-DEe-T0-M.js @@ -0,0 +1,47 @@ +import{i as t,a,b as e,r,c as s}from"./sprites-C5dmJ2Us.js";import"./index-DLwFTXQh.js";import{a as o}from"./texts-D4Uwcsjn.js";const p=7;const m="Arrays";const c="Edit the map";const l=` +${t()} +${a({pos:"center()"})} +${e({pos:"550, 550"})} + +${r()} +${s(p)} + +${o("Trapped in arrays")} + +onUpdate(() => { + const map = get('map')[0] + if (!map?.map?.length) { + throw new Error('Map must be valid') + } +}) +`;const h=` +/** + * An array is an ordered list of data + */ + +const map = [ + '#######', + '# #', + '# #', + '# #', + '# #', + '#######', +] + +map.push(map[0]) + +add(['map', { map }]) +`;const g=` +addLevel(get('map')[0].map, { + tileWidth: 64, + tileHeight: 64, + pos: vec2(64, 64), + tiles: { + '#': () => [ + sprite('block'), + area(), + body({ isStatic: true }), + ], + } +}) +`;export{c as hint,p as level,g as postscript,l as prescript,h as script,m as title}; diff --git a/assets/8-bvyAa4zF.js b/assets/8-bvyAa4zF.js new file mode 100644 index 0000000..b9b1648 --- /dev/null +++ b/assets/8-bvyAa4zF.js @@ -0,0 +1,22 @@ +import{a as e,b as o,d as t,c as s}from"./sprites-C5dmJ2Us.js";import"./index-DLwFTXQh.js";import{a as r}from"./texts-D4Uwcsjn.js";const a=8;const p="Objects";const d="Change the coordinates";const l=` +${e()} +${o({pos:"550, 550"})} + +${t()} +${s(a)} + +${r("Reposition me")} +`;const y=` +/** + * An object is a collection of properties (key-value pairs) + */ + +const coordinates = { + x: 50, + y: 75, +} + +const player = get('player')[0] +player.pos.x = coordinates.x +player.pos.y = coordinates.y +`;export{d as hint,a as level,l as prescript,y as script,p as title}; diff --git a/assets/9-CGkTxJxn.js b/assets/9-CGkTxJxn.js new file mode 100644 index 0000000..588676d --- /dev/null +++ b/assets/9-CGkTxJxn.js @@ -0,0 +1,23 @@ +import{a as e,b as t,d as o,c as r}from"./sprites-C5dmJ2Us.js";import"./index-DLwFTXQh.js";import{a}from"./texts-D4Uwcsjn.js";const s=9;const c="Functions";const l="Edit the values in player.move(...)";const d=` +${e()} +${t({pos:"center().x, 550"})} + +${o()} +${r(s)} + +${a("Move me")} +`;const m=` +/** + * A function is a block of code designed to perform a task + */ + +const player = get('player')[0] + +function movePlayer() { + player.move(0, 0) +} + +player.onUpdate(() => movePlayer()) +`;const v=` +get('player')[0]?.moveTo(50, 75) +`;export{l as hint,s as level,v as postscript,d as prescript,m as script,c as title}; diff --git a/assets/index-B_1k8f-8.css b/assets/index-B_1k8f-8.css new file mode 100644 index 0000000..1e17bb5 --- /dev/null +++ b/assets/index-B_1k8f-8.css @@ -0,0 +1 @@ +*,::before,::after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / 0.5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / 0.5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }*,::before,::after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}::before,::after{--tw-content: ""}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-0.25em}sup{top:-0.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]{display:none}html{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity))}h1{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;font-size:1.875rem;line-height:2.25rem}iframe{width:600px;height:600px}.btn-primary{border-radius:0.25rem;border-bottom-width:4px;--tw-border-opacity: 1;border-color:rgb(21 128 61 / var(--tw-border-opacity));--tw-bg-opacity: 1;background-color:rgb(34 197 94 / var(--tw-bg-opacity));padding-top:0.5rem;padding-bottom:0.5rem;padding-left:1rem;padding-right:1rem;font-weight:700;--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity))}.btn-primary:hover{--tw-border-opacity: 1;border-color:rgb(34 197 94 / var(--tw-border-opacity));--tw-bg-opacity: 1;background-color:rgb(74 222 128 / var(--tw-bg-opacity))}.btn-secondary{border-radius:0.25rem;border-bottom-width:4px;--tw-border-opacity: 1;border-color:rgb(29 78 216 / var(--tw-border-opacity));--tw-bg-opacity: 1;background-color:rgb(59 130 246 / var(--tw-bg-opacity));padding-top:0.5rem;padding-bottom:0.5rem;padding-left:1rem;padding-right:1rem;font-weight:700;--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity))}.btn-secondary:hover{--tw-border-opacity: 1;border-color:rgb(59 130 246 / var(--tw-border-opacity));--tw-bg-opacity: 1;background-color:rgb(96 165 250 / var(--tw-bg-opacity))}.btn-tertiary{border-radius:0.25rem;border-bottom-width:4px;--tw-border-opacity: 1;border-color:rgb(161 98 7 / var(--tw-border-opacity));--tw-bg-opacity: 1;background-color:rgb(234 179 8 / var(--tw-bg-opacity));padding-top:0.5rem;padding-bottom:0.5rem;padding-left:1rem;padding-right:1rem;font-weight:700;--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity))}.btn-tertiary:hover{--tw-border-opacity: 1;border-color:rgb(234 179 8 / var(--tw-border-opacity));--tw-bg-opacity: 1;background-color:rgb(250 204 21 / var(--tw-bg-opacity))}.flex{display:flex}.w-1\/2{width:50%}.basis-1\/2{flex-basis:50%}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.self-end{align-self:flex-end}.transition{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,-webkit-backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter,-webkit-backdrop-filter;transition-timing-function:cubic-bezier(0.4,0,0.2,1);transition-duration:150ms}#editor{width:600px}@media (min-width: 1280px){#editor{overflow:auto;height:600px}}@media not all and (min-width: 1280px){.max-xl\:hidden{display:none}}@media (min-width: 1280px){.xl\:flex{display:flex}.xl\:hidden{display:none}.xl\:center{position:absolute;left:50%;top:50%;display:block;transform:translate(-50%,-50%)}} diff --git a/assets/index-DLwFTXQh.js b/assets/index-DLwFTXQh.js new file mode 100644 index 0000000..5d7fd4e --- /dev/null +++ b/assets/index-DLwFTXQh.js @@ -0,0 +1,53 @@ +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/0-m-TzLBhx.js","assets/sprites-C5dmJ2Us.js","assets/texts-D4Uwcsjn.js","assets/1-BC_hyZ-_.js","assets/10-EikJBxWh.js","assets/11-Crs753y0.js","assets/12-BAR1QHDL.js","assets/13-CLAialfw.js","assets/14-B7hnjGD8.js","assets/15-C6TqAxNI.js","assets/16-BSeuXE2Q.js","assets/17-CcNbyCdP.js","assets/18-lISP770N.js","assets/19-CMNubQrS.js","assets/2-BEevrkhn.js","assets/20-D-iOKw_o.js","assets/21-Dk_5345y.js","assets/22-OzhFl_Xi.js","assets/23-B2K0bVQx.js","assets/24-DVa_QBqx.js","assets/25-CbPebhTh.js","assets/26-BOb4J8Ly.js","assets/27-JBRJsvuZ.js","assets/28-CYF1k5UE.js","assets/29-BAYtqtua.js","assets/3-XCibOsEL.js","assets/30-BIMWgUGC.js","assets/4-CmTixa7I.js","assets/5-BW4Fwo9K.js","assets/6-DSJnDQXJ.js","assets/7-DEe-T0-M.js","assets/8-bvyAa4zF.js","assets/9-CGkTxJxn.js"])))=>i.map(i=>d[i]); +(function n(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload")){return}for(const s of document.querySelectorAll('link[rel="modulepreload"]')){i(s)}new MutationObserver(s=>{for(const r of s){if(r.type!=="childList"){continue}for(const o of r.addedNodes){if(o.tagName==="LINK"&&o.rel==="modulepreload")i(o)}}}).observe(document,{childList:true,subtree:true});function t(s){const r={};if(s.integrity)r.integrity=s.integrity;if(s.referrerPolicy)r.referrerPolicy=s.referrerPolicy;if(s.crossOrigin==="use-credentials")r.credentials="include";else if(s.crossOrigin==="anonymous")r.credentials="omit";else r.credentials="same-origin";return r}function i(s){if(s.ep)return;s.ep=true;const r=t(s);fetch(s.href,r)}})();function Xf(n){return localStorage.getItem(n)}function Df(n,e){localStorage.setItem(n,e)}const va=1024;let Yf=0;let Ss=class q1{constructor(e,t){this.from=e;this.to=t}};class W{constructor(e={}){this.id=Yf++;this.perNode=!!e.perNode;this.deserialize=e.deserialize||(()=>{throw new Error("This node type doesn't define a deserialize function")})}add(e){if(this.perNode)throw new RangeError("Can't add per-node props to node types");if(typeof e!="function")e=$e.match(e);return t=>{let i=e(t);return i===void 0?null:[this,i]}}}W.closedBy=new W({deserialize:n=>n.split(" ")});W.openedBy=new W({deserialize:n=>n.split(" ")});W.group=new W({deserialize:n=>n.split(" ")});W.isolate=new W({deserialize:n=>{if(n&&n!="rtl"&&n!="ltr"&&n!="auto")throw new RangeError("Invalid value for isolate: "+n);return n||"auto"}});W.contextHash=new W({perNode:true});W.lookAhead=new W({perNode:true});W.mounted=new W({perNode:true});class Mn{constructor(e,t,i){this.tree=e;this.overlay=t;this.parser=i}static get(e){return e&&e.props&&e.props[W.mounted.id]}}const Ef=Object.create(null);class $e{constructor(e,t,i,s=0){this.name=e;this.props=t;this.id=i;this.flags=s}static define(e){let t=e.props&&e.props.length?Object.create(null):Ef;let i=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(e.name==null?8:0);let s=new $e(e.name||"",t,e.id,i);if(e.props)for(let r of e.props){if(!Array.isArray(r))r=r(s);if(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 s}prop(e){return this.props[e.id]}get isTop(){return(this.flags&1)>0}get isSkipped(){return(this.flags&2)>0}get isError(){return(this.flags&4)>0}get isAnonymous(){return(this.flags&8)>0}is(e){if(typeof e=="string"){if(this.name==e)return true;let t=this.prop(W.group);return t?t.indexOf(e)>-1:false}return this.id==e}static match(e){let t=Object.create(null);for(let i in e)for(let s of i.split(" "))t[s]=e[i];return i=>{for(let s=i.prop(W.group),r=-1;r<(s?s.length:0);r++){let o=t[r<0?i.name:s[r]];if(o)return o}}}}$e.none=new $e("",Object.create(null),0,8);class Ir{constructor(e){this.types=e;for(let t=0;t0;for(let a=this.cursor(o|se.IncludeAnonymous);;){let h=false;if(a.from<=r&&a.to>=s&&(!l&&a.type.isAnonymous||t(a)!==false)){if(a.firstChild())continue;h=true}for(;;){if(h&&i&&(l||!a.type.isAnonymous))i(a);if(a.nextSibling())break;if(!a.parent())return;h=true}}}prop(e){return!e.perNode?this.type.prop(e):this.props?this.props[e.id]:void 0}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:Fr($e.none,this.children,this.positions,0,this.children.length,0,this.length,(t,i,s)=>new K(this.type,t,i,s,this.propValues),e.makeTree||((t,i,s)=>new K($e.none,t,i,s)))}static build(e){return jf(e)}}K.empty=new K($e.none,[],[],0);class Nr{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 Nr(this.buffer,this.index)}}class yt{constructor(e,t,i){this.buffer=e;this.length=t;this.set=i}get type(){return $e.none}toString(){let e=[];for(let t=0;t0)break}}return l}slice(e,t,i){let s=this.buffer;let r=new Uint16Array(t-e),o=0;for(let l=e,a=0;l=e&&te;case 1:return t<=e&&i>e;case 2:return i>e;case 4:return true}}function Ri(n,e,t,i){var s;while(n.from==n.to||(t<1?n.from>=e:n.from>e)||(t>-1?n.to<=e:n.to0?l.length:-1;e!=h;e+=t){let c=l[e],f=a[e]+o.from;if(!Za(s,i,f,f+c.length))continue;if(c instanceof yt){if(r&se.ExcludeBuffers)continue;let u=c.findChild(0,c.buffer.length,t,i-f,s);if(u>-1)return new Ke(new qf(o,c,e,f),null,u)}else if(r&se.IncludeAnonymous||(!c.type.isAnonymous||Gr(c))){let u;if(!(r&se.IgnoreMounts)&&(u=Mn.get(c))&&!u.overlay)return new Pe(u.tree,f,e,o);let d=new Pe(c,f,e,o);return r&se.IncludeAnonymous||!d.type.isAnonymous?d:d.nextChild(t<0?c.children.length-1:0,t,i,s)}}if(r&se.IncludeAnonymous||!o.type.isAnonymous)return null;if(o.index>=0)e=o.index+t;else e=t<0?-1:o._parent._tree.children.length;o=o._parent;if(!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)}enter(e,t,i=0){let s;if(!(i&se.IgnoreOverlays)&&(s=Mn.get(this._tree))&&s.overlay){let r=e-this.from;for(let{from:o,to:l}of s.overlay){if((t>0?o<=r:o=r:l>r))return new Pe(s.tree,s.overlay[0].from+this.from,-1,this)}}return this.nextChild(0,1,e,t,i)}nextSignificantParent(){let e=this;while(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 Mo(n,e,t,i){let s=n.cursor(),r=[];if(!s.firstChild())return r;if(t!=null)for(let o=false;!o;){o=s.type.is(t);if(!s.nextSibling())return r}for(;;){if(i!=null&&s.type.is(i))return r;if(s.type.is(e))r.push(s.node);if(!s.nextSibling())return i==null?r:[]}}function Hs(n,e,t=e.length-1){for(let i=n.parent;t>=0;i=i.parent){if(!i)return false;if(!i.type.isAnonymous){if(e[t]&&e[t]!=i.name)return false;t--}}return true}class qf{constructor(e,t,i,s){this.parent=e;this.buffer=t;this.index=i;this.start=s}}class Ke extends Ra{get name(){return this.type.name}get from(){return this.context.start+this.context.buffer.buffer[this.index+1]}get to(){return this.context.start+this.context.buffer.buffer[this.index+2]}constructor(e,t,i){super();this.context=e;this._parent=t;this.index=i;this.type=e.buffer.set.types[e.buffer.buffer[i]]}child(e,t,i){let{buffer:s}=this.context;let r=s.findChild(this.index+4,s.buffer[this.index+3],e,t-this.context.start,i);return r<0?null:new Ke(this.context,this,r)}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)}enter(e,t,i=0){if(i&se.ExcludeBuffers)return null;let{buffer:s}=this.context;let r=s.findChild(this.index+4,s.buffer[this.index+3],t>0?1:-1,e-this.context.start,t);return r<0?null:new Ke(this.context,this,r)}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;let t=e.buffer[this.index+3];if(t<(this._parent?e.buffer[this._parent.index+3]:e.buffer.length))return new Ke(this.context,this._parent,t);return this.externalSibling(1)}get prevSibling(){let{buffer:e}=this.context;let t=this._parent?this._parent.index+4:0;if(this.index==t)return this.externalSibling(-1);return new Ke(this.context,this._parent,e.findChild(t,this.index,-1,0,4))}get tree(){return null}toTree(){let e=[],t=[];let{buffer:i}=this.context;let s=this.index+4,r=i.buffer[this.index+3];if(r>s){let o=i.buffer[this.index+1];e.push(i.slice(s,r,o));t.push(0)}return new K(this.type,e,t,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function Ta(n){if(!n.length)return null;let e=0,t=n[0];for(let r=1;rt.from||o.to=e){let l=new Pe(o.tree,o.overlay[0].from+r.from,-1,r);(s||(s=[i])).push(Ri(l,e,t,false))}}}return s?Ta(s):i}class Ks{get name(){return this.type.name}constructor(e,t=0){this.mode=t;this.buffer=null;this.stack=[];this.index=0;this.bufferNode=null;if(e instanceof Pe){this.yieldNode(e)}else{this._tree=e.context.parent;this.buffer=e.context;for(let i=e._parent;i;i=i._parent)this.stack.unshift(i.index);this.bufferNode=e;this.yieldBuf(e.index)}}yieldNode(e){if(!e)return false;this._tree=e;this.type=e.type;this.from=e.from;this.to=e.to;return true}yieldBuf(e,t){this.index=e;let{start:i,buffer:s}=this.buffer;this.type=t||s.set.types[s.buffer[e]];this.from=i+s.buffer[e+1];this.to=i+s.buffer[e+2];return true}yield(e){if(!e)return false;if(e instanceof Pe){this.buffer=null;return this.yieldNode(e)}this.buffer=e.context;return this.yieldBuf(e.index,e.type)}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(e,t,i){if(!this.buffer)return this.yield(this._tree.nextChild(e<0?this._tree._tree.children.length-1:0,e,t,i,this.mode));let{buffer:s}=this.buffer;let r=s.findChild(this.index+4,s.buffer[this.index+3],e,t-this.buffer.start,i);if(r<0)return false;this.stack.push(this.index);return this.yieldBuf(r)}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(e){return this.enterChild(1,e,2)}childBefore(e){return this.enterChild(-1,e,-2)}enter(e,t,i=this.mode){if(!this.buffer)return this.yield(this._tree.enter(e,t,i));return i&se.ExcludeBuffers?false:this.enterChild(1,e,t)}parent(){if(!this.buffer)return this.yieldNode(this.mode&se.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&se.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();this.buffer=null;return this.yieldNode(e)}sibling(e){if(!this.buffer)return!this._tree._parent?false: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,i=this.stack.length-1;if(e<0){let s=i<0?0:this.stack[i]+4;if(this.index!=s)return this.yieldBuf(t.findChild(s,this.index,-1,0,4))}else{let s=t.buffer[this.index+3];if(s<(i<0?t.buffer.length:t.buffer[this.stack[i]+3]))return this.yieldBuf(s)}return i<0?this.yield(this.buffer.parent.nextChild(this.buffer.index+e,e,0,4,this.mode)):false}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(e){let t,i,{buffer:s}=this;if(s){if(e>0){if(this.index-1)for(let r=t+e,o=e<0?-1:i._tree.children.length;r!=o;r+=e){let l=i._tree.children[r];if(this.mode&se.IncludeAnonymous||l instanceof yt||!l.type.isAnonymous||Gr(l))return false}}return true}move(e,t){if(t&&this.enterChild(e,0,4))return true;for(;;){if(this.sibling(e))return true;if(this.atLastNode(e)||!this.parent())return false}}next(e=true){return this.move(1,e)}prev(e=true){return this.move(-1,e)}moveTo(e,t=0){while(this.from==this.to||(t<1?this.from>=e:this.from>e)||(t>-1?this.to<=e:this.to=0;){for(let o=e;o;o=o._parent)if(o.index==s){if(s==this.index)return o;t=o;i=r+1;break e}s=this.stack[--r]}}for(let s=i;s=0;r--){if(r<0)return Hs(this.node,e,s);let o=i[t.buffer[this.stack[r]]];if(!o.isAnonymous){if(e[s]&&e[s]!=o.name)return false;s--}}return true}}function Gr(n){return n.children.some(e=>e instanceof yt||!e.type.isAnonymous||Gr(e))}function jf(n){var e;let{buffer:t,nodeSet:i,maxBufferLength:s=va,reused:r=[],minRepeatType:o=i.types.length}=n;let l=Array.isArray(t)?new Nr(t,t.length):t;let a=i.types;let h=0,c=0;function f(x,$,P,C,D,Y){let{id:X,start:M,end:V,size:z}=l;let F=c;while(z<0){l.next();if(z==-1){let te=r[X];P.push(te);C.push(M-x);return}else if(z==-3){h=X;return}else if(z==-4){c=X;return}else{throw new RangeError(`Unrecognized record size: ${z}`)}}let ye=a[X],xe,ve;let Me=M-x;if(V-M<=s&&(ve=m(l.pos-$,D))){let te=new Uint16Array(ve.size-ve.skip);let We=l.pos-ve.size,Le=te.length;while(l.pos>We)Le=b(ve.start,te,Le);xe=new yt(te,V-ve.start,i);Me=ve.start-x}else{let te=l.pos-z;l.next();let We=[],Le=[];let vt=X>=o?X:-1;let _t=0,Ji=V;while(l.pos>te){if(vt>=0&&l.id==vt&&l.size>=0){if(l.end<=Ji-s){O(We,Le,M,_t,l.end,Ji,vt,F);_t=We.length;Ji=l.end}l.next()}else if(Y>2500){u(M,te,We,Le)}else{f(M,te,We,Le,vt,Y+1)}}if(vt>=0&&_t>0&&_t-1&&_t>0){let Ao=d(ye);xe=Fr(ye,We,Le,0,We.length,0,V-M,Ao,Ao)}else{xe=p(ye,We,Le,V-M,F-V)}}P.push(xe);C.push(Me)}function u(x,$,P,C){let D=[];let Y=0,X=-1;while(l.pos>$){let{id:M,start:V,end:z,size:F}=l;if(F>4){l.next()}else if(X>-1&&V=0;z-=3){M[F++]=D[z];M[F++]=D[z+1]-V;M[F++]=D[z+2]-V;M[F++]=F}P.push(new yt(M,D[2]-V,i));C.push(V-x)}}function d(x){return($,P,C)=>{let D=0,Y=$.length-1,X,M;if(Y>=0&&(X=$[Y])instanceof K){if(!Y&&X.type==x&&X.length==C)return X;if(M=X.prop(W.lookAhead))D=P[Y]+X.length+M}return p(x,$,P,C,D)}}function O(x,$,P,C,D,Y,X,M){let V=[],z=[];while(x.length>C){V.push(x.pop());z.push($.pop()+P-D)}x.push(p(i.types[X],V,z,Y-D,M-Y));$.push(D-P)}function p(x,$,P,C,D=0,Y){if(h){let X=[W.contextHash,h];Y=Y?[X].concat(Y):[X]}if(D>25){let X=[W.lookAhead,D];Y=Y?[X].concat(Y):[X]}return new K(x,$,P,C,Y)}function m(x,$){let P=l.fork();let C=0,D=0,Y=0,X=P.end-s;let M={size:0,start:0,skip:0};e:for(let V=P.pos-x;P.pos>V;){let z=P.size;if(P.id==$&&z>=0){M.size=C;M.start=D;M.skip=Y;Y+=4;C+=4;P.next();continue}let F=P.pos-z;if(z<0||F=o?4:0;let xe=P.start;P.next();while(P.pos>F){if(P.size<0){if(P.size==-3)ye+=4;else break e}else if(P.id>=o){ye+=4}P.next()}D=xe;C+=z;Y+=ye}if($<0||C==x){M.size=C;M.start=D;M.skip=Y}return M.size>4?M:void 0}function b(x,$,P){let{id:C,start:D,end:Y,size:X}=l;l.next();if(X>=0&&C4){let V=l.pos-(X-4);while(l.pos>V)P=b(x,$,P)}$[--P]=M;$[--P]=Y-x;$[--P]=D-x;$[--P]=C}else if(X==-3){h=C}else if(X==-4){c=C}return P}let S=[],k=[];while(l.pos>0)f(n.start||0,n.bufferStart||0,S,k,-1,0);let w=(e=n.length)!==null&&e!==void 0?e:S.length?k[0]+S[0].length:0;return new K(a[n.topID],S.reverse(),k.reverse(),w)}const Wo=new WeakMap;function Qn(n,e){if(!n.isAnonymous||e instanceof yt||e.type!=n)return 1;let t=Wo.get(e);if(t==null){t=1;for(let i of e.children){if(i.type!=n||!(i instanceof K)){t=1;break}t+=Qn(n,i)}Wo.set(e,t)}return t}function Fr(n,e,t,i,s,r,o,l,a){let h=0;for(let O=i;O=c)break;$+=P}if(k==w+1){if($>c){let P=O[w];d(P.children,P.positions,0,P.children.length,p[w]+S);continue}f.push(O[w])}else{let P=p[k-1]+O[k-1].length-x;f.push(Fr(n,O,p,w,k,x,P,null,a))}u.push(x+S-r)}}d(e,t,i,s,0);return(l||a)(f,u,o)}class Vf{constructor(){this.map=new WeakMap}setBuffer(e,t,i){let s=this.map.get(e);if(!s)this.map.set(e,s=new Map);s.set(t,i)}getBuffer(e,t){let i=this.map.get(e);return i&&i.get(t)}set(e,t){if(e instanceof Ke)this.setBuffer(e.context.buffer,e.index,t);else if(e instanceof Pe)this.map.set(e.tree,t)}get(e){return e instanceof Ke?this.getBuffer(e.context.buffer,e.index):e instanceof Pe?this.map.get(e.tree):void 0}cursorSet(e,t){if(e.buffer)this.setBuffer(e.buffer.buffer,e.index,t);else this.map.set(e.tree,t)}cursorGet(e){return e.buffer?this.getBuffer(e.buffer.buffer,e.index):this.map.get(e.tree)}}class Mt{constructor(e,t,i,s,r=false,o=false){this.from=e;this.to=t;this.tree=i;this.offset=s;this.open=(r?1:0)|(o?2:0)}get openStart(){return(this.open&1)>0}get openEnd(){return(this.open&2)>0}static addTree(e,t=[],i=false){let s=[new Mt(0,e.length,e,0,false,i)];for(let r of t)if(r.to>e.length)s.push(r);return s}static applyChanges(e,t,i=128){if(!t.length)return e;let s=[];let r=1,o=e.length?e[0]:null;for(let l=0,a=0,h=0;;l++){let c=l=i)while(o&&o.from=u.from||f<=u.to||h){let d=Math.max(u.from,a)-h,O=Math.min(u.to,f)-h;u=d>=O?null:new Mt(d,O,u.tree,u.offset+h,l>0,!!c)}if(u)s.push(u);if(o.to>f)break;o=rnew Ss(s.from,s.to)):[new Ss(0,0)];return this.createParse(e,t||[],i)}parse(e,t,i){let s=this.startParse(e,t,i);for(;;){let r=s.advance();if(r)return r}}}class Lf{constructor(e){this.string=e}get length(){return this.string.length}chunk(e){return this.string.slice(e)}get lineChunks(){return false}read(e,t){return this.string.slice(e,t)}}new W({perNode:true});var Xo={};class Wn{constructor(e,t,i,s,r,o,l,a,h,c=0,f){this.p=e;this.stack=t;this.state=i;this.reducePos=s;this.pos=r;this.score=o;this.buffer=l;this.bufferBase=a;this.curContext=h;this.lookAhead=c;this.parent=f}toString(){return`[${this.stack.filter((e,t)=>t%3==0).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(e,t,i=0){let s=e.parser.context;return new Wn(e,[],t,i,i,0,[],0,s?new Do(s,s.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(e,t){this.stack.push(this.state,t,this.bufferBase+this.buffer.length);this.state=e}reduce(e){var t;let i=e>>19,s=e&65535;let{parser:r}=this.p;let o=r.dynamicPrecedence(s);if(o)this.score+=o;if(i==0){this.pushState(r.getGoto(this.state,s,true),this.reducePos);if(s=2e3&&!((t=this.p.parser.nodeSet.types[s])===null||t===void 0?void 0:t.isAnonymous)){if(a==this.p.lastBigReductionStart){this.p.bigReductionCount++;this.p.lastBigReductionSize=h}else if(this.p.lastBigReductionSizel)this.stack.pop();this.reduceContext(s,a)}storeNode(e,t,i,s=4,r=false){if(e==0&&(!this.stack.length||this.stack[this.stack.length-1]0&&o.buffer[l-4]==0&&o.buffer[l-1]>-1){if(t==i)return;if(o.buffer[l-2]>=t){o.buffer[l-2]=i;return}}}if(!r||this.pos==i){this.buffer.push(e,t,i,s)}else{let o=this.buffer.length;if(o>0&&this.buffer[o-4]!=0)while(o>0&&this.buffer[o-2]>i){this.buffer[o]=this.buffer[o-4];this.buffer[o+1]=this.buffer[o-3];this.buffer[o+2]=this.buffer[o-2];this.buffer[o+3]=this.buffer[o-1];o-=4;if(s>4)s-=4}this.buffer[o]=e;this.buffer[o+1]=t;this.buffer[o+2]=i;this.buffer[o+3]=s}}shift(e,t,i,s){if(e&131072){this.pushState(e&65535,this.pos)}else if((e&262144)==0){let r=e,{parser:o}=this.p;if(s>this.pos||t<=o.maxNode){this.pos=s;if(!o.stateFlag(r,1))this.reducePos=s}this.pushState(r,i);this.shiftContext(t,i);if(t<=o.maxNode)this.buffer.push(t,i,s,4)}else{this.pos=s;this.shiftContext(t,i);if(t<=this.p.parser.maxNode)this.buffer.push(t,i,s,4)}}apply(e,t,i,s){if(e&65536)this.reduce(e);else this.shift(e,t,i,s)}useNode(e,t){let i=this.p.reused.length-1;if(i<0||this.p.reused[i]!=e){this.p.reused.push(e);i++}let s=this.pos;this.reducePos=this.pos=s+e.length;this.pushState(t,s);this.buffer.push(i,s,this.reducePos,-1);if(this.curContext)this.updateContext(this.curContext.tracker.reuse(this.curContext.context,e,this,this.p.stream.reset(this.pos-e.length)))}split(){let e=this;let t=e.buffer.length;while(t>0&&e.buffer[t-2]>e.reducePos)t-=4;let i=e.buffer.slice(t),s=e.bufferBase+t;while(e&&s==e.bufferBase)e=e.parent;return new Wn(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,i,s,this.curContext,this.lookAhead,e)}recoverByDelete(e,t){let i=e<=this.p.parser.maxNode;if(i)this.storeNode(e,this.pos,t,4);this.storeNode(0,this.pos,t,i?8:4);this.pos=this.reducePos=t;this.score-=190}canShift(e){for(let t=new Bf(this);;){let i=this.p.parser.stateSlot(t.state,4)||this.p.parser.hasAction(t.state,e);if(i==0)return false;if((i&65536)==0)return true;t.reduce(i)}}recoverByInsert(e){if(this.stack.length>=300)return[];let t=this.p.parser.nextStates(this.state);if(t.length>4<<1||this.stack.length>=120){let s=[];for(let r=0,o;ra&1&&l==o))s.push(t[r],o)}t=s}let i=[];for(let s=0;s>19,s=t&65535;let r=this.stack.length-i*3;if(r<0||e.getGoto(this.stack[r],s,false)<0){let o=this.findForcedReduction();if(o==null)return false;t=o}this.storeNode(0,this.pos,this.pos,4,true);this.score-=100}this.reducePos=this.pos;this.reduce(t);return true}findForcedReduction(){let{parser:e}=this.p,t=[];let i=(s,r)=>{if(t.includes(s))return;t.push(s);return e.allActions(s,o=>{if(o&(262144|131072));else if(o&65536){let l=(o>>19)-r;if(l>1){let a=o&65535,h=this.stack.length-l*3;if(h>=0&&e.getGoto(this.stack[h],a,false)>=0)return l<<19|65536|a}}else{let l=i(o,r+1);if(l!=null)return l}})};return i(this.state,0)}forceAll(){while(!this.p.parser.stateFlag(this.state,2)){if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,true);break}}return this}get deadEnd(){if(this.stack.length!=3)return false;let{parser:e}=this.p;return e.data[e.stateSlot(this.state,1)]==65535&&!e.stateSlot(this.state,4)}restart(){this.storeNode(0,this.pos,this.pos,4,true);this.state=this.stack[0];this.stack.length=0}sameState(e){if(this.state!=e.state||this.stack.length!=e.stack.length)return false;for(let t=0;tthis.lookAhead){this.emitLookAhead();this.lookAhead=e}}close(){if(this.curContext&&this.curContext.tracker.strict)this.emitContext();if(this.lookAhead>0)this.emitLookAhead()}}class Do{constructor(e,t){this.tracker=e;this.context=t;this.hash=e.strict?e.hash(t):0}}class Bf{constructor(e){this.start=e;this.state=e.state;this.stack=e.stack;this.base=this.stack.length}reduce(e){let t=e&65535,i=e>>19;if(i==0){if(this.stack==this.start.stack)this.stack=this.stack.slice();this.stack.push(this.state,0,0);this.base+=3}else{this.base-=(i-1)*3}let s=this.start.p.parser.getGoto(this.stack[this.base-3],t,true);this.state=s}}class Xn{constructor(e,t,i){this.stack=e;this.pos=t;this.index=i;this.buffer=e.buffer;if(this.index==0)this.maybeNext()}static create(e,t=e.bufferBase+e.buffer.length){return new Xn(e,t,t-e.bufferBase)}maybeNext(){let e=this.stack.parent;if(e!=null){this.index=this.stack.bufferBase-e.bufferBase;this.stack=e;this.buffer=e.buffer}}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]}next(){this.index-=4;this.pos-=4;if(this.index==0)this.maybeNext()}fork(){return new Xn(this.stack,this.pos,this.index)}}function bi(n,e=Uint16Array){if(typeof n!="string")return n;let t=null;for(let i=0,s=0;i=92)o--;if(o>=34)o--;let a=o-32;if(a>=46){a-=46;l=true}r+=a;if(l)break;r*=46}if(t)t[s++]=r;else t=new e(r)}return t}class kn{constructor(){this.start=-1;this.value=-1;this.end=-1;this.extended=-1;this.lookAhead=0;this.mask=0;this.context=0}}const Yo=new kn;class Uf{constructor(e,t){this.input=e;this.ranges=t;this.chunk="";this.chunkOff=0;this.chunk2="";this.chunk2Pos=0;this.next=-1;this.token=Yo;this.rangeIndex=0;this.pos=this.chunkPos=t[0].from;this.range=t[0];this.end=t[t.length-1].to;this.readNext()}resolveOffset(e,t){let i=this.range,s=this.rangeIndex;let r=this.pos+e;while(ri.to:r>=i.to){if(s==this.ranges.length-1)return null;let o=this.ranges[++s];r+=o.from-i.to;i=o}return r}clipPos(e){if(e>=this.range.from&&ee)return Math.max(e,t.from);return this.end}peek(e){let t=this.chunkOff+e,i,s;if(t>=0&&t=this.chunk2Pos&&il.to)this.chunk2=this.chunk2.slice(0,l.to-i);s=this.chunk2.charCodeAt(0)}}if(i>=this.token.lookAhead)this.token.lookAhead=i+1;return s}acceptToken(e,t=0){let i=t?this.resolveOffset(t,-1):this.pos;if(i==null||i=this.chunk2Pos&&this.posthis.range.to?e.slice(0,this.range.to-this.pos):e;this.chunkPos=this.pos;this.chunkOff=0}}readNext(){if(this.chunkOff>=this.chunk.length){this.getChunk();if(this.chunkOff==this.chunk.length)return this.next=-1}return this.next=this.chunk.charCodeAt(this.chunkOff)}advance(e=1){this.chunkOff+=e;while(this.pos+e>=this.range.to){if(this.rangeIndex==this.ranges.length-1)return this.setDone();e-=this.range.to-this.pos;this.range=this.ranges[++this.rangeIndex];this.pos=this.range.from}this.pos+=e;if(this.pos>=this.token.lookAhead)this.token.lookAhead=this.pos+1;return this.readNext()}setDone(){this.pos=this.chunkPos=this.end;this.range=this.ranges[this.rangeIndex=this.ranges.length-1];this.chunk="";return this.next=-1}reset(e,t){if(t){this.token=t;t.start=e;t.lookAhead=e+1;t.value=t.extended=-1}else{this.token=Yo}if(this.pos!=e){this.pos=e;if(e==this.end){this.setDone();return this}while(e=this.range.to)this.range=this.ranges[++this.rangeIndex];if(e>=this.chunkPos&&e=this.chunkPos&&t<=this.chunkPos+this.chunk.length)return this.chunk.slice(e-this.chunkPos,t-this.chunkPos);if(e>=this.chunk2Pos&&t<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(e-this.chunk2Pos,t-this.chunk2Pos);if(e>=this.range.from&&t<=this.range.to)return this.input.read(e,t);let i="";for(let s of this.ranges){if(s.from>=t)break;if(s.to>e)i+=this.input.read(Math.max(s.from,e),Math.min(s.to,t))}return i}}class It{constructor(e,t){this.data=e;this.id=t}token(e,t){let{parser:i}=t.p;Ca(this.data,e,t,this.id,i.data,i.tokenPrecTable)}}It.prototype.contextual=It.prototype.fallback=It.prototype.extend=false;class Js{constructor(e,t,i){this.precTable=t;this.elseToken=i;this.data=typeof e=="string"?bi(e):e}token(e,t){let i=e.pos,s=0;for(;;){let r=e.next<0,o=e.resolveOffset(1,1);Ca(this.data,e,t,0,this.data,this.precTable);if(e.token.value>-1)break;if(this.elseToken==null)return;if(!r)s++;if(o==null)break;e.reset(o,e.token)}if(s){e.reset(i,e.token);e.acceptToken(this.elseToken,s)}}}Js.prototype.contextual=It.prototype.fallback=It.prototype.extend=false;class os{constructor(e,t={}){this.token=e;this.contextual=!!t.contextual;this.fallback=!!t.fallback;this.extend=!!t.extend}}function Ca(n,e,t,i,s,r){let o=0,l=1<0){let O=n[d];if(a.allows(O)&&(e.token.value==-1||e.token.value==O||If(O,e.token.value,s,r))){e.acceptToken(O);break}}let c=e.next,f=0,u=n[o+2];if(e.next<0&&u>f&&n[h+u*3-3]==65535){o=n[h+u*3-1];continue e}for(;f>1;let O=h+d+(d<<1);let p=n[O],m=n[O+1]||65536;if(c=m)f=d+1;else{o=n[O+2];e.advance();continue e}}break}}function Eo(n,e,t){for(let i=e,s;(s=n[i])!=65535;i++)if(s==t)return i-e;return-1}function If(n,e,t,i){let s=Eo(t,i,e);return s<0||Eo(t,i,n)e)&&!i.type.isError)return t<0?Math.max(0,Math.min(i.to-1,e-25)):Math.min(n.length,Math.max(i.from+1,e+25));if(t<0?i.prevSibling():i.nextSibling())break;if(!i.parent())return t<0?0:n.length}}}class Nf{constructor(e,t){this.fragments=e;this.nodeSet=t;this.i=0;this.fragment=null;this.safeFrom=-1;this.safeTo=-1;this.trees=[];this.start=[];this.index=[];this.nextFragment()}nextFragment(){let e=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(e){this.safeFrom=e.openStart?qo(e.tree,e.from+e.offset,1)-e.offset:e.from;this.safeTo=e.openEnd?qo(e.tree,e.to+e.offset,-1)-e.offset:e.to;while(this.trees.length){this.trees.pop();this.start.pop();this.index.pop()}this.trees.push(e.tree);this.start.push(-e.offset);this.index.push(0);this.nextStart=this.safeFrom}else{this.nextStart=1e9}}nodeAt(e){if(ee){this.nextStart=o;return null}if(r instanceof K){if(o==e){if(o=Math.max(this.safeFrom,e)){this.trees.push(r);this.start.push(o);this.index.push(0)}}else{this.index[t]++;this.nextStart=o+r.length}}}}class Gf{constructor(e,t){this.stream=t;this.tokens=[];this.mainToken=null;this.actions=[];this.tokens=e.tokenizers.map(i=>new kn)}getActions(e){let t=0;let i=null;let{parser:s}=e.p,{tokenizers:r}=s;let o=s.stateSlot(e.state,3);let l=e.curContext?e.curContext.hash:0;let a=0;for(let h=0;hf.end+25)a=Math.max(f.lookAhead,a);if(f.value!=0){let u=t;if(f.extended>-1)t=this.addActions(e,f.extended,f.end,t);t=this.addActions(e,f.value,f.end,t);if(!c.extend){i=f;if(t>u)break}}}while(this.actions.length>t)this.actions.pop();if(a)e.setLookAhead(a);if(!i&&e.pos==this.stream.end){i=new kn;i.value=e.p.parser.eofTerm;i.start=i.end=e.pos;t=this.addActions(e,i.value,i.end,t)}this.mainToken=i;return this.actions}getMainToken(e){if(this.mainToken)return this.mainToken;let t=new kn,{pos:i,p:s}=e;t.start=i;t.end=Math.min(i+1,s.stream.end);t.value=i==s.stream.end?s.parser.eofTerm:0;return t}updateCachedToken(e,t,i){let s=this.stream.clipPos(i.pos);t.token(this.stream.reset(s,e),i);if(e.value>-1){let{parser:r}=i.p;for(let o=0;o=0&&i.p.parser.dialect.allows(l>>1)){if((l&1)==0)e.value=l>>1;else e.extended=l>>1;break}}}else{e.value=0;e.end=this.stream.clipPos(s+1)}}putAction(e,t,i,s){for(let r=0;re.bufferLength*4?new Nf(i,e.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let e=this.stacks,t=this.minStackPos;let i=this.stacks=[];let s,r;if(this.bigReductionCount>300&&e.length==1){let[o]=e;while(o.forceReduce()&&o.stack.length&&o.stack[o.stack.length-2]>=this.lastBigReductionStart){}this.bigReductionCount=this.lastBigReductionSize=0}for(let o=0;ot){i.push(l)}else if(this.advanceStack(l,i,e)){continue}else{if(!s){s=[];r=[]}s.push(l);let a=this.tokens.getMainToken(l);r.push(a.value,a.end)}break}}if(!i.length){let o=s&&Jf(s);if(o){if(Ze)console.log("Finish with "+this.stackID(o));return this.stackToTree(o)}if(this.parser.strict){if(Ze&&s)console.log("Stuck with token "+(this.tokens.mainToken?this.parser.getName(this.tokens.mainToken.value):"none"));throw new SyntaxError("No parse at "+t)}if(!this.recovering)this.recovering=5}if(this.recovering&&s){let o=this.stoppedAt!=null&&s[0].pos>this.stoppedAt?s[0]:this.runRecovery(s,r,i);if(o){if(Ze)console.log("Force-finish "+this.stackID(o));return this.stackToTree(o.forceAll())}}if(this.recovering){let o=this.recovering==1?1:this.recovering*3;if(i.length>o){i.sort((l,a)=>a.score-l.score);while(i.length>o)i.pop()}if(i.some(l=>l.reducePos>t))this.recovering--}else if(i.length>1){e:for(let o=0;o500&&h.buffer.length>500){if((l.score-h.score||l.buffer.length-h.buffer.length)>0){i.splice(a--,1)}else{i.splice(o--,1);continue e}}}}if(i.length>12)i.splice(12,i.length-12)}this.minStackPos=i[0].pos;for(let o=1;o ":"";if(this.stoppedAt!=null&&s>this.stoppedAt)return e.forceReduce()?e:null;if(this.fragments){let h=e.curContext&&e.curContext.tracker.strict,c=h?e.curContext.hash:0;for(let f=this.fragments.nodeAt(s);f;){let u=this.parser.nodeSet.types[f.type.id]==f.type?r.getGoto(e.state,f.type.id):-1;if(u>-1&&f.length&&(!h||(f.prop(W.contextHash)||0)==c)){e.useNode(f,u);if(Ze)console.log(o+this.stackID(e)+` (via reuse of ${r.getName(f.type.id)})`);return true}if(!(f instanceof K)||f.children.length==0||f.positions[0]>0)break;let d=f.children[0];if(d instanceof K&&f.positions[0]==0)f=d;else break}}let l=r.stateSlot(e.state,4);if(l>0){e.reduce(l);if(Ze)console.log(o+this.stackID(e)+` (via always-reduce ${r.getName(l&65535)})`);return true}if(e.stack.length>=8400){while(e.stack.length>6e3&&e.forceReduce()){}}let a=this.tokens.getActions(e);for(let h=0;hs)t.push(O);else i.push(O)}return false}advanceFully(e,t){let i=e.pos;for(;;){if(!this.advanceStack(e,null,null))return false;if(e.pos>i){_o(e,t);return true}}}runRecovery(e,t,i){let s=null,r=false;for(let o=0;o ":"";if(l.deadEnd){if(r)continue;r=true;l.restart();if(Ze)console.log(c+this.stackID(l)+" (restarted)");let d=this.advanceFully(l,i);if(d)continue}let f=l.split(),u=c;for(let d=0;f.forceReduce()&&d<10;d++){if(Ze)console.log(u+this.stackID(f)+" (via force-reduce)");let O=this.advanceFully(f,i);if(O)break;if(Ze)u=this.stackID(f)+" -> "}for(let d of l.recoverByInsert(a)){if(Ze)console.log(c+this.stackID(d)+" (via recover-insert)");this.advanceFully(d,i)}if(this.stream.end>l.pos){if(h==l.pos){h++;a=0}l.recoverByDelete(a,h);if(Ze)console.log(c+this.stackID(l)+` (via recover-delete ${this.parser.getName(a)})`);_o(l,i)}else if(!s||s.scoren;class Kf{constructor(e){this.start=e.start;this.shift=e.shift||Qs;this.reduce=e.reduce||Qs;this.reuse=e.reuse||Qs;this.hash=e.hash||(()=>0);this.strict=e.strict!==false}}class Dn extends Aa{constructor(e){super();this.wrappers=[];if(e.version!=14)throw new RangeError(`Parser version (${e.version}) doesn't match runtime version (${14})`);let t=e.nodeNames.split(" ");this.minRepeatTerm=t.length;for(let l=0;le.topRules[l][1]);let s=[];for(let l=0;l=0){r(c,a,l[h++])}else{let f=l[h+-c];for(let u=-c;u>0;u--)r(l[h++],a,f);h++}}}this.nodeSet=new Ir(t.map((l,a)=>$e.define({name:a>=this.minRepeatTerm?void 0:l,id:a,props:s[a],top:i.indexOf(a)>-1,error:a==0,skipped:e.skippedNodes&&e.skippedNodes.indexOf(a)>-1})));if(e.propSources)this.nodeSet=this.nodeSet.extend(...e.propSources);this.strict=false;this.bufferLength=va;let o=bi(e.tokenData);this.context=e.context;this.specializerSpecs=e.specialized||[];this.specialized=new Uint16Array(this.specializerSpecs.length);for(let l=0;ltypeof l=="number"?new It(o,l):l);this.topRules=e.topRules;this.dialects=e.dialects||{};this.dynamicPrecedences=e.dynamicPrecedences||null;this.tokenPrecTable=e.tokenPrec;this.termNames=e.termNames||null;this.maxNode=this.nodeSet.types.length-1;this.dialect=this.parseDialect();this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(e,t,i){let s=new Ff(this,e,t,i);for(let r of this.wrappers)s=r(s,e,t,i);return s}getGoto(e,t,i=false){let s=this.goto;if(t>=s[0])return-1;for(let r=s[t+1];;){let o=s[r++],l=o&1;let a=s[r++];if(l&&i)return a;for(let h=r+(o>>1);r0}validAction(e,t){return!!this.allActions(e,i=>i==t?true:null)}allActions(e,t){let i=this.stateSlot(e,4);let s=i?t(i):void 0;for(let r=this.stateSlot(e,1);s==null;r+=3){if(this.data[r]==65535){if(this.data[r+1]==1)r=st(this.data,r+2);else break}s=t(st(this.data,r+1))}return s}nextStates(e){let t=[];for(let i=this.stateSlot(e,1);;i+=3){if(this.data[i]==65535){if(this.data[i+1]==1)i=st(this.data,i+2);else break}if((this.data[i+2]&65536>>16)==0){let s=this.data[i+1];if(!t.some((r,o)=>o&1&&r==s))t.push(this.data[i],s)}}return t}configure(e){let t=Object.assign(Object.create(Dn.prototype),this);if(e.props)t.nodeSet=this.nodeSet.extend(...e.props);if(e.top){let i=this.topRules[e.top];if(!i)throw new RangeError(`Invalid top rule name ${e.top}`);t.top=i}if(e.tokenizers)t.tokenizers=this.tokenizers.map(i=>{let s=e.tokenizers.find(r=>r.from==i);return s?s.to:i});if(e.specializers){t.specializers=this.specializers.slice();t.specializerSpecs=this.specializerSpecs.map((i,s)=>{let r=e.specializers.find(l=>l.from==i.external);if(!r)return i;let o=Object.assign(Object.assign({},i),{external:r.to});t.specializers[s]=zo(o);return o})}if(e.contextTracker)t.context=e.contextTracker;if(e.dialect)t.dialect=this.parseDialect(e.dialect);if(e.strict!=null)t.strict=e.strict;if(e.wrap)t.wrappers=t.wrappers.concat(e.wrap);if(e.bufferLength!=null)t.bufferLength=e.bufferLength;return t}hasWrappers(){return this.wrappers.length>0}getName(e){return this.termNames?this.termNames[e]:String(e<=this.maxNode&&this.nodeSet.types[e].name||e)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(e){let t=this.dynamicPrecedences;return t==null?0:t[e]||0}parseDialect(e){let t=Object.keys(this.dialects),i=t.map(()=>false);if(e)for(let r of e.split(" ")){let o=t.indexOf(r);if(o>=0)i[o]=true}let s=null;for(let r=0;ri)&&t.p.parser.stateFlag(t.state,2)&&(!e||e.scoren.external(t,i)<<1|e}return n.get}let eu=0;class Ge{constructor(e,t,i){this.set=e;this.base=t;this.modified=i;this.id=eu++}static define(e){if(e===null||e===void 0?void 0:e.base)throw new Error("Can not derive from a modified tag");let t=new Ge([],null,[]);t.set.push(t);if(e)for(let i of e.set)t.set.push(i);return t}static defineModifier(){let e=new Yn;return t=>{if(t.modified.indexOf(e)>-1)return t;return Yn.get(t.base||t,t.modified.concat(e).sort((i,s)=>i.id-s.id))}}}let tu=0;class Yn{constructor(){this.instances=[];this.id=tu++}static get(e,t){if(!t.length)return e;let i=t[0].instances.find(l=>l.base==e&&iu(t,l.modified));if(i)return i;let s=[],r=new Ge(s,e,t);for(let l of t)l.instances.push(r);let o=nu(t);for(let l of e.set)if(!l.modified.length)for(let a of o)s.push(Yn.get(l,a));return r}}function iu(n,e){return n.length==e.length&&n.every((t,i)=>t==e[i])}function nu(n){let e=[[]];for(let t=0;ti.length-t.length)}function Ma(n){let e=Object.create(null);for(let t in n){let i=n[t];if(!Array.isArray(i))i=[i];for(let s of t.split(" "))if(s){let r=[],o=2,l=s;for(let f=0;;){if(l=="..."&&f>0&&f+3==s.length){o=1;break}let u=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(l);if(!u)throw new RangeError("Invalid path: "+s);r.push(u[0]=="*"?"":u[0][0]=='"'?JSON.parse(u[0]):u[0]);f+=u[0].length;if(f==s.length)break;let d=s[f++];if(f==s.length&&d=="!"){o=0;break}if(d!="/")throw new RangeError("Invalid path: "+s);l=s.slice(f)}let a=r.length-1,h=r[a];if(!h)throw new RangeError("Invalid path: "+s);let c=new En(i,o,a>0?r.slice(0,a):null);e[h]=c.sort(e[h])}}return Wa.add(e)}const Wa=new W;class En{constructor(e,t,i,s){this.tags=e;this.mode=t;this.context=i;this.next=s}get opaque(){return this.mode==0}get inherit(){return this.mode==1}sort(e){if(!e||e.depth{let o=s;for(let l of r){for(let a of l.set){let h=t[a.id];if(h){o=o?o+" "+h:h;break}}}return o},scope:i}}function su(n,e){let t=null;for(let i of n){let s=i.style(e);if(s)t=t?t+" "+s:s}return t}function ru(n,e,t,i=0,s=n.length){let r=new ou(i,Array.isArray(e)?e:[e],t);r.highlightRange(n.cursor(),i,s,"",r.highlighters);r.flush(s)}class ou{constructor(e,t,i){this.at=e;this.highlighters=t;this.span=i;this.class=""}startSpan(e,t){if(t!=this.class){this.flush(e);if(e>this.at)this.at=e;this.class=t}}flush(e){if(e>this.at&&this.class)this.span(this.at,e,this.class)}highlightRange(e,t,i,s,r){let{type:o,from:l,to:a}=e;if(l>=i||a<=t)return;if(o.isTop)r=this.highlighters.filter(d=>!d.scope||d.scope(o));let h=s;let c=lu(e)||En.empty;let f=su(r,c.tags);if(f){if(h)h+=" ";h+=f;if(c.mode==1)s+=(s?" ":"")+f}this.startSpan(Math.max(t,l),h);if(c.opaque)return;let u=e.tree&&e.tree.prop(W.mounted);if(u&&u.overlay){let d=e.node.enter(u.overlay[0].from+l,1);let O=this.highlighters.filter(m=>!m.scope||m.scope(u.tree.type));let p=e.firstChild();for(let m=0,b=l;;m++){let S=m=k||!e.nextSibling())break}}if(!S||k>i)break;b=S.to+l;if(b>t){this.highlightRange(d.cursor(),Math.max(t,S.from+l),Math.min(i,b),"",O);this.startSpan(Math.min(i,b),h)}}if(p)e.parent()}else if(e.firstChild()){if(u)s="";do{if(e.to<=t)continue;if(e.from>=i)break;this.highlightRange(e,t,i,s,r);this.startSpan(Math.min(i,e.to),h)}while(e.nextSibling());e.parent()}}}function lu(n){let e=n.type.prop(Wa);while(e&&e.context&&!n.matchContext(e.context))e=e.next;return e||null}const Q=Ge.define;const tn=Q();const ct=Q();const jo=Q(ct);const Vo=Q(ct);const ft=Q();const nn=Q(ft);const ks=Q(ft);const Ne=Q();const Zt=Q(Ne);const Be=Q();const Ue=Q();const er=Q();const ci=Q(er);const sn=Q();const g={comment:tn,lineComment:Q(tn),blockComment:Q(tn),docComment:Q(tn),name:ct,variableName:Q(ct),typeName:jo,tagName:Q(jo),propertyName:Vo,attributeName:Q(Vo),className:Q(ct),labelName:Q(ct),namespace:Q(ct),macroName:Q(ct),literal:ft,string:nn,docString:Q(nn),character:Q(nn),attributeValue:Q(nn),number:ks,integer:Q(ks),float:Q(ks),bool:Q(ft),regexp:Q(ft),escape:Q(ft),color:Q(ft),url:Q(ft),keyword:Be,self:Q(Be),null:Q(Be),atom:Q(Be),unit:Q(Be),modifier:Q(Be),operatorKeyword:Q(Be),controlKeyword:Q(Be),definitionKeyword:Q(Be),moduleKeyword:Q(Be),operator:Ue,derefOperator:Q(Ue),arithmeticOperator:Q(Ue),logicOperator:Q(Ue),bitwiseOperator:Q(Ue),compareOperator:Q(Ue),updateOperator:Q(Ue),definitionOperator:Q(Ue),typeOperator:Q(Ue),controlOperator:Q(Ue),punctuation:er,separator:Q(er),bracket:ci,angleBracket:Q(ci),squareBracket:Q(ci),paren:Q(ci),brace:Q(ci),content:Ne,heading:Zt,heading1:Q(Zt),heading2:Q(Zt),heading3:Q(Zt),heading4:Q(Zt),heading5:Q(Zt),heading6:Q(Zt),contentSeparator:Q(Ne),list:Q(Ne),quote:Q(Ne),emphasis:Q(Ne),strong:Q(Ne),link:Q(Ne),monospace:Q(Ne),strikethrough:Q(Ne),inserted:Q(),deleted:Q(),changed:Q(),invalid:Q(),meta:sn,documentMeta:Q(sn),annotation:Q(sn),processingInstruction:Q(sn),definition:Ge.defineModifier(),constant:Ge.defineModifier(),function:Ge.defineModifier(),standard:Ge.defineModifier(),local:Ge.defineModifier(),special:Ge.defineModifier()};Xa([{tag:g.link,class:"tok-link"},{tag:g.heading,class:"tok-heading"},{tag:g.emphasis,class:"tok-emphasis"},{tag:g.strong,class:"tok-strong"},{tag:g.keyword,class:"tok-keyword"},{tag:g.atom,class:"tok-atom"},{tag:g.bool,class:"tok-bool"},{tag:g.url,class:"tok-url"},{tag:g.labelName,class:"tok-labelName"},{tag:g.inserted,class:"tok-inserted"},{tag:g.deleted,class:"tok-deleted"},{tag:g.literal,class:"tok-literal"},{tag:g.string,class:"tok-string"},{tag:g.number,class:"tok-number"},{tag:[g.regexp,g.escape,g.special(g.string)],class:"tok-string2"},{tag:g.variableName,class:"tok-variableName"},{tag:g.local(g.variableName),class:"tok-variableName tok-local"},{tag:g.definition(g.variableName),class:"tok-variableName tok-definition"},{tag:g.special(g.variableName),class:"tok-variableName2"},{tag:g.definition(g.propertyName),class:"tok-propertyName tok-definition"},{tag:g.typeName,class:"tok-typeName"},{tag:g.namespace,class:"tok-namespace"},{tag:g.className,class:"tok-className"},{tag:g.macroName,class:"tok-macroName"},{tag:g.propertyName,class:"tok-propertyName"},{tag:g.operator,class:"tok-operator"},{tag:g.comment,class:"tok-comment"},{tag:g.meta,class:"tok-meta"},{tag:g.invalid,class:"tok-invalid"},{tag:g.punctuation,class:"tok-punctuation"}]);const au=312;const Lo=1;const hu=2;const cu=3;const fu=4;const uu=313;const du=315;const Ou=316;const pu=5;const mu=6;const gu=0;const tr=[9,10,11,12,13,32,133,160,5760,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8232,8233,8239,8287,12288];const Da=125;const bu=59;const ir=47;const yu=42;const xu=43;const Su=45;const wu=60;const Qu=44;const ku=63;const Pu=46;const $u=new Kf({start:false,shift(n,e){return e==pu||e==mu||e==du?n:e==Ou},strict:false});const vu=new os((n,e)=>{let{next:t}=n;if(t==Da||t==-1||e.context)n.acceptToken(uu)},{contextual:true,fallback:true});const Zu=new os((n,e)=>{let{next:t}=n,i;if(tr.indexOf(t)>-1)return;if(t==ir&&((i=n.peek(1))==ir||i==yu))return;if(t!=Da&&t!=bu&&t!=-1&&!e.context)n.acceptToken(au)},{contextual:true});const Ru=new os((n,e)=>{let{next:t}=n;if(t==xu||t==Su){n.advance();if(t==n.next){n.advance();let i=!e.context&&e.canShift(Lo);n.acceptToken(i?Lo:hu)}}else if(t==ku&&n.peek(1)==Pu){n.advance();n.advance();if(n.next<48||n.next>57)n.acceptToken(cu)}},{contextual:true});function Ps(n,e){return n>=65&&n<=90||n>=97&&n<=122||n==95||n>=192||!e&&n>=48&&n<=57}const Tu=new os((n,e)=>{if(n.next!=wu||!e.dialectEnabled(gu))return;n.advance();if(n.next==ir)return;let t=0;while(tr.indexOf(n.next)>-1){n.advance();t++}if(Ps(n.next,true)){n.advance();t++;while(Ps(n.next,false)){n.advance();t++}while(tr.indexOf(n.next)>-1){n.advance();t++}if(n.next==Qu)return;for(let i=0;;i++){if(i==7){if(!Ps(n.next,true))return;break}if(n.next!="extends".charCodeAt(i))break;n.advance();t++}}n.acceptToken(fu,-t)});const Au=Ma({"get set async static":g.modifier,"for while do if else switch try catch finally return throw break continue default case":g.controlKeyword,"in of await yield void typeof delete instanceof":g.operatorKeyword,"let var const using function class extends":g.definitionKeyword,"import export from":g.moduleKeyword,"with debugger as new":g.keyword,TemplateString:g.special(g.string),super:g.atom,BooleanLiteral:g.bool,this:g.self,null:g.null,Star:g.modifier,VariableName:g.variableName,"CallExpression/VariableName TaggedTemplateExpression/VariableName":g.function(g.variableName),VariableDefinition:g.definition(g.variableName),Label:g.labelName,PropertyName:g.propertyName,PrivatePropertyName:g.special(g.propertyName),"CallExpression/MemberExpression/PropertyName":g.function(g.propertyName),"FunctionDeclaration/VariableDefinition":g.function(g.definition(g.variableName)),"ClassDeclaration/VariableDefinition":g.definition(g.className),PropertyDefinition:g.definition(g.propertyName),PrivatePropertyDefinition:g.definition(g.special(g.propertyName)),UpdateOp:g.updateOperator,"LineComment Hashbang":g.lineComment,BlockComment:g.blockComment,Number:g.number,String:g.string,Escape:g.escape,ArithOp:g.arithmeticOperator,LogicOp:g.logicOperator,BitOp:g.bitwiseOperator,CompareOp:g.compareOperator,RegExp:g.regexp,Equals:g.definitionOperator,Arrow:g.function(g.punctuation),": Spread":g.punctuation,"( )":g.paren,"[ ]":g.squareBracket,"{ }":g.brace,"InterpolationStart InterpolationEnd":g.special(g.brace),".":g.derefOperator,", ;":g.separator,"@":g.meta,TypeName:g.typeName,TypeDefinition:g.definition(g.typeName),"type enum interface implements namespace module declare":g.definitionKeyword,"abstract global Privacy readonly override":g.modifier,"is keyof unique infer":g.operatorKeyword,JSXAttributeValue:g.attributeValue,JSXText:g.content,"JSXStartTag JSXStartCloseTag JSXSelfCloseEndTag JSXEndTag":g.angleBracket,"JSXIdentifier JSXNameSpacedName":g.tagName,"JSXAttribute/JSXIdentifier JSXAttribute/JSXNameSpacedName":g.attributeName,"JSXBuiltin/JSXIdentifier":g.standard(g.tagName)});const Cu={__proto__:null,export:20,as:25,from:33,default:36,async:41,function:42,extends:54,this:58,true:66,false:66,null:78,void:82,typeof:86,super:102,new:136,delete:148,yield:157,await:161,class:166,public:229,private:229,protected:229,readonly:231,instanceof:250,satisfies:253,in:254,const:256,import:290,keyof:345,unique:349,infer:355,is:391,abstract:411,implements:413,type:415,let:418,var:420,using:423,interface:429,enum:433,namespace:439,module:441,declare:445,global:449,for:468,of:477,while:480,with:484,do:488,if:492,else:494,switch:498,case:504,try:510,catch:514,finally:518,return:522,throw:526,break:530,continue:534,debugger:538};const Mu={__proto__:null,async:123,get:125,set:127,declare:189,public:191,private:191,protected:191,static:193,abstract:195,override:197,readonly:203,accessor:205,new:395};const Wu={__proto__:null,"<":187};const Xu=Dn.deserialize({version:14,states:"$=dO%TQ^OOO%[Q^OOO'_Q`OOP(lOWOOO*zQ?NdO'#CiO+RO!bO'#CjO+aO#tO'#CjO+oO!0LbO'#D^O.QQ^O'#DdO.bQ^O'#DoO%[Q^O'#DwO0fQ^O'#EPOOQ?Mr'#EX'#EXO1PQWO'#EUOOQO'#Em'#EmOOQO'#Ih'#IhO1XQWO'#GpO1dQWO'#ElO1iQWO'#ElO3hQ?NdO'#JmO6[Q?NdO'#JnO6uQWO'#F[O6zQ&jO'#FsOOQ?Mr'#Fe'#FeO7VO,YO'#FeO7eQ7[O'#FzO9RQWO'#FyOOQ?Mr'#Jn'#JnOOQ?Mp'#Jm'#JmO9WQWO'#GtOOQU'#KZ'#KZO9cQWO'#IUO9hQ?MxO'#IVOOQU'#JZ'#JZOOQU'#IZ'#IZQ`Q^OOO`Q^OOO9pQMnO'#DsO9wQ^O'#D{O:OQ^O'#D}O9^QWO'#GpO:VQ7[O'#CoO:eQWO'#EkO:pQWO'#EvO:uQ7[O'#FdO;dQWO'#GpOOQO'#K['#K[O;iQWO'#K[O;wQWO'#GxO;wQWO'#GyO;wQWO'#G{O9^QWO'#HOOVQWO'#CeO>gQWO'#H_O>oQWO'#HeO>oQWO'#HgO`Q^O'#HiO>oQWO'#HkO>oQWO'#HnO>tQWO'#HtO>yQ?MyO'#HzO%[Q^O'#H|O?UQ?MyO'#IOO?aQ?MyO'#IQO9hQ?MxO'#ISO?lQ?NdO'#CiO@nQ`O'#DiQOQWOOO%[Q^O'#D}OAUQWO'#EQO:VQ7[O'#EkOAaQWO'#EkOAlQpO'#FdOOQU'#Cg'#CgOOQ?Mp'#Dn'#DnOOQ?Mp'#Jq'#JqO%[Q^O'#JqOOQO'#Jt'#JtOOQO'#Id'#IdOBlQ`O'#EdOOQ?Mp'#Ec'#EcOOQ?Mp'#Jx'#JxOChQ?NQO'#EdOCrQ`O'#ETOOQO'#Js'#JsODWQ`O'#JtOEeQ`O'#ETOCrQ`O'#EdPErO#@ItO'#CbPOOO)CDx)CDxOOOO'#I['#I[OE}O!bO,59UOOQ?Mr,59U,59UOOOO'#I]'#I]OF]O#tO,59UO%[Q^O'#D`OOOO'#I_'#I_OFkO!0LbO,59xOOQ?Mr,59x,59xOFyQ^O'#I`OG^QWO'#JoOI]QrO'#JoO+}Q^O'#JoOIdQWO,5:OOIzQWO'#EmOJXQWO'#KOOJdQWO'#J}OJdQWO'#J}OJlQWO,5;ZOJqQWO'#J|OOQ?Mv,5:Z,5:ZOJxQ^O,5:ZOLvQ?NdO,5:cOMgQWO,5:kONQQ?MxO'#J{ONXQWO'#JzO9WQWO'#JzONmQWO'#JzONuQWO,5;YONzQWO'#JzO!#PQrO'#JnOOQ?Mr'#Ci'#CiO%[Q^O'#EPO!#oQrO,5:pOOQQ'#Ju'#JuOOQO-EpOOQU'#Jc'#JcOOQU,5>q,5>qOOQU-EtQWO'#HTO9^QWO'#HVO!DgQWO'#HVO:VQ7[O'#HXO!DlQWO'#HXOOQU,5=m,5=mO!DqQWO'#HYO!ESQWO'#CoO!EXQWO,59PO!EcQWO,59PO!GhQ^O,59POOQU,59P,59PO!GxQ?MxO,59PO%[Q^O,59PO!JTQ^O'#HaOOQU'#Hb'#HbOOQU'#Hc'#HcO`Q^O,5=yO!JkQWO,5=yO`Q^O,5>PO`Q^O,5>RO!JpQWO,5>TO`Q^O,5>VO!JuQWO,5>YO!JzQ^O,5>`OOQU,5>f,5>fO%[Q^O,5>fO9hQ?MxO,5>hOOQU,5>j,5>jO# UQWO,5>jOOQU,5>l,5>lO# UQWO,5>lOOQU,5>n,5>nO# rQ`O'#D[O%[Q^O'#JqO# |Q`O'#JqO#!kQ`O'#DjO#!|Q`O'#DjO#%_Q^O'#DjO#%fQWO'#JpO#%nQWO,5:TO#%sQWO'#EqO#&RQWO'#KPO#&ZQWO,5;[O#&`Q`O'#DjO#&mQ`O'#ESOOQ?Mr,5:l,5:lO%[Q^O,5:lO#&tQWO,5:lO>tQWO,5;VO!A}Q`O,5;VO!BVQ7[O,5;VO:VQ7[O,5;VO#&|QWO,5@]O#'RQ(CYO,5:pOOQO-EzO+}Q^O,5>zOOQO,5?Q,5?QO#*ZQ^O'#I`OOQO-E<^-E<^O#*hQWO,5@ZO#*pQrO,5@ZO#*wQWO,5@iOOQ?Mr1G/j1G/jO%[Q^O,5@jO#+PQWO'#IfOOQO-EoQWO1G3oO$4tQ^O1G3qO$8xQ^O'#HpOOQU1G3t1G3tO$9VQWO'#HvO>tQWO'#HxOOQU1G3z1G3zO$9_Q^O1G3zO9hQ?MxO1G4QOOQU1G4S1G4SOOQ?Mp'#G]'#G]O9hQ?MxO1G4UO9hQ?MxO1G4WO$=fQWO,5@]O!(oQ^O,5;]O9WQWO,5;]O>tQWO,5:UO!(oQ^O,5:UO!A}Q`O,5:UO$=kQ07bO,5:UOOQO,5;],5;]O$=uQ`O'#IaO$>]QWO,5@[OOQ?Mr1G/o1G/oO$>eQ`O'#IgO$>oQWO,5@kOOQ?Mp1G0v1G0vO#!|Q`O,5:UOOQO'#Ic'#IcO$>wQ`O,5:nOOQ?Mv,5:n,5:nO#&wQWO1G0WOOQ?Mr1G0W1G0WO%[Q^O1G0WOOQ?Mr1G0q1G0qO>tQWO1G0qO!A}Q`O1G0qO!BVQ7[O1G0qOOQ?Mp1G5w1G5wO!ArQ?MxO1G0ZOOQO1G0j1G0jO%[Q^O1G0jO$?OQ?MxO1G0jO$?ZQ?MxO1G0jO!A}Q`O1G0ZOCrQ`O1G0ZO$?iQ?MxO1G0jOOQO1G0Z1G0ZO$?}Q?NdO1G0jPOOO-EzO$@kQWO1G5uO$@sQWO1G6TO$@{QrO1G6UO9WQWO,5?QO$AVQ?NdO1G6RO%[Q^O1G6RO$AgQ?MxO1G6RO$AxQWO1G6QO$AxQWO1G6QO9WQWO1G6QO$BQQWO,5?TO9WQWO,5?TOOQO,5?T,5?TO$BfQWO,5?TO$)nQWO,5?TOOQO-E[OOQU,5>[,5>[O%[Q^O'#HqO%:PQWO'#HsOOQU,5>b,5>bO9WQWO,5>bOOQU,5>d,5>dOOQU7+)f7+)fOOQU7+)l7+)lOOQU7+)p7+)pOOQU7+)r7+)rO%:UQ`O1G5wO%:jQ07bO1G0wO%:tQWO1G0wOOQO1G/p1G/pO%;PQ07bO1G/pO>tQWO1G/pO!(oQ^O'#DjOOQO,5>{,5>{OOQO-E<_-E<_OOQO,5?R,5?ROOQO-EtQWO7+&]O!A}Q`O7+&]OOQO7+%u7+%uO$?}Q?NdO7+&UOOQO7+&U7+&UO%[Q^O7+&UO%;ZQ?MxO7+&UO!ArQ?MxO7+%uO!A}Q`O7+%uO%;fQ?MxO7+&UO%;tQ?NdO7++mO%[Q^O7++mO%|O%[Q^O,5>|OOQO-E<`-E<`O%HZQWO1G5xOOQ?Mr<]OOQU,5>_,5>_O&;mQWO1G3|O9WQWO7+&cO!(oQ^O7+&cOOQO7+%[7+%[O&;rQ07bO1G6UO>tQWO7+%[OOQ?Mr<tQWO<tQWO7+)hO'){QWO<{AN>{O%[Q^OAN?[OOQO<]Q7[OG27QOOQO<mQ07bO7+*jOOQUG27iG27iO&:OQWOG27iO!&_Q7[OG27iOOQUG27kG27kO9hQ?MxOG27kOOQUG27sG27sO'>wQ07bOG25TOOQOLD*bLD*bOOQU!$(!Y!$(!YO#&wQWO!$(!YO!&_Q7[O!$(!YO'?RQ?NdOG27QOOQ?MpG26uG26uOOQULD-TLD-TO&:OQWOLD-TOOQULD-VLD-VOOQU!)9Et!)9EtO#&wQWO!)9EtOOQU!$(!o!$(!oOOQU!.K;`!.K;`O'AaQ07bOG27QO!(oQ^O'#DwO1PQWO'#EUO'CSQrO'#JmO'CZQMnO'#DsO'CbQ^O'#D{O'CiQrO'#CiO'FPQrO'#CiO!(oQ^O'#D}O'FaQ^O,5;WO!(oQ^O,5;bO!(oQ^O,5;bO!(oQ^O,5;bO!(oQ^O,5;bO!(oQ^O,5;bO!(oQ^O,5;bO!(oQ^O,5;bO!(oQ^O,5;bO!(oQ^O,5;bO!(oQ^O,5;bO!(oQ^O,5;bO!(oQ^O'#IlO'HdQWO,5kOh%WOk+aO![']O%f+`O~O!d+cOa(WX![(WX'u(WX!Y(WX~Oa%lO![XO'u%lO~Oh%WO!i%cO~Oh%WO!i%cO(O%eO~O!d#vO#h(tO~Ob+nO%g+oO(O+kO(QTO(TUO!Z)TP~O!Y+pO`)SX~O[+tO~O`+uO~O![%}O(O%eO(P!lO`)SP~Oh%WO#]+zO~Oh%WOk+}O![$}O~O![,PO~O},RO![XO~O%k%tO~O!u,WO~Oe,]O~Ob,^O(O#nO(QTO(TUO!Z)RP~Oe%{O~O%g!QO(O&WO~P=RO[,cO`,bO~OPYOQYOSfOdzOeyOmkOoYOpkOqkOwkOyYO{YO!PWO!TkO!UkO!fuO!iZO!lYO!mYO!nYO!pvO!uxO!y]O%e}O(QTO(TUO([VO(j[O(yiO~O![!eO!r!gO$V!kO(O!dO~P!EkO`,bOa%lO'u%lO~OPYOQYOSfOd!jOe!iOmkOoYOpkOqkOwkOyYO{YO!PWO!TkO!UkO![!eO!fuO!iZO!lYO!mYO!nYO!pvO!u!hO$V!kO(O!dO(QTO(TUO([VO(j[O(yiO~Oa,hO!rwO#t!OO%i!OO%j!OO%k!OO~P!HTO!i&lO~O&Y,nO~O![,pO~O&k,rO&m,sOP&haQ&haS&haY&haa&had&hae&ham&hao&hap&haq&haw&hay&ha{&ha!P&ha!T&ha!U&ha![&ha!f&ha!i&ha!l&ha!m&ha!n&ha!p&ha!r&ha!u&ha!y&ha#t&ha$V&ha%e&ha%g&ha%i&ha%j&ha%k&ha%n&ha%p&ha%s&ha%t&ha%v&ha&S&ha&Y&ha&[&ha&^&ha&`&ha&c&ha&i&ha&o&ha&q&ha&s&ha&u&ha&w&ha's&ha(O&ha(Q&ha(T&ha([&ha(j&ha(y&ha!Z&ha&a&hab&ha&f&ha~O(O,xO~Oh!bX!Y!OX!Z!OX!d!OX!d!bX!i!bX#]!OX~O!Y!bX!Z!bX~P# ZO!d,}O#],|Oh(eX!Y#eX!Y(eX!Z#eX!Z(eX!d(eX!i(eX~Oh%WO!d-PO!i%cO!Y!^X!Z!^X~Op!nO!P!oO(QTO(TUO(`!mO~OP:kOQ:kOSfOdkOg'XX!Y'XX~P!+hO!Y.wOg(ka~OSfO![3uO$c3vO~O!Z3zO~Os3{O~P#.aOa$lq!Y$lq'u$lq's$lq!V$lq!h$lqs$lq![$lq%f$lq!d$lq~P!9mO!V3|O~P#.aO}){O!P)|O(u%QOk'ea(t'ea!Y'ea#]'ea~Og'ea#}'ea~P%+]O}){O!P)|Ok'ga(t'ga(u'ga!Y'ga#]'ga~Og'ga#}'ga~P%,OO(m$ZO~P#.aO!VfX!V$xX!YfX!Y$xX!d%PX#]fX~P!/gO(O;lO~P!1_OmkO(O4OO~P.iO!P%fO!X4QO![%gO(O%eO!Y'aX!h'aX~O!Y/hO!h(za~O!Y/hO!d#vO!h(za~O!Y/hO!d#vO(m'mO!h(za~Og$zi!Y$zi#]$zi#}$zi~P!0pO!X4YO!V'cX!Y'cX~P!3^O!Y/pO!V({a~O!Y/pO!V({a~P#.aO!d#vO#s4bO~Oo4eO!d#vO(m'mO~O(t%OOk%^i}%^i!P%^i(u%^i!Y%^i#]%^i~Og%^i#}%^i~P%0^O(u%QOk%`i}%`i!P%`i(t%`i!Y%`i#]%`i~Og%`i#}%`i~P%1POg(Yi!Y(Yi~P!0pO#]4lOg(Yi!Y(Yi~P!0pO!h4oO~Oa$mq!Y$mq'u$mq's$mq!V$mq!h$mqs$mq![$mq%f$mq!d$mq~P!9mO!V4sO~O!Y4tO![(|X~P#.aOa$xX![$xX%Z]X'u$xX!Y$xX~P!/gO%Z4wOalXklX}lX!PlX![lX'ulX(tlX(ulX!YlX~O%Z4wO~Ob4}O%g5OO(O+kO(QTO(TUO!Y'pX!Z'pX~O!Y0wO!Z)Ta~O[5SO~O`5TO~Oa%lO'u%lO~P#.aO![$}O~P#.aO!Y5]O#]5_O!Z)QX~O!Z5`O~Op!nO!P5aO!_!yO!`!vO!a!vO!y:lO#Q!pO#R!pO#S!pO#T!pO#U!pO#X5fO#Y!zO(P!lO(QTO(TUO(`!mO(j!sO~O!Z5eO~P%6ZOk5kO![1aO%f5jO~Oh%WOk5kO![1aO%f5jO~Ob5rO(O#nO(QTO(TUO!Y'oX!Z'oX~O!Y1lO!Z)Ra~O(QTO(TUO(`5tO~O`5xO~O#s5{O&W5|O~PMlO!h5}O~P%[Oa6PO~Oa6PO~P%[Ob2SO!Z6UO&f2RO~P`O!d6WO~O!d6YOh(ei!Y(ei!Z(ei!d(ei!i(ei~O!Y#ei!Z#ei~P#D_O#]6ZO!Y#ei!Z#ei~O!Y!^i!Z!^i~P#D_Oa%lO#]6dO'u%lO~Oa%lO!d#vO#]6dO'u%lO~O!Y(oq!h(oqa(oq'u(oq~P!9mO!Y(fO!h(nq~O!P%fO![%gO#g6kO(O%eO~O![']O%f6nO~Ok6rO![']O%f6nO~O#h'eaP'eaR'ea['eaa'eao'ea!i'ea!m'ea#O'ea#k'ea#l'ea#m'ea#n'ea#o'ea#p'ea#q'ea#r'ea#s'ea#u'ea#w'ea#y'ea#z'ea'u'ea(['ea(m'ea!h'ea!V'ea's'eas'ea!['ea%f'ea!d'ea~P%+]O#h'gaP'gaR'ga['gaa'gao'ga!i'ga!m'ga#O'ga#k'ga#l'ga#m'ga#n'ga#o'ga#p'ga#q'ga#r'ga#s'ga#u'ga#w'ga#y'ga#z'ga'u'ga(['ga(m'ga!h'ga!V'ga's'gas'ga!['ga%f'ga!d'ga~P%,OO#h$ziP$ziR$zi[$zia$zio$zi!Y$zi!i$zi!m$zi#O$zi#k$zi#l$zi#m$zi#n$zi#o$zi#p$zi#q$zi#r$zi#s$zi#u$zi#w$zi#y$zi#z$zi'u$zi([$zi(m$zi!h$zi!V$zi's$zi#]$zis$zi![$zi%f$zi!d$zi~P#.aO#h%^iP%^iR%^i[%^ia%^io%^i!i%^i!m%^i#O%^i#k%^i#l%^i#m%^i#n%^i#o%^i#p%^i#q%^i#r%^i#s%^i#u%^i#w%^i#y%^i#z%^i'u%^i([%^i(m%^i!h%^i!V%^i's%^is%^i![%^i%f%^i!d%^i~P%0^O#h%`iP%`iR%`i[%`ia%`io%`i!i%`i!m%`i#O%`i#k%`i#l%`i#m%`i#n%`i#o%`i#p%`i#q%`i#r%`i#s%`i#u%`i#w%`i#y%`i#z%`i'u%`i([%`i(m%`i!h%`i!V%`i's%`is%`i![%`i%f%`i!d%`i~P%1PO!Y'Ua!h'Ua~P!9mO!Y.lO!h(fi~O#}#`i!Y#`i!Z#`i~P#D_OP$]OR#zO}#yO!P#{O!i#xO!m$]O([VO[#jio#ji#O#ji#l#ji#m#ji#n#ji#o#ji#p#ji#q#ji#r#ji#s#ji#u#ji#w#ji#y#ji#z#ji#}#ji(m#ji(t#ji(u#ji!Y#ji!Z#ji~O#k#ji~P%HpO#k:tO~P%HpOP$]OR#zO}#yO!P#{O!i#xO!m$]O#k:tO#l:uO#m:uO#n:uO([VO[#ji#O#ji#o#ji#p#ji#q#ji#r#ji#s#ji#u#ji#w#ji#y#ji#z#ji#}#ji(m#ji(t#ji(u#ji!Y#ji!Z#ji~Oo#ji~P%JxOo:vO~P%JxOP$]OR#zOo:vO}#yO!P#{O!i#xO!m$]O#k:tO#l:uO#m:uO#n:uO#o:wO([VO#u#ji#w#ji#y#ji#z#ji#}#ji(m#ji(t#ji(u#ji!Y#ji!Z#ji~O[#ji#O#ji#p#ji#q#ji#r#ji#s#ji~P%MQO[;SO#O:xO#p:xO#q:xO#r;RO#s:xO~P%MQOP$]OR#zO[;SOo:vO}#yO!P#{O!i#xO!m$]O#O:xO#k:tO#l:uO#m:uO#n:uO#o:wO#p:xO#q:xO#r;RO#s:xO#u:yO([VO(u#}O#y#ji#z#ji#}#ji(m#ji(t#ji!Y#ji!Z#ji~O#w:{O~P& iO#w#ji~P& iOP$]OR#zO[;SOo:vO}#yO!P#{O!i#xO!m$]O#O:xO#k:tO#l:uO#m:uO#n:uO#o:wO#p:xO#q:xO#r;RO#s:xO#u:yO([VO#y#ji#z#ji#}#ji(m#ji!Y#ji!Z#ji~O#w#ji(t#ji(u#ji~P&#qO#w:{O(t#|O(u#}O~P&#qOP$]OR#zO[;SOo:vO}#yO!P#{O!i#xO!m$]O#O:xO#k:tO#l:uO#m:uO#n:uO#o:wO#p:xO#q:xO#r;RO#s:xO#u:yO#w:{O#y:}O([VO(t#|O(u#}O~O#z#ji#}#ji(m#ji!Y#ji!Z#ji~P&&POa#{y!Y#{y'u#{y's#{y!V#{y!h#{ys#{y![#{y%f#{y!d#{y~P!9mOk < TypeParamList TypeDefinition extends ThisType this LiteralType ArithOp Number BooleanLiteral TemplateType InterpolationEnd Interpolation InterpolationStart NullType null VoidType void TypeofType typeof MemberExpression . PropertyName [ TemplateString Escape Interpolation super RegExp ] ArrayExpression Spread , } { ObjectExpression Property async get set PropertyDefinition Block : NewTarget new NewExpression ) ( ArgList UnaryExpression delete LogicOp BitOp YieldExpression yield AwaitExpression await ParenthesizedExpression ClassExpression class ClassBody MethodDeclaration Decorator @ MemberExpression PrivatePropertyName CallExpression TypeArgList CompareOp < declare Privacy static abstract override PrivatePropertyDefinition PropertyDeclaration readonly accessor Optional TypeAnnotation Equals StaticBlock FunctionExpression ArrowFunction ParamList ParamList ArrayPattern ObjectPattern PatternProperty Privacy readonly Arrow MemberExpression BinaryExpression ArithOp ArithOp ArithOp ArithOp BitOp CompareOp instanceof satisfies in const CompareOp BitOp BitOp BitOp LogicOp LogicOp ConditionalExpression LogicOp LogicOp AssignmentExpression UpdateOp PostfixExpression CallExpression InstantiationExpression TaggedTemplateExpression DynamicImport import ImportMeta JSXElement JSXSelfCloseEndTag JSXSelfClosingTag JSXIdentifier JSXBuiltin JSXIdentifier JSXNamespacedName JSXMemberExpression JSXSpreadAttribute JSXAttribute JSXAttributeValue JSXEscape JSXEndTag JSXOpenTag JSXFragmentTag JSXText JSXEscape JSXStartCloseTag JSXCloseTag PrefixCast ArrowFunction TypeParamList SequenceExpression InstantiationExpression KeyofType keyof UniqueType unique ImportType InferredType infer TypeName ParenthesizedType FunctionSignature ParamList NewSignature IndexedType TupleType Label ArrayType ReadonlyType ObjectType MethodType PropertyType IndexSignature PropertyDefinition CallSignature TypePredicate is NewSignature new UnionType LogicOp IntersectionType LogicOp ConditionalType ParameterizedType ClassDeclaration abstract implements type VariableDeclaration let var using TypeAliasDeclaration InterfaceDeclaration interface EnumDeclaration enum EnumBody NamespaceDeclaration namespace module AmbientDeclaration declare GlobalDeclaration global ClassDeclaration ClassBody AmbientFunctionDeclaration ExportGroup VariableName VariableName ImportDeclaration ImportGroup ForStatement for ForSpec ForInSpec ForOfSpec of WhileStatement while WithStatement with DoStatement do IfStatement if else SwitchStatement switch SwitchBody CaseLabel case DefaultLabel TryStatement try CatchClause catch FinallyClause finally ReturnStatement return ThrowStatement throw BreakStatement break ContinueStatement continue DebuggerStatement debugger LabeledStatement ExpressionStatement SingleExpression SingleClassItem",maxTerm:376,context:$u,nodeProps:[["isolate",-8,5,6,14,34,36,48,50,52,""],["group",-26,9,17,19,65,204,208,212,213,215,218,221,231,233,239,241,243,245,248,254,260,262,264,266,268,270,271,"Statement",-34,13,14,29,32,33,39,48,51,52,54,59,67,69,73,77,79,81,82,107,108,117,118,135,138,140,141,142,143,144,146,147,166,167,169,"Expression",-23,28,30,34,38,40,42,171,173,175,176,178,179,180,182,183,184,186,187,188,198,200,202,203,"Type",-3,85,100,106,"ClassItem"],["openedBy",23,"<",35,"InterpolationStart",53,"[",57,"{",70,"(",159,"JSXStartCloseTag"],["closedBy",24,">",37,"InterpolationEnd",47,"]",58,"}",71,")",164,"JSXEndTag"]],propSources:[Au],skippedNodes:[0,5,6,274],repeatNodeCount:37,tokenData:"$Fq07[R!bOX%ZXY+gYZ-yZ[+g[]%Z]^.c^p%Zpq+gqr/mrs3cst:_tuEruvJSvwLkwx! Yxy!'iyz!(sz{!)}{|!,q|}!.O}!O!,q!O!P!/Y!P!Q!9j!Q!R#:O!R![#<_![!]#I_!]!^#Jk!^!_#Ku!_!`$![!`!a$$v!a!b$*T!b!c$,r!c!}Er!}#O$-|#O#P$/W#P#Q$4o#Q#R$5y#R#SEr#S#T$7W#T#o$8b#o#p$x#r#s$@U#s$f%Z$f$g+g$g#BYEr#BY#BZ$A`#BZ$ISEr$IS$I_$A`$I_$I|Er$I|$I}$Dk$I}$JO$Dk$JO$JTEr$JT$JU$A`$JU$KVEr$KV$KW$A`$KW&FUEr&FU&FV$A`&FV;'SEr;'S;=`I|<%l?HTEr?HT?HU$A`?HUOEr(n%d_$h&j(Rp(U!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z&j&hT$h&jO!^&c!_#o&c#p;'S&c;'S;=`&w<%lO&c&j&zP;=`<%l&c'|'U]$h&j(U!bOY&}YZ&cZw&}wx&cx!^&}!^!_'}!_#O&}#O#P&c#P#o&}#o#p'}#p;'S&};'S;=`(l<%lO&}!b(SU(U!bOY'}Zw'}x#O'}#P;'S'};'S;=`(f<%lO'}!b(iP;=`<%l'}'|(oP;=`<%l&}'[(y]$h&j(RpOY(rYZ&cZr(rrs&cs!^(r!^!_)r!_#O(r#O#P&c#P#o(r#o#p)r#p;'S(r;'S;=`*a<%lO(rp)wU(RpOY)rZr)rs#O)r#P;'S)r;'S;=`*Z<%lO)rp*^P;=`<%l)r'[*dP;=`<%l(r#S*nX(Rp(U!bOY*gZr*grs'}sw*gwx)rx#O*g#P;'S*g;'S;=`+Z<%lO*g#S+^P;=`<%l*g(n+dP;=`<%l%Z07[+rq$h&j(Rp(U!b'w0/lOX%ZXY+gYZ&cZ[+g[p%Zpq+gqr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p$f%Z$f$g+g$g#BY%Z#BY#BZ+g#BZ$IS%Z$IS$I_+g$I_$JT%Z$JT$JU+g$JU$KV%Z$KV$KW+g$KW&FU%Z&FU&FV+g&FV;'S%Z;'S;=`+a<%l?HT%Z?HT?HU+g?HUO%Z07[.ST(S#S$h&j'x0/lO!^&c!_#o&c#p;'S&c;'S;=`&w<%lO&c07[.n_$h&j(Rp(U!b'x0/lOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z)3p/x`$h&j!m),Q(Rp(U!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_!`0z!`#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z(KW1V`#u(Ch$h&j(Rp(U!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_!`2X!`#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z(KW2d_#u(Ch$h&j(Rp(U!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z'At3l_(Q':f$h&j(U!bOY4kYZ5qZr4krs7nsw4kwx5qx!^4k!^!_8p!_#O4k#O#P5q#P#o4k#o#p8p#p;'S4k;'S;=`:X<%lO4k(^4r_$h&j(U!bOY4kYZ5qZr4krs7nsw4kwx5qx!^4k!^!_8p!_#O4k#O#P5q#P#o4k#o#p8p#p;'S4k;'S;=`:X<%lO4k&z5vX$h&jOr5qrs6cs!^5q!^!_6y!_#o5q#o#p6y#p;'S5q;'S;=`7h<%lO5q&z6jT$c`$h&jO!^&c!_#o&c#p;'S&c;'S;=`&w<%lO&c`6|TOr6yrs7]s;'S6y;'S;=`7b<%lO6y`7bO$c``7eP;=`<%l6y&z7kP;=`<%l5q(^7w]$c`$h&j(U!bOY&}YZ&cZw&}wx&cx!^&}!^!_'}!_#O&}#O#P&c#P#o&}#o#p'}#p;'S&};'S;=`(l<%lO&}!r8uZ(U!bOY8pYZ6yZr8prs9hsw8pwx6yx#O8p#O#P6y#P;'S8p;'S;=`:R<%lO8p!r9oU$c`(U!bOY'}Zw'}x#O'}#P;'S'};'S;=`(f<%lO'}!r:UP;=`<%l8p(^:[P;=`<%l4k%9[:hh$h&j(Rp(U!bOY%ZYZ&cZq%Zqr`#P#o`x!^=^!^!_?q!_#O=^#O#P>`#P#o=^#o#p?q#p;'S=^;'S;=`@h<%lO=^&n>gXWS$h&jOY>`YZ&cZ!^>`!^!_?S!_#o>`#o#p?S#p;'S>`;'S;=`?k<%lO>`S?XSWSOY?SZ;'S?S;'S;=`?e<%lO?SS?hP;=`<%l?S&n?nP;=`<%l>`!f?xWWS(U!bOY?qZw?qwx?Sx#O?q#O#P?S#P;'S?q;'S;=`@b<%lO?q!f@eP;=`<%l?q(Q@kP;=`<%l=^'`@w]WS$h&j(RpOY@nYZ&cZr@nrs>`s!^@n!^!_Ap!_#O@n#O#P>`#P#o@n#o#pAp#p;'S@n;'S;=`Bg<%lO@ntAwWWS(RpOYApZrAprs?Ss#OAp#O#P?S#P;'SAp;'S;=`Ba<%lOAptBdP;=`<%lAp'`BjP;=`<%l@n#WBvYWS(Rp(U!bOYBmZrBmrs?qswBmwxApx#OBm#O#P?S#P;'SBm;'S;=`Cf<%lOBm#WCiP;=`<%lBm(rCoP;=`<%l^!Q^$h&j!U7`OY!=yYZ&cZ!P!=y!P!Q!>|!Q!^!=y!^!_!@c!_!}!=y!}#O!CW#O#P!Dy#P#o!=y#o#p!@c#p;'S!=y;'S;=`!Ek<%lO!=y|#X#Z&c#Z#[!>|#[#]&c#]#^!>|#^#a&c#a#b!>|#b#g&c#g#h!>|#h#i&c#i#j!>|#j#k!>|#k#m&c#m#n!>|#n#o&c#p;'S&c;'S;=`&w<%lO&c7`!@hX!U7`OY!@cZ!P!@c!P!Q!AT!Q!}!@c!}#O!Ar#O#P!Bq#P;'S!@c;'S;=`!CQ<%lO!@c7`!AYW!U7`#W#X!AT#Z#[!AT#]#^!AT#a#b!AT#g#h!AT#i#j!AT#j#k!AT#m#n!AT7`!AuVOY!ArZ#O!Ar#O#P!B[#P#Q!@c#Q;'S!Ar;'S;=`!Bk<%lO!Ar7`!B_SOY!ArZ;'S!Ar;'S;=`!Bk<%lO!Ar7`!BnP;=`<%l!Ar7`!BtSOY!@cZ;'S!@c;'S;=`!CQ<%lO!@c7`!CTP;=`<%l!@c^!Ezl$h&j(U!b!U7`OY&}YZ&cZw&}wx&cx!^&}!^!_'}!_#O&}#O#P&c#P#W&}#W#X!Eq#X#Z&}#Z#[!Eq#[#]&}#]#^!Eq#^#a&}#a#b!Eq#b#g&}#g#h!Eq#h#i&}#i#j!Eq#j#k!Eq#k#m&}#m#n!Eq#n#o&}#o#p'}#p;'S&};'S;=`(l<%lO&}8r!GyZ(U!b!U7`OY!GrZw!Grwx!@cx!P!Gr!P!Q!Hl!Q!}!Gr!}#O!JU#O#P!Bq#P;'S!Gr;'S;=`!J|<%lO!Gr8r!Hse(U!b!U7`OY'}Zw'}x#O'}#P#W'}#W#X!Hl#X#Z'}#Z#[!Hl#[#]'}#]#^!Hl#^#a'}#a#b!Hl#b#g'}#g#h!Hl#h#i'}#i#j!Hl#j#k!Hl#k#m'}#m#n!Hl#n;'S'};'S;=`(f<%lO'}8r!JZX(U!bOY!JUZw!JUwx!Arx#O!JU#O#P!B[#P#Q!Gr#Q;'S!JU;'S;=`!Jv<%lO!JU8r!JyP;=`<%l!JU8r!KPP;=`<%l!Gr>^!KZ^$h&j(U!bOY!KSYZ&cZw!KSwx!CWx!^!KS!^!_!JU!_#O!KS#O#P!DR#P#Q!^!LYP;=`<%l!KS>^!L`P;=`<%l!_#c#d#Bq#d#l%Z#l#m#Es#m#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z'Ad#_#c#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z'Ad#>j_$h&j(Rp(U!bp'9tOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z'Ad#?rd$h&j(Rp(U!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!Q%Z!Q!R#AQ!R!S#AQ!S!^%Z!^!_*g!_#O%Z#O#P&c#P#R%Z#R#S#AQ#S#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z'Ad#A]f$h&j(Rp(U!bp'9tOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!Q%Z!Q!R#AQ!R!S#AQ!S!^%Z!^!_*g!_#O%Z#O#P&c#P#R%Z#R#S#AQ#S#b%Z#b#c#>_#c#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z'Ad#Bzc$h&j(Rp(U!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!Q%Z!Q!Y#DV!Y!^%Z!^!_*g!_#O%Z#O#P&c#P#R%Z#R#S#DV#S#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z'Ad#Dbe$h&j(Rp(U!bp'9tOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!Q%Z!Q!Y#DV!Y!^%Z!^!_*g!_#O%Z#O#P&c#P#R%Z#R#S#DV#S#b%Z#b#c#>_#c#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z'Ad#E|g$h&j(Rp(U!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!Q%Z!Q![#Ge![!^%Z!^!_*g!_!c%Z!c!i#Ge!i#O%Z#O#P&c#P#R%Z#R#S#Ge#S#T%Z#T#Z#Ge#Z#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z'Ad#Gpi$h&j(Rp(U!bp'9tOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!Q%Z!Q![#Ge![!^%Z!^!_*g!_!c%Z!c!i#Ge!i#O%Z#O#P&c#P#R%Z#R#S#Ge#S#T%Z#T#Z#Ge#Z#b%Z#b#c#>_#c#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z*)x#Il_!d$b$h&j#})Lv(Rp(U!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z)[#Jv_al$h&j(Rp(U!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z04f#LS^h#)`#O-Cu[n]||-1},{term:338,get:n=>Mu[n]||-1},{term:92,get:n=>Wu[n]||-1}],tokenPrec:14793});class _{lineAt(e){if(e<0||e>this.length)throw new RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,false,1,0)}line(e){if(e<1||e>this.lines)throw new RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,true,1,0)}replace(e,t,i){[e,t]=ei(this,e,t);let s=[];this.decompose(0,e,s,2);if(i.length)i.decompose(0,i.length,s,1|2);this.decompose(t,this.length,s,1);return Fe.from(s,this.length-(t-e)+i.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,t=this.length){[e,t]=ei(this,e,t);let i=[];this.decompose(e,t,i,0);return Fe.from(i,t-e)}eq(e){if(e==this)return true;if(e.length!=this.length||e.lines!=this.lines)return false;let t=this.scanIdentical(e,1),i=this.length-this.scanIdentical(e,-1);let s=new ki(this),r=new ki(e);for(let o=t,l=t;;){s.next(o);r.next(o);o=0;if(s.lineBreak!=r.lineBreak||s.done!=r.done||s.value!=r.value)return false;l+=s.value.length;if(s.done||l>=i)return true}}iter(e=1){return new ki(this,e)}iterRange(e,t=this.length){return new Ya(this,e,t)}iterLines(e,t){let i;if(e==null){i=this.iter()}else{if(t==null)t=this.lines+1;let s=this.line(e).from;i=this.iterRange(s,Math.max(s,t==this.lines+1?this.length:t<=1?0:this.line(t-1).to))}return new Ea(i)}toString(){return this.sliceString(0)}toJSON(){let e=[];this.flatten(e);return e}constructor(){}static of(e){if(e.length==0)throw new RangeError("A document must have at least one line");if(e.length==1&&!e[0])return _.empty;return e.length<=32?new H(e):Fe.from(H.split(e,[]))}}class H extends _{constructor(e,t=Du(e)){super();this.text=e;this.length=t}get lines(){return this.text.length}get children(){return null}lineInner(e,t,i,s){for(let r=0;;r++){let o=this.text[r],l=s+o.length;if((t?i:l)>=e)return new Yu(s,l,i,o);s=l+1;i++}}decompose(e,t,i,s){let r=e<=0&&t>=this.length?this:new H(Bo(this.text,e,t),Math.min(t,this.length)-Math.max(0,e));if(s&1){let o=i.pop();let l=Pn(r.text,o.text.slice(),0,r.length);if(l.length<=32){i.push(new H(l,o.length+r.length))}else{let a=l.length>>1;i.push(new H(l.slice(0,a)),new H(l.slice(a)))}}else{i.push(r)}}replace(e,t,i){if(!(i instanceof H))return super.replace(e,t,i);[e,t]=ei(this,e,t);let s=Pn(this.text,Pn(i.text,Bo(this.text,0,e)),t);let r=this.length+i.length-(t-e);if(s.length<=32)return new H(s,r);return Fe.from(H.split(s,[]),r)}sliceString(e,t=this.length,i="\n"){[e,t]=ei(this,e,t);let s="";for(let r=0,o=0;r<=t&&oe&&o)s+=i;if(er)s+=l.slice(Math.max(0,e-r),t-r);r=a+1}return s}flatten(e){for(let t of this.text)e.push(t)}scanIdentical(){return 0}static split(e,t){let i=[],s=-1;for(let r of e){i.push(r);s+=r.length+1;if(i.length==32){t.push(new H(i,s));i=[];s=-1}}if(s>-1)t.push(new H(i,s));return t}}class Fe extends _{constructor(e,t){super();this.children=e;this.length=t;this.lines=0;for(let i of e)this.lines+=i.lines}lineInner(e,t,i,s){for(let r=0;;r++){let o=this.children[r],l=s+o.length,a=i+o.lines-1;if((t?a:l)>=e)return o.lineInner(e,t,i,s);s=l+1;i=a+1}}decompose(e,t,i,s){for(let r=0,o=0;o<=t&&r=o){let h=s&((o<=e?1:0)|(a>=t?2:0));if(o>=e&&a<=t&&!h)i.push(l);else l.decompose(e-o,t-o,i,h)}o=a+1}}replace(e,t,i){[e,t]=ei(this,e,t);if(i.lines=r&&t<=l){let a=o.replace(e-r,t-r,i);let h=this.lines-o.lines+a.lines;if(a.lines>5-1&&a.lines>h>>5+1){let c=this.children.slice();c[s]=a;return new Fe(c,this.length-(t-e)+i.length)}return super.replace(r,l,a)}r=l+1}return super.replace(e,t,i)}sliceString(e,t=this.length,i="\n"){[e,t]=ei(this,e,t);let s="";for(let r=0,o=0;re&&r)s+=i;if(eo)s+=l.sliceString(e-o,t-o,i);o=a+1}return s}flatten(e){for(let t of this.children)t.flatten(e)}scanIdentical(e,t){if(!(e instanceof Fe))return 0;let i=0;let[s,r,o,l]=t>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;s+=t,r+=t){if(s==o||r==l)return i;let a=this.children[s],h=e.children[r];if(a!=h)return i+a.scanIdentical(h,t);i+=a.length+1}}static from(e,t=e.reduce((i,s)=>i+s.length+1,-1)){let i=0;for(let d of e)i+=d.lines;if(i<32){let d=[];for(let O of e)O.flatten(d);return new H(d,t)}let s=Math.max(32,i>>5),r=s<<1,o=s>>1;let l=[],a=0,h=-1,c=[];function f(d){let O;if(d.lines>r&&d instanceof Fe){for(let p of d.children)f(p)}else if(d.lines>o&&(a>o||!a)){u();l.push(d)}else if(d instanceof H&&a&&(O=c[c.length-1])instanceof H&&d.lines+O.lines<=32){a+=d.lines;h+=d.length+1;c[c.length-1]=new H(O.text.concat(d.text),O.length+1+d.length)}else{if(a+d.lines>s)u();a+=d.lines;h+=d.length+1;c.push(d)}}function u(){if(a==0)return;l.push(c.length==1?c[0]:Fe.from(c,h));h=-1;a=c.length=0}for(let d of e)f(d);u();return l.length==1?l[0]:new Fe(l,t)}}_.empty=new H([""],0);function Du(n){let e=-1;for(let t of n)e+=t.length+1;return e}function Pn(n,e,t=0,i=1e9){for(let s=0,r=0,o=true;r=t){if(a>i)l=l.slice(0,i-s);if(s0?1:(e instanceof H?e.text.length:e.children.length)<<1]}nextInner(e,t){this.done=this.lineBreak=false;for(;;){let i=this.nodes.length-1;let s=this.nodes[i],r=this.offsets[i],o=r>>1;let l=s instanceof H?s.text.length:s.children.length;if(o==(t>0?l:0)){if(i==0){this.done=true;this.value="";return this}if(t>0)this.offsets[i-1]++;this.nodes.pop();this.offsets.pop()}else if((r&1)==(t>0?0:1)){this.offsets[i]+=t;if(e==0){this.lineBreak=true;this.value="\n";return this}e--}else if(s instanceof H){let a=s.text[o+(t<0?-1:0)];this.offsets[i]+=t;if(a.length>Math.max(0,e)){this.value=e==0?a:t>0?a.slice(e):a.slice(0,a.length-e);return this}e-=a.length}else{let a=s.children[o+(t<0?-1:0)];if(e>a.length){e-=a.length;this.offsets[i]+=t}else{if(t<0)this.offsets[i]--;this.nodes.push(a);this.offsets.push(t>0?1:(a instanceof H?a.text.length:a.children.length)<<1)}}}}next(e=0){if(e<0){this.nextInner(-e,-this.dir);e=this.value.length}return this.nextInner(e,this.dir)}}class Ya{constructor(e,t,i){this.value="";this.done=false;this.cursor=new ki(e,t>i?-1:1);this.pos=t>i?e.length:0;this.from=Math.min(t,i);this.to=Math.max(t,i)}nextInner(e,t){if(t<0?this.pos<=this.from:this.pos>=this.to){this.value="";this.done=true;return this}e+=Math.max(0,t<0?this.pos-this.to:this.from-this.pos);let i=t<0?this.pos-this.from:this.to-this.pos;if(e>i)e=i;i-=e;let{value:s}=this.cursor.next(e);this.pos+=(s.length+e)*t;this.value=s.length<=i?s:t<0?s.slice(s.length-i):s.slice(0,i);this.done=!this.value;return this}next(e=0){if(e<0)e=Math.max(e,this.from-this.pos);else if(e>0)e=Math.min(e,this.to-this.pos);return this.nextInner(e,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&this.value!=""}}class Ea{constructor(e){this.inner=e;this.afterBreak=true;this.value="";this.done=false}next(e=0){let{done:t,lineBreak:i,value:s}=this.inner.next(e);if(t&&this.afterBreak){this.value="";this.afterBreak=false}else if(t){this.done=true;this.value=""}else if(i){if(this.afterBreak){this.value=""}else{this.afterBreak=true;this.next()}}else{this.value=s;this.afterBreak=false}return this}get lineBreak(){return false}}if(typeof Symbol!="undefined"){_.prototype[Symbol.iterator]=function(){return this.iter()};ki.prototype[Symbol.iterator]=Ya.prototype[Symbol.iterator]=Ea.prototype[Symbol.iterator]=function(){return this}}class Yu{constructor(e,t,i,s){this.from=e;this.to=t;this.number=i;this.text=s}get length(){return this.to-this.from}}function ei(n,e,t){e=Math.max(0,Math.min(n.length,e));return[e,Math.max(e,Math.min(n.length,t))]}let Nt="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map(n=>n?parseInt(n,36):1);for(let n=1;nn)return Nt[e-1]<=n;return false}function Uo(n){return n>=127462&&n<=127487}const Io=8205;function ue(n,e,t=true,i=true){return(t?qa:qu)(n,e,i)}function qa(n,e,t){if(e==n.length)return e;if(e&&_a(n.charCodeAt(e))&&za(n.charCodeAt(e-1)))e--;let i=ae(n,e);e+=Xe(i);while(e=0&&Uo(ae(n,o))){r++;o-=2}if(r%2==0)break;else e+=2}else{break}}return e}function qu(n,e,t){while(e>0){let i=qa(n,e-2,t);if(i=56320&&n<57344}function za(n){return n>=55296&&n<56320}function ae(n,e){let t=n.charCodeAt(e);if(!za(t)||e+1==n.length)return t;let i=n.charCodeAt(e+1);if(!_a(i))return t;return(t-55296<<10)+(i-56320)+65536}function Hr(n){if(n<=65535)return String.fromCharCode(n);n-=65536;return String.fromCharCode((n>>10)+55296,(n&1023)+56320)}function Xe(n){return n<65536?1:2}const nr=/\r\n?|\n/;var ce=function(n){n[n["Simple"]=0]="Simple";n[n["TrackDel"]=1]="TrackDel";n[n["TrackBefore"]=2]="TrackBefore";n[n["TrackAfter"]=3]="TrackAfter";return n}(ce||(ce={}));class tt{constructor(e){this.sections=e}get length(){let e=0;for(let t=0;te)return r+(e-s);r+=l}else{if(i!=ce.Simple&&h>=e&&(i==ce.TrackDel&&se||i==ce.TrackBefore&&se))return null;if(h>e||h==e&&t<0&&!l)return e==s||t<0?r:r+a;r+=a}s=h}if(e>s)throw new RangeError(`Position ${e} is out of range for changeset of length ${s}`);return r}touchesRange(e,t=e){for(let i=0,s=0;i=0&&s<=t&&l>=e)return st?"cover":true;s=l}return false}toString(){let e="";for(let t=0;t=0?":"+s:"")}return e}toJSON(){return this.sections}static fromJSON(e){if(!Array.isArray(e)||e.length%2||e.some(t=>typeof t!="number"))throw new RangeError("Invalid JSON representation of ChangeDesc");return new tt(e)}static create(e){return new tt(e)}}class ne extends tt{constructor(e,t){super(e);this.inserted=t}apply(e){if(this.length!=e.length)throw new RangeError("Applying change set to a document with the wrong length");sr(this,(t,i,s,r,o)=>e=e.replace(s,s+(i-t),o),false);return e}mapDesc(e,t=false){return rr(this,e,t,true)}invert(e){let t=this.sections.slice(),i=[];for(let s=0,r=0;s=0){t[s]=l;t[s+1]=o;let a=s>>1;while(i.length0)dt(i,t,r.text);r.forward(c);l+=c}let h=e[o++];while(l>1].toJSON()))}return e}static of(e,t,i){let s=[],r=[],o=0;let l=null;function a(c=false){if(!c&&!s.length)return;if(ou||f<0||u>t)throw new RangeError(`Invalid change range ${f} to ${u} (in doc of length ${t})`);let O=!d?_.empty:typeof d=="string"?_.of(d.split(i||nr)):d;let p=O.length;if(f==u&&p==0)return;if(fo)de(s,f-o,-1);de(s,u-f,p);dt(r,s,O);o=u}}h(e);a(!l);return l}static empty(e){return new ne(e?[e,-1]:[],[])}static fromJSON(e){if(!Array.isArray(e))throw new RangeError("Invalid JSON representation of ChangeSet");let t=[],i=[];for(let s=0;sl&&typeof o!="string")){throw new RangeError("Invalid JSON representation of ChangeSet")}else if(r.length==1){t.push(r[0],0)}else{while(i.length=0&&t<=0&&t==n[s+1])n[s]+=e;else if(e==0&&n[s]==0)n[s+1]+=t;else if(i){n[s]+=e;n[s+1]+=t}else n.push(e,t)}function dt(n,e,t){if(t.length==0)return;let i=e.length-2>>1;if(i>1]);if(t||o==n.sections.length||n.sections[o+1]<0)break;l=n.sections[o++];a=n.sections[o++]}e(s,h,r,c,f);s=h;r=c}}}function rr(n,e,t,i=false){let s=[],r=i?[]:null;let o=new Ti(n),l=new Ti(e);for(let a=-1;;){if(o.ins==-1&&l.ins==-1){let h=Math.min(o.len,l.len);de(s,h,-1);o.forward(h);l.forward(h)}else if(l.ins>=0&&(o.ins<0||a==o.i||o.off==0&&(l.len=0&&a=0){let h=0,c=o.len;while(c){if(l.ins==-1){let f=Math.min(c,l.len);h+=f;c-=f;l.forward(f)}else if(l.ins==0&&l.lena||o.ins>=0&&o.len>a)&&(l||i.length>h);r.forward2(a);o.forward(a)}}}class Ti{constructor(e){this.set=e;this.i=0;this.next()}next(){let{sections:e}=this.set;if(this.i>1;return t>=e.length?_.empty:e[t]}textBit(e){let{inserted:t}=this.set,i=this.i-2>>1;return i>=t.length&&!e?_.empty:t[i].slice(this.off,e==null?void 0:this.off+e)}forward(e){if(e==this.len)this.next();else{this.len-=e;this.off+=e}}forward2(e){if(this.ins==-1)this.forward(e);else if(e==this.ins)this.next();else{this.ins-=e;this.off+=e}}}class At{constructor(e,t,i){this.from=e;this.to=t;this.flags=i}get anchor(){return this.flags&32?this.to:this.from}get head(){return this.flags&32?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return this.flags&8?-1:this.flags&16?1:0}get bidiLevel(){let e=this.flags&7;return e==7?null:e}get goalColumn(){let e=this.flags>>6;return e==16777215?void 0:e}map(e,t=-1){let i,s;if(this.empty){i=s=e.mapPos(this.from,t)}else{i=e.mapPos(this.from,1);s=e.mapPos(this.to,-1)}return i==this.from&&s==this.to?this:new At(i,s,this.flags)}extend(e,t=e){if(e<=this.anchor&&t>=this.anchor)return y.range(e,t);let i=Math.abs(e-this.anchor)>Math.abs(t-this.anchor)?e:t;return y.range(this.anchor,i)}eq(e,t=false){return this.anchor==e.anchor&&this.head==e.head&&(!t||!this.empty||this.assoc==e.assoc)}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(e){if(!e||typeof e.anchor!="number"||typeof e.head!="number")throw new RangeError("Invalid JSON representation for SelectionRange");return y.range(e.anchor,e.head)}static create(e,t,i){return new At(e,t,i)}}class y{constructor(e,t){this.ranges=e;this.mainIndex=t}map(e,t=-1){if(e.empty)return this;return y.create(this.ranges.map(i=>i.map(e,t)),this.mainIndex)}eq(e,t=false){if(this.ranges.length!=e.ranges.length||this.mainIndex!=e.mainIndex)return false;for(let i=0;ie.toJSON()),main:this.mainIndex}}static fromJSON(e){if(!e||!Array.isArray(e.ranges)||typeof e.main!="number"||e.main>=e.ranges.length)throw new RangeError("Invalid JSON representation for EditorSelection");return new y(e.ranges.map(t=>At.fromJSON(t)),e.main)}static single(e,t=e){return new y([y.range(e,t)],0)}static create(e,t=0){if(e.length==0)throw new RangeError("A selection needs at least one range");for(let i=0,s=0;se?8:0)|r)}static normalized(e,t=0){let i=e[t];e.sort((s,r)=>s.from-r.from);t=e.indexOf(i);for(let s=1;sr.head?y.range(a,l):y.range(l,a))}}return new y(e,t)}}function Va(n,e){for(let t of n.ranges)if(t.to>e)throw new RangeError("Selection points outside of document")}let Kr=0;class Z{constructor(e,t,i,s,r){this.combine=e;this.compareInput=t;this.compare=i;this.isStatic=s;this.id=Kr++;this.default=e([]);this.extensions=typeof r=="function"?r(this):r}get reader(){return this}static define(e={}){return new Z(e.combine||(t=>t),e.compareInput||((t,i)=>t===i),e.compare||(!e.combine?Jr:(t,i)=>t===i),!!e.static,e.enables)}of(e){return new $n([],this,0,e)}compute(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new $n(e,this,1,t)}computeN(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new $n(e,this,2,t)}from(e,t){if(!t)t=i=>i;return this.compute([e],i=>t(i.field(e)))}}function Jr(n,e){return n==e||n.length==e.length&&n.every((t,i)=>t===e[i])}class $n{constructor(e,t,i,s){this.dependencies=e;this.facet=t;this.type=i;this.value=s;this.id=Kr++}dynamicSlot(e){var t;let i=this.value;let s=this.facet.compareInput;let r=this.id,o=e[r]>>1,l=this.type==2;let a=false,h=false,c=[];for(let f of this.dependencies){if(f=="doc")a=true;else if(f=="selection")h=true;else if((((t=e[f.id])!==null&&t!==void 0?t:1)&1)==0)c.push(e[f.id])}return{create(f){f.values[o]=i(f);return 1},update(f,u){if(a&&u.docChanged||h&&(u.docChanged||u.selection)||or(f,c)){let d=i(f);if(l?!No(d,f.values[o],s):!s(d,f.values[o])){f.values[o]=d;return 1}}return 0},reconfigure:(f,u)=>{let d,O=u.config.address[r];if(O!=null){let p=_n(u,O);if(this.dependencies.every(m=>{return m instanceof Z?u.facet(m)===f.facet(m):m instanceof oe?u.field(m,false)==f.field(m,false):true})||(l?No(d=i(f),p,s):s(d=i(f),p))){f.values[o]=p;return 0}}else{d=i(f)}f.values[o]=d;return 1}}}}function No(n,e,t){if(n.length!=e.length)return false;for(let i=0;in[a.id]);let s=t.map(a=>a.type);let r=i.filter(a=>!(a&1));let o=n[e.id]>>1;function l(a){let h=[];for(let c=0;ci===s),e);if(e.provide)t.provides=e.provide(t);return t}create(e){let t=e.facet(Go).find(i=>i.field==this);return((t===null||t===void 0?void 0:t.create)||this.createF)(e)}slot(e){let t=e[this.id]>>1;return{create:i=>{i.values[t]=this.create(i);return 1},update:(i,s)=>{let r=i.values[t];let o=this.updateF(r,s);if(this.compareF(r,o))return 0;i.values[t]=o;return 1},reconfigure:(i,s)=>{if(s.config.address[this.id]!=null){i.values[t]=s.field(this);return 0}i.values[t]=this.create(i);return 1}}}init(e){return[this,Go.of({field:this,create:e})]}get extension(){return this}}const Rt={lowest:4,low:3,default:2,high:1,highest:0};function fi(n){return e=>new La(e,n)}const Pt={highest:fi(Rt.highest),high:fi(Rt.high),default:fi(Rt.default),low:fi(Rt.low),lowest:fi(Rt.lowest)};class La{constructor(e,t){this.inner=e;this.prec=t}}class ls{of(e){return new lr(this,e)}reconfigure(e){return ls.reconfigure.of({compartment:this,extension:e})}get(e){return e.config.compartments.get(this)}}class lr{constructor(e,t){this.compartment=e;this.inner=t}}class qn{constructor(e,t,i,s,r,o){this.base=e;this.compartments=t;this.dynamicSlots=i;this.address=s;this.staticValues=r;this.facets=o;this.statusTemplate=[];while(this.statusTemplate.length>1]}static resolve(e,t,i){let s=[];let r=Object.create(null);let o=new Map;for(let u of zu(e,t,o)){if(u instanceof oe)s.push(u);else(r[u.facet.id]||(r[u.facet.id]=[])).push(u)}let l=Object.create(null);let a=[];let h=[];for(let u of s){l[u.id]=h.length<<1;h.push(d=>u.slot(d))}let c=i===null||i===void 0?void 0:i.config.facets;for(let u in r){let d=r[u],O=d[0].facet;let p=c&&c[u]||[];if(d.every(m=>m.type==0)){l[O.id]=a.length<<1|1;if(Jr(p,d)){a.push(i.facet(O))}else{let m=O.combine(d.map(b=>b.value));a.push(i&&O.compare(m,i.facet(O))?i.facet(O):m)}}else{for(let m of d){if(m.type==0){l[m.id]=a.length<<1|1;a.push(m.value)}else{l[m.id]=h.length<<1;h.push(b=>m.dynamicSlot(b))}}l[O.id]=h.length<<1;h.push(m=>_u(m,O,d))}}let f=h.map(u=>u(l));return new qn(e,o,f,l,a,r)}}function zu(n,e,t){let i=[[],[],[],[],[]];let s=new Map;function r(o,l){let a=s.get(o);if(a!=null){if(a<=l)return;let h=i[a].indexOf(o);if(h>-1)i[a].splice(h,1);if(o instanceof lr)t.delete(o.compartment)}s.set(o,l);if(Array.isArray(o)){for(let h of o)r(h,l)}else if(o instanceof lr){if(t.has(o.compartment))throw new RangeError(`Duplicate use of compartment in extensions`);let h=e.get(o.compartment)||o.inner;t.set(o.compartment,h);r(h,l)}else if(o instanceof La){r(o.inner,o.prec)}else if(o instanceof oe){i[l].push(o);if(o.provides)r(o.provides,l)}else if(o instanceof $n){i[l].push(o);if(o.facet.extensions)r(o.facet.extensions,Rt.default)}else{let h=o.extension;if(!h)throw new Error(`Unrecognized extension value in extension set (${o}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);r(h,l)}}r(n,Rt.default);return i.reduce((o,l)=>o.concat(l))}function Pi(n,e){if(e&1)return 2;let t=e>>1;let i=n.status[t];if(i==4)throw new Error("Cyclic dependency between fields and/or facets");if(i&2)return i;n.status[t]=4;let s=n.computeSlot(n,n.config.dynamicSlots[t]);return n.status[t]=2|s}function _n(n,e){return e&1?n.config.staticValues[e>>1]:n.values[e>>1]}const Ba=Z.define();const ar=Z.define({combine:n=>n.some(e=>e),static:true});const Ua=Z.define({combine:n=>n.length?n[0]:void 0,static:true});const Ia=Z.define();const Na=Z.define();const Ga=Z.define();const Fa=Z.define({combine:n=>n.length?n[0]:false});class at{constructor(e,t){this.type=e;this.value=t}static define(){return new ju}}class ju{of(e){return new at(this,e)}}class Vu{constructor(e){this.map=e}of(e){return new A(this,e)}}class A{constructor(e,t){this.type=e;this.value=t}map(e){let t=this.type.map(this.value,e);return t===void 0?void 0:t==this.value?this:new A(this.type,t)}is(e){return this.type==e}static define(e={}){return new Vu(e.map||(t=>t))}static mapEffects(e,t){if(!e.length)return e;let i=[];for(let s of e){let r=s.map(t);if(r)i.push(r)}return i}}A.reconfigure=A.define();A.appendConfig=A.define();class J{constructor(e,t,i,s,r,o){this.startState=e;this.changes=t;this.selection=i;this.effects=s;this.annotations=r;this.scrollIntoView=o;this._doc=null;this._state=null;if(i)Va(i,t.newLength);if(!r.some(l=>l.type==J.time))this.annotations=r.concat(J.time.of(Date.now()))}static create(e,t,i,s,r,o){return new J(e,t,i,s,r,o)}get newDoc(){return this._doc||(this._doc=this.changes.apply(this.startState.doc))}get newSelection(){return this.selection||this.startState.selection.map(this.changes)}get state(){if(!this._state)this.startState.applyTransaction(this);return this._state}annotation(e){for(let t of this.annotations)if(t.type==e)return t.value;return void 0}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(e){let t=this.annotation(J.userEvent);return!!(t&&(t==e||t.length>e.length&&t.slice(0,e.length)==e&&t[e.length]=="."))}}J.time=at.define();J.userEvent=at.define();J.addToHistory=at.define();J.remote=at.define();function Lu(n,e){let t=[];for(let i=0,s=0;;){let r,o;if(i=n[i])){r=n[i++];o=n[i++]}else if(s=0;s--){let r=i[s](n);if(r instanceof J)n=r;else if(Array.isArray(r)&&r.length==1&&r[0]instanceof J)n=r[0];else n=Ka(e,Gt(r),false)}return n}function Uu(n){let e=n.startState,t=e.facet(Ga),i=n;for(let s=t.length-1;s>=0;s--){let r=t[s](n);if(r&&Object.keys(r).length)i=Ha(i,hr(e,r,n.changes.newLength),true)}return i==n?n:J.create(e,n.changes,n.selection,i.effects,i.annotations,i.scrollIntoView)}const Iu=[];function Gt(n){return n==null?Iu:Array.isArray(n)?n:[n]}var G=function(n){n[n["Word"]=0]="Word";n[n["Space"]=1]="Space";n[n["Other"]=2]="Other";return n}(G||(G={}));const Nu=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let cr;try{cr=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch(n){}function Gu(n){if(cr)return cr.test(n);for(let e=0;e"€"&&(t.toUpperCase()!=t.toLowerCase()||Nu.test(t)))return true}return false}function Fu(n){return e=>{if(!/\S/.test(e))return G.Space;if(Gu(e))return G.Word;for(let t=0;t-1)return G.Word;return G.Other}}class q{constructor(e,t,i,s,r,o){this.config=e;this.doc=t;this.selection=i;this.values=s;this.status=e.statusTemplate.slice();this.computeSlot=r;if(o)o._state=this;for(let l=0;ls.set(h,a));t=null}s.set(l.value.compartment,l.value.extension)}else if(l.is(A.reconfigure)){t=null;i=l.value}else if(l.is(A.appendConfig)){t=null;i=Gt(i).concat(l.value)}}let r;if(!t){t=qn.resolve(i,s,this);let l=new q(t,this.doc,this.selection,t.dynamicSlots.map(()=>null),(a,h)=>h.reconfigure(a,this),null);r=l.values}else{r=e.startState.values.slice()}let o=e.startState.facet(ar)?e.newSelection:e.newSelection.asSingle();new q(t,e.newDoc,o,r,(l,a)=>a.update(l,e),e)}replaceSelection(e){if(typeof e=="string")e=this.toText(e);return this.changeByRange(t=>({changes:{from:t.from,to:t.to,insert:e},range:y.cursor(t.from+e.length)}))}changeByRange(e){let t=this.selection;let i=e(t.ranges[0]);let s=this.changes(i.changes),r=[i.range];let o=Gt(i.effects);for(let l=1;lo.spec.fromJSON(l,a)))}}return q.create({doc:e.doc,selection:y.fromJSON(e.selection),extensions:t.extensions?s.concat([t.extensions]):s})}static create(e={}){let t=qn.resolve(e.extensions||[],new Map);let i=e.doc instanceof _?e.doc:_.of((e.doc||"").split(t.staticFacet(q.lineSeparator)||nr));let s=!e.selection?y.single(0):e.selection instanceof y?e.selection:y.single(e.selection.anchor,e.selection.head);Va(s,i.length);if(!t.staticFacet(ar))s=s.asSingle();return new q(t,i,s,t.dynamicSlots.map(()=>null),(r,o)=>o.create(r),null)}get tabSize(){return this.facet(q.tabSize)}get lineBreak(){return this.facet(q.lineSeparator)||"\n"}get readOnly(){return this.facet(Fa)}phrase(e,...t){for(let i of this.facet(q.phrases))if(Object.prototype.hasOwnProperty.call(i,e)){e=i[e];break}if(t.length)e=e.replace(/\$(\$|\d*)/g,(i,s)=>{if(s=="$")return"$";let r=+(s||1);return!r||r>t.length?i:t[r-1]});return e}languageDataAt(e,t,i=-1){let s=[];for(let r of this.facet(Ba)){for(let o of r(this,t,i)){if(Object.prototype.hasOwnProperty.call(o,e))s.push(o[e])}}return s}charCategorizer(e){return Fu(this.languageDataAt("wordChars",e).join(""))}wordAt(e){let{text:t,from:i,length:s}=this.doc.lineAt(e);let r=this.charCategorizer(e);let o=e-i,l=e-i;while(o>0){let a=ue(t,o,false);if(r(t.slice(a,o))!=G.Word)break;o=a}while(ln.length?n[0]:4});q.lineSeparator=Ua;q.readOnly=Fa;q.phrases=Z.define({compare(n,e){let t=Object.keys(n),i=Object.keys(e);return t.length==i.length&&t.every(s=>n[s]==e[s])}});q.languageData=Ba;q.changeFilter=Ia;q.transactionFilter=Na;q.transactionExtender=Ga;ls.reconfigure=A.define();function it(n,e,t={}){let i={};for(let s of n)for(let r of Object.keys(s)){let o=s[r],l=i[r];if(l===void 0)i[r]=o;else if(l===o||o===void 0);else if(Object.hasOwnProperty.call(t,r))i[r]=t[r](l,o);else throw new Error("Config merge conflict for field "+r)}for(let s in e)if(i[s]===void 0)i[s]=e[s];return i}class Xt{eq(e){return this==e}range(e,t=e){return Ai.create(e,t,this)}}Xt.prototype.startSide=Xt.prototype.endSide=0;Xt.prototype.point=false;Xt.prototype.mapMode=ce.TrackDel;class Ai{constructor(e,t,i){this.from=e;this.to=t;this.value=i}static create(e,t,i){return new Ai(e,t,i)}}function fr(n,e){return n.from-e.from||n.value.startSide-e.value.startSide}class eo{constructor(e,t,i,s){this.from=e;this.to=t;this.value=i;this.maxPoint=s}get length(){return this.to[this.to.length-1]}findIndex(e,t,i,s=0){let r=i?this.to:this.from;for(let o=s,l=r.length;;){if(o==l)return o;let a=o+l>>1;let h=r[a]-e||(i?this.value[a].endSide:this.value[a].startSide)-t;if(a==o)return h>=0?o:l;if(h>=0)l=a;else o=a+1}}between(e,t,i,s){for(let r=this.findIndex(t,-1e9,true),o=this.findIndex(i,1e9,false,r);rd||u==d&&h.startSide>0&&h.endSide<=0)continue}if((d-u||h.endSide-h.startSide)<0)continue;if(o<0)o=u;if(h.point)l=Math.max(l,d-u);i.push(h);s.push(u-o);r.push(d-o)}return{mapped:i.length?new eo(s,r,i,l):null,pos:o}}}class E{constructor(e,t,i,s){this.chunkPos=e;this.chunk=t;this.nextLayer=i;this.maxPoint=s}static create(e,t,i,s){return new E(e,t,i,s)}get length(){let e=this.chunk.length-1;return e<0?0:Math.max(this.chunkEnd(e),this.nextLayer.length)}get size(){if(this.isEmpty)return 0;let e=this.nextLayer.size;for(let t of this.chunk)e+=t.value.length;return e}chunkEnd(e){return this.chunkPos[e]+this.chunk[e].length}update(e){let{add:t=[],sort:i=false,filterFrom:s=0,filterTo:r=this.length}=e;let o=e.filter;if(t.length==0&&!o)return this;if(i)t=t.slice().sort(fr);if(this.isEmpty)return t.length?E.of(t):this;let l=new Ja(this,null,-1).goto(0),a=0,h=[];let c=new xt;while(l.value||a=0){let f=t[a++];if(!c.addInner(f.from,f.to,f.value))h.push(f)}else if(l.rangeIndex==1&&l.chunkIndexthis.chunkEnd(l.chunkIndex)||rl.to||r=r&&e<=r+o.length&&o.between(r,e-r,t-r,i)===false)return}this.nextLayer.between(e,t,i)}iter(e=0){return Ci.from([this]).goto(e)}get isEmpty(){return this.nextLayer==this}static iter(e,t=0){return Ci.from(e).goto(t)}static compare(e,t,i,s,r=-1){let o=e.filter(f=>f.maxPoint>0||!f.isEmpty&&f.maxPoint>=r);let l=t.filter(f=>f.maxPoint>0||!f.isEmpty&&f.maxPoint>=r);let a=Fo(o,l,i);let h=new ui(o,a,r);let c=new ui(l,a,r);i.iterGaps((f,u,d)=>Ho(h,f,c,u,d,s));if(i.empty&&i.length==0)Ho(h,0,c,0,0,s)}static eq(e,t,i=0,s){if(s==null)s=1e9-1;let r=e.filter(c=>!c.isEmpty&&t.indexOf(c)<0);let o=t.filter(c=>!c.isEmpty&&e.indexOf(c)<0);if(r.length!=o.length)return false;if(!r.length)return true;let l=Fo(r,o);let a=new ui(r,l,0).goto(i),h=new ui(o,l,0).goto(i);for(;;){if(a.to!=h.to||!ur(a.active,h.active)||a.point&&(!h.point||!a.point.eq(h.point)))return false;if(a.to>s)return true;a.next();h.next()}}static spans(e,t,i,s,r=-1){let o=new ui(e,null,r).goto(t),l=t;let a=o.openStart;for(;;){let h=Math.min(o.to,i);if(o.point){let c=o.activeForPoint(o.to);let f=o.pointFroml){s.span(l,h,o.active,a);a=o.openEnd(h)}if(o.to>i)return a+(o.point&&o.to>i?1:0);l=o.to;o.next()}}static of(e,t=false){let i=new xt;for(let s of e instanceof Ai?[e]:t?Hu(e):e)i.add(s.from,s.to,s.value);return i.finish()}static join(e){if(!e.length)return E.empty;let t=e[e.length-1];for(let i=e.length-2;i>=0;i--){for(let s=e[i];s!=E.empty;s=s.nextLayer)t=new E(s.chunkPos,s.chunk,t,Math.max(s.maxPoint,t.maxPoint))}return t}}E.empty=new E([],[],null,-1);function Hu(n){if(n.length>1)for(let e=n[0],t=1;t0)return n.slice().sort(fr);e=i}return n}E.empty.nextLayer=E.empty;class xt{finishChunk(e){this.chunks.push(new eo(this.from,this.to,this.value,this.maxPoint));this.chunkPos.push(this.chunkStart);this.chunkStart=-1;this.setMaxPoint=Math.max(this.setMaxPoint,this.maxPoint);this.maxPoint=-1;if(e){this.from=[];this.to=[];this.value=[]}}constructor(){this.chunks=[];this.chunkPos=[];this.chunkStart=-1;this.last=null;this.lastFrom=-1e9;this.lastTo=-1e9;this.from=[];this.to=[];this.value=[];this.maxPoint=-1;this.setMaxPoint=-1;this.nextLayer=null}add(e,t,i){if(!this.addInner(e,t,i))(this.nextLayer||(this.nextLayer=new xt)).add(e,t,i)}addInner(e,t,i){let s=e-this.lastTo||i.startSide-this.last.endSide;if(s<=0&&(e-this.lastFrom||i.startSide-this.last.startSide)<0)throw new Error("Ranges must be added sorted by `from` position and `startSide`");if(s<0)return false;if(this.from.length==250)this.finishChunk(true);if(this.chunkStart<0)this.chunkStart=e;this.from.push(e-this.chunkStart);this.to.push(t-this.chunkStart);this.last=i;this.lastFrom=e;this.lastTo=t;this.value.push(i);if(i.point)this.maxPoint=Math.max(this.maxPoint,t-e);return true}addChunk(e,t){if((e-this.lastTo||t.value[0].startSide-this.last.endSide)<0)return false;if(this.from.length)this.finishChunk(true);this.setMaxPoint=Math.max(this.setMaxPoint,t.maxPoint);this.chunks.push(t);this.chunkPos.push(e);let i=t.value.length-1;this.last=t.value[i];this.lastFrom=t.from[i]+e;this.lastTo=t.to[i]+e;return true}finish(){return this.finishInner(E.empty)}finishInner(e){if(this.from.length)this.finishChunk(false);if(this.chunks.length==0)return e;let t=E.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(e):e,this.setMaxPoint);this.from=null;return t}}function Fo(n,e,t){let i=new Map;for(let r of n)for(let o=0;o=this.minPoint)break}}}setRangeIndex(e){if(e==this.layer.chunk[this.chunkIndex].value.length){this.chunkIndex++;if(this.skip){while(this.chunkIndex=i)s.push(new Ja(o,t,i,r))}}return s.length==1?s[0]:new Ci(s)}get startSide(){return this.value?this.value.startSide:0}goto(e,t=-1e9){for(let i of this.heap)i.goto(e,t);for(let i=this.heap.length>>1;i>=0;i--)$s(this.heap,i);this.next();return this}forward(e,t){for(let i of this.heap)i.forward(e,t);for(let i=this.heap.length>>1;i>=0;i--)$s(this.heap,i);if((this.to-e||this.value.endSide-t)<0)this.next()}next(){if(this.heap.length==0){this.from=this.to=1e9;this.value=null;this.rank=-1}else{let e=this.heap[0];this.from=e.from;this.to=e.to;this.value=e.value;this.rank=e.rank;if(e.value)e.next();$s(this.heap,0)}}}function $s(n,e){for(let t=n[e];;){let i=(e<<1)+1;if(i>=n.length)break;let s=n[i];if(i+1=0){s=n[i+1];i++}if(t.compare(s)<0)break;n[i]=t;n[e]=s;e=i}}class ui{constructor(e,t,i){this.minPoint=i;this.active=[];this.activeTo=[];this.activeRank=[];this.minActive=-1;this.point=null;this.pointFrom=0;this.pointRank=0;this.to=-1e9;this.endSide=0;this.openStart=-1;this.cursor=Ci.from(e,t,i)}goto(e,t=-1e9){this.cursor.goto(e,t);this.active.length=this.activeTo.length=this.activeRank.length=0;this.minActive=-1;this.to=e;this.endSide=t;this.openStart=-1;this.next();return this}forward(e,t){while(this.minActive>-1&&(this.activeTo[this.minActive]-e||this.active[this.minActive].endSide-t)<0)this.removeActive(this.minActive);this.cursor.forward(e,t)}removeActive(e){rn(this.active,e);rn(this.activeTo,e);rn(this.activeRank,e);this.minActive=Ko(this.active,this.activeTo)}addActive(e){let t=0,{value:i,to:s,rank:r}=this.cursor;while(t0)t++;on(this.active,t,i);on(this.activeTo,t,s);on(this.activeRank,t,r);if(e)on(e,t,this.cursor.from);this.minActive=Ko(this.active,this.activeTo)}next(){let e=this.to,t=this.point;this.point=null;let i=this.openStart<0?[]:null;for(;;){let s=this.minActive;if(s>-1&&(this.activeTo[s]-this.cursor.from||this.active[s].endSide-this.cursor.startSide)<0){if(this.activeTo[s]>e){this.to=this.activeTo[s];this.endSide=this.active[s].endSide;break}this.removeActive(s);if(i)rn(i,s)}else if(!this.cursor.value){this.to=this.endSide=1e9;break}else if(this.cursor.from>e){this.to=this.cursor.from;this.endSide=this.cursor.startSide;break}else{let r=this.cursor.value;if(!r.point){this.addActive(i);this.cursor.next()}else if(t&&this.cursor.to==this.to&&this.cursor.from=0&&i[s]=0;i--){if(this.activeRank[i]e||this.activeTo[i]==e&&this.active[i].endSide>=this.point.endSide)t.push(this.active[i])}return t.reverse()}openEnd(e){let t=0;for(let i=this.activeTo.length-1;i>=0&&this.activeTo[i]>e;i--)t++;return t}}function Ho(n,e,t,i,s,r){n.goto(e);t.goto(i);let o=i+s;let l=i,a=i-e;for(;;){let h=n.to+a-t.to||n.endSide-t.endSide;let c=h<0?n.to+a:t.to,f=Math.min(c,o);if(n.point||t.point){if(!(n.point&&t.point&&(n.point==t.point||n.point.eq(t.point))&&ur(n.activeForPoint(n.to),t.activeForPoint(t.to))))r.comparePoint(l,f,n.point,t.point)}else{if(f>l&&!ur(n.active,t.active))r.compareRange(l,f,n.active,t.active)}if(c>o)break;l=c;if(h<=0)n.next();if(h>=0)t.next()}}function ur(n,e){if(n.length!=e.length)return false;for(let t=0;t=e;i--)n[i+1]=n[i];n[e]=t}function Ko(n,e){let t=-1,i=1e9;for(let s=0;s=e)return s;if(s==n.length)break;r+=n.charCodeAt(s)==9?t-r%t:1;s=ue(n,s)}return i===true?-1:n.length}const Or="ͼ";const Jo=typeof Symbol=="undefined"?"__"+Or:Symbol.for(Or);const pr=typeof Symbol=="undefined"?"__styleSet"+Math.floor(Math.random()*1e8):Symbol("styleSet");const el=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:{};class St{constructor(e,t){this.rules=[];let{finish:i}=t||{};function s(o){return/^@/.test(o)?[o]:o.split(/,\s*/)}function r(o,l,a,h){let c=[],f=/^@(\w+)\b/.exec(o[0]),u=f&&f[1]=="keyframes";if(f&&l==null)return a.push(o[0]+";");for(let d in l){let O=l[d];if(/&/.test(d)){r(d.split(/,\s*/).map(p=>o.map(m=>p.replace(/&/,m))).reduce((p,m)=>p.concat(m)),O,a)}else if(O&&typeof O=="object"){if(!f)throw new RangeError("The value of a property ("+d+") should be a primitive value.");r(s(d),O,c,u)}else if(O!=null){c.push(d.replace(/_.*/,"").replace(/[A-Z]/g,p=>"-"+p.toLowerCase())+": "+O+";")}}if(c.length||u){a.push((i&&!f&&!h?o.map(i):o).join(", ")+" {"+c.join(" ")+"}")}}for(let o in e)r(s(o),e[o],this.rules)}getRules(){return this.rules.join("\n")}static newName(){let e=el[Jo]||1;el[Jo]=e+1;return Or+e.toString(36)}static mount(e,t,i){let s=e[pr],r=i&&i.nonce;if(!s)s=new Ku(e,r);else if(r)s.setNonce(r);s.mount(Array.isArray(t)?t:[t],e)}}let tl=new Map;class Ku{constructor(e,t){let i=e.ownerDocument||e,s=i.defaultView;if(!e.head&&e.adoptedStyleSheets&&s.CSSStyleSheet){let r=tl.get(i);if(r)return e[pr]=r;this.sheet=new s.CSSStyleSheet;tl.set(i,this)}else{this.styleTag=i.createElement("style");if(t)this.styleTag.setAttribute("nonce",t)}this.modules=[];e[pr]=this}mount(e,t){let i=this.sheet;let s=0,r=0;for(let o=0;o-1){this.modules.splice(a,1);r--;a=-1}if(a==-1){this.modules.splice(r++,0,l);if(i)for(let h=0;h",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'};var Ju=typeof navigator!="undefined"&&/Mac/.test(navigator.platform);var ed=typeof navigator!="undefined"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var he=0;he<10;he++)wt[48+he]=wt[96+he]=String(he);for(var he=1;he<=24;he++)wt[he+111]="F"+he;for(var he=65;he<=90;he++){wt[he]=String.fromCharCode(he+32);Mi[he]=String.fromCharCode(he)}for(var vs in wt)if(!Mi.hasOwnProperty(vs))Mi[vs]=wt[vs];function td(n){var e=Ju&&n.metaKey&&n.shiftKey&&!n.ctrlKey&&!n.altKey||ed&&n.shiftKey&&n.key&&n.key.length==1||n.key=="Unidentified";var t=!e&&n.key||(n.shiftKey?Mi:wt)[n.keyCode]||n.key||"Unidentified";if(t=="Esc")t="Escape";if(t=="Del")t="Delete";if(t=="Left")t="ArrowLeft";if(t=="Up")t="ArrowUp";if(t=="Right")t="ArrowRight";if(t=="Down")t="ArrowDown";return t}function zn(n){let e;if(n.nodeType==11){e=n.getSelection?n:n.ownerDocument}else{e=n}return e.getSelection()}function mr(n,e){return e?n==e||n.contains(e.nodeType!=1?e.parentNode:e):false}function id(n){let e=n.activeElement;while(e&&e.shadowRoot)e=e.shadowRoot.activeElement;return e}function vn(n,e){if(!e.anchorNode)return false;try{return mr(n,e.anchorNode)}catch(t){return false}}function Wi(n){if(n.nodeType==3)return Yt(n,0,n.nodeValue.length).getClientRects();else if(n.nodeType==1)return n.getClientRects();else return[]}function $i(n,e,t,i){return t?il(n,e,t,i,-1)||il(n,e,t,i,1):false}function Dt(n){for(var e=0;;e++){n=n.previousSibling;if(!n)return e}}function jn(n){return n.nodeType==1&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(n.nodeName)}function il(n,e,t,i,s){for(;;){if(n==t&&e==i)return true;if(e==(s<0?0:rt(n))){if(n.nodeName=="DIV")return false;let r=n.parentNode;if(!r||r.nodeType!=1)return false;e=Dt(n)+(s<0?0:1);n=r}else if(n.nodeType==1){n=n.childNodes[e+(s<0?-1:0)];if(n.nodeType==1&&n.contentEditable=="false")return false;e=s<0?rt(n):0}else{return false}}}function rt(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function to(n,e){let t=e?n.left:n.right;return{left:t,right:t,top:n.top,bottom:n.bottom}}function nd(n){let e=n.visualViewport;if(e)return{left:0,right:e.width,top:0,bottom:e.height};return{left:0,right:n.innerWidth,top:0,bottom:n.innerHeight}}function eh(n,e){let t=e.width/n.offsetWidth;let i=e.height/n.offsetHeight;if(t>.995&&t<1.005||!isFinite(t)||Math.abs(e.width-n.offsetWidth)<1)t=1;if(i>.995&&i<1.005||!isFinite(i)||Math.abs(e.height-n.offsetHeight)<1)i=1;return{scaleX:t,scaleY:i}}function sd(n,e,t,i,s,r,o,l){let a=n.ownerDocument,h=a.defaultView||window;for(let c=n,f=false;c&&!f;){if(c.nodeType==1){let u,d=c==a.body;let O=1,p=1;if(d){u=nd(h)}else{if(/^(fixed|sticky)$/.test(getComputedStyle(c).position))f=true;if(c.scrollHeight<=c.clientHeight&&c.scrollWidth<=c.clientWidth){c=c.assignedSlot||c.parentNode;continue}let S=c.getBoundingClientRect();({scaleX:O,scaleY:p}=eh(c,S));u={left:S.left,right:S.left+c.clientWidth*O,top:S.top,bottom:S.top+c.clientHeight*p}}let m=0,b=0;if(s=="nearest"){if(e.top0&&e.bottom>u.bottom+b)b=e.bottom-u.bottom+b+o}else if(e.bottom>u.bottom){b=e.bottom-u.bottom+o;if(t<0&&e.top-b0&&e.right>u.right+m)m=e.right-u.right+m+r}else if(e.right>u.right){m=e.right-u.right+r;if(t<0&&e.leftt.clientHeight||t.scrollWidth>t.clientWidth)return t;t=t.assignedSlot||t.parentNode}else if(t.nodeType==11){t=t.host}else{break}}return null}class od{constructor(){this.anchorNode=null;this.anchorOffset=0;this.focusNode=null;this.focusOffset=0}eq(e){return this.anchorNode==e.anchorNode&&this.anchorOffset==e.anchorOffset&&this.focusNode==e.focusNode&&this.focusOffset==e.focusOffset}setRange(e){let{anchorNode:t,focusNode:i}=e;this.set(t,Math.min(e.anchorOffset,t?rt(t):0),i,Math.min(e.focusOffset,i?rt(i):0))}set(e,t,i,s){this.anchorNode=e;this.anchorOffset=t;this.focusNode=i;this.focusOffset=s}}let zt=null;function th(n){if(n.setActive)return n.setActive();if(zt)return n.focus(zt);let e=[];for(let t=n;t;t=t.parentNode){e.push(t,t.scrollTop,t.scrollLeft);if(t==t.ownerDocument)break}n.focus(zt==null?{get preventScroll(){zt={preventScroll:true};return true}}:void 0);if(!zt){zt=false;for(let t=0;tMath.max(1,n.scrollHeight-n.clientHeight-4)}function sh(n,e){for(let t=n,i=e;;){if(t.nodeType==3&&i>0){return{node:t,offset:i}}else if(t.nodeType==1&&i>0){if(t.contentEditable=="false")return null;t=t.childNodes[i-1];i=rt(t)}else if(t.parentNode&&!jn(t)){i=Dt(t);t=t.parentNode}else{return null}}}function rh(n,e){for(let t=n,i=e;;){if(t.nodeType==3&&it)return f.domBoundsAround(e,t,h);if(u>=e&&s==-1){s=a;r=h}if(h>t&&f.dom.parentNode==this.dom){o=a;l=c;break}c=u;h=u+f.breakAfter}return{from:r,to:l<0?i+this.length:l,startDOM:(s?this.children[s-1].dom.nextSibling:null)||this.dom.firstChild,endDOM:o=0?this.children[o].dom:null}}markDirty(e=false){this.flags|=2;this.markParentsDirty(e)}markParentsDirty(e){for(let t=this.parent;t;t=t.parent){if(e)t.flags|=2;if(t.flags&1)return;t.flags|=1;e=false}}setParent(e){if(this.parent!=e){this.parent=e;if(this.flags&7)this.markParentsDirty(true)}}setDOM(e){if(this.dom==e)return;if(this.dom)this.dom.cmView=null;this.dom=e;e.cmView=this}get rootView(){for(let e=this;;){let t=e.parent;if(!t)return e;e=t}}replaceChildren(e,t,i=io){this.markDirty();for(let s=e;sthis.pos||e==this.pos&&(t>0||this.i==0||this.children[this.i-1].breakAfter)){this.off=e-this.pos;return this}let i=this.children[--this.i];this.pos-=i.length+i.breakAfter}}}function lh(n,e,t,i,s,r,o,l,a){let{children:h}=n;let c=h.length?h[e]:null;let f=r.length?r[r.length-1]:null;let u=f?f.breakAfter:o;if(e==i&&c&&!o&&!u&&r.length<2&&c.merge(t,s,r.length?f:null,t==0,l,a))return;if(i0){if(!o&&r.length&&c.merge(t,c.length,r[0],false,l,0)){c.breakAfter=r.shift().breakAfter}else if(t2);var R={mac:ll||/Mac/.test(Ae.platform),windows:/Win/.test(Ae.platform),linux:/Linux|X11/.test(Ae.platform),ie:as,ie_version:hh?gr.documentMode||6:yr?+yr[1]:br?+br[1]:0,gecko:rl,gecko_version:rl?+(/Firefox\/(\d+)/.exec(Ae.userAgent)||[0,0])[1]:0,chrome:!!Zs,chrome_version:Zs?+Zs[1]:0,ios:ll,android:/Android\b/.test(Ae.userAgent),webkit:ol,safari:ch,webkit_version:ol?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0,tabSize:gr.documentElement.style.tabSize!=null?"tab-size":"-moz-tab-size"};const hd=256;class ze extends B{constructor(e){super();this.text=e}get length(){return this.text.length}createDOM(e){this.setDOM(e||document.createTextNode(this.text))}sync(e,t){if(!this.dom)this.createDOM();if(this.dom.nodeValue!=this.text){if(t&&t.node==this.dom)t.written=true;this.dom.nodeValue=this.text}}reuseDOM(e){if(e.nodeType==3)this.createDOM(e)}merge(e,t,i){if(this.flags&8||i&&(!(i instanceof ze)||this.length-(t-e)+i.length>hd||i.flags&8))return false;this.text=this.text.slice(0,e)+(i?i.text:"")+this.text.slice(t);this.markDirty();return true}split(e){let t=new ze(this.text.slice(e));this.text=this.text.slice(0,e);this.markDirty();t.flags|=this.flags&8;return t}localPosFromDOM(e,t){return e==this.dom?t:t?this.text.length:0}domAtPos(e){return new Oe(this.dom,e)}domBoundsAround(e,t,i){return{from:i,to:i+this.length,startDOM:this.dom,endDOM:this.dom.nextSibling}}coordsAt(e,t){return cd(this.dom,e,t)}}class ot extends B{constructor(e,t=[],i=0){super();this.mark=e;this.children=t;this.length=i;for(let s of t)s.setParent(this)}setAttrs(e){ih(e);if(this.mark.class)e.className=this.mark.class;if(this.mark.attrs)for(let t in this.mark.attrs)e.setAttribute(t,this.mark.attrs[t]);return e}canReuseDOM(e){return super.canReuseDOM(e)&&!((this.flags|e.flags)&8)}reuseDOM(e){if(e.nodeName==this.mark.tagName.toUpperCase()){this.setDOM(e);this.flags|=4|2}}sync(e,t){if(!this.dom)this.setDOM(this.setAttrs(document.createElement(this.mark.tagName)));else if(this.flags&4)this.setAttrs(this.dom);super.sync(e,t)}merge(e,t,i,s,r,o){if(i&&(!(i instanceof ot&&i.mark.eq(this.mark))||e&&r<=0||te)t.push(i=e)s=r;i=a;r++}let o=this.length-e;this.length=e;if(s>-1){this.children.length=s;this.markDirty()}return new ot(this.mark,t,o)}domAtPos(e){return fh(this,e)}coordsAt(e,t){return dh(this,e,t)}}function cd(n,e,t){let i=n.nodeValue.length;if(e>i)e=i;let s=e,r=e,o=0;if(e==0&&t<0||e==i&&t>=0){if(!(R.chrome||R.gecko)){if(e){s--;o=1}else if(r=0)?0:l.length-1];if(R.safari&&!o&&a.width==0)a=Array.prototype.find.call(l,h=>h.width)||a;return o?to(a,o<0):a||null}class Ot extends B{static create(e,t,i){return new Ot(e,t,i)}constructor(e,t,i){super();this.widget=e;this.length=t;this.side=i;this.prevWidget=null}split(e){let t=Ot.create(this.widget,this.length-e,this.side);this.length-=e;return t}sync(e){if(!this.dom||!this.widget.updateDOM(this.dom,e)){if(this.dom&&this.prevWidget)this.prevWidget.destroy(this.dom);this.prevWidget=null;this.setDOM(this.widget.toDOM(e));if(!this.widget.editable)this.dom.contentEditable="false"}}getSide(){return this.side}merge(e,t,i,s,r,o){if(i&&(!(i instanceof Ot)||!this.widget.compare(i.widget)||e>0&&r<=0||t0)?Oe.before(this.dom):Oe.after(this.dom,e==this.length)}domBoundsAround(){return null}coordsAt(e,t){let i=this.widget.coordsAt(this.dom,e,t);if(i)return i;let s=this.dom.getClientRects(),r=null;if(!s.length)return null;let o=this.side?this.side<0:e>0;for(let l=o?s.length-1:0;;l+=o?-1:1){r=s[l];if(e>0?l==0:l==s.length-1||r.top0?Oe.before(this.dom):Oe.after(this.dom)}localPosFromDOM(){return 0}domBoundsAround(){return null}coordsAt(e){return this.dom.getBoundingClientRect()}get overrideDOMText(){return _.empty}get isHidden(){return true}}ze.prototype.children=Ot.prototype.children=ti.prototype.children=io;function fh(n,e){let t=n.dom,{children:i}=n,s=0;for(let r=0;sr&&e0;r--){let o=i[r-1];if(o.dom.parentNode==t)return o.domAtPos(o.length)}for(let r=s;r0&&e instanceof ot&&s.length&&(i=s[s.length-1])instanceof ot&&i.mark.eq(e.mark)){uh(i,e.children[0],t-1)}else{s.push(e);e.setParent(n)}n.length+=e.length}function dh(n,e,t){let i=null,s=-1,r=null,o=-1;function l(h,c){for(let f=0,u=0;f=c){if(d.children.length){l(d,c-u)}else if((!r||r.isHidden&&t>0)&&(O>c||u==O&&d.getSide()>0)){r=d;o=c-u}else if(u-1?1:0)!=s.length-(t&&s.indexOf(t)>-1?1:0))return false;for(let r of i){if(r!=t&&(s.indexOf(r)==-1||n[r]!==e[r]))return false}return true}function Sr(n,e,t){let i=false;if(e){for(let s in e)if(!(t&&s in t)){i=true;if(s=="style")n.style.cssText="";else n.removeAttribute(s)}}if(t){for(let s in t)if(!(e&&e[s]==t[s])){i=true;if(s=="style")n.style.cssText=t[s];else n.setAttribute(s,t[s])}}return i}function ud(n){let e=Object.create(null);for(let t=0;t0&&this.children[i-1].length==0)this.children[--i].destroy();this.children.length=i;this.markDirty();this.length=e;return t}transferDOM(e){if(!this.dom)return;this.markDirty();e.setDOM(this.dom);e.prevAttrs=this.prevAttrs===void 0?this.attrs:this.prevAttrs;this.prevAttrs=void 0;this.dom=null}setDeco(e){if(!no(this.attrs,e)){if(this.dom){this.prevAttrs=this.attrs;this.markDirty()}this.attrs=e}}append(e,t){uh(this,e,t)}addLineDeco(e){let t=e.spec.attributes,i=e.spec.class;if(t)this.attrs=xr(t,this.attrs||{});if(i)this.attrs=xr({class:i},this.attrs||{})}domAtPos(e){return fh(this,e)}reuseDOM(e){if(e.nodeName=="DIV"){this.setDOM(e);this.flags|=4|2}}sync(e,t){var i;if(!this.dom){this.setDOM(document.createElement("div"));this.dom.className="cm-line";this.prevAttrs=this.attrs?null:void 0}else if(this.flags&4){ih(this.dom);this.dom.className="cm-line";this.prevAttrs=this.attrs?null:void 0}if(this.prevAttrs!==void 0){Sr(this.dom,this.prevAttrs,this.attrs);this.dom.classList.add("cm-line");this.prevAttrs=void 0}super.sync(e,t);let s=this.dom.lastChild;while(s&&B.get(s)instanceof ot)s=s.lastChild;if(!s||!this.length||s.nodeName!="BR"&&((i=B.get(s))===null||i===void 0?void 0:i.isEditable)==false&&(!R.ios||!this.children.some(r=>r instanceof ze))){let r=document.createElement("BR");r.cmIgnore=true;this.dom.appendChild(r)}}measureTextSize(){if(this.children.length==0||this.length>20)return null;let e=0,t;for(let i of this.children){if(!(i instanceof ze)||/[^ -~]/.test(i.text))return null;let s=Wi(i.dom);if(s.length!=1)return null;e+=s[0].width;t=s[0].height}return!e?null:{lineHeight:this.dom.getBoundingClientRect().height,charWidth:e/this.length,textHeight:t}}coordsAt(e,t){let i=dh(this,e,t);if(!this.children.length&&i&&this.parent){let{heightOracle:s}=this.parent.view.viewState,r=i.bottom-i.top;if(Math.abs(r-s.lineHeight)<2&&s.textHeight=t){if(r instanceof ie)return r;if(o>t)break}s=o+r.breakAfter}return null}}class mt extends B{constructor(e,t,i){super();this.widget=e;this.length=t;this.deco=i;this.breakAfter=0;this.prevWidget=null}merge(e,t,i,s,r,o){if(i&&(!(i instanceof mt)||!this.widget.compare(i.widget)||e>0&&r<=0||t0}}class ht{eq(e){return false}updateDOM(e,t){return false}compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}get estimatedHeight(){return-1}get lineBreaks(){return 0}ignoreEvent(e){return true}coordsAt(e,t,i){return null}get isHidden(){return false}get editable(){return false}destroy(e){}}var ge=function(n){n[n["Text"]=0]="Text";n[n["WidgetBefore"]=1]="WidgetBefore";n[n["WidgetAfter"]=2]="WidgetAfter";n[n["WidgetRange"]=3]="WidgetRange";return n}(ge||(ge={}));class T extends Xt{constructor(e,t,i,s){super();this.startSide=e;this.endSide=t;this.widget=i;this.spec=s}get heightRelevant(){return false}static mark(e){return new Ui(e)}static widget(e){let t=Math.max(-1e4,Math.min(1e4,e.side||0)),i=!!e.block;t+=i&&!e.inlineOrder?t>0?3e8:-4e8:t>0?1e8:-1e8;return new Qt(e,t,t,i,e.widget||null,false)}static replace(e){let t=!!e.block,i,s;if(e.isBlockGap){i=-5e8;s=4e8}else{let{start:r,end:o}=Oh(e,t);i=(r?t?-3e8:-1:5e8)-1;s=(o?t?2e8:1:-6e8)+1}return new Qt(e,i,s,t,e.widget||null,true)}static line(e){return new Ii(e)}static set(e,t=false){return E.of(e,t)}hasHeight(){return this.widget?this.widget.estimatedHeight>-1:false}}T.none=E.empty;class Ui extends T{constructor(e){let{start:t,end:i}=Oh(e);super(t?-1:5e8,i?1:-6e8,null,e);this.tagName=e.tagName||"span";this.class=e.class||"";this.attrs=e.attributes||null}eq(e){var t,i;return this==e||e instanceof Ui&&this.tagName==e.tagName&&(this.class||((t=this.attrs)===null||t===void 0?void 0:t.class))==(e.class||((i=e.attrs)===null||i===void 0?void 0:i.class))&&no(this.attrs,e.attrs,"class")}range(e,t=e){if(e>=t)throw new RangeError("Mark decorations may not be empty");return super.range(e,t)}}Ui.prototype.point=false;class Ii extends T{constructor(e){super(-2e8,-2e8,null,e)}eq(e){return e instanceof Ii&&this.spec.class==e.spec.class&&no(this.spec.attributes,e.spec.attributes)}range(e,t=e){if(t!=e)throw new RangeError("Line decoration ranges must be zero-length");return super.range(e,t)}}Ii.prototype.mapMode=ce.TrackBefore;Ii.prototype.point=true;class Qt extends T{constructor(e,t,i,s,r,o){super(t,i,r,e);this.block=s;this.isReplace=o;this.mapMode=!s?ce.TrackDel:t<=0?ce.TrackBefore:ce.TrackAfter}get type(){return this.startSide!=this.endSide?ge.WidgetRange:this.startSide<=0?ge.WidgetBefore:ge.WidgetAfter}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(e){return e instanceof Qt&&dd(this.widget,e.widget)&&this.block==e.block&&this.startSide==e.startSide&&this.endSide==e.endSide}range(e,t=e){if(this.isReplace&&(e>t||e==t&&this.startSide>0&&this.endSide<=0))throw new RangeError("Invalid range for replacement decoration");if(!this.isReplace&&t!=e)throw new RangeError("Widget decorations can only have zero-length ranges");return super.range(e,t)}}Qt.prototype.point=true;function Oh(n,e=false){let{inclusiveStart:t,inclusiveEnd:i}=n;if(t==null)t=n.inclusive;if(i==null)i=n.inclusive;return{start:t!==null&&t!==void 0?t:e,end:i!==null&&i!==void 0?i:e}}function dd(n,e){return n==e||!!(n&&e&&n.compare(e))}function wr(n,e,t,i=0){let s=t.length-1;if(s>=0&&t[s]+i>=n)t[s]=Math.max(t[s],e);else t.push(n,e)}class vi{constructor(e,t,i,s){this.doc=e;this.pos=t;this.end=i;this.disallowBlockEffectsFor=s;this.content=[];this.curLine=null;this.breakAtStart=0;this.pendingBuffer=0;this.bufferMarks=[];this.atCursorPos=true;this.openStart=-1;this.openEnd=-1;this.text="";this.textOff=0;this.cursor=e.iter();this.skip=t}posCovered(){if(this.content.length==0)return!this.breakAtStart&&this.doc.lineAt(this.pos).from!=this.pos;let e=this.content[this.content.length-1];return!(e.breakAfter||e instanceof mt&&e.deco.endSide<0)}getLine(){if(!this.curLine){this.content.push(this.curLine=new ie);this.atCursorPos=true}return this.curLine}flushBuffer(e=this.bufferMarks){if(this.pendingBuffer){this.curLine.append(ln(new ti(-1),e),e.length);this.pendingBuffer=0}}addBlockWidget(e){this.flushBuffer();this.curLine=null;this.content.push(e)}finish(e){if(this.pendingBuffer&&e<=this.bufferMarks.length)this.flushBuffer();else this.pendingBuffer=0;if(!this.posCovered()&&!(e&&this.content.length&&this.content[this.content.length-1]instanceof mt))this.getLine()}buildText(e,t,i){while(e>0){if(this.textOff==this.text.length){let{value:r,lineBreak:o,done:l}=this.cursor.next(this.skip);this.skip=0;if(l)throw new Error("Ran out of text content when drawing inline views");if(o){if(!this.posCovered())this.getLine();if(this.content.length)this.content[this.content.length-1].breakAfter=1;else this.breakAtStart=1;this.flushBuffer();this.curLine=null;this.atCursorPos=true;e--;continue}else{this.text=r;this.textOff=0}}let s=Math.min(this.text.length-this.textOff,e,512);this.flushBuffer(t.slice(t.length-i));this.getLine().append(ln(new ze(this.text.slice(this.textOff,this.textOff+s)),t),i);this.atCursorPos=true;this.textOff+=s;e-=s;i=0}}span(e,t,i,s){this.buildText(t-e,i,s);this.pos=t;if(this.openStart<0)this.openStart=s}point(e,t,i,s,r,o){if(this.disallowBlockEffectsFor[o]&&i instanceof Qt){if(i.block)throw new RangeError("Block decorations may not be specified via plugins");if(t>this.doc.lineAt(this.pos).to)throw new RangeError("Decorations that replace line breaks may not be specified via plugins")}let l=t-e;if(i instanceof Qt){if(i.block){if(i.startSide>0&&!this.posCovered())this.getLine();this.addBlockWidget(new mt(i.widget||ii.block,l,i))}else{let a=Ot.create(i.widget||ii.inline,l,l?0:i.startSide);let h=this.atCursorPos&&!a.isEditable&&r<=s.length&&(e0);let c=!a.isEditable&&(es.length||i.startSide<=0);let f=this.getLine();if(this.pendingBuffer==2&&!h&&!a.isEditable)this.pendingBuffer=0;this.flushBuffer(s);if(h){f.append(ln(new ti(1),s),r);r=s.length+Math.max(0,r-s.length)}f.append(ln(a,s),r);this.atCursorPos=c;this.pendingBuffer=!c?0:es.length?1:2;if(this.pendingBuffer)this.bufferMarks=s.slice()}}else if(this.doc.lineAt(this.pos).from==this.pos){this.getLine().addLineDeco(i)}if(l){if(this.textOff+l<=this.text.length){this.textOff+=l}else{this.skip+=l-(this.text.length-this.textOff);this.text="";this.textOff=0}this.pos=t}if(this.openStart<0)this.openStart=r}static build(e,t,i,s,r){let o=new vi(e,t,i,r);o.openEnd=E.spans(s,t,i,o);if(o.openStart<0)o.openStart=o.openEnd;o.finish(o.openEnd);return o}}function ln(n,e){for(let t of e)n=new ot(t,[n],n.length);return n}class ii extends ht{constructor(e){super();this.tag=e}eq(e){return e.tag==this.tag}toDOM(){return document.createElement(this.tag)}updateDOM(e){return e.nodeName.toLowerCase()==this.tag}get isHidden(){return true}}ii.inline=new ii("span");ii.block=new ii("div");var N=function(n){n[n["LTR"]=0]="LTR";n[n["RTL"]=1]="RTL";return n}(N||(N={}));const Et=N.LTR;const so=N.RTL;function ph(n){let e=[];for(let t=0;t=t){if(l.level==i)return o;if(r<0||(s!=0?s<0?l.fromt:e[r].level>l.level))r=o}}if(r<0)throw new RangeError("Index out of range");return r}}function gh(n,e){if(n.length!=e.length)return false;for(let t=0;t=0;p-=3){if(Ie[p+1]==-d){let m=Ie[p+2];let b=m&2?s:!(m&4)?0:m&1?r:s;if(b)L[f]=L[Ie[p]]=b;l=p;break}}}else if(Ie.length==189){break}else{Ie[l++]=f;Ie[l++]=u;Ie[l++]=a}}else if((O=L[f])==2||O==1){let p=O==s;a=p?0:1;for(let m=l-3;m>=0;m-=3){let b=Ie[m+2];if(b&2)break;if(p){Ie[m+2]|=2}else{if(b&4)break;Ie[m+2]|=4}}}}}}function yd(n,e,t,i){for(let s=0,r=i;s<=t.length;s++){let o=s?t[s-1].to:n,l=sa;){if(O==m){O=t[--p].from;m=p?t[p-1].to:n}L[--O]=d}a=c}else{r=h;a++}}}}function kr(n,e,t,i,s,r,o){let l=i%2?2:1;if(i%2==s%2){for(let a=e,h=0;aa)o.push(new pt(a,p.from,d));let m=p.direction==Et!=!(d%2);Pr(n,m?i+1:i,s,p.inner,p.from,p.to,o);a=p.to}O=p.to}else if(O==t||(c?L[O]!=l:L[O]==l)){break}else{O++}}if(u)kr(n,a,O,i+1,s,u,o);else if(ae;){let c=true,f=false;if(!h||a>r[h-1].to){let p=L[a-1];if(p!=l){c=false;f=p==16}}let u=!c&&l==1?[]:null;let d=c?i:i+1;let O=a;e:for(;;){if(h&&O==r[h-1].to){if(f)break e;let p=r[--h];if(!c)for(let m=p.from,b=h;;){if(m==e)break e;if(b&&r[b-1].to==m)m=r[--b].from;else if(L[m-1]==l)break e;else break}if(u){u.push(p)}else{if(p.toL.length)L[L.length]=256;let i=[],s=e==Et?0:1;Pr(n,s,s,t,0,n.length,i);return i}function bh(n){return[new pt(0,n,0)]}let yh="";function Sd(n,e,t,i,s){var r;let o=i.head-n.from;let l=pt.find(e,o,(r=i.bidiLevel)!==null&&r!==void 0?r:-1,i.assoc);let a=e[l],h=a.side(s,t);if(o==h){let u=l+=s?1:-1;if(u<0||u>=e.length)return null;a=e[l=u];o=a.side(!s,t);h=a.side(s,t)}let c=ue(n.text,o,a.forward(s,t));if(ca.to)c=h;yh=n.text.slice(Math.min(o,c),Math.max(o,c));let f=l==(s?e.length-1:0)?null:e[l+(s?1:-1)];if(f&&c==h&&f.level+(s?0:1)n.some(e=>e)});const vh=Z.define({combine:n=>n.some(e=>e)});const Zh=Z.define();class Ht{constructor(e,t="nearest",i="nearest",s=5,r=5,o=false){this.range=e;this.y=t;this.x=i;this.yMargin=s;this.xMargin=r;this.isSnapshot=o}map(e){return e.empty?this:new Ht(this.range.map(e),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}clip(e){return this.range.to<=e.doc.length?this:new Ht(y.cursor(e.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}}const an=A.define({map:(n,e)=>n.map(e)});function Qe(n,e,t){let i=n.facet(Qh);if(i.length)i[0](e);else if(window.onerror)window.onerror(String(e),t,void 0,void 0,e);else if(t)console.error(t+":",e);else console.error(e)}const hs=Z.define({combine:n=>n.length?n[0]:true});let Qd=0;const yi=Z.define();class ee{constructor(e,t,i,s,r){this.id=e;this.create=t;this.domEventHandlers=i;this.domEventObservers=s;this.extension=r(this)}static define(e,t){const{eventHandlers:i,eventObservers:s,provide:r,decorations:o}=t||{};return new ee(Qd++,e,i,s,l=>{let a=[yi.of(l)];if(o)a.push(Xi.of(h=>{let c=h.plugin(l);return c?o(c):T.none}));if(r)a.push(r(l));return a})}static fromClass(e,t){return ee.define(i=>new e(i),t)}}class Rs{constructor(e){this.spec=e;this.mustUpdate=null;this.value=null}update(e){if(!this.value){if(this.spec){try{this.value=this.spec.create(e)}catch(t){Qe(e.state,t,"CodeMirror plugin crashed");this.deactivate()}}}else if(this.mustUpdate){let t=this.mustUpdate;this.mustUpdate=null;if(this.value.update){try{this.value.update(t)}catch(i){Qe(t.state,i,"CodeMirror plugin crashed");if(this.value.destroy)try{this.value.destroy()}catch(s){}this.deactivate()}}}return this}destroy(e){var t;if((t=this.value)===null||t===void 0?void 0:t.destroy){try{this.value.destroy()}catch(i){Qe(e.state,i,"CodeMirror plugin crashed")}}}deactivate(){this.spec=this.value=null}}const Rh=Z.define();const ro=Z.define();const Xi=Z.define();const Th=Z.define();const oo=Z.define();const Ah=Z.define();function hl(n,e){let t=n.state.facet(Ah);if(!t.length)return t;let i=t.map(r=>r instanceof Function?r(n):r);let s=[];E.spans(i,e.from,e.to,{point(){},span(r,o,l,a){let h=r-e.from,c=o-e.from;let f=s;for(let u=l.length-1;u>=0;u--,a--){let d=l[u].spec.bidiIsolate,O;if(d==null)d=wd(e.text,h,c);if(a>0&&f.length&&(O=f[f.length-1]).to==h&&O.direction==d){O.to=c;f=O.inner}else{let p={from:h,to:c,direction:d,inner:[]};f.push(p);f=p.inner}}}});return s}const Ch=Z.define();function Mh(n){let e=0,t=0,i=0,s=0;for(let r of n.state.facet(Ch)){let o=r(n);if(o){if(o.left!=null)e=Math.max(e,o.left);if(o.right!=null)t=Math.max(t,o.right);if(o.top!=null)i=Math.max(i,o.top);if(o.bottom!=null)s=Math.max(s,o.bottom)}}return{left:e,right:t,top:i,bottom:s}}const xi=Z.define();class Ye{constructor(e,t,i,s){this.fromA=e;this.toA=t;this.fromB=i;this.toB=s}join(e){return new Ye(Math.min(this.fromA,e.fromA),Math.max(this.toA,e.toA),Math.min(this.fromB,e.fromB),Math.max(this.toB,e.toB))}addToSet(e){let t=e.length,i=this;for(;t>0;t--){let s=e[t-1];if(s.fromA>i.toA)continue;if(s.toAc)break;else r+=2}if(!a)return i;new Ye(a.fromA,a.toA,a.fromB,a.toB).addToSet(i);o=a.toA;l=a.toB}}}class Vn{constructor(e,t,i){this.view=e;this.state=t;this.transactions=i;this.flags=0;this.startState=e.state;this.changes=ne.empty(this.startState.doc.length);for(let r of i)this.changes=this.changes.compose(r.changes);let s=[];this.changes.iterChangedRanges((r,o,l,a)=>s.push(new Ye(r,o,l,a)));this.changedRanges=s}static create(e,t,i){return new Vn(e,t,i)}get viewportChanged(){return(this.flags&4)>0}get heightChanged(){return(this.flags&2)>0}get geometryChanged(){return this.docChanged||(this.flags&(8|2))>0}get focusChanged(){return(this.flags&1)>0}get docChanged(){return!this.changes.empty}get selectionSet(){return this.transactions.some(e=>e.selection)}get empty(){return this.flags==0&&this.transactions.length==0}}class cl extends B{get length(){return this.view.state.doc.length}constructor(e){super();this.view=e;this.decorations=[];this.dynamicDecorationMap=[];this.domChanged=null;this.hasComposition=null;this.markedForComposition=new Set;this.lastCompositionAfterCursor=false;this.minWidth=0;this.minWidthFrom=0;this.minWidthTo=0;this.impreciseAnchor=null;this.impreciseHead=null;this.forceSelection=false;this.lastUpdate=Date.now();this.setDOM(e.contentDOM);this.children=[new ie];this.children[0].setParent(this);this.updateDeco();this.updateInner([new Ye(0,0,0,e.state.doc.length)],0,null)}update(e){var t;let i=e.changedRanges;if(this.minWidth>0&&i.length){if(!i.every(({fromA:h,toA:c})=>cthis.minWidthTo)){this.minWidth=this.minWidthFrom=this.minWidthTo=0}else{this.minWidthFrom=e.changes.mapPos(this.minWidthFrom,1);this.minWidthTo=e.changes.mapPos(this.minWidthTo,1)}}let s=-1;if(this.view.inputState.composing>=0){if((t=this.domChanged)===null||t===void 0?void 0:t.newSel)s=this.domChanged.newSel.head;else if(!Td(e.changes,this.hasComposition)&&!e.selectionSet)s=e.state.selection.main.head}let r=s>-1?Pd(this.view,e.changes,s):null;this.domChanged=null;if(this.hasComposition){this.markedForComposition.clear();let{from:h,to:c}=this.hasComposition;i=new Ye(h,c,e.changes.mapPos(h,-1),e.changes.mapPos(c,1)).addToSet(i.slice())}this.hasComposition=r?{from:r.range.fromB,to:r.range.toB}:null;if((R.ie||R.chrome)&&!r&&e&&e.state.doc.lines!=e.startState.doc.lines)this.forceSelection=true;let o=this.decorations,l=this.updateDeco();let a=Zd(o,l,e.changes);i=Ye.extendWithRanges(i,a);if(!(this.flags&7)&&i.length==0){return false}else{this.updateInner(i,e.startState.doc.length,r);if(e.transactions.length)this.lastUpdate=Date.now();return true}}updateInner(e,t,i){this.view.viewState.mustMeasureContent=true;this.updateChildren(e,t,i);let{observer:s}=this.view;s.ignore(()=>{this.dom.style.height=this.view.viewState.contentHeight/this.view.scaleY+"px";this.dom.style.flexBasis=this.minWidth?this.minWidth+"px":"";let o=R.chrome||R.ios?{node:s.selectionRange.focusNode,written:false}:void 0;this.sync(this.view,o);this.flags&=~7;if(o&&(o.written||s.selectionRange.focusNode!=o.node))this.forceSelection=true;this.dom.style.height=""});this.markedForComposition.forEach(o=>o.flags&=~8);let r=[];if(this.view.viewport.from||this.view.viewport.to=0?s[o]:null;if(!l)break;let{fromA:a,toA:h,fromB:c,toB:f}=l,u,d,O,p;if(i&&i.range.fromBc){let w=vi.build(this.view.state.doc,c,i.range.fromB,this.decorations,this.dynamicDecorationMap);let x=vi.build(this.view.state.doc,i.range.toB,f,this.decorations,this.dynamicDecorationMap);d=w.breakAtStart;O=w.openStart;p=x.openEnd;let $=this.compositionView(i);if(x.breakAtStart){$.breakAfter=1}else if(x.content.length&&$.merge($.length,$.length,x.content[0],false,x.openStart,0)){$.breakAfter=x.content[0].breakAfter;x.content.shift()}if(w.content.length&&$.merge(0,0,w.content[w.content.length-1],true,0,w.openEnd)){w.content.pop()}u=w.content.concat($).concat(x.content)}else{({content:u,breakAtStart:d,openStart:O,openEnd:p}=vi.build(this.view.state.doc,c,f,this.decorations,this.dynamicDecorationMap))}let{i:m,off:b}=r.findPos(h,1);let{i:S,off:k}=r.findPos(a,-1);lh(this,S,k,m,b,u,d,O,p)}if(i)this.fixCompositionDOM(i)}compositionView(e){let t=new ze(e.text.nodeValue);t.flags|=8;for(let{deco:s}of e.marks)t=new ot(s,[t],t.length);let i=new ie;i.append(t,0);return i}fixCompositionDOM(e){let t=(r,o)=>{o.flags|=8|(o.children.some(a=>a.flags&7)?1:0);this.markedForComposition.add(o);let l=B.get(r);if(l&&l!=o)l.dom=null;o.setDOM(r)};let i=this.childPos(e.range.fromB,1);let s=this.children[i.i];t(e.line,s);for(let r=e.marks.length-1;r>=-1;r--){i=s.childPos(i.off,1);s=s.children[i.i];t(r>=0?e.marks[r].node:e.text,s)}}updateSelection(e=false,t=false){if(e||!this.view.observer.selectionRange.focusNode)this.view.observer.readSelectionRange();let i=this.view.root.activeElement,s=i==this.dom;let r=!s&&vn(this.dom,this.view.observer.selectionRange)&&!(i&&this.dom.contains(i));if(!(s||t||r))return;let o=this.forceSelection;this.forceSelection=false;let l=this.view.state.selection.main;let a=this.moveToLine(this.domAtPos(l.anchor));let h=l.empty?a:this.moveToLine(this.domAtPos(l.head));if(R.gecko&&l.empty&&!this.hasComposition&&kd(a)){let f=document.createTextNode("");this.view.observer.ignore(()=>a.node.insertBefore(f,a.node.childNodes[a.offset]||null));a=h=new Oe(f,0);o=true}let c=this.view.observer.selectionRange;if(o||!c.focusNode||(!$i(a.node,a.offset,c.anchorNode,c.anchorOffset)||!$i(h.node,h.offset,c.focusNode,c.focusOffset))&&!this.suppressWidgetCursorChange(c,l)){this.view.observer.ignore(()=>{if(R.android&&R.chrome&&this.dom.contains(c.focusNode)&&Rd(c.focusNode,this.dom)){this.dom.blur();this.dom.focus({preventScroll:true})}let f=zn(this.view.root);if(!f);else if(l.empty){if(R.gecko){let u=$d(a.node,a.offset);if(u&&u!=(1|2)){let d=(u==1?sh:rh)(a.node,a.offset);if(d)a=new Oe(d.node,d.offset)}}f.collapse(a.node,a.offset);if(l.bidiLevel!=null&&f.caretBidiLevel!==void 0)f.caretBidiLevel=l.bidiLevel}else if(f.extend){f.collapse(a.node,a.offset);try{f.extend(h.node,h.offset)}catch(u){}}else{let u=document.createRange();if(l.anchor>l.head)[a,h]=[h,a];u.setEnd(h.node,h.offset);u.setStart(a.node,a.offset);f.removeAllRanges();f.addRange(u)}if(r&&this.view.root.activeElement==this.dom){this.dom.blur();if(i)i.focus()}});this.view.observer.setSelectionRange(a,h)}this.impreciseAnchor=a.precise?null:new Oe(c.anchorNode,c.anchorOffset);this.impreciseHead=h.precise?null:new Oe(c.focusNode,c.focusOffset)}suppressWidgetCursorChange(e,t){return this.hasComposition&&t.empty&&$i(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)&&this.posFromDOM(e.focusNode,e.focusOffset)==t.head}enforceCursorAssoc(){if(this.hasComposition)return;let{view:e}=this,t=e.state.selection.main;let i=zn(e.root);let{anchorNode:s,anchorOffset:r}=e.observer.selectionRange;if(!i||!t.empty||!t.assoc||!i.modify)return;let o=ie.find(this,t.head);if(!o)return;let l=o.posAtStart;if(t.head==l||t.head==l+o.length)return;let a=this.coordsAt(t.head,-1),h=this.coordsAt(t.head,1);if(!a||!h||a.bottom>h.top)return;let c=this.domAtPos(t.head+t.assoc);i.collapse(c.node,c.offset);i.modify("move",t.assoc<0?"forward":"backward","lineboundary");e.observer.readSelectionRange();let f=e.observer.selectionRange;if(e.docView.posFromDOM(f.anchorNode,f.anchorOffset)!=t.from)i.collapse(s,r)}moveToLine(e){let t=this.dom,i;if(e.node!=t)return e;for(let s=e.offset;!i&&s=0;s--){let r=B.get(t.childNodes[s]);if(r instanceof ie)i=r.domAtPos(r.length)}return i?new Oe(i.node,i.offset,true):e}nearest(e){for(let t=e;t;){let i=B.get(t);if(i&&i.rootView==this)return i;t=t.parentNode}return null}posFromDOM(e,t){let i=this.nearest(e);if(!i)throw new RangeError("Trying to find position for a DOM position outside of the document");return i.localPosFromDOM(e,t)+i.posAtStart}domAtPos(e){let{i:t,off:i}=this.childCursor().findPos(e,-1);for(;t=0;o--){let l=this.children[o],a=r-l.breakAfter,h=a-l.length;if(ae||l.covers(1))&&(!i||l instanceof ie&&!(i instanceof ie&&t>=0))){i=l;s=h}r=h}return i?i.coordsAt(e-s,t):null}coordsForChar(e){let{i:t,off:i}=this.childPos(e,1),s=this.children[t];if(!(s instanceof ie))return null;while(s.children.length){let{i:l,off:a}=s.childPos(i,1);for(;;l++){if(l==s.children.length)return null;if((s=s.children[l]).length)break}i=a}if(!(s instanceof ze))return null;let r=ue(s.text,i);if(r==i)return null;let o=Yt(s.dom,i,r).getClientRects();for(let l=0;lMath.max(this.view.scrollDOM.clientWidth,this.minWidth)+1;let l=-1,a=this.view.textDirection==N.LTR;for(let h=0,c=0;cs)break;if(h>=i){let d=f.dom.getBoundingClientRect();t.push(d.height);if(o){let O=f.dom.lastChild;let p=O?Wi(O):[];if(p.length){let m=p[p.length-1];let b=a?m.right-d.left:d.right-m.left;if(b>l){l=b;this.minWidth=r;this.minWidthFrom=h;this.minWidthTo=u}}}}h=u+f.breakAfter}return t}textDirectionAt(e){let{i:t}=this.childPos(e,1);return getComputedStyle(this.children[t].dom).direction=="rtl"?N.RTL:N.LTR}measureTextSize(){for(let r of this.children){if(r instanceof ie){let o=r.measureTextSize();if(o)return o}}let e=document.createElement("div"),t,i,s;e.className="cm-line";e.style.width="99999px";e.style.position="absolute";e.textContent="abc def ghi jkl mno pqr stu";this.view.observer.ignore(()=>{this.dom.appendChild(e);let r=Wi(e.firstChild)[0];t=e.getBoundingClientRect().height;i=r?r.width/27:7;s=r?r.height:t;e.remove()});return{lineHeight:t,charWidth:i,textHeight:s}}childCursor(e=this.length){let t=this.children.length;if(t)e-=this.children[--t].length;return new oh(this.children,e,t)}computeBlockGapDeco(){let e=[],t=this.view.viewState;for(let i=0,s=0;;s++){let r=s==t.viewports.length?null:t.viewports[s];let o=r?r.from-1:this.length;if(o>i){let l=(t.lineBlockAt(o).bottom-t.lineBlockAt(i).top)/this.view.scaleY;e.push(T.replace({widget:new fl(l),block:true,inclusive:true,isBlockGap:true}).range(i,o))}if(!r)break;i=r.to+1}return T.set(e)}updateDeco(){let e=0;let t=this.view.state.facet(Xi).map(r=>{let o=this.dynamicDecorationMap[e++]=typeof r=="function";return o?r(this.view):r});let i=false,s=this.view.state.facet(Th).map((r,o)=>{let l=typeof r=="function";if(l)i=true;return l?r(this.view):r});if(s.length){this.dynamicDecorationMap[e++]=i;t.push(E.join(s))}this.decorations=[...t,this.computeBlockGapDeco(),this.view.viewState.lineGapDeco];while(et.anchor?-1:1),s;if(!i)return;if(!t.empty&&(s=this.coordsAt(t.anchor,t.anchor>t.head?-1:1)))i={left:Math.min(i.left,s.left),top:Math.min(i.top,s.top),right:Math.max(i.right,s.right),bottom:Math.max(i.bottom,s.bottom)};let r=Mh(this.view);let o={left:i.left-r.left,top:i.top-r.top,right:i.right+r.right,bottom:i.bottom+r.bottom};let{offsetWidth:l,offsetHeight:a}=this.view.scrollDOM;sd(this.view.scrollDOM,o,t.head{if(ie.from)t=true});return t}function Ad(n,e,t=1){let i=n.charCategorizer(e);let s=n.doc.lineAt(e),r=e-s.from;if(s.length==0)return y.cursor(e);if(r==0)t=1;else if(r==s.length)t=-1;let o=r,l=r;if(t<0)o=ue(s.text,r,false);else l=ue(s.text,r);let a=i(s.text.slice(o,l));while(o>0){let h=ue(s.text,o,false);if(i(s.text.slice(h,o))!=a)break;o=h}while(ln?e.left-n:Math.max(0,n-e.right)}function Md(n,e){return e.top>n?e.top-n:Math.max(0,n-e.bottom)}function Ts(n,e){return n.tope.top+1}function ul(n,e){return en.bottom?{top:n.top,left:n.left,right:n.right,bottom:e}:n}function vr(n,e,t){let i,s,r,o,l=false;let a,h,c,f;for(let O=n.firstChild;O;O=O.nextSibling){let p=Wi(O);for(let m=0;mk||o==k&&r>S){i=O;s=b;r=S;o=k;let w=k?t0?m0)}if(S==0){if(t>b.bottom&&(!c||c.bottomb.top)){h=O;f=b}}else if(c&&Ts(c,b)){c=dl(c,b.bottom)}else if(f&&Ts(f,b)){f=ul(f,b.top)}}}if(c&&c.bottom>=t){i=a;s=c}else if(f&&f.top<=t){i=h;s=f}if(!i)return{node:n,offset:0};let u=Math.max(s.left,Math.min(s.right,e));if(i.nodeType==3)return Ol(i,u,t);if(l&&i.contentEditable!="false")return vr(i,u,t);let d=Array.prototype.indexOf.call(n.childNodes,i)+(e>=(s.left+s.right)/2?1:0);return{node:n,offset:d}}function Ol(n,e,t){let i=n.nodeValue.length;let s=-1,r=1e9,o=0;for(let l=0;lt?c.top-t:t-c.bottom)-1;if(c.left-1<=e&&c.right+1>=e&&f=(c.left+c.right)/2,d=u;if(R.chrome||R.gecko){let O=Yt(n,l).getBoundingClientRect();if(O.left==c.right)d=!u}if(f<=0)return{node:n,offset:l+(d?1:0)};s=l+(d?1:0);r=f}}}return{node:n,offset:s>-1?s:o>0?n.nodeValue.length:0}}function Xh(n,e,t,i=-1){var s,r;let o=n.contentDOM.getBoundingClientRect(),l=o.top+n.viewState.paddingTop;let a,{docHeight:h}=n.viewState;let{x:c,y:f}=e,u=f-l;if(u<0)return 0;if(u>h)return n.state.doc.length;for(let w=n.viewState.heightOracle.textHeight/2,x=false;;){a=n.elementAtHeight(u);if(a.type==ge.Text)break;for(;;){u=i>0?a.bottom+w:a.top-w;if(u>=0&&u<=h)break;if(x)return t?null:0;x=true;i=-i}}f=l+u;let d=a.from;if(dn.viewport.to)return n.viewport.to==n.state.doc.length?n.state.doc.length:t?null:pl(n,o,a,c,f);let O=n.dom.ownerDocument;let p=n.root.elementFromPoint?n.root:O;let m=p.elementFromPoint(c,f);if(m&&!n.contentDOM.contains(m))m=null;if(!m){c=Math.max(o.left+1,Math.min(o.right-1,c));m=p.elementFromPoint(c,f);if(m&&!n.contentDOM.contains(m))m=null}let b,S=-1;if(m&&((s=n.docView.nearest(m))===null||s===void 0?void 0:s.isEditable)!=false){if(O.caretPositionFromPoint){let w=O.caretPositionFromPoint(c,f);if(w)({offsetNode:b,offset:S}=w)}else if(O.caretRangeFromPoint){let w=O.caretRangeFromPoint(c,f);if(w){({startContainer:b,startOffset:S}=w);if(!n.contentDOM.contains(b)||R.safari&&Wd(b,S,c)||R.chrome&&Xd(b,S,c))b=void 0}}}if(!b||!n.docView.dom.contains(b)){let w=ie.find(n.docView,d);if(!w)return u>a.top+a.height/2?a.to:a.from;({node:b,offset:S}=vr(w.dom,c,f))}let k=n.docView.nearest(b);if(!k)return null;if(k.isWidget&&((r=k.dom)===null||r===void 0?void 0:r.nodeType)==1){let w=k.dom.getBoundingClientRect();return e.yn.defaultLineHeight*1.5){let l=n.viewState.heightOracle.textHeight;let a=Math.floor((s-t.top-(n.defaultLineHeight-l)*.5)/l);r+=a*n.viewState.heightOracle.lineLength}let o=n.state.sliceDoc(t.from,t.to);return t.from+dr(o,r,n.state.tabSize)}function Wd(n,e,t){let i;if(n.nodeType!=3||e!=(i=n.nodeValue.length))return false;for(let s=n.nextSibling;s;s=s.nextSibling)if(s.nodeType!=1||s.nodeName!="BR")return false;return Yt(n,i-1,i).getBoundingClientRect().left>t}function Xd(n,e,t){if(e!=0)return false;for(let s=n;;){let r=s.parentNode;if(!r||r.nodeType!=1||r.firstChild!=s)return false;if(r.classList.contains("cm-line"))break;s=r}let i=n.nodeType==1?n.getBoundingClientRect():Yt(n,0,Math.max(n.nodeValue.length,1)).getBoundingClientRect();return t-i.left>5}function Zr(n,e){let t=n.lineBlockAt(e);if(Array.isArray(t.type))for(let i of t.type){if(i.to>e||i.to==e&&(i.to==t.to||i.type==ge.Text))return i}return t}function Dd(n,e,t,i){let s=Zr(n,e.head);let r=!i||s.type!=ge.Text||!(n.lineWrapping||s.widgetLineBreaks)?null:n.coordsAtPos(e.assoc<0&&e.head>s.from?e.head-1:e.head);if(r){let o=n.dom.getBoundingClientRect();let l=n.textDirectionAt(s.from);let a=n.posAtCoords({x:t==(l==N.LTR)?o.right-1:o.left+1,y:(r.top+r.bottom)/2});if(a!=null)return y.cursor(a,t?-1:1)}return y.cursor(t?s.to:s.from,t?-1:1)}function ml(n,e,t,i){let s=n.state.doc.lineAt(e.head),r=n.bidiSpans(s);let o=n.textDirectionAt(s.from);for(let l=e,a=null;;){let h=Sd(s,r,o,l,t),c=yh;if(!h){if(s.number==(t?n.state.doc.lines:1))return l;c="\n";s=n.state.doc.line(s.number+(t?1:-1));r=n.bidiSpans(s);h=n.visualLineSide(s,!t)}if(!a){if(!i)return h;a=i(c)}else if(!a(c)){return l}l=h}}function Yd(n,e,t){let i=n.state.charCategorizer(e);let s=i(t);return r=>{let o=i(r);if(s==G.Space)s=o;return s==o}}function Ed(n,e,t,i){let s=e.head,r=t?1:-1;if(s==(t?n.state.doc.length:0))return y.cursor(s,e.assoc);let o=e.goalColumn,l;let a=n.contentDOM.getBoundingClientRect();let h=n.coordsAtPos(s,e.assoc||-1),c=n.documentTop;if(h){if(o==null)o=h.left-a.left;l=r<0?h.top:h.bottom}else{let d=n.viewState.lineBlockAt(s);if(o==null)o=Math.min(a.right-a.left,n.defaultCharacterWidth*(s-d.from));l=(r<0?d.top:d.bottom)+c}let f=a.left+o;let u=i!==null&&i!==void 0?i:n.viewState.heightOracle.textHeight>>1;for(let d=0;;d+=10){let O=l+(u+d)*r;let p=Xh(n,{x:f,y:O},false,r);if(Oa.bottom||(r<0?ps)){let m=n.docView.coordsForChar(p);let b=!m||O{if(e>r&&es(n)),t.from,e.head>t.from?-1:1);return i==t.from?t:y.cursor(i,inull);if(R.gecko)tO(e.contentDOM.ownerDocument)}handleEvent(e){if(!Id(this.view,e)||this.ignoreDuringComposition(e))return;if(e.type=="keydown"&&this.keydown(e))return;this.runHandlers(e.type,e)}runHandlers(e,t){let i=this.handlers[e];if(i){for(let s of i.observers)s(this.view,t);for(let s of i.handlers){if(t.defaultPrevented)break;if(s(this.view,t)){t.preventDefault();break}}}}ensureHandlers(e){let t=_d(e),i=this.handlers,s=this.view.contentDOM;for(let r in t)if(r!="scroll"){let o=!t[r].handlers.length;let l=i[r];if(l&&o!=!l.handlers.length){s.removeEventListener(r,this.handleEvent);l=null}if(!l)s.addEventListener(r,this.handleEvent,{passive:o})}for(let r in i)if(r!="scroll"&&!t[r])s.removeEventListener(r,this.handleEvent);this.handlers=t}keydown(e){this.lastKeyCode=e.keyCode;this.lastKeyTime=Date.now();if(e.keyCode==9&&Date.now()i.keyCode==e.keyCode))&&!e.ctrlKey||zd.indexOf(e.key)>-1&&e.ctrlKey&&!e.shiftKey)){this.pendingIOSKey=t||e;setTimeout(()=>this.flushIOSKey(),250);return true}if(e.keyCode!=229)this.view.observer.forceFlush();return false}flushIOSKey(e){let t=this.pendingIOSKey;if(!t)return false;if(t.key=="Enter"&&e&&e.from0)return true;if(R.safari&&!R.ios&&this.compositionPendingKey&&Date.now()-this.compositionEndedAt<100){this.compositionPendingKey=false;return true}return false}startMouseSelection(e){if(this.mouseSelection)this.mouseSelection.destroy();this.mouseSelection=e}update(e){if(this.mouseSelection)this.mouseSelection.update(e);if(this.draggedContent&&e.docChanged)this.draggedContent=this.draggedContent.map(e.changes);if(e.transactions.length)this.lastKeyCode=this.lastSelectionTime=0}destroy(){if(this.mouseSelection)this.mouseSelection.destroy()}}function gl(n,e){return(t,i)=>{try{return e.call(n,i,t)}catch(s){Qe(t.state,s)}}}function _d(n){let e=Object.create(null);function t(i){return e[i]||(e[i]={observers:[],handlers:[]})}for(let i of n){let s=i.spec;if(s&&s.domEventHandlers)for(let r in s.domEventHandlers){let o=s.domEventHandlers[r];if(o)t(r).handlers.push(gl(i.value,o))}if(s&&s.domEventObservers)for(let r in s.domEventObservers){let o=s.domEventObservers[r];if(o)t(r).observers.push(gl(i.value,o))}}for(let i in je)t(i).handlers.push(je[i]);for(let i in Ee)t(i).observers.push(Ee[i]);return e}const Dh=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}];const zd="dthko";const Yh=[16,17,18,20,91,92,224,225];const hn=6;function cn(n){return Math.max(0,n)*.7+8}function jd(n,e){return Math.max(Math.abs(n.clientX-e.clientX),Math.abs(n.clientY-e.clientY))}class Vd{constructor(e,t,i,s){this.view=e;this.startEvent=t;this.style=i;this.mustSelect=s;this.scrollSpeed={x:0,y:0};this.scrolling=-1;this.lastEvent=t;this.scrollParent=rd(e.contentDOM);this.atoms=e.state.facet(oo).map(o=>o(e));let r=e.contentDOM.ownerDocument;r.addEventListener("mousemove",this.move=this.move.bind(this));r.addEventListener("mouseup",this.up=this.up.bind(this));this.extend=t.shiftKey;this.multiple=e.state.facet(q.allowMultipleSelections)&&Ld(e,t);this.dragging=Ud(e,t)&&zh(t)==1?null:false}start(e){if(this.dragging===false)this.select(e)}move(e){var t;if(e.buttons==0)return this.destroy();if(this.dragging||this.dragging==null&&jd(this.startEvent,e)<10)return;this.select(this.lastEvent=e);let i=0,s=0;let r=((t=this.scrollParent)===null||t===void 0?void 0:t.getBoundingClientRect())||{left:0,top:0,right:this.view.win.innerWidth,bottom:this.view.win.innerHeight};let o=Mh(this.view);if(e.clientX-o.left<=r.left+hn)i=-cn(r.left-e.clientX);else if(e.clientX+o.right>=r.right-hn)i=cn(e.clientX-r.right);if(e.clientY-o.top<=r.top+hn)s=-cn(r.top-e.clientY);else if(e.clientY+o.bottom>=r.bottom-hn)s=cn(e.clientY-r.bottom);this.setScrollSpeed(i,s)}up(e){if(this.dragging==null)this.select(this.lastEvent);if(!this.dragging)e.preventDefault();this.destroy()}destroy(){this.setScrollSpeed(0,0);let e=this.view.contentDOM.ownerDocument;e.removeEventListener("mousemove",this.move);e.removeEventListener("mouseup",this.up);this.view.inputState.mouseSelection=this.view.inputState.draggedContent=null}setScrollSpeed(e,t){this.scrollSpeed={x:e,y:t};if(e||t){if(this.scrolling<0)this.scrolling=setInterval(()=>this.scroll(),50)}else if(this.scrolling>-1){clearInterval(this.scrolling);this.scrolling=-1}}scroll(){if(this.scrollParent){this.scrollParent.scrollLeft+=this.scrollSpeed.x;this.scrollParent.scrollTop+=this.scrollSpeed.y}else{this.view.win.scrollBy(this.scrollSpeed.x,this.scrollSpeed.y)}if(this.dragging===false)this.select(this.lastEvent)}skipAtoms(e){let t=null;for(let i=0;ithis.select(this.lastEvent),20)}}function Ld(n,e){let t=n.state.facet(xh);return t.length?t[0](e):R.mac?e.metaKey:e.ctrlKey}function Bd(n,e){let t=n.state.facet(Sh);return t.length?t[0](e):R.mac?!e.altKey:!e.ctrlKey}function Ud(n,e){let{main:t}=n.state.selection;if(t.empty)return false;let i=zn(n.root);if(!i||i.rangeCount==0)return true;let s=i.getRangeAt(0).getClientRects();for(let r=0;r=e.clientX&&o.top<=e.clientY&&o.bottom>=e.clientY)return true}return false}function Id(n,e){if(!e.bubbles)return true;if(e.defaultPrevented)return false;for(let t=e.target,i;t!=n.contentDOM;t=t.parentNode)if(!t||t.nodeType==11||(i=B.get(t))&&i.ignoreEvent(e))return false;return true}const je=Object.create(null);const Ee=Object.create(null);const Eh=R.ie&&R.ie_version<15||R.ios&&R.webkit_version<604;function Nd(n){let e=n.dom.parentNode;if(!e)return;let t=e.appendChild(document.createElement("textarea"));t.style.cssText="position: fixed; left: -10000px; top: 10px";t.focus();setTimeout(()=>{n.focus();t.remove();qh(n,t.value)},50)}function qh(n,e){let{state:t}=n,i,s=1,r=t.toText(e);let o=r.lines==t.selection.ranges.length;let l=Rr!=null&&t.selection.ranges.every(a=>a.empty)&&Rr==r.toString();if(l){let a=-1;i=t.changeByRange(h=>{let c=t.doc.lineAt(h.from);if(c.from==a)return{range:h};a=c.from;let f=t.toText((o?r.line(s++).text:e)+t.lineBreak);return{changes:{from:c.from,insert:f},range:y.cursor(h.from+f.length)}})}else if(o){i=t.changeByRange(a=>{let h=r.line(s++);return{changes:{from:a.from,to:a.to,insert:h.text},range:y.cursor(a.from+h.length)}})}else{i=t.replaceSelection(r)}n.dispatch(i,{userEvent:"input.paste",scrollIntoView:true})}Ee.scroll=n=>{n.inputState.lastScrollTop=n.scrollDOM.scrollTop;n.inputState.lastScrollLeft=n.scrollDOM.scrollLeft};je.keydown=(n,e)=>{n.inputState.setSelectionOrigin("select");if(e.keyCode==27)n.inputState.lastEscPress=Date.now();return false};Ee.touchstart=(n,e)=>{n.inputState.lastTouchTime=Date.now();n.inputState.setSelectionOrigin("select.pointer")};Ee.touchmove=n=>{n.inputState.setSelectionOrigin("select.pointer")};je.mousedown=(n,e)=>{n.observer.flush();if(n.inputState.lastTouchTime>Date.now()-2e3)return false;let t=null;for(let i of n.state.facet(wh)){t=i(n,e);if(t)break}if(!t&&e.button==0)t=Hd(n,e);if(t){let i=!n.hasFocus;n.inputState.startMouseSelection(new Vd(n,e,t,i));if(i)n.observer.ignore(()=>th(n.contentDOM));let s=n.inputState.mouseSelection;if(s){s.start(e);return s.dragging===false}}return false};function bl(n,e,t,i){if(i==1){return y.cursor(e,t)}else if(i==2){return Ad(n.state,e,t)}else{let s=ie.find(n.docView,e),r=n.state.doc.lineAt(s?s.posAtEnd:e);let o=s?s.posAtStart:r.from,l=s?s.posAtEnd:r.to;if(ln>=e.top&&n<=e.bottom;let yl=(n,e,t)=>_h(e,t)&&n>=t.left&&n<=t.right;function Gd(n,e,t,i){let s=ie.find(n.docView,e);if(!s)return 1;let r=e-s.posAtStart;if(r==0)return 1;if(r==s.length)return-1;let o=s.coordsAt(r,-1);if(o&&yl(t,i,o))return-1;let l=s.coordsAt(r,1);if(l&&yl(t,i,l))return 1;return o&&_h(i,o)?-1:1}function xl(n,e){let t=n.posAtCoords({x:e.clientX,y:e.clientY},false);return{pos:t,bias:Gd(n,t,e.clientX,e.clientY)}}const Fd=R.ie&&R.ie_version<=11;let Sl=null;let wl=0;let Ql=0;function zh(n){if(!Fd)return n.detail;let e=Sl,t=Ql;Sl=n;Ql=Date.now();return wl=!e||t>Date.now()-400&&Math.abs(e.clientX-n.clientX)<2&&Math.abs(e.clientY-n.clientY)<2?(wl+1)%3:1}function Hd(n,e){let t=xl(n,e),i=zh(e);let s=n.state.selection;return{update(r){if(r.docChanged){t.pos=r.changes.mapPos(t.pos);s=s.map(r.changes)}},get(r,o,l){let a=xl(n,r),h;let c=bl(n,a.pos,a.bias,i);if(t.pos!=a.pos&&!o){let f=bl(n,t.pos,t.bias,i);let u=Math.min(f.from,c.from),d=Math.max(f.to,c.to);c=u1&&(h=Kd(s,a.pos)))return h;else if(l)return s.addRange(c);else return y.create([c])}}}function Kd(n,e){for(let t=0;t=e)return y.create(n.ranges.slice(0,t).concat(n.ranges.slice(t+1)),n.mainIndex==t?0:n.mainIndex-(n.mainIndex>t?1:0))}return null}je.dragstart=(n,e)=>{let{selection:{main:t}}=n.state;if(e.target.draggable){let s=n.docView.nearest(e.target);if(s&&s.isWidget){let r=s.posAtStart,o=r+s.length;if(r>=t.to||o<=t.from)t=y.range(r,o)}}let{inputState:i}=n;if(i.mouseSelection)i.mouseSelection.dragging=true;i.draggedContent=t;if(e.dataTransfer){e.dataTransfer.setData("Text",n.state.sliceDoc(t.from,t.to));e.dataTransfer.effectAllowed="copyMove"}return false};je.dragend=n=>{n.inputState.draggedContent=null;return false};function kl(n,e,t,i){if(!t)return;let s=n.posAtCoords({x:e.clientX,y:e.clientY},false);let{draggedContent:r}=n.inputState;let o=i&&r&&Bd(n,e)?{from:r.from,to:r.to}:null;let l={from:s,insert:t};let a=n.state.changes(o?[o,l]:l);n.focus();n.dispatch({changes:a,selection:{anchor:a.mapPos(s,-1),head:a.mapPos(s,1)},userEvent:o?"move.drop":"input.drop"});n.inputState.draggedContent=null}je.drop=(n,e)=>{if(!e.dataTransfer)return false;if(n.state.readOnly)return true;let t=e.dataTransfer.files;if(t&&t.length){let i=Array(t.length),s=0;let r=()=>{if(++s==t.length)kl(n,e,i.filter(o=>o!=null).join(n.state.lineBreak),false)};for(let o=0;o{if(!/[\x00-\x08\x0e-\x1f]{2}/.test(l.result))i[o]=l.result;r()};l.readAsText(t[o])}return true}else{let i=e.dataTransfer.getData("Text");if(i){kl(n,e,i,true);return true}}return false};je.paste=(n,e)=>{if(n.state.readOnly)return true;n.observer.flush();let t=Eh?null:e.clipboardData;if(t){qh(n,t.getData("text/plain")||t.getData("text/uri-list"));return true}else{Nd(n);return false}};function Jd(n,e){let t=n.dom.parentNode;if(!t)return;let i=t.appendChild(document.createElement("textarea"));i.style.cssText="position: fixed; left: -10000px; top: 10px";i.value=e;i.focus();i.selectionEnd=e.length;i.selectionStart=0;setTimeout(()=>{i.remove();n.focus()},50)}function eO(n){let e=[],t=[],i=false;for(let s of n.selection.ranges)if(!s.empty){e.push(n.sliceDoc(s.from,s.to));t.push(s)}if(!e.length){let s=-1;for(let{from:r}of n.selection.ranges){let o=n.doc.lineAt(r);if(o.number>s){e.push(o.text);t.push({from:o.from,to:Math.min(n.doc.length,o.to+1)})}s=o.number}i=true}return{text:e.join(n.lineBreak),ranges:t,linewise:i}}let Rr=null;je.copy=je.cut=(n,e)=>{let{text:t,ranges:i,linewise:s}=eO(n.state);if(!t&&!s)return false;Rr=s?t:null;if(e.type=="cut"&&!n.state.readOnly)n.dispatch({changes:i,scrollIntoView:true,userEvent:"delete.cut"});let r=Eh?null:e.clipboardData;if(r){r.clearData();r.setData("text/plain",t);return true}else{Jd(n,t);return false}};const jh=at.define();function Vh(n,e){let t=[];for(let i of n.facet(Ph)){let s=i(n,e);if(s)t.push(s)}return t?n.update({effects:t,annotations:jh.of(true)}):null}function Lh(n){setTimeout(()=>{let e=n.hasFocus;if(e!=n.inputState.notifiedFocused){let t=Vh(n.state,e);if(t)n.dispatch(t);else n.update([])}},10)}Ee.focus=n=>{n.inputState.lastFocusTime=Date.now();if(!n.scrollDOM.scrollTop&&(n.inputState.lastScrollTop||n.inputState.lastScrollLeft)){n.scrollDOM.scrollTop=n.inputState.lastScrollTop;n.scrollDOM.scrollLeft=n.inputState.lastScrollLeft}Lh(n)};Ee.blur=n=>{n.observer.clearSelectionRange();Lh(n)};Ee.compositionstart=Ee.compositionupdate=n=>{if(n.inputState.compositionFirstChange==null)n.inputState.compositionFirstChange=true;if(n.inputState.composing<0){n.inputState.composing=0}};Ee.compositionend=n=>{n.inputState.composing=-1;n.inputState.compositionEndedAt=Date.now();n.inputState.compositionPendingKey=true;n.inputState.compositionPendingChange=n.observer.pendingRecords().length>0;n.inputState.compositionFirstChange=null;if(R.chrome&&R.android){n.observer.flushSoon()}else if(n.inputState.compositionPendingChange){Promise.resolve().then(()=>n.observer.flush())}else{setTimeout(()=>{if(n.inputState.composing<0&&n.docView.hasComposition)n.update([])},50)}};Ee.contextmenu=n=>{n.inputState.lastContextMenu=Date.now()};je.beforeinput=(n,e)=>{var t;let i;if(R.chrome&&R.android&&(i=Dh.find(s=>s.inputType==e.inputType))){n.observer.delayAndroidKey(i.key,i.keyCode);if(i.key=="Backspace"||i.key=="Delete"){let s=((t=window.visualViewport)===null||t===void 0?void 0:t.height)||0;setTimeout(()=>{var r;if((((r=window.visualViewport)===null||r===void 0?void 0:r.height)||0)>s+10&&n.hasFocus){n.contentDOM.blur();n.focus()}},100)}}if(R.ios&&e.inputType=="deleteContentForward"){n.observer.flushSoon()}if(R.safari&&e.inputType=="insertText"&&n.inputState.composing>=0){setTimeout(()=>Ee.compositionend(n,e),20)}return false};const Pl=new Set;function tO(n){if(!Pl.has(n)){Pl.add(n);n.addEventListener("copy",()=>{});n.addEventListener("cut",()=>{})}}const $l=["pre-wrap","normal","pre-line","break-spaces"];class iO{constructor(e){this.lineWrapping=e;this.doc=_.empty;this.heightSamples={};this.lineHeight=14;this.charWidth=7;this.textHeight=14;this.lineLength=30;this.heightChanged=false}heightForGap(e,t){let i=this.doc.lineAt(t).number-this.doc.lineAt(e).number+1;if(this.lineWrapping)i+=Math.max(0,Math.ceil((t-e-i*this.lineLength*.5)/this.lineLength));return this.lineHeight*i}heightForLine(e){if(!this.lineWrapping)return this.lineHeight;let t=1+Math.max(0,Math.ceil((e-this.lineLength)/(this.lineLength-5)));return t*this.lineHeight}setDoc(e){this.doc=e;return this}mustRefreshForWrapping(e){return $l.indexOf(e)>-1!=this.lineWrapping}mustRefreshForHeights(e){let t=false;for(let i=0;i-1;let a=Math.round(t)!=Math.round(this.lineHeight)||this.lineWrapping!=l;this.lineWrapping=l;this.lineHeight=t;this.charWidth=i;this.textHeight=s;this.lineLength=r;if(a){this.heightSamples={};for(let h=0;h0}set outdated(e){this.flags=(e?2:0)|this.flags&~2}setHeight(e,t){if(this.height!=t){if(Math.abs(this.height-t)>Rn)e.heightChanged=true;this.height=t}}replace(e,t,i){return be.of(i)}decomposeLeft(e,t){t.push(this)}decomposeRight(e,t){t.push(this)}applyChanges(e,t,i,s){let r=this,o=i.doc;for(let l=s.length-1;l>=0;l--){let{fromA:a,toA:h,fromB:c,toB:f}=s[l];let u=r.lineAt(a,I.ByPosNoHeight,i.setDoc(t),0,0);let d=u.to>=h?u:r.lineAt(h,I.ByPosNoHeight,i,0,0);f+=d.to-h;h=d.to;while(l>0&&u.from<=s[l-1].toA){a=s[l-1].fromA;c=s[l-1].fromB;l--;if(ar*2){let l=e[t-1];if(l.break)e.splice(--t,1,l.left,null,l.right);else e.splice(--t,1,l.left,l.right);i+=1+l.break;s-=l.size}else if(r>s*2){let l=e[i];if(l.break)e.splice(i,1,l.left,null,l.right);else e.splice(i,1,l.left,l.right);i+=2+l.break;r-=l.size}else{break}}else if(s=r)o(this.blockAt(0,i,s,r))}updateHeight(e,t=0,i=false,s){if(s&&s.from<=t&&s.more)this.setHeight(e,s.heights[s.index++]);this.outdated=false;return this}toString(){return`block(${this.length})`}}class Te extends Bh{constructor(e,t){super(e,t,null);this.collapsed=0;this.widgetHeight=0;this.breaks=0}blockAt(e,t,i,s){return new He(s,this.length,i,this.height,this.breaks)}replace(e,t,i){let s=i[0];if(i.length==1&&(s instanceof Te||s instanceof le&&s.flags&4)&&Math.abs(this.length-s.length)<10){if(s instanceof le)s=new Te(s.length,this.height);else s.height=this.height;if(!this.outdated)s.outdated=false;return s}else{return be.of(i)}}updateHeight(e,t=0,i=false,s){if(s&&s.from<=t&&s.more)this.setHeight(e,s.heights[s.index++]);else if(i||this.outdated)this.setHeight(e,Math.max(this.widgetHeight,e.heightForLine(this.length-this.collapsed))+this.breaks*e.lineHeight);this.outdated=false;return this}toString(){return`line(${this.length}${this.collapsed?-this.collapsed:""}${this.widgetHeight?":"+this.widgetHeight:""})`}}class le extends be{constructor(e){super(e,0)}heightMetrics(e,t){let i=e.doc.lineAt(t).number,s=e.doc.lineAt(t+this.length).number;let r=s-i+1;let o,l=0;if(e.lineWrapping){let a=Math.min(this.height,e.lineHeight*r);o=a/r;if(this.length>r+1)l=(this.height-a)/(this.length-r-1)}else{o=this.height/r}return{firstLine:i,lastLine:s,perLine:o,perChar:l}}blockAt(e,t,i,s){let{firstLine:r,lastLine:o,perLine:l,perChar:a}=this.heightMetrics(t,s);if(t.lineWrapping){let h=s+(e0){let r=i[i.length-1];if(r instanceof le)i[i.length-1]=new le(r.length+s);else i.push(null,new le(s-1))}if(e>0){let r=i[0];if(r instanceof le)i[0]=new le(e+r.length);else i.unshift(new le(e-1),null)}return be.of(i)}decomposeLeft(e,t){t.push(new le(e-1),null)}decomposeRight(e,t){t.push(null,new le(this.length-e-1))}updateHeight(e,t=0,i=false,s){let r=t+this.length;if(s&&s.from<=t+this.length&&s.more){let o=[],l=Math.max(t,s.from),a=-1;if(s.from>t)o.push(new le(s.from-t-1).updateHeight(e,t));while(l<=r&&s.more){let c=e.doc.lineAt(l).length;if(o.length)o.push(null);let f=s.heights[s.index++];if(a==-1)a=f;else if(Math.abs(f-a)>=Rn)a=-2;let u=new Te(c,f);u.outdated=false;o.push(u);l+=c+1}if(l<=r)o.push(null,new le(r-l).updateHeight(e,l));let h=be.of(o);if(a<0||Math.abs(h.height-this.height)>=Rn||Math.abs(a-this.heightMetrics(e,t).perLine)>=Rn)e.heightChanged=true;return h}else if(i||this.outdated){this.setHeight(e,e.heightForGap(t,t+this.length));this.outdated=false}return this}toString(){return`gap(${this.length})`}}class sO extends be{constructor(e,t,i){super(e.length+t+i.length,e.height+i.height,t|(e.outdated||i.outdated?2:0));this.left=e;this.right=i;this.size=e.size+i.size}get break(){return this.flags&1}blockAt(e,t,i,s){let r=i+this.left.height;return el))return h;let c=t==I.ByPosNoHeight?I.ByPosNoHeight:I.ByPos;if(a)return h.join(this.right.lineAt(l,c,i,o,l));else return this.left.lineAt(l,c,i,s,r).join(h)}forEachLine(e,t,i,s,r,o){let l=s+this.left.height,a=r+this.left.length+this.break;if(this.break){if(e=a)this.right.forEachLine(e,t,i,l,a,o)}else{let h=this.lineAt(a,I.ByPos,i,s,r);if(e=e&&h.from<=t)o(h);if(t>h.to)this.right.forEachLine(h.to+1,t,i,l,a,o)}}replace(e,t,i){let s=this.left.length+this.break;if(tthis.left.length)return this.balanced(this.left,this.right.replace(e-s,t-s,i));let r=[];if(e>0)this.decomposeLeft(e,r);let o=r.length;for(let l of i)r.push(l);if(e>0)vl(r,o-1);if(t=i)t.push(null)}if(e>i)this.right.decomposeLeft(e-i,t)}decomposeRight(e,t){let i=this.left.length,s=i+this.break;if(e>=s)return this.right.decomposeRight(e-s,t);if(e2*t.size||t.size>2*e.size)return be.of(this.break?[e,null,t]:[e,t]);this.left=e;this.right=t;this.height=e.height+t.height;this.outdated=e.outdated||t.outdated;this.size=e.size+t.size;this.length=e.length+this.break+t.length;return this}updateHeight(e,t=0,i=false,s){let{left:r,right:o}=this,l=t+r.length+this.break,a=null;if(s&&s.from<=t+r.length&&s.more)a=r=r.updateHeight(e,t,i,s);else r.updateHeight(e,t,i);if(s&&s.from<=l+o.length&&s.more)a=o=o.updateHeight(e,l,i,s);else o.updateHeight(e,l,i);if(a)return this.balanced(r,o);this.height=this.left.height+this.right.height;this.outdated=false;return this}toString(){return this.left+(this.break?" ":"-")+this.right}}function vl(n,e){let t,i;if(n[e]==null&&(t=n[e-1])instanceof le&&(i=n[e+1])instanceof le)n.splice(e-1,3,new le(t.length+1+i.length))}const rO=5;class lo{constructor(e,t){this.pos=e;this.oracle=t;this.nodes=[];this.lineStart=-1;this.lineEnd=-1;this.covering=null;this.writtenTo=e}get isCovered(){return this.covering&&this.nodes[this.nodes.length-1]==this.covering}span(e,t){if(this.lineStart>-1){let i=Math.min(t,this.lineEnd),s=this.nodes[this.nodes.length-1];if(s instanceof Te)s.length+=i-this.pos;else if(i>this.pos||!this.isCovered)this.nodes.push(new Te(i-this.pos,-1));this.writtenTo=i;if(t>i){this.nodes.push(null);this.writtenTo++;this.lineStart=-1}}this.pos=t}point(e,t,i){if(e=rO){this.addLineDeco(s,r,o)}}else if(t>e){this.span(e,t)}if(this.lineEnd>-1&&this.lineEnd-1)return;let{from:e,to:t}=this.oracle.doc.lineAt(this.pos);this.lineStart=e;this.lineEnd=t;if(this.writtenToe)this.nodes.push(new Te(this.pos-e,-1));this.writtenTo=this.pos}blankContent(e,t){let i=new le(t-e);if(this.oracle.doc.lineAt(e).to==t)i.flags|=4;return i}ensureLine(){this.enterLine();let e=this.nodes.length?this.nodes[this.nodes.length-1]:null;if(e instanceof Te)return e;let t=new Te(0,-1);this.nodes.push(t);return t}addBlock(e){this.enterLine();let t=e.deco;if(t&&t.startSide>0&&!this.isCovered)this.ensureLine();this.nodes.push(e);this.writtenTo=this.pos=this.pos+e.length;if(t&&t.endSide>0)this.covering=e}addLineDeco(e,t,i){let s=this.ensureLine();s.length+=i;s.collapsed+=i;s.widgetHeight=Math.max(s.widgetHeight,e);s.breaks+=t;this.writtenTo=this.pos=this.pos+i}finish(e){let t=this.nodes.length==0?null:this.nodes[this.nodes.length-1];if(this.lineStart>-1&&!(t instanceof Te)&&!this.isCovered)this.nodes.push(new Te(0,-1));else if(this.writtenToc.clientHeight||c.scrollWidth>c.clientWidth)&&f.overflow!="visible"){let u=c.getBoundingClientRect();r=Math.max(r,u.left);o=Math.min(o,u.right);l=Math.max(l,u.top);a=h==n.parentNode?u.bottom:Math.min(a,u.bottom)}h=f.position=="absolute"||f.position=="fixed"?c.offsetParent:c.parentNode}else if(h.nodeType==11){h=h.host}else{break}}return{left:r-t.left,right:Math.max(r,o)-t.left,top:l-(t.top+e),bottom:Math.max(l,a)-(t.top+e)}}function hO(n,e){let t=n.getBoundingClientRect();return{left:0,right:t.right-t.left,top:e,bottom:t.bottom-(t.top+e)}}class Cs{constructor(e,t,i){this.from=e;this.to=t;this.size=i}static same(e,t){if(e.length!=t.length)return false;for(let i=0;itypeof i!="function"&&i.class=="cm-lineWrapping");this.heightOracle=new iO(t);this.stateDeco=e.facet(Xi).filter(i=>typeof i!="function");this.heightMap=be.empty().applyChanges(this.stateDeco,_.empty,this.heightOracle.setDoc(e.doc),[new Ye(0,0,0,e.doc.length)]);this.viewport=this.getViewport(0,null);this.updateViewportLines();this.updateForViewport();this.lineGaps=this.ensureLineGaps([]);this.lineGapDeco=T.set(this.lineGaps.map(i=>i.draw(this,false)));this.computeVisibleRanges()}updateForViewport(){let e=[this.viewport],{main:t}=this.state.selection;for(let i=0;i<=1;i++){let s=i?t.head:t.anchor;if(!e.some(({from:r,to:o})=>s>=r&&s<=o)){let{from:r,to:o}=this.lineBlockAt(s);e.push(new fn(r,o))}}this.viewports=e.sort((i,s)=>i.from-s.from);this.scaler=this.heightMap.height<=7e6?Rl:new dO(this.heightOracle,this.heightMap,this.viewports)}updateViewportLines(){this.viewportLines=[];this.heightMap.forEachLine(this.viewport.from,this.viewport.to,this.heightOracle.setDoc(this.state.doc),0,0,e=>{this.viewportLines.push(this.scaler.scale==1?e:Si(e,this.scaler))})}update(e,t=null){this.state=e.state;let i=this.stateDeco;this.stateDeco=this.state.facet(Xi).filter(c=>typeof c!="function");let s=e.changedRanges;let r=Ye.extendWithRanges(s,oO(i,this.stateDeco,e?e.changes:ne.empty(this.state.doc.length)));let o=this.heightMap.height;let l=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollTop);this.heightMap=this.heightMap.applyChanges(this.stateDeco,e.startState.doc,this.heightOracle.setDoc(this.state.doc),r);if(this.heightMap.height!=o)e.flags|=2;if(l){this.scrollAnchorPos=e.changes.mapPos(l.from,-1);this.scrollAnchorHeight=l.top}else{this.scrollAnchorPos=-1;this.scrollAnchorHeight=this.heightMap.height}let a=r.length?this.mapViewport(this.viewport,e.changes):this.viewport;if(t&&(t.range.heada.to)||!this.viewportIsAppropriate(a))a=this.getViewport(0,t);let h=!e.changes.empty||e.flags&2||a.from!=this.viewport.from||a.to!=this.viewport.to;this.viewport=a;this.updateForViewport();if(h)this.updateViewportLines();if(this.lineGaps.length||this.viewport.to-this.viewport.from>2e3<<1)this.updateLineGaps(this.ensureLineGaps(this.mapLineGaps(this.lineGaps,e.changes)));e.flags|=this.computeVisibleRanges();if(t)this.scrollTarget=t;if(!this.mustEnforceCursorAssoc&&e.selectionSet&&e.view.lineWrapping&&e.state.selection.main.empty&&e.state.selection.main.assoc&&!e.state.facet(vh))this.mustEnforceCursorAssoc=true}measure(e){let t=e.contentDOM,i=window.getComputedStyle(t);let s=this.heightOracle;let r=i.whiteSpace;this.defaultTextDirection=i.direction=="rtl"?N.RTL:N.LTR;let o=this.heightOracle.mustRefreshForWrapping(r);let l=t.getBoundingClientRect();let a=o||this.mustMeasureContent||this.contentDOMHeight!=l.height;this.contentDOMHeight=l.height;this.mustMeasureContent=false;let h=0,c=0;if(l.width&&l.height){let{scaleX:w,scaleY:x}=eh(t,l);if(w>.005&&Math.abs(this.scaleX-w)>.005||x>.005&&Math.abs(this.scaleY-x)>.005){this.scaleX=w;this.scaleY=x;h|=8;o=a=true}}let f=(parseInt(i.paddingTop)||0)*this.scaleY;let u=(parseInt(i.paddingBottom)||0)*this.scaleY;if(this.paddingTop!=f||this.paddingBottom!=u){this.paddingTop=f;this.paddingBottom=u;h|=8|2}if(this.editorWidth!=e.scrollDOM.clientWidth){if(s.lineWrapping)a=true;this.editorWidth=e.scrollDOM.clientWidth;h|=8}let d=e.scrollDOM.scrollTop*this.scaleY;if(this.scrollTop!=d){this.scrollAnchorHeight=-1;this.scrollTop=d}this.scrolledToBottom=nh(e.scrollDOM);let O=(this.printing?hO:aO)(t,this.paddingTop);let p=O.top-this.pixelViewport.top,m=O.bottom-this.pixelViewport.bottom;this.pixelViewport=O;let b=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(b!=this.inView){this.inView=b;if(b)a=true}if(!this.inView&&!this.scrollTarget)return 0;let S=l.width;if(this.contentDOMWidth!=S||this.editorHeight!=e.scrollDOM.clientHeight){this.contentDOMWidth=l.width;this.editorHeight=e.scrollDOM.clientHeight;h|=8}if(a){let w=e.docView.measureVisibleLineHeights(this.viewport);if(s.mustRefreshForHeights(w))o=true;if(o||s.lineWrapping&&Math.abs(S-this.contentDOMWidth)>s.charWidth){let{lineHeight:x,charWidth:$,textHeight:P}=e.docView.measureTextSize();o=x>0&&s.refresh(r,x,$,P,S/$,w);if(o){e.docView.minWidth=0;h|=8}}if(p>0&&m>0)c=Math.max(p,m);else if(p<0&&m<0)c=Math.min(p,m);s.heightChanged=false;for(let x of this.viewports){let $=x.from==this.viewport.from?w:e.docView.measureVisibleLineHeights(x);this.heightMap=(o?be.empty().applyChanges(this.stateDeco,_.empty,this.heightOracle,[new Ye(0,0,0,e.state.doc.length)]):this.heightMap).updateHeight(s,0,o,new nO(x.from,$))}if(s.heightChanged)h|=2}let k=!this.viewportIsAppropriate(this.viewport,c)||this.scrollTarget&&(this.scrollTarget.range.headthis.viewport.to);if(k)this.viewport=this.getViewport(c,this.scrollTarget);this.updateForViewport();if(h&2||k)this.updateViewportLines();if(this.lineGaps.length||this.viewport.to-this.viewport.from>2e3<<1)this.updateLineGaps(this.ensureLineGaps(o?[]:this.lineGaps,e));h|=this.computeVisibleRanges();if(this.mustEnforceCursorAssoc){this.mustEnforceCursorAssoc=false;e.docView.enforceCursorAssoc()}return h}get visibleTop(){return this.scaler.fromDOM(this.pixelViewport.top)}get visibleBottom(){return this.scaler.fromDOM(this.pixelViewport.bottom)}getViewport(e,t){let i=.5-Math.max(-.5,Math.min(.5,e/1e3/2));let s=this.heightMap,r=this.heightOracle;let{visibleTop:o,visibleBottom:l}=this;let a=new fn(s.lineAt(o-i*1e3,I.ByHeight,r,0,0).from,s.lineAt(l+(1-i)*1e3,I.ByHeight,r,0,0).to);if(t){let{head:h}=t.range;if(ha.to){let c=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top);let f=s.lineAt(h,I.ByPos,r,0,0),u;if(t.y=="center")u=(f.top+f.bottom)/2-c/2;else if(t.y=="start"||t.y=="nearest"&&h=l+Math.max(10,Math.min(i,250)))&&(s>o-2*1e3&&r>1,o=s<<1;if(this.defaultTextDirection!=N.LTR&&!i)return[];let l=[];let a=(h,c,f,u)=>{if(c-hh&&mm.from>=f.from&&m.to<=f.to&&Math.abs(m.from-h)m.fromb));if(!p){if(cm.from<=c&&m.to>=c)){let m=t.moveToLineBoundary(y.cursor(c),false,true).head;if(m>h)c=m}p=new Cs(h,c,this.gapSize(f,h,c,u))}l.push(p)};for(let h of this.viewportLines){if(h.lengthh.from)a(h.from,u,h,c);if(dt.draw(this,this.heightOracle.lineWrapping)))}}computeVisibleRanges(){let e=this.stateDeco;if(this.lineGaps.length)e=e.concat(this.lineGapDeco);let t=[];E.spans(e,this.viewport.from,this.viewport.to,{span(s,r){t.push({from:s,to:r})},point(){}},20);let i=t.length!=this.visibleRanges.length||this.visibleRanges.some((s,r)=>s.from!=t[r].from||s.to!=t[r].to);this.visibleRanges=t;return i?4:0}lineBlockAt(e){return e>=this.viewport.from&&e<=this.viewport.to&&this.viewportLines.find(t=>t.from<=e&&t.to>=e)||Si(this.heightMap.lineAt(e,I.ByPos,this.heightOracle,0,0),this.scaler)}lineBlockAtHeight(e){return Si(this.heightMap.lineAt(this.scaler.fromDOM(e),I.ByHeight,this.heightOracle,0,0),this.scaler)}scrollAnchorAt(e){let t=this.lineBlockAtHeight(e+8);return t.from>=this.viewport.from||this.viewportLines[0].top-e>200?t:this.viewportLines[0]}elementAtHeight(e){return Si(this.heightMap.blockAt(this.scaler.fromDOM(e),this.heightOracle,0,0),this.scaler)}get docHeight(){return this.scaler.toDOM(this.heightMap.height)}get contentHeight(){return this.docHeight+this.paddingTop+this.paddingBottom}}class fn{constructor(e,t){this.from=e;this.to=t}}function fO(n,e,t){let i=[],s=n,r=0;E.spans(t,n,e,{span(){},point(o,l){if(o>s){i.push({from:s,to:o});r+=o-s}s=l}},20);if(s=1)return e[e.length-1].to;let i=Math.floor(n*t);for(let s=0;;s++){let{from:r,to:o}=e[s],l=o-r;if(i<=l)return r+i;i-=l}}function dn(n,e){let t=0;for(let{from:i,to:s}of n.ranges){if(e<=s){t+=e-i;break}t+=s-i}return t/n.total}function uO(n,e){for(let t of n)if(e(t))return t;return void 0}const Rl={toDOM(n){return n},fromDOM(n){return n},scale:1};class dO{constructor(e,t,i){let s=0,r=0,o=0;this.viewports=i.map(({from:l,to:a})=>{let h=t.lineAt(l,I.ByPos,e,0,0).top;let c=t.lineAt(a,I.ByPos,e,0,0).bottom;s+=c-h;return{from:l,to:a,top:h,bottom:c,domTop:0,domBottom:0}});this.scale=(7e6-s)/(t.height-s);for(let l of this.viewports){l.domTop=o+(l.top-r)*this.scale;o=l.domBottom=l.domTop+(l.bottom-l.top);r=l.bottom}}toDOM(e){for(let t=0,i=0,s=0;;t++){let r=tSi(s,e)):n._content)}const On=Z.define({combine:n=>n.join(" ")});const Tr=Z.define({combine:n=>n.indexOf(true)>-1});const Ar=St.newName();const Uh=St.newName();const Ih=St.newName();const Nh={"&light":"."+Uh,"&dark":"."+Ih};function Cr(n,e,t){return new St(e,{finish(i){return/&/.test(i)?i.replace(/&\w*/,s=>{if(s=="&")return n;if(!t||!t[s])throw new RangeError(`Unsupported selector: ${s}`);return t[s]}):n+" "+i}})}const OO=Cr("."+Ar,{"&":{position:"relative !important",boxSizing:"border-box","&.cm-focused":{outline:"1px dotted #212121"},display:"flex !important",flexDirection:"column"},".cm-scroller":{display:"flex !important",alignItems:"flex-start !important",fontFamily:"monospace",lineHeight:1.4,height:"100%",overflowX:"auto",position:"relative",zIndex:0},".cm-content":{margin:0,flexGrow:2,flexShrink:0,display:"block",whiteSpace:"pre",wordWrap:"normal",boxSizing:"border-box",minHeight:"100%",padding:"4px 0",outline:"none","&[contenteditable=true]":{WebkitUserModify:"read-write-plaintext-only"}},".cm-lineWrapping":{whiteSpace_fallback:"pre-wrap",whiteSpace:"break-spaces",wordBreak:"break-word",overflowWrap:"anywhere",flexShrink:1},"&light .cm-content":{caretColor:"black"},"&dark .cm-content":{caretColor:"white"},".cm-line":{display:"block",padding:"0 2px 0 6px"},".cm-layer":{position:"absolute",left:0,top:0,contain:"size style","& > *":{position:"absolute"}},"&light .cm-selectionBackground":{background:"#d9d9d9"},"&dark .cm-selectionBackground":{background:"#222"},"&light.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#d7d4f0"},"&dark.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#233"},".cm-cursorLayer":{pointerEvents:"none"},"&.cm-focused > .cm-scroller > .cm-cursorLayer":{animation:"steps(1) cm-blink 1.2s infinite"},"@keyframes cm-blink":{"0%":{},"50%":{opacity:0},"100%":{}},"@keyframes cm-blink2":{"0%":{},"50%":{opacity:0},"100%":{}},".cm-cursor, .cm-dropCursor":{borderLeft:"1.2px solid black",marginLeft:"-0.6px",pointerEvents:"none"},".cm-cursor":{display:"none"},"&dark .cm-cursor":{borderLeftColor:"#444"},".cm-dropCursor":{position:"absolute"},"&.cm-focused > .cm-scroller > .cm-cursorLayer .cm-cursor":{display:"block"},".cm-iso":{unicodeBidi:"isolate"},".cm-announced":{position:"fixed",top:"-10000px"},"@media print":{".cm-announced":{display:"none"}},"&light .cm-activeLine":{backgroundColor:"#cceeff44"},"&dark .cm-activeLine":{backgroundColor:"#99eeff33"},"&light .cm-specialChar":{color:"red"},"&dark .cm-specialChar":{color:"#f78"},".cm-gutters":{flexShrink:0,display:"flex",height:"100%",boxSizing:"border-box",insetInlineStart:0,zIndex:200},"&light .cm-gutters":{backgroundColor:"#f5f5f5",color:"#6c6c6c",borderRight:"1px solid #ddd"},"&dark .cm-gutters":{backgroundColor:"#333338",color:"#ccc"},".cm-gutter":{display:"flex !important",flexDirection:"column",flexShrink:0,boxSizing:"border-box",minHeight:"100%",overflow:"hidden"},".cm-gutterElement":{boxSizing:"border-box"},".cm-lineNumbers .cm-gutterElement":{padding:"0 3px 0 5px",minWidth:"20px",textAlign:"right",whiteSpace:"nowrap"},"&light .cm-activeLineGutter":{backgroundColor:"#e2f2ff"},"&dark .cm-activeLineGutter":{backgroundColor:"#222227"},".cm-panels":{boxSizing:"border-box",position:"sticky",left:0,right:0},"&light .cm-panels":{backgroundColor:"#f5f5f5",color:"black"},"&light .cm-panels-top":{borderBottom:"1px solid #ddd"},"&light .cm-panels-bottom":{borderTop:"1px solid #ddd"},"&dark .cm-panels":{backgroundColor:"#333338",color:"white"},".cm-tab":{display:"inline-block",overflow:"hidden",verticalAlign:"bottom"},".cm-widgetBuffer":{verticalAlign:"text-top",height:"1em",width:0,display:"inline"},".cm-placeholder":{color:"#888",display:"inline-block",verticalAlign:"top"},".cm-highlightSpace:before":{content:"attr(data-display)",position:"absolute",pointerEvents:"none",color:"#888"},".cm-highlightTab":{backgroundImage:`url('data:image/svg+xml,')`,backgroundSize:"auto 100%",backgroundPosition:"right 90%",backgroundRepeat:"no-repeat"},".cm-trailingSpace":{backgroundColor:"#ff332255"},".cm-button":{verticalAlign:"middle",color:"inherit",fontSize:"70%",padding:".2em 1em",borderRadius:"1px"},"&light .cm-button":{backgroundImage:"linear-gradient(#eff1f5, #d9d9df)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#b4b4b4, #d0d3d6)"}},"&dark .cm-button":{backgroundImage:"linear-gradient(#393939, #111)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#111, #333)"}},".cm-textfield":{verticalAlign:"middle",color:"inherit",fontSize:"70%",border:"1px solid silver",padding:".2em .5em"},"&light .cm-textfield":{backgroundColor:"white"},"&dark .cm-textfield":{border:"1px solid #555",backgroundColor:"inherit"}},Nh);const wi="￿";class pO{constructor(e,t){this.points=e;this.text="";this.lineSeparator=t.facet(q.lineSeparator)}append(e){this.text+=e}lineBreak(){this.text+=wi}readRange(e,t){if(!e)return this;let i=e.parentNode;for(let s=e;;){this.findPointBefore(i,s);let r=this.text.length;this.readNode(s);let o=s.nextSibling;if(o==t)break;let l=B.get(s),a=B.get(o);if(l&&a?l.breakAfter:(l?l.breakAfter:jn(s))||jn(o)&&(s.nodeName!="BR"||s.cmIgnore)&&this.text.length>r)this.lineBreak();s=o}this.findPointBefore(i,t);return this}readTextNode(e){let t=e.nodeValue;for(let i of this.points)if(i.node==e)i.pos=this.text.length+Math.min(i.offset,t.length);for(let i=0,s=this.lineSeparator?null:/\r\n?|\n/g;;){let r=-1,o=1,l;if(this.lineSeparator){r=t.indexOf(this.lineSeparator,i);o=this.lineSeparator.length}else if(l=s.exec(t)){r=l.index;o=l[0].length}this.append(t.slice(i,r<0?t.length:r));if(r<0)break;this.lineBreak();if(o>1){for(let a of this.points)if(a.node==e&&a.pos>this.text.length)a.pos-=o-1}i=r+o}}readNode(e){if(e.cmIgnore)return;let t=B.get(e);let i=t&&t.overrideDOMText;if(i!=null){this.findPointInside(e,i.length);for(let s=i.iter();!s.next().done;){if(s.lineBreak)this.lineBreak();else this.append(s.value)}}else if(e.nodeType==3){this.readTextNode(e)}else if(e.nodeName=="BR"){if(e.nextSibling)this.lineBreak()}else if(e.nodeType==1){this.readRange(e.firstChild,null)}}findPointBefore(e,t){for(let i of this.points)if(i.node==e&&e.childNodes[i.offset]==t)i.pos=this.text.length}findPointInside(e,t){for(let i of this.points)if(e.nodeType==3?i.node==e:e.contains(i.node))i.pos=this.text.length+(mO(e,i.node,i.offset)?t:0)}}function mO(n,e,t){for(;;){if(!e||t-1){this.newSel=null}else if(t>-1&&(this.bounds=e.docView.domBoundsAround(t,i,0))){let l=r||o?[]:xO(e);let a=new pO(l,e.state);a.readRange(this.bounds.startDOM,this.bounds.endDOM);this.text=a.text;this.newSel=SO(l,this.bounds.from)}else{let l=e.observer.selectionRange;let a=r&&r.node==l.focusNode&&r.offset==l.focusOffset||!mr(e.contentDOM,l.focusNode)?e.state.selection.main.head:e.docView.posFromDOM(l.focusNode,l.focusOffset);let h=o&&o.node==l.anchorNode&&o.offset==l.anchorOffset||!mr(e.contentDOM,l.anchorNode)?e.state.selection.main.anchor:e.docView.posFromDOM(l.anchorNode,l.anchorOffset);let c=e.viewport;if((R.ios||R.chrome)&&e.state.selection.main.empty&&a!=h&&(c.from>0||c.toDate.now()-100?n.inputState.lastKeyCode:-1;if(e.bounds){let{from:o,to:l}=e.bounds;let a=s.from,h=null;if(r===8||R.android&&e.text.length=s.from&&t.to<=s.to&&(t.from!=s.from||t.to!=s.to)&&s.to-s.from-(t.to-t.from)<=4){t={from:s.from,to:s.to,insert:n.state.doc.slice(s.from,t.from).append(t.insert).append(n.state.doc.slice(t.to,s.to))}}else if((R.mac||R.android)&&t&&t.from==t.to&&t.from==s.head-1&&/^\. ?$/.test(t.insert.toString())&&n.contentDOM.getAttribute("autocorrect")=="off"){if(i&&t.insert.length==2)i=y.single(i.main.anchor-1,i.main.head-1);t={from:s.from,to:s.to,insert:_.of([" "])}}else if(R.chrome&&t&&t.from==t.to&&t.from==s.head&&t.insert.toString()=="\n "&&n.lineWrapping){if(i)i=y.single(i.main.anchor-1,i.main.head-1);t={from:s.from,to:s.to,insert:_.of([" "])}}if(t){if(R.ios&&n.inputState.flushIOSKey(t))return true;if(R.android&&(t.to==s.to&&(t.from==s.from||t.from==s.from-1&&n.state.sliceDoc(t.from,s.from)==" ")&&t.insert.length==1&&t.insert.lines==2&&Ft(n.contentDOM,"Enter",13)||(t.from==s.from-1&&t.to==s.to&&t.insert.length==0||r==8&&t.insert.lengths.head)&&Ft(n.contentDOM,"Backspace",8)||t.from==s.from&&t.to==s.to+1&&t.insert.length==0&&Ft(n.contentDOM,"Delete",46)))return true;let o=t.insert.toString();if(n.inputState.composing>=0)n.inputState.composing++;let l;let a=()=>l||(l=bO(n,t,i));if(!n.state.facet(kh).some(h=>h(n,t.from,t.to,o,a)))n.dispatch(a());return true}else if(i&&!i.main.eq(s)){let o=false,l="select";if(n.inputState.lastSelectionTime>Date.now()-50){if(n.inputState.lastSelectionOrigin=="select")o=true;l=n.inputState.lastSelectionOrigin}n.dispatch({selection:i,scrollIntoView:o,userEvent:l});return true}else{return false}}function bO(n,e,t){let i,s=n.state,r=s.selection.main;if(e.from>=r.from&&e.to<=r.to&&e.to-e.from>=(r.to-r.from)/3&&(!t||t.main.empty&&t.main.from==e.from+e.insert.length)&&n.inputState.composing<0){let l=r.frome.to?s.sliceDoc(e.to,r.to):"";i=s.replaceSelection(n.state.toText(l+e.insert.sliceString(0,void 0,n.state.lineBreak)+a))}else{let l=s.changes(e);let a=t&&t.main.to<=l.newLength?t.main:void 0;if(s.selection.ranges.length>1&&n.inputState.composing>=0&&e.to<=r.to&&e.to>=r.to-10){let h=n.state.sliceDoc(e.from,e.to);let c,f=t&&Wh(n,t.main.head);if(f){let O=e.insert.length-(e.to-e.from);c={from:f.from,to:f.to-O}}else{c=n.state.doc.lineAt(r.head)}let u=r.to-e.to,d=r.to-r.from;i=s.changeByRange(O=>{if(O.from==r.from&&O.to==r.to)return{changes:l,range:a||O.map(l)};let p=O.to-u,m=p-h.length;if(O.to-O.from!=d||n.state.sliceDoc(m,p)!=h||O.to>=c.from&&O.from<=c.to)return{range:O};let b=s.changes({from:m,to:p,insert:e.insert}),S=O.to-r.to;return{changes:b,range:!a?O.map(b):y.range(Math.max(0,a.anchor+S),Math.max(0,a.head+S))}})}else{i={changes:l,selection:a&&s.selection.replaceRange(a)}}}let o="input.type";if(n.composing||n.inputState.compositionPendingChange&&n.inputState.compositionEndedAt>Date.now()-50){n.inputState.compositionPendingChange=false;o+=".compose";if(n.inputState.compositionFirstChange){o+=".start";n.inputState.compositionFirstChange=false}}return s.update(i,{userEvent:o,scrollIntoView:true})}function yO(n,e,t,i){let s=Math.min(n.length,e.length);let r=0;while(r0&&l>0&&n.charCodeAt(o-1)==e.charCodeAt(l-1)){o--;l--}if(i=="end"){let a=Math.max(0,r-Math.min(o,l));t-=o+a-r}if(o=o?r-t:0;r-=a;l=r+(l-o);o=r}else if(l=l?r-t:0;r-=a;o=r+(o-l);l=r}return{from:r,toA:o,toB:l}}function xO(n){let e=[];if(n.root.activeElement!=n.contentDOM)return e;let{anchorNode:t,anchorOffset:i,focusNode:s,focusOffset:r}=n.observer.selectionRange;if(t){e.push(new Tl(t,i));if(s!=t||r!=i)e.push(new Tl(s,r))}return e}function SO(n,e){if(n.length==0)return null;let t=n[0].pos,i=n.length==2?n[1].pos:t;return t>-1&&i>-1?y.single(t+e,i+e):null}const wO={childList:true,characterData:true,subtree:true,attributes:true,characterDataOldValue:true};const Ms=R.ie&&R.ie_version<=11;class QO{constructor(e){this.view=e;this.active=false;this.selectionRange=new od;this.selectionChanged=false;this.delayedFlush=-1;this.resizeTimeout=-1;this.queue=[];this.delayedAndroidKey=null;this.flushingAndroidKey=-1;this.lastChange=0;this.scrollTargets=[];this.intersection=null;this.resizeScroll=null;this.intersecting=false;this.gapIntersection=null;this.gaps=[];this.printQuery=null;this.parentCheck=-1;this.dom=e.contentDOM;this.observer=new MutationObserver(t=>{for(let i of t)this.queue.push(i);if((R.ie&&R.ie_version<=11||R.ios&&e.composing)&&t.some(i=>i.type=="childList"&&i.removedNodes.length||i.type=="characterData"&&i.oldValue.length>i.target.nodeValue.length))this.flushSoon();else this.flush()});if(Ms)this.onCharData=t=>{this.queue.push({target:t.target,type:"characterData",oldValue:t.prevValue});this.flushSoon()};this.onSelectionChange=this.onSelectionChange.bind(this);this.onResize=this.onResize.bind(this);this.onPrint=this.onPrint.bind(this);this.onScroll=this.onScroll.bind(this);if(window.matchMedia)this.printQuery=window.matchMedia("print");if(typeof ResizeObserver=="function"){this.resizeScroll=new ResizeObserver(()=>{var t;if(((t=this.view.docView)===null||t===void 0?void 0:t.lastUpdate){if(this.parentCheck<0)this.parentCheck=setTimeout(this.listenForScroll.bind(this),1e3);if(t.length>0&&t[t.length-1].intersectionRatio>0!=this.intersecting){this.intersecting=!this.intersecting;if(this.intersecting!=this.view.inView)this.onScrollChanged(document.createEvent("Event"))}},{threshold:[0,.001]});this.intersection.observe(this.dom);this.gapIntersection=new IntersectionObserver(t=>{if(t.length>0&&t[t.length-1].intersectionRatio>0)this.onScrollChanged(document.createEvent("Event"))},{})}this.listenForScroll();this.readSelectionRange()}onScrollChanged(e){this.view.inputState.runHandlers("scroll",e);if(this.intersecting)this.view.measure()}onScroll(e){if(this.intersecting)this.flush(false);this.onScrollChanged(e)}onResize(){if(this.resizeTimeout<0)this.resizeTimeout=setTimeout(()=>{this.resizeTimeout=-1;this.view.requestMeasure()},50)}onPrint(e){if(e.type=="change"&&!e.matches)return;this.view.viewState.printing=true;this.view.measure();setTimeout(()=>{this.view.viewState.printing=false;this.view.requestMeasure()},500)}updateGaps(e){if(this.gapIntersection&&(e.length!=this.gaps.length||this.gaps.some((t,i)=>t!=e[i]))){this.gapIntersection.disconnect();for(let t of e)this.gapIntersection.observe(t);this.gaps=e}}onSelectionChange(e){let t=this.selectionChanged;if(!this.readSelectionRange()||this.delayedAndroidKey)return;let{view:i}=this,s=this.selectionRange;if(i.state.facet(hs)?i.root.activeElement!=this.dom:!vn(i.dom,s))return;let r=s.anchorNode&&i.docView.nearest(s.anchorNode);if(r&&r.ignoreEvent(e)){if(!t)this.selectionChanged=false;return}if((R.ie&&R.ie_version<=11||R.android&&R.chrome)&&!i.state.selection.main.empty&&s.focusNode&&$i(s.focusNode,s.focusOffset,s.anchorNode,s.anchorOffset))this.flushSoon();else this.flush(false)}readSelectionRange(){let{view:e}=this;let t=zn(e.root);if(!t)return false;let i=R.safari&&e.root.nodeType==11&&id(this.dom.ownerDocument)==this.dom&&kO(this.view,t)||t;if(!i||this.selectionRange.eq(i))return false;let s=vn(this.dom,i);if(s&&!this.selectionChanged&&e.inputState.lastFocusTime>Date.now()-200&&e.inputState.lastTouchTime{let r=this.delayedAndroidKey;if(r){this.clearDelayedAndroidKey();this.view.inputState.lastKeyCode=r.keyCode;this.view.inputState.lastKeyTime=Date.now();let o=this.flush();if(!o&&r.force)Ft(this.dom,r.key,r.keyCode)}};this.flushingAndroidKey=this.view.win.requestAnimationFrame(s)}if(!this.delayedAndroidKey||e=="Enter")this.delayedAndroidKey={key:e,keyCode:t,force:this.lastChange{this.delayedFlush=-1;this.flush()})}forceFlush(){if(this.delayedFlush>=0){this.view.win.cancelAnimationFrame(this.delayedFlush);this.delayedFlush=-1}this.flush()}pendingRecords(){for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}processRecords(){let e=this.pendingRecords();if(e.length)this.queue=[];let t=-1,i=-1,s=false;for(let r of e){let o=this.readMutation(r);if(!o)continue;if(o.typeOver)s=true;if(t==-1){({from:t,to:i}=o)}else{t=Math.min(o.from,t);i=Math.max(o.to,i)}}return{from:t,to:i,typeOver:s}}readChange(){let{from:e,to:t,typeOver:i}=this.processRecords();let s=this.selectionChanged&&vn(this.dom,this.selectionRange);if(e<0&&!s)return null;if(e>-1)this.lastChange=Date.now();this.view.inputState.lastFocusTime=0;this.selectionChanged=false;let r=new gO(this.view,e,t,i);this.view.docView.domChanged={newSel:r.newSel?r.newSel.main:null};return r}flush(e=true){if(this.delayedFlush>=0||this.delayedAndroidKey)return false;if(e)this.readSelectionRange();let t=this.readChange();if(!t){this.view.requestMeasure();return false}let i=this.view.state;let s=Gh(this.view,t);if(this.view.state==i)this.view.update([]);return s}readMutation(e){let t=this.view.docView.nearest(e.target);if(!t||t.ignoreMutation(e))return null;t.markDirty(e.type=="attributes");if(e.type=="attributes")t.flags|=4;if(e.type=="childList"){let i=Al(t,e.previousSibling||e.target.previousSibling,-1);let s=Al(t,e.nextSibling||e.target.nextSibling,1);return{from:i?t.posAfter(i):t.posAtStart,to:s?t.posBefore(s):t.posAtEnd,typeOver:false}}else if(e.type=="characterData"){return{from:t.posAtStart,to:t.posAtEnd,typeOver:e.target.nodeValue==e.oldValue}}else{return null}}setWindow(e){if(e!=this.win){this.removeWindowListeners(this.win);this.win=e;this.addWindowListeners(this.win)}}addWindowListeners(e){e.addEventListener("resize",this.onResize);if(this.printQuery)this.printQuery.addEventListener("change",this.onPrint);else e.addEventListener("beforeprint",this.onPrint);e.addEventListener("scroll",this.onScroll);e.document.addEventListener("selectionchange",this.onSelectionChange)}removeWindowListeners(e){e.removeEventListener("scroll",this.onScroll);e.removeEventListener("resize",this.onResize);if(this.printQuery)this.printQuery.removeEventListener("change",this.onPrint);else e.removeEventListener("beforeprint",this.onPrint);e.document.removeEventListener("selectionchange",this.onSelectionChange)}destroy(){var e,t,i;this.stop();(e=this.intersection)===null||e===void 0?void 0:e.disconnect();(t=this.gapIntersection)===null||t===void 0?void 0:t.disconnect();(i=this.resizeScroll)===null||i===void 0?void 0:i.disconnect();for(let s of this.scrollTargets)s.removeEventListener("scroll",this.onScroll);this.removeWindowListeners(this.win);clearTimeout(this.parentCheck);clearTimeout(this.resizeTimeout);this.win.cancelAnimationFrame(this.delayedFlush);this.win.cancelAnimationFrame(this.flushingAndroidKey)}}function Al(n,e,t){while(e){let i=B.get(e);if(i&&i.parent==n)return i;let s=e.parentNode;e=s!=n.dom?s:t>0?e.nextSibling:e.previousSibling}return null}function Cl(n,e){let t=e.startContainer,i=e.startOffset;let s=e.endContainer,r=e.endOffset;let o=n.docView.domAtPos(n.state.selection.main.anchor);if($i(o.node,o.offset,s,r))[t,i,s,r]=[s,r,t,i];return{anchorNode:t,anchorOffset:i,focusNode:s,focusOffset:r}}function kO(n,e){if(e.getComposedRanges){let s=e.getComposedRanges(n.root)[0];if(s)return Cl(n,s)}let t=null;function i(s){s.preventDefault();s.stopImmediatePropagation();t=s.getTargetRanges()[0]}n.contentDOM.addEventListener("beforeinput",i,true);n.dom.ownerDocument.execCommand("indent");n.contentDOM.removeEventListener("beforeinput",i,true);return t?Cl(n,t):null}class v{get state(){return this.viewState.state}get viewport(){return this.viewState.viewport}get visibleRanges(){return this.viewState.visibleRanges}get inView(){return this.viewState.inView}get composing(){return this.inputState.composing>0}get compositionStarted(){return this.inputState.composing>=0}get root(){return this._root}get win(){return this.dom.ownerDocument.defaultView||window}constructor(e={}){this.plugins=[];this.pluginMap=new Map;this.editorAttrs={};this.contentAttrs={};this.bidiCache=[];this.destroyed=false;this.updateState=2;this.measureScheduled=-1;this.measureRequests=[];this.contentDOM=document.createElement("div");this.scrollDOM=document.createElement("div");this.scrollDOM.tabIndex=-1;this.scrollDOM.className="cm-scroller";this.scrollDOM.appendChild(this.contentDOM);this.announceDOM=document.createElement("div");this.announceDOM.className="cm-announced";this.announceDOM.setAttribute("aria-live","polite");this.dom=document.createElement("div");this.dom.appendChild(this.announceDOM);this.dom.appendChild(this.scrollDOM);if(e.parent)e.parent.appendChild(this.dom);let{dispatch:t}=e;this.dispatchTransactions=e.dispatchTransactions||t&&(i=>i.forEach(s=>t(s,this)))||(i=>this.update(i));this.dispatch=this.dispatch.bind(this);this._root=e.root||ld(e.parent)||document;this.viewState=new Zl(e.state||q.create(e));if(e.scrollTo&&e.scrollTo.is(an))this.viewState.scrollTarget=e.scrollTo.value.clip(this.viewState.state);this.plugins=this.state.facet(yi).map(i=>new Rs(i));for(let i of this.plugins)i.update(this);this.observer=new QO(this);this.inputState=new qd(this);this.inputState.ensureHandlers(this.plugins);this.docView=new cl(this);this.mountStyles();this.updateAttrs();this.updateState=0;this.requestMeasure()}dispatch(...e){let t=e.length==1&&e[0]instanceof J?e:e.length==1&&Array.isArray(e[0])?e[0]:[this.state.update(...e)];this.dispatchTransactions(t,this)}update(e){if(this.updateState!=0)throw new Error("Calls to EditorView.update are not allowed while an update is in progress");let t=false,i=false,s;let r=this.state;for(let u of e){if(u.startState!=r)throw new RangeError("Trying to update state with a transaction that doesn't start from the previous state.");r=u.state}if(this.destroyed){this.viewState.state=r;return}let o=this.hasFocus,l=0,a=null;if(e.some(u=>u.annotation(jh))){this.inputState.notifiedFocused=o;l=1}else if(o!=this.inputState.notifiedFocused){this.inputState.notifiedFocused=o;a=Vh(r,o);if(!a)l=1}let h=this.observer.delayedAndroidKey,c=null;if(h){this.observer.clearDelayedAndroidKey();c=this.observer.readChange();if(c&&!this.state.doc.eq(r.doc)||!this.state.selection.eq(r.selection))c=null}else{this.observer.clear()}if(r.facet(q.phrases)!=this.state.facet(q.phrases))return this.setState(r);s=Vn.create(this,r,e);s.flags|=l;let f=this.viewState.scrollTarget;try{this.updateState=2;for(let u of e){if(f)f=f.map(u.changes);if(u.scrollIntoView){let{main:d}=u.state.selection;f=new Ht(d.empty?d:y.cursor(d.head,d.head>d.anchor?-1:1))}for(let d of u.effects)if(d.is(an))f=d.value.clip(this.state)}this.viewState.update(s,f);this.bidiCache=Ln.update(this.bidiCache,s.changes);if(!s.empty){this.updatePlugins(s);this.inputState.update(s)}t=this.docView.update(s);if(this.state.facet(xi)!=this.styleModules)this.mountStyles();i=this.updateAttrs();this.showAnnouncements(e);this.docView.updateSelection(t,e.some(u=>u.isUserEvent("select.pointer")))}finally{this.updateState=0}if(s.startState.facet(On)!=s.state.facet(On))this.viewState.mustMeasureContent=true;if(t||i||f||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)this.requestMeasure();if(t)this.docViewUpdate();if(!s.empty)for(let u of this.state.facet($r)){try{u(s)}catch(d){Qe(this.state,d,"update listener")}}if(a||c)Promise.resolve().then(()=>{if(a&&this.state==a.startState)this.dispatch(a);if(c){if(!Gh(this,c)&&h.force)Ft(this.contentDOM,h.key,h.keyCode)}})}setState(e){if(this.updateState!=0)throw new Error("Calls to EditorView.setState are not allowed while an update is in progress");if(this.destroyed){this.viewState.state=e;return}this.updateState=2;let t=this.hasFocus;try{for(let i of this.plugins)i.destroy(this);this.viewState=new Zl(e);this.plugins=e.facet(yi).map(i=>new Rs(i));this.pluginMap.clear();for(let i of this.plugins)i.update(this);this.docView.destroy();this.docView=new cl(this);this.inputState.ensureHandlers(this.plugins);this.mountStyles();this.updateAttrs();this.bidiCache=[]}finally{this.updateState=0}if(t)this.focus();this.requestMeasure()}updatePlugins(e){let t=e.startState.facet(yi),i=e.state.facet(yi);if(t!=i){let s=[];for(let r of i){let o=t.indexOf(r);if(o<0){s.push(new Rs(r))}else{let l=this.plugins[o];l.mustUpdate=e;s.push(l)}}for(let r of this.plugins)if(r.mustUpdate!=e)r.destroy(this);this.plugins=s;this.pluginMap.clear()}else{for(let s of this.plugins)s.mustUpdate=e}for(let s=0;s-1)this.win.cancelAnimationFrame(this.measureScheduled);if(this.observer.delayedAndroidKey){this.measureScheduled=-1;this.requestMeasure();return}this.measureScheduled=0;if(e)this.observer.forceFlush();let t=null;let i=this.scrollDOM,s=i.scrollTop*this.scaleY;let{scrollAnchorPos:r,scrollAnchorHeight:o}=this.viewState;if(Math.abs(s-this.viewState.scrollTop)>1)o=-1;this.viewState.scrollAnchorHeight=-1;try{for(let l=0;;l++){if(o<0){if(nh(i)){r=-1;o=this.viewState.heightMap.height}else{let d=this.viewState.scrollAnchorAt(s);r=d.from;o=d.top}}this.updateState=1;let a=this.viewState.measure(this);if(!a&&!this.measureRequests.length&&this.viewState.scrollTarget==null)break;if(l>5){console.warn(this.measureRequests.length?"Measure loop restarted more than 5 times":"Viewport failed to stabilize");break}let h=[];if(!(a&4))[this.measureRequests,h]=[h,this.measureRequests];let c=h.map(d=>{try{return d.read(this)}catch(O){Qe(this.state,O);return Ml}});let f=Vn.create(this,this.state,[]),u=false;f.flags|=a;if(!t)t=f;else t.flags|=a;this.updateState=2;if(!f.empty){this.updatePlugins(f);this.inputState.update(f);this.updateAttrs();u=this.docView.update(f);if(u)this.docViewUpdate()}for(let d=0;d1||O<-1){s=s+O;i.scrollTop=s/this.scaleY;o=-1;continue}}}break}}}finally{this.updateState=0;this.measureScheduled=-1}if(t&&!t.empty)for(let l of this.state.facet($r))l(t)}get themeClasses(){return Ar+" "+(this.state.facet(Tr)?Ih:Uh)+" "+this.state.facet(On)}updateAttrs(){let e=Wl(this,Rh,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses});let t={spellcheck:"false",autocorrect:"off",autocapitalize:"off",translate:"no",contenteditable:!this.state.facet(hs)?"false":"true",class:"cm-content",style:`${R.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};if(this.state.readOnly)t["aria-readonly"]="true";Wl(this,ro,t);let i=this.observer.ignore(()=>{let s=Sr(this.contentDOM,this.contentAttrs,t);let r=Sr(this.dom,this.editorAttrs,e);return s||r});this.editorAttrs=e;this.contentAttrs=t;return i}showAnnouncements(e){let t=true;for(let i of e)for(let s of i.effects)if(s.is(v.announce)){if(t)this.announceDOM.textContent="";t=false;let r=this.announceDOM.appendChild(document.createElement("div"));r.textContent=s.value}}mountStyles(){this.styleModules=this.state.facet(xi);let e=this.state.facet(v.cspNonce);St.mount(this.root,this.styleModules.concat(OO).reverse(),e?{nonce:e}:void 0)}readMeasured(){if(this.updateState==2)throw new Error("Reading the editor layout isn't allowed during an update");if(this.updateState==0&&this.measureScheduled>-1)this.measure(false)}requestMeasure(e){if(this.measureScheduled<0)this.measureScheduled=this.win.requestAnimationFrame(()=>this.measure());if(e){if(this.measureRequests.indexOf(e)>-1)return;if(e.key!=null)for(let t=0;ti.spec==e)||null);return t&&t.update(this).value}get documentTop(){return this.contentDOM.getBoundingClientRect().top+this.viewState.paddingTop}get documentPadding(){return{top:this.viewState.paddingTop,bottom:this.viewState.paddingBottom}}get scaleX(){return this.viewState.scaleX}get scaleY(){return this.viewState.scaleY}elementAtHeight(e){this.readMeasured();return this.viewState.elementAtHeight(e)}lineBlockAtHeight(e){this.readMeasured();return this.viewState.lineBlockAtHeight(e)}get viewportLineBlocks(){return this.viewState.viewportLines}lineBlockAt(e){return this.viewState.lineBlockAt(e)}get contentHeight(){return this.viewState.contentHeight}moveByChar(e,t,i){return As(this,e,ml(this,e,t,i))}moveByGroup(e,t){return As(this,e,ml(this,e,t,i=>Yd(this,e.head,i)))}visualLineSide(e,t){let i=this.bidiSpans(e),s=this.textDirectionAt(e.from);let r=i[t?i.length-1:0];return y.cursor(r.side(t,s)+e.from,r.forward(!t,s)?1:-1)}moveToLineBoundary(e,t,i=true){return Dd(this,e,t,i)}moveVertically(e,t,i){return As(this,e,Ed(this,e,t,i))}domAtPos(e){return this.docView.domAtPos(e)}posAtDOM(e,t=0){return this.docView.posFromDOM(e,t)}posAtCoords(e,t=true){this.readMeasured();return Xh(this,e,t)}coordsAtPos(e,t=1){this.readMeasured();let i=this.docView.coordsAt(e,t);if(!i||i.left==i.right)return i;let s=this.state.doc.lineAt(e),r=this.bidiSpans(s);let o=r[pt.find(r,e-s.from,-1,t)];return to(i,o.dir==N.LTR==t>0)}coordsForChar(e){this.readMeasured();return this.docView.coordsForChar(e)}get defaultCharacterWidth(){return this.viewState.heightOracle.charWidth}get defaultLineHeight(){return this.viewState.heightOracle.lineHeight}get textDirection(){return this.viewState.defaultTextDirection}textDirectionAt(e){let t=this.state.facet($h);if(!t||ethis.viewport.to)return this.textDirection;this.readMeasured();return this.docView.textDirectionAt(e)}get lineWrapping(){return this.viewState.heightOracle.lineWrapping}bidiSpans(e){if(e.length>PO)return bh(e.length);let t=this.textDirectionAt(e.from),i;for(let r of this.bidiCache){if(r.from==e.from&&r.dir==t&&(r.fresh||gh(r.isolates,i=hl(this,e))))return r.order}if(!i)i=hl(this,e);let s=xd(e.text,t,i);this.bidiCache.push(new Ln(e.from,e.to,t,i,true,s));return s}get hasFocus(){var e;return(this.dom.ownerDocument.hasFocus()||R.safari&&((e=this.inputState)===null||e===void 0?void 0:e.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{th(this.contentDOM);this.docView.updateSelection()})}setRoot(e){if(this._root!=e){this._root=e;this.observer.setWindow((e.nodeType==9?e:e.ownerDocument).defaultView||window);this.mountStyles()}}destroy(){for(let e of this.plugins)e.destroy(this);this.plugins=[];this.inputState.destroy();this.docView.destroy();this.dom.remove();this.observer.destroy();if(this.measureScheduled>-1)this.win.cancelAnimationFrame(this.measureScheduled);this.destroyed=true}static scrollIntoView(e,t={}){return an.of(new Ht(typeof e=="number"?y.cursor(e):e,t.y,t.x,t.yMargin,t.xMargin))}scrollSnapshot(){let{scrollTop:e,scrollLeft:t}=this.scrollDOM;let i=this.viewState.scrollAnchorAt(e);return an.of(new Ht(y.cursor(i.from),"start","start",i.top-e,t,true))}static domEventHandlers(e){return ee.define(()=>({}),{eventHandlers:e})}static domEventObservers(e){return ee.define(()=>({}),{eventObservers:e})}static theme(e,t){let i=St.newName();let s=[On.of(i),xi.of(Cr(`.${i}`,e))];if(t&&t.dark)s.push(Tr.of(true));return s}static baseTheme(e){return Pt.lowest(xi.of(Cr("."+Ar,e,Nh)))}static findFromDOM(e){var t;let i=e.querySelector(".cm-content");let s=i&&B.get(i)||B.get(e);return((t=s===null||s===void 0?void 0:s.rootView)===null||t===void 0?void 0:t.view)||null}}v.styleModule=xi;v.inputHandler=kh;v.scrollHandler=Zh;v.focusChangeEffect=Ph;v.perLineTextDirection=$h;v.exceptionSink=Qh;v.updateListener=$r;v.editable=hs;v.mouseSelectionStyle=wh;v.dragMovesSelection=Sh;v.clickAddsSelectionRange=xh;v.decorations=Xi;v.outerDecorations=Th;v.atomicRanges=oo;v.bidiIsolatedRanges=Ah;v.scrollMargins=Ch;v.darkTheme=Tr;v.cspNonce=Z.define({combine:n=>n.length?n[0]:""});v.contentAttributes=ro;v.editorAttributes=Rh;v.lineWrapping=v.contentAttributes.of({"class":"cm-lineWrapping"});v.announce=A.define();const PO=4096;const Ml={};class Ln{constructor(e,t,i,s,r,o){this.from=e;this.to=t;this.dir=i;this.isolates=s;this.fresh=r;this.order=o}static update(e,t){if(t.empty&&!e.some(r=>r.fresh))return e;let i=[],s=e.length?e[e.length-1].dir:N.LTR;for(let r=Math.max(0,e.length-10);r=0;s--){let r=i[s],o=typeof r=="function"?r(n):r;if(o)xr(o,t)}return t}const $O=R.mac?"mac":R.windows?"win":R.linux?"linux":"key";function vO(n,e){const t=n.split(/-(?!$)/);let i=t[t.length-1];if(i=="Space")i=" ";let s,r,o,l;for(let a=0;ai.concat(s),[])));return t}function RO(n,e,t){return Hh(Fh(n.state),e,n,t)}let ut=null;const TO=4e3;function AO(n,e=$O){let t=Object.create(null);let i=Object.create(null);let s=(o,l)=>{let a=i[o];if(a==null)i[o]=l;else if(a!=l)throw new Error("Key binding "+o+" is used both as a regular binding and as a multi-stroke prefix")};let r=(o,l,a,h,c)=>{var f,u;let d=t[o]||(t[o]=Object.create(null));let O=l.split(/ (?!$)/).map(b=>vO(b,e));for(let b=1;b{let w=ut={view:k,prefix:S,scope:o};setTimeout(()=>{if(ut==w)ut=null},TO);return true}]}}let p=O.join(" ");s(p,false);let m=d[p]||(d[p]={preventDefault:false,stopPropagation:false,run:((u=(f=d._any)===null||f===void 0?void 0:f.run)===null||u===void 0?void 0:u.slice())||[]});if(a)m.run.push(a);if(h)m.preventDefault=true;if(c)m.stopPropagation=true};for(let o of n){let l=o.scope?o.scope.split(" "):["editor"];if(o.any)for(let h of l){let c=t[h]||(t[h]=Object.create(null));if(!c._any)c._any={preventDefault:false,stopPropagation:false,run:[]};for(let f in c)c[f].run.push(o.any)}let a=o[e]||o.key;if(!a)continue;for(let h of l){r(h,a,o.run,o.preventDefault,o.stopPropagation);if(o.shift)r(h,"Shift-"+a,o.shift,o.preventDefault,o.stopPropagation)}}return t}function Hh(n,e,t,i){let s=td(e);let r=ae(s,0),o=Xe(r)==s.length&&s!=" ";let l="",a=false,h=false,c=false;if(ut&&ut.view==t&&ut.scope==i){l=ut.prefix+" ";if(Yh.indexOf(e.keyCode)<0){h=true;ut=null}}let f=new Set;let u=m=>{if(m){for(let b of m.run)if(!f.has(b)){f.add(b);if(b(t,e)){if(m.stopPropagation)c=true;return true}}if(m.preventDefault){if(m.stopPropagation)c=true;h=true}}return false};let d=n[i],O,p;if(d){if(u(d[l+pn(s,e,!o)])){a=true}else if(o&&(e.altKey||e.metaKey||e.ctrlKey)&&!(R.windows&&e.ctrlKey&&e.altKey)&&(O=wt[e.keyCode])&&O!=s){if(u(d[l+pn(O,e,true)])){a=true}else if(e.shiftKey&&(p=Mi[e.keyCode])!=s&&p!=O&&u(d[l+pn(p,e,false)])){a=true}}else if(o&&e.shiftKey&&u(d[l+pn(s,e,true)])){a=true}if(!a&&u(d._any))a=true}if(h)a=true;if(a&&c)e.stopPropagation();return a}class Ni{constructor(e,t,i,s,r){this.className=e;this.left=t;this.top=i;this.width=s;this.height=r}draw(){let e=document.createElement("div");e.className=this.className;this.adjust(e);return e}update(e,t){if(t.className!=this.className)return false;this.adjust(e);return true}adjust(e){e.style.left=this.left+"px";e.style.top=this.top+"px";if(this.width!=null)e.style.width=this.width+"px";e.style.height=this.height+"px"}eq(e){return this.left==e.left&&this.top==e.top&&this.width==e.width&&this.height==e.height&&this.className==e.className}static forRange(e,t,i){if(i.empty){let s=e.coordsAtPos(i.head,i.assoc||1);if(!s)return[];let r=Kh(e);return[new Ni(t,s.left-r.left,s.top-r.top,null,s.bottom-s.top)]}else{return CO(e,t,i)}}}function Kh(n){let e=n.scrollDOM.getBoundingClientRect();let t=n.textDirection==N.LTR?e.left:e.right-n.scrollDOM.clientWidth*n.scaleX;return{left:t-n.scrollDOM.scrollLeft*n.scaleX,top:e.top-n.scrollDOM.scrollTop*n.scaleY}}function Dl(n,e,t){let i=y.cursor(e);return{from:Math.max(t.from,n.moveToLineBoundary(i,false,true).from),to:Math.min(t.to,n.moveToLineBoundary(i,true,true).from),type:ge.Text}}function CO(n,e,t){if(t.to<=n.viewport.from||t.from>=n.viewport.to)return[];let i=Math.max(t.from,n.viewport.from),s=Math.min(t.to,n.viewport.to);let r=n.textDirection==N.LTR;let o=n.contentDOM,l=o.getBoundingClientRect(),a=Kh(n);let h=o.querySelector(".cm-line"),c=h&&window.getComputedStyle(h);let f=l.left+(c?parseInt(c.paddingLeft)+Math.min(0,parseInt(c.textIndent)):0);let u=l.right-(c?parseInt(c.paddingRight):0);let d=Zr(n,i),O=Zr(n,s);let p=d.type==ge.Text?d:null;let m=O.type==ge.Text?O:null;if(p&&(n.lineWrapping||d.widgetLineBreaks))p=Dl(n,i,p);if(m&&(n.lineWrapping||O.widgetLineBreaks))m=Dl(n,s,m);if(p&&m&&p.from==m.from){return S(k(t.from,t.to,p))}else{let x=p?k(t.from,null,p):w(d,false);let $=m?k(null,t.to,m):w(O,true);let P=[];if((p||d).to<(m||O).from-(p&&m?1:0)||d.widgetLineBreaks>1&&x.bottom+n.defaultLineHeight/2<$.top)P.push(b(f,x.bottom,u,$.top));else if(x.bottom<$.top&&n.elementAtHeight((x.bottom+$.top)/2).type==ge.Text)x.bottom=$.top=(x.bottom+$.top)/2;return S(x).concat(P).concat(S($))}function b(x,$,P,C){return new Ni(e,x-a.left,$-a.top-.01,P-x,C-$+.01)}function S({top:x,bottom:$,horizontal:P}){let C=[];for(let D=0;DM&&z.from=ye)break;if(te>F)X(Math.max(Me,F),x==null&&Me<=M,Math.min(te,ye),$==null&&te>=V,ve.dir)}F=xe.to+1;if(F>=ye)break}}if(Y.length==0)X(M,x==null,V,$==null,n.textDirection);return{top:C,bottom:D,horizontal:Y}}function w(x,$){let P=l.top+($?x.top:x.bottom);return{top:P,bottom:P,horizontal:[]}}}function MO(n,e){return n.constructor==e.constructor&&n.eq(e)}class WO{constructor(e,t){this.view=e;this.layer=t;this.drawn=[];this.scaleX=1;this.scaleY=1;this.measureReq={read:this.measure.bind(this),write:this.draw.bind(this)};this.dom=e.scrollDOM.appendChild(document.createElement("div"));this.dom.classList.add("cm-layer");if(t.above)this.dom.classList.add("cm-layer-above");if(t.class)this.dom.classList.add(t.class);this.scale();this.dom.setAttribute("aria-hidden","true");this.setOrder(e.state);e.requestMeasure(this.measureReq);if(t.mount)t.mount(this.dom,e)}update(e){if(e.startState.facet(Tn)!=e.state.facet(Tn))this.setOrder(e.state);if(this.layer.update(e,this.dom)||e.geometryChanged){this.scale();e.view.requestMeasure(this.measureReq)}}docViewUpdate(e){if(this.layer.updateOnDocViewUpdate!==false)e.requestMeasure(this.measureReq)}setOrder(e){let t=0,i=e.facet(Tn);while(t!MO(t,this.drawn[i]))){let t=this.dom.firstChild,i=0;for(let s of e){if(s.update&&t&&s.constructor&&this.drawn[i].constructor&&s.update(t,this.drawn[i])){t=t.nextSibling;i++}else{this.dom.insertBefore(s.draw(),t)}}while(t){let s=t.nextSibling;t.remove();t=s}this.drawn=e}}destroy(){if(this.layer.destroy)this.layer.destroy(this.dom,this.view);this.dom.remove()}}const Tn=Z.define();function Jh(n){return[ee.define(e=>new WO(e,n)),Tn.of(n)]}const ec=!R.ios;const Di=Z.define({combine(n){return it(n,{cursorBlinkRate:1200,drawRangeCursor:true},{cursorBlinkRate:(e,t)=>Math.min(e,t),drawRangeCursor:(e,t)=>e||t})}});function XO(n={}){return[Di.of(n),DO,YO,EO,vh.of(true)]}function tc(n){return n.startState.facet(Di)!=n.state.facet(Di)}const DO=Jh({above:true,markers(n){let{state:e}=n,t=e.facet(Di);let i=[];for(let s of e.selection.ranges){let r=s==e.selection.main;if(s.empty?!r||ec:t.drawRangeCursor){let o=r?"cm-cursor cm-cursor-primary":"cm-cursor cm-cursor-secondary";let l=s.empty?s:y.cursor(s.head,s.head>s.anchor?-1:1);for(let a of Ni.forRange(n,o,l))i.push(a)}}return i},update(n,e){if(n.transactions.some(i=>i.selection))e.style.animationName=e.style.animationName=="cm-blink"?"cm-blink2":"cm-blink";let t=tc(n);if(t)Yl(n.state,e);return n.docChanged||n.selectionSet||t},mount(n,e){Yl(e.state,n)},class:"cm-cursorLayer"});function Yl(n,e){e.style.animationDuration=n.facet(Di).cursorBlinkRate+"ms"}const YO=Jh({above:false,markers(n){return n.state.selection.ranges.map(e=>e.empty?[]:Ni.forRange(n,"cm-selectionBackground",e)).reduce((e,t)=>e.concat(t))},update(n,e){return n.docChanged||n.selectionSet||n.viewportChanged||tc(n)},class:"cm-selectionLayer"});const Mr={".cm-line":{"& ::selection":{backgroundColor:"transparent !important"},"&::selection":{backgroundColor:"transparent !important"}}};if(ec){Mr[".cm-line"].caretColor="transparent !important";Mr[".cm-content"]={caretColor:"transparent !important"}}const EO=Pt.highest(v.theme(Mr));const ic=A.define({map(n,e){return n==null?null:e.mapPos(n)}});const Qi=oe.define({create(){return null},update(n,e){if(n!=null)n=e.changes.mapPos(n);return e.effects.reduce((t,i)=>i.is(ic)?i.value:t,n)}});const qO=ee.fromClass(class{constructor(n){this.view=n;this.cursor=null;this.measureReq={read:this.readPos.bind(this),write:this.drawCursor.bind(this)}}update(n){var e;let t=n.state.field(Qi);if(t==null){if(this.cursor!=null){(e=this.cursor)===null||e===void 0?void 0:e.remove();this.cursor=null}}else{if(!this.cursor){this.cursor=this.view.scrollDOM.appendChild(document.createElement("div"));this.cursor.className="cm-dropCursor"}if(n.startState.field(Qi)!=t||n.docChanged||n.geometryChanged)this.view.requestMeasure(this.measureReq)}}readPos(){let{view:n}=this;let e=n.state.field(Qi);let t=e!=null&&n.coordsAtPos(e);if(!t)return null;let i=n.scrollDOM.getBoundingClientRect();return{left:t.left-i.left+n.scrollDOM.scrollLeft*n.scaleX,top:t.top-i.top+n.scrollDOM.scrollTop*n.scaleY,height:t.bottom-t.top}}drawCursor(n){if(this.cursor){let{scaleX:e,scaleY:t}=this.view;if(n){this.cursor.style.left=n.left/e+"px";this.cursor.style.top=n.top/t+"px";this.cursor.style.height=n.height/t+"px"}else{this.cursor.style.left="-100000px"}}}destroy(){if(this.cursor)this.cursor.remove()}setDropPos(n){if(this.view.state.field(Qi)!=n)this.view.dispatch({effects:ic.of(n)})}},{eventObservers:{dragover(n){this.setDropPos(this.view.posAtCoords({x:n.clientX,y:n.clientY}))},dragleave(n){if(n.target==this.view.contentDOM||!this.view.contentDOM.contains(n.relatedTarget))this.setDropPos(null)},dragend(){this.setDropPos(null)},drop(){this.setDropPos(null)}}});function _O(){return[Qi,qO]}function El(n,e,t,i,s){e.lastIndex=0;for(let r=n.iterRange(t,i),o=t,l;!r.next().done;o+=r.value.length){if(!r.lineBreak)while(l=e.exec(r.value))s(o+l.index,l)}}function zO(n,e){let t=n.visibleRanges;if(t.length==1&&t[0].from==n.viewport.from&&t[0].to==n.viewport.to)return t;let i=[];for(let{from:s,to:r}of t){s=Math.max(n.state.doc.lineAt(s).from,s-e);r=Math.min(n.state.doc.lineAt(r).to,r+e);if(i.length&&i[i.length-1].to>=s)i[i.length-1].to=r;else i.push({from:s,to:r})}return i}class jO{constructor(e){const{regexp:t,decoration:i,decorate:s,boundary:r,maxLength:o=1e3}=e;if(!t.global)throw new RangeError("The regular expression given to MatchDecorator should have its 'g' flag set");this.regexp=t;if(s){this.addMatch=(l,a,h,c)=>s(c,h,h+l[0].length,l,a)}else if(typeof i=="function"){this.addMatch=(l,a,h,c)=>{let f=i(l,a,h);if(f)c(h,h+l[0].length,f)}}else if(i){this.addMatch=(l,a,h,c)=>c(h,h+l[0].length,i)}else{throw new RangeError("Either 'decorate' or 'decoration' should be provided to MatchDecorator")}this.boundary=r;this.maxLength=o}createDeco(e){let t=new xt,i=t.add.bind(t);for(let{from:s,to:r}of zO(e,this.maxLength))El(e.state.doc,this.regexp,s,r,(o,l)=>this.addMatch(l,e,o,i));return t.finish()}updateDeco(e,t){let i=1e9,s=-1;if(e.docChanged)e.changes.iterChanges((r,o,l,a)=>{if(a>e.view.viewport.from&&l1e3)return this.createDeco(e.view);if(s>-1)return this.updateRange(e.view,t.map(e.changes),i,s);return t}updateRange(e,t,i,s){for(let r of e.visibleRanges){let o=Math.max(r.from,i),l=Math.min(r.to,s);if(l>o){let a=e.state.doc.lineAt(o),h=a.toa.from;o--)if(this.boundary.test(a.text[o-1-a.from])){c=o;break}for(;lu.push(b.range(p,m));if(a==h){this.regexp.lastIndex=c-a.from;while((d=this.regexp.exec(a.text))&&d.indexthis.addMatch(m,e,p,O))}t=t.update({filterFrom:c,filterTo:f,filter:(p,m)=>pf,add:u})}}return t}}const Wr=/x/.unicode!=null?"gu":"g";const VO=new RegExp("[\0-\b\n--Ÿ­؜​‎‏\u2028\u2029‭‮⁦⁧⁩\uFEFF-]",Wr);const LO={0:"null",7:"bell",8:"backspace",10:"newline",11:"vertical tab",13:"carriage return",27:"escape",8203:"zero width space",8204:"zero width non-joiner",8205:"zero width joiner",8206:"left-to-right mark",8207:"right-to-left mark",8232:"line separator",8237:"left-to-right override",8238:"right-to-left override",8294:"left-to-right isolate",8295:"right-to-left isolate",8297:"pop directional isolate",8233:"paragraph separator",65279:"zero width no-break space",65532:"object replacement"};let Ws=null;function BO(){var n;if(Ws==null&&typeof document!="undefined"&&document.body){let e=document.body.style;Ws=((n=e.tabSize)!==null&&n!==void 0?n:e.MozTabSize)!=null}return Ws||false}const An=Z.define({combine(n){let e=it(n,{render:null,specialChars:VO,addSpecialChars:null});if(e.replaceTabs=!BO())e.specialChars=new RegExp(" |"+e.specialChars.source,Wr);if(e.addSpecialChars)e.specialChars=new RegExp(e.specialChars.source+"|"+e.addSpecialChars.source,Wr);return e}});function UO(n={}){return[An.of(n),IO()]}let ql=null;function IO(){return ql||(ql=ee.fromClass(class{constructor(n){this.view=n;this.decorations=T.none;this.decorationCache=Object.create(null);this.decorator=this.makeDecorator(n.state.facet(An));this.decorations=this.decorator.createDeco(n)}makeDecorator(n){return new jO({regexp:n.specialChars,decoration:(e,t,i)=>{let{doc:s}=t.state;let r=ae(e[0],0);if(r==9){let o=s.lineAt(i);let l=t.state.tabSize,a=oi(o.text,l,i-o.from);return T.replace({widget:new HO((l-a%l)*this.view.defaultCharacterWidth/this.view.scaleX)})}return this.decorationCache[r]||(this.decorationCache[r]=T.replace({widget:new FO(n,r)}))},boundary:n.replaceTabs?void 0:/[^]/})}update(n){let e=n.state.facet(An);if(n.startState.facet(An)!=e){this.decorator=this.makeDecorator(e);this.decorations=this.decorator.createDeco(n.view)}else{this.decorations=this.decorator.updateDeco(n,this.decorations)}}},{decorations:n=>n.decorations}))}const NO="•";function GO(n){if(n>=32)return NO;if(n==10)return"␤";return String.fromCharCode(9216+n)}class FO extends ht{constructor(e,t){super();this.options=e;this.code=t}eq(e){return e.code==this.code}toDOM(e){let t=GO(this.code);let i=e.state.phrase("Control character")+" "+(LO[this.code]||"0x"+this.code.toString(16));let s=this.options.render&&this.options.render(this.code,i,t);if(s)return s;let r=document.createElement("span");r.textContent=t;r.title=i;r.setAttribute("aria-label",i);r.className="cm-specialChar";return r}ignoreEvent(){return false}}class HO extends ht{constructor(e){super();this.width=e}eq(e){return e.width==this.width}toDOM(){let e=document.createElement("span");e.textContent=" ";e.className="cm-tab";e.style.width=this.width+"px";return e}ignoreEvent(){return false}}function KO(){return ep}const JO=T.line({class:"cm-activeLine"});const ep=ee.fromClass(class{constructor(n){this.decorations=this.getDeco(n)}update(n){if(n.docChanged||n.selectionSet)this.decorations=this.getDeco(n.view)}getDeco(n){let e=-1,t=[];for(let i of n.state.selection.ranges){let s=n.lineBlockAt(i.head);if(s.from>e){t.push(JO.range(s.from));e=s.from}}return T.set(t)}},{decorations:n=>n.decorations});const Xr=2e3;function tp(n,e,t){let i=Math.min(e.line,t.line),s=Math.max(e.line,t.line);let r=[];if(e.off>Xr||t.off>Xr||e.col<0||t.col<0){let o=Math.min(e.off,t.off),l=Math.max(e.off,t.off);for(let a=i;a<=s;a++){let h=n.doc.line(a);if(h.length<=l)r.push(y.range(h.from+o,h.to+l))}}else{let o=Math.min(e.col,t.col),l=Math.max(e.col,t.col);for(let a=i;a<=s;a++){let h=n.doc.line(a);let c=dr(h.text,o,n.tabSize,true);if(c<0){r.push(y.cursor(h.to))}else{let f=dr(h.text,l,n.tabSize);r.push(y.range(h.from+c,h.from+f))}}}return r}function ip(n,e){let t=n.coordsAtPos(n.viewport.from);return t?Math.round(Math.abs((t.left-e)/n.defaultCharacterWidth)):-1}function _l(n,e){let t=n.posAtCoords({x:e.clientX,y:e.clientY},false);let i=n.state.doc.lineAt(t),s=t-i.from;let r=s>Xr?-1:s==i.length?ip(n,e.clientX):oi(i.text,n.state.tabSize,t-i.from);return{line:i.number,col:r,off:s}}function np(n,e){let t=_l(n,e),i=n.state.selection;if(!t)return null;return{update(s){if(s.docChanged){let r=s.changes.mapPos(s.startState.doc.line(t.line).from);let o=s.state.doc.lineAt(r);t={line:o.number,col:t.col,off:Math.min(t.off,o.length)};i=i.map(s.changes)}},get(s,r,o){let l=_l(n,s);if(!l)return i;let a=tp(n.state,t,l);if(!a.length)return i;if(o)return y.create(a.concat(i.ranges));else return y.create(a)}}}function sp(n){let e=t=>t.altKey&&t.button==0;return v.mouseSelectionStyle.of((t,i)=>e(i)?np(t,i):null)}const rp={Alt:[18,n=>!!n.altKey],Control:[17,n=>!!n.ctrlKey],Shift:[16,n=>!!n.shiftKey],Meta:[91,n=>!!n.metaKey]};const op={style:"cursor: crosshair"};function lp(n={}){let[e,t]=rp[n.key||"Alt"];let i=ee.fromClass(class{constructor(s){this.view=s;this.isDown=false}set(s){if(this.isDown!=s){this.isDown=s;this.view.update([])}}},{eventObservers:{keydown(s){this.set(s.keyCode==e||t(s))},keyup(s){if(s.keyCode==e||!t(s))this.set(false)},mousemove(s){this.set(t(s))}}});return[i,v.contentAttributes.of(s=>{var r;return((r=s.plugin(i))===null||r===void 0?void 0:r.isDown)?op:null})]}const di="-10000px";class nc{constructor(e,t,i,s){this.facet=t;this.createTooltipView=i;this.removeTooltipView=s;this.input=e.state.facet(t);this.tooltips=this.input.filter(o=>o);let r=null;this.tooltipViews=this.tooltips.map(o=>r=i(o,r))}update(e,t){var i;let s=e.state.facet(this.facet);let r=s.filter(a=>a);if(s===this.input){for(let a of this.tooltipViews)if(a.update)a.update(e);return false}let o=[],l=t?[]:null;for(let a=0;at[h]=a);t.length=l.length}this.input=s;this.tooltips=r;this.tooltipViews=o;return true}}function ap(n){let{win:e}=n;return{top:0,left:0,bottom:e.innerHeight,right:e.innerWidth}}const Xs=Z.define({combine:n=>{var e,t,i;return{position:R.ios?"absolute":((e=n.find(s=>s.position))===null||e===void 0?void 0:e.position)||"fixed",parent:((t=n.find(s=>s.parent))===null||t===void 0?void 0:t.parent)||null,tooltipSpace:((i=n.find(s=>s.tooltipSpace))===null||i===void 0?void 0:i.tooltipSpace)||ap}}});const zl=new WeakMap;const ao=ee.fromClass(class{constructor(n){this.view=n;this.above=[];this.inView=true;this.madeAbsolute=false;this.lastTransaction=0;this.measureTimeout=-1;let e=n.state.facet(Xs);this.position=e.position;this.parent=e.parent;this.classes=n.themeClasses;this.createContainer();this.measureReq={read:this.readMeasure.bind(this),write:this.writeMeasure.bind(this),key:this};this.resizeObserver=typeof ResizeObserver=="function"?new ResizeObserver(()=>this.measureSoon()):null;this.manager=new nc(n,ho,(t,i)=>this.createTooltip(t,i),t=>{if(this.resizeObserver)this.resizeObserver.unobserve(t.dom);t.dom.remove()});this.above=this.manager.tooltips.map(t=>!!t.above);this.intersectionObserver=typeof IntersectionObserver=="function"?new IntersectionObserver(t=>{if(Date.now()>this.lastTransaction-50&&t.length>0&&t[t.length-1].intersectionRatio<1)this.measureSoon()},{threshold:[1]}):null;this.observeIntersection();n.win.addEventListener("resize",this.measureSoon=this.measureSoon.bind(this));this.maybeMeasure()}createContainer(){if(this.parent){this.container=document.createElement("div");this.container.style.position="relative";this.container.className=this.view.themeClasses;this.parent.appendChild(this.container)}else{this.container=this.view.dom}}observeIntersection(){if(this.intersectionObserver){this.intersectionObserver.disconnect();for(let n of this.manager.tooltipViews)this.intersectionObserver.observe(n.dom)}}measureSoon(){if(this.measureTimeout<0)this.measureTimeout=setTimeout(()=>{this.measureTimeout=-1;this.maybeMeasure()},50)}update(n){if(n.transactions.length)this.lastTransaction=Date.now();let e=this.manager.update(n,this.above);if(e)this.observeIntersection();let t=e||n.geometryChanged;let i=n.state.facet(Xs);if(i.position!=this.position&&!this.madeAbsolute){this.position=i.position;for(let s of this.manager.tooltipViews)s.dom.style.position=this.position;t=true}if(i.parent!=this.parent){if(this.parent)this.container.remove();this.parent=i.parent;this.createContainer();for(let s of this.manager.tooltipViews)this.container.appendChild(s.dom);t=true}else if(this.parent&&this.view.themeClasses!=this.classes){this.classes=this.container.className=this.view.themeClasses}if(t)this.maybeMeasure()}createTooltip(n,e){let t=n.create(this.view);let i=e?e.dom:null;t.dom.classList.add("cm-tooltip");if(n.arrow&&!t.dom.querySelector(".cm-tooltip > .cm-tooltip-arrow")){let s=document.createElement("div");s.className="cm-tooltip-arrow";t.dom.appendChild(s)}t.dom.style.position=this.position;t.dom.style.top=di;t.dom.style.left="0px";this.container.insertBefore(t.dom,i);if(t.mount)t.mount(this.view);if(this.resizeObserver)this.resizeObserver.observe(t.dom);return t}destroy(){var n,e,t;this.view.win.removeEventListener("resize",this.measureSoon);for(let i of this.manager.tooltipViews){i.dom.remove();(n=i.destroy)===null||n===void 0?void 0:n.call(i)}if(this.parent)this.container.remove();(e=this.resizeObserver)===null||e===void 0?void 0:e.disconnect();(t=this.intersectionObserver)===null||t===void 0?void 0:t.disconnect();clearTimeout(this.measureTimeout)}readMeasure(){let n=this.view.dom.getBoundingClientRect();let e=1,t=1,i=false;if(this.position=="fixed"&&this.manager.tooltipViews.length){let{dom:s}=this.manager.tooltipViews[0];if(R.gecko){i=s.offsetParent!=this.container.ownerDocument.body}else if(s.style.top==di&&s.style.left=="0px"){let r=s.getBoundingClientRect();i=Math.abs(r.top+1e4)>1||Math.abs(r.left)>1}}if(i||this.position=="absolute"){if(this.parent){let s=this.parent.getBoundingClientRect();if(s.width&&s.height){e=s.width/this.parent.offsetWidth;t=s.height/this.parent.offsetHeight}}else{({scaleX:e,scaleY:t}=this.view.viewState)}}return{editor:n,parent:this.parent?this.container.getBoundingClientRect():n,pos:this.manager.tooltips.map((s,r)=>{let o=this.manager.tooltipViews[r];return o.getCoords?o.getCoords(s.pos):this.view.coordsAtPos(s.pos)}),size:this.manager.tooltipViews.map(({dom:s})=>s.getBoundingClientRect()),space:this.view.state.facet(Xs).tooltipSpace(this.view),scaleX:e,scaleY:t,makeAbsolute:i}}writeMeasure(n){var e;if(n.makeAbsolute){this.madeAbsolute=true;this.position="absolute";for(let l of this.manager.tooltipViews)l.dom.style.position="absolute"}let{editor:t,space:i,scaleX:s,scaleY:r}=n;let o=[];for(let l=0;l=Math.min(t.bottom,i.bottom)||f.rightMath.min(t.right,i.right)+.1){c.style.top=di;continue}let d=a.arrow?h.dom.querySelector(".cm-tooltip-arrow"):null;let O=d?7:0;let p=u.right-u.left,m=(e=zl.get(h))!==null&&e!==void 0?e:u.bottom-u.top;let b=h.offset||cp,S=this.view.textDirection==N.LTR;let k=u.width>i.right-i.left?S?i.left:i.right-u.width:S?Math.min(f.left-(d?14:0)+b.x,i.right-p):Math.max(i.left,f.left-p+(d?14:0)-b.x);let w=this.above[l];if(!a.strictSide&&(w?f.top-(u.bottom-u.top)-b.yi.bottom)&&w==i.bottom-f.bottom>f.top-i.top)w=this.above[l]=!w;let x=(w?f.top-i.top:i.bottom-f.bottom)-O;if(xk&&C.top<$+m&&C.bottom>$)$=w?C.top-m-2-O:C.bottom+O+2}if(this.position=="absolute"){c.style.top=($-n.parent.top)/r+"px";c.style.left=(k-n.parent.left)/s+"px"}else{c.style.top=$/r+"px";c.style.left=k/s+"px"}if(d){let C=f.left+(S?b.x:-b.x)-(k+14-7);d.style.left=C/s+"px"}if(h.overlap!==true)o.push({left:k,top:$,right:P,bottom:$+m});c.classList.toggle("cm-tooltip-above",w);c.classList.toggle("cm-tooltip-below",!w);if(h.positioned)h.positioned(n.space)}}maybeMeasure(){if(this.manager.tooltips.length){if(this.view.inView)this.view.requestMeasure(this.measureReq);if(this.inView!=this.view.inView){this.inView=this.view.inView;if(!this.inView)for(let n of this.manager.tooltipViews)n.dom.style.top=di}}}},{eventObservers:{scroll(){this.maybeMeasure()}}});const hp=v.baseTheme({".cm-tooltip":{zIndex:100,boxSizing:"border-box"},"&light .cm-tooltip":{border:"1px solid #bbb",backgroundColor:"#f5f5f5"},"&light .cm-tooltip-section:not(:first-child)":{borderTop:"1px solid #bbb"},"&dark .cm-tooltip":{backgroundColor:"#333338",color:"white"},".cm-tooltip-arrow":{height:`${7}px`,width:`${7*2}px`,position:"absolute",zIndex:-1,overflow:"hidden","&:before, &:after":{content:"''",position:"absolute",width:0,height:0,borderLeft:`${7}px solid transparent`,borderRight:`${7}px solid transparent`},".cm-tooltip-above &":{bottom:`-${7}px`,"&:before":{borderTop:`${7}px solid #bbb`},"&:after":{borderTop:`${7}px solid #f5f5f5`,bottom:"1px"}},".cm-tooltip-below &":{top:`-${7}px`,"&:before":{borderBottom:`${7}px solid #bbb`},"&:after":{borderBottom:`${7}px solid #f5f5f5`,top:"1px"}}},"&dark .cm-tooltip .cm-tooltip-arrow":{"&:before":{borderTopColor:"#333338",borderBottomColor:"#333338"},"&:after":{borderTopColor:"transparent",borderBottomColor:"transparent"}}});const cp={x:0,y:0};const ho=Z.define({enables:[ao,hp]});const Bn=Z.define({combine:n=>n.reduce((e,t)=>e.concat(t),[])});class fs{static create(e){return new fs(e)}constructor(e){this.view=e;this.mounted=false;this.dom=document.createElement("div");this.dom.classList.add("cm-tooltip-hover");this.manager=new nc(e,Bn,(t,i)=>this.createHostedView(t,i),t=>t.dom.remove())}createHostedView(e,t){let i=e.create(this.view);i.dom.classList.add("cm-tooltip-section");this.dom.insertBefore(i.dom,t?t.dom.nextSibling:this.dom.firstChild);if(this.mounted&&i.mount)i.mount(this.view);return i}mount(e){for(let t of this.manager.tooltipViews){if(t.mount)t.mount(e)}this.mounted=true}positioned(e){for(let t of this.manager.tooltipViews){if(t.positioned)t.positioned(e)}}update(e){this.manager.update(e)}destroy(){var e;for(let t of this.manager.tooltipViews)(e=t.destroy)===null||e===void 0?void 0:e.call(t)}passProp(e){let t=void 0;for(let i of this.manager.tooltipViews){let s=i[e];if(s!==void 0){if(t===void 0)t=s;else if(t!==s)return void 0}}return t}get offset(){return this.passProp("offset")}get getCoords(){return this.passProp("getCoords")}get overlap(){return this.passProp("overlap")}get resize(){return this.passProp("resize")}}const fp=ho.compute([Bn],n=>{let e=n.facet(Bn);if(e.length===0)return null;return{pos:Math.min(...e.map(t=>t.pos)),end:Math.max(...e.map(t=>{var i;return(i=t.end)!==null&&i!==void 0?i:t.pos})),create:fs.create,above:e[0].above,arrow:e.some(t=>t.arrow)}});class up{constructor(e,t,i,s,r){this.view=e;this.source=t;this.field=i;this.setHover=s;this.hoverTime=r;this.hoverTimeout=-1;this.restartTimeout=-1;this.pending=null;this.lastMove={x:0,y:0,target:e.dom,time:0};this.checkHover=this.checkHover.bind(this);e.dom.addEventListener("mouseleave",this.mouseleave=this.mouseleave.bind(this));e.dom.addEventListener("mousemove",this.mousemove=this.mousemove.bind(this))}update(){if(this.pending){this.pending=null;clearTimeout(this.restartTimeout);this.restartTimeout=setTimeout(()=>this.startHover(),20)}}get active(){return this.view.state.field(this.field)}checkHover(){this.hoverTimeout=-1;if(this.active.length)return;let e=Date.now()-this.lastMove.time;if(el.bottom||t.xl.right+e.defaultCharacterWidth)return;let a=e.bidiSpans(e.state.doc.lineAt(s)).find(c=>c.from<=s&&c.to>=s);let h=a&&a.dir==N.RTL?-1:1;r=t.x{if(this.pending==l){this.pending=null;if(a&&!(Array.isArray(a)&&!a.length))e.dispatch({effects:this.setHover.of(Array.isArray(a)?a:[a])})}},a=>Qe(e.state,a,"hover tooltip"))}else if(o&&!(Array.isArray(o)&&!o.length)){e.dispatch({effects:this.setHover.of(Array.isArray(o)?o:[o])})}}get tooltip(){let e=this.view.plugin(ao);let t=e?e.manager.tooltips.findIndex(i=>i.create==fs.create):-1;return t>-1?e.manager.tooltipViews[t]:null}mousemove(e){var t,i;this.lastMove={x:e.clientX,y:e.clientY,target:e.target,time:Date.now()};if(this.hoverTimeout<0)this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime);let{active:s,tooltip:r}=this;if(s.length&&r&&!dp(r.dom,e)||this.pending){let{pos:o}=s[0]||this.pending,l=(i=(t=s[0])===null||t===void 0?void 0:t.end)!==null&&i!==void 0?i:o;if(o==l?this.view.posAtCoords(this.lastMove)!=o:!Op(this.view,o,l,e.clientX,e.clientY)){this.view.dispatch({effects:this.setHover.of([])});this.pending=null}}}mouseleave(e){clearTimeout(this.hoverTimeout);this.hoverTimeout=-1;let{active:t}=this;if(t.length){let{tooltip:i}=this;let s=i&&i.dom.contains(e.relatedTarget);if(!s)this.view.dispatch({effects:this.setHover.of([])});else this.watchTooltipLeave(i.dom)}}watchTooltipLeave(e){let t=i=>{e.removeEventListener("mouseleave",t);if(this.active.length&&!this.view.dom.contains(i.relatedTarget))this.view.dispatch({effects:this.setHover.of([])})};e.addEventListener("mouseleave",t)}destroy(){clearTimeout(this.hoverTimeout);this.view.dom.removeEventListener("mouseleave",this.mouseleave);this.view.dom.removeEventListener("mousemove",this.mousemove)}}const mn=4;function dp(n,e){let t=n.getBoundingClientRect();return e.clientX>=t.left-mn&&e.clientX<=t.right+mn&&e.clientY>=t.top-mn&&e.clientY<=t.bottom+mn}function Op(n,e,t,i,s,r){let o=n.scrollDOM.getBoundingClientRect();let l=n.documentTop+n.documentPadding.top+n.contentHeight;if(o.left>i||o.rights||Math.min(o.bottom,l)=e&&a<=t}function pp(n,e={}){let t=A.define();let i=oe.define({create(){return[]},update(s,r){if(s.length){if(e.hideOnChange&&(r.docChanged||r.selection))s=[];else if(e.hideOn)s=s.filter(o=>!e.hideOn(r,o));if(r.docChanged){let o=[];for(let l of s){let a=r.changes.mapPos(l.pos,-1,ce.TrackDel);if(a!=null){let h=Object.assign(Object.create(null),l);h.pos=a;if(h.end!=null)h.end=r.changes.mapPos(h.end);o.push(h)}}s=o}}for(let o of r.effects){if(o.is(t))s=o.value;if(o.is(mp))s=[]}return s},provide:s=>Bn.from(s)});return[i,ee.define(s=>new up(s,n,i,t,e.hoverTime||300)),fp]}function sc(n,e){let t=n.plugin(ao);if(!t)return null;let i=t.manager.tooltips.indexOf(e);return i<0?null:t.manager.tooltipViews[i]}const mp=A.define();const jl=Z.define({combine(n){let e,t;for(let i of n){e=e||i.topContainer;t=t||i.bottomContainer}return{topContainer:e,bottomContainer:t}}});function Yi(n,e){let t=n.plugin(rc);let i=t?t.specs.indexOf(e):-1;return i>-1?t.panels[i]:null}const rc=ee.fromClass(class{constructor(n){this.input=n.state.facet(Ei);this.specs=this.input.filter(t=>t);this.panels=this.specs.map(t=>t(n));let e=n.state.facet(jl);this.top=new gn(n,true,e.topContainer);this.bottom=new gn(n,false,e.bottomContainer);this.top.sync(this.panels.filter(t=>t.top));this.bottom.sync(this.panels.filter(t=>!t.top));for(let t of this.panels){t.dom.classList.add("cm-panel");if(t.mount)t.mount()}}update(n){let e=n.state.facet(jl);if(this.top.container!=e.topContainer){this.top.sync([]);this.top=new gn(n.view,true,e.topContainer)}if(this.bottom.container!=e.bottomContainer){this.bottom.sync([]);this.bottom=new gn(n.view,false,e.bottomContainer)}this.top.syncClasses();this.bottom.syncClasses();let t=n.state.facet(Ei);if(t!=this.input){let i=t.filter(a=>a);let s=[],r=[],o=[],l=[];for(let a of i){let h=this.specs.indexOf(a),c;if(h<0){c=a(n.view);l.push(c)}else{c=this.panels[h];if(c.update)c.update(n)}s.push(c);(c.top?r:o).push(c)}this.specs=i;this.panels=s;this.top.sync(r);this.bottom.sync(o);for(let a of l){a.dom.classList.add("cm-panel");if(a.mount)a.mount()}}else{for(let i of this.panels)if(i.update)i.update(n)}}destroy(){this.top.sync([]);this.bottom.sync([])}},{provide:n=>v.scrollMargins.of(e=>{let t=e.plugin(n);return t&&{top:t.top.scrollMargin(),bottom:t.bottom.scrollMargin()}})});class gn{constructor(e,t,i){this.view=e;this.top=t;this.container=i;this.dom=void 0;this.classes="";this.panels=[];this.syncClasses()}sync(e){for(let t of this.panels)if(t.destroy&&e.indexOf(t)<0)t.destroy();this.panels=e;this.syncDOM()}syncDOM(){if(this.panels.length==0){if(this.dom){this.dom.remove();this.dom=void 0}return}if(!this.dom){this.dom=document.createElement("div");this.dom.className=this.top?"cm-panels cm-panels-top":"cm-panels cm-panels-bottom";this.dom.style[this.top?"top":"bottom"]="0";let t=this.container||this.view.dom;t.insertBefore(this.dom,this.top?t.firstChild:null)}let e=this.dom.firstChild;for(let t of this.panels){if(t.dom.parentNode==this.dom){while(e!=t.dom)e=Vl(e);e=e.nextSibling}else{this.dom.insertBefore(t.dom,e)}}while(e)e=Vl(e)}scrollMargin(){return!this.dom||this.container?0:Math.max(0,this.top?this.dom.getBoundingClientRect().bottom-Math.max(0,this.view.scrollDOM.getBoundingClientRect().top):Math.min(innerHeight,this.view.scrollDOM.getBoundingClientRect().bottom)-this.dom.getBoundingClientRect().top)}syncClasses(){if(!this.container||this.classes==this.view.themeClasses)return;for(let e of this.classes.split(" "))if(e)this.container.classList.remove(e);for(let e of(this.classes=this.view.themeClasses).split(" "))if(e)this.container.classList.add(e)}}function Vl(n){let e=n.nextSibling;n.remove();return e}const Ei=Z.define({enables:rc});class lt extends Xt{compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}eq(e){return false}destroy(e){}}lt.prototype.elementClass="";lt.prototype.toDOM=void 0;lt.prototype.mapMode=ce.TrackBefore;lt.prototype.startSide=lt.prototype.endSide=-1;lt.prototype.point=true;const Cn=Z.define();const gp={class:"",renderEmptyElements:false,elementStyle:"",markers:()=>E.empty,lineMarker:()=>null,widgetMarker:()=>null,lineMarkerChange:null,initialSpacer:null,updateSpacer:null,domEventHandlers:{}};const Zi=Z.define();function bp(n){return[oc(),Zi.of(Object.assign(Object.assign({},gp),n))]}const Ll=Z.define({combine:n=>n.some(e=>e)});function oc(n){let e=[yp];return e}const yp=ee.fromClass(class{constructor(n){this.view=n;this.prevViewport=n.viewport;this.dom=document.createElement("div");this.dom.className="cm-gutters";this.dom.setAttribute("aria-hidden","true");this.dom.style.minHeight=this.view.contentHeight/this.view.scaleY+"px";this.gutters=n.state.facet(Zi).map(e=>new Ul(n,e));for(let e of this.gutters)this.dom.appendChild(e.dom);this.fixed=!n.state.facet(Ll);if(this.fixed){this.dom.style.position="sticky"}this.syncGutters(false);n.scrollDOM.insertBefore(this.dom,n.contentDOM)}update(n){if(this.updateGutters(n)){let e=this.prevViewport,t=n.view.viewport;let i=Math.min(e.to,t.to)-Math.max(e.from,t.from);this.syncGutters(i<(t.to-t.from)*.8)}if(n.geometryChanged){this.dom.style.minHeight=this.view.contentHeight/this.view.scaleY+"px"}if(this.view.state.facet(Ll)!=!this.fixed){this.fixed=!this.fixed;this.dom.style.position=this.fixed?"sticky":""}this.prevViewport=n.view.viewport}syncGutters(n){let e=this.dom.nextSibling;if(n)this.dom.remove();let t=E.iter(this.view.state.facet(Cn),this.view.viewport.from);let i=[];let s=this.gutters.map(r=>new xp(r,this.view.viewport,-this.view.documentPadding.top));for(let r of this.view.viewportLineBlocks){if(i.length)i=[];if(Array.isArray(r.type)){let o=true;for(let l of r.type){if(l.type==ge.Text&&o){Dr(t,i,l.from);for(let a of s)a.line(this.view,l,i);o=false}else if(l.widget){for(let a of s)a.widget(this.view,l)}}}else if(r.type==ge.Text){Dr(t,i,r.from);for(let o of s)o.line(this.view,r,i)}else if(r.widget){for(let o of s)o.widget(this.view,r)}}for(let r of s)r.finish();if(n)this.view.scrollDOM.insertBefore(this.dom,e)}updateGutters(n){let e=n.startState.facet(Zi),t=n.state.facet(Zi);let i=n.docChanged||n.heightChanged||n.viewportChanged||!E.eq(n.startState.facet(Cn),n.state.facet(Cn),n.view.viewport.from,n.view.viewport.to);if(e==t){for(let s of this.gutters)if(s.update(n))i=true}else{i=true;let s=[];for(let r of t){let o=e.indexOf(r);if(o<0){s.push(new Ul(this.view,r))}else{this.gutters[o].update(n);s.push(this.gutters[o])}}for(let r of this.gutters){r.dom.remove();if(s.indexOf(r)<0)r.destroy()}for(let r of s)this.dom.appendChild(r.dom);this.gutters=s}return i}destroy(){for(let n of this.gutters)n.destroy();this.dom.remove()}},{provide:n=>v.scrollMargins.of(e=>{let t=e.plugin(n);if(!t||t.gutters.length==0||!t.fixed)return null;return e.textDirection==N.LTR?{left:t.dom.offsetWidth*e.scaleX}:{right:t.dom.offsetWidth*e.scaleX}})});function Bl(n){return Array.isArray(n)?n:[n]}function Dr(n,e,t){while(n.value&&n.from<=t){if(n.from==t)e.push(n.value);n.next()}}class xp{constructor(e,t,i){this.gutter=e;this.height=i;this.i=0;this.cursor=E.iter(e.markers,t.from)}addElement(e,t,i){let{gutter:s}=this,r=(t.top-this.height)/e.scaleY,o=t.height/e.scaleY;if(this.i==s.elements.length){let l=new lc(e,o,r,i);s.elements.push(l);s.dom.appendChild(l.dom)}else{s.elements[this.i].update(e,o,r,i)}this.height=t.bottom;this.i++}line(e,t,i){let s=[];Dr(this.cursor,s,t.from);if(i.length)s=s.concat(i);let r=this.gutter.config.lineMarker(e,t,s);if(r)s.unshift(r);let o=this.gutter;if(s.length==0&&!o.config.renderEmptyElements)return;this.addElement(e,t,s)}widget(e,t){let i=this.gutter.config.widgetMarker(e,t.widget,t);if(i)this.addElement(e,t,[i])}finish(){let e=this.gutter;while(e.elements.length>this.i){let t=e.elements.pop();e.dom.removeChild(t.dom);t.destroy()}}}class Ul{constructor(e,t){this.view=e;this.config=t;this.elements=[];this.spacer=null;this.dom=document.createElement("div");this.dom.className="cm-gutter"+(this.config.class?" "+this.config.class:"");for(let i in t.domEventHandlers){this.dom.addEventListener(i,s=>{let r=s.target,o;if(r!=this.dom&&this.dom.contains(r)){while(r.parentNode!=this.dom)r=r.parentNode;let a=r.getBoundingClientRect();o=(a.top+a.bottom)/2}else{o=s.clientY}let l=e.lineBlockAtHeight(o-e.documentTop);if(t.domEventHandlers[i](e,l,s))s.preventDefault()})}this.markers=Bl(t.markers(e));if(t.initialSpacer){this.spacer=new lc(e,0,0,[t.initialSpacer(e)]);this.dom.appendChild(this.spacer.dom);this.spacer.dom.style.cssText+="visibility: hidden; pointer-events: none"}}update(e){let t=this.markers;this.markers=Bl(this.config.markers(e.view));if(this.spacer&&this.config.updateSpacer){let s=this.config.updateSpacer(this.spacer.markers[0],e);if(s!=this.spacer.markers[0])this.spacer.update(e.view,0,0,[s])}let i=e.view.viewport;return!E.eq(this.markers,t,i.from,i.to)||(this.config.lineMarkerChange?this.config.lineMarkerChange(e):false)}destroy(){for(let e of this.elements)e.destroy()}}class lc{constructor(e,t,i,s){this.height=-1;this.above=0;this.markers=[];this.dom=document.createElement("div");this.dom.className="cm-gutterElement";this.update(e,t,i,s)}update(e,t,i,s){if(this.height!=t){this.height=t;this.dom.style.height=t+"px"}if(this.above!=i)this.dom.style.marginTop=(this.above=i)?i+"px":"";if(!Sp(this.markers,s))this.setMarkers(e,s)}setMarkers(e,t){let i="cm-gutterElement",s=this.dom.firstChild;for(let r=0,o=0;;){let l=o,a=rr(l,a,h)||o(l,a,h):o}return i}})}});class Ds extends lt{constructor(e){super();this.number=e}eq(e){return this.number==e.number}toDOM(){return document.createTextNode(this.number)}}function Ys(n,e){return n.state.facet(Lt).formatNumber(e,n.state)}const Qp=Zi.compute([Lt],n=>({class:"cm-lineNumbers",renderEmptyElements:false,markers(e){return e.state.facet(wp)},lineMarker(e,t,i){if(i.some(s=>s.toDOM))return null;return new Ds(Ys(e,e.state.doc.lineAt(t.from).number))},widgetMarker:()=>null,lineMarkerChange:e=>e.startState.facet(Lt)!=e.state.facet(Lt),initialSpacer(e){return new Ds(Ys(e,Il(e.state.doc.lines)))},updateSpacer(e,t){let i=Ys(t.view,Il(t.view.state.doc.lines));return i==e.number?e:new Ds(i)},domEventHandlers:n.facet(Lt).domEventHandlers}));function kp(n={}){return[Lt.of(n),oc(),Qp]}function Il(n){let e=9;while(e{let e=[],t=-1;for(let i of n.selection.ranges){let s=n.doc.lineAt(i.head).from;if(s>t){t=s;e.push(Pp.range(s))}}return E.of(e)});function vp(){return $p}var Es;const Bt=new W;function ac(n){return Z.define({combine:n?e=>e.concat(n):void 0})}const co=new W;class _e{constructor(e,t,i=[],s=""){this.data=e;this.name=s;if(!q.prototype.hasOwnProperty("tree"))Object.defineProperty(q.prototype,"tree",{get(){return re(this)}});this.parser=t;this.extension=[kt.of(this),q.languageData.of((r,o,l)=>{let a=Nl(r,o,l),h=a.type.prop(Bt);if(!h)return[];let c=r.facet(h),f=a.type.prop(co);if(f){let u=a.resolve(o-a.from,l);for(let d of f)if(d.test(u,r)){let O=r.facet(d.facet);return d.type=="replace"?O:O.concat(c)}}return c})].concat(i)}isActiveAt(e,t,i=-1){return Nl(e,t,i).type.prop(Bt)==this.data}findRegions(e){let t=e.facet(kt);if((t===null||t===void 0?void 0:t.data)==this.data)return[{from:0,to:e.doc.length}];if(!t||!t.allowsNesting)return[];let i=[];let s=(r,o)=>{if(r.prop(Bt)==this.data){i.push({from:o,to:o+r.length});return}let l=r.prop(W.mounted);if(l){if(l.tree.prop(Bt)==this.data){if(l.overlay)for(let a of l.overlay)i.push({from:a.from+o,to:a.to+o});else i.push({from:o,to:o+r.length});return}else if(l.overlay){let a=i.length;s(l.tree,l.overlay[0].from+o);if(i.length>a)return}}for(let a=0;ai.isTop?t:void 0)]}),e.name)}configure(e,t){return new Un(this.data,this.parser.configure(e),t||this.name)}get allowsNesting(){return this.parser.hasWrappers()}}function re(n){let e=n.field(_e.state,false);return e?e.tree:K.empty}class Zp{constructor(e){this.doc=e;this.cursorPos=0;this.string="";this.cursor=e.iter()}get length(){return this.doc.length}syncTo(e){this.string=this.cursor.next(e-this.cursorPos).value;this.cursorPos=e+this.string.length;return this.cursorPos-this.string.length}chunk(e){this.syncTo(e);return this.string}get lineChunks(){return true}read(e,t){let i=this.cursorPos-this.string.length;if(e=this.cursorPos)return this.doc.sliceString(e,t);else return this.string.slice(e-i,t-i)}}let Oi=null;class In{constructor(e,t,i=[],s,r,o,l,a){this.parser=e;this.state=t;this.fragments=i;this.tree=s;this.treeLen=r;this.viewport=o;this.skipped=l;this.scheduleOn=a;this.parse=null;this.tempSkipped=[]}static create(e,t,i){return new In(e,t,[],K.empty,0,i,[],null)}startParse(){return this.parser.startParse(new Zp(this.state.doc),this.fragments)}work(e,t){if(t!=null&&t>=this.state.doc.length)t=void 0;if(this.tree!=K.empty&&this.isDone(t!==null&&t!==void 0?t:this.state.doc.length)){this.takeTree();return true}return this.withContext(()=>{var i;if(typeof e=="number"){let s=Date.now()+e;e=()=>Date.now()>s}if(!this.parse)this.parse=this.startParse();if(t!=null&&(this.parse.stoppedAt==null||this.parse.stoppedAt>t)&&t=this.treeLen){if(this.parse.stoppedAt==null||this.parse.stoppedAt>e)this.parse.stopAt(e);this.withContext(()=>{while(!(t=this.parse.advance())){}});this.treeLen=e;this.tree=t;this.fragments=this.withoutTempSkipped(Mt.addTree(this.tree,this.fragments,true));this.parse=null}}withContext(e){let t=Oi;Oi=this;try{return e()}finally{Oi=t}}withoutTempSkipped(e){for(let t;t=this.tempSkipped.pop();)e=Gl(e,t.from,t.to);return e}changes(e,t){let{fragments:i,tree:s,treeLen:r,viewport:o,skipped:l}=this;this.takeTree();if(!e.empty){let a=[];e.iterChangedRanges((h,c,f,u)=>a.push({fromA:h,toA:c,fromB:f,toB:u}));i=Mt.applyChanges(i,a);s=K.empty;r=0;o={from:e.mapPos(o.from,-1),to:e.mapPos(o.to,1)};if(this.skipped.length){l=[];for(let h of this.skipped){let c=e.mapPos(h.from,1),f=e.mapPos(h.to,-1);if(ce.from){this.fragments=Gl(this.fragments,s,r);this.skipped.splice(i--,1)}}if(this.skipped.length>=t)return false;this.reset();return true}reset(){if(this.parse){this.takeTree();this.parse=null}}skipUntilInView(e,t){this.skipped.push({from:e,to:t})}static getSkippingParser(e){return new class extends Aa{createParse(t,i,s){let r=s[0].from,o=s[s.length-1].to;let l={parsedPos:r,advance(){let a=Oi;if(a){for(let h of s)a.tempSkipped.push(h);if(e)a.scheduleOn=a.scheduleOn?Promise.all([a.scheduleOn,e]):e}this.parsedPos=o;return new K($e.none,[],[],o-r)},stoppedAt:null,stopAt(){}};return l}}}isDone(e){e=Math.min(e,this.state.doc.length);let t=this.fragments;return this.treeLen>=e&&t.length&&t[0].from==0&&t[0].to>=e}static get(){return Oi}}function Gl(n,e,t){return Mt.applyChanges(n,[{fromA:e,toA:t,fromB:e,toB:t}])}class ni{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);let i=this.context.treeLen==e.startState.doc.length?void 0:Math.max(e.changes.mapPos(this.context.treeLen),t.viewport.to);if(!t.work(20,i))t.takeTree();return new ni(t)}static init(e){let t=Math.min(3e3,e.doc.length);let i=In.create(e.facet(kt).parser,e,{from:0,to:t});if(!i.work(20,t))i.takeTree();return new ni(i)}}_e.state=oe.define({create:ni.init,update(n,e){for(let t of e.effects)if(t.is(_e.setState))return t.value;if(e.startState.facet(kt)!=e.state.facet(kt))return ni.init(e.state);return n.apply(e)}});let hc=n=>{let e=setTimeout(()=>n(),500);return()=>clearTimeout(e)};if(typeof requestIdleCallback!="undefined")hc=n=>{let e=-1,t=setTimeout(()=>{e=requestIdleCallback(n,{timeout:500-100})},100);return()=>e<0?clearTimeout(t):cancelIdleCallback(e)};const qs=typeof navigator!="undefined"&&((Es=navigator.scheduling)===null||Es===void 0?void 0:Es.isInputPending)?()=>navigator.scheduling.isInputPending():null;const Rp=ee.fromClass(class z1{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(_e.state).context;if(t.updateViewport(e.view.viewport)||this.view.viewport.to>t.treeLen)this.scheduleWork();if(e.docChanged||e.selectionSet){if(this.view.hasFocus)this.chunkBudget+=50;this.scheduleWork()}this.checkAsyncSchedule(t)}scheduleWork(){if(this.working)return;let{state:e}=this.view,t=e.field(_e.state);if(t.tree!=t.context.tree||!t.context.isDone(e.doc.length))this.working=hc(this.work)}work(e){this.working=null;let t=Date.now();if(this.chunkEnds+1e3;let a=r.context.work(()=>{return qs&&qs()||Date.now()>o},s+(l?0:1e5));this.chunkBudget-=Date.now()-t;if(a||this.chunkBudget<=0){r.context.takeTree();this.view.dispatch({effects:_e.setState.of(new ni(r.context))})}if(this.chunkBudget>0&&!(a&&!l))this.scheduleWork();this.checkAsyncSchedule(r.context)}checkAsyncSchedule(e){if(e.scheduleOn){this.workScheduled++;e.scheduleOn.then(()=>this.scheduleWork()).catch(t=>Qe(this.view.state,t)).then(()=>this.workScheduled--);e.scheduleOn=null}}destroy(){if(this.working)this.working()}isWorking(){return!!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork()}}});const kt=Z.define({combine(n){return n.length?n[0]:null},enables:n=>[_e.state,Rp,v.contentAttributes.compute([n],e=>{let t=e.facet(n);return t&&t.name?{"data-language":t.name}:{}})]});class Tp{constructor(e,t=[]){this.language=e;this.support=t;this.extension=[e,t]}}const Ap=Z.define();const us=Z.define({combine:n=>{if(!n.length)return" ";let e=n[0];if(!e||/\S/.test(e)||Array.from(e).some(t=>t!=e[0]))throw new Error("Invalid indent unit: "+JSON.stringify(n[0]));return e}});function Nn(n){let e=n.facet(us);return e.charCodeAt(0)==9?n.tabSize*e.length:e.length}function qi(n,e){let t="",i=n.tabSize,s=n.facet(us)[0];if(s==" "){while(e>=i){t+=" ";e-=i}s=" "}for(let r=0;r=e?Cp(n,t,e):null}class ds{constructor(e,t={}){this.state=e;this.options=t;this.unit=Nn(e)}lineAt(e,t=1){let i=this.state.doc.lineAt(e);let{simulateBreak:s,simulateDoubleBreak:r}=this.options;if(s!=null&&s>=i.from&&s<=i.to){if(r&&s==e)return{text:"",from:e};else if(t<0?s-1)r+=o-this.countColumn(i,i.search(/\S|$/));return r}countColumn(e,t=e.length){return oi(e,this.state.tabSize,t)}lineIndent(e,t=1){let{text:i,from:s}=this.lineAt(e,t);let r=this.options.overrideIndentation;if(r){let o=r(s);if(o>-1)return o}return this.countColumn(i,i.search(/\S|$/))}get simulatedBreak(){return this.options.simulateBreak||null}}const cc=new W;function Cp(n,e,t){let i=e.resolveStack(t);let s=i.node.enterUnfinishedNodesBefore(t);if(s!=i.node){let r=[];for(let o=s;o!=i.node;o=o.parent)r.push(o);for(let o=r.length-1;o>=0;o--)i={node:r[o],next:i}}return fc(i,n,t)}function fc(n,e,t){for(let i=n;i;i=i.next){let s=Wp(i.node);if(s)return s(uo.create(e,t,i))}return 0}function Mp(n){return n.pos==n.options.simulateBreak&&n.options.simulateDoubleBreak}function Wp(n){let e=n.type.prop(cc);if(e)return e;let t=n.firstChild,i;if(t&&(i=t.type.prop(W.closedBy))){let s=n.lastChild,r=s&&i.indexOf(s.name)>-1;return o=>uc(o,true,1,void 0,r&&!Mp(o)?s.from:void 0)}return n.parent==null?Xp:null}function Xp(){return 0}class uo extends ds{constructor(e,t,i){super(e.state,e.options);this.base=e;this.pos=t;this.context=i}get node(){return this.context.node}static create(e,t,i){return new uo(e,t,i)}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 i=e.resolve(t.from);while(i.parent&&i.parent.from==i.from)i=i.parent;if(Dp(i,e))break;t=this.state.doc.lineAt(i.from)}return this.lineIndent(t.from)}continue(){return fc(this.context.next,this.base,this.pos)}}function Dp(n,e){for(let t=e;t;t=t.parent)if(n==t)return true;return false}function Yp(n){let e=n.node;let t=e.childAfter(e.from),i=e.lastChild;if(!t)return null;let s=n.options.simulateBreak;let r=n.state.doc.lineAt(t.from);let o=s==null||s<=r.from?r.to:Math.min(r.to,s);for(let l=t.to;;){let a=e.childAfter(l);if(!a||a==i)return null;if(!a.type.isSkipped)return a.fromuc(i,e,t,n)}function uc(n,e,t,i,s){let r=n.textAfter,o=r.match(/^\s*/)[0].length;let l=i&&r.slice(o,o+i.length)==i||s==n.pos+o;let a=e?Yp(n):null;if(a)return l?n.column(a.from):n.column(a.to);return n.baseIndent+(l?0:n.unit*t)}const qp=n=>n.baseIndent;function _s({except:n,units:e=1}={}){return t=>{let i=n&&n.test(t.textAfter);return t.baseIndent+(i?0:e*t.unit)}}const _p=200;function zp(){return q.transactionFilter.of(n=>{if(!n.docChanged||!n.isUserEvent("input.type")&&!n.isUserEvent("input.complete"))return n;let e=n.startState.languageDataAt("indentOnInput",n.startState.selection.main.head);if(!e.length)return n;let t=n.newDoc,{head:i}=n.newSelection.main,s=t.lineAt(i);if(i>s.from+_p)return n;let r=t.sliceString(s.from,i);if(!e.some(h=>h.test(r)))return n;let{state:o}=n,l=-1,a=[];for(let{head:h}of o.selection.ranges){let c=o.doc.lineAt(h);if(c.from==l)continue;l=c.from;let f=fo(o,c.from);if(f==null)continue;let u=/^\s*/.exec(c.text)[0];let d=qi(o,f);if(u!=d)a.push({from:c.from,to:c.from+u.length,insert:d})}return a.length?[n,{changes:a,sequential:true}]:n})}const jp=Z.define();const dc=new W;function Vp(n){let e=n.firstChild,t=n.lastChild;return e&&e.tot)continue;if(r&&l.from=e&&h.to>t)r=h}}return r}function Bp(n){let e=n.lastChild;return e&&e.to==n.to&&e.type.isError}function Gn(n,e,t){for(let i of n.facet(jp)){let s=i(n,e,t);if(s)return s}return Lp(n,e,t)}function Oc(n,e){let t=e.mapPos(n.from,1),i=e.mapPos(n.to,-1);return t>=i?void 0:{from:t,to:i}}const Os=A.define({map:Oc});const Gi=A.define({map:Oc});function pc(n){let e=[];for(let{head:t}of n.state.selection.ranges){if(e.some(i=>i.from<=t&&i.to>=t))continue;e.push(n.lineBlockAt(t))}return e}const qt=oe.define({create(){return T.none},update(n,e){n=n.map(e.changes);for(let t of e.effects){if(t.is(Os)&&!Up(n,t.value.from,t.value.to)){let{preparePlaceholder:i}=e.state.facet(bc);let s=!i?Fl:T.replace({widget:new Jp(i(e.state,t.value))});n=n.update({add:[s.range(t.value.from,t.value.to)]})}else if(t.is(Gi)){n=n.update({filter:(i,s)=>t.value.from!=i||t.value.to!=s,filterFrom:t.value.from,filterTo:t.value.to})}}if(e.selection){let t=false,{head:i}=e.selection.main;n.between(i,i,(s,r)=>{if(si)t=true});if(t)n=n.update({filterFrom:i,filterTo:i,filter:(s,r)=>r<=i||s>=i})}return n},provide:n=>v.decorations.from(n),toJSON(n,e){let t=[];n.between(0,e.doc.length,(i,s)=>{t.push(i,s)});return t},fromJSON(n){if(!Array.isArray(n)||n.length%2)throw new RangeError("Invalid JSON for fold state");let e=[];for(let t=0;t{if(!s||s.from>r)s={from:r,to:o}});return s}function Up(n,e,t){let i=false;n.between(e,e,(s,r)=>{if(s==e&&r==t)i=true});return i}function mc(n,e){return n.field(qt,false)?e:e.concat(A.appendConfig.of(yc()))}const Ip=n=>{for(let e of pc(n)){let t=Gn(n.state,e.from,e.to);if(t){n.dispatch({effects:mc(n.state,[Os.of(t),gc(n,t)])});return true}}return false};const Np=n=>{if(!n.state.field(qt,false))return false;let e=[];for(let t of pc(n)){let i=Fn(n.state,t.from,t.to);if(i)e.push(Gi.of(i),gc(n,i,false))}if(e.length)n.dispatch({effects:e});return e.length>0};function gc(n,e,t=true){let i=n.state.doc.lineAt(e.from).number,s=n.state.doc.lineAt(e.to).number;return v.announce.of(`${n.state.phrase(t?"Folded lines":"Unfolded lines")} ${i} ${n.state.phrase("to")} ${s}.`)}const Gp=n=>{let{state:e}=n,t=[];for(let i=0;i{let e=n.state.field(qt,false);if(!e||!e.size)return false;let t=[];e.between(0,n.state.doc.length,(i,s)=>{t.push(Gi.of({from:i,to:s}))});n.dispatch({effects:t});return true};const Hp=[{key:"Ctrl-Shift-[",mac:"Cmd-Alt-[",run:Ip},{key:"Ctrl-Shift-]",mac:"Cmd-Alt-]",run:Np},{key:"Ctrl-Alt-[",run:Gp},{key:"Ctrl-Alt-]",run:Fp}];const Kp={placeholderDOM:null,preparePlaceholder:null,placeholderText:"…"};const bc=Z.define({combine(n){return it(n,Kp)}});function yc(n){let e=[qt,im];return e}function xc(n,e){let{state:t}=n,i=t.facet(bc);let s=o=>{let l=n.lineBlockAt(n.posAtDOM(o.target));let a=Fn(n.state,l.from,l.to);if(a)n.dispatch({effects:Gi.of(a)});o.preventDefault()};if(i.placeholderDOM)return i.placeholderDOM(n,s,e);let r=document.createElement("span");r.textContent=i.placeholderText;r.setAttribute("aria-label",t.phrase("folded code"));r.title=t.phrase("unfold");r.className="cm-foldPlaceholder";r.onclick=s;return r}const Fl=T.replace({widget:new class extends ht{toDOM(n){return xc(n,null)}}});class Jp extends ht{constructor(e){super();this.value=e}eq(e){return this.value==e.value}toDOM(e){return xc(e,this.value)}}const em={openText:"⌄",closedText:"›",markerDOM:null,domEventHandlers:{},foldingChanged:()=>false};class zs extends lt{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");t.textContent=this.open?this.config.openText:this.config.closedText;t.title=e.state.phrase(this.open?"Fold line":"Unfold line");return t}}function tm(n={}){let e=Object.assign(Object.assign({},em),n);let t=new zs(e,true),i=new zs(e,false);let s=ee.fromClass(class{constructor(o){this.from=o.viewport.from;this.markers=this.buildMarkers(o)}update(o){if(o.docChanged||o.viewportChanged||o.startState.facet(kt)!=o.state.facet(kt)||o.startState.field(qt,false)!=o.state.field(qt,false)||re(o.startState)!=re(o.state)||e.foldingChanged(o))this.markers=this.buildMarkers(o.view)}buildMarkers(o){let l=new xt;for(let a of o.viewportLineBlocks){let h=Fn(o.state,a.from,a.to)?i:Gn(o.state,a.from,a.to)?t:null;if(h)l.add(a.from,a.from,h)}return l.finish()}});let{domEventHandlers:r}=e;return[s,bp({class:"cm-foldGutter",markers(o){var l;return((l=o.plugin(s))===null||l===void 0?void 0:l.markers)||E.empty},initialSpacer(){return new zs(e,false)},domEventHandlers:Object.assign(Object.assign({},r),{click:(o,l,a)=>{if(r.click&&r.click(o,l,a))return true;let h=Fn(o.state,l.from,l.to);if(h){o.dispatch({effects:Gi.of(h)});return true}let c=Gn(o.state,l.from,l.to);if(c){o.dispatch({effects:Os.of(c)});return true}return false}})}),yc()]}const im=v.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 ps{constructor(e,t){this.specs=e;let i;function s(l){let a=St.newName();(i||(i=Object.create(null)))["."+a]=l;return a}const r=typeof t.all=="string"?t.all:t.all?s(t.all):void 0;const o=t.scope;this.scope=o instanceof _e?l=>l.prop(Bt)==o.data:o?l=>l==o:void 0;this.style=Xa(e.map(l=>({tag:l.tag,class:l.class||s(Object.assign({},l,{tag:null}))})),{all:r}).style;this.module=i?new St(i):null;this.themeType=t.themeType}static define(e,t){return new ps(e,t||{})}}const Yr=Z.define();const Sc=Z.define({combine(n){return n.length?[n[0]]:null}});function js(n){let e=n.facet(Yr);return e.length?e:n.facet(Sc)}function nm(n,e){let t=[rm],i;if(n instanceof ps){if(n.module)t.push(v.styleModule.of(n.module));i=n.themeType}if(e===null||e===void 0?void 0:e.fallback)t.push(Sc.of(n));else if(i)t.push(Yr.computeN([v.darkTheme],s=>{return s.facet(v.darkTheme)==(i=="dark")?[n]:[]}));else t.push(Yr.of(n));return t}class sm{constructor(e){this.markCache=Object.create(null);this.tree=re(e.state);this.decorations=this.buildDeco(e,js(e.state));this.decoratedTo=e.viewport.to}update(e){let t=re(e.state),i=js(e.state);let s=i!=js(e.startState);let{viewport:r}=e.view,o=e.changes.mapPos(this.decoratedTo,1);if(t.length=r.to){this.decorations=this.decorations.map(e.changes);this.decoratedTo=o}else if(t!=this.tree||e.viewportChanged||s){this.tree=t;this.decorations=this.buildDeco(e.view,i);this.decoratedTo=r.to}}buildDeco(e,t){if(!t||!this.tree.length)return T.none;let i=new xt;for(let{from:s,to:r}of e.visibleRanges){ru(this.tree,t,(o,l,a)=>{i.add(o,l,this.markCache[a]||(this.markCache[a]=T.mark({class:a})))},s,r)}return i.finish()}}const rm=Pt.high(ee.fromClass(sm,{decorations:n=>n.decorations}));const om=ps.define([{tag:g.meta,color:"#404740"},{tag:g.link,textDecoration:"underline"},{tag:g.heading,textDecoration:"underline",fontWeight:"bold"},{tag:g.emphasis,fontStyle:"italic"},{tag:g.strong,fontWeight:"bold"},{tag:g.strikethrough,textDecoration:"line-through"},{tag:g.keyword,color:"#708"},{tag:[g.atom,g.bool,g.url,g.contentSeparator,g.labelName],color:"#219"},{tag:[g.literal,g.inserted],color:"#164"},{tag:[g.string,g.deleted],color:"#a11"},{tag:[g.regexp,g.escape,g.special(g.string)],color:"#e40"},{tag:g.definition(g.variableName),color:"#00f"},{tag:g.local(g.variableName),color:"#30a"},{tag:[g.typeName,g.namespace],color:"#085"},{tag:g.className,color:"#167"},{tag:[g.special(g.variableName),g.macroName],color:"#256"},{tag:g.definition(g.propertyName),color:"#00c"},{tag:g.comment,color:"#940"},{tag:g.invalid,color:"#f00"}]);const lm=v.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}});const wc=1e4;const Qc="()[]{}";const kc=Z.define({combine(n){return it(n,{afterCursor:true,brackets:Qc,maxScanDistance:wc,renderMatch:cm})}});const am=T.mark({class:"cm-matchingBracket"});const hm=T.mark({class:"cm-nonmatchingBracket"});function cm(n){let e=[];let t=n.matched?am:hm;e.push(t.range(n.start.from,n.start.to));if(n.end)e.push(t.range(n.end.from,n.end.to));return e}const fm=oe.define({create(){return T.none},update(n,e){if(!e.docChanged&&!e.selection)return n;let t=[];let i=e.state.facet(kc);for(let s of e.state.selection.ranges){if(!s.empty)continue;let r=Je(e.state,s.head,-1,i)||s.head>0&&Je(e.state,s.head-1,1,i)||i.afterCursor&&(Je(e.state,s.head,1,i)||s.headv.decorations.from(n)});const um=[fm,lm];function dm(n={}){return[kc.of(n),um]}const Om=new W;function Er(n,e,t){let i=n.prop(e<0?W.openedBy:W.closedBy);if(i)return i;if(n.name.length==1){let s=t.indexOf(n.name);if(s>-1&&s%2==(e<0?1:0))return[t[s+e]]}return null}function qr(n){let e=n.type.prop(Om);return e?e(n.node):n}function Je(n,e,t,i={}){let s=i.maxScanDistance||wc,r=i.brackets||Qc;let o=re(n),l=o.resolveInner(e,t);for(let a=l;a;a=a.parent){let h=Er(a.type,t,r);if(h&&a.from0?e>=c.from&&ec.from&&e<=c.to))return pm(n,e,t,a,c,h,r)}}return mm(n,e,t,o,l.type,s,r)}function pm(n,e,t,i,s,r,o){let l=i.parent,a={from:s.from,to:s.to};let h=0,c=l===null||l===void 0?void 0:l.cursor();if(c&&(t<0?c.childBefore(i.from):c.childAfter(i.to)))do{if(t<0?c.to<=i.from:c.from>=i.to){if(h==0&&r.indexOf(c.type.name)>-1&&c.from0)return null;let h={from:t<0?e-1:e,to:t>0?e+1:e};let c=n.doc.iterRange(e,t>0?n.doc.length:0),f=0;for(let u=0;!c.next().done&&u<=r;){let d=c.value;if(t<0)u+=d.length;let O=e+u*t;for(let p=t>0?0:d.length-1,m=t>0?d.length:-1;p!=m;p+=t){let b=o.indexOf(d[p]);if(b<0||i.resolveInner(O+p,1).type!=s)continue;if(b%2==0==t>0){f++}else if(f==1){return{start:h,end:{from:O+p,to:O+p+1},matched:b>>1==a>>1}}else{f--}}if(t>0)u+=d.length}return c.done?{start:h,matched:false}:null}const gm=Object.create(null);const Hl=[$e.none];const Kl=[];const Jl=Object.create(null);const bm=Object.create(null);for(let[n,e]of[["variable","variableName"],["variable-2","variableName.special"],["string-2","string.special"],["def","variableName.definition"],["tag","tagName"],["attribute","attributeName"],["type","typeName"],["builtin","variableName.standard"],["qualifier","modifier"],["error","invalid"],["header","heading"],["property","propertyName"]])bm[n]=ym(gm,e);function Vs(n,e){if(Kl.indexOf(n)>-1)return;Kl.push(n);console.warn(e)}function ym(n,e){let t=[];for(let l of e.split(" ")){let a=[];for(let h of l.split(".")){let c=n[h]||g[h];if(!c){Vs(h,`Unknown highlighting tag ${h}`)}else if(typeof c=="function"){if(!a.length)Vs(h,`Modifier ${h} used at start of tag`);else a=a.map(c)}else{if(a.length)Vs(h,`Tag ${h} used as modifier`);else a=Array.isArray(c)?c:[c]}}for(let h of a)t.push(h)}if(!t.length)return 0;let i=e.replace(/ /g,"_"),s=i+" "+t.map(l=>l.id);let r=Jl[s];if(r)return r.id;let o=Jl[s]=$e.define({id:Hl.length,name:i,props:[Ma({[i]:t})]});Hl.push(o);return o.id}({rtl:T.mark({class:"cm-iso",inclusive:true,attributes:{dir:"rtl"},bidiIsolate:N.RTL}),ltr:T.mark({class:"cm-iso",inclusive:true,attributes:{dir:"ltr"},bidiIsolate:N.LTR}),auto:T.mark({class:"cm-iso",inclusive:true,attributes:{dir:"auto"},bidiIsolate:null})});class Pc{constructor(e,t,i){this.state=e;this.pos=t;this.explicit=i;this.abortListeners=[]}tokenBefore(e){let t=re(this.state).resolveInner(this.pos,-1);while(t&&e.indexOf(t.name)<0)t=t.parent;return t?{from:t.from,to:this.pos,text:this.state.sliceDoc(t.from,this.pos),type:t.type}:null}matchBefore(e){let t=this.state.doc.lineAt(this.pos);let i=Math.max(t.from,this.pos-250);let s=t.text.slice(i-t.from,this.pos-t.from);let r=s.search(vc(e,false));return r<0?null:{from:i+r,to:this.pos,text:s.slice(r)}}get aborted(){return this.abortListeners==null}addEventListener(e,t){if(e=="abort"&&this.abortListeners)this.abortListeners.push(t)}}function ea(n){let e=Object.keys(n).join("");let t=/\w/.test(e);if(t)e=e.replace(/\w/g,"");return`[${t?"\\w":""}${e.replace(/[^\w\s]/g,"\\$&")}]`}function xm(n){let e=Object.create(null),t=Object.create(null);for(let{label:s}of n){e[s[0]]=true;for(let r=1;rtypeof s=="string"?{label:s}:s);let[t,i]=e.every(s=>/^\w+$/.test(s.label))?[/\w*$/,/\w+$/]:xm(e);return s=>{let r=s.matchBefore(i);return r||s.explicit?{from:r?r.from:s.pos,options:e,validFor:t}:null}}function Sm(n,e){return t=>{for(let i=re(t.state).resolveInner(t.pos,-1);i;i=i.parent){if(n.indexOf(i.name)>-1)return null;if(i.type.isTop)break}return e(t)}}class ta{constructor(e,t,i,s){this.completion=e;this.source=t;this.match=i;this.score=s}}function gt(n){return n.selection.main.from}function vc(n,e){var t;let{source:i}=n;let s=e&&i[0]!="^",r=i[i.length-1]!="$";if(!s&&!r)return n;return new RegExp(`${s?"^":""}(?:${i})${r?"$":""}`,(t=n.flags)!==null&&t!==void 0?t:n.ignoreCase?"i":"")}const Oo=at.define();function wm(n,e,t,i){let{main:s}=n.selection,r=t-s.from,o=i-s.from;return Object.assign(Object.assign({},n.changeByRange(l=>{if(l!=s&&t!=i&&n.sliceDoc(l.from+r,l.from+o)!=n.sliceDoc(t,i))return{range:l};return{changes:{from:l.from+r,to:i==s.from?l.to:l.from+o,insert:e},range:y.cursor(l.from+r+e.length)}})),{scrollIntoView:true,userEvent:"input.complete"})}const ia=new WeakMap;function Qm(n){if(!Array.isArray(n))return n;let e=ia.get(n);if(!e)ia.set(n,e=$c(n));return e}const Hn=A.define();const _i=A.define();class km{constructor(e){this.pattern=e;this.chars=[];this.folded=[];this.any=[];this.precise=[];this.byWord=[];this.score=0;this.matched=[];for(let t=0;t=48&&x<=57||x>=97&&x<=122?2:x>=65&&x<=90?1:0:($=Hr(x))!=$.toLowerCase()?1:$!=$.toUpperCase()?2:0;if(!S||P==1&&m||w==0&&P!=0){if(t[f]==x||i[f]==x&&(u=true))o[f++]=S;else if(o.length)b=false}w=P;S+=Xe(x)}if(f==a&&o[0]==0&&b)return this.result(-100+(u?-200:0),o,e);if(d==a&&O==0)return this.ret(-200-e.length+(p==e.length?0:-100),[0,p]);if(l>-1)return this.ret(-700-e.length,[l,l+this.pattern.length]);if(d==a)return this.ret(-200+-700-e.length,[O,p]);if(f==a)return this.result(-100+(u?-200:0)+-700+(b?0:-1100),o,e);return t.length==2?null:this.result((s[0]?-700:0)+-200+-1100,s,e)}result(e,t,i){let s=[],r=0;for(let o of t){let l=o+(this.astral?Xe(ae(i,o)):1);if(r&&s[r-1]==o)s[r-1]=l;else{s[r++]=o;s[r++]=l}}return this.ret(e-i.length,s)}}class Pm{constructor(e){this.pattern=e;this.matched=[];this.score=0;this.folded=e.toLowerCase()}match(e){if(e.lengthfalse,activateOnTypingDelay:100,selectOnOpen:true,override:null,closeOnBlur:true,maxRenderedOptions:100,defaultKeymap:true,tooltipClass:()=>"",optionClass:()=>"",aboveCursor:false,icons:true,addToOptions:[],positionInfo:$m,filterStrict:false,compareCompletions:(e,t)=>e.label.localeCompare(t.label),interactionDelay:75,updateSyncTime:100},{defaultKeymap:(e,t)=>e&&t,closeOnBlur:(e,t)=>e&&t,icons:(e,t)=>e&&t,tooltipClass:(e,t)=>i=>na(e(i),t(i)),optionClass:(e,t)=>i=>na(e(i),t(i)),addToOptions:(e,t)=>e.concat(t),filterStrict:(e,t)=>e||t})}});function na(n,e){return n?e?n+" "+e:n:e}function $m(n,e,t,i,s,r){let o=n.textDirection==N.RTL,l=o,a=false;let h="top",c,f;let u=e.left-s.left,d=s.right-e.right;let O=i.right-i.left,p=i.bottom-i.top;if(l&&u=p||S>e.top){c=t.bottom-e.top}else{h="bottom";c=e.bottom-t.top}}let m=(e.bottom-e.top)/r.offsetHeight;let b=(e.right-e.left)/r.offsetWidth;return{style:`${h}: ${c/m}px; max-width: ${f/b}px`,class:"cm-completionInfo-"+(a?o?"left-narrow":"right-narrow":l?"left":"right")}}function vm(n){let e=n.addToOptions.slice();if(n.icons)e.push({render(t){let i=document.createElement("div");i.classList.add("cm-completionIcon");if(t.type)i.classList.add(...t.type.split(/\s+/g).map(s=>"cm-completionIcon-"+s));i.setAttribute("aria-hidden","true");return i},position:20});e.push({render(t,i,s,r){let o=document.createElement("span");o.className="cm-completionLabel";let l=t.displayLabel||t.label,a=0;for(let h=0;ha)o.appendChild(document.createTextNode(l.slice(a,c)));let u=o.appendChild(document.createElement("span"));u.appendChild(document.createTextNode(l.slice(c,f)));u.className="cm-completionMatchedText";a=f}if(at.position-i.position).map(t=>t.render)}function Ls(n,e,t){if(n<=t)return{from:0,to:n};if(e<0)e=0;if(e<=n>>1){let s=Math.floor(e/t);return{from:s*t,to:(s+1)*t}}let i=Math.floor((n-e)/t);return{from:n-(i+1)*t,to:n-i*t}}class Zm{constructor(e,t,i){this.view=e;this.stateField=t;this.applyCompletion=i;this.info=null;this.infoDestroy=null;this.placeInfoReq={read:()=>this.measureInfo(),write:a=>this.placeInfo(a),key:this};this.space=null;this.currentClass="";let s=e.state.field(t);let{options:r,selected:o}=s.open;let l=e.state.facet(fe);this.optionContent=vm(l);this.optionClass=l.optionClass;this.tooltipClass=l.tooltipClass;this.range=Ls(r.length,o,l.maxRenderedOptions);this.dom=document.createElement("div");this.dom.className="cm-tooltip-autocomplete";this.updateTooltipClass(e.state);this.dom.addEventListener("mousedown",a=>{let{options:h}=e.state.field(t).open;for(let c=a.target,f;c&&c!=this.dom;c=c.parentNode){if(c.nodeName=="LI"&&(f=/-(\d+)$/.exec(c.id))&&+f[1]{let h=e.state.field(this.stateField,false);if(h&&h.tooltip&&e.state.facet(fe).closeOnBlur&&a.relatedTarget!=e.contentDOM)e.dispatch({effects:_i.of(null)})});this.showOptions(r,s.id)}mount(){this.updateSel()}showOptions(e,t){if(this.list)this.list.remove();this.list=this.dom.appendChild(this.createListBox(e,t,this.range));this.list.addEventListener("scroll",()=>{if(this.info)this.view.requestMeasure(this.placeInfoReq)})}update(e){var t;let i=e.state.field(this.stateField);let s=e.startState.field(this.stateField);this.updateTooltipClass(e.state);if(i!=s){let{options:r,selected:o,disabled:l}=i.open;if(!s.open||s.open.options!=r){this.range=Ls(r.length,o,e.state.facet(fe).maxRenderedOptions);this.showOptions(r,i.id)}this.updateSel();if(l!=((t=s.open)===null||t===void 0?void 0:t.disabled))this.dom.classList.toggle("cm-tooltip-autocomplete-disabled",!!l)}}updateTooltipClass(e){let t=this.tooltipClass(e);if(t!=this.currentClass){for(let i of this.currentClass.split(" "))if(i)this.dom.classList.remove(i);for(let i of t.split(" "))if(i)this.dom.classList.add(i);this.currentClass=t}}positioned(e){this.space=e;if(this.info)this.view.requestMeasure(this.placeInfoReq)}updateSel(){let e=this.view.state.field(this.stateField),t=e.open;if(t.selected>-1&&t.selected=this.range.to){this.range=Ls(t.options.length,t.selected,this.view.state.facet(fe).maxRenderedOptions);this.showOptions(t.options,e.id)}if(this.updateSelectedOption(t.selected)){this.destroyInfo();let{completion:i}=t.options[t.selected];let{info:s}=i;if(!s)return;let r=typeof s==="string"?document.createTextNode(s):s(i);if(!r)return;if("then"in r){r.then(o=>{if(o&&this.view.state.field(this.stateField,false)==e)this.addInfoPane(o,i)}).catch(o=>Qe(this.view.state,o,"completion info"))}else{this.addInfoPane(r,i)}}}addInfoPane(e,t){this.destroyInfo();let i=this.info=document.createElement("div");i.className="cm-tooltip cm-completionInfo";if(e.nodeType!=null){i.appendChild(e);this.infoDestroy=null}else{let{dom:s,destroy:r}=e;i.appendChild(s);this.infoDestroy=r||null}this.dom.appendChild(i);this.view.requestMeasure(this.placeInfoReq)}updateSelectedOption(e){let t=null;for(let i=this.list.firstChild,s=this.range.from;i;i=i.nextSibling,s++){if(i.nodeName!="LI"||!i.id){s--}else if(s==e){if(!i.hasAttribute("aria-selected")){i.setAttribute("aria-selected","true");t=i}}else{if(i.hasAttribute("aria-selected"))i.removeAttribute("aria-selected")}}if(t)Tm(this.list,t);return t}measureInfo(){let e=this.dom.querySelector("[aria-selected]");if(!e||!this.info)return null;let t=this.dom.getBoundingClientRect();let i=this.info.getBoundingClientRect();let s=e.getBoundingClientRect();let r=this.space;if(!r){let o=this.dom.ownerDocument.defaultView||window;r={left:0,top:0,right:o.innerWidth,bottom:o.innerHeight}}if(s.top>Math.min(r.bottom,t.bottom)-10||s.bottomi.from||i.from==0)){r=u;if(typeof h!="string"&&h.header){s.appendChild(h.header(h))}else{let d=s.appendChild(document.createElement("completion-section"));d.textContent=u}}}const c=s.appendChild(document.createElement("li"));c.id=t+"-"+o;c.setAttribute("role","option");let f=this.optionClass(l);if(f)c.className=f;for(let u of this.optionContent){let d=u(l,this.view.state,this.view,a);if(d)c.appendChild(d)}}if(i.from)s.classList.add("cm-completionListIncompleteTop");if(i.tonew Zm(t,n,e)}function Tm(n,e){let t=n.getBoundingClientRect();let i=e.getBoundingClientRect();let s=t.height/n.offsetHeight;if(i.topt.bottom)n.scrollTop+=(i.bottom-t.bottom)/s}function sa(n){return(n.boost||0)*100+(n.apply?10:0)+(n.info?5:0)+(n.type?1:0)}function Am(n,e){let t=[];let i=null;let s=h=>{t.push(h);let{section:c}=h.completion;if(c){if(!i)i=[];let f=typeof c=="string"?c:c.name;if(!i.some(u=>u.name==f))i.push(typeof c=="string"?{name:f}:c)}};let r=e.facet(fe);for(let h of n)if(h.hasResult()){let c=h.result.getMatch;if(h.result.filter===false){for(let f of h.result.options){s(new ta(f,h.source,c?c(f):[],1e9-t.length))}}else{let f=e.sliceDoc(h.from,h.to),u;let d=r.filterStrict?new Pm(f):new km(f);for(let O of h.result.options)if(u=d.match(O.label)){let p=!O.displayLabel?u.matched:c?c(O,u.matched):[];s(new ta(O,h.source,p,u.score+(O.boost||0)))}}}if(i){let h=Object.create(null),c=0;let f=(u,d)=>{var O,p;return((O=u.rank)!==null&&O!==void 0?O:1e9)-((p=d.rank)!==null&&p!==void 0?p:1e9)||(u.namef.score-c.score||a(c.completion,f.completion))){let c=h.completion;if(!l||l.label!=c.label||l.detail!=c.detail||l.type!=null&&c.type!=null&&l.type!=c.type||l.apply!=c.apply||l.boost!=c.boost)o.push(h);else if(sa(h.completion)>sa(l))o[o.length-1]=h;l=h.completion}return o}class Ut{constructor(e,t,i,s,r,o){this.options=e;this.attrs=t;this.tooltip=i;this.timestamp=s;this.selected=r;this.disabled=o}setSelected(e,t){return e==this.selected||e>=this.options.length?this:new Ut(this.options,ra(t,e),this.tooltip,this.timestamp,e,this.disabled)}static build(e,t,i,s,r){let o=Am(e,t);if(!o.length){return s&&e.some(a=>a.state==1)?new Ut(s.options,s.attrs,s.tooltip,s.timestamp,s.selected,true):null}let l=t.facet(fe).selectOnOpen?0:-1;if(s&&s.selected!=l&&s.selected!=-1){let a=s.options[s.selected].completion;for(let h=0;hh.hasResult()?Math.min(a,h.from):a,1e8),create:Dm,above:r.aboveCursor},s?s.timestamp:Date.now(),l,false)}map(e){return new Ut(this.options,this.attrs,Object.assign(Object.assign({},this.tooltip),{pos:e.mapPos(this.tooltip.pos)}),this.timestamp,this.selected,this.disabled)}}class Kn{constructor(e,t,i){this.active=e;this.id=t;this.open=i}static start(){return new Kn(Wm,"cm-ac-"+Math.floor(Math.random()*2e6).toString(36),null)}update(e){let{state:t}=e,i=t.facet(fe);let s=i.override||t.languageDataAt("autocomplete",gt(t)).map(Qm);let r=s.map(l=>{let a=this.active.find(h=>h.source==l)||new me(l,this.active.some(h=>h.state!=0)?1:0);return a.update(e,i)});if(r.length==this.active.length&&r.every((l,a)=>l==this.active[a]))r=this.active;let o=this.open;if(o&&e.docChanged)o=o.map(e.changes);if(e.selection||r.some(l=>l.hasResult()&&e.changes.touchesRange(l.from,l.to))||!Cm(r,this.active))o=Ut.build(r,t,this.id,o,i);else if(o&&o.disabled&&!r.some(l=>l.state==1))o=null;if(!o&&r.every(l=>l.state!=1)&&r.some(l=>l.hasResult()))r=r.map(l=>l.hasResult()?new me(l.source,0):l);for(let l of e.effects)if(l.is(Rc))o=o&&o.setSelected(l.value,this.id);return r==this.active&&o==this.open?this:new Kn(r,this.id,o)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:Mm}}function Cm(n,e){if(n==e)return true;for(let t=0,i=0;;){while(t-1)t["aria-activedescendant"]=n+"-"+e;return t}const Wm=[];function _r(n,e){if(n.isUserEvent("input.complete")){let t=n.annotation(Oo);if(t&&e.activateOnCompletion(t))return"input"}return n.isUserEvent("input.type")?"input":n.isUserEvent("delete.backward")?"delete":null}class me{constructor(e,t,i=-1){this.source=e;this.state=t;this.explicitPos=i}hasResult(){return false}update(e,t){let i=_r(e,t),s=this;if(i)s=s.handleUserEvent(e,i,t);else if(e.docChanged)s=s.handleChange(e);else if(e.selection&&s.state!=0)s=new me(s.source,0);for(let r of e.effects){if(r.is(Hn))s=new me(s.source,1,r.value?gt(e.state):-1);else if(r.is(_i))s=new me(s.source,0);else if(r.is(Zc)){for(let o of r.value)if(o.source==s.source)s=o}}return s}handleUserEvent(e,t,i){return t=="delete"||!i.activateOnTyping?this.map(e.changes):new me(this.source,1)}handleChange(e){return e.changes.touchesRange(gt(e.startState))?new me(this.source,0):this.map(e.changes)}map(e){return e.empty||this.explicitPos<0?this:new me(this.source,this.state,e.mapPos(this.explicitPos))}}class Kt extends me{constructor(e,t,i,s,r){super(e,2,t);this.result=i;this.from=s;this.to=r}hasResult(){return true}handleUserEvent(e,t,i){var s;let r=this.result;if(r.map&&!e.changes.empty)r=r.map(r,e.changes);let o=e.changes.mapPos(this.from),l=e.changes.mapPos(this.to,1);let a=gt(e.state);if((this.explicitPos<0?a<=o:al||!r||t=="delete"&>(e.startState)==this.from)return new me(this.source,t=="input"&&i.activateOnTyping?1:0);let h=this.explicitPos<0?-1:e.changes.mapPos(this.explicitPos);if(Xm(r.validFor,e.state,o,l))return new Kt(this.source,h,r,o,l);if(r.update&&(r=r.update(r,o,l,new Pc(e.state,a,h>=0))))return new Kt(this.source,h,r,r.from,(s=r.to)!==null&&s!==void 0?s:gt(e.state));return new me(this.source,1,h)}handleChange(e){return e.changes.touchesRange(this.from,this.to)?new me(this.source,0):this.map(e.changes)}map(e){if(e.empty)return this;let t=this.result.map?this.result.map(this.result,e):this.result;if(!t)return new me(this.source,0);return new Kt(this.source,this.explicitPos<0?-1:e.mapPos(this.explicitPos),this.result,e.mapPos(this.from),e.mapPos(this.to,1))}}function Xm(n,e,t,i){if(!n)return false;let s=e.sliceDoc(t,i);return typeof n=="function"?n(s,t,i,e):vc(n,true).test(s)}const Zc=A.define({map(n,e){return n.map(t=>t.map(e))}});const Rc=A.define();const we=oe.define({create(){return Kn.start()},update(n,e){return n.update(e)},provide:n=>[ho.from(n,e=>e.tooltip),v.contentAttributes.from(n,e=>e.attrs)]});function po(n,e){const t=e.completion.apply||e.completion.label;let i=n.state.field(we).active.find(s=>s.source==e.source);if(!(i instanceof Kt))return false;if(typeof t=="string")n.dispatch(Object.assign(Object.assign({},wm(n.state,t,i.from,i.to)),{annotations:Oo.of(e.completion)}));else t(n,e.completion,i.from,i.to);return true}const Dm=Rm(we,po);function bn(n,e="option"){return t=>{let i=t.state.field(we,false);if(!i||!i.open||i.open.disabled||Date.now()-i.open.timestamp-1?i.open.selected+s*(n?1:-1):n?0:o-1;if(l<0)l=e=="page"?0:o-1;else if(l>=o)l=e=="page"?o-1:0;t.dispatch({effects:Rc.of(l)});return true}}const Ym=n=>{let e=n.state.field(we,false);if(n.state.readOnly||!e||!e.open||e.open.selected<0||e.open.disabled||Date.now()-e.open.timestamp{let e=n.state.field(we,false);if(!e)return false;n.dispatch({effects:Hn.of(true)});return true};const qm=n=>{let e=n.state.field(we,false);if(!e||!e.active.some(t=>t.state!=0))return false;n.dispatch({effects:_i.of(null)});return true};class _m{constructor(e,t){this.active=e;this.context=t;this.time=Date.now();this.updates=[];this.done=void 0}}const zm=50;const jm=1e3;const Vm=ee.fromClass(class{constructor(n){this.view=n;this.debounceUpdate=-1;this.running=[];this.debounceAccept=-1;this.pendingStart=false;this.composing=0;for(let e of n.state.field(we).active)if(e.state==1)this.startQuery(e)}update(n){let e=n.state.field(we);let t=n.state.facet(fe);if(!n.selectionSet&&!n.docChanged&&n.startState.field(we)==e)return;let i=n.transactions.some(r=>{return(r.selection||r.docChanged)&&!_r(r,t)});for(let r=0;rzm&&Date.now()-o.time>jm){for(let l of o.context.abortListeners){try{l()}catch(a){Qe(this.view.state,a)}}o.context.abortListeners=null;this.running.splice(r--,1)}else{o.updates.push(...n.transactions)}}if(this.debounceUpdate>-1)clearTimeout(this.debounceUpdate);if(n.transactions.some(r=>r.effects.some(o=>o.is(Hn))))this.pendingStart=true;let s=this.pendingStart?50:t.activateOnTypingDelay;this.debounceUpdate=e.active.some(r=>r.state==1&&!this.running.some(o=>o.active.source==r.source))?setTimeout(()=>this.startUpdate(),s):-1;if(this.composing!=0)for(let r of n.transactions){if(_r(r,t)=="input")this.composing=2;else if(this.composing==2&&r.selection)this.composing=3}}startUpdate(){this.debounceUpdate=-1;this.pendingStart=false;let{state:n}=this.view,e=n.field(we);for(let t of e.active){if(t.state==1&&!this.running.some(i=>i.active.source==t.source))this.startQuery(t)}}startQuery(n){let{state:e}=this.view,t=gt(e);let i=new Pc(e,t,n.explicitPos==t);let s=new _m(n,i);this.running.push(s);Promise.resolve(n.source(i)).then(r=>{if(!s.context.aborted){s.done=r||null;this.scheduleAccept()}},r=>{this.view.dispatch({effects:_i.of(null)});Qe(this.view.state,r)})}scheduleAccept(){if(this.running.every(n=>n.done!==void 0))this.accept();else if(this.debounceAccept<0)this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(fe).updateSyncTime)}accept(){var n;if(this.debounceAccept>-1)clearTimeout(this.debounceAccept);this.debounceAccept=-1;let e=[];let t=this.view.state.facet(fe);for(let i=0;io.source==s.active.source);if(r&&r.state==1){if(s.done==null){let o=new me(s.active.source,0);for(let l of s.updates)o=o.update(l,t);if(o.state!=1)e.push(o)}else{this.startQuery(r)}}}if(e.length)this.view.dispatch({effects:Zc.of(e)})}},{eventHandlers:{blur(n){let e=this.view.state.field(we,false);if(e&&e.tooltip&&this.view.state.facet(fe).closeOnBlur){let t=e.open&&sc(this.view,e.open.tooltip);if(!t||!t.dom.contains(n.relatedTarget))setTimeout(()=>this.view.dispatch({effects:_i.of(null)}),10)}},compositionstart(){this.composing=1},compositionend(){if(this.composing==3){setTimeout(()=>this.view.dispatch({effects:Hn.of(false)}),20)}this.composing=0}}});const Lm=typeof navigator=="object"&&/Win/.test(navigator.platform);const Bm=Pt.highest(v.domEventHandlers({keydown(n,e){let t=e.state.field(we,false);if(!t||!t.open||t.open.disabled||t.open.selected<0||n.key.length>1||n.ctrlKey&&!(Lm&&n.altKey)||n.metaKey)return false;let i=t.open.options[t.open.selected];let s=t.active.find(o=>o.source==i.source);let r=i.completion.commitCharacters||s.result.commitCharacters;if(r&&r.indexOf(n.key)>-1)po(e,i);return false}}));const Tc=v.baseTheme({".cm-tooltip.cm-tooltip-autocomplete":{"& > ul":{fontFamily:"monospace",whiteSpace:"nowrap",overflow:"hidden auto",maxWidth_fallback:"700px",maxWidth:"min(700px, 95vw)",minWidth:"250px",maxHeight:"10em",height:"100%",listStyle:"none",margin:0,padding:0,"& > li, & > completion-section":{padding:"1px 3px",lineHeight:1.2},"& > li":{overflowX:"hidden",textOverflow:"ellipsis",cursor:"pointer"},"& > completion-section":{display:"list-item",borderBottom:"1px solid silver",paddingLeft:"0.5em",opacity:.7}}},"&light .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#17c",color:"white"},"&light .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#777"},"&dark .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#347",color:"white"},"&dark .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#444"},".cm-completionListIncompleteTop:before, .cm-completionListIncompleteBottom:after":{content:'"···"',opacity:.5,display:"block",textAlign:"center"},".cm-tooltip.cm-completionInfo":{position:"absolute",padding:"3px 9px",width:"max-content",maxWidth:`${400}px`,boxSizing:"border-box"},".cm-completionInfo.cm-completionInfo-left":{right:"100%"},".cm-completionInfo.cm-completionInfo-right":{left:"100%"},".cm-completionInfo.cm-completionInfo-left-narrow":{right:`${30}px`},".cm-completionInfo.cm-completionInfo-right-narrow":{left:`${30}px`},"&light .cm-snippetField":{backgroundColor:"#00000022"},"&dark .cm-snippetField":{backgroundColor:"#ffffff22"},".cm-snippetFieldPosition":{verticalAlign:"text-top",width:0,height:"1.15em",display:"inline-block",margin:"0 -0.7px -.7em",borderLeft:"1.4px dotted #888"},".cm-completionMatchedText":{textDecoration:"underline"},".cm-completionDetail":{marginLeft:"0.5em",fontStyle:"italic"},".cm-completionIcon":{fontSize:"90%",width:".8em",display:"inline-block",textAlign:"center",paddingRight:".6em",opacity:"0.6",boxSizing:"content-box"},".cm-completionIcon-function, .cm-completionIcon-method":{"&:after":{content:"'ƒ'"}},".cm-completionIcon-class":{"&:after":{content:"'○'"}},".cm-completionIcon-interface":{"&:after":{content:"'◌'"}},".cm-completionIcon-variable":{"&:after":{content:"'𝑥'"}},".cm-completionIcon-constant":{"&:after":{content:"'𝐶'"}},".cm-completionIcon-type":{"&:after":{content:"'𝑡'"}},".cm-completionIcon-enum":{"&:after":{content:"'∪'"}},".cm-completionIcon-property":{"&:after":{content:"'□'"}},".cm-completionIcon-keyword":{"&:after":{content:"'🔑︎'"}},".cm-completionIcon-namespace":{"&:after":{content:"'▢'"}},".cm-completionIcon-text":{"&:after":{content:"'abc'",fontSize:"50%",verticalAlign:"middle"}}});class Um{constructor(e,t,i,s){this.field=e;this.line=t;this.from=i;this.to=s}}class mo{constructor(e,t,i){this.field=e;this.from=t;this.to=i}map(e){let t=e.mapPos(this.from,-1,ce.TrackDel);let i=e.mapPos(this.to,1,ce.TrackDel);return t==null||i==null?null:new mo(this.field,t,i)}}class go{constructor(e,t){this.lines=e;this.fieldPositions=t}instantiate(e,t){let i=[],s=[t];let r=e.doc.lineAt(t),o=/^\s*/.exec(r.text)[0];for(let a of this.lines){if(i.length){let h=o,c=/^\t*/.exec(a)[0].length;for(let f=0;fnew mo(a.field,s[a.line]+a.from,s[a.line]+a.to));return{text:i,ranges:l}}static parse(e){let t=[];let i=[],s=[],r;for(let o of e.split(/\r\n?|\n/)){while(r=/[#$]\{(?:(\d+)(?::([^}]*))?|([^}]*))\}/.exec(o)){let l=r[1]?+r[1]:null,a=r[2]||r[3]||"",h=-1;for(let c=0;c=h)f.field++}s.push(new Um(h,i.length,r.index,r.index+a.length));o=o.slice(0,r.index)+a+o.slice(r.index+r[0].length)}for(let l;l=/\\([{}])/.exec(o);){o=o.slice(0,l.index)+l[1]+o.slice(l.index+l[0].length);for(let a of s)if(a.line==i.length&&a.from>l.index){a.from--;a.to--}}i.push(o)}return new go(i,s)}}let Im=T.widget({widget:new class extends ht{toDOM(){let n=document.createElement("span");n.className="cm-snippetFieldPosition";return n}ignoreEvent(){return false}}});let Nm=T.mark({class:"cm-snippetField"});class li{constructor(e,t){this.ranges=e;this.active=t;this.deco=T.set(e.map(i=>(i.from==i.to?Im:Nm).range(i.from,i.to)))}map(e){let t=[];for(let i of this.ranges){let s=i.map(e);if(!s)return null;t.push(s)}return new li(t,this.active)}selectionInsideField(e){return e.ranges.every(t=>this.ranges.some(i=>i.field==this.active&&i.from<=t.from&&i.to>=t.to))}}const Fi=A.define({map(n,e){return n&&n.map(e)}});const Gm=A.define();const zi=oe.define({create(){return null},update(n,e){for(let t of e.effects){if(t.is(Fi))return t.value;if(t.is(Gm)&&n)return new li(n.ranges,t.value)}if(n&&e.docChanged)n=n.map(e.changes);if(n&&e.selection&&!n.selectionInsideField(e.selection))n=null;return n},provide:n=>v.decorations.from(n,e=>e?e.deco:T.none)});function bo(n,e){return y.create(n.filter(t=>t.field==e).map(t=>y.range(t.from,t.to)))}function Fm(n){let e=go.parse(n);return(t,i,s,r)=>{let{text:o,ranges:l}=e.instantiate(t.state,s);let a={changes:{from:s,to:r,insert:_.of(o)},scrollIntoView:true,annotations:i?[Oo.of(i),J.userEvent.of("input.complete")]:void 0};if(l.length)a.selection=bo(l,0);if(l.some(h=>h.field>0)){let h=new li(l,0);let c=a.effects=[Fi.of(h)];if(t.state.field(zi,false)===void 0)c.push(A.appendConfig.of([zi,tg,ig,Tc]))}t.dispatch(t.state.update(a))}}function Ac(n){return({state:e,dispatch:t})=>{let i=e.field(zi,false);if(!i||n<0&&i.active==0)return false;let s=i.active+n,r=n>0&&!i.ranges.some(o=>o.field==s+n);t(e.update({selection:bo(i.ranges,s),effects:Fi.of(r?null:new li(i.ranges,s)),scrollIntoView:true}));return true}}const Hm=({state:n,dispatch:e})=>{let t=n.field(zi,false);if(!t)return false;e(n.update({effects:Fi.of(null)}));return true};const Km=Ac(1);const Jm=Ac(-1);const eg=[{key:"Tab",run:Km,shift:Jm},{key:"Escape",run:Hm}];const oa=Z.define({combine(n){return n.length?n[0]:eg}});const tg=Pt.highest(cs.compute([oa],n=>n.facet(oa)));function Se(n,e){return Object.assign(Object.assign({},e),{apply:Fm(n)})}const ig=v.domEventHandlers({mousedown(n,e){let t=e.state.field(zi,false),i;if(!t||(i=e.posAtCoords({x:n.clientX,y:n.clientY}))==null)return false;let s=t.ranges.find(r=>r.from<=i&&r.to>=i);if(!s||s.field==t.active)return false;e.dispatch({selection:bo(t.ranges,s.field),effects:Fi.of(t.ranges.some(r=>r.field>s.field)?new li(t.ranges,s.field):null),scrollIntoView:true});return true}});const ji={brackets:["(","[","{","'",'"'],before:")]}:;>",stringPrefixes:[]};const Ct=A.define({map(n,e){let t=e.mapPos(n,-1,ce.TrackAfter);return t==null?void 0:t}});const yo=new class extends Xt{};yo.startSide=1;yo.endSide=-1;const Cc=oe.define({create(){return E.empty},update(n,e){n=n.map(e.changes);if(e.selection){let t=e.state.doc.lineAt(e.selection.main.head);n=n.update({filter:i=>i>=t.from&&i<=t.to})}for(let t of e.effects)if(t.is(Ct))n=n.update({add:[yo.range(t.value,t.value+1)]});return n}});function ng(){return[rg,Cc]}const Bs="()[]{}<>";function Mc(n){for(let e=0;e{if((sg?n.composing:n.compositionStarted)||n.state.readOnly)return false;let s=n.state.selection.main;if(i.length>2||i.length==2&&Xe(ae(i,0))==1||e!=s.from||t!=s.to)return false;let r=ag(n.state,i);if(!r)return false;n.dispatch(r);return true});const og=({state:n,dispatch:e})=>{if(n.readOnly)return false;let t=Wc(n,n.selection.main.head);let i=t.brackets||ji.brackets;let s=null,r=n.changeByRange(o=>{if(o.empty){let l=hg(n.doc,o.head);for(let a of i){if(a==l&&ms(n.doc,o.head)==Mc(ae(a,0)))return{changes:{from:o.head-a.length,to:o.head+a.length},range:y.cursor(o.head-a.length)}}}return{range:s=o}});if(!s)e(n.update(r,{scrollIntoView:true,userEvent:"delete.backward"}));return!s};const lg=[{key:"Backspace",run:og}];function ag(n,e){let t=Wc(n,n.selection.main.head);let i=t.brackets||ji.brackets;for(let s of i){let r=Mc(ae(s,0));if(e==s)return r==s?ug(n,s,i.indexOf(s+s+s)>-1,t):cg(n,s,r,t.before||ji.before);if(e==r&&Xc(n,n.selection.main.from))return fg(n,s,r)}return null}function Xc(n,e){let t=false;n.field(Cc).between(0,n.doc.length,i=>{if(i==e)t=true});return t}function ms(n,e){let t=n.sliceString(e,e+2);return t.slice(0,Xe(ae(t,0)))}function hg(n,e){let t=n.sliceString(e-2,e);return Xe(ae(t,0))==t.length?t:t.slice(1)}function cg(n,e,t,i){let s=null,r=n.changeByRange(o=>{if(!o.empty)return{changes:[{insert:e,from:o.from},{insert:t,from:o.to}],effects:Ct.of(o.to+e.length),range:y.range(o.anchor+e.length,o.head+e.length)};let l=ms(n.doc,o.head);if(!l||/\s/.test(l)||i.indexOf(l)>-1)return{changes:{insert:e+t,from:o.head},effects:Ct.of(o.head+e.length),range:y.cursor(o.head+e.length)};return{range:s=o}});return s?null:n.update(r,{scrollIntoView:true,userEvent:"input.type"})}function fg(n,e,t){let i=null,s=n.changeByRange(r=>{if(r.empty&&ms(n.doc,r.head)==t)return{changes:{from:r.head,to:r.head+t.length,insert:t},range:y.cursor(r.head+t.length)};return i={range:r}});return i?null:n.update(s,{scrollIntoView:true,userEvent:"input.type"})}function ug(n,e,t,i){let s=i.stringPrefixes||ji.stringPrefixes;let r=null,o=n.changeByRange(l=>{if(!l.empty)return{changes:[{insert:e,from:l.from},{insert:e,from:l.to}],effects:Ct.of(l.to+e.length),range:y.range(l.anchor+e.length,l.head+e.length)};let a=l.head,h=ms(n.doc,a),c;if(h==e){if(la(n,a)){return{changes:{insert:e+e,from:a},effects:Ct.of(a+e.length),range:y.cursor(a+e.length)}}else if(Xc(n,a)){let f=t&&n.sliceDoc(a,a+e.length*3)==e+e+e;let u=f?e+e+e:e;return{changes:{from:a,to:a+u.length,insert:u},range:y.cursor(a+u.length)}}}else if(t&&n.sliceDoc(a-2*e.length,a)==e+e&&(c=aa(n,a-2*e.length,s))>-1&&la(n,c)){return{changes:{insert:e+e+e+e,from:a},effects:Ct.of(a+e.length),range:y.cursor(a+e.length)}}else if(n.charCategorizer(a)(h)!=G.Word){if(aa(n,a,s)>-1&&!dg(n,a,e,s))return{changes:{insert:e+e,from:a},effects:Ct.of(a+e.length),range:y.cursor(a+e.length)}}return{range:r=l}});return r?null:n.update(o,{scrollIntoView:true,userEvent:"input.type"})}function la(n,e){let t=re(n).resolveInner(e+1);return t.parent&&t.from==e}function dg(n,e,t,i){let s=re(n).resolveInner(e,-1);let r=i.reduce((o,l)=>Math.max(o,l.length),0);for(let o=0;o<5;o++){let l=n.sliceDoc(s.from,Math.min(s.to,s.from+t.length+r));let a=l.indexOf(t);if(!a||a>-1&&i.indexOf(l.slice(0,a))>-1){let c=s.firstChild;while(c&&c.from==s.from&&c.to-c.from>t.length+a){if(n.sliceDoc(c.to-t.length,c.to)==t)return false;c=c.firstChild}return true}let h=s.to==e&&s.parent;if(!h)break;s=h}return false}function aa(n,e,t){let i=n.charCategorizer(e);if(i(n.sliceDoc(e-1,e))!=G.Word)return e;for(let s of t){let r=e-s.length;if(n.sliceDoc(r,e)==s&&i(n.sliceDoc(r-1,r))!=G.Word)return r}return-1}function Og(n={}){return[Bm,we,fe.of(n),Vm,pg,Tc]}const Dc=[{key:"Ctrl-Space",run:Em},{key:"Escape",run:qm},{key:"ArrowDown",run:bn(true)},{key:"ArrowUp",run:bn(false)},{key:"PageDown",run:bn(true,"page")},{key:"PageUp",run:bn(false,"page")},{key:"Enter",run:Ym}];const pg=Pt.highest(cs.computeN([fe],n=>n.facet(fe).defaultKeymap?[Dc]:[]));const Yc=[Se("function ${name}(${params}) {\n ${}\n}",{label:"function",detail:"definition",type:"keyword"}),Se("for (let ${index} = 0; ${index} < ${bound}; ${index}++) {\n ${}\n}",{label:"for",detail:"loop",type:"keyword"}),Se("for (let ${name} of ${collection}) {\n ${}\n}",{label:"for",detail:"of loop",type:"keyword"}),Se("do {\n ${}\n} while (${})",{label:"do",detail:"loop",type:"keyword"}),Se("while (${}) {\n ${}\n}",{label:"while",detail:"loop",type:"keyword"}),Se("try {\n ${}\n} catch (${error}) {\n ${}\n}",{label:"try",detail:"/ catch block",type:"keyword"}),Se("if (${}) {\n ${}\n}",{label:"if",detail:"block",type:"keyword"}),Se("if (${}) {\n ${}\n} else {\n ${}\n}",{label:"if",detail:"/ else block",type:"keyword"}),Se("class ${name} {\n constructor(${params}) {\n ${}\n }\n}",{label:"class",detail:"definition",type:"keyword"}),Se('import {${names}} from "${module}"\n${}',{label:"import",detail:"named",type:"keyword"}),Se('import ${name} from "${module}"\n${}',{label:"import",detail:"default",type:"keyword"})];const mg=Yc.concat([Se("interface ${name} {\n ${}\n}",{label:"interface",detail:"definition",type:"keyword"}),Se("type ${name} = ${type}",{label:"type",detail:"definition",type:"keyword"}),Se("enum ${name} {\n ${}\n}",{label:"enum",detail:"definition",type:"keyword"})]);const ha=new Vf;const Ec=new Set(["Script","Block","FunctionExpression","FunctionDeclaration","ArrowFunction","MethodDeclaration","ForStatement"]);function pi(n){return(e,t)=>{let i=e.node.getChild("VariableDefinition");if(i)t(i,n);return true}}const gg=["FunctionDeclaration"];const bg={FunctionDeclaration:pi("function"),ClassDeclaration:pi("class"),ClassExpression:()=>true,EnumDeclaration:pi("constant"),TypeAliasDeclaration:pi("type"),NamespaceDeclaration:pi("namespace"),VariableDefinition(n,e){if(!n.matchContext(gg))e(n,"variable")},TypeDefinition(n,e){e(n,"type")},__proto__:null};function qc(n,e){let t=ha.get(e);if(t)return t;let i=[],s=true;function r(o,l){let a=n.sliceString(o.from,o.to);i.push({label:a,type:l})}e.cursor(se.IncludeAnonymous).iterate(o=>{if(s){s=false}else if(o.name){let l=bg[o.name];if(l&&l(o,r)||Ec.has(o.name))return false}else if(o.to-o.from>8192){for(let l of qc(n,o.node))i.push(l);return false}});ha.set(e,i);return i}const ca=/^[\w$\xa1-\uffff][\w$\d\xa1-\uffff]*$/;const _c=["TemplateString","String","RegExp","LineComment","BlockComment","VariableDefinition","TypeDefinition","Label","PropertyDefinition","PropertyName","PrivatePropertyDefinition","PrivatePropertyName",".","?."];function yg(n){let e=re(n.state).resolveInner(n.pos,-1);if(_c.indexOf(e.name)>-1)return null;let t=e.name=="VariableName"||e.to-e.from<20&&ca.test(n.state.sliceDoc(e.from,e.to));if(!t&&!n.explicit)return null;let i=[];for(let s=e;s;s=s.parent){if(Ec.has(s.name))i=i.concat(qc(n.state.doc,s))}return{options:i,from:t?e.from:n.pos,validFor:ca}}const Wt=Un.define({name:"javascript",parser:Xu.configure({props:[cc.add({IfStatement:_s({except:/^\s*({|else\b)/}),TryStatement:_s({except:/^\s*({|catch\b|finally\b)/}),LabeledStatement:qp,SwitchBody:n=>{let e=n.textAfter,t=/^\s*\}/.test(e),i=/^\s*(case|default)\b/.test(e);return n.baseIndent+(t?0:i?1:2)*n.unit},Block:Ep({closing:"}"}),ArrowFunction:n=>n.baseIndent+n.unit,"TemplateString BlockComment":()=>null,"Statement Property":_s({except:/^{/}),JSXElement(n){let e=/^\s*<\//.test(n.textAfter);return n.lineIndent(n.node.from)+(e?0:n.unit)},JSXEscape(n){let e=/\s*\}/.test(n.textAfter);return n.lineIndent(n.node.from)+(e?0:n.unit)},"JSXOpenTag JSXSelfClosingTag"(n){return n.column(n.node.from)+n.unit}}),dc.add({"Block ClassBody SwitchBody EnumBody ObjectExpression ArrayExpression ObjectType":Vp,BlockComment(n){return{from:n.from+2,to:n.to-2}}})]}),languageData:{closeBrackets:{brackets:["(","[","{","'",'"',"`"]},commentTokens:{line:"//",block:{open:"/*",close:"*/"}},indentOnInput:/^\s*(?:case |default:|\{|\}|<\/)$/,wordChars:"$"}});const zc={test:n=>/^JSX/.test(n.name),facet:ac({commentTokens:{block:{open:"{/*",close:"*/}"}}})};const xg=Wt.configure({dialect:"ts"},"typescript");const Sg=Wt.configure({dialect:"jsx",props:[co.add(n=>n.isTop?[zc]:void 0)]});const wg=Wt.configure({dialect:"jsx ts",props:[co.add(n=>n.isTop?[zc]:void 0)]},"typescript");let jc=n=>({label:n,type:"keyword"});const Vc="break case const continue default delete export extends false finally in instanceof let new return static super switch this throw true typeof var yield".split(" ").map(jc);const Qg=Vc.concat(["declare","implements","private","protected","public"].map(jc));function kg(n={}){let e=n.jsx?n.typescript?wg:Sg:n.typescript?xg:Wt;let t=n.typescript?mg.concat(Qg):Yc.concat(Vc);return new Tp(e,[Wt.data.of({autocomplete:Sm(_c,$c(t))}),Wt.data.of({autocomplete:yg}),n.jsx?vg:[]])}function Pg(n){for(;;){if(n.name=="JSXOpenTag"||n.name=="JSXSelfClosingTag"||n.name=="JSXFragmentTag")return n;if(n.name=="JSXEscape"||!n.parent)return null;n=n.parent}}function fa(n,e,t=n.length){for(let i=e===null||e===void 0?void 0:e.firstChild;i;i=i.nextSibling){if(i.name=="JSXIdentifier"||i.name=="JSXBuiltin"||i.name=="JSXNamespacedName"||i.name=="JSXMemberExpression")return n.sliceString(i.from,Math.min(i.to,t))}return""}const $g=typeof navigator=="object"&&/Android\b/.test(navigator.userAgent);const vg=v.inputHandler.of((n,e,t,i,s)=>{if(($g?n.composing:n.compositionStarted)||n.state.readOnly||e!=t||i!=">"&&i!="/"||!Wt.isActiveAt(n.state,e,-1))return false;let r=s(),{state:o}=r;let l=o.changeByRange(a=>{var h;let{head:c}=a,f=re(o).resolveInner(c-1,-1),u;if(f.name=="JSXStartTag")f=f.parent;if(o.doc.sliceString(c-1,c)!=i||f.name=="JSXAttributeValue"&&f.to>c);else if(i==">"&&f.name=="JSXFragmentTag"){return{range:a,changes:{from:c,insert:``}}}else if(i=="/"&&f.name=="JSXStartCloseTag"){let d=f.parent,O=d.parent;if(O&&d.from==c-2&&((u=fa(o.doc,O.firstChild,c))||((h=O.firstChild)===null||h===void 0?void 0:h.name)=="JSXFragmentTag")){let p=`${u}>`;return{range:y.cursor(c+p.length,-1),changes:{from:c,insert:p}}}}else if(i==">"){let d=Pg(f);if(d&&d.name=="JSXOpenTag"&&!/^\/?>|^<\//.test(o.doc.sliceString(c,c+2))&&(u=fa(o.doc,d,c)))return{range:a,changes:{from:c,insert:``}}}return{range:a}});if(l.changes.empty)return false;n.dispatch([r,o.update(l,{userEvent:"input.complete",scrollIntoView:true})]);return true});const Zg=n=>{let{state:e}=n,t=e.doc.lineAt(e.selection.main.from),i=So(n.state,t.from);return i.line?Rg(n):i.block?Ag(n):false};function xo(n,e){return({state:t,dispatch:i})=>{if(t.readOnly)return false;let s=n(e,t);if(!s)return false;i(t.update(s));return true}}const Rg=xo(Wg,0);const Tg=xo(Lc,0);const Ag=xo((n,e)=>Lc(n,e,Mg(e)),0);function So(n,e){let t=n.languageDataAt("commentTokens",e);return t.length?t[0]:{}}const mi=50;function Cg(n,{open:e,close:t},i,s){let r=n.sliceDoc(i-mi,i);let o=n.sliceDoc(s,s+mi);let l=/\s*$/.exec(r)[0].length,a=/^\s*/.exec(o)[0].length;let h=r.length-l;if(r.slice(h-e.length,h)==e&&o.slice(a,a+t.length)==t){return{open:{pos:i-l,margin:l&&1},close:{pos:s+a,margin:a&&1}}}let c,f;if(s-i<=2*mi){c=f=n.sliceDoc(i,s)}else{c=n.sliceDoc(i,i+mi);f=n.sliceDoc(s-mi,s)}let u=/^\s*/.exec(c)[0].length,d=/\s*$/.exec(f)[0].length;let O=f.length-d-t.length;if(c.slice(u,u+e.length)==e&&f.slice(O,O+t.length)==t){return{open:{pos:i+u+e.length,margin:/\s/.test(c.charAt(u+e.length))?1:0},close:{pos:s-d-t.length,margin:/\s/.test(f.charAt(O-1))?1:0}}}return null}function Mg(n){let e=[];for(let t of n.selection.ranges){let i=n.doc.lineAt(t.from);let s=t.to<=i.to?i:n.doc.lineAt(t.to);let r=e.length-1;if(r>=0&&e[r].to>i.from)e[r].to=s.to;else e.push({from:i.from+/^\s*/.exec(i.text)[0].length,to:s.to})}return e}function Lc(n,e,t=e.selection.ranges){let i=t.map(r=>So(e,r.from).block);if(!i.every(r=>r))return null;let s=t.map((r,o)=>Cg(e,i[o],r.from,r.to));if(n!=2&&!s.every(r=>r)){return{changes:e.changes(t.map((r,o)=>{if(s[o])return[];return[{from:r.from,insert:i[o].open+" "},{from:r.to,insert:" "+i[o].close}]}))}}else if(n!=1&&s.some(r=>r)){let r=[];for(let o=0,l;os&&(r==o||o>f.from)){s=f.from;let u=/^\s*/.exec(f.text)[0].length;let d=u==f.length;let O=f.text.slice(u,u+h.length)==h?u:-1;if(ur.comment<0&&(!r.empty||r.single))){let r=[];for(let{line:l,token:a,indent:h,empty:c,single:f}of i)if(f||!c)r.push({from:l.from+h,insert:a+" "});let o=e.changes(r);return{changes:o,selection:e.selection.map(o,1)}}else if(n!=1&&i.some(r=>r.comment>=0)){let r=[];for(let{line:o,comment:l,token:a}of i)if(l>=0){let h=o.from+l,c=h+a.length;if(o.text[c-o.from]==" ")c++;r.push({from:h,to:c})}return{changes:r}}return null}const zr=at.define();const Xg=at.define();const Dg=Z.define();const Bc=Z.define({combine(n){return it(n,{minDepth:100,newGroupDelay:500,joinToEvent:(e,t)=>t},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(e,t)=>(i,s)=>e(i,s)||t(i,s)})}});const Uc=oe.define({create(){return et.empty},update(n,e){let t=e.state.facet(Bc);let i=e.annotation(zr);if(i){let a=ke.fromTransaction(e,i.selection),h=i.side;let c=h==0?n.undone:n.done;if(a)c=Jn(c,c.length,t.minDepth,a);else c=Gc(c,e.startState.selection);return new et(h==0?i.rest:c,h==0?c:i.rest)}let s=e.annotation(Xg);if(s=="full"||s=="before")n=n.isolate();if(e.annotation(J.addToHistory)===false)return!e.changes.empty?n.addMapping(e.changes.desc):n;let r=ke.fromTransaction(e);let o=e.annotation(J.time),l=e.annotation(J.userEvent);if(r)n=n.addChanges(r,o,l,t,e);else if(e.selection)n=n.addSelection(e.startState.selection,o,l,t.newGroupDelay);if(s=="full"||s=="after")n=n.isolate();return n},toJSON(n){return{done:n.done.map(e=>e.toJSON()),undone:n.undone.map(e=>e.toJSON())}},fromJSON(n){return new et(n.done.map(ke.fromJSON),n.undone.map(ke.fromJSON))}});function Yg(n={}){return[Uc,Bc.of(n),v.domEventHandlers({beforeinput(e,t){let i=e.inputType=="historyUndo"?Ic:e.inputType=="historyRedo"?jr:null;if(!i)return false;e.preventDefault();return i(t)}})]}function gs(n,e){return function({state:t,dispatch:i}){if(!e&&t.readOnly)return false;let s=t.field(Uc,false);if(!s)return false;let r=s.pop(n,t,e);if(!r)return false;i(r);return true}}const Ic=gs(0,false);const jr=gs(1,false);const Eg=gs(0,true);const qg=gs(1,true);class ke{constructor(e,t,i,s,r){this.changes=e;this.effects=t;this.mapped=i;this.startSelection=s;this.selectionsAfter=r}setSelAfter(e){return new ke(this.changes,this.effects,this.mapped,this.startSelection,e)}toJSON(){var e,t,i;return{changes:(e=this.changes)===null||e===void 0?void 0:e.toJSON(),mapped:(t=this.mapped)===null||t===void 0?void 0:t.toJSON(),startSelection:(i=this.startSelection)===null||i===void 0?void 0:i.toJSON(),selectionsAfter:this.selectionsAfter.map(s=>s.toJSON())}}static fromJSON(e){return new ke(e.changes&&ne.fromJSON(e.changes),[],e.mapped&&tt.fromJSON(e.mapped),e.startSelection&&y.fromJSON(e.startSelection),e.selectionsAfter.map(y.fromJSON))}static fromTransaction(e,t){let i=De;for(let s of e.startState.facet(Dg)){let r=s(e);if(r.length)i=i.concat(r)}if(!i.length&&e.changes.empty)return null;return new ke(e.changes.invert(e.startState.doc),i,void 0,t||e.startState.selection,De)}static selection(e){return new ke(void 0,De,void 0,void 0,e)}}function Jn(n,e,t,i){let s=e+1>t+20?e-t-1:0;let r=n.slice(s,e);r.push(i);return r}function _g(n,e){let t=[],i=false;n.iterChangedRanges((s,r)=>t.push(s,r));e.iterChangedRanges((s,r,o,l)=>{for(let a=0;a=h&&o<=c)i=true}});return i}function zg(n,e){return n.ranges.length==e.ranges.length&&n.ranges.filter((t,i)=>t.empty!=e.ranges[i].empty).length===0}function Nc(n,e){return!n.length?e:!e.length?n:n.concat(e)}const De=[];const jg=200;function Gc(n,e){if(!n.length){return[ke.selection([e])]}else{let t=n[n.length-1];let i=t.selectionsAfter.slice(Math.max(0,t.selectionsAfter.length-jg));if(i.length&&i[i.length-1].eq(e))return n;i.push(e);return Jn(n,n.length-1,1e9,t.setSelAfter(i))}}function Vg(n){let e=n[n.length-1];let t=n.slice();t[n.length-1]=e.setSelAfter(e.selectionsAfter.slice(0,e.selectionsAfter.length-1));return t}function Us(n,e){if(!n.length)return n;let t=n.length,i=De;while(t){let s=Lg(n[t-1],e,i);if(s.changes&&!s.changes.empty||s.effects.length){let r=n.slice(0,t);r[t-1]=s;return r}else{e=s.mapped;t--;i=s.selectionsAfter}}return i.length?[ke.selection(i)]:De}function Lg(n,e,t){let i=Nc(n.selectionsAfter.length?n.selectionsAfter.map(l=>l.map(e)):De,t);if(!n.changes)return ke.selection(i);let s=n.changes.map(e),r=e.mapDesc(n.changes,true);let o=n.mapped?n.mapped.composeDesc(r):r;return new ke(s,A.mapEffects(n.effects,e),o,n.startSelection.map(r),i)}const Bg=/^(input\.type|delete)($|\.)/;class et{constructor(e,t,i=0,s=void 0){this.done=e;this.undone=t;this.prevTime=i;this.prevUserEvent=s}isolate(){return this.prevTime?new et(this.done,this.undone):this}addChanges(e,t,i,s,r){let o=this.done,l=o[o.length-1];if(l&&l.changes&&!l.changes.empty&&e.changes&&(!i||Bg.test(i))&&(!l.selectionsAfter.length&&t-this.prevTime0&&t-this.prevTimet.empty?n.moveByChar(t,e):bs(t,e))}function pe(n){return n.textDirectionAt(n.state.selection.main.head)==N.LTR}const Hc=n=>Fc(n,!pe(n));const Kc=n=>Fc(n,pe(n));function Jc(n,e){return Ve(n,t=>t.empty?n.moveByGroup(t,e):bs(t,e))}const Ig=n=>Jc(n,!pe(n));const Ng=n=>Jc(n,pe(n));function Gg(n,e,t){if(e.type.prop(t))return true;let i=e.to-e.from;return i&&(i>2||/[^\s,.;:]/.test(n.sliceDoc(e.from,e.to)))||e.firstChild}function ys(n,e,t){let i=re(n).resolveInner(e.head);let s=t?W.closedBy:W.openedBy;for(let a=e.head;;){let h=t?i.childAfter(a):i.childBefore(a);if(!h)break;if(Gg(n,h,s))i=h;else a=t?h.to:h.from}let r=i.type.prop(s),o,l;if(r&&(o=t?Je(n,i.from,1):Je(n,i.to,-1))&&o.matched)l=t?o.end.to:o.end.from;else l=t?i.to:i.from;return y.cursor(l,t?-1:1)}const Fg=n=>Ve(n,e=>ys(n.state,e,!pe(n)));const Hg=n=>Ve(n,e=>ys(n.state,e,pe(n)));function ef(n,e){return Ve(n,t=>{if(!t.empty)return bs(t,e);let i=n.moveVertically(t,e);return i.head!=t.head?i:n.moveToLineBoundary(t,e)})}const tf=n=>ef(n,false);const nf=n=>ef(n,true);function sf(n){let e=n.scrollDOM.clientHeight{return o.empty?n.moveVertically(o,e,t.height):bs(o,e)});if(s.eq(i.selection))return false;let r;if(t.selfScroll){let o=n.coordsAtPos(i.selection.main.head);let l=n.scrollDOM.getBoundingClientRect();let a=l.top+t.marginTop,h=l.bottom-t.marginBottom;if(o&&o.top>a&&o.bottomrf(n,false);const Vr=n=>rf(n,true);function $t(n,e,t){let i=n.lineBlockAt(e.head),s=n.moveToLineBoundary(e,t);if(s.head==e.head&&s.head!=(t?i.to:i.from))s=n.moveToLineBoundary(e,t,false);if(!t&&s.head==i.from&&i.length){let r=/^\s*/.exec(n.state.sliceDoc(i.from,Math.min(i.from+100,i.to)))[0].length;if(r&&e.head!=i.from+r)s=y.cursor(i.from+r)}return s}const Kg=n=>Ve(n,e=>$t(n,e,true));const Jg=n=>Ve(n,e=>$t(n,e,false));const e0=n=>Ve(n,e=>$t(n,e,!pe(n)));const t0=n=>Ve(n,e=>$t(n,e,pe(n)));const i0=n=>Ve(n,e=>y.cursor(n.lineBlockAt(e.head).from,1));const n0=n=>Ve(n,e=>y.cursor(n.lineBlockAt(e.head).to,-1));function s0(n,e,t){let i=false,s=ai(n.selection,r=>{let o=Je(n,r.head,-1)||Je(n,r.head,1)||r.head>0&&Je(n,r.head-1,1)||r.heads0(n,e);function qe(n,e){let t=ai(n.state.selection,i=>{let s=e(i);return y.range(i.anchor,s.head,s.goalColumn,s.bidiLevel||void 0)});if(t.eq(n.state.selection))return false;n.dispatch(nt(n.state,t));return true}function of(n,e){return qe(n,t=>n.moveByChar(t,e))}const lf=n=>of(n,!pe(n));const af=n=>of(n,pe(n));function hf(n,e){return qe(n,t=>n.moveByGroup(t,e))}const o0=n=>hf(n,!pe(n));const l0=n=>hf(n,pe(n));const a0=n=>qe(n,e=>ys(n.state,e,!pe(n)));const h0=n=>qe(n,e=>ys(n.state,e,pe(n)));function cf(n,e){return qe(n,t=>n.moveVertically(t,e))}const ff=n=>cf(n,false);const uf=n=>cf(n,true);function df(n,e){return qe(n,t=>n.moveVertically(t,e,sf(n).height))}const da=n=>df(n,false);const Oa=n=>df(n,true);const c0=n=>qe(n,e=>$t(n,e,true));const f0=n=>qe(n,e=>$t(n,e,false));const u0=n=>qe(n,e=>$t(n,e,!pe(n)));const d0=n=>qe(n,e=>$t(n,e,pe(n)));const O0=n=>qe(n,e=>y.cursor(n.lineBlockAt(e.head).from));const p0=n=>qe(n,e=>y.cursor(n.lineBlockAt(e.head).to));const pa=({state:n,dispatch:e})=>{e(nt(n,{anchor:0}));return true};const ma=({state:n,dispatch:e})=>{e(nt(n,{anchor:n.doc.length}));return true};const ga=({state:n,dispatch:e})=>{e(nt(n,{anchor:n.selection.main.anchor,head:0}));return true};const ba=({state:n,dispatch:e})=>{e(nt(n,{anchor:n.selection.main.anchor,head:n.doc.length}));return true};const m0=({state:n,dispatch:e})=>{e(n.update({selection:{anchor:0,head:n.doc.length},userEvent:"select"}));return true};const g0=({state:n,dispatch:e})=>{let t=xs(n).map(({from:i,to:s})=>y.range(i,Math.min(s+1,n.doc.length)));e(n.update({selection:y.create(t),userEvent:"select"}));return true};const b0=({state:n,dispatch:e})=>{let t=ai(n.selection,i=>{var s;let r=re(n).resolveStack(i.from,1);for(let o=r;o;o=o.next){let{node:l}=o;if((l.from=i.to||l.to>i.to&&l.from<=i.from)&&((s=l.parent)===null||s===void 0?void 0:s.parent))return y.range(l.to,l.from)}return i});e(nt(n,t));return true};const y0=({state:n,dispatch:e})=>{let t=n.selection,i=null;if(t.ranges.length>1)i=y.create([t.main]);else if(!t.main.empty)i=y.create([y.cursor(t.main.head)]);if(!i)return false;e(nt(n,i));return true};function Hi(n,e){if(n.state.readOnly)return false;let t="delete.selection",{state:i}=n;let s=i.changeByRange(r=>{let{from:o,to:l}=r;if(o==l){let a=e(r);if(ao){t="delete.forward";a=yn(n,a,true)}o=Math.min(o,a);l=Math.max(l,a)}else{o=yn(n,o,false);l=yn(n,l,true)}return o==l?{range:r}:{changes:{from:o,to:l},range:y.cursor(o,os(n)))i.between(e,e,(s,r)=>{if(se)e=t?r:s});return e}const Of=(n,e,t)=>Hi(n,i=>{let s=i.from,{state:r}=n,o=r.doc.lineAt(s),l,a;if(t&&!e&&s>o.from&&sOf(n,false,true);const pf=n=>Of(n,true,false);const mf=(n,e)=>Hi(n,t=>{let i=t.head,{state:s}=n,r=s.doc.lineAt(i);let o=s.charCategorizer(i);for(let l=null;;){if(i==(e?r.to:r.from)){if(i==t.head&&r.number!=(e?s.doc.lines:1))i+=e?1:-1;break}let a=ue(r.text,i-r.from,e)+r.from;let h=r.text.slice(Math.min(i,a)-r.from,Math.max(i,a)-r.from);let c=o(h);if(l!=null&&c!=l)break;if(h!=" "||i!=t.head)l=c;i=a}return i});const gf=n=>mf(n,false);const x0=n=>mf(n,true);const S0=n=>Hi(n,e=>{let t=n.lineBlockAt(e.head).to;return e.headHi(n,e=>{let t=n.moveToLineBoundary(e,false).head;return e.head>t?t:Math.max(0,e.head-1)});const Q0=n=>Hi(n,e=>{let t=n.moveToLineBoundary(e,true).head;return e.head{if(n.readOnly)return false;let t=n.changeByRange(i=>{return{changes:{from:i.from,to:i.to,insert:_.of(["",""])},range:y.cursor(i.from)}});e(n.update(t,{scrollIntoView:true,userEvent:"input"}));return true};const P0=({state:n,dispatch:e})=>{if(n.readOnly)return false;let t=n.changeByRange(i=>{if(!i.empty||i.from==0||i.from==n.doc.length)return{range:i};let s=i.from,r=n.doc.lineAt(s);let o=s==r.from?s-1:ue(r.text,s-r.from,false)+r.from;let l=s==r.to?s+1:ue(r.text,s-r.from,true)+r.from;return{changes:{from:o,to:l,insert:n.doc.slice(s,l).append(n.doc.slice(o,s))},range:y.cursor(l)}});if(t.changes.empty)return false;e(n.update(t,{scrollIntoView:true,userEvent:"move.character"}));return true};function xs(n){let e=[],t=-1;for(let i of n.selection.ranges){let s=n.doc.lineAt(i.from),r=n.doc.lineAt(i.to);if(!i.empty&&i.to==r.from)r=n.doc.lineAt(i.to-1);if(t>=s.number){let o=e[e.length-1];o.to=r.to;o.ranges.push(i)}else{e.push({from:s.from,to:r.to,ranges:[i]})}t=r.number+1}return e}function bf(n,e,t){if(n.readOnly)return false;let i=[],s=[];for(let r of xs(n)){if(t?r.to==n.doc.length:r.from==0)continue;let o=n.doc.lineAt(t?r.to+1:r.from-1);let l=o.length+1;if(t){i.push({from:r.to,to:o.to},{from:r.from,insert:o.text+n.lineBreak});for(let a of r.ranges)s.push(y.range(Math.min(n.doc.length,a.anchor+l),Math.min(n.doc.length,a.head+l)))}else{i.push({from:o.from,to:r.from},{from:r.to,insert:n.lineBreak+o.text});for(let a of r.ranges)s.push(y.range(a.anchor-l,a.head-l))}}if(!i.length)return false;e(n.update({changes:i,scrollIntoView:true,selection:y.create(s,n.selection.mainIndex),userEvent:"move.line"}));return true}const $0=({state:n,dispatch:e})=>bf(n,e,false);const v0=({state:n,dispatch:e})=>bf(n,e,true);function yf(n,e,t){if(n.readOnly)return false;let i=[];for(let s of xs(n)){if(t)i.push({from:s.from,insert:n.doc.slice(s.from,s.to)+n.lineBreak});else i.push({from:s.to,insert:n.lineBreak+n.doc.slice(s.from,s.to)})}e(n.update({changes:i,scrollIntoView:true,userEvent:"input.copyline"}));return true}const Z0=({state:n,dispatch:e})=>yf(n,e,false);const R0=({state:n,dispatch:e})=>yf(n,e,true);const T0=n=>{if(n.state.readOnly)return false;let{state:e}=n,t=e.changes(xs(e).map(({from:s,to:r})=>{if(s>0)s--;else if(r{let r=void 0;if(n.lineWrapping){let o=n.lineBlockAt(s.head),l=n.coordsAtPos(s.head,s.assoc||1);if(l)r=o.bottom+n.documentTop-l.bottom+n.defaultLineHeight/2}return n.moveVertically(s,true,r)}).map(t);n.dispatch({changes:t,selection:i,scrollIntoView:true,userEvent:"delete.line"});return true};function A0(n,e){if(/\(\)|\[\]|\{\}/.test(n.sliceDoc(e-1,e+1)))return{from:e,to:e};let t=re(n).resolveInner(e);let i=t.childBefore(e),s=t.childAfter(e),r;if(i&&s&&i.to<=e&&s.from>=e&&(r=i.type.prop(W.closedBy))&&r.indexOf(s.name)>-1&&n.doc.lineAt(i.to).from==n.doc.lineAt(s.from).from&&!/\S/.test(n.sliceDoc(i.to,s.from)))return{from:i.to,to:s.from};return null}const C0=xf(false);const M0=xf(true);function xf(n){return({state:e,dispatch:t})=>{if(e.readOnly)return false;let i=e.changeByRange(s=>{let{from:r,to:o}=s,l=e.doc.lineAt(r);let a=!n&&r==o&&A0(e,r);if(n)r=o=(o<=l.to?l:e.doc.lineAt(o)).to;let h=new ds(e,{simulateBreak:r,simulateDoubleBreak:!!a});let c=fo(h,r);if(c==null)c=oi(/^\s*/.exec(e.doc.lineAt(r).text)[0],e.tabSize);while(ol.from&&r{let s=[];for(let o=i.from;o<=i.to;){let l=n.doc.lineAt(o);if(l.number>t&&(i.empty||i.to>l.from)){e(l,s,i);t=l.number}o=l.to+1}let r=n.changes(s);return{changes:s,range:y.range(r.mapPos(i.anchor,1),r.mapPos(i.head,1))}})}const W0=({state:n,dispatch:e})=>{if(n.readOnly)return false;let t=Object.create(null);let i=new ds(n,{overrideIndentation:r=>{let o=t[r];return o==null?-1:o}});let s=wo(n,(r,o,l)=>{let a=fo(i,r.from);if(a==null)return;if(!/\S/.test(r.text))a=0;let h=/^\s*/.exec(r.text)[0];let c=qi(n,a);if(h!=c||l.from{if(n.readOnly)return false;e(n.update(wo(n,(t,i)=>{i.push({from:t.from,insert:n.facet(us)})}),{userEvent:"input.indent"}));return true};const D0=({state:n,dispatch:e})=>{if(n.readOnly)return false;e(n.update(wo(n,(t,i)=>{let s=/^\s*/.exec(t.text)[0];if(!s)return;let r=oi(s,n.tabSize),o=0;let l=qi(n,Math.max(0,r-Nn(n)));while(o({mac:n.key,run:n.run,shift:n.shift})));const q0=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:Fg,shift:a0},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:Hg,shift:h0},{key:"Alt-ArrowUp",run:$0},{key:"Shift-Alt-ArrowUp",run:Z0},{key:"Alt-ArrowDown",run:v0},{key:"Shift-Alt-ArrowDown",run:R0},{key:"Escape",run:y0},{key:"Mod-Enter",run:M0},{key:"Alt-l",mac:"Ctrl-l",run:g0},{key:"Mod-i",run:b0,preventDefault:true},{key:"Mod-[",run:D0},{key:"Mod-]",run:X0},{key:"Mod-Alt-\\",run:W0},{key:"Shift-Mod-k",run:T0},{key:"Shift-Mod-\\",run:r0},{key:"Mod-/",run:Zg},{key:"Alt-A",run:Tg}].concat(E0);function U(){var n=arguments[0];if(typeof n=="string")n=document.createElement(n);var e=1,t=arguments[1];if(t&&typeof t=="object"&&t.nodeType==null&&!Array.isArray(t)){for(var i in t)if(Object.prototype.hasOwnProperty.call(t,i)){var s=t[i];if(typeof s=="string")n.setAttribute(i,s);else if(s!=null)n[i]=s}e++}for(;en.normalize("NFKD"):n=>n;class si{constructor(e,t,i=0,s=e.length,r,o){this.test=o;this.value={from:0,to:0};this.done=false;this.matches=[];this.buffer="";this.bufferPos=0;this.iter=e.iterRange(i,s);this.bufferStart=i;this.normalize=r?l=>r(ya(l)):ya;this.query=this.normalize(t)}peek(){if(this.bufferPos==this.buffer.length){this.bufferStart+=this.buffer.length;this.iter.next();if(this.iter.done)return-1;this.bufferPos=0;this.buffer=this.iter.value}return ae(this.buffer,this.bufferPos)}next(){while(this.matches.length)this.matches.pop();return this.nextOverlapping()}nextOverlapping(){for(;;){let e=this.peek();if(e<0){this.done=true;return this}let t=Hr(e),i=this.bufferStart+this.bufferPos;this.bufferPos+=Xe(e);let s=this.normalize(t);for(let r=0,o=i;;r++){let l=s.charCodeAt(r);let a=this.match(l,o,this.bufferPos+this.bufferStart);if(r==s.length-1){if(a){this.value=a;return this}break}if(o==i&&rthis.to)this.curLine=this.curLine.slice(0,this.to-this.curLineStart);this.iter.next()}}nextLine(){this.curLineStart=this.curLineStart+this.curLine.length+1;if(this.curLineStart>this.to)this.curLine="";else this.getLine(0)}next(){for(let e=this.matchPos-this.curLineStart;;){this.re.lastIndex=e;let t=this.matchPos<=this.to&&this.re.exec(this.curLine);if(t){let i=this.curLineStart+t.index,s=i+t[0].length;this.matchPos=es(this.text,s+(i==s?1:0));if(i==this.curLineStart+this.curLine.length)this.nextLine();if((ithis.value.to)&&(!this.test||this.test(i,s,t))){this.value={from:i,to:s,match:t};return this}e=this.matchPos-this.curLineStart}else if(this.curLineStart+this.curLine.length=i||s.to<=t){let l=new Jt(t,e.sliceString(t,i));Is.set(e,l);return l}if(s.from==t&&s.to==i)return s;let{text:r,from:o}=s;if(o>t){r=e.sliceString(t,o)+r;o=t}if(s.to=this.to?this.to:this.text.lineAt(e).to}next(){for(;;){let e=this.re.lastIndex=this.matchPos-this.flat.from;let t=this.re.exec(this.flat.text);if(t&&!t[0]&&t.index==e){this.re.lastIndex=e+1;t=this.re.exec(this.flat.text)}if(t){let i=this.flat.from+t.index,s=i+t[0].length;if((this.flat.to>=this.to||t.index+t[0].length<=this.flat.text.length-10)&&(!this.test||this.test(i,s,t))){this.value={from:i,to:s,match:t};this.matchPos=es(this.text,s+(i==s?1:0));return this}}if(this.flat.to==this.to){this.done=true;return this}this.flat=Jt.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}}if(typeof Symbol!="undefined"){Qf.prototype[Symbol.iterator]=kf.prototype[Symbol.iterator]=function(){return this}}function _0(n){try{new RegExp(n,Qo);return true}catch(e){return false}}function es(n,e){if(e>=n.length)return e;let t=n.lineAt(e),i;while(e=56320&&i<57344)e++;return e}function Br(n){let e=String(n.state.doc.lineAt(n.state.selection.main.head).number);let t=U("input",{class:"cm-textfield",name:"line",value:e});let i=U("form",{class:"cm-gotoLine",onkeydown:r=>{if(r.keyCode==27){r.preventDefault();n.dispatch({effects:ts.of(false)});n.focus()}else if(r.keyCode==13){r.preventDefault();s()}},onsubmit:r=>{r.preventDefault();s()}},U("label",n.state.phrase("Go to line"),": ",t)," ",U("button",{class:"cm-button",type:"submit"},n.state.phrase("go")));function s(){let r=/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(t.value);if(!r)return;let{state:o}=n,l=o.doc.lineAt(o.selection.main.head);let[,a,h,c,f]=r;let u=c?+c.slice(1):0;let d=h?+h:l.number;if(h&&f){let m=d/100;if(a)m=m*(a=="-"?-1:1)+l.number/o.doc.lines;d=Math.round(o.doc.lines*m)}else if(h&&a){d=d*(a=="-"?-1:1)+l.number}let O=o.doc.line(Math.max(1,Math.min(o.doc.lines,d)));let p=y.cursor(O.from+Math.max(0,Math.min(u,O.length)));n.dispatch({effects:[ts.of(false),v.scrollIntoView(p.from,{y:"center"})],selection:p});n.focus()}return{dom:i}}const ts=A.define();const xa=oe.define({create(){return true},update(n,e){for(let t of e.effects)if(t.is(ts))n=t.value;return n},provide:n=>Ei.from(n,e=>e?Br:null)});const z0=n=>{let e=Yi(n,Br);if(!e){let t=[ts.of(true)];if(n.state.field(xa,false)==null)t.push(A.appendConfig.of([xa,j0]));n.dispatch({effects:t});e=Yi(n,Br)}if(e)e.dom.querySelector("input").select();return true};const j0=v.baseTheme({".cm-panel.cm-gotoLine":{padding:"2px 6px 4px","& label":{fontSize:"80%"}}});const V0={highlightWordAroundCursor:false,minSelectionLength:1,maxMatches:100,wholeWords:false};const L0=Z.define({combine(n){return it(n,V0,{highlightWordAroundCursor:(e,t)=>e||t,minSelectionLength:Math.min,maxMatches:Math.min})}});function B0(n){let e=[F0,G0];return e}const U0=T.mark({class:"cm-selectionMatch"});const I0=T.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function Sa(n,e,t,i){return(t==0||n(e.sliceDoc(t-1,t))!=G.Word)&&(i==e.doc.length||n(e.sliceDoc(i,i+1))!=G.Word)}function N0(n,e,t,i){return n(e.sliceDoc(t,t+1))==G.Word&&n(e.sliceDoc(i-1,i))==G.Word}const G0=ee.fromClass(class{constructor(n){this.decorations=this.getDeco(n)}update(n){if(n.selectionSet||n.docChanged||n.viewportChanged)this.decorations=this.getDeco(n.view)}getDeco(n){let e=n.state.facet(L0);let{state:t}=n,i=t.selection;if(i.ranges.length>1)return T.none;let s=i.main,r,o=null;if(s.empty){if(!e.highlightWordAroundCursor)return T.none;let a=t.wordAt(s.head);if(!a)return T.none;o=t.charCategorizer(s.head);r=t.sliceDoc(a.from,a.to)}else{let a=s.to-s.from;if(a200)return T.none;if(e.wholeWords){r=t.sliceDoc(s.from,s.to);o=t.charCategorizer(s.head);if(!(Sa(o,t,s.from,s.to)&&N0(o,t,s.from,s.to)))return T.none}else{r=t.sliceDoc(s.from,s.to);if(!r)return T.none}}let l=[];for(let a of n.visibleRanges){let h=new si(t.doc,r,a.from,a.to);while(!h.next().done){let{from:c,to:f}=h.value;if(!o||Sa(o,t,c,f)){if(s.empty&&c<=s.from&&f>=s.to)l.push(I0.range(c,f));else if(c>=s.to||f<=s.from)l.push(U0.range(c,f));if(l.length>e.maxMatches)return T.none}}}return T.set(l)}},{decorations:n=>n.decorations});const F0=v.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}});const H0=({state:n,dispatch:e})=>{let{selection:t}=n;let i=y.create(t.ranges.map(s=>n.wordAt(s.head)||y.cursor(s.head)),t.mainIndex);if(i.eq(t))return false;e(n.update({selection:i}));return true};function K0(n,e){let{main:t,ranges:i}=n.selection;let s=n.wordAt(t.head),r=s&&s.from==t.from&&s.to==t.to;for(let o=false,l=new si(n.doc,e,i[i.length-1].to);;){l.next();if(l.done){if(o)return null;l=new si(n.doc,e,0,Math.max(0,i[i.length-1].from-1));o=true}else{if(o&&i.some(a=>a.from==l.value.from))continue;if(r){let a=n.wordAt(l.value.from);if(!a||a.from!=l.value.from||a.to!=l.value.to)continue}return l.value}}}const J0=({state:n,dispatch:e})=>{let{ranges:t}=n.selection;if(t.some(r=>r.from===r.to))return H0({state:n,dispatch:e});let i=n.sliceDoc(t[0].from,t[0].to);if(n.selection.ranges.some(r=>n.sliceDoc(r.from,r.to)!=i))return false;let s=K0(n,i);if(!s)return false;e(n.update({selection:n.selection.addRange(y.range(s.from,s.to),false),effects:v.scrollIntoView(s.to)}));return true};const hi=Z.define({combine(n){return it(n,{top:false,caseSensitive:false,literal:false,regexp:false,wholeWord:false,createPanel:e=>new f1(e),scrollToMatch:e=>v.scrollIntoView(e)})}});class Pf{constructor(e){this.search=e.search;this.caseSensitive=!!e.caseSensitive;this.literal=!!e.literal;this.regexp=!!e.regexp;this.replace=e.replace||"";this.valid=!!this.search&&(!this.regexp||_0(this.search));this.unquoted=this.unquote(this.search);this.wholeWord=!!e.wholeWord}unquote(e){return this.literal?e:e.replace(/\\([nrt\\])/g,(t,i)=>i=="n"?"\n":i=="r"?"\r":i=="t"?" ":"\\")}eq(e){return this.search==e.search&&this.replace==e.replace&&this.caseSensitive==e.caseSensitive&&this.regexp==e.regexp&&this.wholeWord==e.wholeWord}create(){return this.regexp?new n1(this):new t1(this)}getCursor(e,t=0,i){let s=e.doc?e:q.create({doc:e});if(i==null)i=s.doc.length;return this.regexp?Vt(this,s,t,i):jt(this,s,t,i)}}class $f{constructor(e){this.spec=e}}function jt(n,e,t,i){return new si(e.doc,n.unquoted,t,i,n.caseSensitive?void 0:s=>s.toLowerCase(),n.wholeWord?e1(e.doc,e.charCategorizer(e.selection.main.head)):void 0)}function e1(n,e){return(t,i,s,r)=>{if(r>t||r+s.length=t)return null;s.push(i.value)}return s}highlight(e,t,i,s){let r=jt(this.spec,e,Math.max(0,t-this.spec.unquoted.length),Math.min(i+this.spec.unquoted.length,e.doc.length));while(!r.next().done)s(r.value.from,r.value.to)}}function Vt(n,e,t,i){return new Qf(e.doc,n.search,{ignoreCase:!n.caseSensitive,test:n.wholeWord?i1(e.charCategorizer(e.selection.main.head)):void 0},t,i)}function is(n,e){return n.slice(ue(n,e,false),e)}function ns(n,e){return n.slice(e,ue(n,e))}function i1(n){return(e,t,i)=>!i[0].length||(n(is(i.input,i.index))!=G.Word||n(ns(i.input,i.index))!=G.Word)&&(n(ns(i.input,i.index+i[0].length))!=G.Word||n(is(i.input,i.index+i[0].length))!=G.Word)}class n1 extends $f{nextMatch(e,t,i){let s=Vt(this.spec,e,i,e.doc.length).next();if(s.done)s=Vt(this.spec,e,0,t).next();return s.done?null:s.value}prevMatchInRange(e,t,i){for(let s=1;;s++){let r=Math.max(t,i-s*1e4);let o=Vt(this.spec,e,r,i),l=null;while(!o.next().done)l=o.value;if(l&&(r==t||l.from>r+10))return l;if(r==t)return null}}prevMatch(e,t,i){return this.prevMatchInRange(e,0,t)||this.prevMatchInRange(e,i,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace).replace(/\$([$&\d+])/g,(t,i)=>i=="$"?"$":i=="&"?e.match[0]:i!="0"&&+i=t)return null;s.push(i.value)}return s}highlight(e,t,i,s){let r=Vt(this.spec,e,Math.max(0,t-250),Math.min(i+250,e.doc.length));while(!r.next().done)s(r.value.from,r.value.to)}}const Vi=A.define();const ko=A.define();const bt=oe.define({create(n){return new Ns(Ur(n).create(),null)},update(n,e){for(let t of e.effects){if(t.is(Vi))n=new Ns(t.value.create(),n.panel);else if(t.is(ko))n=new Ns(n.query,t.value?Po:null)}return n},provide:n=>Ei.from(n,e=>e.panel)});class Ns{constructor(e,t){this.query=e;this.panel=t}}const s1=T.mark({class:"cm-searchMatch"});const r1=T.mark({class:"cm-searchMatch cm-searchMatch-selected"});const o1=ee.fromClass(class{constructor(n){this.view=n;this.decorations=this.highlight(n.state.field(bt))}update(n){let e=n.state.field(bt);if(e!=n.startState.field(bt)||n.docChanged||n.selectionSet||n.viewportChanged)this.decorations=this.highlight(e)}highlight({query:n,panel:e}){if(!e||!n.spec.valid)return T.none;let{view:t}=this;let i=new xt;for(let s=0,r=t.visibleRanges,o=r.length;sr[s+1].from-2*250)a=r[++s].to;n.highlight(t.state,l,a,(h,c)=>{let f=t.state.selection.ranges.some(u=>u.from==h&&u.to==c);i.add(h,c,f?r1:s1)})}return i.finish()}},{decorations:n=>n.decorations});function Ki(n){return e=>{let t=e.state.field(bt,false);return t&&t.query.spec.valid?n(e,t):Rf(e)}}const ss=Ki((n,{query:e})=>{let{to:t}=n.state.selection.main;let i=e.nextMatch(n.state,t,t);if(!i)return false;let s=y.single(i.from,i.to);let r=n.state.facet(hi);n.dispatch({selection:s,effects:[$o(n,i),r.scrollToMatch(s.main,n)],userEvent:"select.search"});Zf(n);return true});const rs=Ki((n,{query:e})=>{let{state:t}=n,{from:i}=t.selection.main;let s=e.prevMatch(t,i,i);if(!s)return false;let r=y.single(s.from,s.to);let o=n.state.facet(hi);n.dispatch({selection:r,effects:[$o(n,s),o.scrollToMatch(r.main,n)],userEvent:"select.search"});Zf(n);return true});const l1=Ki((n,{query:e})=>{let t=e.matchAll(n.state,1e3);if(!t||!t.length)return false;n.dispatch({selection:y.create(t.map(i=>y.range(i.from,i.to))),userEvent:"select.search.matches"});return true});const a1=({state:n,dispatch:e})=>{let t=n.selection;if(t.ranges.length>1||t.main.empty)return false;let{from:i,to:s}=t.main;let r=[],o=0;for(let l=new si(n.doc,n.sliceDoc(i,s));!l.next().done;){if(r.length>1e3)return false;if(l.value.from==i)o=r.length;r.push(y.range(l.value.from,l.value.to))}e(n.update({selection:y.create(r,o),userEvent:"select.search.matches"}));return true};const wa=Ki((n,{query:e})=>{let{state:t}=n,{from:i,to:s}=t.selection.main;if(t.readOnly)return false;let r=e.nextMatch(t,i,i);if(!r)return false;let o=[],l,a;let h=[];if(r.from==i&&r.to==s){a=t.toText(e.getReplacement(r));o.push({from:r.from,to:r.to,insert:a});r=e.nextMatch(t,r.from,r.to);h.push(v.announce.of(t.phrase("replaced match on line $",t.doc.lineAt(i).number)+"."))}if(r){let c=o.length==0||o[0].from>=r.to?0:r.to-r.from-a.length;l=y.single(r.from-c,r.to-c);h.push($o(n,r));h.push(t.facet(hi).scrollToMatch(l.main,n))}n.dispatch({changes:o,selection:l,effects:h,userEvent:"input.replace"});return true});const h1=Ki((n,{query:e})=>{if(n.state.readOnly)return false;let t=e.matchAll(n.state,1e9).map(s=>{let{from:r,to:o}=s;return{from:r,to:o,insert:e.getReplacement(s)}});if(!t.length)return false;let i=n.state.phrase("replaced $ matches",t.length)+".";n.dispatch({changes:t,effects:v.announce.of(i),userEvent:"input.replace.all"});return true});function Po(n){return n.state.facet(hi).createPanel(n)}function Ur(n,e){var t,i,s,r,o;let l=n.selection.main;let a=l.empty||l.to>l.from+100?"":n.sliceDoc(l.from,l.to);if(e&&!a)return e;let h=n.facet(hi);return new Pf({search:((t=e===null||e===void 0?void 0:e.literal)!==null&&t!==void 0?t:h.literal)?a:a.replace(/\n/g,"\\n"),caseSensitive:(i=e===null||e===void 0?void 0:e.caseSensitive)!==null&&i!==void 0?i:h.caseSensitive,literal:(s=e===null||e===void 0?void 0:e.literal)!==null&&s!==void 0?s:h.literal,regexp:(r=e===null||e===void 0?void 0:e.regexp)!==null&&r!==void 0?r:h.regexp,wholeWord:(o=e===null||e===void 0?void 0:e.wholeWord)!==null&&o!==void 0?o:h.wholeWord})}function vf(n){let e=Yi(n,Po);return e&&e.dom.querySelector("[main-field]")}function Zf(n){let e=vf(n);if(e&&e==n.root.activeElement)e.select()}const Rf=n=>{let e=n.state.field(bt,false);if(e&&e.panel){let t=vf(n);if(t&&t!=n.root.activeElement){let i=Ur(n.state,e.query.spec);if(i.valid)n.dispatch({effects:Vi.of(i)});t.focus();t.select()}}else{n.dispatch({effects:[ko.of(true),e?Vi.of(Ur(n.state,e.query.spec)):A.appendConfig.of(d1)]})}return true};const Tf=n=>{let e=n.state.field(bt,false);if(!e||!e.panel)return false;let t=Yi(n,Po);if(t&&t.dom.contains(n.root.activeElement))n.focus();n.dispatch({effects:ko.of(false)});return true};const c1=[{key:"Mod-f",run:Rf,scope:"editor search-panel"},{key:"F3",run:ss,shift:rs,scope:"editor search-panel",preventDefault:true},{key:"Mod-g",run:ss,shift:rs,scope:"editor search-panel",preventDefault:true},{key:"Escape",run:Tf,scope:"editor search-panel"},{key:"Mod-Shift-l",run:a1},{key:"Mod-Alt-g",run:z0},{key:"Mod-d",run:J0,preventDefault:true}];class f1{constructor(e){this.view=e;let t=this.query=e.state.field(bt).query.spec;this.commit=this.commit.bind(this);this.searchField=U("input",{value:t.search,placeholder:Re(e,"Find"),"aria-label":Re(e,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit});this.replaceField=U("input",{value:t.replace,placeholder:Re(e,"Replace"),"aria-label":Re(e,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit});this.caseField=U("input",{type:"checkbox",name:"case",form:"",checked:t.caseSensitive,onchange:this.commit});this.reField=U("input",{type:"checkbox",name:"re",form:"",checked:t.regexp,onchange:this.commit});this.wordField=U("input",{type:"checkbox",name:"word",form:"",checked:t.wholeWord,onchange:this.commit});function i(s,r,o){return U("button",{class:"cm-button",name:s,onclick:r,type:"button"},o)}this.dom=U("div",{onkeydown:s=>this.keydown(s),class:"cm-search"},[this.searchField,i("next",()=>ss(e),[Re(e,"next")]),i("prev",()=>rs(e),[Re(e,"previous")]),i("select",()=>l1(e),[Re(e,"all")]),U("label",null,[this.caseField,Re(e,"match case")]),U("label",null,[this.reField,Re(e,"regexp")]),U("label",null,[this.wordField,Re(e,"by word")]),...e.state.readOnly?[]:[U("br"),this.replaceField,i("replace",()=>wa(e),[Re(e,"replace")]),i("replaceAll",()=>h1(e),[Re(e,"replace all")])],U("button",{name:"close",onclick:()=>Tf(e),"aria-label":Re(e,"close"),type:"button"},["×"])])}commit(){let e=new Pf({search:this.searchField.value,caseSensitive:this.caseField.checked,regexp:this.reField.checked,wholeWord:this.wordField.checked,replace:this.replaceField.value});if(!e.eq(this.query)){this.query=e;this.view.dispatch({effects:Vi.of(e)})}}keydown(e){if(RO(this.view,e,"search-panel")){e.preventDefault()}else if(e.keyCode==13&&e.target==this.searchField){e.preventDefault();(e.shiftKey?rs:ss)(this.view)}else if(e.keyCode==13&&e.target==this.replaceField){e.preventDefault();wa(this.view)}}update(e){for(let t of e.transactions)for(let i of t.effects){if(i.is(Vi)&&!i.value.eq(this.query))this.setQuery(i.value)}}setQuery(e){this.query=e;this.searchField.value=e.search;this.replaceField.value=e.replace;this.caseField.checked=e.caseSensitive;this.reField.checked=e.regexp;this.wordField.checked=e.wholeWord}mount(){this.searchField.select()}get pos(){return 80}get top(){return this.view.state.facet(hi).top}}function Re(n,e){return n.state.phrase(e)}const xn=30;const Sn=/[\s\.,:;?!]/;function $o(n,{from:e,to:t}){let i=n.state.doc.lineAt(e),s=n.state.doc.lineAt(t).to;let r=Math.max(i.from,e-xn),o=Math.min(s,t+xn);let l=n.state.sliceDoc(r,o);if(r!=i.from){for(let a=0;al.length-xn;a--)if(!Sn.test(l[a-1])&&Sn.test(l[a])){l=l.slice(0,a);break}}return v.announce.of(`${n.state.phrase("current match")}. ${l} ${n.state.phrase("on line")} ${i.number}.`)}const u1=v.baseTheme({".cm-panel.cm-search":{padding:"2px 6px 4px",position:"relative","& [name=close]":{position:"absolute",top:"0",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",padding:0,margin:0},"& input, & button, & label":{margin:".2em .6em .2em 0"},"& input[type=checkbox]":{marginRight:".2em"},"& label":{fontSize:"80%",whiteSpace:"pre"}},"&light .cm-searchMatch":{backgroundColor:"#ffff0054"},"&dark .cm-searchMatch":{backgroundColor:"#00ffff8a"},"&light .cm-searchMatch-selected":{backgroundColor:"#ff6a0054"},"&dark .cm-searchMatch-selected":{backgroundColor:"#ff00ff8a"}});const d1=[bt,Pt.low(o1),u1];class O1{constructor(e,t,i){this.from=e;this.to=t;this.diagnostic=i}}class Tt{constructor(e,t,i){this.diagnostics=e;this.panel=t;this.selected=i}static init(e,t,i){let s=e;let r=i.facet(Li).markerFilter;if(r)s=r(s,i);let o=T.set(s.map(l=>{return l.from==l.to||l.from==l.to-1&&i.doc.lineAt(l.from).to==l.from?T.widget({widget:new Q1(l),diagnostic:l}).range(l.from):T.mark({attributes:{class:"cm-lintRange cm-lintRange-"+l.severity+(l.markClass?" "+l.markClass:"")},diagnostic:l,inclusive:true}).range(l.from,l.to)}),true);return new Tt(o,t,ri(o))}}function ri(n,e=null,t=0){let i=null;n.between(t,1e9,(s,r,{spec:o})=>{if(e&&o.diagnostic!=e)return;i=new O1(s,r,o.diagnostic);return false});return i}function p1(n,e){let t=e.pos,i=e.end||t;let s=n.state.facet(Li).hideOn(n,t,i);if(s!=null)return s;let r=n.startState.doc.lineAt(e.pos);return!!(n.effects.some(o=>o.is(Af))||n.changes.touchesRange(r.from,Math.max(r.to,i)))}function m1(n,e){return n.field(Ce,false)?e:e.concat(A.appendConfig.of($1))}const Af=A.define();const vo=A.define();const Cf=A.define();const Ce=oe.define({create(){return new Tt(T.none,null,null)},update(n,e){if(e.docChanged&&n.diagnostics.size){let t=n.diagnostics.map(e.changes),i=null,s=n.panel;if(n.selected){let r=e.changes.mapPos(n.selected.from,1);i=ri(t,n.selected.diagnostic,r)||ri(t,null,r)}if(!t.size&&s&&e.state.facet(Li).autoPanel)s=null;n=new Tt(t,s,i)}for(let t of e.effects){if(t.is(Af)){let i=!e.state.facet(Li).autoPanel?n.panel:t.value.length?Bi.open:null;n=Tt.init(t.value,i,e.state)}else if(t.is(vo)){n=new Tt(n.diagnostics,t.value?Bi.open:null,n.selected)}else if(t.is(Cf)){n=new Tt(n.diagnostics,n.panel,t.value)}}return n},provide:n=>[Ei.from(n,e=>e.panel),v.decorations.from(n,e=>e.diagnostics)]});const g1=T.mark({class:"cm-lintRange cm-lintRange-active",inclusive:true});function b1(n,e,t){let{diagnostics:i}=n.state.field(Ce);let s=[],r=2e8,o=0;i.between(e-(t<0?1:0),e+(t>0?1:0),(a,h,{spec:c})=>{if(e>=a&&e<=h&&(a==h||(e>a||t>0)&&(eWf(n,t,false)))}const x1=n=>{let e=n.state.field(Ce,false);if(!e||!e.panel)n.dispatch({effects:m1(n.state,[vo.of(true)])});let t=Yi(n,Bi.open);if(t)t.dom.querySelector(".cm-panel-lint ul").focus();return true};const Qa=n=>{let e=n.state.field(Ce,false);if(!e||!e.panel)return false;n.dispatch({effects:vo.of(false)});return true};const S1=n=>{let e=n.state.field(Ce,false);if(!e)return false;let t=n.state.selection.main,i=e.diagnostics.iter(t.to+1);if(!i.value){i=e.diagnostics.iter(0);if(!i.value||i.from==t.from&&i.to==t.to)return false}n.dispatch({selection:{anchor:i.from,head:i.to},scrollIntoView:true});return true};const w1=[{key:"Mod-Shift-m",run:x1,preventDefault:true},{key:"F8",run:S1}];const Li=Z.define({combine(n){return Object.assign({sources:n.map(e=>e.source).filter(e=>e!=null)},it(n.map(e=>e.config),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null,hideOn:()=>null},{needsRefresh:(e,t)=>!e?t:!t?e:i=>e(i)||t(i)}))}});function Mf(n){let e=[];if(n)e:for(let{name:t}of n){for(let i=0;ir.toLowerCase()==s.toLowerCase())){e.push(s);continue e}}e.push("")}return e}function Wf(n,e,t){var i;let s=t?Mf(e.actions):[];return U("li",{class:"cm-diagnostic cm-diagnostic-"+e.severity},U("span",{class:"cm-diagnosticText"},e.renderMessage?e.renderMessage(n):e.message),(i=e.actions)===null||i===void 0?void 0:i.map((r,o)=>{let l=false,a=u=>{u.preventDefault();if(l)return;l=true;let d=ri(n.state.field(Ce).diagnostics,e);if(d)r.apply(n,d.from,d.to)};let{name:h}=r,c=s[o]?h.indexOf(s[o]):-1;let f=c<0?h:[h.slice(0,c),U("u",h.slice(c,c+1)),h.slice(c+1)];return U("button",{type:"button",class:"cm-diagnosticAction",onclick:a,onmousedown:a,"aria-label":` Action: ${h}${c<0?"":` (access key "${s[o]})"`}.`},f)}),e.source&&U("div",{class:"cm-diagnosticSource"},e.source))}class Q1 extends ht{constructor(e){super();this.diagnostic=e}eq(e){return e.diagnostic==this.diagnostic}toDOM(){return U("span",{class:"cm-lintPoint cm-lintPoint-"+this.diagnostic.severity})}}class ka{constructor(e,t){this.diagnostic=t;this.id="item_"+Math.floor(Math.random()*4294967295).toString(16);this.dom=Wf(e,t,true);this.dom.id=this.id;this.dom.setAttribute("role","option")}}class Bi{constructor(e){this.view=e;this.items=[];let t=s=>{if(s.keyCode==27){Qa(this.view);this.view.focus()}else if(s.keyCode==38||s.keyCode==33){this.moveSelection((this.selectedIndex-1+this.items.length)%this.items.length)}else if(s.keyCode==40||s.keyCode==34){this.moveSelection((this.selectedIndex+1)%this.items.length)}else if(s.keyCode==36){this.moveSelection(0)}else if(s.keyCode==35){this.moveSelection(this.items.length-1)}else if(s.keyCode==13){this.view.focus()}else if(s.keyCode>=65&&s.keyCode<=90&&this.selectedIndex>=0){let{diagnostic:r}=this.items[this.selectedIndex],o=Mf(r.actions);for(let l=0;l{for(let r=0;rQa(this.view)},"×"));this.update()}get selectedIndex(){let e=this.view.state.field(Ce).selected;if(!e)return-1;for(let t=0;t{let h=-1,c;for(let f=i;fi){this.items.splice(i,h-i);s=true}}if(t&&c.diagnostic==t.diagnostic){if(!c.dom.hasAttribute("aria-selected")){c.dom.setAttribute("aria-selected","true");r=c}}else if(c.dom.hasAttribute("aria-selected")){c.dom.removeAttribute("aria-selected")}i++});while(i({sel:r.dom.getBoundingClientRect(),panel:this.list.getBoundingClientRect()}),write:({sel:o,panel:l})=>{let a=l.height/this.list.offsetHeight;if(o.topl.bottom)this.list.scrollTop+=(o.bottom-l.bottom)/a}})}else if(this.selectedIndex<0){this.list.removeAttribute("aria-activedescendant")}if(s)this.sync()}sync(){let e=this.list.firstChild;function t(){let i=e;e=i.nextSibling;i.remove()}for(let i of this.items){if(i.dom.parentNode==this.list){while(e!=i.dom)t();e=i.dom.nextSibling}else{this.list.insertBefore(i.dom,e)}}while(e)t()}moveSelection(e){if(this.selectedIndex<0)return;let t=this.view.state.field(Ce);let i=ri(t.diagnostics,this.items[e].diagnostic);if(!i)return;this.view.dispatch({selection:{anchor:i.from,head:i.to},scrollIntoView:true,effects:Cf.of(i)})}static open(e){return new Bi(e)}}function k1(n,e=`viewBox="0 0 40 40"`){return`url('data:image/svg+xml,${encodeURIComponent(n)}')`}function wn(n){return k1(``,`width="6" height="3"`)}const P1=v.baseTheme({".cm-diagnostic":{padding:"3px 6px 3px 8px",marginLeft:"-1px",display:"block",whiteSpace:"pre-wrap"},".cm-diagnostic-error":{borderLeft:"5px solid #d11"},".cm-diagnostic-warning":{borderLeft:"5px solid orange"},".cm-diagnostic-info":{borderLeft:"5px solid #999"},".cm-diagnostic-hint":{borderLeft:"5px solid #66d"},".cm-diagnosticAction":{font:"inherit",border:"none",padding:"2px 4px",backgroundColor:"#444",color:"white",borderRadius:"3px",marginLeft:"8px",cursor:"pointer"},".cm-diagnosticSource":{fontSize:"70%",opacity:.7},".cm-lintRange":{backgroundPosition:"left bottom",backgroundRepeat:"repeat-x",paddingBottom:"0.7px"},".cm-lintRange-error":{backgroundImage:wn("#d11")},".cm-lintRange-warning":{backgroundImage:wn("orange")},".cm-lintRange-info":{backgroundImage:wn("#999")},".cm-lintRange-hint":{backgroundImage:wn("#66d")},".cm-lintRange-active":{backgroundColor:"#ffdd9980"},".cm-tooltip-lint":{padding:0,margin:0},".cm-lintPoint":{position:"relative","&:after":{content:'""',position:"absolute",bottom:0,left:"-2px",borderLeft:"3px solid transparent",borderRight:"3px solid transparent",borderBottom:"4px solid #d11"}},".cm-lintPoint-warning":{"&:after":{borderBottomColor:"orange"}},".cm-lintPoint-info":{"&:after":{borderBottomColor:"#999"}},".cm-lintPoint-hint":{"&:after":{borderBottomColor:"#66d"}},".cm-panel.cm-panel-lint":{position:"relative","& ul":{maxHeight:"100px",overflowY:"auto","& [aria-selected]":{backgroundColor:"#ddd","& u":{textDecoration:"underline"}},"&:focus [aria-selected]":{background_fallback:"#bdf",backgroundColor:"Highlight",color_fallback:"white",color:"HighlightText"},"& u":{textDecoration:"none"},padding:0,margin:0},"& [name=close]":{position:"absolute",top:"0",right:"2px",background:"inherit",border:"none",font:"inherit",padding:0,margin:0}}});const $1=[Ce,v.decorations.compute([Ce],n=>{let{selected:e,panel:t}=n.field(Ce);return!e||!t||e.from==e.to?T.none:T.set([g1.range(e.from,e.to)])}),pp(b1,{hideOn:p1}),P1];const v1=(()=>[kp(),vp(),UO(),Yg(),tm(),XO(),_O(),q.allowMultipleSelections.of(true),zp(),nm(om,{fallback:true}),dm(),ng(),Og(),sp(),lp(),KO(),B0(),cs.of([...lg,...q0,...c1,...Ug,...Hp,...Dc,...w1])])();const gi=new v({extensions:[v1,kg()],parent:document.querySelector("#editor")});const Gs=new Audio("sounds/score.mp3");function Z1(n,e,t){const i=document.querySelectorAll("main .btn-primary");i.forEach(o=>{o.onclick=()=>{Gs.play();n()}});const s=document.querySelectorAll("main .btn-tertiary");s.forEach(o=>{o.onclick=()=>{Gs.play();e()}});const r=document.querySelectorAll("main .btn-secondary");r.forEach(o=>{o.onclick=()=>{Gs.play();t()}})}const Fs=n=>n?`(function(){${n} +})();`:"";const R1="modulepreload";const T1=function(n){return"/code-arcade/"+n};const Pa={};const j=function n(e,t,i){let s=Promise.resolve();if(t&&t.length>0){document.getElementsByTagName("link");const o=document.querySelector("meta[property=csp-nonce]");const l=(o==null?void 0:o.nonce)||(o==null?void 0:o.getAttribute("nonce"));s=Promise.allSettled(t.map(a=>{a=T1(a);if(a in Pa)return;Pa[a]=true;const h=a.endsWith(".css");const c=h?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${a}"]${c}`)){return}const f=document.createElement("link");f.rel=h?"stylesheet":R1;if(!h){f.as="script"}f.crossOrigin="";f.href=a;if(l){f.setAttribute("nonce",l)}document.head.appendChild(f);if(h){return new Promise((u,d)=>{f.addEventListener("load",u);f.addEventListener("error",()=>d(new Error(`Unable to preload CSS for ${a}`)))})}}))}function r(o){const l=new Event("vite:preloadError",{cancelable:true});l.payload=o;window.dispatchEvent(l);if(!l.defaultPrevented){throw o}}return s.then(o=>{for(const l of o||[]){if(l.status!=="rejected")continue;r(l.reason)}return e().catch(r)})};const A1=(n,e,t)=>{const i=n[e];if(i){return typeof i==="function"?i():Promise.resolve(i)}return new Promise((s,r)=>{(typeof queueMicrotask==="function"?queueMicrotask:setTimeout)(r.bind(null,new Error("Unknown variable dynamic import: "+e+(e.split("/").length!==t?". Note that variables only represent file names one level deep.":""))))})};function C1(n){return A1(Object.assign({"../levels/0.ts":()=>j(()=>import("./0-m-TzLBhx.js"),true?__vite__mapDeps([0,1,2]):void 0),"../levels/1.ts":()=>j(()=>import("./1-BC_hyZ-_.js"),true?__vite__mapDeps([3,1,2]):void 0),"../levels/10.ts":()=>j(()=>import("./10-EikJBxWh.js"),true?__vite__mapDeps([4,1,2]):void 0),"../levels/11.ts":()=>j(()=>import("./11-Crs753y0.js"),true?__vite__mapDeps([5,1,2]):void 0),"../levels/12.ts":()=>j(()=>import("./12-BAR1QHDL.js"),true?__vite__mapDeps([6,1,2]):void 0),"../levels/13.ts":()=>j(()=>import("./13-CLAialfw.js"),true?__vite__mapDeps([7,1,2]):void 0),"../levels/14.ts":()=>j(()=>import("./14-B7hnjGD8.js"),true?__vite__mapDeps([8,1,2]):void 0),"../levels/15.ts":()=>j(()=>import("./15-C6TqAxNI.js"),true?__vite__mapDeps([9,1,2]):void 0),"../levels/16.ts":()=>j(()=>import("./16-BSeuXE2Q.js"),true?__vite__mapDeps([10,1,2]):void 0),"../levels/17.ts":()=>j(()=>import("./17-CcNbyCdP.js"),true?__vite__mapDeps([11,1,2]):void 0),"../levels/18.ts":()=>j(()=>import("./18-lISP770N.js"),true?__vite__mapDeps([12,1,2]):void 0),"../levels/19.ts":()=>j(()=>import("./19-CMNubQrS.js"),true?__vite__mapDeps([13,1]):void 0),"../levels/2.ts":()=>j(()=>import("./2-BEevrkhn.js"),true?__vite__mapDeps([14,1,2]):void 0),"../levels/20.ts":()=>j(()=>import("./20-D-iOKw_o.js"),true?__vite__mapDeps([15,1,2]):void 0),"../levels/21.ts":()=>j(()=>import("./21-Dk_5345y.js"),true?__vite__mapDeps([16,1,2]):void 0),"../levels/22.ts":()=>j(()=>import("./22-OzhFl_Xi.js"),true?__vite__mapDeps([17,1,2]):void 0),"../levels/23.ts":()=>j(()=>import("./23-B2K0bVQx.js"),true?__vite__mapDeps([18,1,2]):void 0),"../levels/24.ts":()=>j(()=>import("./24-DVa_QBqx.js"),true?__vite__mapDeps([19,1,2]):void 0),"../levels/25.ts":()=>j(()=>import("./25-CbPebhTh.js"),true?__vite__mapDeps([20,1]):void 0),"../levels/26.ts":()=>j(()=>import("./26-BOb4J8Ly.js"),true?__vite__mapDeps([21,1,2]):void 0),"../levels/27.ts":()=>j(()=>import("./27-JBRJsvuZ.js"),true?__vite__mapDeps([22,1,2]):void 0),"../levels/28.ts":()=>j(()=>import("./28-CYF1k5UE.js"),true?__vite__mapDeps([23,1,2]):void 0),"../levels/29.ts":()=>j(()=>import("./29-BAYtqtua.js"),true?__vite__mapDeps([24,1,2]):void 0),"../levels/3.ts":()=>j(()=>import("./3-XCibOsEL.js"),true?__vite__mapDeps([25,1]):void 0),"../levels/30.ts":()=>j(()=>import("./30-BIMWgUGC.js"),true?__vite__mapDeps([26,1,2]):void 0),"../levels/4.ts":()=>j(()=>import("./4-CmTixa7I.js"),true?__vite__mapDeps([27,1]):void 0),"../levels/5.ts":()=>j(()=>import("./5-BW4Fwo9K.js"),true?__vite__mapDeps([28,1,2]):void 0),"../levels/6.ts":()=>j(()=>import("./6-DSJnDQXJ.js"),true?__vite__mapDeps([29,1,2]):void 0),"../levels/7.ts":()=>j(()=>import("./7-DEe-T0-M.js"),true?__vite__mapDeps([30,1,2]):void 0),"../levels/8.ts":()=>j(()=>import("./8-bvyAa4zF.js"),true?__vite__mapDeps([31,1,2]):void 0),"../levels/9.ts":()=>j(()=>import("./9-CGkTxJxn.js"),true?__vite__mapDeps([32,1,2]):void 0)}),`../levels/${n}.ts`,3)}const M1=document.querySelectorAll("main h1");function W1(n){M1.forEach(e=>e.innerText=`${n.level}. ${n.title}`)}const X1="code-arcade";const Zo=`${X1}-${typeof(crypto==null?void 0:crypto.randomUUID)=="function"?crypto.randomUUID():Date.now()}`;const D1=({prescript:n,script:e,postscript:t})=>` + + + + + + +Code Arcade | remarkablegames

Code Arcade

Code Arcade

\ No newline at end of file diff --git a/logo.png b/logo.png new file mode 100644 index 0000000..ef31299 Binary files /dev/null and b/logo.png differ diff --git a/manifest.json b/manifest.json new file mode 100644 index 0000000..c4225a1 --- /dev/null +++ b/manifest.json @@ -0,0 +1,15 @@ +{ + "short_name": "Code Arcade", + "name": "Code Arcade", + "icons": [ + { + "src": "logo.png", + "type": "image/png", + "sizes": "72x72" + } + ], + "start_url": ".", + "display": "standalone", + "theme_color": "#000000", + "background_color": "#ffffff" +} diff --git a/screenshots/level_0.png b/screenshots/level_0.png new file mode 100644 index 0000000..47602b3 Binary files /dev/null and b/screenshots/level_0.png differ diff --git a/screenshots/level_10.png b/screenshots/level_10.png new file mode 100644 index 0000000..fd0c412 Binary files /dev/null and b/screenshots/level_10.png differ diff --git a/screenshots/level_22.png b/screenshots/level_22.png new file mode 100644 index 0000000..e6d264a Binary files /dev/null and b/screenshots/level_22.png differ diff --git a/screenshots/level_7.png b/screenshots/level_7.png new file mode 100644 index 0000000..e441110 Binary files /dev/null and b/screenshots/level_7.png differ diff --git a/sounds/bell.mp3 b/sounds/bell.mp3 new file mode 100644 index 0000000..589afa2 Binary files /dev/null and b/sounds/bell.mp3 differ diff --git a/sounds/blip.mp3 b/sounds/blip.mp3 new file mode 100644 index 0000000..eb4a3df Binary files /dev/null and b/sounds/blip.mp3 differ diff --git a/sounds/hit.mp3 b/sounds/hit.mp3 new file mode 100644 index 0000000..dc40cf2 Binary files /dev/null and b/sounds/hit.mp3 differ diff --git a/sounds/notice.mp3 b/sounds/notice.mp3 new file mode 100644 index 0000000..c3daf59 Binary files /dev/null and b/sounds/notice.mp3 differ diff --git a/sounds/off.mp3 b/sounds/off.mp3 new file mode 100644 index 0000000..c753fdb Binary files /dev/null and b/sounds/off.mp3 differ diff --git a/sounds/powerup.mp3 b/sounds/powerup.mp3 new file mode 100644 index 0000000..1c3f4f2 Binary files /dev/null and b/sounds/powerup.mp3 differ diff --git a/sounds/score.mp3 b/sounds/score.mp3 new file mode 100644 index 0000000..e068db0 Binary files /dev/null and b/sounds/score.mp3 differ diff --git a/sounds/shoot.mp3 b/sounds/shoot.mp3 new file mode 100644 index 0000000..825c23f Binary files /dev/null and b/sounds/shoot.mp3 differ diff --git a/sounds/signal.mp3 b/sounds/signal.mp3 new file mode 100644 index 0000000..50b7eb1 Binary files /dev/null and b/sounds/signal.mp3 differ diff --git a/sounds/weak.mp3 b/sounds/weak.mp3 new file mode 100644 index 0000000..4dc1179 Binary files /dev/null and b/sounds/weak.mp3 differ diff --git a/sounds/wooosh.mp3 b/sounds/wooosh.mp3 new file mode 100644 index 0000000..e3b4c1e Binary files /dev/null and b/sounds/wooosh.mp3 differ diff --git a/sprites/apple.png b/sprites/apple.png new file mode 100644 index 0000000..a7d81ff Binary files /dev/null and b/sprites/apple.png differ diff --git a/sprites/bag.png b/sprites/bag.png new file mode 100644 index 0000000..3b0ba4d Binary files /dev/null and b/sprites/bag.png differ diff --git a/sprites/bean.png b/sprites/bean.png new file mode 100644 index 0000000..66637b6 Binary files /dev/null and b/sprites/bean.png differ diff --git a/sprites/bobo.png b/sprites/bobo.png new file mode 100644 index 0000000..a946bf8 Binary files /dev/null and b/sprites/bobo.png differ diff --git a/sprites/boom.png b/sprites/boom.png new file mode 100644 index 0000000..6289876 Binary files /dev/null and b/sprites/boom.png differ diff --git a/sprites/btfly.png b/sprites/btfly.png new file mode 100644 index 0000000..d71338b Binary files /dev/null and b/sprites/btfly.png differ diff --git a/sprites/cloud.png b/sprites/cloud.png new file mode 100644 index 0000000..05f93c9 Binary files /dev/null and b/sprites/cloud.png differ diff --git a/sprites/coin.png b/sprites/coin.png new file mode 100644 index 0000000..146a3d7 Binary files /dev/null and b/sprites/coin.png differ diff --git a/sprites/cursor_default.png b/sprites/cursor_default.png new file mode 100644 index 0000000..1a741a4 Binary files /dev/null and b/sprites/cursor_default.png differ diff --git a/sprites/cursor_pointer.png b/sprites/cursor_pointer.png new file mode 100644 index 0000000..4412581 Binary files /dev/null and b/sprites/cursor_pointer.png differ diff --git a/sprites/dino.png b/sprites/dino.png new file mode 100644 index 0000000..edee654 Binary files /dev/null and b/sprites/dino.png differ diff --git a/sprites/door.png b/sprites/door.png new file mode 100644 index 0000000..87d020c Binary files /dev/null and b/sprites/door.png differ diff --git a/sprites/egg.png b/sprites/egg.png new file mode 100644 index 0000000..f37a364 Binary files /dev/null and b/sprites/egg.png differ diff --git a/sprites/egg_crack.png b/sprites/egg_crack.png new file mode 100644 index 0000000..7192a74 Binary files /dev/null and b/sprites/egg_crack.png differ diff --git a/sprites/ghosty.png b/sprites/ghosty.png new file mode 100644 index 0000000..4f2f3be Binary files /dev/null and b/sprites/ghosty.png differ diff --git a/sprites/gigagantrum.png b/sprites/gigagantrum.png new file mode 100644 index 0000000..039dc9f Binary files /dev/null and b/sprites/gigagantrum.png differ diff --git a/sprites/grape.png b/sprites/grape.png new file mode 100644 index 0000000..1427dd4 Binary files /dev/null and b/sprites/grape.png differ diff --git a/sprites/grass.png b/sprites/grass.png new file mode 100644 index 0000000..342993e Binary files /dev/null and b/sprites/grass.png differ diff --git a/sprites/gun.png b/sprites/gun.png new file mode 100644 index 0000000..f5d32bc Binary files /dev/null and b/sprites/gun.png differ diff --git a/sprites/heart.png b/sprites/heart.png new file mode 100644 index 0000000..a787a7f Binary files /dev/null and b/sprites/heart.png differ diff --git a/sprites/jumpy.png b/sprites/jumpy.png new file mode 100644 index 0000000..78ae7bb Binary files /dev/null and b/sprites/jumpy.png differ diff --git a/sprites/k.png b/sprites/k.png new file mode 100644 index 0000000..20d23b2 Binary files /dev/null and b/sprites/k.png differ diff --git a/sprites/ka.png b/sprites/ka.png new file mode 100644 index 0000000..1bf2dd7 Binary files /dev/null and b/sprites/ka.png differ diff --git a/sprites/key.png b/sprites/key.png new file mode 100644 index 0000000..7552dfb Binary files /dev/null and b/sprites/key.png differ diff --git a/sprites/lightening.png b/sprites/lightening.png new file mode 100644 index 0000000..8645c7b Binary files /dev/null and b/sprites/lightening.png differ diff --git a/sprites/mark.png b/sprites/mark.png new file mode 100644 index 0000000..7c57042 Binary files /dev/null and b/sprites/mark.png differ diff --git a/sprites/meat.png b/sprites/meat.png new file mode 100644 index 0000000..292568d Binary files /dev/null and b/sprites/meat.png differ diff --git a/sprites/moon.png b/sprites/moon.png new file mode 100644 index 0000000..cd36c16 Binary files /dev/null and b/sprites/moon.png differ diff --git a/sprites/mushroom.png b/sprites/mushroom.png new file mode 100644 index 0000000..3ed177d Binary files /dev/null and b/sprites/mushroom.png differ diff --git a/sprites/note.png b/sprites/note.png new file mode 100644 index 0000000..2bd770f Binary files /dev/null and b/sprites/note.png differ diff --git a/sprites/pineapple.png b/sprites/pineapple.png new file mode 100644 index 0000000..894063b Binary files /dev/null and b/sprites/pineapple.png differ diff --git a/sprites/portal.png b/sprites/portal.png new file mode 100644 index 0000000..49b52eb Binary files /dev/null and b/sprites/portal.png differ diff --git a/sprites/spike.png b/sprites/spike.png new file mode 100644 index 0000000..94d814e Binary files /dev/null and b/sprites/spike.png differ diff --git a/sprites/steel.png b/sprites/steel.png new file mode 100644 index 0000000..ee896f1 Binary files /dev/null and b/sprites/steel.png differ diff --git a/sprites/sun.png b/sprites/sun.png new file mode 100644 index 0000000..3628ee7 Binary files /dev/null and b/sprites/sun.png differ diff --git a/sprites/sword.png b/sprites/sword.png new file mode 100644 index 0000000..99cf100 Binary files /dev/null and b/sprites/sword.png differ diff --git a/sprites/watermelon.png b/sprites/watermelon.png new file mode 100644 index 0000000..129ab67 Binary files /dev/null and b/sprites/watermelon.png differ