markdown-komponents 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -22,6 +22,7 @@ import {
22
22
  singleo93pzdgfc557 as single,
23
23
  toList3jhuyej2anx2q as toList,
24
24
  isInterface3d6p8outrmvmk as isInterface,
25
+ joinToString1cxrrlmo0chqs as joinToString,
25
26
  until1jbpn0z3f8lbg as until,
26
27
  slice18he6c86ndeu7 as slice,
27
28
  abs1kdzbjes1idip as abs,
@@ -32,37 +33,44 @@ import {
32
33
  indexOf1xbs558u7wr52 as indexOf,
33
34
  listOfvhqybd2zx248 as listOf,
34
35
  ArrayList3it5z8td81qkl as ArrayList,
36
+ repeat2w4c6j8zoq09o as repeat,
35
37
  trimIndent1qytc1wvt8suh as trimIndent,
36
38
  indexOfwa4w6635jewi as indexOf_0,
37
39
  replace3le3ie7l9k8aq as replace,
38
40
  drop3na99dw9feawf as drop,
41
+ RegexOption_MULTILINE_getInstance3caq4fchu5vfw as RegexOption_MULTILINE_getInstance,
39
42
  startsWith26w8qjqapeeq6 as startsWith,
43
+ RegexOption_IGNORE_CASE_getInstance5ovr6gtmcmuu as RegexOption_IGNORE_CASE_getInstance,
44
+ Default_getInstance3u7accvuecmtb as Default_getInstance,
45
+ initMetadataForObject1cxne3s9w65el as initMetadataForObject,
46
+ removePrefix279df90bhrqqg as removePrefix,
40
47
  } from './kotlin-kotlin-stdlib.mjs';
41
48
  import * as logic_tools_markdown_komponents_hljs_kfbjap from 'highlight.js';
49
+ import * as logic_tools_markdown_komponents_tsstack_TsStackMarkdown_bad43z from '@ts-stack/markdown';
42
50
  //region block: imports
43
51
  var imul = Math.imul;
44
52
  //endregion
45
53
  //region block: pre-declaration
46
54
  class BaseWebComponent extends HTMLElement {
47
- w9() {
55
+ ac() {
48
56
  }
49
57
  connectedCallback() {
50
- return this.w9();
58
+ return this.ac();
51
59
  }
52
- x9() {
60
+ bc() {
53
61
  }
54
62
  disconnectedCallback() {
55
- return this.x9();
63
+ return this.bc();
56
64
  }
57
- y9() {
65
+ cc() {
58
66
  }
59
67
  adoptedCallback() {
60
- return this.y9();
68
+ return this.cc();
61
69
  }
62
- z9(name, oldValue, newValue) {
70
+ dc(name, oldValue, newValue) {
63
71
  }
64
72
  attributeChangedCallback(name, oldValue, newValue) {
65
- return this.z9(name, oldValue, newValue);
73
+ return this.dc(name, oldValue, newValue);
66
74
  }
67
75
  }
68
76
  class BoldToolbarButton extends BaseWebComponent {
@@ -77,18 +85,18 @@ class BoldToolbarButton extends BaseWebComponent {
77
85
  var shadow = this.attachShadow(o);
78
86
  var tmp = this;
79
87
  var tmp_0 = element(shadow, 'toolbar-button', BoldToolbarButton$lambda);
80
- tmp.yi_1 = tmp_0 instanceof ToolbarButton ? tmp_0 : THROW_CCE();
88
+ tmp.cl_1 = tmp_0 instanceof ToolbarButton ? tmp_0 : THROW_CCE();
81
89
  }
82
- zi() {
90
+ dl() {
83
91
  return this.hasAttribute('highlighted');
84
92
  }
85
- z9(name, oldValue, newValue) {
93
+ dc(name, oldValue, newValue) {
86
94
  if (name === 'highlighted') {
87
- this.yi_1.bj(this.zi());
95
+ this.cl_1.fl(this.dl());
88
96
  }
89
97
  }
90
98
  attributeChangedCallback(name, oldValue, newValue) {
91
- return this.z9(name, oldValue, newValue);
99
+ return this.dc(name, oldValue, newValue);
92
100
  }
93
101
  }
94
102
  class DropdownElement extends BaseWebComponent {
@@ -124,19 +132,19 @@ class DropdownElements extends BaseWebComponent {
124
132
  class EditorToolbar {}
125
133
  class StashedSelection {
126
134
  constructor(anchorNode, anchorOffset, focusNode, focusOffset) {
127
- this.jj_1 = anchorNode;
128
- this.kj_1 = anchorOffset;
129
- this.lj_1 = focusNode;
130
- this.mj_1 = focusOffset;
135
+ this.gl_1 = anchorNode;
136
+ this.hl_1 = anchorOffset;
137
+ this.il_1 = focusNode;
138
+ this.jl_1 = focusOffset;
131
139
  }
132
140
  toString() {
133
- return 'StashedSelection(anchorNode=' + toString(this.jj_1) + ', anchorOffset=' + this.kj_1 + ', focusNode=' + toString(this.lj_1) + ', focusOffset=' + this.mj_1 + ')';
141
+ return 'StashedSelection(anchorNode=' + toString(this.gl_1) + ', anchorOffset=' + this.hl_1 + ', focusNode=' + toString(this.il_1) + ', focusOffset=' + this.jl_1 + ')';
134
142
  }
135
143
  hashCode() {
136
- var result = this.jj_1 == null ? 0 : hashCode(this.jj_1);
137
- result = imul(result, 31) + this.kj_1 | 0;
138
- result = imul(result, 31) + (this.lj_1 == null ? 0 : hashCode(this.lj_1)) | 0;
139
- result = imul(result, 31) + this.mj_1 | 0;
144
+ var result = this.gl_1 == null ? 0 : hashCode(this.gl_1);
145
+ result = imul(result, 31) + this.hl_1 | 0;
146
+ result = imul(result, 31) + (this.il_1 == null ? 0 : hashCode(this.il_1)) | 0;
147
+ result = imul(result, 31) + this.jl_1 | 0;
140
148
  return result;
141
149
  }
142
150
  equals(other) {
@@ -144,13 +152,13 @@ class StashedSelection {
144
152
  return true;
145
153
  if (!(other instanceof StashedSelection))
146
154
  return false;
147
- if (!equals(this.jj_1, other.jj_1))
155
+ if (!equals(this.gl_1, other.gl_1))
148
156
  return false;
149
- if (!(this.kj_1 === other.kj_1))
157
+ if (!(this.hl_1 === other.hl_1))
150
158
  return false;
151
- if (!equals(this.lj_1, other.lj_1))
159
+ if (!equals(this.il_1, other.il_1))
152
160
  return false;
153
- if (!(this.mj_1 === other.mj_1))
161
+ if (!(this.jl_1 === other.jl_1))
154
162
  return false;
155
163
  return true;
156
164
  }
@@ -159,31 +167,73 @@ class BaseMarkdownDocument extends BaseWebComponent {
159
167
  constructor() {
160
168
  super();
161
169
  var tmp = this;
162
- tmp.nj_1 = BaseMarkdownDocument$parser$lambda;
163
- this.oj_1 = null;
164
- this.pj_1 = document;
165
- this.qj_1 = null;
166
- this.rj_1 = true;
167
- this.sj_1 = null;
168
- this.tj_1 = false;
169
- this.uj_1 = null;
170
- this.vj_1 = 0;
171
- this.wj_1 = null;
172
- this.xj_1 = false;
170
+ tmp.parser = BaseMarkdownDocument$parser$lambda;
171
+ this.toolbar = null;
172
+ this.selectionRoot = document;
173
+ this.onLinkClick = null;
174
+ this.autoNormalize = true;
175
+ this.currentSelection = null;
176
+ this.editable = false;
177
+ this.kl_1 = null;
178
+ this.ll_1 = 0;
179
+ this.ml_1 = null;
180
+ this.nl_1 = false;
173
181
  var tmp_0 = this;
174
182
  // Inline function 'kotlin.js.asDynamic' call
175
- tmp_0.yj_1 = window.chrome != null;
183
+ tmp_0.ol_1 = window.chrome != null;
176
184
  var tmp_1 = this;
177
- tmp_1.zj_1 = BaseMarkdownDocument$onMouseDown$lambda(this);
185
+ tmp_1.pl_1 = BaseMarkdownDocument$onMouseDown$lambda(this);
178
186
  var tmp_2 = this;
179
- tmp_2.ak_1 = BaseMarkdownDocument$onMouseUp$lambda(this);
187
+ tmp_2.ql_1 = BaseMarkdownDocument$onMouseUp$lambda(this);
180
188
  var tmp_3 = this;
181
- tmp_3.bk_1 = BaseMarkdownDocument$onSelectStart$lambda(this);
189
+ tmp_3.rl_1 = BaseMarkdownDocument$onSelectStart$lambda(this);
182
190
  var tmp_4 = this;
183
- tmp_4.ck_1 = BaseMarkdownDocument$onSelectionChange$lambda(this);
184
- this.dk_1 = false;
191
+ tmp_4.sl_1 = BaseMarkdownDocument$onSelectionChange$lambda(this);
192
+ this.tl_1 = false;
185
193
  }
186
- dl() {
194
+ dm(_set____db54di) {
195
+ this.parser = _set____db54di;
196
+ }
197
+ em() {
198
+ return this.parser;
199
+ }
200
+ fm(value) {
201
+ return renderMarkdown(this, value);
202
+ }
203
+ gm() {
204
+ return this.getMarkdown();
205
+ }
206
+ hm(_set____db54di) {
207
+ this.toolbar = _set____db54di;
208
+ }
209
+ im() {
210
+ return this.toolbar;
211
+ }
212
+ jm(_set____db54di) {
213
+ this.selectionRoot = _set____db54di;
214
+ }
215
+ km() {
216
+ return this.selectionRoot;
217
+ }
218
+ lm(_set____db54di) {
219
+ this.onLinkClick = _set____db54di;
220
+ }
221
+ mm() {
222
+ return this.onLinkClick;
223
+ }
224
+ nm(_set____db54di) {
225
+ this.autoNormalize = _set____db54di;
226
+ }
227
+ om() {
228
+ return this.autoNormalize;
229
+ }
230
+ pm() {
231
+ return this.currentSelection;
232
+ }
233
+ qm() {
234
+ return this.editable;
235
+ }
236
+ renderStandardShadow() {
187
237
  // Inline function 'org.w3c.dom.OPEN' call
188
238
  // Inline function 'kotlin.js.asDynamic' call
189
239
  // Inline function 'kotlin.js.unsafeCast' call
@@ -195,20 +245,20 @@ class BaseMarkdownDocument extends BaseWebComponent {
195
245
  style(this_0, ":host {\n display: block;\n border: solid 1px gray;\n border-top: none;\n padding: 16px;\n /* inherited by descendants (including a shadow-DOM toolbar/headings), matching\n the original's separate styles/global-variables.ts stylesheet */\n --header1-font-size: 2em;\n --header2-font-size: 1.5em;\n --header3-font-size: 1.17em;\n --header4-font-size: 1em;\n --header5-font-size: 0.83em;\n --header6-font-size: 0.67em;\n}\n.toolbar {\n z-index: 3;\n top: 0px;\n position: fixed;\n right: 30%;\n background: white;\n}\n.toc {\n position: absolute;\n z-index: 3;\n top: 0px;\n right: 0%;\n}\n@media print {\n :host {\n border: none;\n }\n}");
196
246
  element(this_0, 'div', BaseMarkdownDocument$renderStandardShadow$lambda);
197
247
  }
198
- w9() {
199
- super.w9();
200
- if (!this.dk_1) {
201
- this.dk_1 = true;
248
+ ac() {
249
+ super.ac();
250
+ if (!this.tl_1) {
251
+ this.tl_1 = true;
202
252
  firstUpdated(this);
203
253
  }
204
254
  this.setAttribute('contenteditable', this.getAttribute('readonly') === 'true' ? 'false' : 'true');
205
255
  if (this.getAttribute('spellcheck') == null) {
206
256
  this.setAttribute('spellcheck', 'false');
207
257
  }
208
- this.addEventListener('mousedown', this.zj_1);
209
- this.addEventListener('mouseup', this.ak_1);
210
- document.addEventListener('selectstart', this.bk_1);
211
- document.addEventListener('selectionchange', this.ck_1);
258
+ this.addEventListener('mousedown', this.pl_1);
259
+ this.addEventListener('mouseup', this.ql_1);
260
+ document.addEventListener('selectstart', this.rl_1);
261
+ document.addEventListener('selectionchange', this.sl_1);
212
262
  this.addEventListener('keydown', BaseMarkdownDocument$connectedCallback$lambda(this));
213
263
  this.addEventListener('input', BaseMarkdownDocument$connectedCallback$lambda_0(this));
214
264
  this.addEventListener('blur', BaseMarkdownDocument$connectedCallback$lambda_1(this));
@@ -217,47 +267,66 @@ class BaseMarkdownDocument extends BaseWebComponent {
217
267
  this.addEventListener('paste', BaseMarkdownDocument$connectedCallback$lambda_4(this));
218
268
  }
219
269
  connectedCallback() {
220
- return this.w9();
270
+ return this.ac();
221
271
  }
222
- x9() {
223
- document.removeEventListener('selectionchange', this.ck_1);
224
- document.removeEventListener('selectstart', this.bk_1);
272
+ bc() {
273
+ document.removeEventListener('selectionchange', this.sl_1);
274
+ document.removeEventListener('selectstart', this.rl_1);
225
275
  }
226
276
  disconnectedCallback() {
227
- return this.x9();
277
+ return this.bc();
228
278
  }
229
- gk() {
230
- return getSelection(this.pj_1);
279
+ getSelection() {
280
+ return getSelection(this.selectionRoot);
231
281
  }
232
- jk(child) {
282
+ contentLengthUntil(child) {
233
283
  var nodes = asList(this.childNodes);
234
- var indexOfChild = child == null ? -1 : nodes.m1(child);
284
+ var indexOfChild = child == null ? -1 : nodes.n1(child);
235
285
  if (indexOfChild < 0)
236
286
  return 0;
237
287
  var result = 0;
238
288
  // Inline function 'kotlin.collections.forEach' call
239
- var _iterator__ex2g4s = nodes.n1(0, indexOfChild).p();
289
+ var _iterator__ex2g4s = nodes.o1(0, indexOfChild).p();
240
290
  while (_iterator__ex2g4s.q()) {
241
291
  var element = _iterator__ex2g4s.r();
242
292
  if (element instanceof MarkdownComponent)
243
- result = result + element.el() | 0;
293
+ result = result + element.contentLength() | 0;
244
294
  }
245
295
  return result;
246
296
  }
247
- ek() {
297
+ normalizeContent() {
248
298
  domModificationOperation(this, BaseMarkdownDocument$normalizeContent$lambda(this));
249
299
  }
250
- wk(newToolbar) {
251
- this.oj_1 = newToolbar;
300
+ contentLength() {
301
+ var result = 0;
302
+ // Inline function 'kotlin.collections.forEach' call
303
+ var _iterator__ex2g4s = asList(this.children).p();
304
+ while (_iterator__ex2g4s.q()) {
305
+ var element = _iterator__ex2g4s.r();
306
+ if (element instanceof MarkdownComponent)
307
+ result = result + element.contentLength() | 0;
308
+ }
309
+ return result;
310
+ }
311
+ onChange() {
312
+ var tmp = window;
313
+ tmp.setTimeout(BaseMarkdownDocument$onChange$lambda(this), 0);
314
+ }
315
+ setToolbar(newToolbar) {
316
+ this.toolbar = newToolbar;
252
317
  var tmp0_safe_receiver = newToolbar instanceof MarkdownToolbar ? newToolbar : null;
253
318
  if (tmp0_safe_receiver == null)
254
319
  null;
255
320
  else {
256
- tmp0_safe_receiver.kl(this);
321
+ tmp0_safe_receiver.setMarkdownDocument(this);
257
322
  }
258
323
  }
259
- fk() {
260
- var tmp0_safe_receiver = this.gk();
324
+ getMarkdown() {
325
+ var tmp = asList(this.children);
326
+ return joinToString(tmp, '', VOID, VOID, VOID, VOID, BaseMarkdownDocument$getMarkdown$lambda);
327
+ }
328
+ getCurrentLeafBlock() {
329
+ var tmp0_safe_receiver = this.getSelection();
261
330
  var element = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.anchorNode;
262
331
  while (!(element == null) && !equals(element, document) && !equals(element, this)) {
263
332
  if (element instanceof LeafElement)
@@ -266,12 +335,21 @@ class BaseMarkdownDocument extends BaseWebComponent {
266
335
  }
267
336
  return null;
268
337
  }
269
- ll() {
270
- var tmp0_safe_receiver = this.sj_1;
338
+ getLastLeafBlock() {
339
+ var element = this.kl_1;
340
+ while (!(element == null) && !equals(element, document) && !equals(element, this)) {
341
+ if (element instanceof LeafElement)
342
+ return element;
343
+ element = element.parentNode;
344
+ }
345
+ return null;
346
+ }
347
+ makeBreak() {
348
+ var tmp0_safe_receiver = this.currentSelection;
271
349
  var anchorOffset = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.anchorOffset;
272
- var tmp1_safe_receiver = this.sj_1;
350
+ var tmp1_safe_receiver = this.currentSelection;
273
351
  var focusOffset = tmp1_safe_receiver == null ? null : tmp1_safe_receiver.focusOffset;
274
- var tmp2_safe_receiver = this.sj_1;
352
+ var tmp2_safe_receiver = this.currentSelection;
275
353
  var tmp3_safe_receiver = tmp2_safe_receiver == null ? null : tmp2_safe_receiver.anchorNode;
276
354
  var parent = tmp3_safe_receiver == null ? null : tmp3_safe_receiver.parentElement;
277
355
  if (!(parent == null) && !(anchorOffset == null) && !(focusOffset == null)) {
@@ -296,13 +374,13 @@ class BaseMarkdownDocument extends BaseWebComponent {
296
374
  var range = document.createRange();
297
375
  range.selectNodeContents(replacementRight);
298
376
  range.collapse(true);
299
- var tmp4_safe_receiver = this.sj_1;
377
+ var tmp4_safe_receiver = this.currentSelection;
300
378
  if (tmp4_safe_receiver == null)
301
379
  null;
302
380
  else {
303
381
  tmp4_safe_receiver.removeAllRanges();
304
382
  }
305
- var tmp5_safe_receiver = this.sj_1;
383
+ var tmp5_safe_receiver = this.currentSelection;
306
384
  if (tmp5_safe_receiver == null)
307
385
  null;
308
386
  else {
@@ -315,29 +393,29 @@ class BaseMarkdownDocument extends BaseWebComponent {
315
393
  o['cancelable'] = false;
316
394
  o['composed'] = false;
317
395
  this.dispatchEvent(new CustomEvent('markdown-inserted', o));
318
- onChange(this);
396
+ this.onChange();
319
397
  }
320
398
  }
321
- ml() {
399
+ makeBold() {
322
400
  domModificationOperation(this, BaseMarkdownDocument$makeBold$lambda(this));
323
- onChange(this);
401
+ this.onChange();
324
402
  }
325
- nl() {
403
+ removeBold() {
326
404
  domModificationOperation(this, BaseMarkdownDocument$removeBold$lambda(this));
327
- onChange(this);
405
+ this.onChange();
328
406
  }
329
- ol(elementName) {
330
- var tmp0_safe_receiver = this.sj_1;
407
+ wrapCurrentSelectionInNewElement(elementName) {
408
+ var tmp0_safe_receiver = this.currentSelection;
331
409
  var anchorOffset = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.anchorOffset;
332
- var tmp1_safe_receiver = this.sj_1;
410
+ var tmp1_safe_receiver = this.currentSelection;
333
411
  var focusOffset = tmp1_safe_receiver == null ? null : tmp1_safe_receiver.focusOffset;
334
- var tmp2_safe_receiver = this.sj_1;
412
+ var tmp2_safe_receiver = this.currentSelection;
335
413
  var tmp3_safe_receiver = tmp2_safe_receiver == null ? null : tmp2_safe_receiver.anchorNode;
336
414
  var parent = tmp3_safe_receiver == null ? null : tmp3_safe_receiver.parentElement;
337
415
  if (parent == null || anchorOffset == null || focusOffset == null)
338
416
  return null;
339
417
  var selectionLength = abs(focusOffset - anchorOffset | 0);
340
- var tmp4_safe_receiver = this.sj_1;
418
+ var tmp4_safe_receiver = this.currentSelection;
341
419
  var tmp = tmp4_safe_receiver == null ? null : tmp4_safe_receiver.anchorNode;
342
420
  var tmp5_elvis_lhs = tmp instanceof Text ? tmp : null;
343
421
  var tmp_0;
@@ -356,43 +434,45 @@ class BaseMarkdownDocument extends BaseWebComponent {
356
434
  secondPart.replaceWith(replacement);
357
435
  var range = document.createRange();
358
436
  range.selectNodeContents(replacement);
359
- var tmp6_safe_receiver = this.sj_1;
437
+ var tmp6_safe_receiver = this.currentSelection;
360
438
  if (tmp6_safe_receiver == null)
361
439
  null;
362
440
  else {
363
441
  tmp6_safe_receiver.removeAllRanges();
364
442
  }
365
- var tmp7_safe_receiver = this.sj_1;
443
+ var tmp7_safe_receiver = this.currentSelection;
366
444
  if (tmp7_safe_receiver == null)
367
445
  null;
368
446
  else {
369
447
  tmp7_safe_receiver.addRange(range);
370
448
  }
371
- onChange(this);
449
+ this.onChange();
372
450
  return replacement;
373
451
  }
374
- pl() {
452
+ makeItalic() {
375
453
  domModificationOperation(this, BaseMarkdownDocument$makeItalic$lambda(this));
376
- onChange(this);
454
+ this.onChange();
377
455
  }
378
- ql() {
456
+ removeItalic() {
379
457
  domModificationOperation(this, BaseMarkdownDocument$removeItalic$lambda(this));
380
- onChange(this);
458
+ this.onChange();
459
+ }
460
+ makeUnderline() {
381
461
  }
382
- rl() {
462
+ makeStrike() {
383
463
  domModificationOperation(this, BaseMarkdownDocument$makeStrike$lambda(this));
384
- onChange(this);
464
+ this.onChange();
385
465
  }
386
- sl() {
466
+ removeStrike() {
387
467
  domModificationOperation(this, BaseMarkdownDocument$removeStrike$lambda(this));
388
- onChange(this);
468
+ this.onChange();
389
469
  }
390
- tl() {
470
+ makeCodeInline() {
391
471
  domModificationOperation(this, BaseMarkdownDocument$makeCodeInline$lambda(this));
392
- onChange(this);
472
+ this.onChange();
393
473
  }
394
- ul() {
395
- var tmp0_safe_receiver = this.sj_1;
474
+ listBulletedClick() {
475
+ var tmp0_safe_receiver = this.currentSelection;
396
476
  var tmp1_elvis_lhs = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.anchorNode;
397
477
  var tmp;
398
478
  if (tmp1_elvis_lhs == null) {
@@ -405,7 +485,7 @@ class BaseMarkdownDocument extends BaseWebComponent {
405
485
  var item = document.createElement('markdown-list-item');
406
486
  item.innerHTML = '<br />';
407
487
  list.appendChild(item);
408
- var tmp2_safe_receiver = this.fk();
488
+ var tmp2_safe_receiver = this.getCurrentLeafBlock();
409
489
  if (tmp2_safe_receiver == null)
410
490
  null;
411
491
  else {
@@ -416,13 +496,13 @@ class BaseMarkdownDocument extends BaseWebComponent {
416
496
  var range = document.createRange();
417
497
  range.selectNodeContents(item);
418
498
  range.collapse(true);
419
- var tmp3_safe_receiver = this.sj_1;
499
+ var tmp3_safe_receiver = this.currentSelection;
420
500
  if (tmp3_safe_receiver == null)
421
501
  null;
422
502
  else {
423
503
  tmp3_safe_receiver.removeAllRanges();
424
504
  }
425
- var tmp4_safe_receiver = this.sj_1;
505
+ var tmp4_safe_receiver = this.currentSelection;
426
506
  if (tmp4_safe_receiver == null)
427
507
  null;
428
508
  else {
@@ -435,10 +515,10 @@ class BaseMarkdownDocument extends BaseWebComponent {
435
515
  o['cancelable'] = false;
436
516
  o['composed'] = false;
437
517
  this.dispatchEvent(new CustomEvent('markdown-inserted', o));
438
- onChange(this);
518
+ this.onChange();
439
519
  }
440
- vl() {
441
- var tmp0_safe_receiver = this.sj_1;
520
+ listNumericClick() {
521
+ var tmp0_safe_receiver = this.currentSelection;
442
522
  var tmp1_elvis_lhs = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.anchorNode;
443
523
  var tmp;
444
524
  if (tmp1_elvis_lhs == null) {
@@ -451,7 +531,7 @@ class BaseMarkdownDocument extends BaseWebComponent {
451
531
  var item = document.createElement('markdown-numeric-list-item');
452
532
  item.innerHTML = '<br />';
453
533
  list.appendChild(item);
454
- var tmp2_safe_receiver = this.fk();
534
+ var tmp2_safe_receiver = this.getCurrentLeafBlock();
455
535
  if (tmp2_safe_receiver == null)
456
536
  null;
457
537
  else {
@@ -462,13 +542,13 @@ class BaseMarkdownDocument extends BaseWebComponent {
462
542
  var range = document.createRange();
463
543
  range.selectNodeContents(item);
464
544
  range.collapse(true);
465
- var tmp3_safe_receiver = this.sj_1;
545
+ var tmp3_safe_receiver = this.currentSelection;
466
546
  if (tmp3_safe_receiver == null)
467
547
  null;
468
548
  else {
469
549
  tmp3_safe_receiver.removeAllRanges();
470
550
  }
471
- var tmp4_safe_receiver = this.sj_1;
551
+ var tmp4_safe_receiver = this.currentSelection;
472
552
  if (tmp4_safe_receiver == null)
473
553
  null;
474
554
  else {
@@ -481,10 +561,10 @@ class BaseMarkdownDocument extends BaseWebComponent {
481
561
  o['cancelable'] = false;
482
562
  o['composed'] = false;
483
563
  this.dispatchEvent(new CustomEvent('markdown-inserted', o));
484
- onChange(this);
564
+ this.onChange();
485
565
  }
486
- wl(url, text) {
487
- var tmp0_safe_receiver = this.sj_1;
566
+ insertPhoto(url, text) {
567
+ var tmp0_safe_receiver = this.currentSelection;
488
568
  var tmp1_elvis_lhs = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.anchorNode;
489
569
  var tmp;
490
570
  if (tmp1_elvis_lhs == null) {
@@ -499,9 +579,9 @@ class BaseMarkdownDocument extends BaseWebComponent {
499
579
  image.title = text;
500
580
  }
501
581
  if (!(url == null)) {
502
- image.rk(url);
582
+ image.vl(url);
503
583
  }
504
- var tmp2_safe_receiver = this.sj_1;
584
+ var tmp2_safe_receiver = this.currentSelection;
505
585
  var anchorOffset = tmp2_safe_receiver == null ? null : tmp2_safe_receiver.anchorOffset;
506
586
  var text2 = anchorNode instanceof Text ? anchorNode : null;
507
587
  if (!(anchorOffset == null) && !(text2 == null)) {
@@ -514,11 +594,36 @@ class BaseMarkdownDocument extends BaseWebComponent {
514
594
  o['cancelable'] = false;
515
595
  o['composed'] = false;
516
596
  this.dispatchEvent(new CustomEvent('markdown-inserted', o));
517
- onChange(this);
597
+ this.onChange();
598
+ }
599
+ }
600
+ restoreStashedSelection() {
601
+ var tmp0_elvis_lhs = this.ml_1;
602
+ var tmp;
603
+ if (tmp0_elvis_lhs == null) {
604
+ return Unit_instance;
605
+ } else {
606
+ tmp = tmp0_elvis_lhs;
607
+ }
608
+ var stashed = tmp;
609
+ var range = document.createRange();
610
+ range.setStart(ensureNotNull(stashed.gl_1), stashed.hl_1);
611
+ range.setEnd(ensureNotNull(stashed.il_1), stashed.jl_1);
612
+ var tmp1_safe_receiver = this.currentSelection;
613
+ if (tmp1_safe_receiver == null)
614
+ null;
615
+ else {
616
+ tmp1_safe_receiver.removeAllRanges();
617
+ }
618
+ var tmp2_safe_receiver = this.currentSelection;
619
+ if (tmp2_safe_receiver == null)
620
+ null;
621
+ else {
622
+ tmp2_safe_receiver.addRange(range);
518
623
  }
519
624
  }
520
- xl() {
521
- var tmp = this.ol('markdown-link');
625
+ insertLink() {
626
+ var tmp = this.wrapCurrentSelectionInNewElement('markdown-link');
522
627
  var tmp0_elvis_lhs = tmp instanceof MarkdownLink ? tmp : null;
523
628
  var tmp_0;
524
629
  if (tmp0_elvis_lhs == null) {
@@ -533,32 +638,32 @@ class BaseMarkdownDocument extends BaseWebComponent {
533
638
  link.textContent = 'http://';
534
639
  }
535
640
  var tmp1_elvis_lhs = link.textContent;
536
- link.rk(tmp1_elvis_lhs == null ? '' : tmp1_elvis_lhs);
641
+ link.vl(tmp1_elvis_lhs == null ? '' : tmp1_elvis_lhs);
537
642
  link.classList.add('fresh');
538
643
  }
539
- bm() {
644
+ header1Element() {
540
645
  return replaceCurrentLeafBlockWith(this, 'markdown-header-1');
541
646
  }
542
- cm() {
647
+ header2Element() {
543
648
  return replaceCurrentLeafBlockWith(this, 'markdown-header-2');
544
649
  }
545
- dm() {
650
+ header3Element() {
546
651
  return replaceCurrentLeafBlockWith(this, 'markdown-header-3');
547
652
  }
548
- em() {
653
+ header4Element() {
549
654
  return replaceCurrentLeafBlockWith(this, 'markdown-header-4');
550
655
  }
551
- fm() {
656
+ header5Element() {
552
657
  return replaceCurrentLeafBlockWith(this, 'markdown-header-5');
553
658
  }
554
- gm() {
659
+ header6Element() {
555
660
  return replaceCurrentLeafBlockWith(this, 'markdown-header-6');
556
661
  }
557
- hm() {
662
+ pararaphElement() {
558
663
  return replaceCurrentLeafBlockWith(this, 'markdown-paragraph');
559
664
  }
560
- im() {
561
- var tmp0_elvis_lhs = this.fk();
665
+ makeCodeBlock() {
666
+ var tmp0_elvis_lhs = this.getCurrentLeafBlock();
562
667
  var tmp;
563
668
  if (tmp0_elvis_lhs == null) {
564
669
  return Unit_instance;
@@ -576,10 +681,10 @@ class BaseMarkdownDocument extends BaseWebComponent {
576
681
  o['cancelable'] = false;
577
682
  o['composed'] = false;
578
683
  this.dispatchEvent(new CustomEvent('markdown-inserted', o));
579
- onChange(this);
684
+ this.onChange();
580
685
  }
581
- jm() {
582
- var tmp0_elvis_lhs = this.fk();
686
+ makeQuoteBlock() {
687
+ var tmp0_elvis_lhs = this.getCurrentLeafBlock();
583
688
  var tmp;
584
689
  if (tmp0_elvis_lhs == null) {
585
690
  return Unit_instance;
@@ -599,13 +704,19 @@ class BaseMarkdownDocument extends BaseWebComponent {
599
704
  o['cancelable'] = false;
600
705
  o['composed'] = false;
601
706
  this.dispatchEvent(new CustomEvent('markdown-inserted', o));
602
- onChange(this);
707
+ this.onChange();
708
+ }
709
+ get markdown() {
710
+ return this.gm();
711
+ }
712
+ set markdown(value) {
713
+ this.fm(value);
603
714
  }
604
715
  }
605
716
  class MarkdownDocument extends BaseMarkdownDocument {
606
717
  constructor() {
607
718
  super();
608
- this.dl();
719
+ this.renderStandardShadow();
609
720
  }
610
721
  }
611
722
  class MarkdownEditor extends BaseMarkdownDocument {
@@ -620,13 +731,13 @@ class MarkdownEditor extends BaseMarkdownDocument {
620
731
  var shadow = this.attachShadow(o);
621
732
  var toolbarElement = element(shadow, 'markdown-toolbar');
622
733
  slot(shadow);
623
- this.wk(toolbarElement);
734
+ this.setToolbar(toolbarElement);
624
735
  }
625
736
  }
626
737
  class MarkdownToolbar extends BaseWebComponent {
627
738
  constructor() {
628
739
  super();
629
- this.fl_1 = null;
740
+ this.markdownDocument = null;
630
741
  // Inline function 'org.w3c.dom.OPEN' call
631
742
  // Inline function 'kotlin.js.asDynamic' call
632
743
  // Inline function 'kotlin.js.unsafeCast' call
@@ -638,7 +749,7 @@ class MarkdownToolbar extends BaseWebComponent {
638
749
  var toolbarRow = element(shadow, 'div', MarkdownToolbar$lambda);
639
750
  var dropdown = element(toolbarRow, 'toolbar-dropdown');
640
751
  var tmp = this;
641
- tmp.jl_1 = element(dropdown, 'span', MarkdownToolbar$lambda_0);
752
+ tmp.xm_1 = element(dropdown, 'span', MarkdownToolbar$lambda_0);
642
753
  dropdown.appendChild(document.createTextNode(' \u25BE'));
643
754
  var dropdownElements = element(dropdown, 'dropdown-elements', MarkdownToolbar$lambda_1);
644
755
  headingOption(this, dropdownElements, 1, MarkdownToolbar$lambda_2(this));
@@ -650,11 +761,11 @@ class MarkdownToolbar extends BaseWebComponent {
650
761
  paragraphOption(this, dropdownElements, MarkdownToolbar$lambda_8(this));
651
762
  element(toolbarRow, 'toolbar-separator');
652
763
  var tmp_0 = this;
653
- tmp_0.gl_1 = toggleButton(this, toolbarRow, 'bold', 'toggle bold', MarkdownToolbar$lambda_9(this));
764
+ tmp_0.um_1 = toggleButton(this, toolbarRow, 'bold', 'toggle bold', MarkdownToolbar$lambda_9(this));
654
765
  var tmp_1 = this;
655
- tmp_1.hl_1 = toggleButton(this, toolbarRow, 'italic', 'toggle italic', MarkdownToolbar$lambda_10(this));
766
+ tmp_1.vm_1 = toggleButton(this, toolbarRow, 'italic', 'toggle italic', MarkdownToolbar$lambda_10(this));
656
767
  var tmp_2 = this;
657
- tmp_2.il_1 = toggleButton(this, toolbarRow, 'strikethrough', 'toggle strike', MarkdownToolbar$lambda_11(this));
768
+ tmp_2.wm_1 = toggleButton(this, toolbarRow, 'strikethrough', 'toggle strike', MarkdownToolbar$lambda_11(this));
658
769
  element(toolbarRow, 'toolbar-separator');
659
770
  actionButton(this, toolbarRow, 'list-bulleted', 'list', MarkdownToolbar$lambda_12(this));
660
771
  actionButton(this, toolbarRow, 'list-numbered', 'numbered list', MarkdownToolbar$lambda_13(this));
@@ -669,36 +780,42 @@ class MarkdownToolbar extends BaseWebComponent {
669
780
  element(toolbarRow, 'slot', MarkdownToolbar$lambda_20);
670
781
  slot(shadow);
671
782
  }
672
- w9() {
673
- super.w9();
783
+ an(_set____db54di) {
784
+ this.markdownDocument = _set____db54di;
785
+ }
786
+ bn() {
787
+ return this.markdownDocument;
788
+ }
789
+ ac() {
790
+ super.ac();
674
791
  this.addEventListener('mousedown', MarkdownToolbar$connectedCallback$lambda);
675
792
  }
676
793
  connectedCallback() {
677
- return this.w9();
794
+ return this.ac();
678
795
  }
679
- kl(document) {
680
- this.fl_1 = document;
796
+ setMarkdownDocument(document) {
797
+ this.markdownDocument = document;
681
798
  }
682
- cj() {
683
- this.gl_1.bj(true);
799
+ highlightBoldButton() {
800
+ this.um_1.fl(true);
684
801
  }
685
- dj() {
686
- this.gl_1.bj(false);
802
+ removeBoldButtonHighlighting() {
803
+ this.um_1.fl(false);
687
804
  }
688
- ej() {
689
- this.hl_1.bj(true);
805
+ highlightItalicButton() {
806
+ this.vm_1.fl(true);
690
807
  }
691
- fj() {
692
- this.hl_1.bj(false);
808
+ removeItalicButtonHighlighting() {
809
+ this.vm_1.fl(false);
693
810
  }
694
- gj() {
695
- this.il_1.bj(true);
811
+ highlightStrikeButton() {
812
+ this.wm_1.fl(true);
696
813
  }
697
- hj() {
698
- this.il_1.bj(false);
814
+ removeStrikeButtonHighlighting() {
815
+ this.wm_1.fl(false);
699
816
  }
700
- ij(title) {
701
- this.jl_1.textContent = title;
817
+ setDropdownTitle(title) {
818
+ this.xm_1.textContent = title;
702
819
  }
703
820
  }
704
821
  class ToggleToolbarButton extends BaseWebComponent {
@@ -713,12 +830,12 @@ class ToggleToolbarButton extends BaseWebComponent {
713
830
  var shadow = this.attachShadow(o);
714
831
  var tmp = this;
715
832
  var tmp_0 = element(shadow, 'toolbar-button', ToggleToolbarButton$lambda);
716
- tmp.lm_1 = tmp_0 instanceof ToolbarButton ? tmp_0 : THROW_CCE();
833
+ tmp.ym_1 = tmp_0 instanceof ToolbarButton ? tmp_0 : THROW_CCE();
717
834
  var tmp_1 = this;
718
- var tmp_2 = element(this.lm_1, 'toolbar-icon', ToggleToolbarButton$lambda_0);
719
- tmp_1.mm_1 = tmp_2 instanceof ToolbarIcon ? tmp_2 : THROW_CCE();
835
+ var tmp_2 = element(this.ym_1, 'toolbar-icon', ToggleToolbarButton$lambda_0);
836
+ tmp_1.zm_1 = tmp_2 instanceof ToolbarIcon ? tmp_2 : THROW_CCE();
720
837
  }
721
- bj(value) {
838
+ fl(value) {
722
839
  var tmp;
723
840
  if (value) {
724
841
  this.setAttribute('highlighted', '');
@@ -729,18 +846,18 @@ class ToggleToolbarButton extends BaseWebComponent {
729
846
  }
730
847
  return tmp;
731
848
  }
732
- zi() {
849
+ dl() {
733
850
  return this.hasAttribute('highlighted');
734
851
  }
735
- z9(name, oldValue, newValue) {
852
+ dc(name, oldValue, newValue) {
736
853
  if (name === 'highlighted') {
737
- this.lm_1.bj(this.zi());
854
+ this.ym_1.fl(this.dl());
738
855
  } else if (name === 'icon') {
739
- this.mm_1.om(newValue == null ? '' : newValue);
856
+ this.zm_1.dn(newValue == null ? '' : newValue);
740
857
  }
741
858
  }
742
859
  attributeChangedCallback(name, oldValue, newValue) {
743
- return this.z9(name, oldValue, newValue);
860
+ return this.dc(name, oldValue, newValue);
744
861
  }
745
862
  }
746
863
  class ToolbarButton extends BaseWebComponent {
@@ -755,9 +872,9 @@ class ToolbarButton extends BaseWebComponent {
755
872
  var shadow = this.attachShadow(o);
756
873
  style(shadow, 'button {\n padding: 0;\n margin: 0;\n border: none;\n background-color: transparent;\n vertical-align: center;\n height: 24px;\n}\nbutton:hover {\n background-color: lightblue;\n}\n.highlighted {\n background-color: gray;\n}');
757
874
  var tmp = this;
758
- tmp.aj_1 = element(shadow, 'button', ToolbarButton$lambda);
875
+ tmp.el_1 = element(shadow, 'button', ToolbarButton$lambda);
759
876
  }
760
- bj(value) {
877
+ fl(value) {
761
878
  var tmp;
762
879
  if (value) {
763
880
  this.setAttribute('highlighted', '');
@@ -768,24 +885,24 @@ class ToolbarButton extends BaseWebComponent {
768
885
  }
769
886
  return tmp;
770
887
  }
771
- z9(name, oldValue, newValue) {
888
+ dc(name, oldValue, newValue) {
772
889
  if (name === 'highlighted') {
773
890
  if (!(newValue == null)) {
774
- this.aj_1.classList.add('highlighted');
891
+ this.el_1.classList.add('highlighted');
775
892
  } else {
776
- this.aj_1.classList.remove('highlighted');
893
+ this.el_1.classList.remove('highlighted');
777
894
  }
778
895
  }
779
896
  }
780
897
  attributeChangedCallback(name, oldValue, newValue) {
781
- return this.z9(name, oldValue, newValue);
898
+ return this.dc(name, oldValue, newValue);
782
899
  }
783
900
  }
784
901
  class ToolbarDropdown extends BaseWebComponent {
785
902
  constructor() {
786
903
  super();
787
904
  var tmp = this;
788
- tmp.qm_1 = ToolbarDropdown$hideOnOutsideMouseDown$lambda(this);
905
+ tmp.fn_1 = ToolbarDropdown$hideOnOutsideMouseDown$lambda(this);
789
906
  // Inline function 'org.w3c.dom.OPEN' call
790
907
  // Inline function 'kotlin.js.asDynamic' call
791
908
  // Inline function 'kotlin.js.unsafeCast' call
@@ -797,20 +914,20 @@ class ToolbarDropdown extends BaseWebComponent {
797
914
  var button = element(shadow, 'toolbar-button', ToolbarDropdown$lambda);
798
915
  button.addEventListener('mousedown', ToolbarDropdown$lambda_0(this));
799
916
  var tmp_0 = this;
800
- tmp_0.pm_1 = element(shadow, 'slot', ToolbarDropdown$lambda_1);
917
+ tmp_0.en_1 = element(shadow, 'slot', ToolbarDropdown$lambda_1);
801
918
  }
802
- w9() {
803
- super.w9();
804
- document.addEventListener('mousedown', this.qm_1);
919
+ ac() {
920
+ super.ac();
921
+ document.addEventListener('mousedown', this.fn_1);
805
922
  }
806
923
  connectedCallback() {
807
- return this.w9();
924
+ return this.ac();
808
925
  }
809
- x9() {
810
- document.removeEventListener('mousedown', this.qm_1);
926
+ bc() {
927
+ document.removeEventListener('mousedown', this.fn_1);
811
928
  }
812
929
  disconnectedCallback() {
813
- return this.x9();
930
+ return this.bc();
814
931
  }
815
932
  }
816
933
  class ToolbarIcon extends BaseWebComponent {
@@ -824,18 +941,18 @@ class ToolbarIcon extends BaseWebComponent {
824
941
  o['mode'] = 'open';
825
942
  var shadow = this.attachShadow(o);
826
943
  style(shadow, ':host {\n display: inline-flex;\n width: 24px;\n height: 24px;\n align-items: center;\n justify-content: center;\n color: inherit;\n}\nspan, svg {\n display: block;\n width: 100%;\n height: 100%;\n}');
827
- this.nm_1 = element(shadow, 'span');
944
+ this.cn_1 = element(shadow, 'span');
828
945
  }
829
- om(value) {
946
+ dn(value) {
830
947
  return this.setAttribute('icon', value);
831
948
  }
832
- z9(name, oldValue, newValue) {
949
+ dc(name, oldValue, newValue) {
833
950
  if (name === 'icon') {
834
- this.nm_1.innerHTML = svgFor(this, newValue == null ? '' : newValue);
951
+ this.cn_1.innerHTML = svgFor(this, newValue == null ? '' : newValue);
835
952
  }
836
953
  }
837
954
  attributeChangedCallback(name, oldValue, newValue) {
838
- return this.z9(name, oldValue, newValue);
955
+ return this.dc(name, oldValue, newValue);
839
956
  }
840
957
  }
841
958
  class ToolbarSeparator extends BaseWebComponent {
@@ -853,17 +970,18 @@ class ToolbarSeparator extends BaseWebComponent {
853
970
  element(this_0, 'div', ToolbarSeparator$lambda);
854
971
  }
855
972
  }
973
+ class MarkdownElement {}
856
974
  class MarkdownComponent extends BaseWebComponent {
857
- ik() {
975
+ isEditable() {
858
976
  return true;
859
977
  }
860
- xk() {
978
+ isDeletableAsAWhole() {
861
979
  return false;
862
980
  }
863
- nk() {
981
+ normalizeContent() {
864
982
  return normalizeContent(this);
865
983
  }
866
- rm(content) {
984
+ pushNodesAfterBreakToParent(content) {
867
985
  var tmp0_elvis_lhs = this.parentNode;
868
986
  var tmp;
869
987
  if (tmp0_elvis_lhs == null) {
@@ -873,11 +991,11 @@ class MarkdownComponent extends BaseWebComponent {
873
991
  }
874
992
  var parent = tmp;
875
993
  var siblings = asList(this.childNodes);
876
- var indexOfBreak = siblings.m1(content);
994
+ var indexOfBreak = siblings.n1(content);
877
995
  var elementsToMove = drop(siblings, indexOfBreak + 1 | 0);
878
996
  var tmp_0;
879
997
  if (elementsToMove.e1()) {
880
- tmp_0 = this.um();
998
+ tmp_0 = this.newEmptyElementAfterBreak();
881
999
  } else {
882
1000
  var tmp_1;
883
1001
  if (elementsToMove.t() === 1) {
@@ -894,7 +1012,7 @@ class MarkdownComponent extends BaseWebComponent {
894
1012
  tmp_1 = false;
895
1013
  }
896
1014
  if (tmp_1) {
897
- var tmp1_safe_receiver = this.vm();
1015
+ var tmp1_safe_receiver = this.newEmptyElementNameAfterBreak();
898
1016
  var tmp_3;
899
1017
  if (tmp1_safe_receiver == null) {
900
1018
  tmp_3 = null;
@@ -925,43 +1043,43 @@ class MarkdownComponent extends BaseWebComponent {
925
1043
  }
926
1044
  }
927
1045
  }
928
- sm(tagName) {
1046
+ newEmptyElement(tagName) {
929
1047
  var result = document.createElement(tagName);
930
1048
  if (result instanceof MarkdownComponent) {
931
- result.tm();
1049
+ result.fillEmptyElement();
932
1050
  }
933
1051
  return result;
934
1052
  }
935
- tm() {
1053
+ fillEmptyElement() {
936
1054
  this.appendChild(document.createTextNode(get_ZERO_WIDTH_SPACE()));
937
1055
  }
938
- um() {
939
- var tmp0_safe_receiver = this.vm();
1056
+ newEmptyElementAfterBreak() {
1057
+ var tmp0_safe_receiver = this.newEmptyElementNameAfterBreak();
940
1058
  var tmp;
941
1059
  if (tmp0_safe_receiver == null) {
942
1060
  tmp = null;
943
1061
  } else {
944
1062
  // Inline function 'kotlin.let' call
945
- tmp = this.sm(tmp0_safe_receiver);
1063
+ tmp = this.newEmptyElement(tmp0_safe_receiver);
946
1064
  }
947
1065
  return tmp;
948
1066
  }
949
- vm() {
1067
+ newEmptyElementNameAfterBreak() {
950
1068
  return this.tagName;
951
1069
  }
952
- fn(content) {
953
- this.rm(content);
1070
+ pushBreakAndNodesAfterToParent(content) {
1071
+ this.pushNodesAfterBreakToParent(content);
954
1072
  var tmp0_safe_receiver = this.parentNode;
955
1073
  if (tmp0_safe_receiver == null)
956
1074
  null;
957
1075
  else
958
1076
  tmp0_safe_receiver.insertBefore(content, this.nextSibling);
959
1077
  }
960
- yk(currentSelection) {
1078
+ mergeWithPrevious(currentSelection) {
961
1079
  }
962
- al() {
1080
+ mergeNextIn() {
963
1081
  }
964
- wm(currentSelection) {
1082
+ setSelectionToEnd(currentSelection) {
965
1083
  var last = this;
966
1084
  while (!(last.lastChild == null)) {
967
1085
  last = ensureNotNull(last.lastChild);
@@ -982,7 +1100,7 @@ class MarkdownComponent extends BaseWebComponent {
982
1100
  }
983
1101
  }
984
1102
  }
985
- el() {
1103
+ contentLength() {
986
1104
  var result = 0;
987
1105
  // Inline function 'kotlin.collections.forEach' call
988
1106
  var _iterator__ex2g4s = asList(this.childNodes).p();
@@ -991,7 +1109,7 @@ class MarkdownComponent extends BaseWebComponent {
991
1109
  var tmp = result;
992
1110
  var tmp_0;
993
1111
  if (element instanceof MarkdownComponent) {
994
- tmp_0 = element.el();
1112
+ tmp_0 = element.contentLength();
995
1113
  } else {
996
1114
  if (element instanceof HTMLBRElement) {
997
1115
  tmp_0 = 1;
@@ -1004,21 +1122,21 @@ class MarkdownComponent extends BaseWebComponent {
1004
1122
  }
1005
1123
  result = tmp + tmp_0 | 0;
1006
1124
  }
1007
- return result + this.xm() | 0;
1125
+ return result + this.endOfLineEquivalentLength() | 0;
1008
1126
  }
1009
- jk(child) {
1127
+ contentLengthUntil(child) {
1010
1128
  var nodes = asList(this.childNodes);
1011
- var indexOfChild = child == null ? -1 : nodes.m1(child);
1129
+ var indexOfChild = child == null ? -1 : nodes.n1(child);
1012
1130
  var result = 0;
1013
1131
  if (indexOfChild >= 0) {
1014
1132
  // Inline function 'kotlin.collections.forEach' call
1015
- var _iterator__ex2g4s = nodes.n1(0, indexOfChild).p();
1133
+ var _iterator__ex2g4s = nodes.o1(0, indexOfChild).p();
1016
1134
  while (_iterator__ex2g4s.q()) {
1017
1135
  var element = _iterator__ex2g4s.r();
1018
1136
  var tmp = result;
1019
1137
  var tmp_0;
1020
1138
  if (element instanceof MarkdownComponent) {
1021
- tmp_0 = element.el();
1139
+ tmp_0 = element.contentLength();
1022
1140
  } else {
1023
1141
  if (element instanceof HTMLBRElement) {
1024
1142
  tmp_0 = 1;
@@ -1034,13 +1152,13 @@ class MarkdownComponent extends BaseWebComponent {
1034
1152
  }
1035
1153
  return result;
1036
1154
  }
1037
- lk() {
1155
+ elementEndWithEndOfLineEquivalent() {
1038
1156
  return false;
1039
1157
  }
1040
- xm() {
1041
- return this.lk() ? 1 : 0;
1158
+ endOfLineEquivalentLength() {
1159
+ return this.elementEndWithEndOfLineEquivalent() ? 1 : 0;
1042
1160
  }
1043
- kk(contentOffset) {
1161
+ getNodeAndOffsetFromContentOffsetAnchor(contentOffset) {
1044
1162
  var nodes = asList(this.childNodes);
1045
1163
  if (nodes.e1())
1046
1164
  return to(this, contentOffset);
@@ -1048,7 +1166,7 @@ class MarkdownComponent extends BaseWebComponent {
1048
1166
  var _iterator__ex2g4s = nodes.p();
1049
1167
  $l$loop_0: while (_iterator__ex2g4s.q()) {
1050
1168
  var child = _iterator__ex2g4s.r();
1051
- var lengthUntilChild = this.jk(child);
1169
+ var lengthUntilChild = this.contentLengthUntil(child);
1052
1170
  if (contentOffset === lengthUntilChild) {
1053
1171
  resultNode = child;
1054
1172
  break $l$loop_0;
@@ -1059,13 +1177,13 @@ class MarkdownComponent extends BaseWebComponent {
1059
1177
  }
1060
1178
  var tmp;
1061
1179
  if (resultNode instanceof MarkdownComponent) {
1062
- tmp = resultNode.kk(contentOffset - this.jk(resultNode) | 0);
1180
+ tmp = resultNode.getNodeAndOffsetFromContentOffsetAnchor(contentOffset - this.contentLengthUntil(resultNode) | 0);
1063
1181
  } else {
1064
- tmp = to(resultNode, contentOffset - this.jk(resultNode) | 0);
1182
+ tmp = to(resultNode, contentOffset - this.contentLengthUntil(resultNode) | 0);
1065
1183
  }
1066
1184
  return tmp;
1067
1185
  }
1068
- mk(contentOffset) {
1186
+ getNodeAndOffsetFromContentOffset(contentOffset) {
1069
1187
  var nodes = asList(this.childNodes);
1070
1188
  if (nodes.e1())
1071
1189
  return to(this, contentOffset);
@@ -1074,7 +1192,7 @@ class MarkdownComponent extends BaseWebComponent {
1074
1192
  var _iterator__ex2g4s = nodes.p();
1075
1193
  $l$loop_0: while (_iterator__ex2g4s.q()) {
1076
1194
  var child = _iterator__ex2g4s.r();
1077
- var lengthUntilChild = this.jk(child);
1195
+ var lengthUntilChild = this.contentLengthUntil(child);
1078
1196
  if (contentOffset === lengthUntilChild) {
1079
1197
  if (previousNodeWasEol)
1080
1198
  resultNode = child;
@@ -1085,7 +1203,7 @@ class MarkdownComponent extends BaseWebComponent {
1085
1203
  resultNode = child;
1086
1204
  var tmp;
1087
1205
  if (child instanceof MarkdownComponent) {
1088
- tmp = child.lk();
1206
+ tmp = child.elementEndWithEndOfLineEquivalent();
1089
1207
  } else {
1090
1208
  tmp = false;
1091
1209
  }
@@ -1093,52 +1211,66 @@ class MarkdownComponent extends BaseWebComponent {
1093
1211
  }
1094
1212
  var tmp_0;
1095
1213
  if (resultNode instanceof MarkdownComponent) {
1096
- tmp_0 = resultNode.mk(contentOffset - this.jk(resultNode) | 0);
1214
+ tmp_0 = resultNode.getNodeAndOffsetFromContentOffset(contentOffset - this.contentLengthUntil(resultNode) | 0);
1097
1215
  } else {
1098
- tmp_0 = to(resultNode, contentOffset - this.jk(resultNode) | 0);
1216
+ tmp_0 = to(resultNode, contentOffset - this.contentLengthUntil(resultNode) | 0);
1099
1217
  }
1100
1218
  return tmp_0;
1101
1219
  }
1220
+ getMarkdown() {
1221
+ var tmp = asList(this.children);
1222
+ return joinToString(tmp, '', VOID, VOID, VOID, VOID, MarkdownComponent$getMarkdown$lambda);
1223
+ }
1224
+ get mustBeDirectChildOfDocument() {
1225
+ return this.gn();
1226
+ }
1227
+ }
1228
+ class BlockElement extends MarkdownComponent {
1229
+ get mustBeDirectChildOfDocument() {
1230
+ return this.gn();
1231
+ }
1102
1232
  }
1103
- class BlockElement extends MarkdownComponent {}
1104
1233
  class ContainerElement extends MarkdownComponent {
1105
- el() {
1234
+ contentLength() {
1106
1235
  var result = 0;
1107
1236
  // Inline function 'kotlin.collections.forEach' call
1108
1237
  var _iterator__ex2g4s = asList(this.childNodes).p();
1109
1238
  while (_iterator__ex2g4s.q()) {
1110
1239
  var element = _iterator__ex2g4s.r();
1111
1240
  if (element instanceof MarkdownComponent)
1112
- result = result + element.el() | 0;
1241
+ result = result + element.contentLength() | 0;
1113
1242
  }
1114
- return result + this.xm() | 0;
1243
+ return result + this.endOfLineEquivalentLength() | 0;
1115
1244
  }
1116
- jk(child) {
1245
+ contentLengthUntil(child) {
1117
1246
  var nodes = asList(this.childNodes);
1118
- var indexOfChild = child == null ? -1 : nodes.m1(child);
1247
+ var indexOfChild = child == null ? -1 : nodes.n1(child);
1119
1248
  var result = 0;
1120
1249
  if (indexOfChild >= 0) {
1121
1250
  // Inline function 'kotlin.collections.forEach' call
1122
- var _iterator__ex2g4s = nodes.n1(0, indexOfChild).p();
1251
+ var _iterator__ex2g4s = nodes.o1(0, indexOfChild).p();
1123
1252
  while (_iterator__ex2g4s.q()) {
1124
1253
  var element = _iterator__ex2g4s.r();
1125
1254
  if (element instanceof MarkdownComponent)
1126
- result = result + element.el() | 0;
1255
+ result = result + element.contentLength() | 0;
1127
1256
  }
1128
1257
  }
1129
1258
  return result;
1130
1259
  }
1131
- lk() {
1260
+ elementEndWithEndOfLineEquivalent() {
1132
1261
  return this.children.length > 0;
1133
1262
  }
1263
+ get mustBeDirectChildOfDocument() {
1264
+ return this.gn();
1265
+ }
1134
1266
  }
1135
1267
  class LeafElement extends BlockElement {
1136
- bn() {
1268
+ isIntentionallyEmpty() {
1137
1269
  return false;
1138
1270
  }
1139
- nk() {
1271
+ normalizeContent() {
1140
1272
  this.normalize();
1141
- if (this.childNodes.length === 0 && !this.bn()) {
1273
+ if (this.childNodes.length === 0 && !this.isIntentionallyEmpty()) {
1142
1274
  this.remove();
1143
1275
  return true;
1144
1276
  }
@@ -1159,7 +1291,7 @@ class LeafElement extends BlockElement {
1159
1291
  while (_iterator__ex2g4s_0.q()) {
1160
1292
  var element = _iterator__ex2g4s_0.r();
1161
1293
  if (element instanceof HTMLBRElement) {
1162
- this.rm(element);
1294
+ this.pushNodesAfterBreakToParent(element);
1163
1295
  this.removeChild(element);
1164
1296
  if (this.childNodes.length === 0) {
1165
1297
  this.appendChild(document.createTextNode(get_ZERO_WIDTH_SPACE()));
@@ -1167,8 +1299,8 @@ class LeafElement extends BlockElement {
1167
1299
  return true;
1168
1300
  } else {
1169
1301
  if (element instanceof MarkdownComponent) {
1170
- if (element.nk())
1171
- return this.nk();
1302
+ if (element.normalizeContent())
1303
+ return this.normalizeContent();
1172
1304
  } else {
1173
1305
  if (element instanceof Text) {
1174
1306
  var tmp0_safe_receiver = element.textContent;
@@ -1188,15 +1320,15 @@ class LeafElement extends BlockElement {
1188
1320
  }
1189
1321
  return false;
1190
1322
  }
1191
- yk(currentSelection) {
1192
- this.cn(currentSelection, this.previousElementSibling);
1323
+ mergeWithPrevious(currentSelection) {
1324
+ this.mergeWith(currentSelection, this.previousElementSibling);
1193
1325
  }
1194
- cn(currentSelection, other) {
1326
+ mergeWith(currentSelection, other) {
1195
1327
  if (other == null)
1196
1328
  return Unit_instance;
1197
1329
  if (other instanceof LeafElement) {
1198
1330
  if ((currentSelection == null ? null : currentSelection.containsNode(this, true)) === true) {
1199
- other.wm(currentSelection);
1331
+ other.setSelectionToEnd(currentSelection);
1200
1332
  }
1201
1333
  // Inline function 'kotlin.collections.forEach' call
1202
1334
  var _iterator__ex2g4s = toList(asList(this.childNodes)).p();
@@ -1207,11 +1339,11 @@ class LeafElement extends BlockElement {
1207
1339
  this.remove();
1208
1340
  } else {
1209
1341
  if (other instanceof ContainerElement) {
1210
- this.cn(currentSelection, other.lastElementChild);
1342
+ this.mergeWith(currentSelection, other.lastElementChild);
1211
1343
  }
1212
1344
  }
1213
1345
  }
1214
- al() {
1346
+ mergeNextIn() {
1215
1347
  var next = this.nextElementSibling;
1216
1348
  if (next instanceof LeafElement) {
1217
1349
  // Inline function 'kotlin.collections.forEach' call
@@ -1223,7 +1355,7 @@ class LeafElement extends BlockElement {
1223
1355
  next.remove();
1224
1356
  }
1225
1357
  }
1226
- lk() {
1358
+ elementEndWithEndOfLineEquivalent() {
1227
1359
  var tmp;
1228
1360
  var tmp0_safe_receiver = this.textContent;
1229
1361
  var tmp_0;
@@ -1240,22 +1372,28 @@ class LeafElement extends BlockElement {
1240
1372
  }
1241
1373
  return tmp;
1242
1374
  }
1375
+ get mustBeDirectChildOfDocument() {
1376
+ return this.gn();
1377
+ }
1243
1378
  }
1244
1379
  class Heading extends LeafElement {
1245
1380
  constructor() {
1246
1381
  super();
1247
- this.ym_1 = true;
1382
+ this.hn_1 = true;
1383
+ }
1384
+ gn() {
1385
+ return this.hn_1;
1248
1386
  }
1249
- hk() {
1250
- return this.ym_1;
1387
+ getMarkdown() {
1388
+ return repeat('#', this.depth) + ' ' + getMarkdownWithTextForElement(this) + '\n';
1251
1389
  }
1252
- vm() {
1390
+ newEmptyElementNameAfterBreak() {
1253
1391
  return 'markdown-paragraph';
1254
1392
  }
1255
- km() {
1393
+ containsMarkdownTextContent() {
1256
1394
  return true;
1257
1395
  }
1258
- an() {
1396
+ renderHeading() {
1259
1397
  // Inline function 'org.w3c.dom.OPEN' call
1260
1398
  // Inline function 'kotlin.js.asDynamic' call
1261
1399
  // Inline function 'kotlin.js.unsafeCast' call
@@ -1264,24 +1402,30 @@ class Heading extends LeafElement {
1264
1402
  o['mode'] = 'open';
1265
1403
  // Inline function 'kotlin.apply' call
1266
1404
  var this_0 = this.attachShadow(o);
1267
- style(this_0, trimIndent('\n :host {\n position: relative;\n min-height: 1em;\n }\n h' + this.zm() + ' {\n font-size: var(--header' + this.zm() + '-font-size);\n }\n '));
1268
- var tmp = 'h' + this.zm();
1405
+ style(this_0, trimIndent('\n :host {\n position: relative;\n min-height: 1em;\n }\n h' + this.depth + ' {\n font-size: var(--header' + this.depth + '-font-size);\n }\n '));
1406
+ var tmp = 'h' + this.depth;
1269
1407
  element(this_0, tmp, Heading$renderHeading$lambda);
1270
1408
  }
1409
+ get depth() {
1410
+ return this.in();
1411
+ }
1412
+ get mustBeDirectChildOfDocument() {
1413
+ return this.gn();
1414
+ }
1271
1415
  }
1272
1416
  class InlineElement extends MarkdownComponent {
1273
1417
  constructor() {
1274
1418
  super();
1275
- this.dn_1 = false;
1419
+ this.jn_1 = false;
1276
1420
  }
1277
- hk() {
1278
- return this.dn_1;
1421
+ gn() {
1422
+ return this.jn_1;
1279
1423
  }
1280
- nk() {
1424
+ normalizeContent() {
1281
1425
  var next = this.nextSibling;
1282
1426
  var tmp;
1283
1427
  var tmp_0;
1284
- if (this.en()) {
1428
+ if (this.mergeSameSiblings()) {
1285
1429
  tmp_0 = next instanceof InlineElement;
1286
1430
  } else {
1287
1431
  tmp_0 = false;
@@ -1303,7 +1447,7 @@ class InlineElement extends MarkdownComponent {
1303
1447
  null;
1304
1448
  else
1305
1449
  tmp0_safe_receiver.removeChild(next);
1306
- this.nk();
1450
+ this.normalizeContent();
1307
1451
  return true;
1308
1452
  }
1309
1453
  // Inline function 'kotlin.collections.forEach' call
@@ -1311,12 +1455,12 @@ class InlineElement extends MarkdownComponent {
1311
1455
  while (_iterator__ex2g4s_0.q()) {
1312
1456
  var element_0 = _iterator__ex2g4s_0.r();
1313
1457
  if (element_0 instanceof HTMLBRElement) {
1314
- this.fn(element_0);
1458
+ this.pushBreakAndNodesAfterToParent(element_0);
1315
1459
  return true;
1316
1460
  } else {
1317
1461
  if (element_0 instanceof MarkdownComponent) {
1318
- if (element_0.nk())
1319
- return this.nk();
1462
+ if (element_0.normalizeContent())
1463
+ return this.normalizeContent();
1320
1464
  } else {
1321
1465
  if (normalizeUnknownChild(element_0)) {
1322
1466
  return true;
@@ -1326,38 +1470,90 @@ class InlineElement extends MarkdownComponent {
1326
1470
  }
1327
1471
  return false;
1328
1472
  }
1329
- en() {
1473
+ mergeSameSiblings() {
1330
1474
  return false;
1331
1475
  }
1332
- yk(currentSelection) {
1476
+ getMarkdown() {
1477
+ return getMarkdownWithTextForElement(this);
1478
+ }
1479
+ mergeWithPrevious(currentSelection) {
1333
1480
  var tmp = this.parentNode;
1334
1481
  var tmp0_safe_receiver = tmp instanceof MarkdownComponent ? tmp : null;
1335
1482
  if (tmp0_safe_receiver == null)
1336
1483
  null;
1337
1484
  else {
1338
- tmp0_safe_receiver.yk(currentSelection);
1485
+ tmp0_safe_receiver.mergeWithPrevious(currentSelection);
1339
1486
  }
1340
1487
  }
1341
- al() {
1488
+ mergeNextIn() {
1342
1489
  var tmp = this.parentNode;
1343
1490
  var tmp0_safe_receiver = tmp instanceof MarkdownComponent ? tmp : null;
1344
1491
  if (tmp0_safe_receiver == null)
1345
1492
  null;
1346
1493
  else {
1347
- tmp0_safe_receiver.al();
1494
+ tmp0_safe_receiver.mergeNextIn();
1348
1495
  }
1349
1496
  }
1497
+ get mustBeDirectChildOfDocument() {
1498
+ return this.gn();
1499
+ }
1500
+ }
1501
+ class TerminalInlineElement extends MarkdownComponent {
1502
+ get mustBeDirectChildOfDocument() {
1503
+ return this.gn();
1504
+ }
1350
1505
  }
1351
- class TerminalInlineElement extends MarkdownComponent {}
1352
1506
  class ListItem extends ContainerElement {
1353
1507
  constructor() {
1354
1508
  super();
1355
- this.gn_1 = false;
1509
+ this.kn_1 = false;
1356
1510
  }
1357
- hk() {
1358
- return this.gn_1;
1511
+ gn() {
1512
+ return this.kn_1;
1359
1513
  }
1360
- nk() {
1514
+ ln() {
1515
+ var depth = 0;
1516
+ var ancestor = this.parentNode;
1517
+ $l$loop: while (true) {
1518
+ var tmp;
1519
+ if (!(ancestor == null)) {
1520
+ // Inline function 'kotlin.text.lowercase' call
1521
+ // Inline function 'kotlin.js.asDynamic' call
1522
+ tmp = !(ancestor.nodeName.toLowerCase() === 'markdown-document');
1523
+ } else {
1524
+ tmp = false;
1525
+ }
1526
+ if (!tmp) {
1527
+ break $l$loop;
1528
+ }
1529
+ var tmp_0;
1530
+ // Inline function 'kotlin.text.lowercase' call
1531
+ // Inline function 'kotlin.js.asDynamic' call
1532
+ if (ancestor.nodeName.toLowerCase() === 'markdown-list') {
1533
+ tmp_0 = true;
1534
+ } else {
1535
+ // Inline function 'kotlin.text.lowercase' call
1536
+ // Inline function 'kotlin.js.asDynamic' call
1537
+ tmp_0 = ancestor.nodeName.toLowerCase() === 'markdown-numeric-list';
1538
+ }
1539
+ if (tmp_0) {
1540
+ depth = depth + 1 | 0;
1541
+ }
1542
+ ancestor = ancestor.parentNode;
1543
+ }
1544
+ return depth;
1545
+ }
1546
+ getMarkdown() {
1547
+ return repeat(' ', this.ln()) + '- ' + this.mn() + this.nn();
1548
+ }
1549
+ mn() {
1550
+ return '';
1551
+ }
1552
+ nn() {
1553
+ var tmp = asList(this.childNodes);
1554
+ return joinToString(tmp, '', VOID, VOID, VOID, VOID, ListItem$getMarkdownWithTextForElement$lambda);
1555
+ }
1556
+ normalizeContent() {
1361
1557
  this.normalize();
1362
1558
  if (this.childNodes.length === 0) {
1363
1559
  this.remove();
@@ -1368,13 +1564,13 @@ class ListItem extends ContainerElement {
1368
1564
  while (_iterator__ex2g4s.q()) {
1369
1565
  var element = _iterator__ex2g4s.r();
1370
1566
  if (element instanceof HTMLBRElement) {
1371
- this.rm(element);
1567
+ this.pushNodesAfterBreakToParent(element);
1372
1568
  this.removeChild(element);
1373
1569
  return true;
1374
1570
  } else {
1375
1571
  if (element instanceof MarkdownComponent) {
1376
- if (element.nk())
1377
- return this.nk();
1572
+ if (element.normalizeContent())
1573
+ return this.normalizeContent();
1378
1574
  } else {
1379
1575
  if (element instanceof Text) {
1380
1576
  var tmp0_safe_receiver = element.textContent;
@@ -1394,7 +1590,7 @@ class ListItem extends ContainerElement {
1394
1590
  }
1395
1591
  return false;
1396
1592
  }
1397
- el() {
1593
+ contentLength() {
1398
1594
  var result = 0;
1399
1595
  // Inline function 'kotlin.collections.forEach' call
1400
1596
  var _iterator__ex2g4s = asList(this.childNodes).p();
@@ -1403,7 +1599,7 @@ class ListItem extends ContainerElement {
1403
1599
  var tmp = result;
1404
1600
  var tmp_0;
1405
1601
  if (element instanceof MarkdownComponent) {
1406
- tmp_0 = element.el();
1602
+ tmp_0 = element.contentLength();
1407
1603
  } else {
1408
1604
  if (element instanceof HTMLBRElement) {
1409
1605
  tmp_0 = 1;
@@ -1416,21 +1612,21 @@ class ListItem extends ContainerElement {
1416
1612
  }
1417
1613
  result = tmp + tmp_0 | 0;
1418
1614
  }
1419
- return result + this.xm() | 0;
1615
+ return result + this.endOfLineEquivalentLength() | 0;
1420
1616
  }
1421
- jk(child) {
1617
+ contentLengthUntil(child) {
1422
1618
  var nodes = asList(this.childNodes);
1423
- var indexOfChild = child == null ? -1 : nodes.m1(child);
1619
+ var indexOfChild = child == null ? -1 : nodes.n1(child);
1424
1620
  var result = 0;
1425
1621
  if (indexOfChild >= 0) {
1426
1622
  // Inline function 'kotlin.collections.forEach' call
1427
- var _iterator__ex2g4s = nodes.n1(0, indexOfChild).p();
1623
+ var _iterator__ex2g4s = nodes.o1(0, indexOfChild).p();
1428
1624
  while (_iterator__ex2g4s.q()) {
1429
1625
  var element = _iterator__ex2g4s.r();
1430
1626
  var tmp = result;
1431
1627
  var tmp_0;
1432
1628
  if (element instanceof MarkdownComponent) {
1433
- tmp_0 = element.el();
1629
+ tmp_0 = element.contentLength();
1434
1630
  } else {
1435
1631
  if (element instanceof HTMLBRElement) {
1436
1632
  tmp_0 = 1;
@@ -1446,11 +1642,11 @@ class ListItem extends ContainerElement {
1446
1642
  }
1447
1643
  return result;
1448
1644
  }
1449
- yk(currentSelection) {
1645
+ mergeWithPrevious(currentSelection) {
1450
1646
  var previous = this.previousElementSibling;
1451
1647
  if (previous instanceof ListItem) {
1452
1648
  if ((currentSelection == null ? null : currentSelection.containsNode(this, true)) === true) {
1453
- previous.wm(currentSelection);
1649
+ previous.setSelectionToEnd(currentSelection);
1454
1650
  }
1455
1651
  // Inline function 'kotlin.collections.forEach' call
1456
1652
  var _iterator__ex2g4s = toList(asList(this.childNodes)).p();
@@ -1483,7 +1679,7 @@ class ListItem extends ContainerElement {
1483
1679
  }
1484
1680
  }
1485
1681
  }
1486
- al() {
1682
+ mergeNextIn() {
1487
1683
  var next = this.nextElementSibling;
1488
1684
  if (next instanceof ListItem) {
1489
1685
  // Inline function 'kotlin.collections.forEach' call
@@ -1495,7 +1691,7 @@ class ListItem extends ContainerElement {
1495
1691
  next.remove();
1496
1692
  }
1497
1693
  }
1498
- lk() {
1694
+ elementEndWithEndOfLineEquivalent() {
1499
1695
  var tmp;
1500
1696
  var tmp0_safe_receiver = this.textContent;
1501
1697
  var tmp_0;
@@ -1512,21 +1708,24 @@ class ListItem extends ContainerElement {
1512
1708
  }
1513
1709
  return tmp;
1514
1710
  }
1515
- km() {
1711
+ containsMarkdownTextContent() {
1516
1712
  return true;
1517
1713
  }
1714
+ get mustBeDirectChildOfDocument() {
1715
+ return this.gn();
1716
+ }
1518
1717
  }
1519
1718
  class MarkdownElementWithLevel {}
1520
1719
  class MarkdownElementEscapeByBackspace {}
1521
1720
  class TableCell extends ContainerElement {
1522
1721
  constructor() {
1523
1722
  super();
1524
- this.hn_1 = false;
1723
+ this.on_1 = false;
1525
1724
  }
1526
- hk() {
1527
- return this.hn_1;
1725
+ gn() {
1726
+ return this.on_1;
1528
1727
  }
1529
- in(hostCss) {
1728
+ pn(hostCss) {
1530
1729
  // Inline function 'org.w3c.dom.OPEN' call
1531
1730
  // Inline function 'kotlin.js.asDynamic' call
1532
1731
  // Inline function 'kotlin.js.unsafeCast' call
@@ -1538,14 +1737,21 @@ class TableCell extends ContainerElement {
1538
1737
  style(this_0, ':host { ' + hostCss + ' }');
1539
1738
  slot(this_0);
1540
1739
  }
1541
- km() {
1740
+ getMarkdown() {
1741
+ var tmp = asList(this.childNodes);
1742
+ return joinToString(tmp, '', VOID, VOID, VOID, VOID, TableCell$getMarkdown$lambda);
1743
+ }
1744
+ containsMarkdownTextContent() {
1542
1745
  return true;
1543
1746
  }
1747
+ get mustBeDirectChildOfDocument() {
1748
+ return this.gn();
1749
+ }
1544
1750
  }
1545
1751
  class MarkdownBreak extends LeafElement {
1546
1752
  constructor() {
1547
1753
  super();
1548
- this.jn_1 = true;
1754
+ this.qn_1 = true;
1549
1755
  // Inline function 'org.w3c.dom.OPEN' call
1550
1756
  // Inline function 'kotlin.js.asDynamic' call
1551
1757
  // Inline function 'kotlin.js.unsafeCast' call
@@ -1554,20 +1760,26 @@ class MarkdownBreak extends LeafElement {
1554
1760
  o['mode'] = 'open';
1555
1761
  element(this.attachShadow(o), 'hr');
1556
1762
  }
1557
- hk() {
1558
- return this.jn_1;
1763
+ gn() {
1764
+ return this.qn_1;
1559
1765
  }
1560
- km() {
1766
+ getMarkdown() {
1767
+ return '-----------------------\n';
1768
+ }
1769
+ containsMarkdownTextContent() {
1561
1770
  return false;
1562
1771
  }
1563
- bn() {
1772
+ isIntentionallyEmpty() {
1564
1773
  return true;
1565
1774
  }
1775
+ get mustBeDirectChildOfDocument() {
1776
+ return this.gn();
1777
+ }
1566
1778
  }
1567
1779
  class MarkdownCode extends LeafElement {
1568
1780
  constructor() {
1569
1781
  super();
1570
- this.kn_1 = true;
1782
+ this.rn_1 = true;
1571
1783
  // Inline function 'org.w3c.dom.OPEN' call
1572
1784
  // Inline function 'kotlin.js.asDynamic' call
1573
1785
  // Inline function 'kotlin.js.unsafeCast' call
@@ -1577,25 +1789,33 @@ class MarkdownCode extends LeafElement {
1577
1789
  var tmp = element(this.attachShadow(o), 'pre');
1578
1790
  element(tmp, 'code', MarkdownCode$lambda);
1579
1791
  }
1580
- hk() {
1581
- return this.kn_1;
1792
+ gn() {
1793
+ return this.rn_1;
1794
+ }
1795
+ getMarkdown() {
1796
+ var lang = this.getAttribute('lang');
1797
+ var id = this.getAttribute('id');
1798
+ return !(id == null) ? '``` ' + lang + ' {' + id + '}\n' + this.textContent + '\n```\n' : '``` ' + lang + '\n' + this.textContent + '\n```\n';
1582
1799
  }
1583
- w9() {
1584
- super.w9();
1800
+ ac() {
1801
+ super.ac();
1585
1802
  highlight(this);
1586
1803
  this.addEventListener('input', MarkdownCode$connectedCallback$lambda(this));
1587
1804
  }
1588
1805
  connectedCallback() {
1589
- return this.w9();
1806
+ return this.ac();
1590
1807
  }
1591
- km() {
1808
+ containsMarkdownTextContent() {
1592
1809
  return true;
1593
1810
  }
1811
+ get mustBeDirectChildOfDocument() {
1812
+ return this.gn();
1813
+ }
1594
1814
  }
1595
1815
  class MarkdownCodeSpan extends TerminalInlineElement {
1596
1816
  constructor() {
1597
1817
  super();
1598
- this.ln_1 = false;
1818
+ this.sn_1 = false;
1599
1819
  // Inline function 'org.w3c.dom.OPEN' call
1600
1820
  // Inline function 'kotlin.js.asDynamic' call
1601
1821
  // Inline function 'kotlin.js.unsafeCast' call
@@ -1605,12 +1825,18 @@ class MarkdownCodeSpan extends TerminalInlineElement {
1605
1825
  var tmp = this.attachShadow(o);
1606
1826
  element(tmp, 'code', MarkdownCodeSpan$lambda);
1607
1827
  }
1608
- hk() {
1609
- return this.ln_1;
1828
+ gn() {
1829
+ return this.sn_1;
1830
+ }
1831
+ getMarkdown() {
1832
+ return '`' + getMarkdownWithTextForElement(this) + '`';
1610
1833
  }
1611
- km() {
1834
+ containsMarkdownTextContent() {
1612
1835
  return true;
1613
1836
  }
1837
+ get mustBeDirectChildOfDocument() {
1838
+ return this.gn();
1839
+ }
1614
1840
  }
1615
1841
  class MarkdownEmphasis extends InlineElement {
1616
1842
  constructor() {
@@ -1624,74 +1850,79 @@ class MarkdownEmphasis extends InlineElement {
1624
1850
  var tmp = this.attachShadow(o);
1625
1851
  element(tmp, 'i', MarkdownEmphasis$lambda);
1626
1852
  }
1627
- km() {
1853
+ getMarkdown() {
1854
+ // Inline function 'kotlin.text.trim' call
1855
+ var this_0 = super.getMarkdown();
1856
+ return '*' + toString_0(trim(isCharSequence(this_0) ? this_0 : THROW_CCE())) + '*';
1857
+ }
1858
+ containsMarkdownTextContent() {
1628
1859
  return true;
1629
1860
  }
1630
1861
  }
1631
1862
  class MarkdownHeading1 extends Heading {
1632
1863
  constructor() {
1633
1864
  super();
1634
- this.on_1 = 1;
1635
- this.an();
1865
+ this.un_1 = 1;
1866
+ this.renderHeading();
1636
1867
  }
1637
- zm() {
1638
- return this.on_1;
1868
+ in() {
1869
+ return this.un_1;
1639
1870
  }
1640
1871
  }
1641
1872
  class MarkdownHeading2 extends Heading {
1642
1873
  constructor() {
1643
1874
  super();
1644
- this.qn_1 = 2;
1645
- this.an();
1875
+ this.wn_1 = 2;
1876
+ this.renderHeading();
1646
1877
  }
1647
- zm() {
1648
- return this.qn_1;
1878
+ in() {
1879
+ return this.wn_1;
1649
1880
  }
1650
1881
  }
1651
1882
  class MarkdownHeading3 extends Heading {
1652
1883
  constructor() {
1653
1884
  super();
1654
- this.sn_1 = 3;
1655
- this.an();
1885
+ this.yn_1 = 3;
1886
+ this.renderHeading();
1656
1887
  }
1657
- zm() {
1658
- return this.sn_1;
1888
+ in() {
1889
+ return this.yn_1;
1659
1890
  }
1660
1891
  }
1661
1892
  class MarkdownHeading4 extends Heading {
1662
1893
  constructor() {
1663
1894
  super();
1664
- this.un_1 = 4;
1665
- this.an();
1895
+ this.ao_1 = 4;
1896
+ this.renderHeading();
1666
1897
  }
1667
- zm() {
1668
- return this.un_1;
1898
+ in() {
1899
+ return this.ao_1;
1669
1900
  }
1670
1901
  }
1671
1902
  class MarkdownHeading5 extends Heading {
1672
1903
  constructor() {
1673
1904
  super();
1674
- this.wn_1 = 5;
1675
- this.an();
1905
+ this.co_1 = 5;
1906
+ this.renderHeading();
1676
1907
  }
1677
- zm() {
1678
- return this.wn_1;
1908
+ in() {
1909
+ return this.co_1;
1679
1910
  }
1680
1911
  }
1681
1912
  class MarkdownHeading6 extends Heading {
1682
1913
  constructor() {
1683
1914
  super();
1684
- this.yn_1 = 6;
1685
- this.an();
1915
+ this.eo_1 = 6;
1916
+ this.renderHeading();
1686
1917
  }
1687
- zm() {
1688
- return this.yn_1;
1918
+ in() {
1919
+ return this.eo_1;
1689
1920
  }
1690
1921
  }
1691
1922
  class MarkdownHtml extends LeafElement {
1692
1923
  constructor() {
1693
1924
  super();
1694
- this.zn_1 = false;
1925
+ this.fo_1 = false;
1695
1926
  // Inline function 'org.w3c.dom.OPEN' call
1696
1927
  // Inline function 'kotlin.js.asDynamic' call
1697
1928
  // Inline function 'kotlin.js.unsafeCast' call
@@ -1700,20 +1931,28 @@ class MarkdownHtml extends LeafElement {
1700
1931
  o['mode'] = 'open';
1701
1932
  slot(this.attachShadow(o));
1702
1933
  }
1703
- hk() {
1704
- return this.zn_1;
1934
+ gn() {
1935
+ return this.fo_1;
1705
1936
  }
1706
- ik() {
1937
+ isEditable() {
1707
1938
  return false;
1708
1939
  }
1709
- km() {
1940
+ getMarkdown() {
1941
+ // Inline function 'kotlin.text.trim' call
1942
+ var this_0 = this.innerHTML;
1943
+ return toString_0(trim(isCharSequence(this_0) ? this_0 : THROW_CCE())) + '\n\n';
1944
+ }
1945
+ containsMarkdownTextContent() {
1710
1946
  return true;
1711
1947
  }
1948
+ get mustBeDirectChildOfDocument() {
1949
+ return this.gn();
1950
+ }
1712
1951
  }
1713
1952
  class MarkdownImage extends TerminalInlineElement {
1714
1953
  constructor() {
1715
1954
  super();
1716
- this.ok_1 = false;
1955
+ this.ul_1 = false;
1717
1956
  // Inline function 'org.w3c.dom.OPEN' call
1718
1957
  // Inline function 'kotlin.js.asDynamic' call
1719
1958
  // Inline function 'kotlin.js.unsafeCast' call
@@ -1724,50 +1963,76 @@ class MarkdownImage extends TerminalInlineElement {
1724
1963
  style(shadow, ':host([destination]) .upload {\n display: none;\n}\n.upload {\n border: #c7c7c7 1px dashed;\n padding: 10px;\n}');
1725
1964
  var tmp = this;
1726
1965
  var tmp_0 = element(shadow, 'input', MarkdownImage$lambda);
1727
- tmp.qk_1 = tmp_0 instanceof HTMLInputElement ? tmp_0 : THROW_CCE();
1728
- this.qk_1.addEventListener('change', MarkdownImage$lambda_0(this));
1966
+ tmp.uploadInput = tmp_0 instanceof HTMLInputElement ? tmp_0 : THROW_CCE();
1967
+ this.uploadInput.addEventListener('change', MarkdownImage$lambda_0(this));
1729
1968
  var tmp_1 = this;
1730
1969
  var tmp_2 = element(shadow, 'img', MarkdownImage$lambda_1);
1731
- tmp_1.pk_1 = tmp_2 instanceof HTMLImageElement ? tmp_2 : THROW_CCE();
1732
- this.pk_1.addEventListener('error', MarkdownImage$lambda_2(this));
1970
+ tmp_1.img = tmp_2 instanceof HTMLImageElement ? tmp_2 : THROW_CCE();
1971
+ this.img.addEventListener('error', MarkdownImage$lambda_2(this));
1733
1972
  element(shadow, 'slot', MarkdownImage$lambda_3);
1734
1973
  }
1735
- hk() {
1736
- return this.ok_1;
1974
+ gn() {
1975
+ return this.ul_1;
1737
1976
  }
1738
- rk(value) {
1977
+ go() {
1978
+ return this.img;
1979
+ }
1980
+ ho() {
1981
+ return this.uploadInput;
1982
+ }
1983
+ vl(value) {
1739
1984
  return this.setAttribute('destination', value);
1740
1985
  }
1741
- ao() {
1986
+ io() {
1742
1987
  var tmp0_elvis_lhs = this.getAttribute('destination');
1743
1988
  return tmp0_elvis_lhs == null ? '' : tmp0_elvis_lhs;
1744
1989
  }
1745
- w9() {
1746
- super.w9();
1747
- updateImage(this);
1990
+ ac() {
1991
+ super.ac();
1992
+ this.render();
1748
1993
  }
1749
1994
  connectedCallback() {
1750
- return this.w9();
1995
+ return this.ac();
1751
1996
  }
1752
- z9(name, oldValue, newValue) {
1997
+ dc(name, oldValue, newValue) {
1753
1998
  if (name === 'destination' || name === 'title') {
1754
- updateImage(this);
1999
+ this.render();
1755
2000
  }
1756
2001
  }
1757
2002
  attributeChangedCallback(name, oldValue, newValue) {
1758
- return this.z9(name, oldValue, newValue);
2003
+ return this.dc(name, oldValue, newValue);
1759
2004
  }
1760
- km() {
2005
+ render() {
2006
+ this.img.src = this.destination;
2007
+ this.img.title = this.title;
2008
+ this.img.alt = this.innerText;
2009
+ }
2010
+ setImageSrc(src) {
2011
+ this.img.src = src;
2012
+ }
2013
+ getMarkdown() {
2014
+ return '![' + this.innerText + '](' + this.destination + ' "' + this.title + '")';
2015
+ }
2016
+ containsMarkdownTextContent() {
1761
2017
  return false;
1762
2018
  }
1763
- xk() {
2019
+ isDeletableAsAWhole() {
1764
2020
  return true;
1765
2021
  }
2022
+ get mustBeDirectChildOfDocument() {
2023
+ return this.gn();
2024
+ }
2025
+ get destination() {
2026
+ return this.io();
2027
+ }
2028
+ set destination(value) {
2029
+ this.vl(value);
2030
+ }
1766
2031
  }
1767
2032
  class MarkdownLink extends TerminalInlineElement {
1768
2033
  constructor() {
1769
2034
  super();
1770
- this.yl_1 = false;
2035
+ this.rm_1 = false;
1771
2036
  // Inline function 'org.w3c.dom.OPEN' call
1772
2037
  // Inline function 'kotlin.js.asDynamic' call
1773
2038
  // Inline function 'kotlin.js.unsafeCast' call
@@ -1781,54 +2046,68 @@ class MarkdownLink extends TerminalInlineElement {
1781
2046
  // Inline function 'kotlin.also' call
1782
2047
  var this_0 = tmp_0 instanceof HTMLAnchorElement ? tmp_0 : THROW_CCE();
1783
2048
  slot(this_0);
1784
- tmp.zl_1 = this_0;
2049
+ tmp.sm_1 = this_0;
1785
2050
  var showLink = element(shadow, 'span', MarkdownLink$lambda_0);
1786
2051
  showLink.addEventListener('click', MarkdownLink$lambda_1(this));
1787
2052
  var tmp_1 = this;
1788
2053
  var tmp_2 = element(shadow, 'input', MarkdownLink$lambda_2);
1789
- tmp_1.am_1 = tmp_2 instanceof HTMLInputElement ? tmp_2 : THROW_CCE();
1790
- this.am_1.addEventListener('input', MarkdownLink$lambda_3(this));
1791
- this.am_1.addEventListener('blur', MarkdownLink$lambda_4(this));
1792
- this.am_1.addEventListener('keydown', MarkdownLink$lambda_5(this));
2054
+ tmp_1.tm_1 = tmp_2 instanceof HTMLInputElement ? tmp_2 : THROW_CCE();
2055
+ this.tm_1.addEventListener('input', MarkdownLink$lambda_3(this));
2056
+ this.tm_1.addEventListener('blur', MarkdownLink$lambda_4(this));
2057
+ this.tm_1.addEventListener('keydown', MarkdownLink$lambda_5(this));
1793
2058
  }
1794
- hk() {
1795
- return this.yl_1;
2059
+ gn() {
2060
+ return this.rm_1;
1796
2061
  }
1797
- rk(value) {
2062
+ vl(value) {
1798
2063
  return this.setAttribute('destination', value);
1799
2064
  }
1800
- ao() {
2065
+ io() {
1801
2066
  var tmp0_elvis_lhs = this.getAttribute('destination');
1802
2067
  return tmp0_elvis_lhs == null ? '' : tmp0_elvis_lhs;
1803
2068
  }
1804
- w9() {
1805
- super.w9();
2069
+ ac() {
2070
+ super.ac();
1806
2071
  var tmp = window;
1807
2072
  tmp.setTimeout(MarkdownLink$connectedCallback$lambda(this), 5000);
1808
2073
  updateLinkTarget(this);
1809
2074
  }
1810
2075
  connectedCallback() {
1811
- return this.w9();
2076
+ return this.ac();
1812
2077
  }
1813
- z9(name, oldValue, newValue) {
2078
+ dc(name, oldValue, newValue) {
1814
2079
  if (name === 'destination' || name === 'title') {
1815
2080
  updateLinkTarget(this);
1816
2081
  }
1817
2082
  }
1818
2083
  attributeChangedCallback(name, oldValue, newValue) {
1819
- return this.z9(name, oldValue, newValue);
2084
+ return this.dc(name, oldValue, newValue);
1820
2085
  }
1821
- vm() {
2086
+ newEmptyElementNameAfterBreak() {
1822
2087
  return null;
1823
2088
  }
1824
- km() {
2089
+ getMarkdown() {
2090
+ var tmp;
2091
+ // Inline function 'kotlin.text.isNotEmpty' call
2092
+ var this_0 = this.title;
2093
+ if (charSequenceLength(this_0) > 0) {
2094
+ tmp = '[' + this.innerText + '](' + this.io() + ' "' + this.title + '")';
2095
+ } else {
2096
+ tmp = '[' + this.innerText + '](' + this.io() + ')';
2097
+ }
2098
+ return tmp;
2099
+ }
2100
+ containsMarkdownTextContent() {
1825
2101
  return true;
1826
2102
  }
2103
+ get mustBeDirectChildOfDocument() {
2104
+ return this.gn();
2105
+ }
1827
2106
  }
1828
2107
  class MarkdownList extends ContainerElement {
1829
2108
  constructor() {
1830
2109
  super();
1831
- this.bo_1 = false;
2110
+ this.jo_1 = false;
1832
2111
  // Inline function 'org.w3c.dom.OPEN' call
1833
2112
  // Inline function 'kotlin.js.asDynamic' call
1834
2113
  // Inline function 'kotlin.js.unsafeCast' call
@@ -1840,13 +2119,16 @@ class MarkdownList extends ContainerElement {
1840
2119
  style(this_0, ":host {\n counter-reset: section;\n}\n:host ::slotted(*) {\n display: list-item;\n}\n:host([ordered='true']) ::slotted(*) {\n list-style-type: decimal;\n}");
1841
2120
  slot(this_0);
1842
2121
  }
1843
- hk() {
1844
- return this.bo_1;
2122
+ gn() {
2123
+ return this.jo_1;
1845
2124
  }
1846
- km() {
2125
+ getMarkdown() {
2126
+ return super.getMarkdown() + '\n';
2127
+ }
2128
+ containsMarkdownTextContent() {
1847
2129
  return false;
1848
2130
  }
1849
- bl(child) {
2131
+ bm(child) {
1850
2132
  if (child == null)
1851
2133
  return Unit_instance;
1852
2134
  var list = document.createElement('markdown-list');
@@ -1856,7 +2138,7 @@ class MarkdownList extends ContainerElement {
1856
2138
  child.innerHTML = '&nbsp';
1857
2139
  child.appendChild(list);
1858
2140
  }
1859
- cl(child) {
2141
+ cm(child) {
1860
2142
  if (child == null)
1861
2143
  return Unit_instance;
1862
2144
  var tmp0_safe_receiver = this.parentElement;
@@ -1869,7 +2151,7 @@ class MarkdownList extends ContainerElement {
1869
2151
  }
1870
2152
  var nextUp = tmp;
1871
2153
  var nodes = asList(this.childNodes);
1872
- var indexOfChild = nodes.m1(child);
2154
+ var indexOfChild = nodes.n1(child);
1873
2155
  // Inline function 'kotlin.collections.forEach' call
1874
2156
  var _iterator__ex2g4s = drop(nodes, indexOfChild).p();
1875
2157
  while (_iterator__ex2g4s.q()) {
@@ -1877,6 +2159,9 @@ class MarkdownList extends ContainerElement {
1877
2159
  nextUp.after(element);
1878
2160
  }
1879
2161
  }
2162
+ get mustBeDirectChildOfDocument() {
2163
+ return this.gn();
2164
+ }
1880
2165
  }
1881
2166
  class MarkdownListItem extends ListItem {
1882
2167
  constructor() {
@@ -1896,7 +2181,7 @@ class MarkdownListItem extends ListItem {
1896
2181
  class MarkdownNumericList extends ContainerElement {
1897
2182
  constructor() {
1898
2183
  super();
1899
- this.co_1 = false;
2184
+ this.ko_1 = false;
1900
2185
  // Inline function 'org.w3c.dom.OPEN' call
1901
2186
  // Inline function 'kotlin.js.asDynamic' call
1902
2187
  // Inline function 'kotlin.js.unsafeCast' call
@@ -1908,13 +2193,16 @@ class MarkdownNumericList extends ContainerElement {
1908
2193
  style(this_0, ":host {\n /* fallback for browsers without ::marker { content } support */\n list-style-type: decimal;\n /* a real <ol> gets a fresh counter scope per nesting level for free (it's baked\n into the UA stylesheet); a custom element doesn't, so this does it explicitly \u2014\n without it, nested lists just continue the outer count instead of showing 1.1 */\n counter-reset: numbered-item;\n}");
1909
2194
  slot(this_0);
1910
2195
  }
1911
- hk() {
1912
- return this.co_1;
2196
+ gn() {
2197
+ return this.ko_1;
1913
2198
  }
1914
- km() {
2199
+ getMarkdown() {
2200
+ return super.getMarkdown() + '\n';
2201
+ }
2202
+ containsMarkdownTextContent() {
1915
2203
  return false;
1916
2204
  }
1917
- bl(child) {
2205
+ bm(child) {
1918
2206
  if (child == null)
1919
2207
  return Unit_instance;
1920
2208
  var list = document.createElement('markdown-numeric-list');
@@ -1924,7 +2212,7 @@ class MarkdownNumericList extends ContainerElement {
1924
2212
  child.innerHTML = '&nbsp';
1925
2213
  child.appendChild(list);
1926
2214
  }
1927
- cl(child) {
2215
+ cm(child) {
1928
2216
  if (child == null)
1929
2217
  return Unit_instance;
1930
2218
  var tmp0_safe_receiver = this.parentElement;
@@ -1937,7 +2225,7 @@ class MarkdownNumericList extends ContainerElement {
1937
2225
  }
1938
2226
  var nextUp = tmp;
1939
2227
  var nodes = asList(this.childNodes);
1940
- var indexOfChild = nodes.m1(child);
2228
+ var indexOfChild = nodes.n1(child);
1941
2229
  // Inline function 'kotlin.collections.forEach' call
1942
2230
  var _iterator__ex2g4s = drop(nodes, indexOfChild).p();
1943
2231
  while (_iterator__ex2g4s.q()) {
@@ -1945,6 +2233,9 @@ class MarkdownNumericList extends ContainerElement {
1945
2233
  nextUp.after(element);
1946
2234
  }
1947
2235
  }
2236
+ get mustBeDirectChildOfDocument() {
2237
+ return this.gn();
2238
+ }
1948
2239
  }
1949
2240
  class MarkdownNumericListItem extends ListItem {
1950
2241
  constructor() {
@@ -1964,7 +2255,7 @@ class MarkdownNumericListItem extends ListItem {
1964
2255
  class MarkdownParagraph extends LeafElement {
1965
2256
  constructor() {
1966
2257
  super();
1967
- this.do_1 = true;
2258
+ this.lo_1 = true;
1968
2259
  // Inline function 'org.w3c.dom.OPEN' call
1969
2260
  // Inline function 'kotlin.js.asDynamic' call
1970
2261
  // Inline function 'kotlin.js.unsafeCast' call
@@ -1976,13 +2267,17 @@ class MarkdownParagraph extends LeafElement {
1976
2267
  style(this_0, ':host {\n position: relative;\n display: block;\n margin-block-start: 1em;\n margin-block-end: 1em;\n margin-inline-start: 0px;\n margin-inline-end: 0px;\n}');
1977
2268
  slot(this_0);
1978
2269
  }
1979
- hk() {
1980
- return this.do_1;
2270
+ gn() {
2271
+ return this.lo_1;
1981
2272
  }
1982
- km() {
2273
+ getMarkdown() {
2274
+ var tmp = asList(this.childNodes);
2275
+ return replace(joinToString(tmp, '', VOID, VOID, VOID, VOID, MarkdownParagraph$getMarkdown$lambda), get_ZERO_WIDTH_SPACE(), '') + '\n\n';
2276
+ }
2277
+ containsMarkdownTextContent() {
1983
2278
  return true;
1984
2279
  }
1985
- nk() {
2280
+ normalizeContent() {
1986
2281
  var onlyChild = singleOrNull(asList(this.childNodes));
1987
2282
  if (onlyChild instanceof HTMLBRElement) {
1988
2283
  onlyChild.remove();
@@ -1992,13 +2287,19 @@ class MarkdownParagraph extends LeafElement {
1992
2287
  if (tmp instanceof MarkdownComponent) {
1993
2288
  this.appendChild(document.createTextNode(get_ZERO_WIDTH_SPACE()));
1994
2289
  }
1995
- return super.nk();
2290
+ return super.normalizeContent();
2291
+ }
2292
+ isEmpty() {
2293
+ return this.getMarkdown() === '\n\n';
2294
+ }
2295
+ get mustBeDirectChildOfDocument() {
2296
+ return this.gn();
1996
2297
  }
1997
2298
  }
1998
2299
  class MarkdownQuote extends ContainerElement {
1999
2300
  constructor() {
2000
2301
  super();
2001
- this.eo_1 = true;
2302
+ this.mo_1 = true;
2002
2303
  // Inline function 'org.w3c.dom.OPEN' call
2003
2304
  // Inline function 'kotlin.js.asDynamic' call
2004
2305
  // Inline function 'kotlin.js.unsafeCast' call
@@ -2010,13 +2311,17 @@ class MarkdownQuote extends ContainerElement {
2010
2311
  style(this_0, ":host {\n position: relative;\n}\nblockquote::before {\n position: absolute;\n width: 3px;\n height: 100%;\n left: 20px;\n background-color: lightgray;\n content: '';\n}");
2011
2312
  element(this_0, 'blockquote', MarkdownQuote$lambda);
2012
2313
  }
2013
- hk() {
2014
- return this.eo_1;
2314
+ gn() {
2315
+ return this.mo_1;
2015
2316
  }
2016
- km() {
2317
+ getMarkdown() {
2318
+ var tmp = asList(this.childNodes);
2319
+ return joinToString(tmp, '', VOID, VOID, VOID, VOID, MarkdownQuote$getMarkdown$lambda);
2320
+ }
2321
+ containsMarkdownTextContent() {
2017
2322
  return true;
2018
2323
  }
2019
- yk(currentSelection) {
2324
+ mergeWithPrevious(currentSelection) {
2020
2325
  var tmp0_safe_receiver = this.firstChild;
2021
2326
  if (tmp0_safe_receiver == null)
2022
2327
  null;
@@ -2025,17 +2330,17 @@ class MarkdownQuote extends ContainerElement {
2025
2330
  this.before(tmp0_safe_receiver);
2026
2331
  }
2027
2332
  }
2028
- bl(child) {
2333
+ bm(child) {
2029
2334
  if (!(child == null)) {
2030
2335
  var quote = document.createElement('markdown-quote');
2031
2336
  child.replaceWith(quote);
2032
2337
  quote.append(child);
2033
2338
  }
2034
2339
  }
2035
- cl(child) {
2340
+ cm(child) {
2036
2341
  if (!(child == null) && this.childNodes.length > 1) {
2037
2342
  var nodes = asList(this.childNodes);
2038
- var indexOfChild = nodes.m1(child);
2343
+ var indexOfChild = nodes.n1(child);
2039
2344
  if (indexOfChild < (nodes.t() - 1 | 0)) {
2040
2345
  var quote = document.createElement('markdown-quote');
2041
2346
  this.after(quote);
@@ -2064,8 +2369,11 @@ class MarkdownQuote extends ContainerElement {
2064
2369
  this.remove();
2065
2370
  }
2066
2371
  }
2067
- zk(child) {
2068
- this.cl(child);
2372
+ am(child) {
2373
+ this.cm(child);
2374
+ }
2375
+ get mustBeDirectChildOfDocument() {
2376
+ return this.gn();
2069
2377
  }
2070
2378
  }
2071
2379
  class MarkdownStrike extends InlineElement {
@@ -2080,7 +2388,12 @@ class MarkdownStrike extends InlineElement {
2080
2388
  var tmp = this.attachShadow(o);
2081
2389
  element(tmp, 'del', MarkdownStrike$lambda);
2082
2390
  }
2083
- km() {
2391
+ getMarkdown() {
2392
+ // Inline function 'kotlin.text.trim' call
2393
+ var this_0 = super.getMarkdown();
2394
+ return '~~' + toString_0(trim(isCharSequence(this_0) ? this_0 : THROW_CCE())) + '~~';
2395
+ }
2396
+ containsMarkdownTextContent() {
2084
2397
  return true;
2085
2398
  }
2086
2399
  }
@@ -2098,17 +2411,22 @@ class MarkdownStrong extends InlineElement {
2098
2411
  style(this_0, ':host { font-weight: bold; }');
2099
2412
  slot(this_0);
2100
2413
  }
2101
- en() {
2414
+ getMarkdown() {
2415
+ // Inline function 'kotlin.text.trim' call
2416
+ var this_0 = super.getMarkdown();
2417
+ return '**' + toString_0(trim(isCharSequence(this_0) ? this_0 : THROW_CCE())) + '**';
2418
+ }
2419
+ mergeSameSiblings() {
2102
2420
  return true;
2103
2421
  }
2104
- km() {
2422
+ containsMarkdownTextContent() {
2105
2423
  return true;
2106
2424
  }
2107
2425
  }
2108
2426
  class MarkdownTable extends ContainerElement {
2109
2427
  constructor() {
2110
2428
  super();
2111
- this.ho_1 = true;
2429
+ this.no_1 = true;
2112
2430
  // Inline function 'org.w3c.dom.OPEN' call
2113
2431
  // Inline function 'kotlin.js.asDynamic' call
2114
2432
  // Inline function 'kotlin.js.unsafeCast' call
@@ -2120,29 +2438,36 @@ class MarkdownTable extends ContainerElement {
2120
2438
  style(this_0, ':host {\n display: table;\n border-collapse: collapse;\n}');
2121
2439
  slot(this_0);
2122
2440
  }
2123
- hk() {
2124
- return this.ho_1;
2441
+ gn() {
2442
+ return this.no_1;
2125
2443
  }
2126
- km() {
2444
+ getMarkdown() {
2445
+ var tmp = asList(this.children);
2446
+ return '\n' + joinToString(tmp, '\n', VOID, VOID, VOID, VOID, MarkdownTable$getMarkdown$lambda) + '\n';
2447
+ }
2448
+ containsMarkdownTextContent() {
2127
2449
  return false;
2128
2450
  }
2451
+ get mustBeDirectChildOfDocument() {
2452
+ return this.gn();
2453
+ }
2129
2454
  }
2130
2455
  class MarkdownTableCell extends TableCell {
2131
2456
  constructor() {
2132
2457
  super();
2133
- this.in('display: table-cell; border: lightgrey 1px solid;');
2458
+ this.pn('display: table-cell; border: lightgrey 1px solid;');
2134
2459
  }
2135
2460
  }
2136
2461
  class MarkdownTableHeaderCell extends TableCell {
2137
2462
  constructor() {
2138
2463
  super();
2139
- this.in('display: table-cell; border: lightgrey 1px solid; background-color: lightgray;');
2464
+ this.pn('display: table-cell; border: lightgrey 1px solid; background-color: lightgray;');
2140
2465
  }
2141
2466
  }
2142
2467
  class MarkdownTableRow extends ContainerElement {
2143
2468
  constructor() {
2144
2469
  super();
2145
- this.io_1 = false;
2470
+ this.oo_1 = false;
2146
2471
  // Inline function 'org.w3c.dom.OPEN' call
2147
2472
  // Inline function 'kotlin.js.asDynamic' call
2148
2473
  // Inline function 'kotlin.js.unsafeCast' call
@@ -2154,14 +2479,25 @@ class MarkdownTableRow extends ContainerElement {
2154
2479
  style(this_0, ':host {\n display: table-row;\n border: lightgrey 1px solid;\n}');
2155
2480
  slot(this_0);
2156
2481
  }
2157
- hk() {
2158
- return this.io_1;
2482
+ gn() {
2483
+ return this.oo_1;
2159
2484
  }
2160
- km() {
2485
+ getMarkdown() {
2486
+ var tmp = asList(this.children);
2487
+ return '| ' + joinToString(tmp, ' | ', VOID, VOID, VOID, VOID, MarkdownTableRow$getMarkdown$lambda) + ' |';
2488
+ }
2489
+ containsMarkdownTextContent() {
2161
2490
  return false;
2162
2491
  }
2492
+ get mustBeDirectChildOfDocument() {
2493
+ return this.gn();
2494
+ }
2495
+ }
2496
+ class MarkdownTableHeaderRow extends MarkdownTableRow {
2497
+ getMarkdown() {
2498
+ return super.getMarkdown() + '\n' + '| ' + repeat('--- |', this.children.length);
2499
+ }
2163
2500
  }
2164
- class MarkdownTableHeaderRow extends MarkdownTableRow {}
2165
2501
  class MarkdownTaskListItem extends ListItem {
2166
2502
  constructor() {
2167
2503
  super();
@@ -2176,28 +2512,31 @@ class MarkdownTaskListItem extends ListItem {
2176
2512
  var container = element(shadow, 'div', MarkdownTaskListItem$lambda);
2177
2513
  var tmp = this;
2178
2514
  var tmp_0 = element(container, 'input', MarkdownTaskListItem$lambda_0);
2179
- tmp.ko_1 = tmp_0 instanceof HTMLInputElement ? tmp_0 : THROW_CCE();
2180
- this.ko_1.addEventListener('change', MarkdownTaskListItem$lambda_1(this));
2515
+ tmp.qo_1 = tmp_0 instanceof HTMLInputElement ? tmp_0 : THROW_CCE();
2516
+ this.qo_1.addEventListener('change', MarkdownTaskListItem$lambda_1(this));
2181
2517
  element(container, 'div', MarkdownTaskListItem$lambda_2);
2182
2518
  }
2183
- lo() {
2519
+ ro() {
2184
2520
  return this.getAttribute('checked') === 'true';
2185
2521
  }
2186
- z9(name, oldValue, newValue) {
2522
+ dc(name, oldValue, newValue) {
2187
2523
  if (name === 'checked') {
2188
- this.ko_1.checked = this.lo();
2524
+ this.qo_1.checked = this.ro();
2189
2525
  }
2190
2526
  }
2191
2527
  attributeChangedCallback(name, oldValue, newValue) {
2192
- return this.z9(name, oldValue, newValue);
2528
+ return this.dc(name, oldValue, newValue);
2529
+ }
2530
+ mn() {
2531
+ return '[' + (this.ro() ? 'x' : ' ') + '] ';
2193
2532
  }
2194
2533
  }
2195
2534
  class MarkdownToc extends BaseWebComponent {
2196
2535
  constructor() {
2197
2536
  super();
2198
- this.sk_1 = false;
2199
- this.tk_1 = null;
2200
- this.uk_1 = null;
2537
+ this.wl_1 = false;
2538
+ this.xl_1 = null;
2539
+ this.yl_1 = null;
2201
2540
  // Inline function 'org.w3c.dom.OPEN' call
2202
2541
  // Inline function 'kotlin.js.asDynamic' call
2203
2542
  // Inline function 'kotlin.js.unsafeCast' call
@@ -2206,20 +2545,392 @@ class MarkdownToc extends BaseWebComponent {
2206
2545
  o['mode'] = 'open';
2207
2546
  style(this.attachShadow(o), ':host {\n display: block;\n}\n@media screen {\n :host(.floating) {\n position: absolute;\n right: 0px;\n top: 0px;\n }\n :host(.floating) .level-2 {\n height: 0px;\n visibility: collapse;\n }\n :host(.floating:hover) .level-2 {\n height: auto;\n visibility: visible;\n }\n}\n.level {\n padding-left: 10px;\n font-size: 0.9em;\n}\n.level a {\n display: block;\n}\ndiv {\n display: flex;\n flex-direction: column;\n}');
2208
2547
  }
2209
- vk(value) {
2210
- this.uk_1 = value;
2211
- refresh(this);
2548
+ gn() {
2549
+ return this.wl_1;
2212
2550
  }
2213
- w9() {
2214
- super.w9();
2215
- if (this.uk_1 == null) {
2216
- this.vk(this.closest('markdown-document'));
2551
+ zl(value) {
2552
+ this.yl_1 = value;
2553
+ this.refresh();
2554
+ }
2555
+ bn() {
2556
+ return this.yl_1;
2557
+ }
2558
+ ac() {
2559
+ super.ac();
2560
+ if (this.yl_1 == null) {
2561
+ this.zl(this.closest('markdown-document'));
2217
2562
  var tmp = window;
2218
2563
  tmp.setTimeout(MarkdownToc$connectedCallback$lambda(this), 1000);
2219
2564
  }
2220
2565
  }
2221
2566
  connectedCallback() {
2222
- return this.w9();
2567
+ return this.ac();
2568
+ }
2569
+ refresh() {
2570
+ var tmp0_elvis_lhs = this.yl_1;
2571
+ var tmp;
2572
+ if (tmp0_elvis_lhs == null) {
2573
+ return Unit_instance;
2574
+ } else {
2575
+ tmp = tmp0_elvis_lhs;
2576
+ }
2577
+ var root = tmp;
2578
+ var tmp1_elvis_lhs = this.shadowRoot;
2579
+ var tmp_0;
2580
+ if (tmp1_elvis_lhs == null) {
2581
+ return Unit_instance;
2582
+ } else {
2583
+ tmp_0 = tmp1_elvis_lhs;
2584
+ }
2585
+ var shadow = tmp_0;
2586
+ var tmp2_safe_receiver = this.xl_1;
2587
+ if (tmp2_safe_receiver == null)
2588
+ null;
2589
+ else {
2590
+ tmp2_safe_receiver.remove();
2591
+ }
2592
+ var currentDepth = 1;
2593
+ var currentList = document.createElement('div');
2594
+ this.xl_1 = currentList;
2595
+ shadow.appendChild(currentList);
2596
+ // Inline function 'kotlin.collections.filterIsInstance' call
2597
+ var tmp0 = asList(root.querySelectorAll('*'));
2598
+ // Inline function 'kotlin.collections.filterIsInstanceTo' call
2599
+ var destination = ArrayList.x();
2600
+ var _iterator__ex2g4s = tmp0.p();
2601
+ while (_iterator__ex2g4s.q()) {
2602
+ var element = _iterator__ex2g4s.r();
2603
+ if (element instanceof Heading) {
2604
+ destination.l(element);
2605
+ }
2606
+ }
2607
+ var headings = destination;
2608
+ // Inline function 'kotlin.collections.forEach' call
2609
+ var _iterator__ex2g4s_0 = headings.p();
2610
+ while (_iterator__ex2g4s_0.q()) {
2611
+ var element_0 = _iterator__ex2g4s_0.r();
2612
+ var tmp_1 = document.createElement('a');
2613
+ var a = tmp_1 instanceof HTMLAnchorElement ? tmp_1 : THROW_CCE();
2614
+ a.href = '#' + element_0.id;
2615
+ a.innerHTML = element_0.innerHTML;
2616
+ a.onclick = MarkdownToc$refresh$lambda(element_0);
2617
+ while (currentDepth < element_0.depth) {
2618
+ currentDepth = currentDepth + 1 | 0;
2619
+ var nextList = document.createElement('div');
2620
+ nextList.classList.add('level');
2621
+ nextList.classList.add('level-' + currentDepth);
2622
+ currentList.appendChild(nextList);
2623
+ currentList = nextList;
2624
+ }
2625
+ while (currentDepth > element_0.depth) {
2626
+ currentDepth = currentDepth - 1 | 0;
2627
+ currentList = ensureNotNull(currentList.parentElement);
2628
+ }
2629
+ currentList.appendChild(a);
2630
+ }
2631
+ }
2632
+ getMarkdown() {
2633
+ return '${toc}';
2634
+ }
2635
+ get mustBeDirectChildOfDocument() {
2636
+ return this.gn();
2637
+ }
2638
+ get markdownDocument() {
2639
+ return this.bn();
2640
+ }
2641
+ set markdownDocument(value) {
2642
+ this.zl(value);
2643
+ }
2644
+ }
2645
+ class HeadingAnchors {
2646
+ constructor() {
2647
+ HeadingAnchors_instance = this;
2648
+ this.so_1 = Regex.k8('\\s*\\{([^}]+)\\}$');
2649
+ this.to_1 = Regex.j8('[^\\w\u0430-\u044F\u0456\u0457\u0454]+', RegexOption_IGNORE_CASE_getInstance());
2650
+ }
2651
+ uo(idPrefixForDefault, text, useTextInId) {
2652
+ var match = this.so_1.n8(text);
2653
+ var tmp;
2654
+ if (!(match == null)) {
2655
+ tmp = to(match.l9().s(1), substring(text, 0, match.q8().ua_1));
2656
+ } else {
2657
+ var tmp_0;
2658
+ if (useTextInId) {
2659
+ tmp_0 = idPrefixForDefault + this.vo(text);
2660
+ } else {
2661
+ tmp_0 = idPrefixForDefault + ((new Date()).getTime() + Default_getInstance().ka());
2662
+ }
2663
+ var id = tmp_0;
2664
+ tmp = to(id, text);
2665
+ }
2666
+ return tmp;
2667
+ }
2668
+ vo(text) {
2669
+ // Inline function 'kotlin.text.lowercase' call
2670
+ // Inline function 'kotlin.js.asDynamic' call
2671
+ var tmp0 = text.toLowerCase();
2672
+ // Inline function 'kotlin.text.replace' call
2673
+ return this.to_1.o8(tmp0, '-');
2674
+ }
2675
+ }
2676
+ class MarkdownRenderer {}
2677
+ class MarkdownComponentsRenderer {
2678
+ heading(text, level, id) {
2679
+ var tmp;
2680
+ // Inline function 'kotlin.text.isNullOrEmpty' call
2681
+ if (!(id == null || charSequenceLength(id) === 0)) {
2682
+ tmp = " id='" + id + "'";
2683
+ } else {
2684
+ tmp = '';
2685
+ }
2686
+ var idAttr = tmp;
2687
+ return '<markdown-header-' + level + idAttr + '>' + text + '<\/markdown-header-' + level + '>';
2688
+ }
2689
+ paragraph(text) {
2690
+ var replaced = replace(text, '${toc}', this.toc());
2691
+ return '<markdown-paragraph>' + replaced + '<\/markdown-paragraph>';
2692
+ }
2693
+ blockquote(quote) {
2694
+ return '<markdown-quote>' + quote + '<\/markdown-quote>';
2695
+ }
2696
+ html(html) {
2697
+ return '<markdown-html>' + html + '<\/markdown-html>';
2698
+ }
2699
+ hr() {
2700
+ return '<markdown-break><\/markdown-break>';
2701
+ }
2702
+ list(body, ordered) {
2703
+ return "<markdown-list ordered='" + ordered + "'>" + body + '<\/markdown-list>';
2704
+ }
2705
+ listItem(text) {
2706
+ return '<markdown-list-item>' + text + '<\/markdown-list-item>';
2707
+ }
2708
+ taskListItem(text, checked) {
2709
+ var checkedAttr = checked ? " checked='true'" : '';
2710
+ return '<markdown-task-list-item' + checkedAttr + '>' + text + '<\/markdown-task-list-item>';
2711
+ }
2712
+ table(header, body) {
2713
+ return '<markdown-table>' + header + body + '<\/markdown-table>';
2714
+ }
2715
+ tableRow(content) {
2716
+ return '<markdown-table-row>' + content + '<\/markdown-table-row>';
2717
+ }
2718
+ tableHeaderRow(content) {
2719
+ return '<markdown-table-header-row>' + content + '<\/markdown-table-header-row>';
2720
+ }
2721
+ tableCell(content) {
2722
+ return '<markdown-table-cell>' + content + '<\/markdown-table-cell>';
2723
+ }
2724
+ tableHeaderCell(content) {
2725
+ return '<markdown-table-header-cell>' + content + '<\/markdown-table-header-cell>';
2726
+ }
2727
+ code(code, lang, id) {
2728
+ var tmp;
2729
+ // Inline function 'kotlin.text.isNullOrEmpty' call
2730
+ if (!(lang == null || charSequenceLength(lang) === 0)) {
2731
+ tmp = " lang='" + lang + "'";
2732
+ } else {
2733
+ tmp = '';
2734
+ }
2735
+ var langAttr = tmp;
2736
+ var tmp_0;
2737
+ // Inline function 'kotlin.text.isNullOrEmpty' call
2738
+ if (!(id == null || charSequenceLength(id) === 0)) {
2739
+ tmp_0 = " id='" + id + "'";
2740
+ } else {
2741
+ tmp_0 = '';
2742
+ }
2743
+ var idAttr = tmp_0;
2744
+ return '<markdown-code' + langAttr + idAttr + '>' + code + '<\/markdown-code>';
2745
+ }
2746
+ codeSpan(text) {
2747
+ return '<markdown-code-span>' + text + '<\/markdown-code-span>';
2748
+ }
2749
+ strong(text) {
2750
+ return '<markdown-strong>' + text + '<\/markdown-strong>';
2751
+ }
2752
+ emphasis(text) {
2753
+ return '<markdown-emphasis>' + text + '<\/markdown-emphasis>';
2754
+ }
2755
+ strikethrough(text) {
2756
+ return '<markdown-strike>' + text + '<\/markdown-strike>';
2757
+ }
2758
+ link(href, title, text) {
2759
+ var tmp;
2760
+ // Inline function 'kotlin.text.isNullOrEmpty' call
2761
+ if (!(title == null || charSequenceLength(title) === 0)) {
2762
+ tmp = "<markdown-link destination='" + href + "' title='" + title + "'>" + text + '<\/markdown-link>';
2763
+ } else {
2764
+ tmp = "<markdown-link destination='" + href + "'>" + text + '<\/markdown-link>';
2765
+ }
2766
+ return tmp;
2767
+ }
2768
+ image(href, title, text) {
2769
+ var tmp;
2770
+ // Inline function 'kotlin.text.isNullOrEmpty' call
2771
+ if (!(title == null || charSequenceLength(title) === 0)) {
2772
+ tmp = "<markdown-image destination='" + href + "' title='" + title + "'>" + text + '<\/markdown-image>';
2773
+ } else {
2774
+ tmp = "<markdown-image destination='" + href + "'>" + text + '<\/markdown-image>';
2775
+ }
2776
+ return tmp;
2777
+ }
2778
+ toc() {
2779
+ return '<markdown-toc><\/markdown-toc>';
2780
+ }
2781
+ custom(tag, content) {
2782
+ return '<' + tag + '>' + content + '<\/' + tag + '>';
2783
+ }
2784
+ }
2785
+ class TsStackMarkdownRenderer extends logic_tools_markdown_komponents_tsstack_TsStackMarkdown_bad43z.Renderer {
2786
+ constructor(delegate) {
2787
+ delegate = delegate === VOID ? new MarkdownComponentsRenderer() : delegate;
2788
+ super();
2789
+ this.wo_1 = delegate;
2790
+ this.xo_1 = false;
2791
+ }
2792
+ yo() {
2793
+ return this.wo_1;
2794
+ }
2795
+ zo(code, lang, escaped, meta) {
2796
+ var tmp;
2797
+ // Inline function 'kotlin.text.isNullOrEmpty' call
2798
+ if (!(meta == null || charSequenceLength(meta) === 0)) {
2799
+ var _destruct__k2r9zo = HeadingAnchors_getInstance().uo('code-', meta, false);
2800
+ var id = _destruct__k2r9zo.mb();
2801
+ var newLang = _destruct__k2r9zo.nb();
2802
+ tmp = this.codeWithAnchor(code, newLang, id, escaped);
2803
+ } else {
2804
+ tmp = this.codeWithAnchor(code, lang, null, escaped);
2805
+ }
2806
+ return tmp;
2807
+ }
2808
+ code(code, lang, escaped, meta) {
2809
+ return this.zo(code, lang, escaped, meta);
2810
+ }
2811
+ ap(code, lang, id, escaped) {
2812
+ var tmp;
2813
+ if (!(escaped === true)) {
2814
+ var tmp0_safe_receiver = this.options.escape;
2815
+ var tmp1_elvis_lhs = tmp0_safe_receiver == null ? null : tmp0_safe_receiver(code, false);
2816
+ tmp = tmp1_elvis_lhs == null ? code : tmp1_elvis_lhs;
2817
+ } else {
2818
+ tmp = code;
2819
+ }
2820
+ var codeText = tmp;
2821
+ return this.wo_1.code(codeText, lang, id);
2822
+ }
2823
+ codeWithAnchor(code, lang, id, escaped, $super) {
2824
+ escaped = escaped === VOID ? null : escaped;
2825
+ return $super === VOID ? this.ap(code, lang, id, escaped) : $super.ap.call(this, code, lang, id, escaped);
2826
+ }
2827
+ bp(quote) {
2828
+ return this.wo_1.blockquote(quote);
2829
+ }
2830
+ blockquote(quote) {
2831
+ return this.bp(quote);
2832
+ }
2833
+ cp(html) {
2834
+ return this.wo_1.html(html);
2835
+ }
2836
+ html(html) {
2837
+ return this.cp(html);
2838
+ }
2839
+ dp(text, level, raw) {
2840
+ var _destruct__k2r9zo = HeadingAnchors_getInstance().uo('heading-', text, true);
2841
+ var id = _destruct__k2r9zo.mb();
2842
+ var newText = _destruct__k2r9zo.nb();
2843
+ return this.wo_1.heading(newText, level, id);
2844
+ }
2845
+ heading(text, level, raw) {
2846
+ return this.dp(text, level, raw);
2847
+ }
2848
+ ep() {
2849
+ return this.wo_1.hr();
2850
+ }
2851
+ hr() {
2852
+ return this.ep();
2853
+ }
2854
+ fp(body, ordered) {
2855
+ return this.wo_1.list(body, ordered === true);
2856
+ }
2857
+ list(body, ordered) {
2858
+ return this.fp(body, ordered);
2859
+ }
2860
+ gp(text) {
2861
+ return startsWith(text, '<markdown-paragraph>[ ] ') ? this.wo_1.taskListItem(replacePrefixOnce(text, '<markdown-paragraph>[ ] ', '<markdown-paragraph>'), false) : startsWith(text, '<markdown-paragraph>[x] ') ? this.wo_1.taskListItem(replacePrefixOnce(text, '<markdown-paragraph>[x] ', '<markdown-paragraph>'), true) : startsWith(text, '[ ] ') ? this.wo_1.taskListItem(removePrefix(text, '[ ] '), false) : startsWith(text, '[x] ') ? this.wo_1.taskListItem(removePrefix(text, '[x] '), true) : this.wo_1.listItem(text);
2862
+ }
2863
+ listitem(text) {
2864
+ return this.gp(text);
2865
+ }
2866
+ hp(text) {
2867
+ return this.wo_1.paragraph(text);
2868
+ }
2869
+ paragraph(text) {
2870
+ return this.hp(text);
2871
+ }
2872
+ ip(header, body) {
2873
+ return this.wo_1.table(header, body);
2874
+ }
2875
+ table(header, body) {
2876
+ return this.ip(header, body);
2877
+ }
2878
+ jp(content) {
2879
+ var isHeaderRow = this.xo_1;
2880
+ this.xo_1 = false;
2881
+ return isHeaderRow ? this.wo_1.tableHeaderRow(content) : this.wo_1.tableRow(content);
2882
+ }
2883
+ tablerow(content) {
2884
+ return this.jp(content);
2885
+ }
2886
+ kp(content, flags) {
2887
+ var tmp;
2888
+ if (flags.header == true) {
2889
+ this.xo_1 = true;
2890
+ tmp = this.wo_1.tableHeaderCell(content);
2891
+ } else {
2892
+ tmp = this.wo_1.tableCell(content);
2893
+ }
2894
+ return tmp;
2895
+ }
2896
+ tablecell(content, flags) {
2897
+ return this.kp(content, flags);
2898
+ }
2899
+ lp(text) {
2900
+ return this.wo_1.strong(text);
2901
+ }
2902
+ strong(text) {
2903
+ return this.lp(text);
2904
+ }
2905
+ mp(text) {
2906
+ return this.wo_1.emphasis(text);
2907
+ }
2908
+ em(text) {
2909
+ return this.mp(text);
2910
+ }
2911
+ np(text) {
2912
+ return this.wo_1.codeSpan(text);
2913
+ }
2914
+ codespan(text) {
2915
+ return this.np(text);
2916
+ }
2917
+ op(text) {
2918
+ return this.wo_1.strikethrough(text);
2919
+ }
2920
+ del(text) {
2921
+ return this.op(text);
2922
+ }
2923
+ pp(href, title, text) {
2924
+ return this.wo_1.link(href, title, text);
2925
+ }
2926
+ link(href, title, text) {
2927
+ return this.pp(href, title, text);
2928
+ }
2929
+ qp(href, title, text) {
2930
+ return this.wo_1.image(href, title, text);
2931
+ }
2932
+ image(href, title, text) {
2933
+ return this.qp(href, title, text);
2223
2934
  }
2224
2935
  }
2225
2936
  //endregion
@@ -2332,7 +3043,7 @@ function DropdownElement$lambda($this$element) {
2332
3043
  return Unit_instance;
2333
3044
  }
2334
3045
  function onKeyDown($this, event) {
2335
- if ($this.tj_1) {
3046
+ if ($this.editable) {
2336
3047
  switch (event.code) {
2337
3048
  case 'Enter':
2338
3049
  event.preventDefault();
@@ -2350,10 +3061,10 @@ function onKeyDown($this, event) {
2350
3061
  break;
2351
3062
  }
2352
3063
  if (event.defaultPrevented) {
2353
- $this.ek();
2354
- onChange($this);
3064
+ $this.normalizeContent();
3065
+ $this.onChange();
2355
3066
  }
2356
- var current = $this.fk();
3067
+ var current = $this.getCurrentLeafBlock();
2357
3068
  var tmp;
2358
3069
  if (!(current == null)) {
2359
3070
  // Inline function 'kotlin.js.asDynamic' call
@@ -2374,7 +3085,7 @@ function onDrop($this, event) {
2374
3085
  var file = ensureNotNull(files.item(0));
2375
3086
  var tmp0 = file.type;
2376
3087
  // Inline function 'kotlin.text.matches' call
2377
- if (Regex.u7('image.*').v7(tmp0)) {
3088
+ if (Regex.k8('image.*').l8(tmp0)) {
2378
3089
  event.stopPropagation();
2379
3090
  event.preventDefault();
2380
3091
  var reader = new FileReader();
@@ -2384,33 +3095,33 @@ function onDrop($this, event) {
2384
3095
  }
2385
3096
  }
2386
3097
  function onDragOver($this, event) {
2387
- var pos = $this.pj_1.caretPositionFromPoint(event.clientX, event.clientY);
3098
+ var pos = $this.selectionRoot.caretPositionFromPoint(event.clientX, event.clientY);
2388
3099
  if (!(pos == null)) {
2389
3100
  var range = document.createRange();
2390
3101
  range.setStart(pos.offsetNode, pos.offset);
2391
3102
  range.collapse();
2392
- var tmp0_safe_receiver = $this.gk();
3103
+ var tmp0_safe_receiver = $this.getSelection();
2393
3104
  if (tmp0_safe_receiver == null)
2394
3105
  null;
2395
3106
  else {
2396
3107
  tmp0_safe_receiver.removeAllRanges();
2397
3108
  }
2398
- var tmp1_safe_receiver = $this.gk();
3109
+ var tmp1_safe_receiver = $this.getSelection();
2399
3110
  if (tmp1_safe_receiver == null)
2400
3111
  null;
2401
3112
  else {
2402
3113
  tmp1_safe_receiver.addRange(range);
2403
3114
  }
2404
3115
  } else {
2405
- var range_0 = caretRangeFromPoint($this.pj_1, event.clientX, event.clientY);
3116
+ var range_0 = caretRangeFromPoint($this.selectionRoot, event.clientX, event.clientY);
2406
3117
  if (!(range_0 == null)) {
2407
- var tmp2_safe_receiver = $this.gk();
3118
+ var tmp2_safe_receiver = $this.getSelection();
2408
3119
  if (tmp2_safe_receiver == null)
2409
3120
  null;
2410
3121
  else {
2411
3122
  tmp2_safe_receiver.removeAllRanges();
2412
3123
  }
2413
- var tmp3_safe_receiver = $this.gk();
3124
+ var tmp3_safe_receiver = $this.getSelection();
2414
3125
  if (tmp3_safe_receiver == null)
2415
3126
  null;
2416
3127
  else {
@@ -2425,13 +3136,13 @@ function onPaste($this, event) {
2425
3136
  var pastedMarkdown = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.getData('text/markdown');
2426
3137
  // Inline function 'kotlin.text.isNullOrEmpty' call
2427
3138
  if (!(pastedMarkdown == null || charSequenceLength(pastedMarkdown) === 0)) {
2428
- var tmp1_safe_receiver = $this.gk();
3139
+ var tmp1_safe_receiver = $this.getSelection();
2429
3140
  if (tmp1_safe_receiver == null)
2430
3141
  null;
2431
3142
  else {
2432
3143
  tmp1_safe_receiver.deleteFromDocument();
2433
3144
  }
2434
- var tmp2_safe_receiver = $this.gk();
3145
+ var tmp2_safe_receiver = $this.getSelection();
2435
3146
  var tmp3_elvis_lhs = tmp2_safe_receiver == null ? null : tmp2_safe_receiver.getRangeAt(0);
2436
3147
  var tmp;
2437
3148
  if (tmp3_elvis_lhs == null) {
@@ -2440,7 +3151,7 @@ function onPaste($this, event) {
2440
3151
  tmp = tmp3_elvis_lhs;
2441
3152
  }
2442
3153
  var range = tmp;
2443
- var pastedNode = range.createContextualFragment($this.nj_1(pastedMarkdown));
3154
+ var pastedNode = range.createContextualFragment($this.parser(pastedMarkdown));
2444
3155
  var firstChild = pastedNode.firstChild;
2445
3156
  var tmp_0;
2446
3157
  var tmp_1;
@@ -2451,26 +3162,26 @@ function onPaste($this, event) {
2451
3162
  tmp_2 = false;
2452
3163
  }
2453
3164
  if (tmp_2) {
2454
- tmp_1 = firstChild.hk();
3165
+ tmp_1 = firstChild.mustBeDirectChildOfDocument;
2455
3166
  } else {
2456
3167
  tmp_1 = false;
2457
3168
  }
2458
3169
  if (tmp_1) {
2459
- var tmp9_safe_receiver = $this.gk();
3170
+ var tmp9_safe_receiver = $this.getSelection();
2460
3171
  tmp_0 = !equals(tmp9_safe_receiver == null ? null : tmp9_safe_receiver.anchorNode, $this);
2461
3172
  } else {
2462
3173
  tmp_0 = false;
2463
3174
  }
2464
3175
  if (tmp_0) {
2465
- var tmp4_safe_receiver = $this.gk();
3176
+ var tmp4_safe_receiver = $this.getSelection();
2466
3177
  var documentChild = tmp4_safe_receiver == null ? null : tmp4_safe_receiver.anchorNode;
2467
3178
  while (!(documentChild == null) && !equals(documentChild.parentElement, $this)) {
2468
3179
  documentChild = documentChild.parentElement;
2469
3180
  }
2470
3181
  if (documentChild instanceof Element) {
2471
- var tmp5_safe_receiver = $this.gk();
3182
+ var tmp5_safe_receiver = $this.getSelection();
2472
3183
  var offset = tmp5_safe_receiver == null ? null : tmp5_safe_receiver.anchorOffset;
2473
- var tmp6_safe_receiver = $this.gk();
3184
+ var tmp6_safe_receiver = $this.getSelection();
2474
3185
  var tmp7_safe_receiver = tmp6_safe_receiver == null ? null : tmp6_safe_receiver.anchorNode;
2475
3186
  var tmp8_safe_receiver = tmp7_safe_receiver == null ? null : tmp7_safe_receiver.textContent;
2476
3187
  var length = tmp8_safe_receiver == null ? null : tmp8_safe_receiver.length;
@@ -2486,33 +3197,33 @@ function onPaste($this, event) {
2486
3197
  range.insertNode(pastedNode);
2487
3198
  }
2488
3199
  event.preventDefault();
2489
- onChange($this);
3200
+ $this.onChange();
2490
3201
  }
2491
3202
  }
2492
3203
  function onMouseSelection($this) {
2493
- if ($this.yj_1 && $this.getAttribute('contenteditable') === 'true') {
3204
+ if ($this.ol_1 && $this.getAttribute('contenteditable') === 'true') {
2494
3205
  $this.setAttribute('contenteditable', 'false');
2495
3206
  }
2496
3207
  }
2497
3208
  function onEndMouseSelection($this) {
2498
- if ($this.yj_1 && $this.getAttribute('contenteditable') === 'false') {
3209
+ if ($this.ol_1 && $this.getAttribute('contenteditable') === 'false') {
2499
3210
  $this.setAttribute('contenteditable', $this.getAttribute('readonly') === 'true' ? 'false' : 'true');
2500
3211
  $this.focus();
2501
3212
  }
2502
3213
  }
2503
3214
  function mousedown($this, event) {
2504
3215
  if ((event.buttons % 2 | 0) === 1) {
2505
- $this.xj_1 = true;
3216
+ $this.nl_1 = true;
2506
3217
  }
2507
3218
  }
2508
3219
  function mouseup($this) {
2509
- $this.xj_1 = false;
3220
+ $this.nl_1 = false;
2510
3221
  onEndMouseSelection($this);
2511
3222
  }
2512
3223
  function selectstart($this) {
2513
3224
  }
2514
3225
  function selectionchange($this) {
2515
- var selection = $this.gk();
3226
+ var selection = $this.getSelection();
2516
3227
  var anchorNode = selection == null ? null : selection.anchorNode;
2517
3228
  if (!(selection == null) && !(anchorNode == null) && $this.contains(anchorNode)) {
2518
3229
  var element = anchorNode;
@@ -2530,38 +3241,38 @@ function selectionchange($this) {
2530
3241
  }
2531
3242
  var tmp_0;
2532
3243
  if (element instanceof MarkdownComponent) {
2533
- tmp_0 = element.ik();
3244
+ tmp_0 = element.isEditable();
2534
3245
  } else {
2535
3246
  tmp_0 = false;
2536
3247
  }
2537
3248
  if (tmp_0) {
2538
- if ($this.xj_1) {
3249
+ if ($this.nl_1) {
2539
3250
  onMouseSelection($this);
2540
3251
  }
2541
3252
  enableEditable($this);
2542
3253
  } else {
2543
3254
  disableEditable($this);
2544
3255
  }
2545
- $this.sj_1 = selection;
2546
- $this.uj_1 = anchorNode;
2547
- $this.vj_1 = selection.anchorOffset;
2548
- $this.wj_1 = new StashedSelection(selection.anchorNode, selection.anchorOffset, selection.focusNode, selection.focusOffset);
3256
+ $this.currentSelection = selection;
3257
+ $this.kl_1 = anchorNode;
3258
+ $this.ll_1 = selection.anchorOffset;
3259
+ $this.ml_1 = new StashedSelection(selection.anchorNode, selection.anchorOffset, selection.focusNode, selection.focusOffset);
2549
3260
  affectToolbar($this);
2550
3261
  } else {
2551
3262
  disableEditable($this);
2552
3263
  }
2553
3264
  }
2554
3265
  function enableEditable($this) {
2555
- if (!$this.tj_1) {
2556
- $this.tj_1 = true;
2557
- var tmp0_safe_receiver = $this.oj_1;
3266
+ if (!$this.editable) {
3267
+ $this.editable = true;
3268
+ var tmp0_safe_receiver = $this.toolbar;
2558
3269
  var tmp1_safe_receiver = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.classList;
2559
3270
  if (tmp1_safe_receiver == null)
2560
3271
  null;
2561
3272
  else {
2562
3273
  tmp1_safe_receiver.add('focus-enabled');
2563
3274
  }
2564
- var tmp2_safe_receiver = $this.oj_1;
3275
+ var tmp2_safe_receiver = $this.toolbar;
2565
3276
  var tmp3_safe_receiver = tmp2_safe_receiver == null ? null : tmp2_safe_receiver.classList;
2566
3277
  if (tmp3_safe_receiver == null)
2567
3278
  null;
@@ -2571,16 +3282,16 @@ function enableEditable($this) {
2571
3282
  }
2572
3283
  }
2573
3284
  function disableEditable($this) {
2574
- if ($this.tj_1) {
2575
- $this.tj_1 = false;
2576
- var tmp0_safe_receiver = $this.oj_1;
3285
+ if ($this.editable) {
3286
+ $this.editable = false;
3287
+ var tmp0_safe_receiver = $this.toolbar;
2577
3288
  var tmp1_safe_receiver = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.classList;
2578
3289
  if (tmp1_safe_receiver == null)
2579
3290
  null;
2580
3291
  else {
2581
3292
  tmp1_safe_receiver.remove('focus-enabled');
2582
3293
  }
2583
- var tmp2_safe_receiver = $this.oj_1;
3294
+ var tmp2_safe_receiver = $this.toolbar;
2584
3295
  var tmp3_safe_receiver = tmp2_safe_receiver == null ? null : tmp2_safe_receiver.classList;
2585
3296
  if (tmp3_safe_receiver == null)
2586
3297
  null;
@@ -2590,7 +3301,7 @@ function disableEditable($this) {
2590
3301
  }
2591
3302
  }
2592
3303
  function selectionToContentRange($this) {
2593
- var tmp0_elvis_lhs = $this.gk();
3304
+ var tmp0_elvis_lhs = $this.getSelection();
2594
3305
  var tmp;
2595
3306
  if (tmp0_elvis_lhs == null) {
2596
3307
  return null;
@@ -2634,7 +3345,7 @@ function selectionToContentRange($this) {
2634
3345
  }
2635
3346
  function selectionNodeAndOffsetToContentOffset($this, node, offset) {
2636
3347
  if (equals(node, $this)) {
2637
- return $this.jk(getOrNull(asList($this.childNodes), offset));
3348
+ return $this.contentLengthUntil(getOrNull(asList($this.childNodes), offset));
2638
3349
  } else {
2639
3350
  if (node instanceof MarkdownComponent) {
2640
3351
  var tmp0_elvis_lhs = node.parentNode;
@@ -2645,13 +3356,13 @@ function selectionNodeAndOffsetToContentOffset($this, node, offset) {
2645
3356
  tmp = tmp0_elvis_lhs;
2646
3357
  }
2647
3358
  var parent = tmp;
2648
- var parentOffset = selectionNodeAndOffsetToContentOffset($this, parent, asList(parent.childNodes).m1(node));
3359
+ var parentOffset = selectionNodeAndOffsetToContentOffset($this, parent, asList(parent.childNodes).n1(node));
2649
3360
  var tmp_0;
2650
3361
  if (parentOffset == null) {
2651
3362
  tmp_0 = null;
2652
3363
  } else {
2653
3364
  // Inline function 'kotlin.let' call
2654
- tmp_0 = parentOffset + node.jk(getOrNull(asList(node.childNodes), offset)) | 0;
3365
+ tmp_0 = parentOffset + node.contentLengthUntil(getOrNull(asList(node.childNodes), offset)) | 0;
2655
3366
  }
2656
3367
  return tmp_0;
2657
3368
  } else {
@@ -2664,7 +3375,7 @@ function selectionNodeAndOffsetToContentOffset($this, node, offset) {
2664
3375
  tmp_1 = tmp2_elvis_lhs;
2665
3376
  }
2666
3377
  var parent_0 = tmp_1;
2667
- var parentOffset_0 = selectionNodeAndOffsetToContentOffset($this, parent_0, asList(parent_0.childNodes).m1(node));
3378
+ var parentOffset_0 = selectionNodeAndOffsetToContentOffset($this, parent_0, asList(parent_0.childNodes).n1(node));
2668
3379
  var tmp_2;
2669
3380
  if (parentOffset_0 == null) {
2670
3381
  tmp_2 = null;
@@ -2684,22 +3395,22 @@ function selectionNodeAndOffsetToContentOffset($this, node, offset) {
2684
3395
  return null;
2685
3396
  }
2686
3397
  function setSelectionToContentRange($this, range) {
2687
- var _destruct__k2r9zo = getNodeAndOffsetFromContentOffsetAnchor($this, range.j9_1);
2688
- var anchorNode = _destruct__k2r9zo.l9();
2689
- var anchorOffset = _destruct__k2r9zo.m9();
2690
- var _destruct__k2r9zo_0 = getNodeAndOffsetFromContentOffset($this, range.k9_1);
2691
- var focusNode = _destruct__k2r9zo_0.l9();
2692
- var focusOffset = _destruct__k2r9zo_0.m9();
3398
+ var _destruct__k2r9zo = getNodeAndOffsetFromContentOffsetAnchor($this, range.first);
3399
+ var anchorNode = _destruct__k2r9zo.mb();
3400
+ var anchorOffset = _destruct__k2r9zo.nb();
3401
+ var _destruct__k2r9zo_0 = getNodeAndOffsetFromContentOffset($this, range.second);
3402
+ var focusNode = _destruct__k2r9zo_0.mb();
3403
+ var focusOffset = _destruct__k2r9zo_0.nb();
2693
3404
  var domRange = document.createRange();
2694
3405
  domRange.setStart(anchorNode, anchorOffset);
2695
3406
  domRange.setEnd(focusNode, focusOffset);
2696
- var tmp0_safe_receiver = $this.sj_1;
3407
+ var tmp0_safe_receiver = $this.currentSelection;
2697
3408
  if (tmp0_safe_receiver == null)
2698
3409
  null;
2699
3410
  else {
2700
3411
  tmp0_safe_receiver.removeAllRanges();
2701
3412
  }
2702
- var tmp1_safe_receiver = $this.sj_1;
3413
+ var tmp1_safe_receiver = $this.currentSelection;
2703
3414
  if (tmp1_safe_receiver == null)
2704
3415
  null;
2705
3416
  else {
@@ -2714,7 +3425,7 @@ function getNodeAndOffsetFromContentOffsetAnchor($this, contentOffset) {
2714
3425
  var _iterator__ex2g4s = elements.p();
2715
3426
  $l$loop_0: while (_iterator__ex2g4s.q()) {
2716
3427
  var child = _iterator__ex2g4s.r();
2717
- var lengthUntilChild = $this.jk(child);
3428
+ var lengthUntilChild = $this.contentLengthUntil(child);
2718
3429
  if (contentOffset === lengthUntilChild) {
2719
3430
  resultNode = child;
2720
3431
  break $l$loop_0;
@@ -2725,9 +3436,9 @@ function getNodeAndOffsetFromContentOffsetAnchor($this, contentOffset) {
2725
3436
  }
2726
3437
  var tmp;
2727
3438
  if (resultNode instanceof MarkdownComponent) {
2728
- tmp = resultNode.kk(contentOffset - $this.jk(resultNode) | 0);
3439
+ tmp = resultNode.getNodeAndOffsetFromContentOffsetAnchor(contentOffset - $this.contentLengthUntil(resultNode) | 0);
2729
3440
  } else {
2730
- tmp = to(resultNode, contentOffset - $this.jk(resultNode) | 0);
3441
+ tmp = to(resultNode, contentOffset - $this.contentLengthUntil(resultNode) | 0);
2731
3442
  }
2732
3443
  return tmp;
2733
3444
  }
@@ -2740,7 +3451,7 @@ function getNodeAndOffsetFromContentOffset($this, contentOffset) {
2740
3451
  var _iterator__ex2g4s = elements.p();
2741
3452
  $l$loop_0: while (_iterator__ex2g4s.q()) {
2742
3453
  var child = _iterator__ex2g4s.r();
2743
- var lengthUntilChild = $this.jk(child);
3454
+ var lengthUntilChild = $this.contentLengthUntil(child);
2744
3455
  if (contentOffset === lengthUntilChild) {
2745
3456
  if (previousNodeWasEol)
2746
3457
  resultNode = child;
@@ -2751,7 +3462,7 @@ function getNodeAndOffsetFromContentOffset($this, contentOffset) {
2751
3462
  resultNode = child;
2752
3463
  var tmp;
2753
3464
  if (child instanceof MarkdownComponent) {
2754
- tmp = child.lk();
3465
+ tmp = child.elementEndWithEndOfLineEquivalent();
2755
3466
  } else {
2756
3467
  tmp = false;
2757
3468
  }
@@ -2759,9 +3470,9 @@ function getNodeAndOffsetFromContentOffset($this, contentOffset) {
2759
3470
  }
2760
3471
  var tmp_0;
2761
3472
  if (resultNode instanceof MarkdownComponent) {
2762
- tmp_0 = resultNode.mk(contentOffset - $this.jk(resultNode) | 0);
3473
+ tmp_0 = resultNode.getNodeAndOffsetFromContentOffset(contentOffset - $this.contentLengthUntil(resultNode) | 0);
2763
3474
  } else {
2764
- tmp_0 = to(resultNode, contentOffset - $this.jk(resultNode) | 0);
3475
+ tmp_0 = to(resultNode, contentOffset - $this.contentLengthUntil(resultNode) | 0);
2765
3476
  }
2766
3477
  return tmp_0;
2767
3478
  }
@@ -2779,7 +3490,7 @@ function normalizeDOM($this) {
2779
3490
  while (_iterator__ex2g4s.q()) {
2780
3491
  var child = _iterator__ex2g4s.r();
2781
3492
  if (child instanceof MarkdownComponent) {
2782
- if (child.nk()) {
3493
+ if (child.normalizeContent()) {
2783
3494
  normalizeDOM($this);
2784
3495
  return Unit_instance;
2785
3496
  }
@@ -2802,14 +3513,14 @@ function normalizeDOM($this) {
2802
3513
  null;
2803
3514
  else {
2804
3515
  // Inline function 'kotlin.let' call
2805
- img.rk(tmp0_safe_receiver);
3516
+ img.vl(tmp0_safe_receiver);
2806
3517
  }
2807
3518
  var tmp1_safe_receiver = child.getAttribute('title');
2808
3519
  if (tmp1_safe_receiver == null)
2809
3520
  null;
2810
3521
  else {
2811
3522
  // Inline function 'kotlin.let' call
2812
- img.rk(tmp1_safe_receiver);
3523
+ img.vl(tmp1_safe_receiver);
2813
3524
  }
2814
3525
  var tmp2_safe_receiver = child.getAttribute('alt');
2815
3526
  if (tmp2_safe_receiver == null)
@@ -2865,7 +3576,7 @@ function normalizeDOM($this) {
2865
3576
  var p = document.createElement('markdown-paragraph');
2866
3577
  p.textContent = child.textContent;
2867
3578
  child.replaceWith(p);
2868
- (p instanceof MarkdownComponent ? p : THROW_CCE()).nk();
3579
+ (p instanceof MarkdownComponent ? p : THROW_CCE()).normalizeContent();
2869
3580
  } else {
2870
3581
  var html = document.createElement('markdown-html');
2871
3582
  (!(child == null) ? child : THROW_CCE()).replaceWith(html);
@@ -2898,16 +3609,12 @@ function normalizeDOM($this) {
2898
3609
  $this.appendChild(p_0);
2899
3610
  }
2900
3611
  }
2901
- function onChange($this) {
2902
- var tmp = window;
2903
- tmp.setTimeout(BaseMarkdownDocument$onChange$lambda($this), 0);
2904
- }
2905
3612
  function firstUpdated($this) {
2906
3613
  if ($this.getAttribute('floating-toc') === 'true') {
2907
3614
  var tmp = document.createElement('markdown-toc');
2908
3615
  var toc = tmp instanceof MarkdownToc ? tmp : THROW_CCE();
2909
3616
  toc.classList.add('floating');
2910
- toc.vk($this);
3617
+ toc.zl($this);
2911
3618
  var tmp0_safe_receiver = $this.shadowRoot;
2912
3619
  var tmp1_safe_receiver = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.querySelector('.toc');
2913
3620
  if (tmp1_safe_receiver == null)
@@ -2923,18 +3630,22 @@ function firstUpdated($this) {
2923
3630
  null;
2924
3631
  else
2925
3632
  tmp3_safe_receiver.appendChild(newToolbar);
2926
- $this.wk(newToolbar);
3633
+ $this.setToolbar(newToolbar);
2927
3634
  }
2928
3635
  }
3636
+ function renderMarkdown($this, newMarkdown) {
3637
+ $this.innerHTML = $this.parser(newMarkdown);
3638
+ $this.normalizeContent();
3639
+ }
2929
3640
  function handleBackspaceKeyDown($this, event) {
2930
- var tmp0_safe_receiver = $this.sj_1;
3641
+ var tmp0_safe_receiver = $this.currentSelection;
2931
3642
  var anchorOffset = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.anchorOffset;
2932
- var tmp1_safe_receiver = $this.sj_1;
3643
+ var tmp1_safe_receiver = $this.currentSelection;
2933
3644
  var focusOffset = tmp1_safe_receiver == null ? null : tmp1_safe_receiver.focusOffset;
2934
- var tmp2_safe_receiver = $this.sj_1;
3645
+ var tmp2_safe_receiver = $this.currentSelection;
2935
3646
  var tmp3_safe_receiver = tmp2_safe_receiver == null ? null : tmp2_safe_receiver.anchorNode;
2936
3647
  var parent = tmp3_safe_receiver == null ? null : tmp3_safe_receiver.parentElement;
2937
- var tmp4_safe_receiver = $this.sj_1;
3648
+ var tmp4_safe_receiver = $this.currentSelection;
2938
3649
  var tmp5_safe_receiver = tmp4_safe_receiver == null ? null : tmp4_safe_receiver.anchorNode;
2939
3650
  var sibling = tmp5_safe_receiver == null ? null : tmp5_safe_receiver.previousSibling;
2940
3651
  var tmp;
@@ -2953,9 +3664,9 @@ function handleBackspaceKeyDown($this, event) {
2953
3664
  event.preventDefault();
2954
3665
  var grandparent = parent.parentElement;
2955
3666
  if (!(grandparent == null) ? isInterface(grandparent, MarkdownElementEscapeByBackspace) : false) {
2956
- grandparent.zk(parent);
3667
+ grandparent.am(parent);
2957
3668
  } else {
2958
- parent.yk($this.sj_1);
3669
+ parent.mergeWithPrevious($this.currentSelection);
2959
3670
  }
2960
3671
  } else {
2961
3672
  var tmp_1;
@@ -2966,7 +3677,7 @@ function handleBackspaceKeyDown($this, event) {
2966
3677
  tmp_2 = false;
2967
3678
  }
2968
3679
  if (tmp_2) {
2969
- tmp_1 = sibling.xk();
3680
+ tmp_1 = sibling.isDeletableAsAWhole();
2970
3681
  } else {
2971
3682
  tmp_1 = false;
2972
3683
  }
@@ -2977,11 +3688,11 @@ function handleBackspaceKeyDown($this, event) {
2977
3688
  }
2978
3689
  }
2979
3690
  function handleDeleteKeyDown($this, event) {
2980
- var tmp0_safe_receiver = $this.sj_1;
3691
+ var tmp0_safe_receiver = $this.currentSelection;
2981
3692
  var anchor = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.anchorNode;
2982
- var tmp1_safe_receiver = $this.sj_1;
3693
+ var tmp1_safe_receiver = $this.currentSelection;
2983
3694
  var anchorOffset = tmp1_safe_receiver == null ? null : tmp1_safe_receiver.anchorOffset;
2984
- var tmp2_safe_receiver = $this.sj_1;
3695
+ var tmp2_safe_receiver = $this.currentSelection;
2985
3696
  var focusOffset = tmp2_safe_receiver == null ? null : tmp2_safe_receiver.focusOffset;
2986
3697
  var parent = anchor == null ? null : anchor.parentElement;
2987
3698
  var tmp;
@@ -3016,11 +3727,11 @@ function handleDeleteKeyDown($this, event) {
3016
3727
  }
3017
3728
  if (tmp) {
3018
3729
  event.preventDefault();
3019
- parent.al();
3730
+ parent.mergeNextIn();
3020
3731
  }
3021
3732
  }
3022
3733
  function handleTabKeyDown($this, shift) {
3023
- var tmp0_safe_receiver = $this.sj_1;
3734
+ var tmp0_safe_receiver = $this.currentSelection;
3024
3735
  var tmp1_safe_receiver = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.anchorNode;
3025
3736
  var parent = tmp1_safe_receiver == null ? null : tmp1_safe_receiver.parentElement;
3026
3737
  var child = null;
@@ -3039,60 +3750,60 @@ function handleTabKeyDown($this, shift) {
3039
3750
  }
3040
3751
  if (!(parent == null) ? isInterface(parent, MarkdownElementWithLevel) : false) {
3041
3752
  if (shift) {
3042
- parent.cl(child);
3753
+ parent.cm(child);
3043
3754
  } else {
3044
- parent.bl(child);
3755
+ parent.bm(child);
3045
3756
  }
3046
- onChange($this);
3757
+ $this.onChange();
3047
3758
  }
3048
3759
  }
3049
3760
  function allRangeUnderInline($this, tagName) {
3050
- var selection = $this.sj_1;
3761
+ var selection = $this.currentSelection;
3051
3762
  return !(selection == null) && selection.rangeCount > 0 ? allRangeUnderInline_0(tagName, selection.getRangeAt(0)) : null;
3052
3763
  }
3053
3764
  function affectToolbar($this) {
3054
- var tmp = $this.oj_1;
3765
+ var tmp = $this.toolbar;
3055
3766
  var toolbar = (!(tmp == null) ? isInterface(tmp, EditorToolbar) : false) ? tmp : null;
3056
3767
  if (allRangeUnderInline($this, 'markdown-strong') === true) {
3057
3768
  if (toolbar == null)
3058
3769
  null;
3059
3770
  else {
3060
- toolbar.cj();
3771
+ toolbar.highlightBoldButton();
3061
3772
  }
3062
3773
  } else {
3063
3774
  if (toolbar == null)
3064
3775
  null;
3065
3776
  else {
3066
- toolbar.dj();
3777
+ toolbar.removeBoldButtonHighlighting();
3067
3778
  }
3068
3779
  }
3069
3780
  if (allRangeUnderInline($this, 'markdown-emphasis') === true) {
3070
3781
  if (toolbar == null)
3071
3782
  null;
3072
3783
  else {
3073
- toolbar.ej();
3784
+ toolbar.highlightItalicButton();
3074
3785
  }
3075
3786
  } else {
3076
3787
  if (toolbar == null)
3077
3788
  null;
3078
3789
  else {
3079
- toolbar.fj();
3790
+ toolbar.removeItalicButtonHighlighting();
3080
3791
  }
3081
3792
  }
3082
3793
  if (allRangeUnderInline($this, 'markdown-strike') === true) {
3083
3794
  if (toolbar == null)
3084
3795
  null;
3085
3796
  else {
3086
- toolbar.gj();
3797
+ toolbar.highlightStrikeButton();
3087
3798
  }
3088
3799
  } else {
3089
3800
  if (toolbar == null)
3090
3801
  null;
3091
3802
  else {
3092
- toolbar.hj();
3803
+ toolbar.removeStrikeButtonHighlighting();
3093
3804
  }
3094
3805
  }
3095
- var tmp6_safe_receiver = $this.sj_1;
3806
+ var tmp6_safe_receiver = $this.currentSelection;
3096
3807
  var tmp7_safe_receiver = tmp6_safe_receiver == null ? null : tmp6_safe_receiver.anchorNode;
3097
3808
  var tmp8_safe_receiver = tmp7_safe_receiver == null ? null : tmp7_safe_receiver.parentElement;
3098
3809
  var tagName = tmp8_safe_receiver == null ? null : tmp8_safe_receiver.tagName;
@@ -3101,7 +3812,7 @@ function affectToolbar($this) {
3101
3812
  if (toolbar == null)
3102
3813
  null;
3103
3814
  else {
3104
- toolbar.ij('Paragraph');
3815
+ toolbar.setDropdownTitle('Paragraph');
3105
3816
  }
3106
3817
 
3107
3818
  break;
@@ -3109,7 +3820,7 @@ function affectToolbar($this) {
3109
3820
  if (toolbar == null)
3110
3821
  null;
3111
3822
  else {
3112
- toolbar.ij('Heading 1');
3823
+ toolbar.setDropdownTitle('Heading 1');
3113
3824
  }
3114
3825
 
3115
3826
  break;
@@ -3117,7 +3828,7 @@ function affectToolbar($this) {
3117
3828
  if (toolbar == null)
3118
3829
  null;
3119
3830
  else {
3120
- toolbar.ij('Heading 2');
3831
+ toolbar.setDropdownTitle('Heading 2');
3121
3832
  }
3122
3833
 
3123
3834
  break;
@@ -3125,7 +3836,7 @@ function affectToolbar($this) {
3125
3836
  if (toolbar == null)
3126
3837
  null;
3127
3838
  else {
3128
- toolbar.ij('Heading 3');
3839
+ toolbar.setDropdownTitle('Heading 3');
3129
3840
  }
3130
3841
 
3131
3842
  break;
@@ -3133,7 +3844,7 @@ function affectToolbar($this) {
3133
3844
  if (toolbar == null)
3134
3845
  null;
3135
3846
  else {
3136
- toolbar.ij('Heading 4');
3847
+ toolbar.setDropdownTitle('Heading 4');
3137
3848
  }
3138
3849
 
3139
3850
  break;
@@ -3141,7 +3852,7 @@ function affectToolbar($this) {
3141
3852
  if (toolbar == null)
3142
3853
  null;
3143
3854
  else {
3144
- toolbar.ij('Heading 5');
3855
+ toolbar.setDropdownTitle('Heading 5');
3145
3856
  }
3146
3857
 
3147
3858
  break;
@@ -3149,14 +3860,14 @@ function affectToolbar($this) {
3149
3860
  if (toolbar == null)
3150
3861
  null;
3151
3862
  else {
3152
- toolbar.ij('Heading 6');
3863
+ toolbar.setDropdownTitle('Heading 6');
3153
3864
  }
3154
3865
 
3155
3866
  break;
3156
3867
  }
3157
3868
  }
3158
3869
  function replaceCurrentLeafBlockWith($this, tagName) {
3159
- var tmp0_elvis_lhs = $this.fk();
3870
+ var tmp0_elvis_lhs = $this.getCurrentLeafBlock();
3160
3871
  var tmp;
3161
3872
  if (tmp0_elvis_lhs == null) {
3162
3873
  return Unit_instance;
@@ -3167,7 +3878,7 @@ function replaceCurrentLeafBlockWith($this, tagName) {
3167
3878
  var element = document.createElement(tagName);
3168
3879
  element.innerHTML = oldElement.innerHTML;
3169
3880
  oldElement.replaceWith(element);
3170
- onChange($this);
3881
+ $this.onChange();
3171
3882
  }
3172
3883
  function BaseMarkdownDocument$parser$lambda(md) {
3173
3884
  return '<markdown-paragraph>' + md + '<\/markdown-paragraph>';
@@ -3220,11 +3931,11 @@ function BaseMarkdownDocument$connectedCallback$lambda(this$0) {
3220
3931
  function BaseMarkdownDocument$connectedCallback$lambda_0(this$0) {
3221
3932
  return (it) => {
3222
3933
  var tmp;
3223
- if (this$0.rj_1) {
3224
- this$0.ek();
3934
+ if (this$0.autoNormalize) {
3935
+ this$0.normalizeContent();
3225
3936
  tmp = Unit_instance;
3226
3937
  }
3227
- onChange(this$0);
3938
+ this$0.onChange();
3228
3939
  return Unit_instance;
3229
3940
  };
3230
3941
  }
@@ -3262,8 +3973,8 @@ function BaseMarkdownDocument$onDrop$lambda($reader, this$0, $event) {
3262
3973
  var dataUri = (!(tmp == null) ? typeof tmp === 'string' : false) ? tmp : THROW_CCE();
3263
3974
  var tmp_0 = document.createElement('markdown-image');
3264
3975
  var img = tmp_0 instanceof MarkdownImage ? tmp_0 : THROW_CCE();
3265
- img.rk(dataUri);
3266
- var pos = this$0.pj_1.caretPositionFromPoint($event.clientX, $event.clientY);
3976
+ img.vl(dataUri);
3977
+ var pos = this$0.selectionRoot.caretPositionFromPoint($event.clientX, $event.clientY);
3267
3978
  var tmp_1;
3268
3979
  if (!(pos == null)) {
3269
3980
  var range = document.createRange();
@@ -3272,14 +3983,14 @@ function BaseMarkdownDocument$onDrop$lambda($reader, this$0, $event) {
3272
3983
  range.insertNode(img);
3273
3984
  tmp_1 = Unit_instance;
3274
3985
  } else {
3275
- var range_0 = caretRangeFromPoint(this$0.pj_1, $event.clientX, $event.clientY);
3986
+ var range_0 = caretRangeFromPoint(this$0.selectionRoot, $event.clientX, $event.clientY);
3276
3987
  if (!(range_0 == null)) {
3277
3988
  range_0.insertNode(img);
3278
3989
  } else {
3279
- var tmp2_safe_receiver = this$0.gk();
3990
+ var tmp2_safe_receiver = this$0.getSelection();
3280
3991
  var tmp3_elvis_lhs = tmp2_safe_receiver == null ? null : tmp2_safe_receiver.rangeCount;
3281
3992
  if ((tmp3_elvis_lhs == null ? 0 : tmp3_elvis_lhs) > 0) {
3282
- var tmp0_safe_receiver = this$0.gk();
3993
+ var tmp0_safe_receiver = this$0.getSelection();
3283
3994
  var tmp1_safe_receiver = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.getRangeAt(0);
3284
3995
  if (tmp1_safe_receiver == null)
3285
3996
  null;
@@ -3302,9 +4013,18 @@ function BaseMarkdownDocument$normalizeContent$lambda(this$0) {
3302
4013
  function BaseMarkdownDocument$onChange$lambda(this$0) {
3303
4014
  return () => this$0.dispatchEvent(new CustomEvent('change'));
3304
4015
  }
4016
+ function BaseMarkdownDocument$getMarkdown$lambda(it) {
4017
+ var tmp;
4018
+ if (it instanceof MarkdownComponent) {
4019
+ tmp = it.getMarkdown();
4020
+ } else {
4021
+ tmp = '';
4022
+ }
4023
+ return tmp;
4024
+ }
3305
4025
  function BaseMarkdownDocument$makeBold$lambda(this$0) {
3306
4026
  return () => {
3307
- var tmp0_safe_receiver = this$0.sj_1;
4027
+ var tmp0_safe_receiver = this$0.currentSelection;
3308
4028
  if (tmp0_safe_receiver == null)
3309
4029
  null;
3310
4030
  else {
@@ -3319,7 +4039,7 @@ function BaseMarkdownDocument$makeBold$lambda(this$0) {
3319
4039
  }
3320
4040
  function BaseMarkdownDocument$removeBold$lambda(this$0) {
3321
4041
  return () => {
3322
- var tmp0_safe_receiver = this$0.sj_1;
4042
+ var tmp0_safe_receiver = this$0.currentSelection;
3323
4043
  if (tmp0_safe_receiver == null)
3324
4044
  null;
3325
4045
  else {
@@ -3334,7 +4054,7 @@ function BaseMarkdownDocument$removeBold$lambda(this$0) {
3334
4054
  }
3335
4055
  function BaseMarkdownDocument$makeItalic$lambda(this$0) {
3336
4056
  return () => {
3337
- var tmp0_safe_receiver = this$0.sj_1;
4057
+ var tmp0_safe_receiver = this$0.currentSelection;
3338
4058
  if (tmp0_safe_receiver == null)
3339
4059
  null;
3340
4060
  else {
@@ -3349,7 +4069,7 @@ function BaseMarkdownDocument$makeItalic$lambda(this$0) {
3349
4069
  }
3350
4070
  function BaseMarkdownDocument$removeItalic$lambda(this$0) {
3351
4071
  return () => {
3352
- var tmp0_safe_receiver = this$0.sj_1;
4072
+ var tmp0_safe_receiver = this$0.currentSelection;
3353
4073
  if (tmp0_safe_receiver == null)
3354
4074
  null;
3355
4075
  else {
@@ -3364,7 +4084,7 @@ function BaseMarkdownDocument$removeItalic$lambda(this$0) {
3364
4084
  }
3365
4085
  function BaseMarkdownDocument$makeStrike$lambda(this$0) {
3366
4086
  return () => {
3367
- var tmp0_safe_receiver = this$0.sj_1;
4087
+ var tmp0_safe_receiver = this$0.currentSelection;
3368
4088
  if (tmp0_safe_receiver == null)
3369
4089
  null;
3370
4090
  else {
@@ -3379,7 +4099,7 @@ function BaseMarkdownDocument$makeStrike$lambda(this$0) {
3379
4099
  }
3380
4100
  function BaseMarkdownDocument$removeStrike$lambda(this$0) {
3381
4101
  return () => {
3382
- var tmp0_safe_receiver = this$0.sj_1;
4102
+ var tmp0_safe_receiver = this$0.currentSelection;
3383
4103
  if (tmp0_safe_receiver == null)
3384
4104
  null;
3385
4105
  else {
@@ -3394,7 +4114,7 @@ function BaseMarkdownDocument$removeStrike$lambda(this$0) {
3394
4114
  }
3395
4115
  function BaseMarkdownDocument$makeCodeInline$lambda(this$0) {
3396
4116
  return () => {
3397
- var tmp0_safe_receiver = this$0.sj_1;
4117
+ var tmp0_safe_receiver = this$0.currentSelection;
3398
4118
  if (tmp0_safe_receiver == null)
3399
4119
  null;
3400
4120
  else {
@@ -3552,7 +4272,7 @@ function isMarkdownContentTextNode(node) {
3552
4272
  var parent = node.parentNode;
3553
4273
  var tmp;
3554
4274
  if (parent instanceof MarkdownComponent) {
3555
- tmp = parent.km();
4275
+ tmp = parent.containsMarkdownTextContent();
3556
4276
  } else {
3557
4277
  tmp = false;
3558
4278
  }
@@ -3685,53 +4405,53 @@ function paragraphOption($this, parent, onClick) {
3685
4405
  item.addEventListener('mousedown', MarkdownToolbar$paragraphOption$lambda_0(onClick));
3686
4406
  }
3687
4407
  function onBoldClick($this) {
3688
- if ($this.gl_1.zi()) {
3689
- var tmp0_safe_receiver = $this.fl_1;
4408
+ if ($this.um_1.dl()) {
4409
+ var tmp0_safe_receiver = $this.markdownDocument;
3690
4410
  if (tmp0_safe_receiver == null)
3691
4411
  null;
3692
4412
  else {
3693
- tmp0_safe_receiver.nl();
4413
+ tmp0_safe_receiver.removeBold();
3694
4414
  }
3695
4415
  } else {
3696
- var tmp1_safe_receiver = $this.fl_1;
4416
+ var tmp1_safe_receiver = $this.markdownDocument;
3697
4417
  if (tmp1_safe_receiver == null)
3698
4418
  null;
3699
4419
  else {
3700
- tmp1_safe_receiver.ml();
4420
+ tmp1_safe_receiver.makeBold();
3701
4421
  }
3702
4422
  }
3703
4423
  }
3704
4424
  function onItalicClick($this) {
3705
- if ($this.hl_1.zi()) {
3706
- var tmp0_safe_receiver = $this.fl_1;
4425
+ if ($this.vm_1.dl()) {
4426
+ var tmp0_safe_receiver = $this.markdownDocument;
3707
4427
  if (tmp0_safe_receiver == null)
3708
4428
  null;
3709
4429
  else {
3710
- tmp0_safe_receiver.ql();
4430
+ tmp0_safe_receiver.removeItalic();
3711
4431
  }
3712
4432
  } else {
3713
- var tmp1_safe_receiver = $this.fl_1;
4433
+ var tmp1_safe_receiver = $this.markdownDocument;
3714
4434
  if (tmp1_safe_receiver == null)
3715
4435
  null;
3716
4436
  else {
3717
- tmp1_safe_receiver.pl();
4437
+ tmp1_safe_receiver.makeItalic();
3718
4438
  }
3719
4439
  }
3720
4440
  }
3721
4441
  function onStrikeClick($this) {
3722
- if ($this.il_1.zi()) {
3723
- var tmp0_safe_receiver = $this.fl_1;
4442
+ if ($this.wm_1.dl()) {
4443
+ var tmp0_safe_receiver = $this.markdownDocument;
3724
4444
  if (tmp0_safe_receiver == null)
3725
4445
  null;
3726
4446
  else {
3727
- tmp0_safe_receiver.sl();
4447
+ tmp0_safe_receiver.removeStrike();
3728
4448
  }
3729
4449
  } else {
3730
- var tmp1_safe_receiver = $this.fl_1;
4450
+ var tmp1_safe_receiver = $this.markdownDocument;
3731
4451
  if (tmp1_safe_receiver == null)
3732
4452
  null;
3733
4453
  else {
3734
- tmp1_safe_receiver.rl();
4454
+ tmp1_safe_receiver.makeStrike();
3735
4455
  }
3736
4456
  }
3737
4457
  }
@@ -3750,77 +4470,77 @@ function MarkdownToolbar$lambda_1($this$element) {
3750
4470
  }
3751
4471
  function MarkdownToolbar$lambda_2(this$0) {
3752
4472
  return () => {
3753
- var tmp0_safe_receiver = this$0.fl_1;
4473
+ var tmp0_safe_receiver = this$0.markdownDocument;
3754
4474
  if (tmp0_safe_receiver == null)
3755
4475
  null;
3756
4476
  else {
3757
- tmp0_safe_receiver.bm();
4477
+ tmp0_safe_receiver.header1Element();
3758
4478
  }
3759
4479
  return Unit_instance;
3760
4480
  };
3761
4481
  }
3762
4482
  function MarkdownToolbar$lambda_3(this$0) {
3763
4483
  return () => {
3764
- var tmp0_safe_receiver = this$0.fl_1;
4484
+ var tmp0_safe_receiver = this$0.markdownDocument;
3765
4485
  if (tmp0_safe_receiver == null)
3766
4486
  null;
3767
4487
  else {
3768
- tmp0_safe_receiver.cm();
4488
+ tmp0_safe_receiver.header2Element();
3769
4489
  }
3770
4490
  return Unit_instance;
3771
4491
  };
3772
4492
  }
3773
4493
  function MarkdownToolbar$lambda_4(this$0) {
3774
4494
  return () => {
3775
- var tmp0_safe_receiver = this$0.fl_1;
4495
+ var tmp0_safe_receiver = this$0.markdownDocument;
3776
4496
  if (tmp0_safe_receiver == null)
3777
4497
  null;
3778
4498
  else {
3779
- tmp0_safe_receiver.dm();
4499
+ tmp0_safe_receiver.header3Element();
3780
4500
  }
3781
4501
  return Unit_instance;
3782
4502
  };
3783
4503
  }
3784
4504
  function MarkdownToolbar$lambda_5(this$0) {
3785
4505
  return () => {
3786
- var tmp0_safe_receiver = this$0.fl_1;
4506
+ var tmp0_safe_receiver = this$0.markdownDocument;
3787
4507
  if (tmp0_safe_receiver == null)
3788
4508
  null;
3789
4509
  else {
3790
- tmp0_safe_receiver.em();
4510
+ tmp0_safe_receiver.header4Element();
3791
4511
  }
3792
4512
  return Unit_instance;
3793
4513
  };
3794
4514
  }
3795
4515
  function MarkdownToolbar$lambda_6(this$0) {
3796
4516
  return () => {
3797
- var tmp0_safe_receiver = this$0.fl_1;
4517
+ var tmp0_safe_receiver = this$0.markdownDocument;
3798
4518
  if (tmp0_safe_receiver == null)
3799
4519
  null;
3800
4520
  else {
3801
- tmp0_safe_receiver.fm();
4521
+ tmp0_safe_receiver.header5Element();
3802
4522
  }
3803
4523
  return Unit_instance;
3804
4524
  };
3805
4525
  }
3806
4526
  function MarkdownToolbar$lambda_7(this$0) {
3807
4527
  return () => {
3808
- var tmp0_safe_receiver = this$0.fl_1;
4528
+ var tmp0_safe_receiver = this$0.markdownDocument;
3809
4529
  if (tmp0_safe_receiver == null)
3810
4530
  null;
3811
4531
  else {
3812
- tmp0_safe_receiver.gm();
4532
+ tmp0_safe_receiver.header6Element();
3813
4533
  }
3814
4534
  return Unit_instance;
3815
4535
  };
3816
4536
  }
3817
4537
  function MarkdownToolbar$lambda_8(this$0) {
3818
4538
  return () => {
3819
- var tmp0_safe_receiver = this$0.fl_1;
4539
+ var tmp0_safe_receiver = this$0.markdownDocument;
3820
4540
  if (tmp0_safe_receiver == null)
3821
4541
  null;
3822
4542
  else {
3823
- tmp0_safe_receiver.hm();
4543
+ tmp0_safe_receiver.pararaphElement();
3824
4544
  }
3825
4545
  return Unit_instance;
3826
4546
  };
@@ -3845,88 +4565,88 @@ function MarkdownToolbar$lambda_11(this$0) {
3845
4565
  }
3846
4566
  function MarkdownToolbar$lambda_12(this$0) {
3847
4567
  return () => {
3848
- var tmp0_safe_receiver = this$0.fl_1;
4568
+ var tmp0_safe_receiver = this$0.markdownDocument;
3849
4569
  if (tmp0_safe_receiver == null)
3850
4570
  null;
3851
4571
  else {
3852
- tmp0_safe_receiver.ul();
4572
+ tmp0_safe_receiver.listBulletedClick();
3853
4573
  }
3854
4574
  return Unit_instance;
3855
4575
  };
3856
4576
  }
3857
4577
  function MarkdownToolbar$lambda_13(this$0) {
3858
4578
  return () => {
3859
- var tmp0_safe_receiver = this$0.fl_1;
4579
+ var tmp0_safe_receiver = this$0.markdownDocument;
3860
4580
  if (tmp0_safe_receiver == null)
3861
4581
  null;
3862
4582
  else {
3863
- tmp0_safe_receiver.vl();
4583
+ tmp0_safe_receiver.listNumericClick();
3864
4584
  }
3865
4585
  return Unit_instance;
3866
4586
  };
3867
4587
  }
3868
4588
  function MarkdownToolbar$lambda_14(this$0) {
3869
4589
  return () => {
3870
- var tmp0_safe_receiver = this$0.fl_1;
4590
+ var tmp0_safe_receiver = this$0.markdownDocument;
3871
4591
  if (tmp0_safe_receiver == null)
3872
4592
  null;
3873
4593
  else {
3874
- tmp0_safe_receiver.tl();
4594
+ tmp0_safe_receiver.makeCodeInline();
3875
4595
  }
3876
4596
  return Unit_instance;
3877
4597
  };
3878
4598
  }
3879
4599
  function MarkdownToolbar$lambda_15(this$0) {
3880
4600
  return () => {
3881
- var tmp0_safe_receiver = this$0.fl_1;
4601
+ var tmp0_safe_receiver = this$0.markdownDocument;
3882
4602
  if (tmp0_safe_receiver == null)
3883
4603
  null;
3884
4604
  else {
3885
- tmp0_safe_receiver.ll();
4605
+ tmp0_safe_receiver.makeBreak();
3886
4606
  }
3887
4607
  return Unit_instance;
3888
4608
  };
3889
4609
  }
3890
4610
  function MarkdownToolbar$lambda_16(this$0) {
3891
4611
  return () => {
3892
- var tmp0_safe_receiver = this$0.fl_1;
4612
+ var tmp0_safe_receiver = this$0.markdownDocument;
3893
4613
  if (tmp0_safe_receiver == null)
3894
4614
  null;
3895
4615
  else {
3896
- tmp0_safe_receiver.wl(null, null);
4616
+ tmp0_safe_receiver.insertPhoto(null, null);
3897
4617
  }
3898
4618
  return Unit_instance;
3899
4619
  };
3900
4620
  }
3901
4621
  function MarkdownToolbar$lambda_17(this$0) {
3902
4622
  return () => {
3903
- var tmp0_safe_receiver = this$0.fl_1;
4623
+ var tmp0_safe_receiver = this$0.markdownDocument;
3904
4624
  if (tmp0_safe_receiver == null)
3905
4625
  null;
3906
4626
  else {
3907
- tmp0_safe_receiver.xl();
4627
+ tmp0_safe_receiver.insertLink();
3908
4628
  }
3909
4629
  return Unit_instance;
3910
4630
  };
3911
4631
  }
3912
4632
  function MarkdownToolbar$lambda_18(this$0) {
3913
4633
  return () => {
3914
- var tmp0_safe_receiver = this$0.fl_1;
4634
+ var tmp0_safe_receiver = this$0.markdownDocument;
3915
4635
  if (tmp0_safe_receiver == null)
3916
4636
  null;
3917
4637
  else {
3918
- tmp0_safe_receiver.im();
4638
+ tmp0_safe_receiver.makeCodeBlock();
3919
4639
  }
3920
4640
  return Unit_instance;
3921
4641
  };
3922
4642
  }
3923
4643
  function MarkdownToolbar$lambda_19(this$0) {
3924
4644
  return () => {
3925
- var tmp0_safe_receiver = this$0.fl_1;
4645
+ var tmp0_safe_receiver = this$0.markdownDocument;
3926
4646
  if (tmp0_safe_receiver == null)
3927
4647
  null;
3928
4648
  else {
3929
- tmp0_safe_receiver.jm();
4649
+ tmp0_safe_receiver.makeQuoteBlock();
3930
4650
  }
3931
4651
  return Unit_instance;
3932
4652
  };
@@ -4042,11 +4762,11 @@ function ToolbarButton$lambda($this$element) {
4042
4762
  }
4043
4763
  function showDropdown($this, event) {
4044
4764
  event.stopPropagation();
4045
- var tmp = $this.pm_1;
4765
+ var tmp = $this.en_1;
4046
4766
  (tmp instanceof HTMLElement ? tmp : THROW_CCE()).style.display = 'block';
4047
4767
  }
4048
4768
  function hideDropdown($this) {
4049
- var tmp = $this.pm_1;
4769
+ var tmp = $this.en_1;
4050
4770
  (tmp instanceof HTMLElement ? tmp : THROW_CCE()).style.display = 'none';
4051
4771
  }
4052
4772
  function ToolbarDropdown$hideOnOutsideMouseDown$lambda(this$0) {
@@ -4105,17 +4825,70 @@ function Heading$renderHeading$lambda($this$element) {
4105
4825
  slot($this$element);
4106
4826
  return Unit_instance;
4107
4827
  }
4828
+ function ListItem$getMarkdownWithTextForElement$lambda(child) {
4829
+ var tmp0_safe_receiver = asMarkdownElement(child);
4830
+ var tmp1_elvis_lhs = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.getMarkdown();
4831
+ var tmp;
4832
+ if (tmp1_elvis_lhs == null) {
4833
+ var tmp2_safe_receiver = child.textContent;
4834
+ var tmp_0;
4835
+ if (tmp2_safe_receiver == null) {
4836
+ tmp_0 = null;
4837
+ } else {
4838
+ // Inline function 'kotlin.text.trim' call
4839
+ tmp_0 = toString_0(trim(isCharSequence(tmp2_safe_receiver) ? tmp2_safe_receiver : THROW_CCE()));
4840
+ }
4841
+ var tmp3_elvis_lhs = tmp_0;
4842
+ tmp = (tmp3_elvis_lhs == null ? '' : tmp3_elvis_lhs) + '\n';
4843
+ } else {
4844
+ tmp = tmp1_elvis_lhs;
4845
+ }
4846
+ return tmp;
4847
+ }
4848
+ function MarkdownComponent$getMarkdown$lambda(child) {
4849
+ var tmp0_safe_receiver = asMarkdownElement(child);
4850
+ var tmp1_elvis_lhs = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.getMarkdown();
4851
+ return tmp1_elvis_lhs == null ? '' : tmp1_elvis_lhs;
4852
+ }
4108
4853
  function get_ZERO_WIDTH_SPACE() {
4109
4854
  return ZERO_WIDTH_SPACE;
4110
4855
  }
4111
4856
  var ZERO_WIDTH_SPACE;
4857
+ function asMarkdownElement(node) {
4858
+ var tmp;
4859
+ var tmp_0;
4860
+ if (!(node == null)) {
4861
+ // Inline function 'kotlin.js.asDynamic' call
4862
+ tmp_0 = typeof node.getMarkdown === 'function';
4863
+ } else {
4864
+ tmp_0 = false;
4865
+ }
4866
+ if (tmp_0) {
4867
+ // Inline function 'kotlin.js.unsafeCast' call
4868
+ // Inline function 'kotlin.js.asDynamic' call
4869
+ tmp = node;
4870
+ } else {
4871
+ tmp = null;
4872
+ }
4873
+ return tmp;
4874
+ }
4875
+ function getMarkdownWithTextForElement(_this__u8e3s4) {
4876
+ var tmp = asList(_this__u8e3s4.childNodes);
4877
+ return joinToString(tmp, '', VOID, VOID, VOID, VOID, getMarkdownWithTextForElement$lambda);
4878
+ }
4879
+ function getMarkdownWithTextForElement$lambda(child) {
4880
+ var tmp0_safe_receiver = asMarkdownElement(child);
4881
+ var tmp1_elvis_lhs = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.getMarkdown();
4882
+ var tmp2_elvis_lhs = tmp1_elvis_lhs == null ? child.textContent : tmp1_elvis_lhs;
4883
+ return tmp2_elvis_lhs == null ? '' : tmp2_elvis_lhs;
4884
+ }
4112
4885
  function normalizeContent(element) {
4113
4886
  // Inline function 'kotlin.collections.forEach' call
4114
4887
  var _iterator__ex2g4s = asList(element.childNodes).p();
4115
4888
  while (_iterator__ex2g4s.q()) {
4116
4889
  var element_0 = _iterator__ex2g4s.r();
4117
4890
  if (element_0 instanceof MarkdownComponent) {
4118
- if (element_0.nk())
4891
+ if (element_0.normalizeContent())
4119
4892
  return normalizeContent(element);
4120
4893
  } else {
4121
4894
  if (normalizeUnknownChild(element_0)) {
@@ -4164,6 +4937,45 @@ function normalizeUnknownChild(content) {
4164
4937
  }
4165
4938
  return false;
4166
4939
  }
4940
+ function TableCell$getMarkdown$lambda(child) {
4941
+ var markdownElement = asMarkdownElement(child);
4942
+ var tmp;
4943
+ if (!(markdownElement == null)) {
4944
+ tmp = markdownElement.getMarkdown();
4945
+ } else {
4946
+ var tmp0_safe_receiver = child.textContent;
4947
+ var tmp_0;
4948
+ if (tmp0_safe_receiver == null) {
4949
+ tmp_0 = null;
4950
+ } else {
4951
+ // Inline function 'kotlin.text.replace' call
4952
+ tmp_0 = Regex.k8('\\s').o8(tmp0_safe_receiver, '');
4953
+ }
4954
+ var tmp1_safe_receiver = tmp_0;
4955
+ var tmp_1;
4956
+ if (tmp1_safe_receiver == null) {
4957
+ tmp_1 = null;
4958
+ } else {
4959
+ // Inline function 'kotlin.text.isEmpty' call
4960
+ tmp_1 = charSequenceLength(tmp1_safe_receiver) === 0;
4961
+ }
4962
+ if (tmp_1 === true) {
4963
+ tmp = '';
4964
+ } else {
4965
+ var tmp2_safe_receiver = child.textContent;
4966
+ var tmp_2;
4967
+ if (tmp2_safe_receiver == null) {
4968
+ tmp_2 = null;
4969
+ } else {
4970
+ // Inline function 'kotlin.text.replace' call
4971
+ tmp_2 = Regex.j8('^\\s+', RegexOption_MULTILINE_getInstance()).o8(tmp2_safe_receiver, ' ');
4972
+ }
4973
+ var tmp3_elvis_lhs = tmp_2;
4974
+ tmp = tmp3_elvis_lhs == null ? '' : tmp3_elvis_lhs;
4975
+ }
4976
+ }
4977
+ return tmp;
4978
+ }
4167
4979
  function highlight($this) {
4168
4980
  var lang = $this.getAttribute('lang');
4169
4981
  var text = $this.textContent;
@@ -4189,14 +5001,9 @@ function MarkdownEmphasis$lambda($this$element) {
4189
5001
  slot($this$element);
4190
5002
  return Unit_instance;
4191
5003
  }
4192
- function updateImage($this) {
4193
- $this.pk_1.src = $this.ao();
4194
- $this.pk_1.title = $this.title;
4195
- $this.pk_1.alt = $this.innerText;
4196
- }
4197
5004
  function onError($this) {
4198
5005
  // Inline function 'org.w3c.dom.CustomEventInit' call
4199
- var detail = $this.ao();
5006
+ var detail = $this.destination;
4200
5007
  var o = {};
4201
5008
  o['detail'] = detail;
4202
5009
  o['bubbles'] = true;
@@ -4205,7 +5012,7 @@ function onError($this) {
4205
5012
  $this.dispatchEvent(new CustomEvent('error-image', o));
4206
5013
  }
4207
5014
  function upload($this) {
4208
- var tmp0_safe_receiver = $this.qk_1.files;
5015
+ var tmp0_safe_receiver = $this.uploadInput.files;
4209
5016
  var tmp1_elvis_lhs = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.item(0);
4210
5017
  var tmp;
4211
5018
  if (tmp1_elvis_lhs == null) {
@@ -4252,23 +5059,23 @@ function MarkdownImage$upload$lambda(this$0, $reader) {
4252
5059
  };
4253
5060
  }
4254
5061
  function updateLinkTarget($this) {
4255
- $this.zl_1.href = $this.ao();
4256
- $this.zl_1.title = $this.title;
4257
- $this.zl_1.target = startsWith($this.ao(), '#') ? '_self' : '_blank';
4258
- $this.zl_1.onclick = MarkdownLink$updateLinkTarget$lambda($this);
5062
+ $this.sm_1.href = $this.io();
5063
+ $this.sm_1.title = $this.title;
5064
+ $this.sm_1.target = startsWith($this.io(), '#') ? '_self' : '_blank';
5065
+ $this.sm_1.onclick = MarkdownLink$updateLinkTarget$lambda($this);
4259
5066
  }
4260
5067
  function onDestinationInput($this) {
4261
- $this.rk($this.am_1.value);
5068
+ $this.vl($this.tm_1.value);
4262
5069
  updateLinkTarget($this);
4263
5070
  }
4264
5071
  function hideDestinationInput($this) {
4265
5072
  $this.classList.remove('fresh');
4266
- $this.am_1.classList.remove('visible');
5073
+ $this.tm_1.classList.remove('visible');
4267
5074
  }
4268
5075
  function showDestinationInput($this) {
4269
- $this.am_1.classList.add('visible');
4270
- $this.am_1.focus();
4271
- $this.am_1.setSelectionRange($this.am_1.value.length, $this.am_1.value.length);
5076
+ $this.tm_1.classList.add('visible');
5077
+ $this.tm_1.focus();
5078
+ $this.tm_1.setSelectionRange($this.tm_1.value.length, $this.tm_1.value.length);
4272
5079
  }
4273
5080
  function onDestinationKey($this, event) {
4274
5081
  if (event.key === 'Enter') {
@@ -4328,7 +5135,7 @@ function MarkdownLink$connectedCallback$lambda(this$0) {
4328
5135
  function MarkdownLink$updateLinkTarget$lambda(this$0) {
4329
5136
  return (event) => {
4330
5137
  // Inline function 'org.w3c.dom.CustomEventInit' call
4331
- var detail = this$0.ao();
5138
+ var detail = this$0.io();
4332
5139
  var o = {};
4333
5140
  o['detail'] = detail;
4334
5141
  o['bubbles'] = true;
@@ -4353,14 +5160,79 @@ function MarkdownNumericListItem$lambda($this$element) {
4353
5160
  slot($this$element);
4354
5161
  return Unit_instance;
4355
5162
  }
5163
+ function MarkdownParagraph$getMarkdown$lambda(child) {
5164
+ var markdownElement = asMarkdownElement(child);
5165
+ var tmp;
5166
+ if (!(markdownElement == null)) {
5167
+ tmp = markdownElement.getMarkdown();
5168
+ } else {
5169
+ var tmp0_safe_receiver = child.textContent;
5170
+ var tmp_0;
5171
+ if (tmp0_safe_receiver == null) {
5172
+ tmp_0 = null;
5173
+ } else {
5174
+ // Inline function 'kotlin.text.replace' call
5175
+ tmp_0 = Regex.k8('\\s').o8(tmp0_safe_receiver, '');
5176
+ }
5177
+ var tmp1_safe_receiver = tmp_0;
5178
+ var tmp_1;
5179
+ if (tmp1_safe_receiver == null) {
5180
+ tmp_1 = null;
5181
+ } else {
5182
+ // Inline function 'kotlin.text.isEmpty' call
5183
+ tmp_1 = charSequenceLength(tmp1_safe_receiver) === 0;
5184
+ }
5185
+ if (tmp_1 === true) {
5186
+ tmp = '';
5187
+ } else {
5188
+ var tmp2_safe_receiver = child.textContent;
5189
+ var tmp_2;
5190
+ if (tmp2_safe_receiver == null) {
5191
+ tmp_2 = null;
5192
+ } else {
5193
+ // Inline function 'kotlin.text.replace' call
5194
+ tmp_2 = Regex.j8('^\\s+', RegexOption_MULTILINE_getInstance()).o8(tmp2_safe_receiver, ' ');
5195
+ }
5196
+ var tmp3_elvis_lhs = tmp_2;
5197
+ tmp = tmp3_elvis_lhs == null ? '' : tmp3_elvis_lhs;
5198
+ }
5199
+ }
5200
+ return tmp;
5201
+ }
4356
5202
  function MarkdownQuote$lambda($this$element) {
4357
5203
  slot($this$element);
4358
5204
  return Unit_instance;
4359
5205
  }
5206
+ function MarkdownQuote$getMarkdown$lambda(child) {
5207
+ var tmp0_safe_receiver = asMarkdownElement(child);
5208
+ var tmp1_elvis_lhs = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.getMarkdown();
5209
+ var tmp;
5210
+ if (tmp1_elvis_lhs == null) {
5211
+ var tmp2_elvis_lhs = child.textContent;
5212
+ tmp = tmp2_elvis_lhs == null ? '' : tmp2_elvis_lhs;
5213
+ } else {
5214
+ tmp = tmp1_elvis_lhs;
5215
+ }
5216
+ return '> ' + tmp;
5217
+ }
4360
5218
  function MarkdownStrike$lambda($this$element) {
4361
5219
  slot($this$element);
4362
5220
  return Unit_instance;
4363
5221
  }
5222
+ function MarkdownTable$getMarkdown$lambda(child) {
5223
+ var tmp;
5224
+ if (child instanceof MarkdownTableRow) {
5225
+ tmp = child.getMarkdown();
5226
+ } else {
5227
+ tmp = '';
5228
+ }
5229
+ return tmp;
5230
+ }
5231
+ function MarkdownTableRow$getMarkdown$lambda(child) {
5232
+ var tmp0_safe_receiver = asMarkdownElement(child);
5233
+ var tmp1_elvis_lhs = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.getMarkdown();
5234
+ return tmp1_elvis_lhs == null ? '' : tmp1_elvis_lhs;
5235
+ }
4364
5236
  function MarkdownTaskListItem$lambda($this$element) {
4365
5237
  $this$element.className = 'task-and-container';
4366
5238
  return Unit_instance;
@@ -4371,7 +5243,7 @@ function MarkdownTaskListItem$lambda_0($this$element) {
4371
5243
  }
4372
5244
  function MarkdownTaskListItem$lambda_1(this$0) {
4373
5245
  return (it) => {
4374
- this$0.setAttribute('checked', this$0.ko_1.checked.toString());
5246
+ this$0.setAttribute('checked', this$0.qo_1.checked.toString());
4375
5247
  return Unit_instance;
4376
5248
  };
4377
5249
  }
@@ -4380,72 +5252,9 @@ function MarkdownTaskListItem$lambda_2($this$element) {
4380
5252
  slot($this$element);
4381
5253
  return Unit_instance;
4382
5254
  }
4383
- function refresh($this) {
4384
- var tmp0_elvis_lhs = $this.uk_1;
4385
- var tmp;
4386
- if (tmp0_elvis_lhs == null) {
4387
- return Unit_instance;
4388
- } else {
4389
- tmp = tmp0_elvis_lhs;
4390
- }
4391
- var root = tmp;
4392
- var tmp1_elvis_lhs = $this.shadowRoot;
4393
- var tmp_0;
4394
- if (tmp1_elvis_lhs == null) {
4395
- return Unit_instance;
4396
- } else {
4397
- tmp_0 = tmp1_elvis_lhs;
4398
- }
4399
- var shadow = tmp_0;
4400
- var tmp2_safe_receiver = $this.tk_1;
4401
- if (tmp2_safe_receiver == null)
4402
- null;
4403
- else {
4404
- tmp2_safe_receiver.remove();
4405
- }
4406
- var currentDepth = 1;
4407
- var currentList = document.createElement('div');
4408
- $this.tk_1 = currentList;
4409
- shadow.appendChild(currentList);
4410
- // Inline function 'kotlin.collections.filterIsInstance' call
4411
- var tmp0 = asList(root.querySelectorAll('*'));
4412
- // Inline function 'kotlin.collections.filterIsInstanceTo' call
4413
- var destination = ArrayList.x();
4414
- var _iterator__ex2g4s = tmp0.p();
4415
- while (_iterator__ex2g4s.q()) {
4416
- var element = _iterator__ex2g4s.r();
4417
- if (element instanceof Heading) {
4418
- destination.l(element);
4419
- }
4420
- }
4421
- var headings = destination;
4422
- // Inline function 'kotlin.collections.forEach' call
4423
- var _iterator__ex2g4s_0 = headings.p();
4424
- while (_iterator__ex2g4s_0.q()) {
4425
- var element_0 = _iterator__ex2g4s_0.r();
4426
- var tmp_1 = document.createElement('a');
4427
- var a = tmp_1 instanceof HTMLAnchorElement ? tmp_1 : THROW_CCE();
4428
- a.href = '#' + element_0.id;
4429
- a.innerHTML = element_0.innerHTML;
4430
- a.onclick = MarkdownToc$refresh$lambda(element_0);
4431
- while (currentDepth < element_0.zm()) {
4432
- currentDepth = currentDepth + 1 | 0;
4433
- var nextList = document.createElement('div');
4434
- nextList.classList.add('level');
4435
- nextList.classList.add('level-' + currentDepth);
4436
- currentList.appendChild(nextList);
4437
- currentList = nextList;
4438
- }
4439
- while (currentDepth > element_0.zm()) {
4440
- currentDepth = currentDepth - 1 | 0;
4441
- currentList = ensureNotNull(currentList.parentElement);
4442
- }
4443
- currentList.appendChild(a);
4444
- }
4445
- }
4446
5255
  function MarkdownToc$connectedCallback$lambda(this$0) {
4447
5256
  return () => {
4448
- refresh(this$0);
5257
+ this$0.refresh();
4449
5258
  return Unit_instance;
4450
5259
  };
4451
5260
  }
@@ -4503,6 +5312,64 @@ function registerMarkdownComponents() {
4503
5312
  define_0(window.customElements, 'markdown-code', MarkdownCode);
4504
5313
  define_0(window.customElements, 'markdown-toc', MarkdownToc);
4505
5314
  }
5315
+ var HeadingAnchors_instance;
5316
+ function HeadingAnchors_getInstance() {
5317
+ if (HeadingAnchors_instance === VOID)
5318
+ new HeadingAnchors();
5319
+ return HeadingAnchors_instance;
5320
+ }
5321
+ function get_fencedCodeWithAnchorRule() {
5322
+ _init_properties_TsStackMarkdownRenderer_kt__69bnnt();
5323
+ return fencedCodeWithAnchorRule;
5324
+ }
5325
+ var fencedCodeWithAnchorRule;
5326
+ function get_customBlockRule() {
5327
+ _init_properties_TsStackMarkdownRenderer_kt__69bnnt();
5328
+ return customBlockRule;
5329
+ }
5330
+ var customBlockRule;
5331
+ function parseMarkdownWithTsStackRenderer(markdown, renderer) {
5332
+ _init_properties_TsStackMarkdownRenderer_kt__69bnnt();
5333
+ var options = new logic_tools_markdown_komponents_tsstack_TsStackMarkdown_bad43z.MarkedOptions();
5334
+ options.gfm = true;
5335
+ options.renderer = renderer;
5336
+ var tmp = logic_tools_markdown_komponents_tsstack_TsStackMarkdown_bad43z.Marked;
5337
+ var tmp_0 = get_fencedCodeWithAnchorRule();
5338
+ tmp.setBlockRule(tmp_0, parseMarkdown$lambda(renderer));
5339
+ var tmp_1 = logic_tools_markdown_komponents_tsstack_TsStackMarkdown_bad43z.Marked;
5340
+ var tmp_2 = get_customBlockRule();
5341
+ tmp_1.setBlockRule(tmp_2, parseMarkdown$lambda_0(renderer));
5342
+ return logic_tools_markdown_komponents_tsstack_TsStackMarkdown_bad43z.Marked.parse(markdown, options);
5343
+ }
5344
+ function parseMarkdown(markdown, renderer) {
5345
+ renderer = renderer === VOID ? new MarkdownComponentsRenderer() : renderer;
5346
+ _init_properties_TsStackMarkdownRenderer_kt__69bnnt();
5347
+ return parseMarkdownWithTsStackRenderer(markdown, new TsStackMarkdownRenderer(renderer));
5348
+ }
5349
+ function replacePrefixOnce(_this__u8e3s4, prefix, replacement) {
5350
+ _init_properties_TsStackMarkdownRenderer_kt__69bnnt();
5351
+ return startsWith(_this__u8e3s4, prefix) ? replacement + substring_0(_this__u8e3s4, prefix.length) : _this__u8e3s4;
5352
+ }
5353
+ function parseMarkdown$lambda($renderer) {
5354
+ return (execArr) => {
5355
+ var groups = ensureNotNull(execArr);
5356
+ return $renderer.codeWithAnchor(ensureNotNull(groups[4]), groups[2], groups[3]);
5357
+ };
5358
+ }
5359
+ function parseMarkdown$lambda_0($renderer) {
5360
+ return (execArr) => {
5361
+ var groups = ensureNotNull(execArr);
5362
+ return $renderer.wo_1.custom(ensureNotNull(groups[1]), parseMarkdownWithTsStackRenderer(ensureNotNull(groups[2]), $renderer));
5363
+ };
5364
+ }
5365
+ var properties_initialized_TsStackMarkdownRenderer_kt_6onrsl;
5366
+ function _init_properties_TsStackMarkdownRenderer_kt__69bnnt() {
5367
+ if (!properties_initialized_TsStackMarkdownRenderer_kt_6onrsl) {
5368
+ properties_initialized_TsStackMarkdownRenderer_kt_6onrsl = true;
5369
+ fencedCodeWithAnchorRule = new RegExp('^ *(`{3,}|~{3,})[ .]*(\\S+)? +\\{([^}]+)} *\\n([\\s\\S]*?)\\s*\\1 *(?:\\n+|$)');
5370
+ customBlockRule = new RegExp('^\\[\\[\\[([a-z\\-]+)\\n([\\s\\S]+?)\\1\\]\\]\\]\\n');
5371
+ }
5372
+ }
4506
5373
  //region block: post-declaration
4507
5374
  initMetadataForClass(BaseWebComponent, 'BaseWebComponent');
4508
5375
  initMetadataForClass(BoldToolbarButton, 'BoldToolbarButton', BoldToolbarButton);
@@ -4519,7 +5386,8 @@ initMetadataForClass(ToolbarButton, 'ToolbarButton', ToolbarButton);
4519
5386
  initMetadataForClass(ToolbarDropdown, 'ToolbarDropdown', ToolbarDropdown);
4520
5387
  initMetadataForClass(ToolbarIcon, 'ToolbarIcon', ToolbarIcon);
4521
5388
  initMetadataForClass(ToolbarSeparator, 'ToolbarSeparator', ToolbarSeparator);
4522
- initMetadataForClass(MarkdownComponent, 'MarkdownComponent');
5389
+ initMetadataForInterface(MarkdownElement, 'MarkdownElement');
5390
+ initMetadataForClass(MarkdownComponent, 'MarkdownComponent', VOID, VOID, [MarkdownElement]);
4523
5391
  initMetadataForClass(BlockElement, 'BlockElement');
4524
5392
  initMetadataForClass(ContainerElement, 'ContainerElement');
4525
5393
  initMetadataForClass(LeafElement, 'LeafElement');
@@ -4557,7 +5425,11 @@ initMetadataForClass(MarkdownTableHeaderCell, 'MarkdownTableHeaderCell', Markdow
4557
5425
  initMetadataForClass(MarkdownTableRow, 'MarkdownTableRow', MarkdownTableRow);
4558
5426
  initMetadataForClass(MarkdownTableHeaderRow, 'MarkdownTableHeaderRow', MarkdownTableHeaderRow);
4559
5427
  initMetadataForClass(MarkdownTaskListItem, 'MarkdownTaskListItem', MarkdownTaskListItem);
4560
- initMetadataForClass(MarkdownToc, 'MarkdownToc', MarkdownToc);
5428
+ initMetadataForClass(MarkdownToc, 'MarkdownToc', MarkdownToc, VOID, [MarkdownElement]);
5429
+ initMetadataForObject(HeadingAnchors, 'HeadingAnchors');
5430
+ initMetadataForInterface(MarkdownRenderer, 'MarkdownRenderer');
5431
+ initMetadataForClass(MarkdownComponentsRenderer, 'MarkdownComponentsRenderer', MarkdownComponentsRenderer, VOID, [MarkdownRenderer]);
5432
+ initMetadataForClass(TsStackMarkdownRenderer, 'TsStackMarkdownRenderer', TsStackMarkdownRenderer);
4561
5433
  //endregion
4562
5434
  //region block: init
4563
5435
  ZERO_WIDTH_SPACE = '\u200B';
@@ -4565,6 +5437,29 @@ ZERO_WIDTH_SPACE = '\u200B';
4565
5437
  //region block: eager init
4566
5438
  registerAllComponentsOnLoad = registerAllComponentsOnLoad$init$();
4567
5439
  //endregion
5440
+ //region block: exports
5441
+ export {
5442
+ BaseWebComponent as BaseWebComponent,
5443
+ BaseMarkdownDocument as BaseMarkdownDocument,
5444
+ MarkdownDocument as MarkdownDocument,
5445
+ MarkdownEditor as MarkdownEditor,
5446
+ MarkdownToolbar as MarkdownToolbar,
5447
+ BlockElement as BlockElement,
5448
+ ContainerElement as ContainerElement,
5449
+ Heading as Heading,
5450
+ InlineElement as InlineElement,
5451
+ TerminalInlineElement as TerminalInlineElement,
5452
+ LeafElement as LeafElement,
5453
+ MarkdownComponent as MarkdownComponent,
5454
+ MarkdownImage as MarkdownImage,
5455
+ MarkdownParagraph as MarkdownParagraph,
5456
+ MarkdownToc as MarkdownToc,
5457
+ MarkdownComponentsRenderer as MarkdownComponentsRenderer,
5458
+ TsStackMarkdownRenderer as TsStackMarkdownRenderer,
5459
+ parseMarkdownWithTsStackRenderer as parseMarkdownWithTsStackRenderer,
5460
+ parseMarkdown as parseMarkdown,
5461
+ };
5462
+ //endregion
4568
5463
  mainWrapper();
4569
5464
 
4570
5465
  //# sourceMappingURL=markdown-komponents.mjs.map