ghost 5.110.4 → 5.112.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.
- package/components/tryghost-adapter-cache-memory-ttl-5.112.0.tgz +0 -0
- package/components/tryghost-adapter-cache-redis-5.112.0.tgz +0 -0
- package/components/{tryghost-adapter-manager-5.110.4.tgz → tryghost-adapter-manager-5.112.0.tgz} +0 -0
- package/components/tryghost-announcement-bar-settings-5.112.0.tgz +0 -0
- package/components/{tryghost-api-framework-5.110.4.tgz → tryghost-api-framework-5.112.0.tgz} +0 -0
- package/components/tryghost-api-version-compatibility-service-5.112.0.tgz +0 -0
- package/components/{tryghost-audience-feedback-5.110.4.tgz → tryghost-audience-feedback-5.112.0.tgz} +0 -0
- package/components/tryghost-bookshelf-repository-5.112.0.tgz +0 -0
- package/components/tryghost-bootstrap-socket-5.112.0.tgz +0 -0
- package/components/tryghost-captcha-service-5.112.0.tgz +0 -0
- package/components/tryghost-constants-5.112.0.tgz +0 -0
- package/components/tryghost-custom-fonts-5.112.0.tgz +0 -0
- package/components/{tryghost-custom-theme-settings-service-5.110.4.tgz → tryghost-custom-theme-settings-service-5.112.0.tgz} +0 -0
- package/components/{tryghost-data-generator-5.110.4.tgz → tryghost-data-generator-5.112.0.tgz} +0 -0
- package/components/{tryghost-domain-events-5.110.4.tgz → tryghost-domain-events-5.112.0.tgz} +0 -0
- package/components/tryghost-donations-5.112.0.tgz +0 -0
- package/components/tryghost-email-addresses-5.112.0.tgz +0 -0
- package/components/tryghost-email-analytics-provider-mailgun-5.112.0.tgz +0 -0
- package/components/{tryghost-email-analytics-service-5.110.4.tgz → tryghost-email-analytics-service-5.112.0.tgz} +0 -0
- package/components/tryghost-email-content-generator-5.112.0.tgz +0 -0
- package/components/tryghost-email-events-5.112.0.tgz +0 -0
- package/components/tryghost-email-service-5.112.0.tgz +0 -0
- package/components/tryghost-email-suppression-list-5.112.0.tgz +0 -0
- package/components/{tryghost-express-dynamic-redirects-5.110.4.tgz → tryghost-express-dynamic-redirects-5.112.0.tgz} +0 -0
- package/components/{tryghost-external-media-inliner-5.110.4.tgz → tryghost-external-media-inliner-5.112.0.tgz} +0 -0
- package/components/tryghost-extract-api-key-5.112.0.tgz +0 -0
- package/components/tryghost-ghost-5.112.0.tgz +0 -0
- package/components/{tryghost-html-to-plaintext-5.110.4.tgz → tryghost-html-to-plaintext-5.112.0.tgz} +0 -0
- package/components/tryghost-i18n-5.112.0.tgz +0 -0
- package/components/tryghost-identity-token-service-5.112.0.tgz +0 -0
- package/components/tryghost-importer-handler-content-files-5.112.0.tgz +0 -0
- package/components/{tryghost-importer-revue-5.110.4.tgz → tryghost-importer-revue-5.112.0.tgz} +0 -0
- package/components/tryghost-in-memory-repository-5.112.0.tgz +0 -0
- package/components/{tryghost-job-manager-5.110.4.tgz → tryghost-job-manager-5.112.0.tgz} +0 -0
- package/components/{tryghost-link-redirects-5.110.4.tgz → tryghost-link-redirects-5.112.0.tgz} +0 -0
- package/components/tryghost-link-replacer-5.112.0.tgz +0 -0
- package/components/{tryghost-magic-link-5.110.4.tgz → tryghost-magic-link-5.112.0.tgz} +0 -0
- package/components/tryghost-mail-events-5.112.0.tgz +0 -0
- package/components/tryghost-mailgun-client-5.112.0.tgz +0 -0
- package/components/{tryghost-member-attribution-5.110.4.tgz → tryghost-member-attribution-5.112.0.tgz} +0 -0
- package/components/{tryghost-member-events-5.110.4.tgz → tryghost-member-events-5.112.0.tgz} +0 -0
- package/components/{tryghost-members-api-5.110.4.tgz → tryghost-members-api-5.112.0.tgz} +0 -0
- package/components/{tryghost-members-csv-5.110.4.tgz → tryghost-members-csv-5.112.0.tgz} +0 -0
- package/components/{tryghost-members-importer-5.110.4.tgz → tryghost-members-importer-5.112.0.tgz} +0 -0
- package/components/{tryghost-members-offers-5.110.4.tgz → tryghost-members-offers-5.112.0.tgz} +0 -0
- package/components/{tryghost-members-payments-5.110.4.tgz → tryghost-members-payments-5.112.0.tgz} +0 -0
- package/components/{tryghost-members-ssr-5.110.4.tgz → tryghost-members-ssr-5.112.0.tgz} +0 -0
- package/components/{tryghost-members-stripe-service-5.110.4.tgz → tryghost-members-stripe-service-5.112.0.tgz} +0 -0
- package/components/{tryghost-milestones-5.110.4.tgz → tryghost-milestones-5.112.0.tgz} +0 -0
- package/components/tryghost-minifier-5.112.0.tgz +0 -0
- package/components/tryghost-mw-api-version-mismatch-5.112.0.tgz +0 -0
- package/components/{tryghost-mw-cache-control-5.110.4.tgz → tryghost-mw-cache-control-5.112.0.tgz} +0 -0
- package/components/tryghost-mw-error-handler-5.112.0.tgz +0 -0
- package/components/{tryghost-mw-session-from-token-5.110.4.tgz → tryghost-mw-session-from-token-5.112.0.tgz} +0 -0
- package/components/{tryghost-mw-update-user-last-seen-5.110.4.tgz → tryghost-mw-update-user-last-seen-5.112.0.tgz} +0 -0
- package/components/tryghost-mw-version-match-5.112.0.tgz +0 -0
- package/components/tryghost-mw-vhost-5.112.0.tgz +0 -0
- package/components/tryghost-package-json-5.112.0.tgz +0 -0
- package/components/{tryghost-post-events-5.110.4.tgz → tryghost-post-events-5.112.0.tgz} +0 -0
- package/components/{tryghost-post-revisions-5.110.4.tgz → tryghost-post-revisions-5.112.0.tgz} +0 -0
- package/components/{tryghost-posts-service-5.110.4.tgz → tryghost-posts-service-5.112.0.tgz} +0 -0
- package/components/tryghost-prometheus-metrics-5.112.0.tgz +0 -0
- package/components/tryghost-recommendations-5.112.0.tgz +0 -0
- package/components/tryghost-referrers-5.112.0.tgz +0 -0
- package/components/{tryghost-security-5.110.4.tgz → tryghost-security-5.112.0.tgz} +0 -0
- package/components/tryghost-session-service-5.112.0.tgz +0 -0
- package/components/tryghost-settings-path-manager-5.112.0.tgz +0 -0
- package/components/{tryghost-slack-notifications-5.110.4.tgz → tryghost-slack-notifications-5.112.0.tgz} +0 -0
- package/components/tryghost-tiers-5.112.0.tgz +0 -0
- package/components/tryghost-version-notifications-data-service-5.112.0.tgz +0 -0
- package/components/tryghost-webmentions-5.112.0.tgz +0 -0
- package/core/built/admin/assets/admin-x-activitypub/admin-x-activitypub.js +12799 -10270
- package/core/built/admin/assets/admin-x-demo/admin-x-demo.js +2 -2
- package/core/built/admin/assets/admin-x-demo/{index-82e381fb.mjs → index-0040480a.mjs} +3252 -2891
- package/core/built/admin/assets/admin-x-demo/{modals-b20a9ede.mjs → modals-fb35c86c.mjs} +2 -2
- package/core/built/admin/assets/admin-x-settings/{CodeEditorView-ea62c29b.mjs → CodeEditorView-ad8698fe.mjs} +624 -618
- package/core/built/admin/assets/admin-x-settings/admin-x-settings.js +3 -3
- package/core/built/admin/assets/admin-x-settings/{index-af8cf9cf.mjs → index-2713e469.mjs} +6892 -6469
- package/core/built/admin/assets/admin-x-settings/{index-4b25c788.mjs → index-463cec50.mjs} +2 -2
- package/core/built/admin/assets/admin-x-settings/{modals-cb2dc7b7.mjs → modals-033e8fc4.mjs} +7888 -7669
- package/core/built/admin/assets/{chunk.524.3096e68df5b51dacf872.js → chunk.524.db49da6fd8ae155205a4.js} +6 -6
- package/core/built/admin/assets/{chunk.582.e225422f90639ff30544.js → chunk.582.0bf715eb6807f7641706.js} +8 -8
- package/core/built/admin/assets/{ghost-98d002d50a5e01d2100b2c387a849249.js → ghost-62bd4d4c837d453e1038808dc1cd1e4c.js} +43 -42
- package/core/built/admin/assets/img/ap-nodes-01ee317529e6353a1c34a062c388f1e7.png +0 -0
- package/core/built/admin/assets/koenig-lexical/index.css +1 -1
- package/core/built/admin/assets/koenig-lexical/koenig-lexical.js +18314 -17680
- package/core/built/admin/assets/koenig-lexical/koenig-lexical.umd.js +229 -200
- package/core/built/admin/assets/posts/posts.js +24137 -24156
- package/core/built/admin/index.html +3 -3
- package/core/frontend/helpers/get.js +2 -3
- package/core/frontend/services/sitemap/SiteMapManager.js +1 -1
- package/core/frontend/src/cards/css/cta.css +40 -30
- package/core/frontend/src/cards/css/video.css +1 -0
- package/core/server/api/endpoints/settings-public.js +3 -2
- package/core/server/api/endpoints/utils/serializers/input/settings.js +3 -1
- package/core/server/api/endpoints/utils/serializers/input/utils/settings-key-group-mapper.js +2 -1
- package/core/server/api/endpoints/utils/serializers/input/utils/settings-key-type-mapper.js +2 -1
- package/core/server/data/migrations/versions/5.111/2025-03-05-16-36-39-add-captcha-setting.js +8 -0
- package/core/server/data/migrations/versions/5.112/2025-03-10-10-01-01-add-require-mfa-setting.js +8 -0
- package/core/server/data/schema/default-settings/default-settings.json +14 -0
- package/core/server/models/invite.js +4 -5
- package/core/server/models/post.js +3 -9
- package/core/server/models/relations/authors.js +2 -4
- package/core/server/models/role-utils.js +38 -0
- package/core/server/models/role.js +5 -3
- package/core/server/models/user.js +5 -3
- package/core/server/services/activitypub/ActivityPubService.js +116 -0
- package/core/server/services/activitypub/ActivityPubService.ts +139 -0
- package/core/server/services/activitypub/ActivityPubServiceWrapper.js +1 -1
- package/core/server/services/link-tracking/ClickEvent.js +25 -0
- package/core/server/services/link-tracking/FullPostLink.js +36 -0
- package/core/server/services/link-tracking/LinkClickRepository.js +1 -1
- package/core/server/services/link-tracking/LinkClickTrackingService.js +237 -0
- package/core/server/services/link-tracking/PostLink.js +29 -0
- package/core/server/services/link-tracking/PostLinkRepository.js +2 -2
- package/core/server/services/link-tracking/index.js +1 -1
- package/core/server/services/members-events/EventStorage.js +61 -0
- package/core/server/services/members-events/LastSeenAtCache.js +96 -0
- package/core/server/services/members-events/LastSeenAtUpdater.js +192 -0
- package/core/server/services/members-events/index.js +3 -1
- package/core/server/services/mentions-email-report/MentionEmailReportJob.js +117 -0
- package/core/server/services/mentions-email-report/service.js +3 -3
- package/core/server/services/staff/StaffService.js +179 -0
- package/core/server/services/staff/StaffServiceEmails.js +527 -0
- package/core/server/services/staff/email-templates/donation.hbs +119 -0
- package/core/server/services/staff/email-templates/donation.txt.js +15 -0
- package/core/server/services/staff/email-templates/mention-report.hbs +136 -0
- package/core/server/services/staff/email-templates/mention-report.txt.js +19 -0
- package/core/server/services/staff/email-templates/new-free-signup.hbs +118 -0
- package/core/server/services/staff/email-templates/new-free-signup.txt.js +13 -0
- package/core/server/services/staff/email-templates/new-milestone-received.hbs +142 -0
- package/core/server/services/staff/email-templates/new-milestone-received.txt.js +13 -0
- package/core/server/services/staff/email-templates/new-paid-cancellation.hbs +125 -0
- package/core/server/services/staff/email-templates/new-paid-cancellation.txt.js +13 -0
- package/core/server/services/staff/email-templates/new-paid-started.hbs +124 -0
- package/core/server/services/staff/email-templates/new-paid-started.txt.js +13 -0
- package/core/server/services/staff/email-templates/partials/preview.hbs +6 -0
- package/core/server/services/staff/email-templates/partials/styles.hbs +114 -0
- package/core/server/services/staff/email-templates/recommendation-received.hbs +154 -0
- package/core/server/services/staff/email-templates/recommendation-received.txt.js +13 -0
- package/core/server/services/staff/index.js +1 -1
- package/core/server/services/staff/milestone-email-config.js +207 -0
- package/core/server/services/stats/MembersStatsService.js +167 -0
- package/core/server/services/stats/MrrStatsService.js +161 -0
- package/core/server/services/stats/ReferrersStatsService.js +164 -0
- package/core/server/services/stats/StatsService.js +63 -0
- package/core/server/services/stats/SubscriptionStatsService.js +180 -0
- package/core/server/services/stats/service.js +1 -1
- package/core/server/services/url/Resources.js +2 -2
- package/core/shared/config/defaults.json +2 -1
- package/core/shared/events/URLResourceUpdatedEvent.js +33 -0
- package/core/shared/settings-cache/public.js +1 -0
- package/package.json +155 -158
- package/tsconfig.json +105 -0
- package/tsconfig.tsbuildinfo +1 -0
- package/yarn.lock +347 -136
- package/components/tryghost-activitypub-5.110.4.tgz +0 -0
- package/components/tryghost-adapter-cache-memory-ttl-5.110.4.tgz +0 -0
- package/components/tryghost-adapter-cache-redis-5.110.4.tgz +0 -0
- package/components/tryghost-announcement-bar-settings-5.110.4.tgz +0 -0
- package/components/tryghost-api-version-compatibility-service-5.110.4.tgz +0 -0
- package/components/tryghost-bookshelf-repository-5.110.4.tgz +0 -0
- package/components/tryghost-bootstrap-socket-5.110.4.tgz +0 -0
- package/components/tryghost-captcha-service-5.110.4.tgz +0 -0
- package/components/tryghost-constants-5.110.4.tgz +0 -0
- package/components/tryghost-custom-fonts-5.110.4.tgz +0 -0
- package/components/tryghost-donations-5.110.4.tgz +0 -0
- package/components/tryghost-dynamic-routing-events-5.110.4.tgz +0 -0
- package/components/tryghost-email-addresses-5.110.4.tgz +0 -0
- package/components/tryghost-email-analytics-provider-mailgun-5.110.4.tgz +0 -0
- package/components/tryghost-email-content-generator-5.110.4.tgz +0 -0
- package/components/tryghost-email-events-5.110.4.tgz +0 -0
- package/components/tryghost-email-service-5.110.4.tgz +0 -0
- package/components/tryghost-email-suppression-list-5.110.4.tgz +0 -0
- package/components/tryghost-extract-api-key-5.110.4.tgz +0 -0
- package/components/tryghost-ghost-5.110.4.tgz +0 -0
- package/components/tryghost-i18n-5.110.4.tgz +0 -0
- package/components/tryghost-identity-token-service-5.110.4.tgz +0 -0
- package/components/tryghost-importer-handler-content-files-5.110.4.tgz +0 -0
- package/components/tryghost-in-memory-repository-5.110.4.tgz +0 -0
- package/components/tryghost-link-replacer-5.110.4.tgz +0 -0
- package/components/tryghost-link-tracking-5.110.4.tgz +0 -0
- package/components/tryghost-mail-events-5.110.4.tgz +0 -0
- package/components/tryghost-mailgun-client-5.110.4.tgz +0 -0
- package/components/tryghost-members-events-service-5.110.4.tgz +0 -0
- package/components/tryghost-mentions-email-report-5.110.4.tgz +0 -0
- package/components/tryghost-minifier-5.110.4.tgz +0 -0
- package/components/tryghost-mw-api-version-mismatch-5.110.4.tgz +0 -0
- package/components/tryghost-mw-error-handler-5.110.4.tgz +0 -0
- package/components/tryghost-mw-version-match-5.110.4.tgz +0 -0
- package/components/tryghost-mw-vhost-5.110.4.tgz +0 -0
- package/components/tryghost-package-json-5.110.4.tgz +0 -0
- package/components/tryghost-prometheus-metrics-5.110.4.tgz +0 -0
- package/components/tryghost-recommendations-5.110.4.tgz +0 -0
- package/components/tryghost-referrers-5.110.4.tgz +0 -0
- package/components/tryghost-session-service-5.110.4.tgz +0 -0
- package/components/tryghost-settings-path-manager-5.110.4.tgz +0 -0
- package/components/tryghost-staff-service-5.110.4.tgz +0 -0
- package/components/tryghost-stats-service-5.110.4.tgz +0 -0
- package/components/tryghost-tiers-5.110.4.tgz +0 -0
- package/components/tryghost-version-notifications-data-service-5.110.4.tgz +0 -0
- package/components/tryghost-webmentions-5.110.4.tgz +0 -0
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { E as p, F as de, v as
|
|
3
|
-
const
|
|
4
|
-
let { state: e } = t, r = e.doc.lineAt(e.selection.main.from), n =
|
|
5
|
-
return n.line ?
|
|
1
|
+
import { e as ce, s as qn, g as z, l as wt, cg as _n, f as Tt, ch as Hn, u as Vn, j as N, ci as zn, p as Un, R as $n, z as Gn, r as Kn, H as Jn, q as jn } from "./index-2713e469.mjs";
|
|
2
|
+
import { E as p, F as de, v as Re, S as we, o as d, w as _e, C as Qn, x as Yn, y as Ot, z as It, A as Ce, B as Pt, G as Wt, H as Ft, J as $e, K as et, M as w, O as X, g as tt, b as Ge, Q as Zn, R as te, V as Nt, U as x, W as Xn, X as er, Y as ue, Z as B, _ as tr, $ as nr, a0 as nt, a1 as he, a2 as rr, a3 as or, a4 as ir, a5 as sr, a6 as lr, a7 as ar, a8 as cr, a9 as ur, aa as hr, ab as fr, ac as dr, ad as mr, ae as gr, af as pr, ag as qt, ah as yr, ai as xr, aj as kr, ak as br, al as Sr, am as Cr, an as _t, ao as vr, ap as Ar, t as f, aq as Mr } from "./index-9cc1df42.mjs";
|
|
3
|
+
const Lr = (t) => {
|
|
4
|
+
let { state: e } = t, r = e.doc.lineAt(e.selection.main.from), n = ot(t.state, r.from);
|
|
5
|
+
return n.line ? Br(t) : n.block ? Er(t) : !1;
|
|
6
6
|
};
|
|
7
|
-
function
|
|
7
|
+
function rt(t, e) {
|
|
8
8
|
return ({ state: r, dispatch: n }) => {
|
|
9
9
|
if (r.readOnly)
|
|
10
10
|
return !1;
|
|
@@ -12,25 +12,25 @@ function nt(t, e) {
|
|
|
12
12
|
return o ? (n(r.update(o)), !0) : !1;
|
|
13
13
|
};
|
|
14
14
|
}
|
|
15
|
-
const
|
|
16
|
-
|
|
15
|
+
const Br = /* @__PURE__ */ rt(
|
|
16
|
+
Tr,
|
|
17
17
|
0
|
|
18
18
|
/* CommentOption.Toggle */
|
|
19
|
-
),
|
|
20
|
-
|
|
19
|
+
), Dr = /* @__PURE__ */ rt(
|
|
20
|
+
Ht,
|
|
21
21
|
0
|
|
22
22
|
/* CommentOption.Toggle */
|
|
23
|
-
),
|
|
24
|
-
(t, e) =>
|
|
23
|
+
), Er = /* @__PURE__ */ rt(
|
|
24
|
+
(t, e) => Ht(t, e, wr(e)),
|
|
25
25
|
0
|
|
26
26
|
/* CommentOption.Toggle */
|
|
27
27
|
);
|
|
28
|
-
function
|
|
28
|
+
function ot(t, e) {
|
|
29
29
|
let r = t.languageDataAt("commentTokens", e);
|
|
30
30
|
return r.length ? r[0] : {};
|
|
31
31
|
}
|
|
32
32
|
const ae = 50;
|
|
33
|
-
function
|
|
33
|
+
function Rr(t, { open: e, close: r }, n, o) {
|
|
34
34
|
let i = t.sliceDoc(n - ae, n), s = t.sliceDoc(o, o + ae), l = /\s*$/.exec(i)[0].length, a = /^\s*/.exec(s)[0].length, c = i.length - l;
|
|
35
35
|
if (i.slice(c - e.length, c) == e && s.slice(a, a + r.length) == r)
|
|
36
36
|
return {
|
|
@@ -51,7 +51,7 @@ function Dr(t, { open: e, close: r }, n, o) {
|
|
|
51
51
|
}
|
|
52
52
|
} : null;
|
|
53
53
|
}
|
|
54
|
-
function
|
|
54
|
+
function wr(t) {
|
|
55
55
|
let e = [];
|
|
56
56
|
for (let r of t.selection.ranges) {
|
|
57
57
|
let n = t.doc.lineAt(r.from), o = r.to <= n.to ? n : t.doc.lineAt(r.to), i = e.length - 1;
|
|
@@ -59,11 +59,11 @@ function Er(t) {
|
|
|
59
59
|
}
|
|
60
60
|
return e;
|
|
61
61
|
}
|
|
62
|
-
function
|
|
63
|
-
let n = r.map((i) =>
|
|
62
|
+
function Ht(t, e, r = e.selection.ranges) {
|
|
63
|
+
let n = r.map((i) => ot(e, i.from).block);
|
|
64
64
|
if (!n.every((i) => i))
|
|
65
65
|
return null;
|
|
66
|
-
let o = r.map((i, s) =>
|
|
66
|
+
let o = r.map((i, s) => Rr(e, n[s], i.from, i.to));
|
|
67
67
|
if (t != 2 && !o.every((i) => i))
|
|
68
68
|
return { changes: e.changes(r.map((i, s) => o[s] ? [] : [{ from: i.from, insert: n[s].open + " " }, { from: i.to, insert: " " + n[s].close }])) };
|
|
69
69
|
if (t != 1 && o.some((i) => i)) {
|
|
@@ -77,10 +77,10 @@ function qt(t, e, r = e.selection.ranges) {
|
|
|
77
77
|
}
|
|
78
78
|
return null;
|
|
79
79
|
}
|
|
80
|
-
function
|
|
80
|
+
function Tr(t, e, r = e.selection.ranges) {
|
|
81
81
|
let n = [], o = -1;
|
|
82
82
|
for (let { from: i, to: s } of r) {
|
|
83
|
-
let l = n.length, a = 1e9, c =
|
|
83
|
+
let l = n.length, a = 1e9, c = ot(e, i).line;
|
|
84
84
|
if (c) {
|
|
85
85
|
for (let u = i; u <= s; ) {
|
|
86
86
|
let h = e.doc.lineAt(u);
|
|
@@ -114,9 +114,9 @@ function Rr(t, e, r = e.selection.ranges) {
|
|
|
114
114
|
}
|
|
115
115
|
return null;
|
|
116
116
|
}
|
|
117
|
-
const
|
|
117
|
+
const Ke = /* @__PURE__ */ et.define(), Or = /* @__PURE__ */ et.define(), Ir = /* @__PURE__ */ de.define(), Vt = /* @__PURE__ */ de.define({
|
|
118
118
|
combine(t) {
|
|
119
|
-
return
|
|
119
|
+
return Re(t, {
|
|
120
120
|
minDepth: 100,
|
|
121
121
|
newGroupDelay: 500,
|
|
122
122
|
joinToEvent: (e, r) => r
|
|
@@ -127,63 +127,63 @@ const Ge = /* @__PURE__ */ Xe.define(), wr = /* @__PURE__ */ Xe.define(), Tr = /
|
|
|
127
127
|
});
|
|
128
128
|
}
|
|
129
129
|
});
|
|
130
|
-
function
|
|
130
|
+
function Pr(t) {
|
|
131
131
|
let e = 0;
|
|
132
132
|
return t.iterChangedRanges((r, n) => e = n), e;
|
|
133
133
|
}
|
|
134
|
-
const
|
|
134
|
+
const zt = /* @__PURE__ */ we.define({
|
|
135
135
|
create() {
|
|
136
136
|
return O.empty;
|
|
137
137
|
},
|
|
138
138
|
update(t, e) {
|
|
139
|
-
let r = e.state.facet(
|
|
139
|
+
let r = e.state.facet(Vt), n = e.annotation(Ke);
|
|
140
140
|
if (n) {
|
|
141
|
-
let a = e.docChanged ? d.single(
|
|
142
|
-
return c ? h =
|
|
141
|
+
let a = e.docChanged ? d.single(Pr(e.changes)) : void 0, c = A.fromTransaction(e, a), u = n.side, h = u == 0 ? t.undone : t.done;
|
|
142
|
+
return c ? h = ve(h, h.length, r.minDepth, c) : h = Gt(h, e.startState.selection), new O(u == 0 ? n.rest : h, u == 0 ? h : n.rest);
|
|
143
143
|
}
|
|
144
|
-
let o = e.annotation(
|
|
144
|
+
let o = e.annotation(Or);
|
|
145
145
|
if ((o == "full" || o == "before") && (t = t.isolate()), e.annotation(_e.addToHistory) === !1)
|
|
146
146
|
return e.changes.empty ? t : t.addMapping(e.changes.desc);
|
|
147
|
-
let i =
|
|
147
|
+
let i = A.fromTransaction(e), s = e.annotation(_e.time), l = e.annotation(_e.userEvent);
|
|
148
148
|
return i ? t = t.addChanges(i, s, l, r, e) : e.selection && (t = t.addSelection(e.startState.selection, s, l, r.newGroupDelay)), (o == "full" || o == "after") && (t = t.isolate()), t;
|
|
149
149
|
},
|
|
150
150
|
toJSON(t) {
|
|
151
151
|
return { done: t.done.map((e) => e.toJSON()), undone: t.undone.map((e) => e.toJSON()) };
|
|
152
152
|
},
|
|
153
153
|
fromJSON(t) {
|
|
154
|
-
return new O(t.done.map(
|
|
154
|
+
return new O(t.done.map(A.fromJSON), t.undone.map(A.fromJSON));
|
|
155
155
|
}
|
|
156
156
|
});
|
|
157
|
-
function
|
|
157
|
+
function Wr(t = {}) {
|
|
158
158
|
return [
|
|
159
|
-
|
|
160
|
-
|
|
159
|
+
zt,
|
|
160
|
+
Vt.of(t),
|
|
161
161
|
p.domEventHandlers({
|
|
162
162
|
beforeinput(e, r) {
|
|
163
|
-
let n = e.inputType == "historyUndo" ?
|
|
163
|
+
let n = e.inputType == "historyUndo" ? Ut : e.inputType == "historyRedo" ? Je : null;
|
|
164
164
|
return n ? (e.preventDefault(), n(r)) : !1;
|
|
165
165
|
}
|
|
166
166
|
})
|
|
167
167
|
];
|
|
168
168
|
}
|
|
169
|
-
function
|
|
169
|
+
function Te(t, e) {
|
|
170
170
|
return function({ state: r, dispatch: n }) {
|
|
171
171
|
if (!e && r.readOnly)
|
|
172
172
|
return !1;
|
|
173
|
-
let o = r.field(
|
|
173
|
+
let o = r.field(zt, !1);
|
|
174
174
|
if (!o)
|
|
175
175
|
return !1;
|
|
176
176
|
let i = o.pop(t, r, e);
|
|
177
177
|
return i ? (n(i), !0) : !1;
|
|
178
178
|
};
|
|
179
179
|
}
|
|
180
|
-
const
|
|
181
|
-
class
|
|
180
|
+
const Ut = /* @__PURE__ */ Te(0, !1), Je = /* @__PURE__ */ Te(1, !1), Fr = /* @__PURE__ */ Te(0, !0), Nr = /* @__PURE__ */ Te(1, !0);
|
|
181
|
+
class A {
|
|
182
182
|
constructor(e, r, n, o, i) {
|
|
183
183
|
this.changes = e, this.effects = r, this.mapped = n, this.startSelection = o, this.selectionsAfter = i;
|
|
184
184
|
}
|
|
185
185
|
setSelAfter(e) {
|
|
186
|
-
return new
|
|
186
|
+
return new A(this.changes, this.effects, this.mapped, this.startSelection, e);
|
|
187
187
|
}
|
|
188
188
|
toJSON() {
|
|
189
189
|
var e, r, n;
|
|
@@ -195,28 +195,28 @@ class v {
|
|
|
195
195
|
};
|
|
196
196
|
}
|
|
197
197
|
static fromJSON(e) {
|
|
198
|
-
return new
|
|
198
|
+
return new A(e.changes && Qn.fromJSON(e.changes), [], e.mapped && Yn.fromJSON(e.mapped), e.startSelection && d.fromJSON(e.startSelection), e.selectionsAfter.map(d.fromJSON));
|
|
199
199
|
}
|
|
200
200
|
// This does not check `addToHistory` and such, it assumes the
|
|
201
201
|
// transaction needs to be converted to an item. Returns null when
|
|
202
202
|
// there are no changes or effects in the transaction.
|
|
203
203
|
static fromTransaction(e, r) {
|
|
204
|
-
let n =
|
|
205
|
-
for (let o of e.startState.facet(
|
|
204
|
+
let n = D;
|
|
205
|
+
for (let o of e.startState.facet(Ir)) {
|
|
206
206
|
let i = o(e);
|
|
207
207
|
i.length && (n = n.concat(i));
|
|
208
208
|
}
|
|
209
|
-
return !n.length && e.changes.empty ? null : new
|
|
209
|
+
return !n.length && e.changes.empty ? null : new A(e.changes.invert(e.startState.doc), n, void 0, r || e.startState.selection, D);
|
|
210
210
|
}
|
|
211
211
|
static selection(e) {
|
|
212
|
-
return new
|
|
212
|
+
return new A(void 0, D, void 0, void 0, e);
|
|
213
213
|
}
|
|
214
214
|
}
|
|
215
|
-
function
|
|
215
|
+
function ve(t, e, r, n) {
|
|
216
216
|
let o = e + 1 > r + 20 ? e - r - 1 : 0, i = t.slice(o, e);
|
|
217
217
|
return i.push(n), i;
|
|
218
218
|
}
|
|
219
|
-
function
|
|
219
|
+
function qr(t, e) {
|
|
220
220
|
let r = [], n = !1;
|
|
221
221
|
return t.iterChangedRanges((o, i) => r.push(o, i)), e.iterChangedRanges((o, i, s, l) => {
|
|
222
222
|
for (let a = 0; a < r.length; ) {
|
|
@@ -225,46 +225,46 @@ function Fr(t, e) {
|
|
|
225
225
|
}
|
|
226
226
|
}), n;
|
|
227
227
|
}
|
|
228
|
-
function
|
|
228
|
+
function _r(t, e) {
|
|
229
229
|
return t.ranges.length == e.ranges.length && t.ranges.filter((r, n) => r.empty != e.ranges[n].empty).length === 0;
|
|
230
230
|
}
|
|
231
|
-
function
|
|
231
|
+
function $t(t, e) {
|
|
232
232
|
return t.length ? e.length ? t.concat(e) : t : e;
|
|
233
233
|
}
|
|
234
|
-
const
|
|
235
|
-
function
|
|
234
|
+
const D = [], Hr = 200;
|
|
235
|
+
function Gt(t, e) {
|
|
236
236
|
if (t.length) {
|
|
237
|
-
let r = t[t.length - 1], n = r.selectionsAfter.slice(Math.max(0, r.selectionsAfter.length -
|
|
238
|
-
return n.length && n[n.length - 1].eq(e) ? t : (n.push(e),
|
|
237
|
+
let r = t[t.length - 1], n = r.selectionsAfter.slice(Math.max(0, r.selectionsAfter.length - Hr));
|
|
238
|
+
return n.length && n[n.length - 1].eq(e) ? t : (n.push(e), ve(t, t.length - 1, 1e9, r.setSelAfter(n)));
|
|
239
239
|
} else
|
|
240
|
-
return [
|
|
240
|
+
return [A.selection([e])];
|
|
241
241
|
}
|
|
242
|
-
function
|
|
242
|
+
function Vr(t) {
|
|
243
243
|
let e = t[t.length - 1], r = t.slice();
|
|
244
244
|
return r[t.length - 1] = e.setSelAfter(e.selectionsAfter.slice(0, e.selectionsAfter.length - 1)), r;
|
|
245
245
|
}
|
|
246
|
-
function
|
|
246
|
+
function He(t, e) {
|
|
247
247
|
if (!t.length)
|
|
248
248
|
return t;
|
|
249
|
-
let r = t.length, n =
|
|
249
|
+
let r = t.length, n = D;
|
|
250
250
|
for (; r; ) {
|
|
251
|
-
let o =
|
|
251
|
+
let o = zr(t[r - 1], e, n);
|
|
252
252
|
if (o.changes && !o.changes.empty || o.effects.length) {
|
|
253
253
|
let i = t.slice(0, r);
|
|
254
254
|
return i[r - 1] = o, i;
|
|
255
255
|
} else
|
|
256
256
|
e = o.mapped, r--, n = o.selectionsAfter;
|
|
257
257
|
}
|
|
258
|
-
return n.length ? [
|
|
258
|
+
return n.length ? [A.selection(n)] : D;
|
|
259
259
|
}
|
|
260
|
-
function
|
|
261
|
-
let n =
|
|
260
|
+
function zr(t, e, r) {
|
|
261
|
+
let n = $t(t.selectionsAfter.length ? t.selectionsAfter.map((l) => l.map(e)) : D, r);
|
|
262
262
|
if (!t.changes)
|
|
263
|
-
return
|
|
263
|
+
return A.selection(n);
|
|
264
264
|
let o = t.changes.map(e), i = e.mapDesc(t.changes, !0), s = t.mapped ? t.mapped.composeDesc(i) : i;
|
|
265
|
-
return new
|
|
265
|
+
return new A(o, w.mapEffects(t.effects, e), s, t.startSelection.map(i), n);
|
|
266
266
|
}
|
|
267
|
-
const
|
|
267
|
+
const Ur = /^(input\.type|delete)($|\.)/;
|
|
268
268
|
class O {
|
|
269
269
|
constructor(e, r, n = 0, o = void 0) {
|
|
270
270
|
this.done = e, this.undone = r, this.prevTime = n, this.prevUserEvent = o;
|
|
@@ -274,15 +274,15 @@ class O {
|
|
|
274
274
|
}
|
|
275
275
|
addChanges(e, r, n, o, i) {
|
|
276
276
|
let s = this.done, l = s[s.length - 1];
|
|
277
|
-
return l && l.changes && !l.changes.empty && e.changes && (!n ||
|
|
278
|
-
n == "input.type.compose") ? s =
|
|
277
|
+
return l && l.changes && !l.changes.empty && e.changes && (!n || Ur.test(n)) && (!l.selectionsAfter.length && r - this.prevTime < o.newGroupDelay && o.joinToEvent(i, qr(l.changes, e.changes)) || // For compose (but not compose.start) events, always join with previous event
|
|
278
|
+
n == "input.type.compose") ? s = ve(s, s.length - 1, o.minDepth, new A(e.changes.compose(l.changes), $t(e.effects, l.effects), l.mapped, l.startSelection, D)) : s = ve(s, s.length, o.minDepth, e), new O(s, D, r, n);
|
|
279
279
|
}
|
|
280
280
|
addSelection(e, r, n, o) {
|
|
281
|
-
let i = this.done.length ? this.done[this.done.length - 1].selectionsAfter :
|
|
282
|
-
return i.length > 0 && r - this.prevTime < o && n == this.prevUserEvent && n && /^select($|\.)/.test(n) &&
|
|
281
|
+
let i = this.done.length ? this.done[this.done.length - 1].selectionsAfter : D;
|
|
282
|
+
return i.length > 0 && r - this.prevTime < o && n == this.prevUserEvent && n && /^select($|\.)/.test(n) && _r(i[i.length - 1], e) ? this : new O(Gt(this.done, e), this.undone, r, n);
|
|
283
283
|
}
|
|
284
284
|
addMapping(e) {
|
|
285
|
-
return new O(
|
|
285
|
+
return new O(He(this.done, e), He(this.undone, e), this.prevTime, this.prevUserEvent);
|
|
286
286
|
}
|
|
287
287
|
pop(e, r, n) {
|
|
288
288
|
let o = e == 0 ? this.done : this.undone;
|
|
@@ -292,17 +292,17 @@ class O {
|
|
|
292
292
|
if (n && i.selectionsAfter.length)
|
|
293
293
|
return r.update({
|
|
294
294
|
selection: i.selectionsAfter[i.selectionsAfter.length - 1],
|
|
295
|
-
annotations:
|
|
295
|
+
annotations: Ke.of({ side: e, rest: Vr(o) }),
|
|
296
296
|
userEvent: e == 0 ? "select.undo" : "select.redo",
|
|
297
297
|
scrollIntoView: !0
|
|
298
298
|
});
|
|
299
299
|
if (i.changes) {
|
|
300
|
-
let s = o.length == 1 ?
|
|
301
|
-
return i.mapped && (s =
|
|
300
|
+
let s = o.length == 1 ? D : o.slice(0, o.length - 1);
|
|
301
|
+
return i.mapped && (s = He(s, i.mapped)), r.update({
|
|
302
302
|
changes: i.changes,
|
|
303
303
|
selection: i.startSelection,
|
|
304
304
|
effects: i.effects,
|
|
305
|
-
annotations:
|
|
305
|
+
annotations: Ke.of({ side: e, rest: s }),
|
|
306
306
|
filter: !1,
|
|
307
307
|
userEvent: e == 0 ? "undo" : "redo",
|
|
308
308
|
scrollIntoView: !0
|
|
@@ -311,66 +311,66 @@ class O {
|
|
|
311
311
|
return null;
|
|
312
312
|
}
|
|
313
313
|
}
|
|
314
|
-
O.empty = /* @__PURE__ */ new O(
|
|
315
|
-
const
|
|
316
|
-
{ key: "Mod-z", run:
|
|
317
|
-
{ key: "Mod-y", mac: "Mod-Shift-z", run:
|
|
318
|
-
{ linux: "Ctrl-Shift-z", run:
|
|
319
|
-
{ key: "Mod-u", run:
|
|
320
|
-
{ key: "Alt-u", mac: "Mod-Shift-u", run:
|
|
314
|
+
O.empty = /* @__PURE__ */ new O(D, D);
|
|
315
|
+
const $r = [
|
|
316
|
+
{ key: "Mod-z", run: Ut, preventDefault: !0 },
|
|
317
|
+
{ key: "Mod-y", mac: "Mod-Shift-z", run: Je, preventDefault: !0 },
|
|
318
|
+
{ linux: "Ctrl-Shift-z", run: Je, preventDefault: !0 },
|
|
319
|
+
{ key: "Mod-u", run: Fr, preventDefault: !0 },
|
|
320
|
+
{ key: "Alt-u", mac: "Mod-Shift-u", run: Nr, preventDefault: !0 }
|
|
321
321
|
];
|
|
322
|
-
function
|
|
322
|
+
function oe(t, e) {
|
|
323
323
|
return d.create(t.ranges.map(e), t.mainIndex);
|
|
324
324
|
}
|
|
325
325
|
function I(t, e) {
|
|
326
326
|
return t.update({ selection: e, scrollIntoView: !0, userEvent: "select" });
|
|
327
327
|
}
|
|
328
328
|
function T({ state: t, dispatch: e }, r) {
|
|
329
|
-
let n =
|
|
329
|
+
let n = oe(t.selection, r);
|
|
330
330
|
return n.eq(t.selection) ? !1 : (e(I(t, n)), !0);
|
|
331
331
|
}
|
|
332
|
-
function
|
|
332
|
+
function Oe(t, e) {
|
|
333
333
|
return d.cursor(e ? t.to : t.from);
|
|
334
334
|
}
|
|
335
|
-
function
|
|
336
|
-
return T(t, (r) => r.empty ? t.moveByChar(r, e) :
|
|
335
|
+
function Kt(t, e) {
|
|
336
|
+
return T(t, (r) => r.empty ? t.moveByChar(r, e) : Oe(r, e));
|
|
337
337
|
}
|
|
338
338
|
function S(t) {
|
|
339
|
-
return t.textDirectionAt(t.state.selection.main.head) ==
|
|
339
|
+
return t.textDirectionAt(t.state.selection.main.head) == Zn.LTR;
|
|
340
340
|
}
|
|
341
|
-
const
|
|
342
|
-
function
|
|
343
|
-
return T(t, (r) => r.empty ? t.moveByGroup(r, e) :
|
|
341
|
+
const Jt = (t) => Kt(t, !S(t)), jt = (t) => Kt(t, S(t));
|
|
342
|
+
function Qt(t, e) {
|
|
343
|
+
return T(t, (r) => r.empty ? t.moveByGroup(r, e) : Oe(r, e));
|
|
344
344
|
}
|
|
345
|
-
const
|
|
346
|
-
function
|
|
345
|
+
const Gr = (t) => Qt(t, !S(t)), Kr = (t) => Qt(t, S(t));
|
|
346
|
+
function Jr(t, e, r) {
|
|
347
347
|
if (e.type.prop(r))
|
|
348
348
|
return !0;
|
|
349
349
|
let n = e.to - e.from;
|
|
350
350
|
return n && (n > 2 || /[^\s,.;:]/.test(t.sliceDoc(e.from, e.to))) || e.firstChild;
|
|
351
351
|
}
|
|
352
|
-
function
|
|
353
|
-
let n =
|
|
352
|
+
function Ie(t, e, r) {
|
|
353
|
+
let n = tt(t).resolveInner(e.head), o = r ? Ge.closedBy : Ge.openedBy;
|
|
354
354
|
for (let a = e.head; ; ) {
|
|
355
355
|
let c = r ? n.childAfter(a) : n.childBefore(a);
|
|
356
356
|
if (!c)
|
|
357
357
|
break;
|
|
358
|
-
|
|
358
|
+
Jr(t, c, o) ? n = c : a = r ? c.to : c.from;
|
|
359
359
|
}
|
|
360
360
|
let i = n.type.prop(o), s, l;
|
|
361
|
-
return i && (s = r ?
|
|
361
|
+
return i && (s = r ? X(t, n.from, 1) : X(t, n.to, -1)) && s.matched ? l = r ? s.end.to : s.end.from : l = r ? n.to : n.from, d.cursor(l, r ? -1 : 1);
|
|
362
362
|
}
|
|
363
|
-
const
|
|
364
|
-
function
|
|
363
|
+
const jr = (t) => T(t, (e) => Ie(t.state, e, !S(t))), Qr = (t) => T(t, (e) => Ie(t.state, e, S(t)));
|
|
364
|
+
function Yt(t, e) {
|
|
365
365
|
return T(t, (r) => {
|
|
366
366
|
if (!r.empty)
|
|
367
|
-
return
|
|
367
|
+
return Oe(r, e);
|
|
368
368
|
let n = t.moveVertically(r, e);
|
|
369
369
|
return n.head != r.head ? n : t.moveToLineBoundary(r, e);
|
|
370
370
|
});
|
|
371
371
|
}
|
|
372
|
-
const
|
|
373
|
-
function
|
|
372
|
+
const Zt = (t) => Yt(t, !1), Xt = (t) => Yt(t, !0);
|
|
373
|
+
function en(t) {
|
|
374
374
|
let e = t.scrollDOM.clientHeight < t.scrollDOM.scrollHeight - 2, r = 0, n = 0, o;
|
|
375
375
|
if (e) {
|
|
376
376
|
for (let i of t.state.facet(p.scrollMargins)) {
|
|
@@ -387,8 +387,8 @@ function Xt(t) {
|
|
|
387
387
|
height: Math.max(t.defaultLineHeight, o - 5)
|
|
388
388
|
};
|
|
389
389
|
}
|
|
390
|
-
function
|
|
391
|
-
let r =
|
|
390
|
+
function tn(t, e) {
|
|
391
|
+
let r = en(t), { state: n } = t, o = oe(n.selection, (s) => s.empty ? t.moveVertically(s, e, r.height) : Oe(s, e));
|
|
392
392
|
if (o.eq(n.selection))
|
|
393
393
|
return !1;
|
|
394
394
|
let i;
|
|
@@ -398,8 +398,8 @@ function en(t, e) {
|
|
|
398
398
|
}
|
|
399
399
|
return t.dispatch(I(n, o), { effects: i }), !0;
|
|
400
400
|
}
|
|
401
|
-
const
|
|
402
|
-
function
|
|
401
|
+
const ht = (t) => tn(t, !1), je = (t) => tn(t, !0);
|
|
402
|
+
function _(t, e, r) {
|
|
403
403
|
let n = t.lineBlockAt(e.head), o = t.moveToLineBoundary(e, r);
|
|
404
404
|
if (o.head == e.head && o.head != (r ? n.to : n.from) && (o = t.moveToLineBoundary(e, r, !1)), !r && o.head == n.from && n.length) {
|
|
405
405
|
let i = /^\s*/.exec(t.state.sliceDoc(n.from, Math.min(n.from + 100, n.to)))[0].length;
|
|
@@ -407,10 +407,10 @@ function H(t, e, r) {
|
|
|
407
407
|
}
|
|
408
408
|
return o;
|
|
409
409
|
}
|
|
410
|
-
const
|
|
411
|
-
function
|
|
412
|
-
let n = !1, o =
|
|
413
|
-
let s =
|
|
410
|
+
const Yr = (t) => T(t, (e) => _(t, e, !0)), Zr = (t) => T(t, (e) => _(t, e, !1)), Xr = (t) => T(t, (e) => _(t, e, !S(t))), eo = (t) => T(t, (e) => _(t, e, S(t))), to = (t) => T(t, (e) => d.cursor(t.lineBlockAt(e.head).from, 1)), no = (t) => T(t, (e) => d.cursor(t.lineBlockAt(e.head).to, -1));
|
|
411
|
+
function ro(t, e, r) {
|
|
412
|
+
let n = !1, o = oe(t.selection, (i) => {
|
|
413
|
+
let s = X(t, i.head, -1) || X(t, i.head, 1) || i.head > 0 && X(t, i.head - 1, 1) || i.head < t.doc.length && X(t, i.head + 1, -1);
|
|
414
414
|
if (!s || !s.end)
|
|
415
415
|
return i;
|
|
416
416
|
n = !0;
|
|
@@ -419,55 +419,55 @@ function to(t, e, r) {
|
|
|
419
419
|
});
|
|
420
420
|
return n ? (e(I(t, o)), !0) : !1;
|
|
421
421
|
}
|
|
422
|
-
const
|
|
423
|
-
function
|
|
424
|
-
let r =
|
|
422
|
+
const oo = ({ state: t, dispatch: e }) => ro(t, e, !1);
|
|
423
|
+
function E(t, e) {
|
|
424
|
+
let r = oe(t.state.selection, (n) => {
|
|
425
425
|
let o = e(n);
|
|
426
426
|
return d.range(n.anchor, o.head, o.goalColumn, o.bidiLevel || void 0);
|
|
427
427
|
});
|
|
428
428
|
return r.eq(t.state.selection) ? !1 : (t.dispatch(I(t.state, r)), !0);
|
|
429
429
|
}
|
|
430
|
-
function
|
|
431
|
-
return
|
|
432
|
-
}
|
|
433
|
-
const nn = (t) => tn(t, !S(t)), rn = (t) => tn(t, S(t));
|
|
434
|
-
function on(t, e) {
|
|
435
|
-
return D(t, (r) => t.moveByGroup(r, e));
|
|
430
|
+
function nn(t, e) {
|
|
431
|
+
return E(t, (r) => t.moveByChar(r, e));
|
|
436
432
|
}
|
|
437
|
-
const
|
|
433
|
+
const rn = (t) => nn(t, !S(t)), on = (t) => nn(t, S(t));
|
|
438
434
|
function sn(t, e) {
|
|
439
|
-
return
|
|
435
|
+
return E(t, (r) => t.moveByGroup(r, e));
|
|
436
|
+
}
|
|
437
|
+
const io = (t) => sn(t, !S(t)), so = (t) => sn(t, S(t)), lo = (t) => E(t, (e) => Ie(t.state, e, !S(t))), ao = (t) => E(t, (e) => Ie(t.state, e, S(t)));
|
|
438
|
+
function ln(t, e) {
|
|
439
|
+
return E(t, (r) => t.moveVertically(r, e));
|
|
440
440
|
}
|
|
441
|
-
const
|
|
442
|
-
function
|
|
443
|
-
return
|
|
441
|
+
const an = (t) => ln(t, !1), cn = (t) => ln(t, !0);
|
|
442
|
+
function un(t, e) {
|
|
443
|
+
return E(t, (r) => t.moveVertically(r, e, en(t).height));
|
|
444
444
|
}
|
|
445
|
-
const
|
|
446
|
-
let r =
|
|
445
|
+
const ft = (t) => un(t, !1), dt = (t) => un(t, !0), co = (t) => E(t, (e) => _(t, e, !0)), uo = (t) => E(t, (e) => _(t, e, !1)), ho = (t) => E(t, (e) => _(t, e, !S(t))), fo = (t) => E(t, (e) => _(t, e, S(t))), mo = (t) => E(t, (e) => d.cursor(t.lineBlockAt(e.head).from)), go = (t) => E(t, (e) => d.cursor(t.lineBlockAt(e.head).to)), mt = ({ state: t, dispatch: e }) => (e(I(t, { anchor: 0 })), !0), gt = ({ state: t, dispatch: e }) => (e(I(t, { anchor: t.doc.length })), !0), pt = ({ state: t, dispatch: e }) => (e(I(t, { anchor: t.selection.main.anchor, head: 0 })), !0), yt = ({ state: t, dispatch: e }) => (e(I(t, { anchor: t.selection.main.anchor, head: t.doc.length })), !0), po = ({ state: t, dispatch: e }) => (e(t.update({ selection: { anchor: 0, head: t.doc.length }, userEvent: "select" })), !0), yo = ({ state: t, dispatch: e }) => {
|
|
446
|
+
let r = We(t).map(({ from: n, to: o }) => d.range(n, Math.min(o + 1, t.doc.length)));
|
|
447
447
|
return e(t.update({ selection: d.create(r), userEvent: "select" })), !0;
|
|
448
|
-
},
|
|
449
|
-
let r =
|
|
448
|
+
}, xo = ({ state: t, dispatch: e }) => {
|
|
449
|
+
let r = oe(t.selection, (n) => {
|
|
450
450
|
var o;
|
|
451
|
-
let i =
|
|
451
|
+
let i = tt(t).resolveInner(n.head, 1);
|
|
452
452
|
for (; !(i.from < n.from && i.to >= n.to || i.to > n.to && i.from <= n.from || !(!((o = i.parent) === null || o === void 0) && o.parent)); )
|
|
453
453
|
i = i.parent;
|
|
454
454
|
return d.range(i.to, i.from);
|
|
455
455
|
});
|
|
456
456
|
return e(I(t, r)), !0;
|
|
457
|
-
},
|
|
457
|
+
}, ko = ({ state: t, dispatch: e }) => {
|
|
458
458
|
let r = t.selection, n = null;
|
|
459
459
|
return r.ranges.length > 1 ? n = d.create([r.main]) : r.main.empty || (n = d.create([d.cursor(r.main.head)])), n ? (e(I(t, n)), !0) : !1;
|
|
460
460
|
};
|
|
461
|
-
function
|
|
461
|
+
function Pe(t, e) {
|
|
462
462
|
if (t.state.readOnly)
|
|
463
463
|
return !1;
|
|
464
464
|
let r = "delete.selection", { state: n } = t, o = n.changeByRange((i) => {
|
|
465
465
|
let { from: s, to: l } = i;
|
|
466
466
|
if (s == l) {
|
|
467
467
|
let a = e(s);
|
|
468
|
-
a < s ? (r = "delete.backward", a =
|
|
468
|
+
a < s ? (r = "delete.backward", a = ye(t, a, !1)) : a > s && (r = "delete.forward", a = ye(t, a, !0)), s = Math.min(s, a), l = Math.max(l, a);
|
|
469
469
|
} else
|
|
470
|
-
s =
|
|
470
|
+
s = ye(t, s, !1), l = ye(t, l, !0);
|
|
471
471
|
return s == l ? { range: i } : { changes: { from: s, to: l }, range: d.cursor(s) };
|
|
472
472
|
});
|
|
473
473
|
return o.changes.empty ? !1 : (t.dispatch(n.update(o, {
|
|
@@ -476,7 +476,7 @@ function Ie(t, e) {
|
|
|
476
476
|
effects: r == "delete.selection" ? p.announce.of(n.phrase("Selection deleted")) : void 0
|
|
477
477
|
})), !0);
|
|
478
478
|
}
|
|
479
|
-
function
|
|
479
|
+
function ye(t, e, r) {
|
|
480
480
|
if (t instanceof p)
|
|
481
481
|
for (let n of t.state.facet(p.atomicRanges).map((o) => o(t)))
|
|
482
482
|
n.between(e, e, (o, i) => {
|
|
@@ -484,52 +484,52 @@ function pe(t, e, r) {
|
|
|
484
484
|
});
|
|
485
485
|
return e;
|
|
486
486
|
}
|
|
487
|
-
const
|
|
487
|
+
const hn = (t, e) => Pe(t, (r) => {
|
|
488
488
|
let { state: n } = t, o = n.doc.lineAt(r), i, s;
|
|
489
489
|
if (!e && r > o.from && r < o.from + 200 && !/[^ \t]/.test(i = o.text.slice(0, r - o.from))) {
|
|
490
490
|
if (i[i.length - 1] == " ")
|
|
491
491
|
return r - 1;
|
|
492
|
-
let l =
|
|
492
|
+
let l = Ft(i, n.tabSize), a = l % $e(n) || $e(n);
|
|
493
493
|
for (let c = 0; c < a && i[i.length - 1 - c] == " "; c++)
|
|
494
494
|
r--;
|
|
495
495
|
s = r;
|
|
496
496
|
} else
|
|
497
|
-
s =
|
|
497
|
+
s = te(o.text, r - o.from, e, e) + o.from, s == r && o.number != (e ? n.doc.lines : 1) && (s += e ? 1 : -1);
|
|
498
498
|
return s;
|
|
499
|
-
}),
|
|
499
|
+
}), Qe = (t) => hn(t, !1), fn = (t) => hn(t, !0), dn = (t, e) => Pe(t, (r) => {
|
|
500
500
|
let n = r, { state: o } = t, i = o.doc.lineAt(n), s = o.charCategorizer(n);
|
|
501
501
|
for (let l = null; ; ) {
|
|
502
502
|
if (n == (e ? i.to : i.from)) {
|
|
503
503
|
n == r && i.number != (e ? o.doc.lines : 1) && (n += e ? 1 : -1);
|
|
504
504
|
break;
|
|
505
505
|
}
|
|
506
|
-
let a =
|
|
506
|
+
let a = te(i.text, n - i.from, e) + i.from, c = i.text.slice(Math.min(n, a) - i.from, Math.max(n, a) - i.from), u = s(c);
|
|
507
507
|
if (l != null && u != l)
|
|
508
508
|
break;
|
|
509
509
|
(c != " " || n != r) && (l = u), n = a;
|
|
510
510
|
}
|
|
511
511
|
return n;
|
|
512
|
-
}),
|
|
512
|
+
}), mn = (t) => dn(t, !1), bo = (t) => dn(t, !0), gn = (t) => Pe(t, (e) => {
|
|
513
513
|
let r = t.lineBlockAt(e).to;
|
|
514
514
|
return e < r ? r : Math.min(t.state.doc.length, e + 1);
|
|
515
|
-
}),
|
|
515
|
+
}), So = (t) => Pe(t, (e) => {
|
|
516
516
|
let r = t.lineBlockAt(e).from;
|
|
517
517
|
return e > r ? r : Math.max(0, e - 1);
|
|
518
|
-
}),
|
|
518
|
+
}), Co = ({ state: t, dispatch: e }) => {
|
|
519
519
|
if (t.readOnly)
|
|
520
520
|
return !1;
|
|
521
521
|
let r = t.changeByRange((n) => ({
|
|
522
|
-
changes: { from: n.from, to: n.to, insert:
|
|
522
|
+
changes: { from: n.from, to: n.to, insert: Pt.of(["", ""]) },
|
|
523
523
|
range: d.cursor(n.from)
|
|
524
524
|
}));
|
|
525
525
|
return e(t.update(r, { scrollIntoView: !0, userEvent: "input" })), !0;
|
|
526
|
-
},
|
|
526
|
+
}, vo = ({ state: t, dispatch: e }) => {
|
|
527
527
|
if (t.readOnly)
|
|
528
528
|
return !1;
|
|
529
529
|
let r = t.changeByRange((n) => {
|
|
530
530
|
if (!n.empty || n.from == 0 || n.from == t.doc.length)
|
|
531
531
|
return { range: n };
|
|
532
|
-
let o = n.from, i = t.doc.lineAt(o), s = o == i.from ? o - 1 :
|
|
532
|
+
let o = n.from, i = t.doc.lineAt(o), s = o == i.from ? o - 1 : te(i.text, o - i.from, !1) + i.from, l = o == i.to ? o + 1 : te(i.text, o - i.from, !0) + i.from;
|
|
533
533
|
return {
|
|
534
534
|
changes: { from: s, to: l, insert: t.doc.slice(o, l).append(t.doc.slice(s, o)) },
|
|
535
535
|
range: d.cursor(l)
|
|
@@ -537,7 +537,7 @@ const un = (t, e) => Ie(t, (r) => {
|
|
|
537
537
|
});
|
|
538
538
|
return r.changes.empty ? !1 : (e(t.update(r, { scrollIntoView: !0, userEvent: "move.character" })), !0);
|
|
539
539
|
};
|
|
540
|
-
function
|
|
540
|
+
function We(t) {
|
|
541
541
|
let e = [], r = -1;
|
|
542
542
|
for (let n of t.selection.ranges) {
|
|
543
543
|
let o = t.doc.lineAt(n.from), i = t.doc.lineAt(n.to);
|
|
@@ -550,11 +550,11 @@ function Pe(t) {
|
|
|
550
550
|
}
|
|
551
551
|
return e;
|
|
552
552
|
}
|
|
553
|
-
function
|
|
553
|
+
function pn(t, e, r) {
|
|
554
554
|
if (t.readOnly)
|
|
555
555
|
return !1;
|
|
556
556
|
let n = [], o = [];
|
|
557
|
-
for (let i of
|
|
557
|
+
for (let i of We(t)) {
|
|
558
558
|
if (r ? i.to == t.doc.length : i.from == 0)
|
|
559
559
|
continue;
|
|
560
560
|
let s = t.doc.lineAt(r ? i.to + 1 : i.from - 1), l = s.length + 1;
|
|
@@ -575,49 +575,49 @@ function gn(t, e, r) {
|
|
|
575
575
|
userEvent: "move.line"
|
|
576
576
|
})), !0) : !1;
|
|
577
577
|
}
|
|
578
|
-
const
|
|
579
|
-
function
|
|
578
|
+
const Ao = ({ state: t, dispatch: e }) => pn(t, e, !1), Mo = ({ state: t, dispatch: e }) => pn(t, e, !0);
|
|
579
|
+
function yn(t, e, r) {
|
|
580
580
|
if (t.readOnly)
|
|
581
581
|
return !1;
|
|
582
582
|
let n = [];
|
|
583
|
-
for (let o of
|
|
583
|
+
for (let o of We(t))
|
|
584
584
|
r ? n.push({ from: o.from, insert: t.doc.slice(o.from, o.to) + t.lineBreak }) : n.push({ from: o.to, insert: t.lineBreak + t.doc.slice(o.from, o.to) });
|
|
585
585
|
return e(t.update({ changes: n, scrollIntoView: !0, userEvent: "input.copyline" })), !0;
|
|
586
586
|
}
|
|
587
|
-
const
|
|
587
|
+
const Lo = ({ state: t, dispatch: e }) => yn(t, e, !1), Bo = ({ state: t, dispatch: e }) => yn(t, e, !0), Do = (t) => {
|
|
588
588
|
if (t.state.readOnly)
|
|
589
589
|
return !1;
|
|
590
|
-
let { state: e } = t, r = e.changes(
|
|
590
|
+
let { state: e } = t, r = e.changes(We(e).map(({ from: o, to: i }) => (o > 0 ? o-- : i < e.doc.length && i++, { from: o, to: i }))), n = oe(e.selection, (o) => t.moveVertically(o, !0)).map(r);
|
|
591
591
|
return t.dispatch({ changes: r, selection: n, scrollIntoView: !0, userEvent: "delete.line" }), !0;
|
|
592
592
|
};
|
|
593
|
-
function
|
|
593
|
+
function Eo(t, e) {
|
|
594
594
|
if (/\(\)|\[\]|\{\}/.test(t.sliceDoc(e - 1, e + 1)))
|
|
595
595
|
return { from: e, to: e };
|
|
596
|
-
let r =
|
|
597
|
-
return n && o && n.to <= e && o.from >= e && (i = n.type.prop(
|
|
596
|
+
let r = tt(t).resolveInner(e), n = r.childBefore(e), o = r.childAfter(e), i;
|
|
597
|
+
return n && o && n.to <= e && o.from >= e && (i = n.type.prop(Ge.closedBy)) && i.indexOf(o.name) > -1 && t.doc.lineAt(n.to).from == t.doc.lineAt(o.from).from ? { from: n.to, to: o.from } : null;
|
|
598
598
|
}
|
|
599
|
-
const
|
|
600
|
-
function
|
|
599
|
+
const Ro = /* @__PURE__ */ xn(!1), wo = /* @__PURE__ */ xn(!0);
|
|
600
|
+
function xn(t) {
|
|
601
601
|
return ({ state: e, dispatch: r }) => {
|
|
602
602
|
if (e.readOnly)
|
|
603
603
|
return !1;
|
|
604
604
|
let n = e.changeByRange((o) => {
|
|
605
|
-
let { from: i, to: s } = o, l = e.doc.lineAt(i), a = !t && i == s &&
|
|
605
|
+
let { from: i, to: s } = o, l = e.doc.lineAt(i), a = !t && i == s && Eo(e, i);
|
|
606
606
|
t && (i = s = (s <= l.to ? l : e.doc.lineAt(s)).to);
|
|
607
|
-
let c = new
|
|
607
|
+
let c = new Ot(e, { simulateBreak: i, simulateDoubleBreak: !!a }), u = It(c, i);
|
|
608
608
|
for (u == null && (u = /^\s*/.exec(e.doc.lineAt(i).text)[0].length); s < l.to && /\s/.test(l.text[s - l.from]); )
|
|
609
609
|
s++;
|
|
610
610
|
a ? { from: i, to: s } = a : i > l.from && i < l.from + 100 && !/\S/.test(l.text.slice(0, i)) && (i = l.from);
|
|
611
|
-
let h = ["",
|
|
612
|
-
return a && h.push(
|
|
613
|
-
changes: { from: i, to: s, insert:
|
|
611
|
+
let h = ["", Ce(e, u)];
|
|
612
|
+
return a && h.push(Ce(e, c.lineIndent(l.from, -1))), {
|
|
613
|
+
changes: { from: i, to: s, insert: Pt.of(h) },
|
|
614
614
|
range: d.cursor(i + 1 + h[1].length)
|
|
615
615
|
};
|
|
616
616
|
});
|
|
617
617
|
return r(e.update(n, { scrollIntoView: !0, userEvent: "input" })), !0;
|
|
618
618
|
};
|
|
619
619
|
}
|
|
620
|
-
function
|
|
620
|
+
function it(t, e) {
|
|
621
621
|
let r = -1;
|
|
622
622
|
return t.changeByRange((n) => {
|
|
623
623
|
let o = [];
|
|
@@ -632,91 +632,91 @@ function ot(t, e) {
|
|
|
632
632
|
};
|
|
633
633
|
});
|
|
634
634
|
}
|
|
635
|
-
const
|
|
635
|
+
const To = ({ state: t, dispatch: e }) => {
|
|
636
636
|
if (t.readOnly)
|
|
637
637
|
return !1;
|
|
638
|
-
let r = /* @__PURE__ */ Object.create(null), n = new
|
|
638
|
+
let r = /* @__PURE__ */ Object.create(null), n = new Ot(t, { overrideIndentation: (i) => {
|
|
639
639
|
let s = r[i];
|
|
640
640
|
return s ?? -1;
|
|
641
|
-
} }), o =
|
|
642
|
-
let a =
|
|
641
|
+
} }), o = it(t, (i, s, l) => {
|
|
642
|
+
let a = It(n, i.from);
|
|
643
643
|
if (a == null)
|
|
644
644
|
return;
|
|
645
645
|
/\S/.test(i.text) || (a = 0);
|
|
646
|
-
let c = /^\s*/.exec(i.text)[0], u =
|
|
646
|
+
let c = /^\s*/.exec(i.text)[0], u = Ce(t, a);
|
|
647
647
|
(c != u || l.from < i.from + c.length) && (r[i.from] = a, s.push({ from: i.from, to: i.from + c.length, insert: u }));
|
|
648
648
|
});
|
|
649
649
|
return o.changes.empty || e(t.update(o, { userEvent: "indent" })), !0;
|
|
650
|
-
},
|
|
651
|
-
n.push({ from: r.from, insert: t.facet(
|
|
652
|
-
}), { userEvent: "input.indent" })), !0),
|
|
650
|
+
}, kn = ({ state: t, dispatch: e }) => t.readOnly ? !1 : (e(t.update(it(t, (r, n) => {
|
|
651
|
+
n.push({ from: r.from, insert: t.facet(Wt) });
|
|
652
|
+
}), { userEvent: "input.indent" })), !0), bn = ({ state: t, dispatch: e }) => t.readOnly ? !1 : (e(t.update(it(t, (r, n) => {
|
|
653
653
|
let o = /^\s*/.exec(r.text)[0];
|
|
654
654
|
if (!o)
|
|
655
655
|
return;
|
|
656
|
-
let i =
|
|
656
|
+
let i = Ft(o, t.tabSize), s = 0, l = Ce(t, Math.max(0, i - $e(t)));
|
|
657
657
|
for (; s < o.length && s < l.length && o.charCodeAt(s) == l.charCodeAt(s); )
|
|
658
658
|
s++;
|
|
659
659
|
n.push({ from: r.from + s, to: r.from + o.length, insert: l.slice(s) });
|
|
660
|
-
}), { userEvent: "delete.dedent" })), !0),
|
|
661
|
-
{ key: "Ctrl-b", run:
|
|
662
|
-
{ key: "Ctrl-f", run:
|
|
663
|
-
{ key: "Ctrl-p", run:
|
|
664
|
-
{ key: "Ctrl-n", run:
|
|
665
|
-
{ key: "Ctrl-a", run:
|
|
666
|
-
{ key: "Ctrl-e", run:
|
|
667
|
-
{ key: "Ctrl-d", run:
|
|
668
|
-
{ key: "Ctrl-h", run:
|
|
669
|
-
{ key: "Ctrl-k", run:
|
|
670
|
-
{ key: "Ctrl-Alt-h", run:
|
|
671
|
-
{ key: "Ctrl-o", run:
|
|
672
|
-
{ key: "Ctrl-t", run:
|
|
673
|
-
{ key: "Ctrl-v", run:
|
|
674
|
-
],
|
|
675
|
-
{ key: "ArrowLeft", run:
|
|
676
|
-
{ key: "Mod-ArrowLeft", mac: "Alt-ArrowLeft", run:
|
|
677
|
-
{ mac: "Cmd-ArrowLeft", run:
|
|
678
|
-
{ key: "ArrowRight", run:
|
|
679
|
-
{ key: "Mod-ArrowRight", mac: "Alt-ArrowRight", run:
|
|
680
|
-
{ mac: "Cmd-ArrowRight", run:
|
|
681
|
-
{ key: "ArrowUp", run:
|
|
682
|
-
{ mac: "Cmd-ArrowUp", run:
|
|
683
|
-
{ mac: "Ctrl-ArrowUp", run:
|
|
684
|
-
{ key: "ArrowDown", run:
|
|
685
|
-
{ mac: "Cmd-ArrowDown", run:
|
|
686
|
-
{ mac: "Ctrl-ArrowDown", run:
|
|
687
|
-
{ key: "PageUp", run:
|
|
688
|
-
{ key: "PageDown", run:
|
|
689
|
-
{ key: "Home", run:
|
|
690
|
-
{ key: "Mod-Home", run:
|
|
691
|
-
{ key: "End", run:
|
|
692
|
-
{ key: "Mod-End", run:
|
|
693
|
-
{ key: "Enter", run:
|
|
694
|
-
{ key: "Mod-a", run:
|
|
695
|
-
{ key: "Backspace", run:
|
|
696
|
-
{ key: "Delete", run:
|
|
697
|
-
{ key: "Mod-Backspace", mac: "Alt-Backspace", run:
|
|
698
|
-
{ key: "Mod-Delete", mac: "Alt-Delete", run:
|
|
699
|
-
{ mac: "Mod-Backspace", run:
|
|
700
|
-
{ mac: "Mod-Delete", run:
|
|
701
|
-
].concat(/* @__PURE__ */
|
|
702
|
-
{ key: "Alt-ArrowLeft", mac: "Ctrl-ArrowLeft", run:
|
|
703
|
-
{ key: "Alt-ArrowRight", mac: "Ctrl-ArrowRight", run:
|
|
704
|
-
{ key: "Alt-ArrowUp", run:
|
|
705
|
-
{ key: "Shift-Alt-ArrowUp", run:
|
|
706
|
-
{ key: "Alt-ArrowDown", run:
|
|
707
|
-
{ key: "Shift-Alt-ArrowDown", run:
|
|
708
|
-
{ key: "Escape", run:
|
|
709
|
-
{ key: "Mod-Enter", run:
|
|
710
|
-
{ key: "Alt-l", mac: "Ctrl-l", run:
|
|
711
|
-
{ key: "Mod-i", run:
|
|
712
|
-
{ key: "Mod-[", run:
|
|
713
|
-
{ key: "Mod-]", run:
|
|
714
|
-
{ key: "Mod-Alt-\\", run:
|
|
715
|
-
{ key: "Shift-Mod-k", run:
|
|
716
|
-
{ key: "Shift-Mod-\\", run:
|
|
717
|
-
{ key: "Mod-/", run:
|
|
718
|
-
{ key: "Alt-A", run:
|
|
719
|
-
].concat(
|
|
660
|
+
}), { userEvent: "delete.dedent" })), !0), Oo = [
|
|
661
|
+
{ key: "Ctrl-b", run: Jt, shift: rn, preventDefault: !0 },
|
|
662
|
+
{ key: "Ctrl-f", run: jt, shift: on },
|
|
663
|
+
{ key: "Ctrl-p", run: Zt, shift: an },
|
|
664
|
+
{ key: "Ctrl-n", run: Xt, shift: cn },
|
|
665
|
+
{ key: "Ctrl-a", run: to, shift: mo },
|
|
666
|
+
{ key: "Ctrl-e", run: no, shift: go },
|
|
667
|
+
{ key: "Ctrl-d", run: fn },
|
|
668
|
+
{ key: "Ctrl-h", run: Qe },
|
|
669
|
+
{ key: "Ctrl-k", run: gn },
|
|
670
|
+
{ key: "Ctrl-Alt-h", run: mn },
|
|
671
|
+
{ key: "Ctrl-o", run: Co },
|
|
672
|
+
{ key: "Ctrl-t", run: vo },
|
|
673
|
+
{ key: "Ctrl-v", run: je }
|
|
674
|
+
], Io = /* @__PURE__ */ [
|
|
675
|
+
{ key: "ArrowLeft", run: Jt, shift: rn, preventDefault: !0 },
|
|
676
|
+
{ key: "Mod-ArrowLeft", mac: "Alt-ArrowLeft", run: Gr, shift: io, preventDefault: !0 },
|
|
677
|
+
{ mac: "Cmd-ArrowLeft", run: Xr, shift: ho, preventDefault: !0 },
|
|
678
|
+
{ key: "ArrowRight", run: jt, shift: on, preventDefault: !0 },
|
|
679
|
+
{ key: "Mod-ArrowRight", mac: "Alt-ArrowRight", run: Kr, shift: so, preventDefault: !0 },
|
|
680
|
+
{ mac: "Cmd-ArrowRight", run: eo, shift: fo, preventDefault: !0 },
|
|
681
|
+
{ key: "ArrowUp", run: Zt, shift: an, preventDefault: !0 },
|
|
682
|
+
{ mac: "Cmd-ArrowUp", run: mt, shift: pt },
|
|
683
|
+
{ mac: "Ctrl-ArrowUp", run: ht, shift: ft },
|
|
684
|
+
{ key: "ArrowDown", run: Xt, shift: cn, preventDefault: !0 },
|
|
685
|
+
{ mac: "Cmd-ArrowDown", run: gt, shift: yt },
|
|
686
|
+
{ mac: "Ctrl-ArrowDown", run: je, shift: dt },
|
|
687
|
+
{ key: "PageUp", run: ht, shift: ft },
|
|
688
|
+
{ key: "PageDown", run: je, shift: dt },
|
|
689
|
+
{ key: "Home", run: Zr, shift: uo, preventDefault: !0 },
|
|
690
|
+
{ key: "Mod-Home", run: mt, shift: pt },
|
|
691
|
+
{ key: "End", run: Yr, shift: co, preventDefault: !0 },
|
|
692
|
+
{ key: "Mod-End", run: gt, shift: yt },
|
|
693
|
+
{ key: "Enter", run: Ro },
|
|
694
|
+
{ key: "Mod-a", run: po },
|
|
695
|
+
{ key: "Backspace", run: Qe, shift: Qe },
|
|
696
|
+
{ key: "Delete", run: fn },
|
|
697
|
+
{ key: "Mod-Backspace", mac: "Alt-Backspace", run: mn },
|
|
698
|
+
{ key: "Mod-Delete", mac: "Alt-Delete", run: bo },
|
|
699
|
+
{ mac: "Mod-Backspace", run: So },
|
|
700
|
+
{ mac: "Mod-Delete", run: gn }
|
|
701
|
+
].concat(/* @__PURE__ */ Oo.map((t) => ({ mac: t.key, run: t.run, shift: t.shift }))), Po = /* @__PURE__ */ [
|
|
702
|
+
{ key: "Alt-ArrowLeft", mac: "Ctrl-ArrowLeft", run: jr, shift: lo },
|
|
703
|
+
{ key: "Alt-ArrowRight", mac: "Ctrl-ArrowRight", run: Qr, shift: ao },
|
|
704
|
+
{ key: "Alt-ArrowUp", run: Ao },
|
|
705
|
+
{ key: "Shift-Alt-ArrowUp", run: Lo },
|
|
706
|
+
{ key: "Alt-ArrowDown", run: Mo },
|
|
707
|
+
{ key: "Shift-Alt-ArrowDown", run: Bo },
|
|
708
|
+
{ key: "Escape", run: ko },
|
|
709
|
+
{ key: "Mod-Enter", run: wo },
|
|
710
|
+
{ key: "Alt-l", mac: "Ctrl-l", run: yo },
|
|
711
|
+
{ key: "Mod-i", run: xo, preventDefault: !0 },
|
|
712
|
+
{ key: "Mod-[", run: bn },
|
|
713
|
+
{ key: "Mod-]", run: kn },
|
|
714
|
+
{ key: "Mod-Alt-\\", run: To },
|
|
715
|
+
{ key: "Shift-Mod-k", run: Do },
|
|
716
|
+
{ key: "Shift-Mod-\\", run: oo },
|
|
717
|
+
{ key: "Mod-/", run: Lr },
|
|
718
|
+
{ key: "Alt-A", run: Dr }
|
|
719
|
+
].concat(Io), Wo = { key: "Tab", run: kn, shift: bn };
|
|
720
720
|
function g() {
|
|
721
721
|
var t = arguments[0];
|
|
722
722
|
typeof t == "string" && (t = document.createElement(t));
|
|
@@ -730,10 +730,10 @@ function g() {
|
|
|
730
730
|
e++;
|
|
731
731
|
}
|
|
732
732
|
for (; e < arguments.length; e++)
|
|
733
|
-
|
|
733
|
+
Sn(t, arguments[e]);
|
|
734
734
|
return t;
|
|
735
735
|
}
|
|
736
|
-
function
|
|
736
|
+
function Sn(t, e) {
|
|
737
737
|
if (typeof e == "string")
|
|
738
738
|
t.appendChild(document.createTextNode(e));
|
|
739
739
|
else if (e != null)
|
|
@@ -741,12 +741,12 @@ function bn(t, e) {
|
|
|
741
741
|
t.appendChild(e);
|
|
742
742
|
else if (Array.isArray(e))
|
|
743
743
|
for (var r = 0; r < e.length; r++)
|
|
744
|
-
|
|
744
|
+
Sn(t, e[r]);
|
|
745
745
|
else
|
|
746
746
|
throw new RangeError("Unsupported child node: " + e);
|
|
747
747
|
}
|
|
748
|
-
const
|
|
749
|
-
class
|
|
748
|
+
const xt = typeof String.prototype.normalize == "function" ? (t) => t.normalize("NFKD") : (t) => t;
|
|
749
|
+
class ne {
|
|
750
750
|
/**
|
|
751
751
|
Create a text cursor. The query is the search string, `from` to
|
|
752
752
|
`to` provides the region to search.
|
|
@@ -761,7 +761,7 @@ class te {
|
|
|
761
761
|
(when supported).
|
|
762
762
|
*/
|
|
763
763
|
constructor(e, r, n = 0, o = e.length, i, s) {
|
|
764
|
-
this.test = s, this.value = { from: 0, to: 0 }, this.done = !1, this.matches = [], this.buffer = "", this.bufferPos = 0, this.iter = e.iterRange(n, o), this.bufferStart = n, this.normalize = i ? (l) => i(
|
|
764
|
+
this.test = s, this.value = { from: 0, to: 0 }, this.done = !1, this.matches = [], this.buffer = "", this.bufferPos = 0, this.iter = e.iterRange(n, o), this.bufferStart = n, this.normalize = i ? (l) => i(xt(l)) : xt, this.query = this.normalize(r);
|
|
765
765
|
}
|
|
766
766
|
peek() {
|
|
767
767
|
if (this.bufferPos == this.buffer.length) {
|
|
@@ -769,7 +769,7 @@ class te {
|
|
|
769
769
|
return -1;
|
|
770
770
|
this.bufferPos = 0, this.buffer = this.iter.value;
|
|
771
771
|
}
|
|
772
|
-
return
|
|
772
|
+
return Xn(this.buffer, this.bufferPos);
|
|
773
773
|
}
|
|
774
774
|
/**
|
|
775
775
|
Look for the next match. Updates the iterator's
|
|
@@ -792,8 +792,8 @@ class te {
|
|
|
792
792
|
let e = this.peek();
|
|
793
793
|
if (e < 0)
|
|
794
794
|
return this.done = !0, this;
|
|
795
|
-
let r =
|
|
796
|
-
this.bufferPos +=
|
|
795
|
+
let r = nr(e), n = this.bufferStart + this.bufferPos;
|
|
796
|
+
this.bufferPos += er(e);
|
|
797
797
|
let o = this.normalize(r);
|
|
798
798
|
for (let i = 0, s = n; ; i++) {
|
|
799
799
|
let l = o.charCodeAt(i), a = this.match(l, s);
|
|
@@ -815,22 +815,22 @@ class te {
|
|
|
815
815
|
return this.query.charCodeAt(0) == e && (this.query.length == 1 ? n = { from: r, to: r + 1 } : this.matches.push(1, r)), n && this.test && !this.test(n.from, n.to, this.buffer, this.bufferPos) && (n = null), n;
|
|
816
816
|
}
|
|
817
817
|
}
|
|
818
|
-
typeof Symbol < "u" && (
|
|
818
|
+
typeof Symbol < "u" && (ne.prototype[Symbol.iterator] = function() {
|
|
819
819
|
return this;
|
|
820
820
|
});
|
|
821
|
-
const
|
|
822
|
-
class
|
|
821
|
+
const Cn = { from: -1, to: -1, match: /* @__PURE__ */ /.*/.exec("") }, st = "gm" + (/x/.unicode == null ? "" : "u");
|
|
822
|
+
class vn {
|
|
823
823
|
/**
|
|
824
824
|
Create a cursor that will search the given range in the given
|
|
825
825
|
document. `query` should be the raw pattern (as you'd pass it to
|
|
826
826
|
`new RegExp`).
|
|
827
827
|
*/
|
|
828
828
|
constructor(e, r, n, o = 0, i = e.length) {
|
|
829
|
-
if (this.text = e, this.to = i, this.curLine = "", this.done = !1, this.value =
|
|
830
|
-
return new
|
|
831
|
-
this.re = new RegExp(r,
|
|
829
|
+
if (this.text = e, this.to = i, this.curLine = "", this.done = !1, this.value = Cn, /\\[sWDnr]|\n|\r|\[\^/.test(r))
|
|
830
|
+
return new An(e, r, n, o, i);
|
|
831
|
+
this.re = new RegExp(r, st + (n != null && n.ignoreCase ? "i" : "")), this.test = n == null ? void 0 : n.test, this.iter = e.iter();
|
|
832
832
|
let s = e.lineAt(o);
|
|
833
|
-
this.curLineStart = s.from, this.matchPos =
|
|
833
|
+
this.curLineStart = s.from, this.matchPos = Ae(e, o), this.getLine(this.curLineStart);
|
|
834
834
|
}
|
|
835
835
|
getLine(e) {
|
|
836
836
|
this.iter.next(e), this.iter.lineBreak ? this.curLine = "" : (this.curLine = this.iter.value, this.curLineStart + this.curLine.length > this.to && (this.curLine = this.curLine.slice(0, this.to - this.curLineStart)), this.iter.next());
|
|
@@ -847,7 +847,7 @@ class Cn {
|
|
|
847
847
|
let r = this.matchPos <= this.to && this.re.exec(this.curLine);
|
|
848
848
|
if (r) {
|
|
849
849
|
let n = this.curLineStart + r.index, o = n + r[0].length;
|
|
850
|
-
if (this.matchPos =
|
|
850
|
+
if (this.matchPos = Ae(this.text, o + (n == o ? 1 : 0)), n == this.curLineStart + this.curLine.length && this.nextLine(), (n < o || n > this.value.to) && (!this.test || this.test(n, o, r)))
|
|
851
851
|
return this.value = { from: n, to: o, match: r }, this;
|
|
852
852
|
e = this.matchPos - this.curLineStart;
|
|
853
853
|
} else if (this.curLineStart + this.curLine.length < this.to)
|
|
@@ -857,8 +857,8 @@ class Cn {
|
|
|
857
857
|
}
|
|
858
858
|
}
|
|
859
859
|
}
|
|
860
|
-
const
|
|
861
|
-
class
|
|
860
|
+
const Ve = /* @__PURE__ */ new WeakMap();
|
|
861
|
+
class ee {
|
|
862
862
|
constructor(e, r) {
|
|
863
863
|
this.from = e, this.text = r;
|
|
864
864
|
}
|
|
@@ -866,20 +866,20 @@ class X {
|
|
|
866
866
|
return this.from + this.text.length;
|
|
867
867
|
}
|
|
868
868
|
static get(e, r, n) {
|
|
869
|
-
let o =
|
|
869
|
+
let o = Ve.get(e);
|
|
870
870
|
if (!o || o.from >= n || o.to <= r) {
|
|
871
|
-
let l = new
|
|
872
|
-
return
|
|
871
|
+
let l = new ee(r, e.sliceString(r, n));
|
|
872
|
+
return Ve.set(e, l), l;
|
|
873
873
|
}
|
|
874
874
|
if (o.from == r && o.to == n)
|
|
875
875
|
return o;
|
|
876
876
|
let { text: i, from: s } = o;
|
|
877
|
-
return s > r && (i = e.sliceString(r, s) + i, s = r), o.to < n && (i += e.sliceString(o.to, n)),
|
|
877
|
+
return s > r && (i = e.sliceString(r, s) + i, s = r), o.to < n && (i += e.sliceString(o.to, n)), Ve.set(e, new ee(s, i)), new ee(r, i.slice(r - s, n - s));
|
|
878
878
|
}
|
|
879
879
|
}
|
|
880
|
-
class
|
|
880
|
+
class An {
|
|
881
881
|
constructor(e, r, n, o, i) {
|
|
882
|
-
this.text = e, this.to = i, this.done = !1, this.value =
|
|
882
|
+
this.text = e, this.to = i, this.done = !1, this.value = Cn, this.matchPos = Ae(e, o), this.re = new RegExp(r, st + (n != null && n.ignoreCase ? "i" : "")), this.test = n == null ? void 0 : n.test, this.flat = ee.get(e, o, this.chunkEnd(
|
|
883
883
|
o + 5e3
|
|
884
884
|
/* Base */
|
|
885
885
|
));
|
|
@@ -893,25 +893,25 @@ class vn {
|
|
|
893
893
|
if (r && !r[0] && r.index == e && (this.re.lastIndex = e + 1, r = this.re.exec(this.flat.text)), r) {
|
|
894
894
|
let n = this.flat.from + r.index, o = n + r[0].length;
|
|
895
895
|
if ((this.flat.to >= this.to || r.index + r[0].length <= this.flat.text.length - 10) && (!this.test || this.test(n, o, r)))
|
|
896
|
-
return this.value = { from: n, to: o, match: r }, this.matchPos =
|
|
896
|
+
return this.value = { from: n, to: o, match: r }, this.matchPos = Ae(this.text, o + (n == o ? 1 : 0)), this;
|
|
897
897
|
}
|
|
898
898
|
if (this.flat.to == this.to)
|
|
899
899
|
return this.done = !0, this;
|
|
900
|
-
this.flat =
|
|
900
|
+
this.flat = ee.get(this.text, this.flat.from, this.chunkEnd(this.flat.from + this.flat.text.length * 2));
|
|
901
901
|
}
|
|
902
902
|
}
|
|
903
903
|
}
|
|
904
|
-
typeof Symbol < "u" && (
|
|
904
|
+
typeof Symbol < "u" && (vn.prototype[Symbol.iterator] = An.prototype[Symbol.iterator] = function() {
|
|
905
905
|
return this;
|
|
906
906
|
});
|
|
907
|
-
function
|
|
907
|
+
function Fo(t) {
|
|
908
908
|
try {
|
|
909
|
-
return new RegExp(t,
|
|
909
|
+
return new RegExp(t, st), !0;
|
|
910
910
|
} catch {
|
|
911
911
|
return !1;
|
|
912
912
|
}
|
|
913
913
|
}
|
|
914
|
-
function
|
|
914
|
+
function Ae(t, e) {
|
|
915
915
|
if (e >= t.length)
|
|
916
916
|
return e;
|
|
917
917
|
let r = t.lineAt(e), n;
|
|
@@ -919,11 +919,11 @@ function ve(t, e) {
|
|
|
919
919
|
e++;
|
|
920
920
|
return e;
|
|
921
921
|
}
|
|
922
|
-
function
|
|
922
|
+
function Ye(t) {
|
|
923
923
|
let e = g("input", { class: "cm-textfield", name: "line" }), r = g("form", {
|
|
924
924
|
class: "cm-gotoLine",
|
|
925
925
|
onkeydown: (o) => {
|
|
926
|
-
o.keyCode == 27 ? (o.preventDefault(), t.dispatch({ effects:
|
|
926
|
+
o.keyCode == 27 ? (o.preventDefault(), t.dispatch({ effects: Me.of(!1) }), t.focus()) : o.keyCode == 13 && (o.preventDefault(), n());
|
|
927
927
|
},
|
|
928
928
|
onsubmit: (o) => {
|
|
929
929
|
o.preventDefault(), n();
|
|
@@ -935,66 +935,66 @@ function Qe(t) {
|
|
|
935
935
|
return;
|
|
936
936
|
let { state: i } = t, s = i.doc.lineAt(i.selection.main.head), [, l, a, c, u] = o, h = c ? +c.slice(1) : 0, m = a ? +a : s.number;
|
|
937
937
|
if (a && u) {
|
|
938
|
-
let
|
|
939
|
-
l && (
|
|
938
|
+
let R = m / 100;
|
|
939
|
+
l && (R = R * (l == "-" ? -1 : 1) + s.number / i.doc.lines), m = Math.round(i.doc.lines * R);
|
|
940
940
|
} else
|
|
941
941
|
a && l && (m = m * (l == "-" ? -1 : 1) + s.number);
|
|
942
942
|
let k = i.doc.line(Math.max(1, Math.min(i.doc.lines, m))), C = d.cursor(k.from + Math.max(0, Math.min(h, k.length)));
|
|
943
943
|
t.dispatch({
|
|
944
|
-
effects: [
|
|
944
|
+
effects: [Me.of(!1), p.scrollIntoView(C.from, { y: "center" })],
|
|
945
945
|
selection: C
|
|
946
946
|
}), t.focus();
|
|
947
947
|
}
|
|
948
948
|
return { dom: r };
|
|
949
949
|
}
|
|
950
|
-
const
|
|
950
|
+
const Me = /* @__PURE__ */ w.define(), kt = /* @__PURE__ */ we.define({
|
|
951
951
|
create() {
|
|
952
952
|
return !0;
|
|
953
953
|
},
|
|
954
954
|
update(t, e) {
|
|
955
955
|
for (let r of e.effects)
|
|
956
|
-
r.is(
|
|
956
|
+
r.is(Me) && (t = r.value);
|
|
957
957
|
return t;
|
|
958
958
|
},
|
|
959
|
-
provide: (t) =>
|
|
960
|
-
}),
|
|
961
|
-
let e = ue(t,
|
|
959
|
+
provide: (t) => nt.from(t, (e) => e ? Ye : null)
|
|
960
|
+
}), No = (t) => {
|
|
961
|
+
let e = ue(t, Ye);
|
|
962
962
|
if (!e) {
|
|
963
|
-
let r = [
|
|
964
|
-
t.state.field(
|
|
963
|
+
let r = [Me.of(!0)];
|
|
964
|
+
t.state.field(kt, !1) == null && r.push(w.appendConfig.of([kt, qo])), t.dispatch({ effects: r }), e = ue(t, Ye);
|
|
965
965
|
}
|
|
966
966
|
return e && e.dom.querySelector("input").focus(), !0;
|
|
967
|
-
},
|
|
967
|
+
}, qo = /* @__PURE__ */ p.baseTheme({
|
|
968
968
|
".cm-panel.cm-gotoLine": {
|
|
969
969
|
padding: "2px 6px 4px",
|
|
970
970
|
"& label": { fontSize: "80%" }
|
|
971
971
|
}
|
|
972
|
-
}),
|
|
972
|
+
}), _o = {
|
|
973
973
|
highlightWordAroundCursor: !1,
|
|
974
974
|
minSelectionLength: 1,
|
|
975
975
|
maxMatches: 100,
|
|
976
976
|
wholeWords: !1
|
|
977
|
-
},
|
|
977
|
+
}, Mn = /* @__PURE__ */ de.define({
|
|
978
978
|
combine(t) {
|
|
979
|
-
return
|
|
979
|
+
return Re(t, _o, {
|
|
980
980
|
highlightWordAroundCursor: (e, r) => e || r,
|
|
981
981
|
minSelectionLength: Math.min,
|
|
982
982
|
maxMatches: Math.min
|
|
983
983
|
});
|
|
984
984
|
}
|
|
985
985
|
});
|
|
986
|
-
function
|
|
987
|
-
let e = [
|
|
988
|
-
return t && e.push(
|
|
986
|
+
function Ho(t) {
|
|
987
|
+
let e = [Go, $o];
|
|
988
|
+
return t && e.push(Mn.of(t)), e;
|
|
989
989
|
}
|
|
990
|
-
const
|
|
991
|
-
function
|
|
992
|
-
return (r == 0 || t(e.sliceDoc(r - 1, r)) !=
|
|
990
|
+
const Vo = /* @__PURE__ */ x.mark({ class: "cm-selectionMatch" }), zo = /* @__PURE__ */ x.mark({ class: "cm-selectionMatch cm-selectionMatch-main" });
|
|
991
|
+
function bt(t, e, r, n) {
|
|
992
|
+
return (r == 0 || t(e.sliceDoc(r - 1, r)) != B.Word) && (n == e.doc.length || t(e.sliceDoc(n, n + 1)) != B.Word);
|
|
993
993
|
}
|
|
994
|
-
function
|
|
995
|
-
return t(e.sliceDoc(r, r + 1)) ==
|
|
994
|
+
function Uo(t, e, r, n) {
|
|
995
|
+
return t(e.sliceDoc(r, r + 1)) == B.Word && t(e.sliceDoc(n - 1, n)) == B.Word;
|
|
996
996
|
}
|
|
997
|
-
const
|
|
997
|
+
const $o = /* @__PURE__ */ Nt.fromClass(class {
|
|
998
998
|
constructor(t) {
|
|
999
999
|
this.decorations = this.getDeco(t);
|
|
1000
1000
|
}
|
|
@@ -1002,7 +1002,7 @@ const zo = /* @__PURE__ */ Ft.fromClass(class {
|
|
|
1002
1002
|
(t.selectionSet || t.docChanged || t.viewportChanged) && (this.decorations = this.getDeco(t.view));
|
|
1003
1003
|
}
|
|
1004
1004
|
getDeco(t) {
|
|
1005
|
-
let e = t.state.facet(
|
|
1005
|
+
let e = t.state.facet(Mn), { state: r } = t, n = r.selection;
|
|
1006
1006
|
if (n.ranges.length > 1)
|
|
1007
1007
|
return x.none;
|
|
1008
1008
|
let o = n.main, i, s = null;
|
|
@@ -1018,17 +1018,17 @@ const zo = /* @__PURE__ */ Ft.fromClass(class {
|
|
|
1018
1018
|
if (a < e.minSelectionLength || a > 200)
|
|
1019
1019
|
return x.none;
|
|
1020
1020
|
if (e.wholeWords) {
|
|
1021
|
-
if (i = r.sliceDoc(o.from, o.to), s = r.charCategorizer(o.head), !(
|
|
1021
|
+
if (i = r.sliceDoc(o.from, o.to), s = r.charCategorizer(o.head), !(bt(s, r, o.from, o.to) && Uo(s, r, o.from, o.to)))
|
|
1022
1022
|
return x.none;
|
|
1023
1023
|
} else if (i = r.sliceDoc(o.from, o.to).trim(), !i)
|
|
1024
1024
|
return x.none;
|
|
1025
1025
|
}
|
|
1026
1026
|
let l = [];
|
|
1027
1027
|
for (let a of t.visibleRanges) {
|
|
1028
|
-
let c = new
|
|
1028
|
+
let c = new ne(r.doc, i, a.from, a.to);
|
|
1029
1029
|
for (; !c.next().done; ) {
|
|
1030
1030
|
let { from: u, to: h } = c.value;
|
|
1031
|
-
if ((!s ||
|
|
1031
|
+
if ((!s || bt(s, r, u, h)) && (o.empty && u <= o.from && h >= o.to ? l.push(zo.range(u, h)) : (u >= o.to || h <= o.from) && l.push(Vo.range(u, h)), l.length > e.maxMatches))
|
|
1032
1032
|
return x.none;
|
|
1033
1033
|
}
|
|
1034
1034
|
}
|
|
@@ -1036,20 +1036,20 @@ const zo = /* @__PURE__ */ Ft.fromClass(class {
|
|
|
1036
1036
|
}
|
|
1037
1037
|
}, {
|
|
1038
1038
|
decorations: (t) => t.decorations
|
|
1039
|
-
}),
|
|
1039
|
+
}), Go = /* @__PURE__ */ p.baseTheme({
|
|
1040
1040
|
".cm-selectionMatch": { backgroundColor: "#99ff7780" },
|
|
1041
1041
|
".cm-searchMatch .cm-selectionMatch": { backgroundColor: "transparent" }
|
|
1042
|
-
}),
|
|
1042
|
+
}), Ko = ({ state: t, dispatch: e }) => {
|
|
1043
1043
|
let { selection: r } = t, n = d.create(r.ranges.map((o) => t.wordAt(o.head) || d.cursor(o.head)), r.mainIndex);
|
|
1044
1044
|
return n.eq(r) ? !1 : (e(t.update({ selection: n })), !0);
|
|
1045
1045
|
};
|
|
1046
|
-
function
|
|
1046
|
+
function Jo(t, e) {
|
|
1047
1047
|
let { main: r, ranges: n } = t.selection, o = t.wordAt(r.head), i = o && o.from == r.from && o.to == r.to;
|
|
1048
|
-
for (let s = !1, l = new
|
|
1048
|
+
for (let s = !1, l = new ne(t.doc, e, n[n.length - 1].to); ; )
|
|
1049
1049
|
if (l.next(), l.done) {
|
|
1050
1050
|
if (s)
|
|
1051
1051
|
return null;
|
|
1052
|
-
l = new
|
|
1052
|
+
l = new ne(t.doc, e, 0, Math.max(0, n[n.length - 1].from - 1)), s = !0;
|
|
1053
1053
|
} else {
|
|
1054
1054
|
if (s && n.some((a) => a.from == l.value.from))
|
|
1055
1055
|
continue;
|
|
@@ -1061,37 +1061,37 @@ function Go(t, e) {
|
|
|
1061
1061
|
return l.value;
|
|
1062
1062
|
}
|
|
1063
1063
|
}
|
|
1064
|
-
const
|
|
1064
|
+
const jo = ({ state: t, dispatch: e }) => {
|
|
1065
1065
|
let { ranges: r } = t.selection;
|
|
1066
1066
|
if (r.some((i) => i.from === i.to))
|
|
1067
|
-
return
|
|
1067
|
+
return Ko({ state: t, dispatch: e });
|
|
1068
1068
|
let n = t.sliceDoc(r[0].from, r[0].to);
|
|
1069
1069
|
if (t.selection.ranges.some((i) => t.sliceDoc(i.from, i.to) != n))
|
|
1070
1070
|
return !1;
|
|
1071
|
-
let o =
|
|
1071
|
+
let o = Jo(t, n);
|
|
1072
1072
|
return o ? (e(t.update({
|
|
1073
1073
|
selection: t.selection.addRange(d.range(o.from, o.to), !1),
|
|
1074
1074
|
effects: p.scrollIntoView(o.to)
|
|
1075
1075
|
})), !0) : !1;
|
|
1076
|
-
},
|
|
1076
|
+
}, ie = /* @__PURE__ */ de.define({
|
|
1077
1077
|
combine(t) {
|
|
1078
|
-
return
|
|
1078
|
+
return Re(t, {
|
|
1079
1079
|
top: !1,
|
|
1080
1080
|
caseSensitive: !1,
|
|
1081
1081
|
literal: !1,
|
|
1082
1082
|
regexp: !1,
|
|
1083
1083
|
wholeWord: !1,
|
|
1084
|
-
createPanel: (e) => new
|
|
1084
|
+
createPanel: (e) => new li(e),
|
|
1085
1085
|
scrollToMatch: (e) => p.scrollIntoView(e)
|
|
1086
1086
|
});
|
|
1087
1087
|
}
|
|
1088
1088
|
});
|
|
1089
|
-
class
|
|
1089
|
+
class Ln {
|
|
1090
1090
|
/**
|
|
1091
1091
|
Create a query object.
|
|
1092
1092
|
*/
|
|
1093
1093
|
constructor(e) {
|
|
1094
|
-
this.search = e.search, this.caseSensitive = !!e.caseSensitive, this.literal = !!e.literal, this.regexp = !!e.regexp, this.replace = e.replace || "", this.valid = !!this.search && (!this.regexp ||
|
|
1094
|
+
this.search = e.search, this.caseSensitive = !!e.caseSensitive, this.literal = !!e.literal, this.regexp = !!e.regexp, this.replace = e.replace || "", this.valid = !!this.search && (!this.regexp || Fo(this.search)), this.unquoted = this.unquote(this.search), this.wholeWord = !!e.wholeWord;
|
|
1095
1095
|
}
|
|
1096
1096
|
/**
|
|
1097
1097
|
@internal
|
|
@@ -1110,7 +1110,7 @@ class Mn {
|
|
|
1110
1110
|
@internal
|
|
1111
1111
|
*/
|
|
1112
1112
|
create() {
|
|
1113
|
-
return this.regexp ? new
|
|
1113
|
+
return this.regexp ? new Xo(this) : new Yo(this);
|
|
1114
1114
|
}
|
|
1115
1115
|
/**
|
|
1116
1116
|
Get a search cursor for this query, searching through the given
|
|
@@ -1118,33 +1118,33 @@ class Mn {
|
|
|
1118
1118
|
*/
|
|
1119
1119
|
getCursor(e, r = 0, n) {
|
|
1120
1120
|
let o = e.doc ? e : he.create({ doc: e });
|
|
1121
|
-
return n == null && (n = o.doc.length), this.regexp ?
|
|
1121
|
+
return n == null && (n = o.doc.length), this.regexp ? Z(this, o, r, n) : Y(this, o, r, n);
|
|
1122
1122
|
}
|
|
1123
1123
|
}
|
|
1124
|
-
class
|
|
1124
|
+
class Bn {
|
|
1125
1125
|
constructor(e) {
|
|
1126
1126
|
this.spec = e;
|
|
1127
1127
|
}
|
|
1128
1128
|
}
|
|
1129
|
-
function
|
|
1130
|
-
return new
|
|
1129
|
+
function Y(t, e, r, n) {
|
|
1130
|
+
return new ne(e.doc, t.unquoted, r, n, t.caseSensitive ? void 0 : (o) => o.toLowerCase(), t.wholeWord ? Qo(e.doc, e.charCategorizer(e.selection.main.head)) : void 0);
|
|
1131
1131
|
}
|
|
1132
|
-
function
|
|
1133
|
-
return (r, n, o, i) => ((i > r || i + o.length < n) && (i = Math.max(0, r - 2), o = t.sliceString(i, Math.min(t.length, n + 2))), (e(
|
|
1132
|
+
function Qo(t, e) {
|
|
1133
|
+
return (r, n, o, i) => ((i > r || i + o.length < n) && (i = Math.max(0, r - 2), o = t.sliceString(i, Math.min(t.length, n + 2))), (e(Le(o, r - i)) != B.Word || e(Be(o, r - i)) != B.Word) && (e(Be(o, n - i)) != B.Word || e(Le(o, n - i)) != B.Word));
|
|
1134
1134
|
}
|
|
1135
|
-
class
|
|
1135
|
+
class Yo extends Bn {
|
|
1136
1136
|
constructor(e) {
|
|
1137
1137
|
super(e);
|
|
1138
1138
|
}
|
|
1139
1139
|
nextMatch(e, r, n) {
|
|
1140
|
-
let o =
|
|
1141
|
-
return o.done && (o =
|
|
1140
|
+
let o = Y(this.spec, e, n, e.doc.length).nextOverlapping();
|
|
1141
|
+
return o.done && (o = Y(this.spec, e, 0, r).nextOverlapping()), o.done ? null : o.value;
|
|
1142
1142
|
}
|
|
1143
1143
|
// Searching in reverse is, rather than implementing an inverted search
|
|
1144
1144
|
// cursor, done by scanning chunk after chunk forward.
|
|
1145
1145
|
prevMatchInRange(e, r, n) {
|
|
1146
1146
|
for (let o = n; ; ) {
|
|
1147
|
-
let i = Math.max(r, o - 1e4 - this.spec.unquoted.length), s =
|
|
1147
|
+
let i = Math.max(r, o - 1e4 - this.spec.unquoted.length), s = Y(this.spec, e, i, o), l = null;
|
|
1148
1148
|
for (; !s.nextOverlapping().done; )
|
|
1149
1149
|
l = s.value;
|
|
1150
1150
|
if (l)
|
|
@@ -1161,7 +1161,7 @@ class jo extends Ln {
|
|
|
1161
1161
|
return this.spec.unquote(this.spec.replace);
|
|
1162
1162
|
}
|
|
1163
1163
|
matchAll(e, r) {
|
|
1164
|
-
let n =
|
|
1164
|
+
let n = Y(this.spec, e, 0, e.doc.length), o = [];
|
|
1165
1165
|
for (; !n.next().done; ) {
|
|
1166
1166
|
if (o.length >= r)
|
|
1167
1167
|
return null;
|
|
@@ -1170,30 +1170,30 @@ class jo extends Ln {
|
|
|
1170
1170
|
return o;
|
|
1171
1171
|
}
|
|
1172
1172
|
highlight(e, r, n, o) {
|
|
1173
|
-
let i =
|
|
1173
|
+
let i = Y(this.spec, e, Math.max(0, r - this.spec.unquoted.length), Math.min(n + this.spec.unquoted.length, e.doc.length));
|
|
1174
1174
|
for (; !i.next().done; )
|
|
1175
1175
|
o(i.value.from, i.value.to);
|
|
1176
1176
|
}
|
|
1177
1177
|
}
|
|
1178
|
-
function
|
|
1179
|
-
return new
|
|
1178
|
+
function Z(t, e, r, n) {
|
|
1179
|
+
return new vn(e.doc, t.search, {
|
|
1180
1180
|
ignoreCase: !t.caseSensitive,
|
|
1181
|
-
test: t.wholeWord ?
|
|
1181
|
+
test: t.wholeWord ? Zo(e.charCategorizer(e.selection.main.head)) : void 0
|
|
1182
1182
|
}, r, n);
|
|
1183
1183
|
}
|
|
1184
|
-
function Me(t, e) {
|
|
1185
|
-
return t.slice(ee(t, e, !1), e);
|
|
1186
|
-
}
|
|
1187
1184
|
function Le(t, e) {
|
|
1188
|
-
return t.slice(e,
|
|
1185
|
+
return t.slice(te(t, e, !1), e);
|
|
1189
1186
|
}
|
|
1190
|
-
function
|
|
1191
|
-
return
|
|
1187
|
+
function Be(t, e) {
|
|
1188
|
+
return t.slice(e, te(t, e));
|
|
1192
1189
|
}
|
|
1193
|
-
|
|
1190
|
+
function Zo(t) {
|
|
1191
|
+
return (e, r, n) => !n[0].length || (t(Le(n.input, n.index)) != B.Word || t(Be(n.input, n.index)) != B.Word) && (t(Be(n.input, n.index + n[0].length)) != B.Word || t(Le(n.input, n.index + n[0].length)) != B.Word);
|
|
1192
|
+
}
|
|
1193
|
+
class Xo extends Bn {
|
|
1194
1194
|
nextMatch(e, r, n) {
|
|
1195
|
-
let o =
|
|
1196
|
-
return o.done && (o =
|
|
1195
|
+
let o = Z(this.spec, e, n, e.doc.length).next();
|
|
1196
|
+
return o.done && (o = Z(this.spec, e, 0, r).next()), o.done ? null : o.value;
|
|
1197
1197
|
}
|
|
1198
1198
|
prevMatchInRange(e, r, n) {
|
|
1199
1199
|
for (let o = 1; ; o++) {
|
|
@@ -1201,7 +1201,7 @@ class Yo extends Ln {
|
|
|
1201
1201
|
r,
|
|
1202
1202
|
n - o * 1e4
|
|
1203
1203
|
/* ChunkSize */
|
|
1204
|
-
), s =
|
|
1204
|
+
), s = Z(this.spec, e, i, n), l = null;
|
|
1205
1205
|
for (; !s.next().done; )
|
|
1206
1206
|
l = s.value;
|
|
1207
1207
|
if (l && (i == r || l.from > i + 10))
|
|
@@ -1217,7 +1217,7 @@ class Yo extends Ln {
|
|
|
1217
1217
|
return this.spec.unquote(this.spec.replace.replace(/\$([$&\d+])/g, (r, n) => n == "$" ? "$" : n == "&" ? e.match[0] : n != "0" && +n < e.match.length ? e.match[n] : r));
|
|
1218
1218
|
}
|
|
1219
1219
|
matchAll(e, r) {
|
|
1220
|
-
let n =
|
|
1220
|
+
let n = Z(this.spec, e, 0, e.doc.length), o = [];
|
|
1221
1221
|
for (; !n.next().done; ) {
|
|
1222
1222
|
if (o.length >= r)
|
|
1223
1223
|
return null;
|
|
@@ -1226,7 +1226,7 @@ class Yo extends Ln {
|
|
|
1226
1226
|
return o;
|
|
1227
1227
|
}
|
|
1228
1228
|
highlight(e, r, n, o) {
|
|
1229
|
-
let i =
|
|
1229
|
+
let i = Z(this.spec, e, Math.max(
|
|
1230
1230
|
0,
|
|
1231
1231
|
r - 250
|
|
1232
1232
|
/* HighlightMargin */
|
|
@@ -1235,23 +1235,23 @@ class Yo extends Ln {
|
|
|
1235
1235
|
o(i.value.from, i.value.to);
|
|
1236
1236
|
}
|
|
1237
1237
|
}
|
|
1238
|
-
const fe = /* @__PURE__ */ w.define(),
|
|
1238
|
+
const fe = /* @__PURE__ */ w.define(), lt = /* @__PURE__ */ w.define(), q = /* @__PURE__ */ we.define({
|
|
1239
1239
|
create(t) {
|
|
1240
|
-
return new
|
|
1240
|
+
return new ze(Ze(t).create(), null);
|
|
1241
1241
|
},
|
|
1242
1242
|
update(t, e) {
|
|
1243
1243
|
for (let r of e.effects)
|
|
1244
|
-
r.is(fe) ? t = new
|
|
1244
|
+
r.is(fe) ? t = new ze(r.value.create(), t.panel) : r.is(lt) && (t = new ze(t.query, r.value ? at : null));
|
|
1245
1245
|
return t;
|
|
1246
1246
|
},
|
|
1247
|
-
provide: (t) =>
|
|
1247
|
+
provide: (t) => nt.from(t, (e) => e.panel)
|
|
1248
1248
|
});
|
|
1249
|
-
class
|
|
1249
|
+
class ze {
|
|
1250
1250
|
constructor(e, r) {
|
|
1251
1251
|
this.query = e, this.panel = r;
|
|
1252
1252
|
}
|
|
1253
1253
|
}
|
|
1254
|
-
const
|
|
1254
|
+
const ei = /* @__PURE__ */ x.mark({ class: "cm-searchMatch" }), ti = /* @__PURE__ */ x.mark({ class: "cm-searchMatch cm-searchMatch-selected" }), ni = /* @__PURE__ */ Nt.fromClass(class {
|
|
1255
1255
|
constructor(t) {
|
|
1256
1256
|
this.view = t, this.decorations = this.highlight(t.state.field(q));
|
|
1257
1257
|
}
|
|
@@ -1262,14 +1262,14 @@ const Zo = /* @__PURE__ */ x.mark({ class: "cm-searchMatch" }), Xo = /* @__PURE_
|
|
|
1262
1262
|
highlight({ query: t, panel: e }) {
|
|
1263
1263
|
if (!e || !t.spec.valid)
|
|
1264
1264
|
return x.none;
|
|
1265
|
-
let { view: r } = this, n = new
|
|
1265
|
+
let { view: r } = this, n = new rr();
|
|
1266
1266
|
for (let o = 0, i = r.visibleRanges, s = i.length; o < s; o++) {
|
|
1267
1267
|
let { from: l, to: a } = i[o];
|
|
1268
1268
|
for (; o < s - 1 && a > i[o + 1].from - 2 * 250; )
|
|
1269
1269
|
a = i[++o].to;
|
|
1270
1270
|
t.highlight(r.state, l, a, (c, u) => {
|
|
1271
1271
|
let h = r.state.selection.ranges.some((m) => m.from == c && m.to == u);
|
|
1272
|
-
n.add(c, u, h ?
|
|
1272
|
+
n.add(c, u, h ? ti : ei);
|
|
1273
1273
|
});
|
|
1274
1274
|
}
|
|
1275
1275
|
return n.finish();
|
|
@@ -1280,41 +1280,41 @@ const Zo = /* @__PURE__ */ x.mark({ class: "cm-searchMatch" }), Xo = /* @__PURE_
|
|
|
1280
1280
|
function me(t) {
|
|
1281
1281
|
return (e) => {
|
|
1282
1282
|
let r = e.state.field(q, !1);
|
|
1283
|
-
return r && r.query.spec.valid ? t(e, r) :
|
|
1283
|
+
return r && r.query.spec.valid ? t(e, r) : Rn(e);
|
|
1284
1284
|
};
|
|
1285
1285
|
}
|
|
1286
|
-
const
|
|
1286
|
+
const De = /* @__PURE__ */ me((t, { query: e }) => {
|
|
1287
1287
|
let { to: r } = t.state.selection.main, n = e.nextMatch(t.state, r, r);
|
|
1288
1288
|
if (!n)
|
|
1289
1289
|
return !1;
|
|
1290
|
-
let o = d.single(n.from, n.to), i = t.state.facet(
|
|
1290
|
+
let o = d.single(n.from, n.to), i = t.state.facet(ie);
|
|
1291
1291
|
return t.dispatch({
|
|
1292
1292
|
selection: o,
|
|
1293
|
-
effects: [
|
|
1293
|
+
effects: [ct(t, n), i.scrollToMatch(o.main, t)],
|
|
1294
1294
|
userEvent: "select.search"
|
|
1295
|
-
}),
|
|
1296
|
-
}),
|
|
1295
|
+
}), En(t), !0;
|
|
1296
|
+
}), Ee = /* @__PURE__ */ me((t, { query: e }) => {
|
|
1297
1297
|
let { state: r } = t, { from: n } = r.selection.main, o = e.prevMatch(r, n, n);
|
|
1298
1298
|
if (!o)
|
|
1299
1299
|
return !1;
|
|
1300
|
-
let i = d.single(o.from, o.to), s = t.state.facet(
|
|
1300
|
+
let i = d.single(o.from, o.to), s = t.state.facet(ie);
|
|
1301
1301
|
return t.dispatch({
|
|
1302
1302
|
selection: i,
|
|
1303
|
-
effects: [
|
|
1303
|
+
effects: [ct(t, o), s.scrollToMatch(i.main, t)],
|
|
1304
1304
|
userEvent: "select.search"
|
|
1305
|
-
}),
|
|
1306
|
-
}),
|
|
1305
|
+
}), En(t), !0;
|
|
1306
|
+
}), ri = /* @__PURE__ */ me((t, { query: e }) => {
|
|
1307
1307
|
let r = e.matchAll(t.state, 1e3);
|
|
1308
1308
|
return !r || !r.length ? !1 : (t.dispatch({
|
|
1309
1309
|
selection: d.create(r.map((n) => d.range(n.from, n.to))),
|
|
1310
1310
|
userEvent: "select.search.matches"
|
|
1311
1311
|
}), !0);
|
|
1312
|
-
}),
|
|
1312
|
+
}), oi = ({ state: t, dispatch: e }) => {
|
|
1313
1313
|
let r = t.selection;
|
|
1314
1314
|
if (r.ranges.length > 1 || r.main.empty)
|
|
1315
1315
|
return !1;
|
|
1316
1316
|
let { from: n, to: o } = r.main, i = [], s = 0;
|
|
1317
|
-
for (let l = new
|
|
1317
|
+
for (let l = new ne(t.doc, t.sliceDoc(n, o)); !l.next().done; ) {
|
|
1318
1318
|
if (i.length > 1e3)
|
|
1319
1319
|
return !1;
|
|
1320
1320
|
l.value.from == n && (s = i.length), i.push(d.range(l.value.from, l.value.to));
|
|
@@ -1323,7 +1323,7 @@ const Be = /* @__PURE__ */ me((t, { query: e }) => {
|
|
|
1323
1323
|
selection: d.create(i, s),
|
|
1324
1324
|
userEvent: "select.search.matches"
|
|
1325
1325
|
})), !0;
|
|
1326
|
-
},
|
|
1326
|
+
}, St = /* @__PURE__ */ me((t, { query: e }) => {
|
|
1327
1327
|
let { state: r } = t, { from: n, to: o } = r.selection.main;
|
|
1328
1328
|
if (r.readOnly)
|
|
1329
1329
|
return !1;
|
|
@@ -1333,7 +1333,7 @@ const Be = /* @__PURE__ */ me((t, { query: e }) => {
|
|
|
1333
1333
|
let s = [], l, a, c = [];
|
|
1334
1334
|
if (i.from == n && i.to == o && (a = r.toText(e.getReplacement(i)), s.push({ from: i.from, to: i.to, insert: a }), i = e.nextMatch(r, i.from, i.to), c.push(p.announce.of(r.phrase("replaced match on line $", r.doc.lineAt(n).number) + "."))), i) {
|
|
1335
1335
|
let u = s.length == 0 || s[0].from >= i.to ? 0 : i.to - i.from - a.length;
|
|
1336
|
-
l = d.single(i.from - u, i.to - u), c.push(
|
|
1336
|
+
l = d.single(i.from - u, i.to - u), c.push(ct(t, i)), c.push(r.facet(ie).scrollToMatch(l.main, t));
|
|
1337
1337
|
}
|
|
1338
1338
|
return t.dispatch({
|
|
1339
1339
|
changes: s,
|
|
@@ -1341,7 +1341,7 @@ const Be = /* @__PURE__ */ me((t, { query: e }) => {
|
|
|
1341
1341
|
effects: c,
|
|
1342
1342
|
userEvent: "input.replace"
|
|
1343
1343
|
}), !0;
|
|
1344
|
-
}),
|
|
1344
|
+
}), ii = /* @__PURE__ */ me((t, { query: e }) => {
|
|
1345
1345
|
if (t.state.readOnly)
|
|
1346
1346
|
return !1;
|
|
1347
1347
|
let r = e.matchAll(t.state, 1e9).map((o) => {
|
|
@@ -1357,16 +1357,16 @@ const Be = /* @__PURE__ */ me((t, { query: e }) => {
|
|
|
1357
1357
|
userEvent: "input.replace.all"
|
|
1358
1358
|
}), !0;
|
|
1359
1359
|
});
|
|
1360
|
-
function
|
|
1361
|
-
return t.state.facet(
|
|
1360
|
+
function at(t) {
|
|
1361
|
+
return t.state.facet(ie).createPanel(t);
|
|
1362
1362
|
}
|
|
1363
|
-
function
|
|
1363
|
+
function Ze(t, e) {
|
|
1364
1364
|
var r, n, o, i, s;
|
|
1365
1365
|
let l = t.selection.main, a = l.empty || l.to > l.from + 100 ? "" : t.sliceDoc(l.from, l.to);
|
|
1366
1366
|
if (e && !a)
|
|
1367
1367
|
return e;
|
|
1368
|
-
let c = t.facet(
|
|
1369
|
-
return new
|
|
1368
|
+
let c = t.facet(ie);
|
|
1369
|
+
return new Ln({
|
|
1370
1370
|
search: ((r = e == null ? void 0 : e.literal) !== null && r !== void 0 ? r : c.literal) ? a : a.replace(/\n/g, "\\n"),
|
|
1371
1371
|
caseSensitive: (n = e == null ? void 0 : e.caseSensitive) !== null && n !== void 0 ? n : c.caseSensitive,
|
|
1372
1372
|
literal: (o = e == null ? void 0 : e.literal) !== null && o !== void 0 ? o : c.literal,
|
|
@@ -1374,51 +1374,51 @@ function Ye(t, e) {
|
|
|
1374
1374
|
wholeWord: (s = e == null ? void 0 : e.wholeWord) !== null && s !== void 0 ? s : c.wholeWord
|
|
1375
1375
|
});
|
|
1376
1376
|
}
|
|
1377
|
-
function
|
|
1378
|
-
let e = ue(t,
|
|
1377
|
+
function Dn(t) {
|
|
1378
|
+
let e = ue(t, at);
|
|
1379
1379
|
return e && e.dom.querySelector("[main-field]");
|
|
1380
1380
|
}
|
|
1381
|
-
function
|
|
1382
|
-
let e =
|
|
1381
|
+
function En(t) {
|
|
1382
|
+
let e = Dn(t);
|
|
1383
1383
|
e && e == t.root.activeElement && e.select();
|
|
1384
1384
|
}
|
|
1385
|
-
const
|
|
1385
|
+
const Rn = (t) => {
|
|
1386
1386
|
let e = t.state.field(q, !1);
|
|
1387
1387
|
if (e && e.panel) {
|
|
1388
|
-
let r =
|
|
1388
|
+
let r = Dn(t);
|
|
1389
1389
|
if (r && r != t.root.activeElement) {
|
|
1390
|
-
let n =
|
|
1390
|
+
let n = Ze(t.state, e.query.spec);
|
|
1391
1391
|
n.valid && t.dispatch({ effects: fe.of(n) }), r.focus(), r.select();
|
|
1392
1392
|
}
|
|
1393
1393
|
} else
|
|
1394
1394
|
t.dispatch({ effects: [
|
|
1395
|
-
|
|
1396
|
-
e ? fe.of(
|
|
1395
|
+
lt.of(!0),
|
|
1396
|
+
e ? fe.of(Ze(t.state, e.query.spec)) : w.appendConfig.of(ci)
|
|
1397
1397
|
] });
|
|
1398
1398
|
return !0;
|
|
1399
|
-
},
|
|
1399
|
+
}, wn = (t) => {
|
|
1400
1400
|
let e = t.state.field(q, !1);
|
|
1401
1401
|
if (!e || !e.panel)
|
|
1402
1402
|
return !1;
|
|
1403
|
-
let r = ue(t,
|
|
1404
|
-
return r && r.dom.contains(t.root.activeElement) && t.focus(), t.dispatch({ effects:
|
|
1405
|
-
},
|
|
1406
|
-
{ key: "Mod-f", run:
|
|
1407
|
-
{ key: "F3", run:
|
|
1408
|
-
{ key: "Mod-g", run:
|
|
1409
|
-
{ key: "Escape", run:
|
|
1410
|
-
{ key: "Mod-Shift-l", run:
|
|
1411
|
-
{ key: "Alt-g", run:
|
|
1412
|
-
{ key: "Mod-d", run:
|
|
1403
|
+
let r = ue(t, at);
|
|
1404
|
+
return r && r.dom.contains(t.root.activeElement) && t.focus(), t.dispatch({ effects: lt.of(!1) }), !0;
|
|
1405
|
+
}, si = [
|
|
1406
|
+
{ key: "Mod-f", run: Rn, scope: "editor search-panel" },
|
|
1407
|
+
{ key: "F3", run: De, shift: Ee, scope: "editor search-panel", preventDefault: !0 },
|
|
1408
|
+
{ key: "Mod-g", run: De, shift: Ee, scope: "editor search-panel", preventDefault: !0 },
|
|
1409
|
+
{ key: "Escape", run: wn, scope: "editor search-panel" },
|
|
1410
|
+
{ key: "Mod-Shift-l", run: oi },
|
|
1411
|
+
{ key: "Alt-g", run: No },
|
|
1412
|
+
{ key: "Mod-d", run: jo, preventDefault: !0 }
|
|
1413
1413
|
];
|
|
1414
|
-
class
|
|
1414
|
+
class li {
|
|
1415
1415
|
constructor(e) {
|
|
1416
1416
|
this.view = e;
|
|
1417
1417
|
let r = this.query = e.state.field(q).query.spec;
|
|
1418
1418
|
this.commit = this.commit.bind(this), this.searchField = g("input", {
|
|
1419
1419
|
value: r.search,
|
|
1420
|
-
placeholder:
|
|
1421
|
-
"aria-label":
|
|
1420
|
+
placeholder: M(e, "Find"),
|
|
1421
|
+
"aria-label": M(e, "Find"),
|
|
1422
1422
|
class: "cm-textfield",
|
|
1423
1423
|
name: "search",
|
|
1424
1424
|
form: "",
|
|
@@ -1427,8 +1427,8 @@ class ii {
|
|
|
1427
1427
|
onkeyup: this.commit
|
|
1428
1428
|
}), this.replaceField = g("input", {
|
|
1429
1429
|
value: r.replace,
|
|
1430
|
-
placeholder:
|
|
1431
|
-
"aria-label":
|
|
1430
|
+
placeholder: M(e, "Replace"),
|
|
1431
|
+
"aria-label": M(e, "Replace"),
|
|
1432
1432
|
class: "cm-textfield",
|
|
1433
1433
|
name: "replace",
|
|
1434
1434
|
form: "",
|
|
@@ -1458,28 +1458,28 @@ class ii {
|
|
|
1458
1458
|
}
|
|
1459
1459
|
this.dom = g("div", { onkeydown: (o) => this.keydown(o), class: "cm-search" }, [
|
|
1460
1460
|
this.searchField,
|
|
1461
|
-
n("next", () =>
|
|
1462
|
-
n("prev", () =>
|
|
1463
|
-
n("select", () =>
|
|
1464
|
-
g("label", null, [this.caseField,
|
|
1465
|
-
g("label", null, [this.reField,
|
|
1466
|
-
g("label", null, [this.wordField,
|
|
1461
|
+
n("next", () => De(e), [M(e, "next")]),
|
|
1462
|
+
n("prev", () => Ee(e), [M(e, "previous")]),
|
|
1463
|
+
n("select", () => ri(e), [M(e, "all")]),
|
|
1464
|
+
g("label", null, [this.caseField, M(e, "match case")]),
|
|
1465
|
+
g("label", null, [this.reField, M(e, "regexp")]),
|
|
1466
|
+
g("label", null, [this.wordField, M(e, "by word")]),
|
|
1467
1467
|
...e.state.readOnly ? [] : [
|
|
1468
1468
|
g("br"),
|
|
1469
1469
|
this.replaceField,
|
|
1470
|
-
n("replace", () =>
|
|
1471
|
-
n("replaceAll", () =>
|
|
1470
|
+
n("replace", () => St(e), [M(e, "replace")]),
|
|
1471
|
+
n("replaceAll", () => ii(e), [M(e, "replace all")])
|
|
1472
1472
|
],
|
|
1473
1473
|
g("button", {
|
|
1474
1474
|
name: "close",
|
|
1475
|
-
onclick: () =>
|
|
1476
|
-
"aria-label":
|
|
1475
|
+
onclick: () => wn(e),
|
|
1476
|
+
"aria-label": M(e, "close"),
|
|
1477
1477
|
type: "button"
|
|
1478
1478
|
}, ["×"])
|
|
1479
1479
|
]);
|
|
1480
1480
|
}
|
|
1481
1481
|
commit() {
|
|
1482
|
-
let e = new
|
|
1482
|
+
let e = new Ln({
|
|
1483
1483
|
search: this.searchField.value,
|
|
1484
1484
|
caseSensitive: this.caseField.checked,
|
|
1485
1485
|
regexp: this.reField.checked,
|
|
@@ -1489,7 +1489,7 @@ class ii {
|
|
|
1489
1489
|
e.eq(this.query) || (this.query = e, this.view.dispatch({ effects: fe.of(e) }));
|
|
1490
1490
|
}
|
|
1491
1491
|
keydown(e) {
|
|
1492
|
-
|
|
1492
|
+
or(this.view, e, "search-panel") ? e.preventDefault() : e.keyCode == 13 && e.target == this.searchField ? (e.preventDefault(), (e.shiftKey ? Ee : De)(this.view)) : e.keyCode == 13 && e.target == this.replaceField && (e.preventDefault(), St(this.view));
|
|
1493
1493
|
}
|
|
1494
1494
|
update(e) {
|
|
1495
1495
|
for (let r of e.transactions)
|
|
@@ -1506,32 +1506,32 @@ class ii {
|
|
|
1506
1506
|
return 80;
|
|
1507
1507
|
}
|
|
1508
1508
|
get top() {
|
|
1509
|
-
return this.view.state.facet(
|
|
1509
|
+
return this.view.state.facet(ie).top;
|
|
1510
1510
|
}
|
|
1511
1511
|
}
|
|
1512
|
-
function
|
|
1512
|
+
function M(t, e) {
|
|
1513
1513
|
return t.state.phrase(e);
|
|
1514
1514
|
}
|
|
1515
|
-
const
|
|
1516
|
-
function
|
|
1517
|
-
let n = t.state.doc.lineAt(e), o = t.state.doc.lineAt(r).to, i = Math.max(n.from, e -
|
|
1515
|
+
const xe = 30, ke = /[\s\.,:;?!]/;
|
|
1516
|
+
function ct(t, { from: e, to: r }) {
|
|
1517
|
+
let n = t.state.doc.lineAt(e), o = t.state.doc.lineAt(r).to, i = Math.max(n.from, e - xe), s = Math.min(o, r + xe), l = t.state.sliceDoc(i, s);
|
|
1518
1518
|
if (i != n.from) {
|
|
1519
|
-
for (let a = 0; a <
|
|
1520
|
-
if (!
|
|
1519
|
+
for (let a = 0; a < xe; a++)
|
|
1520
|
+
if (!ke.test(l[a + 1]) && ke.test(l[a])) {
|
|
1521
1521
|
l = l.slice(a);
|
|
1522
1522
|
break;
|
|
1523
1523
|
}
|
|
1524
1524
|
}
|
|
1525
1525
|
if (s != o) {
|
|
1526
|
-
for (let a = l.length - 1; a > l.length -
|
|
1527
|
-
if (!
|
|
1526
|
+
for (let a = l.length - 1; a > l.length - xe; a--)
|
|
1527
|
+
if (!ke.test(l[a - 1]) && ke.test(l[a])) {
|
|
1528
1528
|
l = l.slice(0, a);
|
|
1529
1529
|
break;
|
|
1530
1530
|
}
|
|
1531
1531
|
}
|
|
1532
1532
|
return p.announce.of(`${t.state.phrase("current match")}. ${l} ${t.state.phrase("on line")} ${n.number}.`);
|
|
1533
1533
|
}
|
|
1534
|
-
const
|
|
1534
|
+
const ai = /* @__PURE__ */ p.baseTheme({
|
|
1535
1535
|
".cm-panel.cm-search": {
|
|
1536
1536
|
padding: "2px 6px 4px",
|
|
1537
1537
|
position: "relative",
|
|
@@ -1560,107 +1560,107 @@ const si = /* @__PURE__ */ p.baseTheme({
|
|
|
1560
1560
|
"&dark .cm-searchMatch": { backgroundColor: "#00ffff8a" },
|
|
1561
1561
|
"&light .cm-searchMatch-selected": { backgroundColor: "#ff6a0054" },
|
|
1562
1562
|
"&dark .cm-searchMatch-selected": { backgroundColor: "#ff00ff8a" }
|
|
1563
|
-
}),
|
|
1563
|
+
}), ci = [
|
|
1564
1564
|
q,
|
|
1565
|
-
/* @__PURE__ */
|
|
1566
|
-
|
|
1565
|
+
/* @__PURE__ */ tr.lowest(ni),
|
|
1566
|
+
ai
|
|
1567
1567
|
];
|
|
1568
|
-
class
|
|
1568
|
+
class ui {
|
|
1569
1569
|
constructor(e, r, n) {
|
|
1570
1570
|
this.from = e, this.to = r, this.diagnostic = n;
|
|
1571
1571
|
}
|
|
1572
1572
|
}
|
|
1573
|
-
class
|
|
1573
|
+
class U {
|
|
1574
1574
|
constructor(e, r, n) {
|
|
1575
1575
|
this.diagnostics = e, this.panel = r, this.selected = n;
|
|
1576
1576
|
}
|
|
1577
1577
|
static init(e, r, n) {
|
|
1578
|
-
let o = e, i = n.facet(
|
|
1578
|
+
let o = e, i = n.facet(In).markerFilter;
|
|
1579
1579
|
i && (o = i(o));
|
|
1580
1580
|
let s = x.set(o.map((l) => l.from == l.to || l.from == l.to - 1 && n.doc.lineAt(l.from).to == l.from ? x.widget({
|
|
1581
|
-
widget: new
|
|
1581
|
+
widget: new ki(l),
|
|
1582
1582
|
diagnostic: l
|
|
1583
1583
|
}).range(l.from) : x.mark({
|
|
1584
1584
|
attributes: { class: "cm-lintRange cm-lintRange-" + l.severity + (l.markClass ? " " + l.markClass : "") },
|
|
1585
1585
|
diagnostic: l
|
|
1586
1586
|
}).range(l.from, l.to)), !0);
|
|
1587
|
-
return new
|
|
1587
|
+
return new U(s, r, re(s));
|
|
1588
1588
|
}
|
|
1589
1589
|
}
|
|
1590
|
-
function
|
|
1590
|
+
function re(t, e = null, r = 0) {
|
|
1591
1591
|
let n = null;
|
|
1592
1592
|
return t.between(r, 1e9, (o, i, { spec: s }) => {
|
|
1593
1593
|
if (!(e && s.diagnostic != e))
|
|
1594
|
-
return n = new
|
|
1594
|
+
return n = new ui(o, i, s.diagnostic), !1;
|
|
1595
1595
|
}), n;
|
|
1596
1596
|
}
|
|
1597
|
-
function
|
|
1597
|
+
function hi(t, e) {
|
|
1598
1598
|
let r = t.startState.doc.lineAt(e.pos);
|
|
1599
|
-
return !!(t.effects.some((n) => n.is(
|
|
1599
|
+
return !!(t.effects.some((n) => n.is(Tn)) || t.changes.touchesRange(r.from, r.to));
|
|
1600
1600
|
}
|
|
1601
|
-
function
|
|
1602
|
-
return t.field(
|
|
1601
|
+
function fi(t, e) {
|
|
1602
|
+
return t.field(L, !1) ? e : e.concat(w.appendConfig.of(Ci));
|
|
1603
1603
|
}
|
|
1604
|
-
const
|
|
1604
|
+
const Tn = /* @__PURE__ */ w.define(), ut = /* @__PURE__ */ w.define(), On = /* @__PURE__ */ w.define(), L = /* @__PURE__ */ we.define({
|
|
1605
1605
|
create() {
|
|
1606
|
-
return new
|
|
1606
|
+
return new U(x.none, null, null);
|
|
1607
1607
|
},
|
|
1608
1608
|
update(t, e) {
|
|
1609
1609
|
if (e.docChanged) {
|
|
1610
1610
|
let r = t.diagnostics.map(e.changes), n = null;
|
|
1611
1611
|
if (t.selected) {
|
|
1612
1612
|
let o = e.changes.mapPos(t.selected.from, 1);
|
|
1613
|
-
n =
|
|
1613
|
+
n = re(r, t.selected.diagnostic, o) || re(r, null, o);
|
|
1614
1614
|
}
|
|
1615
|
-
t = new
|
|
1615
|
+
t = new U(r, t.panel, n);
|
|
1616
1616
|
}
|
|
1617
1617
|
for (let r of e.effects)
|
|
1618
|
-
r.is(
|
|
1618
|
+
r.is(Tn) ? t = U.init(r.value, t.panel, e.state) : r.is(ut) ? t = new U(t.diagnostics, r.value ? Fe.open : null, t.selected) : r.is(On) && (t = new U(t.diagnostics, t.panel, r.value));
|
|
1619
1619
|
return t;
|
|
1620
1620
|
},
|
|
1621
1621
|
provide: (t) => [
|
|
1622
|
-
|
|
1622
|
+
nt.from(t, (e) => e.panel),
|
|
1623
1623
|
p.decorations.from(t, (e) => e.diagnostics)
|
|
1624
1624
|
]
|
|
1625
|
-
}),
|
|
1626
|
-
function
|
|
1627
|
-
let { diagnostics: n } = t.state.field(
|
|
1625
|
+
}), di = /* @__PURE__ */ x.mark({ class: "cm-lintRange cm-lintRange-active" });
|
|
1626
|
+
function mi(t, e, r) {
|
|
1627
|
+
let { diagnostics: n } = t.state.field(L), o = [], i = 2e8, s = 0;
|
|
1628
1628
|
n.between(e - (r < 0 ? 1 : 0), e + (r > 0 ? 1 : 0), (a, c, { spec: u }) => {
|
|
1629
1629
|
e >= a && e <= c && (a == c || (e > a || r > 0) && (e < c || r < 0)) && (o.push(u.diagnostic), i = Math.min(a, i), s = Math.max(c, s));
|
|
1630
1630
|
});
|
|
1631
|
-
let l = t.state.facet(
|
|
1631
|
+
let l = t.state.facet(In).tooltipFilter;
|
|
1632
1632
|
return l && (o = l(o)), o.length ? {
|
|
1633
1633
|
pos: i,
|
|
1634
1634
|
end: s,
|
|
1635
1635
|
above: t.state.doc.lineAt(i).to < s,
|
|
1636
1636
|
create() {
|
|
1637
|
-
return { dom:
|
|
1637
|
+
return { dom: gi(t, o) };
|
|
1638
1638
|
}
|
|
1639
1639
|
} : null;
|
|
1640
1640
|
}
|
|
1641
|
-
function
|
|
1642
|
-
return g("ul", { class: "cm-tooltip-lint" }, e.map((r) =>
|
|
1641
|
+
function gi(t, e) {
|
|
1642
|
+
return g("ul", { class: "cm-tooltip-lint" }, e.map((r) => Wn(t, r, !1)));
|
|
1643
1643
|
}
|
|
1644
|
-
const
|
|
1645
|
-
let e = t.state.field(
|
|
1646
|
-
(!e || !e.panel) && t.dispatch({ effects:
|
|
1647
|
-
let r = ue(t,
|
|
1644
|
+
const pi = (t) => {
|
|
1645
|
+
let e = t.state.field(L, !1);
|
|
1646
|
+
(!e || !e.panel) && t.dispatch({ effects: fi(t.state, [ut.of(!0)]) });
|
|
1647
|
+
let r = ue(t, Fe.open);
|
|
1648
1648
|
return r && r.dom.querySelector(".cm-panel-lint ul").focus(), !0;
|
|
1649
|
-
},
|
|
1650
|
-
let e = t.state.field(
|
|
1651
|
-
return !e || !e.panel ? !1 : (t.dispatch({ effects:
|
|
1652
|
-
},
|
|
1653
|
-
let e = t.state.field(
|
|
1649
|
+
}, Ct = (t) => {
|
|
1650
|
+
let e = t.state.field(L, !1);
|
|
1651
|
+
return !e || !e.panel ? !1 : (t.dispatch({ effects: ut.of(!1) }), !0);
|
|
1652
|
+
}, yi = (t) => {
|
|
1653
|
+
let e = t.state.field(L, !1);
|
|
1654
1654
|
if (!e)
|
|
1655
1655
|
return !1;
|
|
1656
1656
|
let r = t.state.selection.main, n = e.diagnostics.iter(r.to + 1);
|
|
1657
1657
|
return !n.value && (n = e.diagnostics.iter(0), !n.value || n.from == r.from && n.to == r.to) ? !1 : (t.dispatch({ selection: { anchor: n.from, head: n.to }, scrollIntoView: !0 }), !0);
|
|
1658
|
-
},
|
|
1659
|
-
{ key: "Mod-Shift-m", run:
|
|
1660
|
-
{ key: "F8", run:
|
|
1661
|
-
],
|
|
1658
|
+
}, xi = [
|
|
1659
|
+
{ key: "Mod-Shift-m", run: pi, preventDefault: !0 },
|
|
1660
|
+
{ key: "F8", run: yi }
|
|
1661
|
+
], In = /* @__PURE__ */ de.define({
|
|
1662
1662
|
combine(t) {
|
|
1663
|
-
return Object.assign({ sources: t.map((e) => e.source) },
|
|
1663
|
+
return Object.assign({ sources: t.map((e) => e.source) }, Re(t.map((e) => e.config), {
|
|
1664
1664
|
delay: 750,
|
|
1665
1665
|
markerFilter: null,
|
|
1666
1666
|
tooltipFilter: null,
|
|
@@ -1670,7 +1670,7 @@ const mi = (t) => {
|
|
|
1670
1670
|
}));
|
|
1671
1671
|
}
|
|
1672
1672
|
});
|
|
1673
|
-
function
|
|
1673
|
+
function Pn(t) {
|
|
1674
1674
|
let e = [];
|
|
1675
1675
|
if (t)
|
|
1676
1676
|
e:
|
|
@@ -1686,15 +1686,15 @@ function In(t) {
|
|
|
1686
1686
|
}
|
|
1687
1687
|
return e;
|
|
1688
1688
|
}
|
|
1689
|
-
function
|
|
1689
|
+
function Wn(t, e, r) {
|
|
1690
1690
|
var n;
|
|
1691
|
-
let o = r ?
|
|
1691
|
+
let o = r ? Pn(e.actions) : [];
|
|
1692
1692
|
return g("li", { class: "cm-diagnostic cm-diagnostic-" + e.severity }, g("span", { class: "cm-diagnosticText" }, e.renderMessage ? e.renderMessage() : e.message), (n = e.actions) === null || n === void 0 ? void 0 : n.map((i, s) => {
|
|
1693
1693
|
let l = !1, a = (m) => {
|
|
1694
1694
|
if (m.preventDefault(), l)
|
|
1695
1695
|
return;
|
|
1696
1696
|
l = !0;
|
|
1697
|
-
let k =
|
|
1697
|
+
let k = re(t.state.field(L).diagnostics, e);
|
|
1698
1698
|
k && i.apply(t, k.from, k.to);
|
|
1699
1699
|
}, { name: c } = i, u = o[s] ? c.indexOf(o[s]) : -1, h = u < 0 ? c : [
|
|
1700
1700
|
c.slice(0, u),
|
|
@@ -1710,7 +1710,7 @@ function Pn(t, e, r) {
|
|
|
1710
1710
|
}, h);
|
|
1711
1711
|
}), e.source && g("div", { class: "cm-diagnosticSource" }, e.source));
|
|
1712
1712
|
}
|
|
1713
|
-
class
|
|
1713
|
+
class ki extends sr {
|
|
1714
1714
|
constructor(e) {
|
|
1715
1715
|
super(), this.diagnostic = e;
|
|
1716
1716
|
}
|
|
@@ -1721,17 +1721,17 @@ class yi extends or {
|
|
|
1721
1721
|
return g("span", { class: "cm-lintPoint cm-lintPoint-" + this.diagnostic.severity });
|
|
1722
1722
|
}
|
|
1723
1723
|
}
|
|
1724
|
-
class
|
|
1724
|
+
class vt {
|
|
1725
1725
|
constructor(e, r) {
|
|
1726
|
-
this.diagnostic = r, this.id = "item_" + Math.floor(Math.random() * 4294967295).toString(16), this.dom =
|
|
1726
|
+
this.diagnostic = r, this.id = "item_" + Math.floor(Math.random() * 4294967295).toString(16), this.dom = Wn(e, r, !0), this.dom.id = this.id, this.dom.setAttribute("role", "option");
|
|
1727
1727
|
}
|
|
1728
1728
|
}
|
|
1729
|
-
class
|
|
1729
|
+
class Fe {
|
|
1730
1730
|
constructor(e) {
|
|
1731
1731
|
this.view = e, this.items = [];
|
|
1732
1732
|
let r = (o) => {
|
|
1733
1733
|
if (o.keyCode == 27)
|
|
1734
|
-
|
|
1734
|
+
Ct(this.view), this.view.focus();
|
|
1735
1735
|
else if (o.keyCode == 38 || o.keyCode == 33)
|
|
1736
1736
|
this.moveSelection((this.selectedIndex - 1 + this.items.length) % this.items.length);
|
|
1737
1737
|
else if (o.keyCode == 40 || o.keyCode == 34)
|
|
@@ -1743,10 +1743,10 @@ class We {
|
|
|
1743
1743
|
else if (o.keyCode == 13)
|
|
1744
1744
|
this.view.focus();
|
|
1745
1745
|
else if (o.keyCode >= 65 && o.keyCode <= 90 && this.selectedIndex >= 0) {
|
|
1746
|
-
let { diagnostic: i } = this.items[this.selectedIndex], s =
|
|
1746
|
+
let { diagnostic: i } = this.items[this.selectedIndex], s = Pn(i.actions);
|
|
1747
1747
|
for (let l = 0; l < s.length; l++)
|
|
1748
1748
|
if (s[l].toUpperCase().charCodeAt(0) == o.keyCode) {
|
|
1749
|
-
let a =
|
|
1749
|
+
let a = re(this.view.state.field(L).diagnostics, i);
|
|
1750
1750
|
a && i.actions[l].apply(e, a.from, a.to);
|
|
1751
1751
|
}
|
|
1752
1752
|
} else
|
|
@@ -1766,11 +1766,11 @@ class We {
|
|
|
1766
1766
|
type: "button",
|
|
1767
1767
|
name: "close",
|
|
1768
1768
|
"aria-label": this.view.state.phrase("close"),
|
|
1769
|
-
onclick: () =>
|
|
1769
|
+
onclick: () => Ct(this.view)
|
|
1770
1770
|
}, "×")), this.update();
|
|
1771
1771
|
}
|
|
1772
1772
|
get selectedIndex() {
|
|
1773
|
-
let e = this.view.state.field(
|
|
1773
|
+
let e = this.view.state.field(L).selected;
|
|
1774
1774
|
if (!e)
|
|
1775
1775
|
return -1;
|
|
1776
1776
|
for (let r = 0; r < this.items.length; r++)
|
|
@@ -1779,7 +1779,7 @@ class We {
|
|
|
1779
1779
|
return -1;
|
|
1780
1780
|
}
|
|
1781
1781
|
update() {
|
|
1782
|
-
let { diagnostics: e, selected: r } = this.view.state.field(
|
|
1782
|
+
let { diagnostics: e, selected: r } = this.view.state.field(L), n = 0, o = !1, i = null;
|
|
1783
1783
|
for (e.between(0, this.view.state.doc.length, (s, l, { spec: a }) => {
|
|
1784
1784
|
let c = -1, u;
|
|
1785
1785
|
for (let h = n; h < this.items.length; h++)
|
|
@@ -1787,10 +1787,10 @@ class We {
|
|
|
1787
1787
|
c = h;
|
|
1788
1788
|
break;
|
|
1789
1789
|
}
|
|
1790
|
-
c < 0 ? (u = new
|
|
1790
|
+
c < 0 ? (u = new vt(this.view, a.diagnostic), this.items.splice(n, 0, u), o = !0) : (u = this.items[c], c > n && (this.items.splice(n, c - n), o = !0)), r && u.diagnostic == r.diagnostic ? u.dom.hasAttribute("aria-selected") || (u.dom.setAttribute("aria-selected", "true"), i = u) : u.dom.hasAttribute("aria-selected") && u.dom.removeAttribute("aria-selected"), n++;
|
|
1791
1791
|
}); n < this.items.length && !(this.items.length == 1 && this.items[0].diagnostic.from < 0); )
|
|
1792
1792
|
o = !0, this.items.pop();
|
|
1793
|
-
this.items.length == 0 && (this.items.push(new
|
|
1793
|
+
this.items.length == 0 && (this.items.push(new vt(this.view, {
|
|
1794
1794
|
from: -1,
|
|
1795
1795
|
to: -1,
|
|
1796
1796
|
severity: "info",
|
|
@@ -1822,24 +1822,24 @@ class We {
|
|
|
1822
1822
|
moveSelection(e) {
|
|
1823
1823
|
if (this.selectedIndex < 0)
|
|
1824
1824
|
return;
|
|
1825
|
-
let r = this.view.state.field(
|
|
1825
|
+
let r = this.view.state.field(L), n = re(r.diagnostics, this.items[e].diagnostic);
|
|
1826
1826
|
n && this.view.dispatch({
|
|
1827
1827
|
selection: { anchor: n.from, head: n.to },
|
|
1828
1828
|
scrollIntoView: !0,
|
|
1829
|
-
effects:
|
|
1829
|
+
effects: On.of(n)
|
|
1830
1830
|
});
|
|
1831
1831
|
}
|
|
1832
1832
|
static open(e) {
|
|
1833
|
-
return new
|
|
1833
|
+
return new Fe(e);
|
|
1834
1834
|
}
|
|
1835
1835
|
}
|
|
1836
|
-
function
|
|
1836
|
+
function bi(t, e = 'viewBox="0 0 40 40"') {
|
|
1837
1837
|
return `url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" ${e}>${encodeURIComponent(t)}</svg>')`;
|
|
1838
1838
|
}
|
|
1839
|
-
function
|
|
1840
|
-
return
|
|
1839
|
+
function be(t) {
|
|
1840
|
+
return bi(`<path d="m0 2.5 l2 -1.5 l1 0 l2 1.5 l1 0" stroke="${t}" fill="none" stroke-width=".7"/>`, 'width="6" height="3"');
|
|
1841
1841
|
}
|
|
1842
|
-
const
|
|
1842
|
+
const Si = /* @__PURE__ */ p.baseTheme({
|
|
1843
1843
|
".cm-diagnostic": {
|
|
1844
1844
|
padding: "3px 6px 3px 8px",
|
|
1845
1845
|
marginLeft: "-1px",
|
|
@@ -1869,10 +1869,10 @@ const ki = /* @__PURE__ */ p.baseTheme({
|
|
|
1869
1869
|
backgroundRepeat: "repeat-x",
|
|
1870
1870
|
paddingBottom: "0.7px"
|
|
1871
1871
|
},
|
|
1872
|
-
".cm-lintRange-error": { backgroundImage: /* @__PURE__ */
|
|
1873
|
-
".cm-lintRange-warning": { backgroundImage: /* @__PURE__ */
|
|
1874
|
-
".cm-lintRange-info": { backgroundImage: /* @__PURE__ */
|
|
1875
|
-
".cm-lintRange-hint": { backgroundImage: /* @__PURE__ */
|
|
1872
|
+
".cm-lintRange-error": { backgroundImage: /* @__PURE__ */ be("#d11") },
|
|
1873
|
+
".cm-lintRange-warning": { backgroundImage: /* @__PURE__ */ be("orange") },
|
|
1874
|
+
".cm-lintRange-info": { backgroundImage: /* @__PURE__ */ be("#999") },
|
|
1875
|
+
".cm-lintRange-hint": { backgroundImage: /* @__PURE__ */ be("#66d") },
|
|
1876
1876
|
".cm-lintRange-active": { backgroundColor: "#ffdd9980" },
|
|
1877
1877
|
".cm-tooltip-lint": {
|
|
1878
1878
|
padding: 0,
|
|
@@ -1929,39 +1929,39 @@ const ki = /* @__PURE__ */ p.baseTheme({
|
|
|
1929
1929
|
margin: 0
|
|
1930
1930
|
}
|
|
1931
1931
|
}
|
|
1932
|
-
}),
|
|
1933
|
-
|
|
1934
|
-
/* @__PURE__ */ p.decorations.compute([
|
|
1935
|
-
let { selected: e, panel: r } = t.field(
|
|
1932
|
+
}), Ci = [
|
|
1933
|
+
L,
|
|
1934
|
+
/* @__PURE__ */ p.decorations.compute([L], (t) => {
|
|
1935
|
+
let { selected: e, panel: r } = t.field(L);
|
|
1936
1936
|
return !e || !r || e.from == e.to ? x.none : x.set([
|
|
1937
|
-
|
|
1937
|
+
di.range(e.from, e.to)
|
|
1938
1938
|
]);
|
|
1939
1939
|
}),
|
|
1940
|
-
/* @__PURE__ */
|
|
1941
|
-
|
|
1940
|
+
/* @__PURE__ */ ir(mi, { hideOn: hi }),
|
|
1941
|
+
Si
|
|
1942
1942
|
];
|
|
1943
|
-
var
|
|
1943
|
+
var At = function(e) {
|
|
1944
1944
|
e === void 0 && (e = {});
|
|
1945
1945
|
var {
|
|
1946
1946
|
crosshairCursor: r = !1
|
|
1947
1947
|
} = e, n = [];
|
|
1948
|
-
e.closeBracketsKeymap !== !1 && (n = n.concat(
|
|
1948
|
+
e.closeBracketsKeymap !== !1 && (n = n.concat(lr)), e.defaultKeymap !== !1 && (n = n.concat(Po)), e.searchKeymap !== !1 && (n = n.concat(si)), e.historyKeymap !== !1 && (n = n.concat($r)), e.foldKeymap !== !1 && (n = n.concat(ar)), e.completionKeymap !== !1 && (n = n.concat(cr)), e.lintKeymap !== !1 && (n = n.concat(xi));
|
|
1949
1949
|
var o = [];
|
|
1950
|
-
return e.lineNumbers !== !1 && o.push(
|
|
1950
|
+
return e.lineNumbers !== !1 && o.push(ur()), e.highlightActiveLineGutter !== !1 && o.push(hr()), e.highlightSpecialChars !== !1 && o.push(fr()), e.history !== !1 && o.push(Wr()), e.foldGutter !== !1 && o.push(dr()), e.drawSelection !== !1 && o.push(mr()), e.dropCursor !== !1 && o.push(gr()), e.allowMultipleSelections !== !1 && o.push(he.allowMultipleSelections.of(!0)), e.indentOnInput !== !1 && o.push(pr()), e.syntaxHighlighting !== !1 && o.push(qt(vr, {
|
|
1951
1951
|
fallback: !0
|
|
1952
|
-
})), e.bracketMatching !== !1 && o.push(
|
|
1952
|
+
})), e.bracketMatching !== !1 && o.push(yr()), e.closeBrackets !== !1 && o.push(xr()), e.autocompletion !== !1 && o.push(kr()), e.rectangularSelection !== !1 && o.push(br()), r !== !1 && o.push(Sr()), e.highlightActiveLine !== !1 && o.push(Cr()), e.highlightSelectionMatches !== !1 && o.push(Ho()), e.tabSize && typeof e.tabSize == "number" && o.push(Wt.of(" ".repeat(e.tabSize))), o.concat([_t.of(n.flat())]).filter(Boolean);
|
|
1953
1953
|
};
|
|
1954
|
-
const
|
|
1954
|
+
const vi = "#e5c07b", Mt = "#e06c75", Ai = "#56b6c2", Mi = "#ffffff", Se = "#abb2bf", Xe = "#7d8799", Li = "#61afef", Bi = "#98c379", Lt = "#d19a66", Di = "#c678dd", Ei = "#21252b", Bt = "#2c313a", Dt = "#282c34", Ue = "#353a42", Ri = "#3E4451", Et = "#528bff", wi = /* @__PURE__ */ p.theme({
|
|
1955
1955
|
"&": {
|
|
1956
|
-
color:
|
|
1957
|
-
backgroundColor:
|
|
1956
|
+
color: Se,
|
|
1957
|
+
backgroundColor: Dt
|
|
1958
1958
|
},
|
|
1959
1959
|
".cm-content": {
|
|
1960
|
-
caretColor:
|
|
1960
|
+
caretColor: Et
|
|
1961
1961
|
},
|
|
1962
|
-
".cm-cursor, .cm-dropCursor": { borderLeftColor:
|
|
1963
|
-
"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection": { backgroundColor:
|
|
1964
|
-
".cm-panels": { backgroundColor:
|
|
1962
|
+
".cm-cursor, .cm-dropCursor": { borderLeftColor: Et },
|
|
1963
|
+
"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection": { backgroundColor: Ri },
|
|
1964
|
+
".cm-panels": { backgroundColor: Ei, color: Se },
|
|
1965
1965
|
".cm-panels.cm-panels-top": { borderBottom: "2px solid black" },
|
|
1966
1966
|
".cm-panels.cm-panels-bottom": { borderTop: "2px solid black" },
|
|
1967
1967
|
".cm-searchMatch": {
|
|
@@ -1977,12 +1977,12 @@ const Si = "#e5c07b", At = "#e06c75", Ci = "#56b6c2", vi = "#ffffff", be = "#abb
|
|
|
1977
1977
|
backgroundColor: "#bad0f847"
|
|
1978
1978
|
},
|
|
1979
1979
|
".cm-gutters": {
|
|
1980
|
-
backgroundColor:
|
|
1981
|
-
color:
|
|
1980
|
+
backgroundColor: Dt,
|
|
1981
|
+
color: Xe,
|
|
1982
1982
|
border: "none"
|
|
1983
1983
|
},
|
|
1984
1984
|
".cm-activeLineGutter": {
|
|
1985
|
-
backgroundColor:
|
|
1985
|
+
backgroundColor: Bt
|
|
1986
1986
|
},
|
|
1987
1987
|
".cm-foldPlaceholder": {
|
|
1988
1988
|
backgroundColor: "transparent",
|
|
@@ -1991,54 +1991,54 @@ const Si = "#e5c07b", At = "#e06c75", Ci = "#56b6c2", vi = "#ffffff", be = "#abb
|
|
|
1991
1991
|
},
|
|
1992
1992
|
".cm-tooltip": {
|
|
1993
1993
|
border: "none",
|
|
1994
|
-
backgroundColor:
|
|
1994
|
+
backgroundColor: Ue
|
|
1995
1995
|
},
|
|
1996
1996
|
".cm-tooltip .cm-tooltip-arrow:before": {
|
|
1997
1997
|
borderTopColor: "transparent",
|
|
1998
1998
|
borderBottomColor: "transparent"
|
|
1999
1999
|
},
|
|
2000
2000
|
".cm-tooltip .cm-tooltip-arrow:after": {
|
|
2001
|
-
borderTopColor:
|
|
2002
|
-
borderBottomColor:
|
|
2001
|
+
borderTopColor: Ue,
|
|
2002
|
+
borderBottomColor: Ue
|
|
2003
2003
|
},
|
|
2004
2004
|
".cm-tooltip-autocomplete": {
|
|
2005
2005
|
"& > ul > li[aria-selected]": {
|
|
2006
|
-
backgroundColor:
|
|
2007
|
-
color:
|
|
2006
|
+
backgroundColor: Bt,
|
|
2007
|
+
color: Se
|
|
2008
2008
|
}
|
|
2009
2009
|
}
|
|
2010
|
-
}, { dark: !0 }),
|
|
2010
|
+
}, { dark: !0 }), Ti = /* @__PURE__ */ Ar.define([
|
|
2011
2011
|
{
|
|
2012
2012
|
tag: f.keyword,
|
|
2013
|
-
color:
|
|
2013
|
+
color: Di
|
|
2014
2014
|
},
|
|
2015
2015
|
{
|
|
2016
2016
|
tag: [f.name, f.deleted, f.character, f.propertyName, f.macroName],
|
|
2017
|
-
color:
|
|
2017
|
+
color: Mt
|
|
2018
2018
|
},
|
|
2019
2019
|
{
|
|
2020
2020
|
tag: [/* @__PURE__ */ f.function(f.variableName), f.labelName],
|
|
2021
|
-
color:
|
|
2021
|
+
color: Li
|
|
2022
2022
|
},
|
|
2023
2023
|
{
|
|
2024
2024
|
tag: [f.color, /* @__PURE__ */ f.constant(f.name), /* @__PURE__ */ f.standard(f.name)],
|
|
2025
|
-
color:
|
|
2025
|
+
color: Lt
|
|
2026
2026
|
},
|
|
2027
2027
|
{
|
|
2028
2028
|
tag: [/* @__PURE__ */ f.definition(f.name), f.separator],
|
|
2029
|
-
color:
|
|
2029
|
+
color: Se
|
|
2030
2030
|
},
|
|
2031
2031
|
{
|
|
2032
2032
|
tag: [f.typeName, f.className, f.number, f.changed, f.annotation, f.modifier, f.self, f.namespace],
|
|
2033
|
-
color:
|
|
2033
|
+
color: vi
|
|
2034
2034
|
},
|
|
2035
2035
|
{
|
|
2036
2036
|
tag: [f.operator, f.operatorKeyword, f.url, f.escape, f.regexp, f.link, /* @__PURE__ */ f.special(f.string)],
|
|
2037
|
-
color:
|
|
2037
|
+
color: Ai
|
|
2038
2038
|
},
|
|
2039
2039
|
{
|
|
2040
2040
|
tag: [f.meta, f.comment],
|
|
2041
|
-
color:
|
|
2041
|
+
color: Xe
|
|
2042
2042
|
},
|
|
2043
2043
|
{
|
|
2044
2044
|
tag: f.strong,
|
|
@@ -2054,34 +2054,34 @@ const Si = "#e5c07b", At = "#e06c75", Ci = "#56b6c2", vi = "#ffffff", be = "#abb
|
|
|
2054
2054
|
},
|
|
2055
2055
|
{
|
|
2056
2056
|
tag: f.link,
|
|
2057
|
-
color:
|
|
2057
|
+
color: Xe,
|
|
2058
2058
|
textDecoration: "underline"
|
|
2059
2059
|
},
|
|
2060
2060
|
{
|
|
2061
2061
|
tag: f.heading,
|
|
2062
2062
|
fontWeight: "bold",
|
|
2063
|
-
color:
|
|
2063
|
+
color: Mt
|
|
2064
2064
|
},
|
|
2065
2065
|
{
|
|
2066
2066
|
tag: [f.atom, f.bool, /* @__PURE__ */ f.special(f.variableName)],
|
|
2067
|
-
color:
|
|
2067
|
+
color: Lt
|
|
2068
2068
|
},
|
|
2069
2069
|
{
|
|
2070
2070
|
tag: [f.processingInstruction, f.string, f.inserted],
|
|
2071
|
-
color:
|
|
2071
|
+
color: Bi
|
|
2072
2072
|
},
|
|
2073
2073
|
{
|
|
2074
2074
|
tag: f.invalid,
|
|
2075
|
-
color:
|
|
2075
|
+
color: Mi
|
|
2076
2076
|
}
|
|
2077
|
-
]),
|
|
2078
|
-
var
|
|
2077
|
+
]), Oi = [wi, /* @__PURE__ */ qt(Ti)];
|
|
2078
|
+
var Ii = p.theme({
|
|
2079
2079
|
"&": {
|
|
2080
2080
|
backgroundColor: "#fff"
|
|
2081
2081
|
}
|
|
2082
2082
|
}, {
|
|
2083
2083
|
dark: !1
|
|
2084
|
-
}),
|
|
2084
|
+
}), Pi = function(e) {
|
|
2085
2085
|
e === void 0 && (e = {});
|
|
2086
2086
|
var {
|
|
2087
2087
|
indentWithTab: r = !0,
|
|
@@ -2091,12 +2091,12 @@ var Ti = p.theme({
|
|
|
2091
2091
|
placeholder: s = "",
|
|
2092
2092
|
basicSetup: l = !0
|
|
2093
2093
|
} = e, a = [];
|
|
2094
|
-
switch (r && a.unshift(_t.of([
|
|
2094
|
+
switch (r && a.unshift(_t.of([Wo])), l && (typeof l == "boolean" ? a.unshift(At()) : a.unshift(At(l))), s && a.unshift(Mr(s)), i) {
|
|
2095
2095
|
case "light":
|
|
2096
|
-
a.push(
|
|
2096
|
+
a.push(Ii);
|
|
2097
2097
|
break;
|
|
2098
2098
|
case "dark":
|
|
2099
|
-
a.push(
|
|
2099
|
+
a.push(Oi);
|
|
2100
2100
|
break;
|
|
2101
2101
|
case "none":
|
|
2102
2102
|
break;
|
|
@@ -2105,7 +2105,7 @@ var Ti = p.theme({
|
|
|
2105
2105
|
break;
|
|
2106
2106
|
}
|
|
2107
2107
|
return n === !1 && a.push(p.editable.of(!1)), o && a.push(he.readOnly.of(!0)), [...a];
|
|
2108
|
-
},
|
|
2108
|
+
}, Wi = (t) => ({
|
|
2109
2109
|
line: t.state.doc.lineAt(t.state.selection.main.from),
|
|
2110
2110
|
lineCount: t.state.doc.lines,
|
|
2111
2111
|
lineBreak: t.state.lineBreak,
|
|
@@ -2118,8 +2118,8 @@ var Ti = p.theme({
|
|
|
2118
2118
|
selectionCode: t.state.sliceDoc(t.state.selection.main.from, t.state.selection.main.to),
|
|
2119
2119
|
selections: t.state.selection.ranges.map((e) => t.state.sliceDoc(e.from, e.to)),
|
|
2120
2120
|
selectedText: t.state.selection.ranges.some((e) => !e.empty)
|
|
2121
|
-
}),
|
|
2122
|
-
function
|
|
2121
|
+
}), Rt = et.define(), Fi = [];
|
|
2122
|
+
function Ni(t) {
|
|
2123
2123
|
var {
|
|
2124
2124
|
value: e,
|
|
2125
2125
|
selection: r,
|
|
@@ -2127,7 +2127,7 @@ function Wi(t) {
|
|
|
2127
2127
|
onStatistics: o,
|
|
2128
2128
|
onCreateEditor: i,
|
|
2129
2129
|
onUpdate: s,
|
|
2130
|
-
extensions: l =
|
|
2130
|
+
extensions: l = Fi,
|
|
2131
2131
|
autoFocus: a,
|
|
2132
2132
|
theme: c = "light",
|
|
2133
2133
|
height: u = null,
|
|
@@ -2135,91 +2135,93 @@ function Wi(t) {
|
|
|
2135
2135
|
maxHeight: m = null,
|
|
2136
2136
|
width: k = null,
|
|
2137
2137
|
minWidth: C = null,
|
|
2138
|
-
maxWidth:
|
|
2139
|
-
placeholder:
|
|
2140
|
-
editable:
|
|
2141
|
-
readOnly:
|
|
2142
|
-
indentWithTab:
|
|
2143
|
-
basicSetup:
|
|
2144
|
-
root:
|
|
2138
|
+
maxWidth: R = null,
|
|
2139
|
+
placeholder: $ = "",
|
|
2140
|
+
editable: G = !0,
|
|
2141
|
+
readOnly: H = !1,
|
|
2142
|
+
indentWithTab: K = !0,
|
|
2143
|
+
basicSetup: J = !0,
|
|
2144
|
+
root: se,
|
|
2145
2145
|
initialState: P
|
|
2146
|
-
} = t, [W,
|
|
2146
|
+
} = t, [W, j] = ce(), [y, b] = ce(), [F, Q] = ce(), Ne = p.theme({
|
|
2147
2147
|
"&": {
|
|
2148
2148
|
height: u,
|
|
2149
2149
|
minHeight: h,
|
|
2150
2150
|
maxHeight: m,
|
|
2151
2151
|
width: k,
|
|
2152
2152
|
minWidth: C,
|
|
2153
|
-
maxWidth:
|
|
2153
|
+
maxWidth: R
|
|
2154
2154
|
},
|
|
2155
2155
|
"& .cm-scroller": {
|
|
2156
2156
|
height: "100% !important"
|
|
2157
2157
|
}
|
|
2158
|
-
}),
|
|
2159
|
-
if (
|
|
2158
|
+
}), ge = p.updateListener.of((v) => {
|
|
2159
|
+
if (v.docChanged && typeof n == "function" && // Fix echoing of the remote changes:
|
|
2160
2160
|
// If transaction is market as remote we don't have to call `onChange` handler again
|
|
2161
|
-
!
|
|
2162
|
-
var le =
|
|
2163
|
-
n(
|
|
2161
|
+
!v.transactions.some((Nn) => Nn.annotation(Rt))) {
|
|
2162
|
+
var le = v.state.doc, pe = le.toString();
|
|
2163
|
+
n(pe, v);
|
|
2164
2164
|
}
|
|
2165
|
-
o && o(
|
|
2166
|
-
}),
|
|
2165
|
+
o && o(Wi(v));
|
|
2166
|
+
}), qe = Pi({
|
|
2167
2167
|
theme: c,
|
|
2168
|
-
editable:
|
|
2169
|
-
readOnly:
|
|
2170
|
-
placeholder:
|
|
2171
|
-
indentWithTab:
|
|
2172
|
-
basicSetup:
|
|
2173
|
-
}),
|
|
2174
|
-
return s && typeof s == "function" &&
|
|
2168
|
+
editable: G,
|
|
2169
|
+
readOnly: H,
|
|
2170
|
+
placeholder: $,
|
|
2171
|
+
indentWithTab: K,
|
|
2172
|
+
basicSetup: J
|
|
2173
|
+
}), V = [ge, Ne, ...qe];
|
|
2174
|
+
return s && typeof s == "function" && V.push(p.updateListener.of(s)), V = V.concat(l), qn(() => {
|
|
2175
2175
|
if (W && !F) {
|
|
2176
|
-
var
|
|
2176
|
+
var v = {
|
|
2177
2177
|
doc: e,
|
|
2178
2178
|
selection: r,
|
|
2179
|
-
extensions:
|
|
2180
|
-
}, le = P ? he.fromJSON(P.json,
|
|
2181
|
-
if (
|
|
2182
|
-
var
|
|
2179
|
+
extensions: V
|
|
2180
|
+
}, le = P ? he.fromJSON(P.json, v, P.fields) : he.create(v);
|
|
2181
|
+
if (Q(le), !y) {
|
|
2182
|
+
var pe = new p({
|
|
2183
2183
|
state: le,
|
|
2184
2184
|
parent: W,
|
|
2185
|
-
root:
|
|
2185
|
+
root: se
|
|
2186
2186
|
});
|
|
2187
|
-
b(
|
|
2187
|
+
b(pe), i && i(pe, le);
|
|
2188
2188
|
}
|
|
2189
2189
|
}
|
|
2190
2190
|
return () => {
|
|
2191
|
-
y && (
|
|
2191
|
+
y && (Q(void 0), b(void 0));
|
|
2192
2192
|
};
|
|
2193
|
-
}, [W, F]),
|
|
2193
|
+
}, [W, F]), z(() => {
|
|
2194
|
+
t.container && j(t.container);
|
|
2195
|
+
}, [t.container]), z(() => () => {
|
|
2194
2196
|
y && (y.destroy(), b(void 0));
|
|
2195
|
-
}, [y]),
|
|
2197
|
+
}, [y]), z(() => {
|
|
2196
2198
|
a && y && y.focus();
|
|
2197
|
-
}, [a, y]),
|
|
2199
|
+
}, [a, y]), z(() => {
|
|
2198
2200
|
y && y.dispatch({
|
|
2199
|
-
effects: w.reconfigure.of(
|
|
2201
|
+
effects: w.reconfigure.of(V)
|
|
2200
2202
|
});
|
|
2201
|
-
}, [c, l, u, h, m, k, C,
|
|
2203
|
+
}, [c, l, u, h, m, k, C, R, $, G, H, K, J, n, s]), z(() => {
|
|
2202
2204
|
if (e !== void 0) {
|
|
2203
|
-
var
|
|
2204
|
-
y && e !==
|
|
2205
|
+
var v = y ? y.state.doc.toString() : "";
|
|
2206
|
+
y && e !== v && y.dispatch({
|
|
2205
2207
|
changes: {
|
|
2206
2208
|
from: 0,
|
|
2207
|
-
to:
|
|
2209
|
+
to: v.length,
|
|
2208
2210
|
insert: e || ""
|
|
2209
2211
|
},
|
|
2210
|
-
annotations: [
|
|
2212
|
+
annotations: [Rt.of(!0)]
|
|
2211
2213
|
});
|
|
2212
2214
|
}
|
|
2213
2215
|
}, [e, y]), {
|
|
2214
2216
|
state: F,
|
|
2215
|
-
setState:
|
|
2217
|
+
setState: Q,
|
|
2216
2218
|
view: y,
|
|
2217
2219
|
setView: b,
|
|
2218
2220
|
container: W,
|
|
2219
|
-
setContainer:
|
|
2221
|
+
setContainer: j
|
|
2220
2222
|
};
|
|
2221
2223
|
}
|
|
2222
|
-
var
|
|
2224
|
+
var qi = ["className", "value", "selection", "extensions", "onChange", "onStatistics", "onCreateEditor", "onUpdate", "autoFocus", "theme", "height", "minHeight", "maxHeight", "width", "minWidth", "maxWidth", "basicSetup", "placeholder", "indentWithTab", "editable", "readOnly", "root", "initialState"], Fn = /* @__PURE__ */ wt((t, e) => {
|
|
2223
2225
|
var {
|
|
2224
2226
|
className: r,
|
|
2225
2227
|
value: n = "",
|
|
@@ -2234,22 +2236,22 @@ var Fi = ["className", "value", "selection", "extensions", "onChange", "onStatis
|
|
|
2234
2236
|
height: m,
|
|
2235
2237
|
minHeight: k,
|
|
2236
2238
|
maxHeight: C,
|
|
2237
|
-
width:
|
|
2238
|
-
minWidth:
|
|
2239
|
-
maxWidth:
|
|
2240
|
-
basicSetup:
|
|
2241
|
-
placeholder:
|
|
2242
|
-
indentWithTab:
|
|
2243
|
-
editable:
|
|
2239
|
+
width: R,
|
|
2240
|
+
minWidth: $,
|
|
2241
|
+
maxWidth: G,
|
|
2242
|
+
basicSetup: H,
|
|
2243
|
+
placeholder: K,
|
|
2244
|
+
indentWithTab: J,
|
|
2245
|
+
editable: se,
|
|
2244
2246
|
readOnly: P,
|
|
2245
2247
|
root: W,
|
|
2246
|
-
initialState:
|
|
2247
|
-
} = t, y = _n(t,
|
|
2248
|
+
initialState: j
|
|
2249
|
+
} = t, y = _n(t, qi), b = Tt(null), {
|
|
2248
2250
|
state: F,
|
|
2249
|
-
view:
|
|
2250
|
-
container:
|
|
2251
|
-
|
|
2252
|
-
|
|
2251
|
+
view: Q,
|
|
2252
|
+
container: Ne,
|
|
2253
|
+
setContainer: ge
|
|
2254
|
+
} = Ni({
|
|
2253
2255
|
root: W,
|
|
2254
2256
|
value: n,
|
|
2255
2257
|
autoFocus: u,
|
|
@@ -2257,13 +2259,13 @@ var Fi = ["className", "value", "selection", "extensions", "onChange", "onStatis
|
|
|
2257
2259
|
height: m,
|
|
2258
2260
|
minHeight: k,
|
|
2259
2261
|
maxHeight: C,
|
|
2260
|
-
width:
|
|
2261
|
-
minWidth:
|
|
2262
|
-
maxWidth:
|
|
2263
|
-
basicSetup:
|
|
2264
|
-
placeholder:
|
|
2265
|
-
indentWithTab:
|
|
2266
|
-
editable:
|
|
2262
|
+
width: R,
|
|
2263
|
+
minWidth: $,
|
|
2264
|
+
maxWidth: G,
|
|
2265
|
+
basicSetup: H,
|
|
2266
|
+
placeholder: K,
|
|
2267
|
+
indentWithTab: J,
|
|
2268
|
+
editable: se,
|
|
2267
2269
|
readOnly: P,
|
|
2268
2270
|
selection: o,
|
|
2269
2271
|
onChange: s,
|
|
@@ -2271,22 +2273,26 @@ var Fi = ["className", "value", "selection", "extensions", "onChange", "onStatis
|
|
|
2271
2273
|
onCreateEditor: a,
|
|
2272
2274
|
onUpdate: c,
|
|
2273
2275
|
extensions: i,
|
|
2274
|
-
initialState:
|
|
2276
|
+
initialState: j
|
|
2275
2277
|
});
|
|
2276
|
-
|
|
2278
|
+
Hn(e, () => ({
|
|
2277
2279
|
editor: b.current,
|
|
2278
2280
|
state: F,
|
|
2279
|
-
view:
|
|
2280
|
-
}), [b,
|
|
2281
|
+
view: Q
|
|
2282
|
+
}), [b, Ne, F, Q]);
|
|
2283
|
+
var qe = Vn((v) => {
|
|
2284
|
+
b.current = v, ge(v);
|
|
2285
|
+
}, [ge]);
|
|
2286
|
+
if (typeof n != "string")
|
|
2281
2287
|
throw new Error("value must be typeof string but got " + typeof n);
|
|
2282
|
-
var
|
|
2283
|
-
return /* @__PURE__ */ N.jsx("div",
|
|
2284
|
-
ref:
|
|
2285
|
-
className: "" +
|
|
2288
|
+
var V = typeof h == "string" ? "cm-theme-" + h : "cm-theme";
|
|
2289
|
+
return /* @__PURE__ */ N.jsx("div", zn({
|
|
2290
|
+
ref: qe,
|
|
2291
|
+
className: "" + V + (r ? " " + r : "")
|
|
2286
2292
|
}, y));
|
|
2287
2293
|
});
|
|
2288
|
-
|
|
2289
|
-
const
|
|
2294
|
+
Fn.displayName = "CodeMirror";
|
|
2295
|
+
const _i = [
|
|
2290
2296
|
"[&_.cm-editor]:bg-transparent",
|
|
2291
2297
|
"[&_.cm-editor]:border-transparent",
|
|
2292
2298
|
"[&_.cm-scroller]:font-mono",
|
|
@@ -2298,7 +2304,7 @@ const Ni = [
|
|
|
2298
2304
|
"[&_.cm-gutters]:border-grey-500 dark:[&_.cm-gutters]:border-grey-800",
|
|
2299
2305
|
"[&_.cm-cursor]:border-grey-900 dark:[&_.cm-cursor]:border-grey-75",
|
|
2300
2306
|
"dark:[&_.cm-tooltip-autocomplete.cm-tooltip_ul_li:not([aria-selected])]:bg-grey-975"
|
|
2301
|
-
].join(" "),
|
|
2307
|
+
].join(" "), zi = wt(function({
|
|
2302
2308
|
title: e,
|
|
2303
2309
|
value: r,
|
|
2304
2310
|
height: n = "200px",
|
|
@@ -2312,54 +2318,54 @@ const Ni = [
|
|
|
2312
2318
|
className: h,
|
|
2313
2319
|
...m
|
|
2314
2320
|
}, k) {
|
|
2315
|
-
const C =
|
|
2321
|
+
const C = Un(), R = Tt(null), [$, G] = ce(100), [H, K] = $n.useState(null), [J, se] = ce({
|
|
2316
2322
|
crosshairCursor: !1
|
|
2317
|
-
}), { setFocusState: P } =
|
|
2323
|
+
}), { setFocusState: P } = Gn(), W = (b) => {
|
|
2318
2324
|
c == null || c(b), P(!0);
|
|
2319
|
-
},
|
|
2325
|
+
}, j = (b) => {
|
|
2320
2326
|
u == null || u(b), P(!1);
|
|
2321
2327
|
};
|
|
2322
|
-
|
|
2323
|
-
Promise.all(l).then(
|
|
2324
|
-
}, [l]),
|
|
2328
|
+
z(() => {
|
|
2329
|
+
Promise.all(l).then(K), se((b) => ({ setup: b, searchKeymap: !1 }));
|
|
2330
|
+
}, [l]), z(() => {
|
|
2325
2331
|
const b = new ResizeObserver(([F]) => {
|
|
2326
|
-
|
|
2332
|
+
G(F.contentRect.width);
|
|
2327
2333
|
});
|
|
2328
|
-
return b.observe(
|
|
2334
|
+
return b.observe(R.current), () => b.disconnect();
|
|
2329
2335
|
}, []);
|
|
2330
|
-
const y =
|
|
2336
|
+
const y = Kn(
|
|
2331
2337
|
"peer order-2 w-full max-w-full overflow-hidden rounded-sm border",
|
|
2332
2338
|
s ? "bg-transparent" : "bg-grey-75",
|
|
2333
2339
|
o ? "border-red" : "border-grey-500 dark:border-grey-800",
|
|
2334
2340
|
e && "mt-2",
|
|
2335
2341
|
n === "full" && "h-full",
|
|
2336
|
-
|
|
2342
|
+
_i,
|
|
2337
2343
|
h
|
|
2338
2344
|
);
|
|
2339
2345
|
return /* @__PURE__ */ N.jsxs(N.Fragment, { children: [
|
|
2340
|
-
/* @__PURE__ */ N.jsx("div", { ref:
|
|
2341
|
-
|
|
2346
|
+
/* @__PURE__ */ N.jsx("div", { ref: R }),
|
|
2347
|
+
H && /* @__PURE__ */ N.jsxs("div", { className: n === "full" ? "h-full" : "", style: { width: $ }, children: [
|
|
2342
2348
|
/* @__PURE__ */ N.jsx(
|
|
2343
|
-
|
|
2349
|
+
Fn,
|
|
2344
2350
|
{
|
|
2345
2351
|
ref: k,
|
|
2346
|
-
basicSetup:
|
|
2352
|
+
basicSetup: J,
|
|
2347
2353
|
className: y,
|
|
2348
|
-
extensions:
|
|
2354
|
+
extensions: H,
|
|
2349
2355
|
height: n === "full" ? "100%" : n,
|
|
2350
2356
|
value: r,
|
|
2351
|
-
onBlur:
|
|
2357
|
+
onBlur: j,
|
|
2352
2358
|
onChange: a,
|
|
2353
2359
|
onFocus: W,
|
|
2354
2360
|
...m
|
|
2355
2361
|
}
|
|
2356
2362
|
),
|
|
2357
|
-
e && /* @__PURE__ */ N.jsx(
|
|
2358
|
-
i && /* @__PURE__ */ N.jsx(
|
|
2363
|
+
e && /* @__PURE__ */ N.jsx(Jn, { className: "order-1 !text-grey-700 peer-focus:!text-black", htmlFor: C, useLabelTag: !0, children: e }),
|
|
2364
|
+
i && /* @__PURE__ */ N.jsx(jn, { className: "order-3", color: o ? "red" : "", children: i })
|
|
2359
2365
|
] })
|
|
2360
2366
|
] });
|
|
2361
2367
|
});
|
|
2362
2368
|
export {
|
|
2363
|
-
|
|
2369
|
+
zi as default
|
|
2364
2370
|
};
|
|
2365
|
-
//# sourceMappingURL=CodeEditorView-
|
|
2371
|
+
//# sourceMappingURL=CodeEditorView-ad8698fe.mjs.map
|