@glifox/gnosis 0.0.6 → 0.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/gnosis.mjs CHANGED
@@ -1,15 +1,15 @@
1
- var V = Object.defineProperty;
2
- var X = (t, r, o) => r in t ? V(t, r, { enumerable: !0, configurable: !0, writable: !0, value: o }) : t[r] = o;
3
- var L = (t, r, o) => X(t, typeof r != "symbol" ? r + "" : r, o);
4
- import { languages as Z } from "@codemirror/language-data";
5
- import { markdown as J } from "@codemirror/lang-markdown";
6
- import { GFM as ee } from "@lezer/markdown";
7
- import { Tag as re, styleTags as te, tags as e } from "@lezer/highlight";
8
- import { ViewPlugin as ae, Decoration as h, WidgetType as S, EditorView as K } from "@codemirror/view";
9
- import { syntaxTree as H, HighlightStyle as oe, syntaxHighlighting as ne } from "@codemirror/language";
10
- import { EditorView as B } from "codemirror";
11
- import { Compartment as le } from "@codemirror/state";
12
- const m = re.define("none"), ce = te({
1
+ var Z = Object.defineProperty;
2
+ var J = (t, r, a) => r in t ? Z(t, r, { enumerable: !0, configurable: !0, writable: !0, value: a }) : t[r] = a;
3
+ var L = (t, r, a) => J(t, typeof r != "symbol" ? r + "" : r, a);
4
+ import { languages as ee } from "@codemirror/language-data";
5
+ import { markdown as re } from "@codemirror/lang-markdown";
6
+ import { GFM as te } from "@lezer/markdown";
7
+ import { Tag as ae, styleTags as oe, tags as e } from "@lezer/highlight";
8
+ import { ViewPlugin as ne, Decoration as h, WidgetType as M, EditorView as q } from "@codemirror/view";
9
+ import { syntaxTree as $, HighlightStyle as le, syntaxHighlighting as ce } from "@codemirror/language";
10
+ import { EditorView as w } from "codemirror";
11
+ import { Compartment as se, StateEffect as ie, StateField as ge } from "@codemirror/state";
12
+ const m = ae.define("none"), he = oe({
13
13
  "Blockquote/...": m,
14
14
  HorizontalRule: m,
15
15
  "ATXHeading1/... SetextHeading1/...": m,
@@ -34,54 +34,54 @@ const m = re.define("none"), ce = te({
34
34
  "CodeInfo LinkLabel TaskMarker TableDelimiter": m,
35
35
  LinkTitle: m,
36
36
  Paragraph: m
37
- }), se = { props: [ce] }, C = (t, r, o = {}) => {
37
+ }), de = { props: [he] }, C = (t, r, a = {}) => {
38
38
  const n = class {
39
- constructor(g) {
39
+ constructor(i) {
40
40
  L(this, "decorations");
41
41
  L(this, "conf");
42
- this.conf = r, this.decorations = t(g, this.conf);
42
+ this.conf = r, this.decorations = t(i, this.conf);
43
43
  }
44
- update(g) {
45
- (g.docChanged || g.viewportChanged || g.selectionSet) && (this.decorations = t(g.view, this.conf));
44
+ update(i) {
45
+ (i.docChanged || i.viewportChanged || i.selectionSet) && (this.decorations = t(i.view, this.conf));
46
46
  }
47
47
  };
48
- return ae.fromClass(n, { decorations: (s) => s.decorations, ...o });
49
- }, v = (t, r, o) => {
48
+ return ne.fromClass(n, { decorations: (c) => c.decorations, ...a });
49
+ }, N = (t, r, a) => {
50
50
  const n = t.state.selection.ranges;
51
- for (let s of n)
52
- if (s.from >= r && s.from <= o || s.to >= r && s.to <= o || s.from <= r && s.to >= o)
51
+ for (let c of n)
52
+ if (c.from >= r && c.from <= a || c.to >= r && c.to <= a || c.from <= r && c.to >= a)
53
53
  return !0;
54
54
  return !1;
55
- }, E = (t, r) => {
56
- for (const { from: o, to: n } of t.visibleRanges)
57
- H(t.state).iterate({ ...r, from: o, to: n });
55
+ }, v = (t, r) => {
56
+ for (const { from: a, to: n } of t.visibleRanges)
57
+ $(t.state).iterate({ ...r, from: a, to: n });
58
58
  };
59
- function ge(t, r, o, n = 1) {
60
- const s = (i) => [
61
- (t[0] - (1 - i) * r[0]) / i,
62
- (t[1] - (1 - i) * r[1]) / i,
63
- (t[2] - (1 - i) * r[2]) / i
59
+ function be(t, r, a, n = 1) {
60
+ const c = (g) => [
61
+ (t[0] - (1 - g) * r[0]) / g,
62
+ (t[1] - (1 - g) * r[1]) / g,
63
+ (t[2] - (1 - g) * r[2]) / g
64
64
  ];
65
- let g = o, l = s(g);
66
- const a = l.map((i, d) => i < 0 && r[d] > 0 ? 1 - l[d] / r[d] : o), c = Math.max(...a);
67
- return c > g && (g = Math.min(c, n), t = s(g)), l = l.map((i) => Math.round(i < 0 ? 0 : i)), l.push(g), l;
65
+ let i = a, l = c(i);
66
+ const o = l.map((g, d) => g < 0 && r[d] > 0 ? 1 - l[d] / r[d] : a), s = Math.max(...o);
67
+ return s > i && (i = Math.min(s, n), t = c(i)), l = l.map((g) => Math.round(g < 0 ? 0 : g)), l.push(i), l;
68
68
  }
69
- function ie(t, r) {
70
- const o = ["Document"], n = {}, s = {
71
- HorizontalRule: (l, a, c = !0) => [
72
- h.line({ class: "hr " + (c ? "sw" : "") }).range(l),
73
- h.mark({ class: "mk" }).range(l, a)
69
+ function me(t, r) {
70
+ const a = ["Document"], n = {}, c = {
71
+ HorizontalRule: (l, o, s = !0) => [
72
+ h.line({ class: "hr " + (s ? "sw" : "") }).range(l),
73
+ h.mark({ class: "mk" }).range(l, o)
74
74
  ]
75
- }, g = [];
76
- return E(t, {
77
- enter: ({ type: l, from: a, to: c }) => (l.name in s && g.push(...s[l.name](a, c, v(t, a, c))), o.includes(l.name) || l.name in n)
78
- }), h.set(g, !1);
75
+ }, i = [];
76
+ return v(t, {
77
+ enter: ({ type: l, from: o, to: s }) => (l.name in c && i.push(...c[l.name](o, s, N(t, o, s))), a.includes(l.name) || l.name in n)
78
+ }), h.set(i, !1);
79
79
  }
80
- const he = (t) => {
80
+ const ue = (t) => {
81
81
  const {
82
82
  color: r = "black"
83
83
  } = t || {};
84
- return B.baseTheme({
84
+ return w.baseTheme({
85
85
  ".hr": { position: "relative" },
86
86
  ".hr > .mk": { fontSize: "0" },
87
87
  ".hr.sw > .mk": { fontSize: "inherit" },
@@ -94,29 +94,29 @@ const he = (t) => {
94
94
  },
95
95
  "&.cm-focused .hr.sw::before": { width: "0", height: "0" }
96
96
  });
97
- }, Q = (t = {}) => [
98
- C(ie, {}),
99
- he(t == null ? void 0 : t.color)
97
+ }, G = (t = {}) => [
98
+ C(me, {}),
99
+ ue(t == null ? void 0 : t.color)
100
100
  ];
101
- function de(t, r) {
102
- const o = ["FencedCode"], n = {
103
- StrongEmphasis: (l = !0, a, c) => h.mark({ class: "il st " + (l ? "sw" : "") }).range(a, c),
104
- Strikethrough: (l = !0, a, c) => h.mark({ class: "il sk " + (l ? "sw" : "") }).range(a, c),
105
- InlineCode: (l = !0, a, c) => h.mark({ class: "il ic " + (l ? "sw" : "") }).range(a, c),
106
- Emphasis: (l = !0, a, c) => h.mark({ class: "il it " + (l ? "sw" : "") }).range(a, c),
107
- Mark: (l, a) => h.mark({ class: "mkl" }).range(l, a)
108
- }, s = ["EmphasisMark", "CodeMark", "StrikethroughMark"], g = [];
109
- return E(t, {
110
- enter: ({ type: { name: l }, from: a, to: c }) => s.includes(l) ? (g.push(n.Mark(a, c)), !1) : (l in n && g.push(
101
+ function fe(t, r) {
102
+ const a = ["FencedCode"], n = {
103
+ StrongEmphasis: (l = !0, o, s) => h.mark({ class: "il st " + (l ? "sw" : "") }).range(o, s),
104
+ Strikethrough: (l = !0, o, s) => h.mark({ class: "il sk " + (l ? "sw" : "") }).range(o, s),
105
+ InlineCode: (l = !0, o, s) => h.mark({ class: "il ic " + (l ? "sw" : "") }).range(o, s),
106
+ Emphasis: (l = !0, o, s) => h.mark({ class: "il it " + (l ? "sw" : "") }).range(o, s),
107
+ Mark: (l, o) => h.mark({ class: "mkl" }).range(l, o)
108
+ }, c = ["EmphasisMark", "CodeMark", "StrikethroughMark"], i = [];
109
+ return v(t, {
110
+ enter: ({ type: { name: l }, from: o, to: s }) => c.includes(l) ? (i.push(n.Mark(o, s)), !1) : (l in n && i.push(
111
111
  n[l](
112
- v(t, a, c),
113
- a,
114
- c
112
+ N(t, o, s),
113
+ o,
114
+ s
115
115
  )
116
- ), !o.includes(l))
117
- }), h.set(g, !1);
116
+ ), !a.includes(l))
117
+ }), h.set(i, !1);
118
118
  }
119
- const be = B.baseTheme({
119
+ const pe = w.baseTheme({
120
120
  ".it ": { fontStyle: "italic" },
121
121
  ".st ": { fontWeight: "bold" },
122
122
  ".sk ": { textDecoration: "line-through" },
@@ -125,82 +125,82 @@ const be = B.baseTheme({
125
125
  paddingInline: ".6ch",
126
126
  borderRadius: ".6ch"
127
127
  }
128
- }), me = B.baseTheme({
128
+ }), ke = w.baseTheme({
129
129
  ".il .mkl": { fontSize: "0" },
130
130
  "&.cm-focused .il.sw .mkl": { fontSize: "inherit" }
131
- }), z = (t = {}) => {
131
+ }), Q = (t = {}) => {
132
132
  const {
133
133
  hideMarks: r = !0
134
134
  } = t;
135
135
  return [
136
- C(de, {}),
137
- be,
138
- r ? me : []
136
+ C(fe, {}),
137
+ pe,
138
+ r ? ke : []
139
139
  ];
140
140
  };
141
- class ue extends S {
142
- constructor(o) {
141
+ class xe extends M {
142
+ constructor(a) {
143
143
  super();
144
144
  L(this, "checked", !1);
145
- this.checked = o;
145
+ this.checked = a;
146
146
  }
147
147
  // eq(other) { return other.checked == this.checked }
148
148
  toDOM() {
149
- let o = document.createElement("span");
150
- o.setAttribute("aria-hidden", "true"), o.className = "TaskMark";
151
- let n = o.appendChild(document.createElement("input"));
152
- return n.type = "checkbox", n.checked = this.checked, o;
149
+ let a = document.createElement("span");
150
+ a.setAttribute("aria-hidden", "true"), a.className = "TaskMark";
151
+ let n = a.appendChild(document.createElement("input"));
152
+ return n.type = "checkbox", n.checked = this.checked, a;
153
153
  }
154
154
  ignoreEvent() {
155
155
  return !1;
156
156
  }
157
157
  }
158
- function fe(t, r) {
159
- const o = [
158
+ function ye(t, r) {
159
+ const a = [
160
160
  "Document",
161
161
  "ListItem",
162
162
  "Task"
163
163
  ], n = {
164
164
  BulletList: "bl",
165
165
  OrderedList: "ol"
166
- }, s = {
167
- ListMark: (a, c, i, d = !0) => h.mark({ class: `${i} lm ${d ? "sw" : ""}` }).range(a, c),
168
- TaskMarker: (a, c, i, d = !0) => {
169
- const b = t.state.doc.sliceString(a + 1, c - 1) === "x";
170
- return d ? h.mark({ class: `tm ${b ? "ck" : ""}` }).range(a, c) : h.replace({
171
- widget: new ue(b)
172
- }).range(a, c);
166
+ }, c = {
167
+ ListMark: (o, s, g, d = !0) => h.mark({ class: `${g} lm ${d ? "sw" : ""}` }).range(o, s),
168
+ TaskMarker: (o, s, g, d = !0) => {
169
+ const b = t.state.doc.sliceString(o + 1, s - 1) === "x";
170
+ return d ? h.mark({ class: `tm ${b ? "ck" : ""}` }).range(o, s) : h.replace({
171
+ widget: new xe(b)
172
+ }).range(o, s);
173
173
  }
174
- }, g = [], l = [];
175
- return E(t, {
176
- enter: ({ type: a, from: c, to: i }) => a.name in n ? (l.push({ name: a.name, from: c, to: i }), !0) : (a.name in s && g.push(s[a.name](
177
- c,
178
- i,
174
+ }, i = [], l = [];
175
+ return v(t, {
176
+ enter: ({ type: o, from: s, to: g }) => o.name in n ? (l.push({ name: o.name, from: s, to: g }), !0) : (o.name in c && i.push(c[o.name](
177
+ s,
178
+ g,
179
179
  n[l.slice(-1)[0].name],
180
- v(t, c, i)
181
- )), o.includes(a.name)),
182
- leave: ({ type: { name: a }, from: c, to: i }) => {
180
+ N(t, s, g)
181
+ )), a.includes(o.name)),
182
+ leave: ({ type: { name: o }, from: s, to: g }) => {
183
183
  const d = l.slice(-1)[0];
184
- d && d.name === a && d.from === c && d.to === i && l.pop();
184
+ d && d.name === o && d.from === s && d.to === g && l.pop();
185
185
  }
186
- }), h.set(g, !1);
186
+ }), h.set(i, !1);
187
187
  }
188
- const pe = (t, r) => {
188
+ const Fe = (t, r) => {
189
189
  var n;
190
- let o = t.target;
191
- if (o.nodeName === "INPUT" && ((n = o.parentElement) != null && n.classList.contains("TaskMark"))) return ke(r, r.posAtDOM(o));
192
- }, ke = (t, r) => {
193
- const o = r - 2, n = r - 1;
194
- let s = t.state.doc.sliceString(Math.max(0, o), n), g;
195
- if (s === "x") g = { from: o, to: n, insert: " " };
196
- else if (s === " ") g = { from: o, to: n, insert: "x" };
190
+ let a = t.target;
191
+ if (a.nodeName === "INPUT" && ((n = a.parentElement) != null && n.classList.contains("TaskMark"))) return we(r, r.posAtDOM(a));
192
+ }, we = (t, r) => {
193
+ const a = r - 2, n = r - 1;
194
+ let c = t.state.doc.sliceString(Math.max(0, a), n), i;
195
+ if (c === "x") i = { from: a, to: n, insert: " " };
196
+ else if (c === " ") i = { from: a, to: n, insert: "x" };
197
197
  else return !1;
198
- return t.dispatch({ changes: g }), !0;
199
- }, xe = (t) => {
198
+ return t.dispatch({ changes: i }), !0;
199
+ }, Be = (t) => {
200
200
  const {
201
201
  color: r = "black"
202
202
  } = t || {};
203
- return B.baseTheme({
203
+ return w.baseTheme({
204
204
  /* Bullet list Point */
205
205
  ".lm.bl": {
206
206
  position: "relative",
@@ -226,108 +226,108 @@ const pe = (t, r) => {
226
226
  color: "inherit"
227
227
  }
228
228
  });
229
- }, G = (t = {}) => [
230
- C(fe, {}, { eventHandlers: { mousedown: pe } }),
231
- xe(t == null ? void 0 : t.color)
232
- ], ye = (t, r) => {
229
+ }, _ = (t = {}) => [
230
+ C(ye, {}, { eventHandlers: { mousedown: Fe } }),
231
+ Be(t == null ? void 0 : t.color)
232
+ ], Ce = (t, r) => {
233
233
  var n;
234
- let o = t.target;
235
- if (o.nodeName === "BUTTON" && ((n = o.parentElement) != null && n.classList.contains("wg-codeblock"))) {
236
- const s = ["FencedCode", "CodeBlock"];
237
- let g = "";
234
+ let a = t.target;
235
+ if (a.nodeName === "BUTTON" && ((n = a.parentElement) != null && n.classList.contains("wg-codeblock"))) {
236
+ const c = ["FencedCode", "CodeBlock"];
237
+ let i = "";
238
238
  const l = {
239
- enter: ({ type: { name: a }, from: c, to: i, node: d }) => (s.includes(a) && (g = Fe(r, d.toTree(), c, i)), !s.includes(a))
239
+ enter: ({ type: { name: o }, from: s, to: g, node: d }) => (c.includes(o) && (i = Ne(r, d.toTree(), s, g)), !c.includes(o))
240
240
  };
241
- return H(r.state).iterate({
241
+ return $(r.state).iterate({
242
242
  ...l,
243
- from: r.posAtDOM(o),
244
- to: r.posAtDOM(o) + 2
245
- }), navigator.clipboard.writeText(g), !0;
243
+ from: r.posAtDOM(a),
244
+ to: r.posAtDOM(a) + 2
245
+ }), navigator.clipboard.writeText(i), !0;
246
246
  }
247
- }, Fe = (t, r, o, n) => {
248
- const s = ["CodeMark", "CodeInfo"];
249
- let g = t.state.doc.sliceString(o, n), l = /* @__PURE__ */ new Set();
247
+ }, Ne = (t, r, a, n) => {
248
+ const c = ["CodeMark", "CodeInfo"];
249
+ let i = t.state.doc.sliceString(a, n), l = /* @__PURE__ */ new Set();
250
250
  r.iterate({
251
251
  enter({ type: { name: d }, from: b, node: y }) {
252
- s.includes(d) && l.add(t.state.doc.lineAt(b + o).number);
252
+ c.includes(d) && l.add(t.state.doc.lineAt(b + a).number);
253
253
  }
254
254
  });
255
- const a = t.state.doc.lineAt(o), c = o - a.from, i = [];
256
- return g.split(`
255
+ const o = t.state.doc.lineAt(a), s = a - o.from, g = [];
256
+ return i.split(`
257
257
  `).forEach((d, b) => {
258
- l.has(b + a.number) || i.push(d.slice(c));
259
- }), i.join(`
258
+ l.has(b + o.number) || g.push(d.slice(s));
259
+ }), g.join(`
260
260
  `);
261
261
  };
262
- class W extends S {
263
- constructor(o, n, s) {
262
+ class I extends M {
263
+ constructor(a, n, c) {
264
264
  super();
265
265
  L(this, "classes", "");
266
- this.classes = o, this.width = n, this.marginLeft = s;
266
+ this.classes = a, this.width = n, this.marginLeft = c;
267
267
  }
268
268
  toDOM() {
269
- let o = document.createElement("span");
270
- return o.setAttribute("aria-hidden", "true"), o.className = this.classes + " vacio", o.textContent = " ", o.style.width = this.width, o.style.marginLeft = this.marginLeft, o;
269
+ let a = document.createElement("span");
270
+ return a.setAttribute("aria-hidden", "true"), a.className = this.classes + " vacio", a.textContent = " ", a.style.width = this.width, a.style.marginLeft = this.marginLeft, a;
271
271
  }
272
272
  ignoreEvent() {
273
273
  return !1;
274
274
  }
275
275
  }
276
- const we = (t) => `<svg class="cb-icon" viewBox="0 0 18 18" fill="none" xmlns="http://www.w3.org/2000/svg">
276
+ const ve = (t) => `<svg class="cb-icon" viewBox="0 0 18 18" fill="none" xmlns="http://www.w3.org/2000/svg">
277
277
  <path class="cb-icon-path cb.i1" fill-rule="evenodd" clip-rule="evenodd" d="M15 0C15.5304 0 16.0391 0.210714 16.4142 0.585786C16.7893 0.960859 17 1.46957 17 2V12C17 12.5304 16.7893 13.0391 16.4142 13.4142C16.0391 13.7893 15.5304 14 15 14H14V6C14 4.93913 13.5786 3.92172 12.8284 3.17157C12.0783 2.42143 11.0609 2 10 2H7C6.64895 1.99924 6.30395 2.09135 6 2.267V2C6 1.46957 6.21071 0.960859 6.58579 0.585786C6.96086 0.210714 7.46957 0 8 0H15Z"/>
278
278
  <path class="cb-icon-path cb.i1" fill-rule="evenodd" clip-rule="evenodd" d="M5 4.054V8H1.2C1.27464 7.84448 1.3691 7.69928 1.481 7.568L3.941 4.698C4.2169 4.37661 4.58771 4.15111 5 4.054ZM7 4V8C7 8.53043 6.78929 9.03914 6.41421 9.41421C6.03914 9.78929 5.53043 10 5 10H1V16C1 16.5304 1.21071 17.0391 1.58579 17.4142C1.96086 17.7893 2.46957 18 3 18H10C10.5304 18 11.0391 17.7893 11.4142 17.4142C11.7893 17.0391 12 16.5304 12 16V6C12 5.46957 11.7893 4.96086 11.4142 4.58579C11.0391 4.21071 10.5304 4 10 4H7Z"/>
279
279
  </svg>`;
280
- class Be extends S {
281
- constructor(r, o) {
282
- super(), this.type = r, this.code = o;
280
+ class Ee extends M {
281
+ constructor(r, a) {
282
+ super(), this.type = r, this.code = a;
283
283
  }
284
284
  toDOM() {
285
285
  let r = document.createElement("span");
286
286
  r.setAttribute("aria-hidden", "true"), r.className = "wg-codeblock";
287
- let o = document.createElement("button");
288
- return o.className = "wg-codeblock-btn", o.innerHTML = we(), r.appendChild(o), r;
287
+ let a = document.createElement("button");
288
+ return a.className = "wg-codeblock-btn", a.innerHTML = ve(), r.appendChild(a), r;
289
289
  }
290
290
  ignoreEvent() {
291
291
  return !1;
292
292
  }
293
293
  }
294
- const M = [];
295
- function I(t, r) {
294
+ const S = [];
295
+ function P(t, r) {
296
296
  const {
297
- mode: o
297
+ mode: a
298
298
  /* type, mark */
299
- } = r, n = ["Document", "Blockquote", "ListItem", "BulletList", "OrderedList"], s = {
300
- FencedCode: P,
301
- CodeBlock: P
302
- }, g = {
303
- CodeMark: (a, c, i) => [h.mark({ class: "cb-mk" }).range(c, i)],
304
- CodeInfo: (a, c, i) => [h.mark({ class: "cb-mi" }).range(c, i)]
299
+ } = r, n = ["Document", "Blockquote", "ListItem", "BulletList", "OrderedList"], c = {
300
+ FencedCode: K,
301
+ CodeBlock: K
302
+ }, i = {
303
+ CodeMark: (o, s, g) => [h.mark({ class: "cb-mk" }).range(s, g)],
304
+ CodeInfo: (o, s, g) => [h.mark({ class: "cb-mi" }).range(s, g)]
305
305
  }, l = [];
306
- return E(t, {
307
- enter: ({ type: { name: a }, from: c, to: i }) => (o === "type" && a in s && l.push(...s[a](t, c, i)), o === "mark" && a in g && l.push(...g[a](t, c, i)), n.includes(a) || a in s ? (M.push({ name: a, from: c, to: i }), !0) : !1),
308
- Leave: ({ type: { name: a }, from: c, to: i }) => n.includes(a) || a in s ? (M.pop(), !0) : !1
306
+ return v(t, {
307
+ enter: ({ type: { name: o }, from: s, to: g }) => (a === "type" && o in c && l.push(...c[o](t, s, g)), a === "mark" && o in i && l.push(...i[o](t, s, g)), n.includes(o) || o in c ? (S.push({ name: o, from: s, to: g }), !0) : !1),
308
+ Leave: ({ type: { name: o }, from: s, to: g }) => n.includes(o) || o in c ? (S.pop(), !0) : !1
309
309
  }), {
310
310
  type: h.set(l, !0),
311
311
  mark: h.set(l, !0)
312
- }[o];
312
+ }[a];
313
313
  }
314
- const P = (t, r, o) => {
315
- const n = [], s = M[M.length - 1], g = ["BulletList", "OrderedList", "ListItem"].some((f) => f === s.name), l = ["Blockquote"].some((f) => f === s.name), a = t.state.doc.lineAt(r), c = r - a.from, i = c > 0, d = v(t, a.from, o);
314
+ const K = (t, r, a) => {
315
+ const n = [], c = S[S.length - 1], i = ["BulletList", "OrderedList", "ListItem"].some((f) => f === c.name), l = ["Blockquote"].some((f) => f === c.name), o = t.state.doc.lineAt(r), s = r - o.from, g = s > 0, d = N(t, o.from, a);
316
316
  d || n.push(
317
- h.widget({ widget: new Be("view.state.sliceDoc(from, to)", "code"), side: 0 }).range(r + 1)
317
+ h.widget({ widget: new Ee("view.state.sliceDoc(from, to)", "code"), side: 0 }).range(r + 1)
318
318
  );
319
- const b = a.number, y = t.state.doc.sliceString(r, o).split(`
319
+ const b = o.number, y = t.state.doc.sliceString(r, a).split(`
320
320
  `).length;
321
321
  for (let f = b; f < y + b; f++) {
322
- const { from: u, to: F } = t.state.doc.line(f), w = "100% - 1.2ch", x = ["cb-content"];
322
+ const { from: u, to: F } = t.state.doc.line(f), B = "100% - 1.2ch", x = ["cb-content"];
323
323
  d && x.push("sw"), f === b && x.push("cb-start"), f === y + b - 1 && x.push("cb-end");
324
- const p = Math.max(u + c, 0);
324
+ const p = Math.max(u + s, 0);
325
325
  if (F < p)
326
326
  x.push("free"), n.push(
327
327
  h.widget({
328
- widget: new W(
328
+ widget: new I(
329
329
  x.join(" "),
330
- `calc(${w} - ${p - u}ch)`,
330
+ `calc(${B} - ${p - u}ch)`,
331
331
  `calc(${p - F}ch + 2px)`
332
332
  ),
333
333
  side: 1
@@ -336,26 +336,26 @@ const P = (t, r, o) => {
336
336
  else if (p === F)
337
337
  x.push("wg"), n.push(
338
338
  h.widget({
339
- widget: new W(
339
+ widget: new I(
340
340
  x.join(" "),
341
- `calc(${w} - ${p - u}ch)`
341
+ `calc(${B} - ${p - u}ch)`
342
342
  ),
343
343
  side: 1
344
344
  }).range(p)
345
345
  );
346
- else if (g || l || i) {
347
- const N = { style: `width: calc(${w} - ${p - u}ch)` };
348
- F > p && n.push(h.mark({ class: x.join(" "), attributes: N }).range(p, F)), u !== p && g && n.push(h.mark({ class: "cb-listsp" }).range(u, p)), u !== p && i && n.push(h.mark({ class: "cb-spacer" }).range(u, p)), u !== p && l && n.push(h.mark({ class: "cb-quote bq" }).range(u, p));
346
+ else if (i || l || g) {
347
+ const E = { style: `width: calc(${B} - ${p - u}ch)` };
348
+ F > p && n.push(h.mark({ class: x.join(" "), attributes: E }).range(p, F)), u !== p && i && n.push(h.mark({ class: "cb-listsp" }).range(u, p)), u !== p && g && n.push(h.mark({ class: "cb-spacer" }).range(u, p)), u !== p && l && n.push(h.mark({ class: "cb-quote bq" }).range(u, p));
349
349
  } else if (u !== F) {
350
- const N = { style: `width: calc(${w})` };
351
- n.push(h.mark({ class: x.join(" "), attributes: N }).range(u, F));
350
+ const E = { style: `width: calc(${B})` };
351
+ n.push(h.mark({ class: x.join(" "), attributes: E }).range(u, F));
352
352
  }
353
353
  n.push(h.line({ class: "cb-line" }).range(u));
354
354
  }
355
355
  return n;
356
- }, Ce = () => {
357
- const n = "4px", s = "1lh";
358
- return B.baseTheme({
356
+ }, Te = () => {
357
+ const n = "4px", c = "1lh";
358
+ return w.baseTheme({
359
359
  ".cb-start": { borderRadius: `${n} ${n} 0 0` },
360
360
  ".cb-end ": { borderRadius: `0 0 ${n} ${n}` },
361
361
  ".cb-start.cb-end": { borderRadius: `${n}` },
@@ -399,12 +399,12 @@ const P = (t, r, o) => {
399
399
  outline: "none",
400
400
  justifyContent: "center",
401
401
  alignItems: "center",
402
- height: `calc(${s} + 4px )`,
402
+ height: `calc(${c} + 4px )`,
403
403
  width: "5ch"
404
404
  },
405
405
  ".cb-icon": {
406
- width: s,
407
- height: s,
406
+ width: c,
407
+ height: c,
408
408
  pointerEvents: "none",
409
409
  fill: "currentColor",
410
410
  opacity: "0.7"
@@ -423,41 +423,41 @@ const P = (t, r, o) => {
423
423
  width: "5ch"
424
424
  }
425
425
  });
426
- }, _ = (t) => [
427
- C(I, { mode: "mark" }),
428
- C(I, { mode: "type" }, { eventHandlers: { mousedown: ye } }),
429
- Ce()
426
+ }, Y = (t) => [
427
+ C(P, { mode: "mark" }),
428
+ C(P, { mode: "type" }, { eventHandlers: { mousedown: Ce } }),
429
+ Te()
430
430
  ];
431
- function Ne(t, r) {
432
- const o = ["Document"], n = {
433
- ATXHeading1: (l, a = !0) => h.line({ class: "h1 hg " + (a ? "sw" : "") }).range(l),
434
- ATXHeading2: (l, a = !0) => h.line({ class: "h2 hg " + (a ? "sw" : "") }).range(l),
435
- ATXHeading3: (l, a = !0) => h.line({ class: "h3 hg " + (a ? "sw" : "") }).range(l),
436
- ATXHeading4: (l, a = !0) => h.line({ class: "h4 hg " + (a ? "sw" : "") }).range(l),
437
- ATXHeading5: (l, a = !0) => h.line({ class: "h5 hg " + (a ? "sw" : "") }).range(l),
438
- ATXHeading6: (l, a = !0) => h.line({ class: "h6 hg " + (a ? "sw" : "") }).range(l)
439
- }, s = {
440
- HeaderMark: (l, a) => h.mark({ class: "mk" }).range(l, a)
441
- }, g = [];
442
- return E(t, {
443
- enter: ({ type: l, from: a, to: c }) => (l.name in n && g.push(n[l.name](a, v(t, a, c))), l.name in s && g.push(s[l.name](a, c + 1)), o.includes(l.name) || l.name in n)
444
- }), h.set(g, !1);
431
+ function Ae(t, r) {
432
+ const a = ["Document"], n = {
433
+ ATXHeading1: (l, o = !0) => h.line({ class: "h1 hg " + (o ? "sw" : "") }).range(l),
434
+ ATXHeading2: (l, o = !0) => h.line({ class: "h2 hg " + (o ? "sw" : "") }).range(l),
435
+ ATXHeading3: (l, o = !0) => h.line({ class: "h3 hg " + (o ? "sw" : "") }).range(l),
436
+ ATXHeading4: (l, o = !0) => h.line({ class: "h4 hg " + (o ? "sw" : "") }).range(l),
437
+ ATXHeading5: (l, o = !0) => h.line({ class: "h5 hg " + (o ? "sw" : "") }).range(l),
438
+ ATXHeading6: (l, o = !0) => h.line({ class: "h6 hg " + (o ? "sw" : "") }).range(l)
439
+ }, c = {
440
+ HeaderMark: (l, o) => h.mark({ class: "mk" }).range(l, o)
441
+ }, i = [];
442
+ return v(t, {
443
+ enter: ({ type: l, from: o, to: s }) => (l.name in n && i.push(n[l.name](o, N(t, o, s))), l.name in c && i.push(c[l.name](o, s + 1)), a.includes(l.name) || l.name in n)
444
+ }), h.set(i, !1);
445
445
  }
446
- const ve = B.baseTheme({
446
+ const Le = w.baseTheme({
447
447
  ".h1 ": { fontSize: "2.6rem" },
448
448
  ".h2 ": { fontSize: "2.0rem" },
449
449
  ".h3 ": { fontSize: "1.8rem" },
450
450
  ".h4 ": { fontSize: "1.6rem" },
451
451
  ".h5 ": { fontSize: "1.4rem" },
452
452
  ".h6 ": { fontSize: "1.2rem" }
453
- }), Ee = B.baseTheme({
453
+ }), Me = w.baseTheme({
454
454
  ".hg .mk": { fontSize: "0" },
455
455
  "&.cm-focused .hg.sw .mk": { fontSize: "inherit" }
456
- }), Y = (t = {}) => [
457
- C(Ne, {}),
458
- ve,
459
- Ee
460
- ], Ae = {
456
+ }), j = (t = {}) => [
457
+ C(Ae, {}),
458
+ Le,
459
+ Me
460
+ ], De = {
461
461
  version: "1.7.1",
462
462
  latte: {
463
463
  name: "Latte",
@@ -3251,14 +3251,14 @@ const ve = B.baseTheme({
3251
3251
  }
3252
3252
  }
3253
3253
  }
3254
- }, D = (t) => Object.entries(t), { version: sr, ...Te } = Ae, j = D(Te).reduce((t, [r, o]) => (t[r] = {
3255
- ...o,
3256
- colorEntries: D(o.colors),
3257
- ansiColorEntries: D(o.ansiColors)
3254
+ }, D = (t) => Object.entries(t), { version: pr, ...Se } = De, U = D(Se).reduce((t, [r, a]) => (t[r] = {
3255
+ ...a,
3256
+ colorEntries: D(a.colors),
3257
+ ansiColorEntries: D(a.ansiColors)
3258
3258
  }, t), {});
3259
- D(j);
3260
- const k = ({ variant: t, settings: r, styles: o }) => {
3261
- const n = K.theme({
3259
+ D(U);
3260
+ const k = ({ variant: t, settings: r, styles: a }) => {
3261
+ const n = q.theme({
3262
3262
  // eslint-disable-next-line @typescript-eslint/naming-convention
3263
3263
  "&": {
3264
3264
  backgroundColor: r.background,
@@ -3285,8 +3285,8 @@ const k = ({ variant: t, settings: r, styles: o }) => {
3285
3285
  }
3286
3286
  }, {
3287
3287
  dark: t === "dark"
3288
- }), s = oe.define(o);
3289
- return [n, ne(s)];
3288
+ }), c = le.define(a);
3289
+ return [n, ce(c)];
3290
3290
  };
3291
3291
  k({
3292
3292
  variant: "dark",
@@ -4238,18 +4238,18 @@ k({
4238
4238
  }
4239
4239
  ]
4240
4240
  });
4241
- const Le = new le(), De = (t = "latte") => {
4242
- const r = j[t].colors, o = r.base, n = t === "latte" ? "#484b64" : r.text.hex, s = Me(r.crust.rgb, o.rgb, 0.1);
4241
+ const qe = new se(), He = (t = "latte") => {
4242
+ const r = U[t].colors, a = r.base, n = t === "latte" ? "#484b64" : r.text.hex, c = $e(r.crust.rgb, a.rgb, 0.1);
4243
4243
  return [
4244
4244
  k({
4245
4245
  variant: t === "latte" ? "light" : "dark",
4246
4246
  settings: {
4247
- background: o.hex,
4247
+ background: a.hex,
4248
4248
  foreground: n,
4249
4249
  caret: r.rosewater.hex,
4250
4250
  // selection: selection,
4251
- lineHighlight: q(r.overlay1.rgb, 0.1),
4252
- gutterBackground: o.hex,
4251
+ lineHighlight: H(r.overlay1.rgb, 0.1),
4252
+ gutterBackground: a.hex,
4253
4253
  gutterForeground: n
4254
4254
  },
4255
4255
  styles: [
@@ -4321,13 +4321,13 @@ const Le = new le(), De = (t = "latte") => {
4321
4321
  { tag: e.macroName, color: r.peach.hex }
4322
4322
  ]
4323
4323
  }),
4324
- K.theme({
4324
+ q.theme({
4325
4325
  // Editor
4326
- "& .cm-selectionBackground, ::selection": { background: `${q(r.overlay2.rgb, 0.3)} !important` },
4326
+ "& .cm-selectionBackground, ::selection": { background: `${H(r.overlay2.rgb, 0.3)} !important` },
4327
4327
  // Code
4328
- "& .cb-content, & .ic": { backgroundColor: s },
4328
+ "& .cb-content, & .ic": { backgroundColor: c },
4329
4329
  ".cb-icon": { fill: n },
4330
- ".wg-codeblock-btn:hover": { backgroundColor: q(r.overlay1.rgb, 0.2) },
4330
+ ".wg-codeblock-btn:hover": { backgroundColor: H(r.overlay1.rgb, 0.2) },
4331
4331
  // Blockquote
4332
4332
  ".bq-none-mark": { "--bq-none-mark": n },
4333
4333
  ".bq-note-mark": { "--bq-note-mark": r.blue.hex },
@@ -4337,72 +4337,80 @@ const Le = new le(), De = (t = "latte") => {
4337
4337
  ".bq-caution-mark": { "--bq-caution-mark": r.red.hex },
4338
4338
  // Links
4339
4339
  "& a.url": { color: r.blue.hex },
4340
- "& a.url:visited": { color: r.mauve.hex }
4340
+ "& a.url:visited": { color: r.mauve.hex },
4341
+ // Html
4342
+ "& .cm-rendered-tag": {
4343
+ border: `1px solid ${r.surface2.hex}`,
4344
+ borderRadius: "4px",
4345
+ fontSize: ".8em",
4346
+ padding: "0px 3px",
4347
+ background: r.surface0.hex
4348
+ }
4341
4349
  }, { dark: t !== "latte" })
4342
4350
  ];
4343
- }, Me = (t, r, o) => {
4344
- const n = [t.r, t.g, t.b], s = [r.r, r.g, r.b];
4345
- return `rgba(${ge(n, s, o, 0.3).join(", ")})`;
4346
- }, q = (t, r) => `rgba(${t.r}, ${t.g}, ${t.b}, ${r})`;
4347
- function Se(t, r) {
4348
- const o = ["Document", "ListItem", "BulletList", "OrderedList"], n = {
4351
+ }, $e = (t, r, a) => {
4352
+ const n = [t.r, t.g, t.b], c = [r.r, r.g, r.b];
4353
+ return `rgba(${be(n, c, a, 0.3).join(", ")})`;
4354
+ }, H = (t, r) => `rgba(${t.r}, ${t.g}, ${t.b}, ${r})`;
4355
+ function Oe(t, r) {
4356
+ const a = ["Document", "ListItem", "BulletList", "OrderedList"], n = {
4349
4357
  none: "bq-none-mark",
4350
4358
  note: "bq-note-mark",
4351
4359
  tip: "bq-tip-mark",
4352
4360
  warning: "bq-warning-mark",
4353
4361
  important: "bq-important-mark",
4354
4362
  caution: "bq-caution-mark"
4355
- }, s = {
4356
- QuoteMark: (a, c, i) => {
4363
+ }, c = {
4364
+ QuoteMark: (o, s, g) => {
4357
4365
  const d = ["qt-mk"];
4358
- return i in n ? d.push(n[i]) : d.push(n.none), h.mark({
4366
+ return g in n ? d.push(n[g]) : d.push(n.none), h.mark({
4359
4367
  class: d.join(" ")
4360
- }).range(a, c);
4368
+ }).range(o, s);
4361
4369
  },
4362
- BlockquoteLine: (a, c) => h.line({ class: "bq-line " + (c ? "sw" : "") }).range(a),
4363
- quoteLine: (a, c, i) => {
4364
- const d = `calc(100% - ${Math.max(0, i) + 1.2}ch)`;
4370
+ BlockquoteLine: (o, s) => h.line({ class: "bq-line " + (s ? "sw" : "") }).range(o),
4371
+ quoteLine: (o, s, g) => {
4372
+ const d = `calc(100% - ${Math.max(0, g) + 1.2}ch)`;
4365
4373
  return h.mark({
4366
4374
  class: "bq-text-line",
4367
4375
  attributes: { style: `width: ${d}` }
4368
- }).range(a, c);
4376
+ }).range(o, s);
4369
4377
  }
4370
- }, g = (a, c, i, d) => {
4371
- const b = [], { from: y, to: f } = c, u = i.number, F = (w, x) => {
4378
+ }, i = (o, s, g, d) => {
4379
+ const b = [], { from: y, to: f } = s, u = g.number, F = (B, x) => {
4372
4380
  let p = 0;
4373
- const N = [];
4374
- let T = 0;
4381
+ const E = [];
4382
+ let A = 0;
4375
4383
  return {
4376
- enter({ name: A, node: $, from: O, to: R }) {
4377
- A === "Blockquote" && N.push(qe(a, $)), A === "QuoteMark" && (b.push(s[A](O, R, N[p])), T = R, p++);
4384
+ enter({ name: T, node: O, from: R, to: W }) {
4385
+ T === "Blockquote" && E.push(Re(o, O)), T === "QuoteMark" && (b.push(c[T](R, W, E[p])), A = W, p++);
4378
4386
  },
4379
- leave({ name: A, from: $, to: O }) {
4380
- A === "Paragraph" && T < x && b.push(s.quoteLine(T, x, T - w));
4387
+ leave({ name: T, from: O, to: R }) {
4388
+ T === "Paragraph" && A < x && b.push(c.quoteLine(A, x, A - B));
4381
4389
  }
4382
4390
  };
4383
4391
  };
4384
- for (let w = u; w < d + u; w++) {
4385
- const { from: x, to: p } = a.state.doc.line(w), { from: N, to: T } = c, A = v(a, N, T);
4386
- b.push(s.BlockquoteLine(x, A)), H(a.state).iterate({ from: x, to: p, ...F(x, p) });
4392
+ for (let B = u; B < d + u; B++) {
4393
+ const { from: x, to: p } = o.state.doc.line(B), { from: E, to: A } = s, T = N(o, E, A);
4394
+ b.push(c.BlockquoteLine(x, T)), $(o.state).iterate({ from: x, to: p, ...F(x, p) });
4387
4395
  }
4388
4396
  return b;
4389
4397
  }, l = [];
4390
- return E(t, {
4391
- enter: ({ name: a }) => !(a in o),
4392
- leave: ({ name: a, from: c, to: i, node: d }) => {
4393
- if (a !== "Blockquote") return;
4394
- const b = t.state.sliceDoc(c, i).split(`
4395
- `), y = t.state.doc.lineAt(c);
4396
- l.push(...g(t, d, y, b.length));
4398
+ return v(t, {
4399
+ enter: ({ name: o }) => !(o in a),
4400
+ leave: ({ name: o, from: s, to: g, node: d }) => {
4401
+ if (o !== "Blockquote") return;
4402
+ const b = t.state.sliceDoc(s, g).split(`
4403
+ `), y = t.state.doc.lineAt(s);
4404
+ l.push(...i(t, d, y, b.length));
4397
4405
  }
4398
4406
  }), h.set(l, !0);
4399
4407
  }
4400
- const qe = (t, r) => {
4401
- const o = r.getChild("QuoteType");
4402
- if (!o) return "none";
4403
- const n = o.getChild("QuoteTypeText");
4408
+ const Re = (t, r) => {
4409
+ const a = r.getChild("QuoteType");
4410
+ if (!a) return "none";
4411
+ const n = a.getChild("QuoteTypeText");
4404
4412
  return n ? t.state.sliceDoc(n.from, n.to).toLowerCase() : "none";
4405
- }, He = () => B.baseTheme({
4413
+ }, We = () => w.baseTheme({
4406
4414
  "& .qt-mk": {
4407
4415
  // outline: "1px red solid",
4408
4416
  position: "relative",
@@ -4419,6 +4427,9 @@ const qe = (t, r) => {
4419
4427
  height: "200vh",
4420
4428
  zIndex: "-1"
4421
4429
  },
4430
+ "&.cm-focused .bq-line.sw .qt-mk::after": {
4431
+ opacity: 0.3
4432
+ },
4422
4433
  "& .bq-line": { lineHeight: "1.2lh", overflowY: "hidden" },
4423
4434
  "&.cm-focused .bq-line.sw .bq-none-mark, .bq-none-mark::after": { color: "var(--bq-none-mark)" },
4424
4435
  "&.cm-focused .bq-line.sw .bq-note-mark, .bq-note-mark::after": { color: "var(--bq-note-mark)" },
@@ -4428,17 +4439,15 @@ const qe = (t, r) => {
4428
4439
  "&.cm-focused .bq-line.sw .bq-caution-mark, .bq-caution-mark::after": { color: "var(--bq-caution-mark)" },
4429
4440
  "& .bq-text-line": {
4430
4441
  lineHeight: "1lh",
4431
- // backgroundColor: "rgba(0, 0, 0, 0.1)",
4432
4442
  display: "inline-block",
4433
- // maxWidth: "95%",
4434
4443
  paddingLeft: "6px",
4435
4444
  textIndent: "-7px",
4436
4445
  ariaHidden: "true"
4437
4446
  }
4438
- }), $e = (t) => [
4439
- C(Se, t),
4440
- He()
4441
- ], Oe = {
4447
+ }), Ie = (t) => [
4448
+ C(Oe, t),
4449
+ We()
4450
+ ], Pe = {
4442
4451
  name: "QuoteTypeParser",
4443
4452
  parse(t, r) {
4444
4453
  if ((() => {
@@ -4448,98 +4457,98 @@ const qe = (t, r) => {
4448
4457
  })()) {
4449
4458
  const n = r.text.match(/^(\s*>\s*)+(\[!\w+\])\s*$/);
4450
4459
  if (n && n[2]) {
4451
- const s = n[2], g = r.text.indexOf(s), l = g + s.length, a = t.elt("QuoteType", t.lineStart + g, t.lineStart + l);
4452
- a.children = [
4453
- t.elt("QuoteTypeMark", t.lineStart + g, t.lineStart + g + 2),
4454
- t.elt("QuoteTypeText", t.lineStart + g + 2, t.lineStart + l - 1),
4460
+ const c = n[2], i = r.text.indexOf(c), l = i + c.length, o = t.elt("QuoteType", t.lineStart + i, t.lineStart + l);
4461
+ o.children = [
4462
+ t.elt("QuoteTypeMark", t.lineStart + i, t.lineStart + i + 2),
4463
+ t.elt("QuoteTypeText", t.lineStart + i + 2, t.lineStart + l - 1),
4455
4464
  t.elt("QuoteTypeMark", t.lineStart + l - 1, t.lineStart + l)
4456
- ], t.addElement(a);
4465
+ ], t.addElement(o);
4457
4466
  }
4458
4467
  }
4459
4468
  return !1;
4460
4469
  }
4461
- }, Re = {
4470
+ }, Ke = {
4462
4471
  defineNodes: [
4463
4472
  { name: "QuoteType", style: { "QuoteType/...": e.content } },
4464
4473
  { name: "QuoteTypeMark", style: e.processingInstruction },
4465
4474
  { name: "QuoteTypeText", style: e.bool }
4466
4475
  ],
4467
- parseBlock: [Oe]
4468
- }, U = (t, r, o) => {
4469
- const n = t.state.sliceDoc(r, o), s = n.match(/\[(.*)\]/);
4470
- return s !== null && s.length > 1 ? {
4471
- text: s[1],
4472
- from: r + n.indexOf(s[1]),
4473
- to: r + 1 + s[1].length
4476
+ parseBlock: [Pe]
4477
+ }, V = (t, r, a) => {
4478
+ const n = t.state.sliceDoc(r, a), c = n.match(/\[(.*)\]/);
4479
+ return c !== null && c.length > 1 ? {
4480
+ text: c[1],
4481
+ from: r + n.indexOf(c[1]),
4482
+ to: r + 1 + c[1].length
4474
4483
  } : { text: null };
4475
4484
  };
4476
- function We(t, r) {
4477
- const o = ["FencedCode", "Image", "Link"], n = {
4485
+ function ze(t, r) {
4486
+ const a = ["FencedCode", "Image", "Link"], n = {
4478
4487
  Link: {
4479
4488
  marks: ["LinkMark"],
4480
4489
  url: "URL"
4481
4490
  }
4482
- }, s = {
4483
- Link: (l, a, c) => h.mark({ class: "link " + (c ? "sw" : "") }).range(l, a),
4484
- LinkMark: (l, a) => h.mark({ class: "lk-mk" }).range(l, a),
4485
- TextDec: (l, a, c) => h.mark({
4491
+ }, c = {
4492
+ Link: (l, o, s) => h.mark({ class: "link " + (s ? "sw" : "") }).range(l, o),
4493
+ LinkMark: (l, o) => h.mark({ class: "lk-mk" }).range(l, o),
4494
+ TextDec: (l, o, s) => h.mark({
4486
4495
  class: "lk-text url",
4487
4496
  tagName: "a",
4488
- attributes: { href: c, target: "_blank" }
4489
- }).range(l, a),
4490
- URL: (l, a, c) => h.mark({
4497
+ attributes: { href: s, target: "_blank" }
4498
+ }).range(l, o),
4499
+ URL: (l, o, s) => h.mark({
4491
4500
  class: "lk-url url",
4492
4501
  tagName: "a",
4493
- attributes: { href: c, target: "_blank" }
4494
- }).range(l, a)
4495
- }, g = [];
4496
- return E(t, {
4497
- enter: ({ type: { name: l }, from: a, to: c, node: i }) => {
4498
- if (l === "URL" && g.push(s.URL(a, c, t.state.sliceDoc(a, c))), !(l in n)) return !o.includes(l);
4499
- g.push(s.Link(a, c, v(t, a, c)));
4500
- const d = n[l].marks.flatMap((f) => i.getChildren(f));
4501
- g.push(...d.map(({ from: f, to: u }) => s.LinkMark(f, u)));
4502
- const b = i.getChild(n[l].url);
4502
+ attributes: { href: s, target: "_blank" }
4503
+ }).range(l, o)
4504
+ }, i = [];
4505
+ return v(t, {
4506
+ enter: ({ type: { name: l }, from: o, to: s, node: g }) => {
4507
+ if (l === "URL" && i.push(c.URL(o, s, t.state.sliceDoc(o, s))), !(l in n)) return !a.includes(l);
4508
+ i.push(c.Link(o, s, N(t, o, s)));
4509
+ const d = n[l].marks.flatMap((f) => g.getChildren(f));
4510
+ i.push(...d.map(({ from: f, to: u }) => c.LinkMark(f, u)));
4511
+ const b = g.getChild(n[l].url);
4503
4512
  let y = null;
4504
4513
  if (b !== null) {
4505
4514
  const { from: f, to: u } = b;
4506
- y = t.state.sliceDoc(f, u), g.push(s.URL(f, u, y));
4515
+ y = t.state.sliceDoc(f, u), i.push(c.URL(f, u, y));
4507
4516
  }
4508
- if (i.getChild("Image") === null) {
4509
- const { text: f, from: u, to: F } = U(t, a, c);
4510
- f !== null && y !== null && g.push(s.TextDec(u, F, y));
4517
+ if (g.getChild("Image") === null) {
4518
+ const { text: f, from: u, to: F } = V(t, o, s);
4519
+ f !== null && y !== null && i.push(c.TextDec(u, F, y));
4511
4520
  }
4512
4521
  return !1;
4513
4522
  }
4514
- }), h.set(g, !0);
4523
+ }), h.set(i, !0);
4515
4524
  }
4516
- const Ie = (t, r) => t.ctrlKey ? Pe(
4525
+ const Ge = (t, r) => t.ctrlKey ? Qe(
4517
4526
  t.target
4518
4527
  /* as HTMLElement */
4519
- ) : !1, Pe = (t) => {
4528
+ ) : !1, Qe = (t) => {
4520
4529
  if (t.nodeName === "A" && t.href && t.classList.contains("url"))
4521
4530
  return window.open(t.href, t.target), !0;
4522
- }, Ke = B.baseTheme({
4531
+ }, _e = w.baseTheme({
4523
4532
  ".lk-mk, .link > .lk-url": { display: "none" },
4524
4533
  "&.cm-focused .link.sw .lk-mk, &.cm-focused .link.sw .lk-url": { display: "inherit" }
4525
- }), Qe = (t = {}) => {
4534
+ }), Ye = (t = {}) => {
4526
4535
  const {
4527
4536
  hideMarks: r = !0
4528
4537
  } = t;
4529
4538
  return [
4530
- C(We, {}, { eventHandlers: { mousedown: Ie } }),
4531
- Ke
4539
+ C(ze, {}, { eventHandlers: { mousedown: Ge } }),
4540
+ _e
4532
4541
  ];
4533
4542
  };
4534
- class ze extends S {
4535
- constructor(r, o = null, n = "[image]") {
4536
- super(), this.img = r, this.url = o, this.alt = n;
4543
+ class je extends M {
4544
+ constructor(r, a = null, n = "[image]") {
4545
+ super(), this.img = r, this.url = a, this.alt = n;
4537
4546
  }
4538
4547
  toDOM() {
4539
4548
  let r = document.createElement("img");
4540
4549
  if (r.src = this.img, r.alt = this.alt, r.style.minWidth = "100px", this.url) {
4541
- let o = document.createElement("a");
4542
- return o.href = this.url, o.target = "_blank", o.classList.add("url"), o.appendChild(r), o;
4550
+ let a = document.createElement("a");
4551
+ return a.href = this.url, a.target = "_blank", a.classList.add("url"), a.appendChild(r), a;
4543
4552
  } else
4544
4553
  return r;
4545
4554
  }
@@ -4550,90 +4559,173 @@ class ze extends S {
4550
4559
  return !1;
4551
4560
  }
4552
4561
  }
4553
- function Ge(t, r) {
4554
- const o = ["FencedCode", "Image"], n = [];
4555
- return E(t, {
4556
- enter: ({ type: { name: s }, from: g, to: l, node: a }) => {
4557
- if (s === "Image" && !v(t, g, l)) {
4558
- const { from: c, to: i } = a.getChild("URL"), d = t.state.sliceDoc(c, i), { text: b } = U(t, g, l);
4562
+ function Ue(t, r) {
4563
+ const a = ["FencedCode", "Image"], n = [];
4564
+ return v(t, {
4565
+ enter: ({ type: { name: c }, from: i, to: l, node: o }) => {
4566
+ if (c === "Image" && !N(t, i, l)) {
4567
+ const { from: s, to: g } = o.getChild("URL"), d = t.state.sliceDoc(s, g), { text: b } = V(t, i, l);
4559
4568
  n.push(
4560
4569
  h.replace({
4561
- widget: new ze(d, _e(t, a), b)
4562
- }).range(g, l)
4570
+ widget: new je(d, Ve(t, o), b)
4571
+ }).range(i, l)
4563
4572
  );
4564
4573
  }
4565
- return !o.includes(s);
4574
+ return !a.includes(c);
4566
4575
  }
4567
4576
  }), h.set(n, !1);
4568
4577
  }
4569
- const _e = (t, r) => {
4578
+ const Ve = (t, r) => {
4570
4579
  const n = r.parent.getChild("URL");
4571
4580
  if (n !== null) {
4572
- const { from: s, to: g } = n;
4573
- return t.state.sliceDoc(s, g);
4581
+ const { from: c, to: i } = n;
4582
+ return t.state.sliceDoc(c, i);
4574
4583
  }
4575
4584
  return null;
4576
- }, Ye = (t, r) => t.ctrlKey ? je(
4585
+ }, Xe = (t, r) => t.ctrlKey ? Ze(
4577
4586
  t.target
4578
4587
  /* as HTMLElement */
4579
- ) : !1, je = (t) => {
4588
+ ) : !1, Ze = (t) => {
4580
4589
  const r = t.parentElement ?? !1;
4581
4590
  if (t.nodeName === "IMG" && r && r.nodeName === "A" && r.classList.contains("url"))
4582
4591
  return !0;
4583
- }, Ue = B.baseTheme({}), Ve = (t = {}) => {
4592
+ }, Je = w.baseTheme({}), er = (t = {}) => {
4584
4593
  const {
4585
4594
  hideMarks: r = !0
4586
4595
  } = t;
4587
4596
  return [
4588
- C(Ge, {}, { eventHandlers: { mousedown: Ye } }),
4589
- Ue
4597
+ C(Ue, {}, { eventHandlers: { mousedown: Xe } }),
4598
+ Je
4590
4599
  ];
4591
- }, Xe = (t = { markdown: {} }) => {
4600
+ };
4601
+ class z extends M {
4602
+ constructor(r, a = !1) {
4603
+ super(), this.content = r, this.tag = a;
4604
+ }
4605
+ toDOM() {
4606
+ const r = document.createElement("div");
4607
+ r.className = "cm-html-widget", r.setAttribute("aria-hidden", "true");
4608
+ const a = this.content.replace(/^```html\n?/, "").replace(/```$/, "").trim();
4609
+ return r.innerHTML = (this.tag ? '<span class="cm-rendered-tag">RTAG</span>' : "") + a, r.querySelectorAll("script").forEach((n) => {
4610
+ n.parentNode.removeChild(n);
4611
+ }), r;
4612
+ }
4613
+ ignoreEvent(r) {
4614
+ return r.type === "click";
4615
+ }
4616
+ eq(r) {
4617
+ return r.content === this.content;
4618
+ }
4619
+ }
4620
+ const X = ie.define(), rr = ge.define({
4621
+ create(t) {
4622
+ return h.none;
4623
+ },
4624
+ update(t, r) {
4625
+ t = t.map(r.changes);
4626
+ for (let a of r.effects)
4627
+ if (a.is(X))
4628
+ return a.value;
4629
+ return t;
4630
+ },
4631
+ provide: (t) => q.decorations.from(t)
4632
+ });
4633
+ function tr(t) {
4634
+ const r = [
4635
+ /<br>/,
4636
+ /<img .*\/>/
4637
+ ], a = {
4638
+ HTMLBlock: (c, i) => {
4639
+ const l = t.state.doc.sliceString(c, i);
4640
+ return [h.replace({
4641
+ widget: new z(l),
4642
+ inclusive: !1
4643
+ }).range(c, i)];
4644
+ },
4645
+ HTMLTag: (c, i) => {
4646
+ const l = t.state.doc.sliceString(c, i);
4647
+ return console.log(l), r.some((o) => o.test(l)) ? (console.log(l), [
4648
+ h.replace({
4649
+ widget: new z(l, !0),
4650
+ inclusive: !1
4651
+ }).range(c, i)
4652
+ ]) : [];
4653
+ }
4654
+ }, n = [];
4655
+ return v(t, {
4656
+ enter: ({ type: c, from: i, to: l, node: o }) => {
4657
+ c.name in a && (!N(t, i, l) || !t.hasFocus) && n.push(...a[c.name](i, l));
4658
+ }
4659
+ }), h.set(n);
4660
+ }
4661
+ const ar = w.baseTheme({
4662
+ "& .cm-html-widget": {
4663
+ all: "unset"
4664
+ // outline: "red solid 2px",
4665
+ },
4666
+ "& .cm-html-widget > *": {
4667
+ paddingTop: "0",
4668
+ paddingBottom: "0",
4669
+ marginBottom: "0",
4670
+ marginTop: "0"
4671
+ },
4672
+ "& .cm-widgetBuffer": { display: "none" }
4673
+ }), or = q.updateListener.of((t) => {
4674
+ if (t.selectionSet || t.docChanged || t.focusChanged || t.geometryChanged) {
4675
+ const r = tr(t.view);
4676
+ t.view.dispatch({ effects: X.of(r) });
4677
+ }
4678
+ }), nr = (t = {}) => [
4679
+ rr,
4680
+ or,
4681
+ ar
4682
+ ], lr = (t = { markdown: {} }) => {
4592
4683
  const {
4593
4684
  markdown: {
4594
4685
  defaultCodeLanguage: r,
4595
- codeLanguages: o,
4686
+ codeLanguages: a,
4596
4687
  addKeymap: n,
4597
- base: s,
4598
- completeHTMLTags: g,
4688
+ base: c,
4689
+ completeHTMLTags: i,
4599
4690
  htmlTagLanguage: l,
4600
- extensions: a = []
4691
+ extensions: o = []
4601
4692
  },
4602
- inline: c,
4603
- Heading: i,
4693
+ inline: s,
4694
+ Heading: g,
4604
4695
  Hr: d,
4605
4696
  List: b,
4606
4697
  Code: y
4607
4698
  } = t, f = {
4608
4699
  defaultCodeLanguage: r,
4609
- codeLanguages: o || Z,
4700
+ codeLanguages: a || ee,
4610
4701
  addKeymap: n,
4611
- base: s,
4612
- completeHTMLTags: g,
4702
+ base: c,
4703
+ completeHTMLTags: i,
4613
4704
  htmlTagLanguage: l,
4614
- extensions: [...a, ee, se, Re]
4705
+ extensions: [...o, te, de, Ke]
4615
4706
  };
4616
4707
  return [
4617
- J(f),
4618
- Le.of(De()),
4619
- z(c),
4620
- Y(i),
4621
- G(b),
4622
- Q(d),
4623
- _(),
4624
- Qe(),
4625
- Ve(),
4626
- $e()
4708
+ re(f),
4709
+ qe.of(He()),
4710
+ Q(s),
4711
+ j(g),
4712
+ _(b),
4713
+ G(d),
4714
+ Y(),
4715
+ Ye(),
4716
+ er(),
4717
+ Ie(),
4718
+ nr()
4627
4719
  ];
4628
4720
  };
4629
- typeof window < "u" && (window.gnosis = Xe, window.HrPlugin = Q, window.ListPlugin = G, window.CodePlugin = _, window.InlinePlugin = z, window.HeadingPlugin = Y);
4721
+ typeof window < "u" && (window.gnosis = lr, window.HrPlugin = G, window.ListPlugin = _, window.CodePlugin = Y, window.InlinePlugin = Q, window.HeadingPlugin = j);
4630
4722
  export {
4631
- _ as CodePlugin,
4632
- Y as HeadingPlugin,
4633
- Q as HrPlugin,
4634
- z as InlinePlugin,
4635
- G as ListPlugin,
4636
- De as catppuccin,
4637
- Xe as gnosis,
4638
- Le as themeVariant
4723
+ Y as CodePlugin,
4724
+ j as HeadingPlugin,
4725
+ G as HrPlugin,
4726
+ Q as InlinePlugin,
4727
+ _ as ListPlugin,
4728
+ He as catppuccin,
4729
+ lr as gnosis,
4730
+ qe as themeVariant
4639
4731
  };