UNPKG

reactjs-tiptap-editor

Version:

A modern WYSIWYG rich text editor based on tiptap and shadcn ui for React

1,245 lines (1,244 loc) 46.5 kB
import { jsx as x, Fragment as je, jsxs as G } from "react/jsx-runtime"; import { useState as Gt, useRef as me, useEffect as Ue } from "react"; import { h as Be, u as ze, d as We, A as Fe, I as be, q as Ke, L as Ut, j as ge, C as _e, B as pe } from "./index-RcSPeQHn.js"; import "./theme.js"; import { M as Ge, e as $e, m as $t, G as Qe, H as qe, I as Je, J as Ve, K as Ye } from "./clsx-DaPvp9ji.js"; import { Plugin as ee, PluginKey as ne } from "@tiptap/pm/state"; import { u as Xe } from "./index-C07N8gA1.js"; import { P as Ze, a as tn, b as en } from "./popover-CtinPbiy.js"; const nn = "aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2", on = "ελ1υ2бг1ел3дети4ею2католик6ом3мкд2он1сква6онлайн5рг3рус2ф2сайт3рб3укр3қаз3հայ3ישראל5קום3ابوظبي5رامكو5لاردن4بحرين5جزائر5سعودية6عليان5مغرب5مارات5یران5بارت2زار4يتك3ھارت5تونس4سودان3رية5شبكة4عراق2ب2مان4فلسطين6قطر3كاثوليك6وم3مصر2ليسيا5وريتانيا7قع4همراه5پاکستان7ڀارت4कॉम3नेट3भारत0म्3ोत5संगठन5বাংলা5ভারত2ৰত4ਭਾਰਤ4ભારત4ଭାରତ4இந்தியா6லங்கை6சிங்கப்பூர்11భారత్5ಭಾರತ4ഭാരതം5ලංකා4คอม3ไทย3ລາວ3გე2みんな3アマゾン4クラウド4グーグル4コム2ストア3セール3ファッション6ポイント4世界2中信1国1國1文网3亚马逊3企业2佛山2信息2健康2八卦2公司1益2台湾1灣2商城1店1标2嘉里0大酒店5在线2大拿2天主教3娱乐2家電2广东2微博2慈善2我爱你3手机2招聘2政务1府2新加坡2闻2时尚2書籍2机构2淡马锡3游戏2澳門2点看2移动2组织机构4网址1店1站1络2联通2谷歌2购物2通販2集团2電訊盈科4飞利浦3食品2餐厅2香格里拉3港2닷넷1컴2삼성2한국2", Qt = "numeric", qt = "ascii", Jt = "alpha", Q = "asciinumeric", $ = "alphanumeric", Vt = "domain", Re = "emoji", sn = "scheme", rn = "slashscheme", Bt = "whitespace"; function an(t, n) { return t in n || (n[t] = []), n[t]; } function U(t, n, e) { n[Qt] && (n[Q] = !0, n[$] = !0), n[qt] && (n[Q] = !0, n[Jt] = !0), n[Q] && (n[$] = !0), n[Jt] && (n[$] = !0), n[$] && (n[Vt] = !0), n[Re] && (n[Vt] = !0); for (const i in n) { const o = an(i, e); o.indexOf(t) < 0 && o.push(t); } } function ln(t, n) { const e = {}; for (const i in n) n[i].indexOf(t) >= 0 && (e[i] = !0); return e; } function R(t = null) { this.j = {}, this.jr = [], this.jd = null, this.t = t; } R.groups = {}; R.prototype = { accepts() { return !!this.t; }, /** * Follow an existing transition from the given input to the next state. * Does not mutate. * @param {string} input character or token type to transition on * @returns {?State<T>} the next state, if any */ go(t) { const n = this, e = n.j[t]; if (e) return e; for (let i = 0; i < n.jr.length; i++) { const o = n.jr[i][0], s = n.jr[i][1]; if (s && o.test(t)) return s; } return n.jd; }, /** * Whether the state has a transition for the given input. Set the second * argument to true to only look for an exact match (and not a default or * regular-expression-based transition) * @param {string} input * @param {boolean} exactOnly */ has(t, n = !1) { return n ? t in this.j : !!this.go(t); }, /** * Short for "transition all"; create a transition from the array of items * in the given list to the same final resulting state. * @param {string | string[]} inputs Group of inputs to transition on * @param {Transition<T> | State<T>} [next] Transition options * @param {Flags} [flags] Collections flags to add token to * @param {Collections<T>} [groups] Master list of token groups */ ta(t, n, e, i) { for (let o = 0; o < t.length; o++) this.tt(t[o], n, e, i); }, /** * Short for "take regexp transition"; defines a transition for this state * when it encounters a token which matches the given regular expression * @param {RegExp} regexp Regular expression transition (populate first) * @param {T | State<T>} [next] Transition options * @param {Flags} [flags] Collections flags to add token to * @param {Collections<T>} [groups] Master list of token groups * @returns {State<T>} taken after the given input */ tr(t, n, e, i) { i = i || R.groups; let o; return n && n.j ? o = n : (o = new R(n), e && i && U(n, e, i)), this.jr.push([t, o]), o; }, /** * Short for "take transitions", will take as many sequential transitions as * the length of the given input and returns the * resulting final state. * @param {string | string[]} input * @param {T | State<T>} [next] Transition options * @param {Flags} [flags] Collections flags to add token to * @param {Collections<T>} [groups] Master list of token groups * @returns {State<T>} taken after the given input */ ts(t, n, e, i) { let o = this; const s = t.length; if (!s) return o; for (let a = 0; a < s - 1; a++) o = o.tt(t[a]); return o.tt(t[s - 1], n, e, i); }, /** * Short for "take transition", this is a method for building/working with * state machines. * * If a state already exists for the given input, returns it. * * If a token is specified, that state will emit that token when reached by * the linkify engine. * * If no state exists, it will be initialized with some default transitions * that resemble existing default transitions. * * If a state is given for the second argument, that state will be * transitioned to on the given input regardless of what that input * previously did. * * Specify a token group flags to define groups that this token belongs to. * The token will be added to corresponding entires in the given groups * object. * * @param {string} input character, token type to transition on * @param {T | State<T>} [next] Transition options * @param {Flags} [flags] Collections flags to add token to * @param {Collections<T>} [groups] Master list of groups * @returns {State<T>} taken after the given input */ tt(t, n, e, i) { i = i || R.groups; const o = this; if (n && n.j) return o.j[t] = n, n; const s = n; let a, l = o.go(t); if (l ? (a = new R(), Object.assign(a.j, l.j), a.jr.push.apply(a.jr, l.jr), a.jd = l.jd, a.t = l.t) : a = new R(), s) { if (i) if (a.t && typeof a.t == "string") { const d = Object.assign(ln(a.t, i), e); U(s, d, i); } else e && U(s, e, i); a.t = s; } return o.j[t] = a, a; } }; const f = (t, n, e, i, o) => t.ta(n, e, i, o), L = (t, n, e, i, o) => t.tr(n, e, i, o), Ee = (t, n, e, i, o) => t.ts(n, e, i, o), r = (t, n, e, i, o) => t.tt(n, e, i, o), P = "WORD", Yt = "UWORD", ye = "ASCIINUMERICAL", Oe = "ALPHANUMERICAL", Z = "LOCALHOST", Xt = "TLD", Zt = "UTLD", rt = "SCHEME", z = "SLASH_SCHEME", ie = "NUM", te = "WS", oe = "NL", q = "OPENBRACE", J = "CLOSEBRACE", at = "OPENBRACKET", lt = "CLOSEBRACKET", ct = "OPENPAREN", ut = "CLOSEPAREN", dt = "OPENANGLEBRACKET", ht = "CLOSEANGLEBRACKET", ft = "FULLWIDTHLEFTPAREN", mt = "FULLWIDTHRIGHTPAREN", gt = "LEFTCORNERBRACKET", pt = "RIGHTCORNERBRACKET", Et = "LEFTWHITECORNERBRACKET", kt = "RIGHTWHITECORNERBRACKET", At = "FULLWIDTHLESSTHAN", Lt = "FULLWIDTHGREATERTHAN", Tt = "AMPERSAND", Ct = "APOSTROPHE", xt = "ASTERISK", M = "AT", bt = "BACKSLASH", Rt = "BACKTICK", yt = "CARET", D = "COLON", se = "COMMA", Ot = "DOLLAR", S = "DOT", St = "EQUALS", re = "EXCLAMATION", O = "HYPHEN", V = "PERCENT", Nt = "PIPE", vt = "PLUS", It = "POUND", Y = "QUERY", ae = "QUOTE", Se = "FULLWIDTHMIDDLEDOT", le = "SEMI", N = "SLASH", X = "TILDE", wt = "UNDERSCORE", Ne = "EMOJI", Pt = "SYM"; var ve = /* @__PURE__ */ Object.freeze({ __proto__: null, ALPHANUMERICAL: Oe, AMPERSAND: Tt, APOSTROPHE: Ct, ASCIINUMERICAL: ye, ASTERISK: xt, AT: M, BACKSLASH: bt, BACKTICK: Rt, CARET: yt, CLOSEANGLEBRACKET: ht, CLOSEBRACE: J, CLOSEBRACKET: lt, CLOSEPAREN: ut, COLON: D, COMMA: se, DOLLAR: Ot, DOT: S, EMOJI: Ne, EQUALS: St, EXCLAMATION: re, FULLWIDTHGREATERTHAN: Lt, FULLWIDTHLEFTPAREN: ft, FULLWIDTHLESSTHAN: At, FULLWIDTHMIDDLEDOT: Se, FULLWIDTHRIGHTPAREN: mt, HYPHEN: O, LEFTCORNERBRACKET: gt, LEFTWHITECORNERBRACKET: Et, LOCALHOST: Z, NL: oe, NUM: ie, OPENANGLEBRACKET: dt, OPENBRACE: q, OPENBRACKET: at, OPENPAREN: ct, PERCENT: V, PIPE: Nt, PLUS: vt, POUND: It, QUERY: Y, QUOTE: ae, RIGHTCORNERBRACKET: pt, RIGHTWHITECORNERBRACKET: kt, SCHEME: rt, SEMI: le, SLASH: N, SLASH_SCHEME: z, SYM: Pt, TILDE: X, TLD: Xt, UNDERSCORE: wt, UTLD: Zt, UWORD: Yt, WORD: P, WS: te }); const I = /[a-z]/, _ = new RegExp("\\p{L}", "u"), zt = new RegExp("\\p{Emoji}", "u"), w = /\d/, Wt = /\s/, ke = "\r", Ft = ` `, cn = "️", un = "‍", Kt = ""; let it = null, ot = null; function dn(t = []) { const n = {}; R.groups = n; const e = new R(); it == null && (it = Ae(nn)), ot == null && (ot = Ae(on)), r(e, "'", Ct), r(e, "{", q), r(e, "}", J), r(e, "[", at), r(e, "]", lt), r(e, "(", ct), r(e, ")", ut), r(e, "<", dt), r(e, ">", ht), r(e, "(", ft), r(e, ")", mt), r(e, "「", gt), r(e, "」", pt), r(e, "『", Et), r(e, "』", kt), r(e, "<", At), r(e, ">", Lt), r(e, "&", Tt), r(e, "*", xt), r(e, "@", M), r(e, "`", Rt), r(e, "^", yt), r(e, ":", D), r(e, ",", se), r(e, "$", Ot), r(e, ".", S), r(e, "=", St), r(e, "!", re), r(e, "-", O), r(e, "%", V), r(e, "|", Nt), r(e, "+", vt), r(e, "#", It), r(e, "?", Y), r(e, '"', ae), r(e, "/", N), r(e, ";", le), r(e, "~", X), r(e, "_", wt), r(e, "\\", bt), r(e, "・", Se); const i = L(e, w, ie, { [Qt]: !0 }); L(i, w, i); const o = L(i, I, ye, { [Q]: !0 }), s = L(i, _, Oe, { [$]: !0 }), a = L(e, I, P, { [qt]: !0 }); L(a, w, o), L(a, I, a), L(o, w, o), L(o, I, o); const l = L(e, _, Yt, { [Jt]: !0 }); L(l, I), L(l, w, s), L(l, _, l), L(s, w, s), L(s, I), L(s, _, s); const d = r(e, Ft, oe, { [Bt]: !0 }), h = r(e, ke, te, { [Bt]: !0 }), c = L(e, Wt, te, { [Bt]: !0 }); r(e, Kt, c), r(h, Ft, d), r(h, Kt, c), L(h, Wt, c), r(c, ke), r(c, Ft), L(c, Wt, c), r(c, Kt, c); const u = L(e, zt, Ne, { [Re]: !0 }); r(u, "#"), L(u, zt, u), r(u, cn, u); const m = r(u, un); r(m, "#"), L(m, zt, u); const p = [[I, a], [w, o]], b = [[I, null], [_, l], [w, s]]; for (let E = 0; E < it.length; E++) H(e, it[E], Xt, P, p); for (let E = 0; E < ot.length; E++) H(e, ot[E], Zt, Yt, b); U(Xt, { tld: !0, ascii: !0 }, n), U(Zt, { utld: !0, alpha: !0 }, n), H(e, "file", rt, P, p), H(e, "mailto", rt, P, p), H(e, "http", z, P, p), H(e, "https", z, P, p), H(e, "ftp", z, P, p), H(e, "ftps", z, P, p), U(rt, { scheme: !0, ascii: !0 }, n), U(z, { slashscheme: !0, ascii: !0 }, n), t = t.sort((E, T) => E[0] > T[0] ? 1 : -1); for (let E = 0; E < t.length; E++) { const T = t[E][0], A = t[E][1] ? { [sn]: !0 } : { [rn]: !0 }; T.indexOf("-") >= 0 ? A[Vt] = !0 : I.test(T) ? w.test(T) ? A[Q] = !0 : A[qt] = !0 : A[Qt] = !0, Ee(e, T, T, A); } return Ee(e, "localhost", Z, { ascii: !0 }), e.jd = new R(Pt), { start: e, tokens: Object.assign({ groups: n }, ve) }; } function Ie(t, n) { const e = hn(n.replace(/[A-Z]/g, (l) => l.toLowerCase())), i = e.length, o = []; let s = 0, a = 0; for (; a < i; ) { let l = t, d = null, h = 0, c = null, u = -1, m = -1; for (; a < i && (d = l.go(e[a])); ) l = d, l.accepts() ? (u = 0, m = 0, c = l) : u >= 0 && (u += e[a].length, m++), h += e[a].length, s += e[a].length, a++; s -= u, a -= m, h -= u, o.push({ t: c.t, // token type/name v: n.slice(s - h, s), // string value s: s - h, // start index e: s // end index (excluding) }); } return o; } function hn(t) { const n = [], e = t.length; let i = 0; for (; i < e; ) { let o = t.charCodeAt(i), s, a = o < 55296 || o > 56319 || i + 1 === e || (s = t.charCodeAt(i + 1)) < 56320 || s > 57343 ? t[i] : t.slice(i, i + 2); n.push(a), i += a.length; } return n; } function H(t, n, e, i, o) { let s; const a = n.length; for (let l = 0; l < a - 1; l++) { const d = n[l]; t.j[d] ? s = t.j[d] : (s = new R(i), s.jr = o.slice(), t.j[d] = s), t = s; } return s = new R(e), s.jr = o.slice(), t.j[n[a - 1]] = s, s; } function Ae(t) { const n = [], e = []; let i = 0, o = "0123456789"; for (; i < t.length; ) { let s = 0; for (; o.indexOf(t[i + s]) >= 0; ) s++; if (s > 0) { n.push(e.join("")); for (let a = parseInt(t.substring(i, i + s), 10); a > 0; a--) e.pop(); i += s; } else e.push(t[i]), i++; } return n; } const tt = { defaultProtocol: "http", events: null, format: Le, formatHref: Le, nl2br: !1, tagName: "a", target: null, rel: null, validate: !0, truncate: 1 / 0, className: null, attributes: null, ignoreTags: [], render: null }; function ce(t, n = null) { let e = Object.assign({}, tt); t && (e = Object.assign(e, t instanceof ce ? t.o : t)); const i = e.ignoreTags, o = []; for (let s = 0; s < i.length; s++) o.push(i[s].toUpperCase()); this.o = e, n && (this.defaultRender = n), this.ignoreTags = o; } ce.prototype = { o: tt, /** * @type string[] */ ignoreTags: [], /** * @param {IntermediateRepresentation} ir * @returns {any} */ defaultRender(t) { return t; }, /** * Returns true or false based on whether a token should be displayed as a * link based on the user options. * @param {MultiToken} token * @returns {boolean} */ check(t) { return this.get("validate", t.toString(), t); }, // Private methods /** * Resolve an option's value based on the value of the option and the given * params. If operator and token are specified and the target option is * callable, automatically calls the function with the given argument. * @template {keyof Opts} K * @param {K} key Name of option to use * @param {string} [operator] will be passed to the target option if it's a * function. If not specified, RAW function value gets returned * @param {MultiToken} [token] The token from linkify.tokenize * @returns {Opts[K] | any} */ get(t, n, e) { const i = n != null; let o = this.o[t]; return o && (typeof o == "object" ? (o = e.t in o ? o[e.t] : tt[t], typeof o == "function" && i && (o = o(n, e))) : typeof o == "function" && i && (o = o(n, e.t, e)), o); }, /** * @template {keyof Opts} L * @param {L} key Name of options object to use * @param {string} [operator] * @param {MultiToken} [token] * @returns {Opts[L] | any} */ getObj(t, n, e) { let i = this.o[t]; return typeof i == "function" && n != null && (i = i(n, e.t, e)), i; }, /** * Convert the given token to a rendered element that may be added to the * calling-interface's DOM * @param {MultiToken} token Token to render to an HTML element * @returns {any} Render result; e.g., HTML string, DOM element, React * Component, etc. */ render(t) { const n = t.render(this); return (this.get("render", null, t) || this.defaultRender)(n, t.t, t); } }; function Le(t) { return t; } function we(t, n) { this.t = "token", this.v = t, this.tk = n; } we.prototype = { isLink: !1, /** * Return the string this token represents. * @return {string} */ toString() { return this.v; }, /** * What should the value for this token be in the `href` HTML attribute? * Returns the `.toString` value by default. * @param {string} [scheme] * @return {string} */ toHref(t) { return this.toString(); }, /** * @param {Options} options Formatting options * @returns {string} */ toFormattedString(t) { const n = this.toString(), e = t.get("truncate", n, this), i = t.get("format", n, this); return e && i.length > e ? i.substring(0, e) + "…" : i; }, /** * * @param {Options} options * @returns {string} */ toFormattedHref(t) { return t.get("formatHref", this.toHref(t.get("defaultProtocol")), this); }, /** * The start index of this token in the original input string * @returns {number} */ startIndex() { return this.tk[0].s; }, /** * The end index of this token in the original input string (up to this * index but not including it) * @returns {number} */ endIndex() { return this.tk[this.tk.length - 1].e; }, /** Returns an object of relevant values for this token, which includes keys * type - Kind of token ('url', 'email', etc.) * value - Original text * href - The value that should be added to the anchor tag's href attribute @method toObject @param {string} [protocol] `'http'` by default */ toObject(t = tt.defaultProtocol) { return { type: this.t, value: this.toString(), isLink: this.isLink, href: this.toHref(t), start: this.startIndex(), end: this.endIndex() }; }, /** * * @param {Options} options Formatting option */ toFormattedObject(t) { return { type: this.t, value: this.toFormattedString(t), isLink: this.isLink, href: this.toFormattedHref(t), start: this.startIndex(), end: this.endIndex() }; }, /** * Whether this token should be rendered as a link according to the given options * @param {Options} options * @returns {boolean} */ validate(t) { return t.get("validate", this.toString(), this); }, /** * Return an object that represents how this link should be rendered. * @param {Options} options Formattinng options */ render(t) { const n = this, e = this.toHref(t.get("defaultProtocol")), i = t.get("formatHref", e, this), o = t.get("tagName", e, n), s = this.toFormattedString(t), a = {}, l = t.get("className", e, n), d = t.get("target", e, n), h = t.get("rel", e, n), c = t.getObj("attributes", e, n), u = t.getObj("events", e, n); return a.href = i, l && (a.class = l), d && (a.target = d), h && (a.rel = h), c && Object.assign(a, c), { tagName: o, attributes: a, content: s, eventListeners: u }; } }; function Ht(t, n) { class e extends we { constructor(o, s) { super(o, s), this.t = t; } } for (const i in n) e.prototype[i] = n[i]; return e.t = t, e; } const Te = Ht("email", { isLink: !0, toHref() { return "mailto:" + this.toString(); } }), Ce = Ht("text"), fn = Ht("nl"), st = Ht("url", { isLink: !0, /** Lowercases relevant parts of the domain and adds the protocol if required. Note that this will not escape unsafe HTML characters in the URL. @param {string} [scheme] default scheme (e.g., 'https') @return {string} the full href */ toHref(t = tt.defaultProtocol) { return this.hasProtocol() ? this.v : `${t}://${this.v}`; }, /** * Check whether this URL token has a protocol * @return {boolean} */ hasProtocol() { const t = this.tk; return t.length >= 2 && t[0].t !== Z && t[1].t === D; } }), y = (t) => new R(t); function mn({ groups: t }) { const n = t.domain.concat([Tt, xt, M, bt, Rt, yt, Ot, St, O, ie, V, Nt, vt, It, N, Pt, X, wt]), e = [Ct, D, se, S, re, V, Y, ae, le, dt, ht, q, J, lt, at, ct, ut, ft, mt, gt, pt, Et, kt, At, Lt], i = [Tt, Ct, xt, bt, Rt, yt, Ot, St, O, q, J, V, Nt, vt, It, Y, N, Pt, X, wt], o = y(), s = r(o, X); f(s, i, s), f(s, t.domain, s); const a = y(), l = y(), d = y(); f(o, t.domain, a), f(o, t.scheme, l), f(o, t.slashscheme, d), f(a, i, s), f(a, t.domain, a); const h = r(a, M); r(s, M, h), r(l, M, h), r(d, M, h); const c = r(s, S); f(c, i, s), f(c, t.domain, s); const u = y(); f(h, t.domain, u), f(u, t.domain, u); const m = r(u, S); f(m, t.domain, u); const p = y(Te); f(m, t.tld, p), f(m, t.utld, p), r(h, Z, p); const b = r(u, O); r(b, O, b), f(b, t.domain, u), f(p, t.domain, u), r(p, S, m), r(p, O, b); const E = r(p, D); f(E, t.numeric, Te); const T = r(a, O), g = r(a, S); r(T, O, T), f(T, t.domain, a), f(g, i, s), f(g, t.domain, a); const A = y(st); f(g, t.tld, A), f(g, t.utld, A), f(A, t.domain, a), f(A, i, s), r(A, S, g), r(A, O, T), r(A, M, h); const et = r(A, D), W = y(st); f(et, t.numeric, W); const C = y(st), v = y(); f(C, n, C), f(C, e, v), f(v, n, C), f(v, e, v), r(A, N, C), r(W, N, C); const F = r(l, D), Me = r(d, D), De = r(Me, N), Mt = r(De, N); f(l, t.domain, a), r(l, S, g), r(l, O, T), f(d, t.domain, a), r(d, S, g), r(d, O, T), f(F, t.domain, C), r(F, N, C), r(F, Y, C), f(Mt, t.domain, C), f(Mt, n, C), r(Mt, N, C); const he = [ [q, J], // {} [at, lt], // [] [ct, ut], // () [dt, ht], // <> [ft, mt], // () [gt, pt], // 「」 [Et, kt], // 『』 [At, Lt] // <> ]; for (let Dt = 0; Dt < he.length; Dt++) { const [fe, jt] = he[Dt], nt = r(C, fe); r(v, fe, nt), r(nt, jt, C); const B = y(st); f(nt, n, B); const K = y(); f(nt, e), f(B, n, B), f(B, e, K), f(K, n, B), f(K, e, K), r(B, jt, C), r(K, jt, C); } return r(o, Z, A), r(o, oe, fn), { start: o, tokens: ve }; } function gn(t, n, e) { let i = e.length, o = 0, s = [], a = []; for (; o < i; ) { let l = t, d = null, h = null, c = 0, u = null, m = -1; for (; o < i && !(d = l.go(e[o].t)); ) a.push(e[o++]); for (; o < i && (h = d || l.go(e[o].t)); ) d = null, l = h, l.accepts() ? (m = 0, u = l) : m >= 0 && m++, o++, c++; if (m < 0) o -= c, o < i && (a.push(e[o]), o++); else { a.length > 0 && (s.push(_t(Ce, n, a)), a = []), o -= m, c -= m; const p = u.t, b = e.slice(o - c, o); s.push(_t(p, n, b)); } } return a.length > 0 && s.push(_t(Ce, n, a)), s; } function _t(t, n, e) { const i = e[0].s, o = e[e.length - 1].e, s = n.slice(i, o); return new t(s, e); } const pn = typeof console < "u" && console && console.warn || (() => { }), En = "until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.", k = { scanner: null, parser: null, tokenQueue: [], pluginQueue: [], customSchemes: [], initialized: !1 }; function kn() { return R.groups = {}, k.scanner = null, k.parser = null, k.tokenQueue = [], k.pluginQueue = [], k.customSchemes = [], k.initialized = !1, k; } function xe(t, n = !1) { if (k.initialized && pn(`linkifyjs: already initialized - will not register custom scheme "${t}" ${En}`), !/^[0-9a-z]+(-[0-9a-z]+)*$/.test(t)) throw new Error(`linkifyjs: incorrect scheme format. 1. Must only contain digits, lowercase ASCII letters or "-" 2. Cannot start or end with "-" 3. "-" cannot repeat`); k.customSchemes.push([t, n]); } function An() { k.scanner = dn(k.customSchemes); for (let t = 0; t < k.tokenQueue.length; t++) k.tokenQueue[t][1]({ scanner: k.scanner }); k.parser = mn(k.scanner.tokens); for (let t = 0; t < k.pluginQueue.length; t++) k.pluginQueue[t][1]({ scanner: k.scanner, parser: k.parser }); return k.initialized = !0, k; } function ue(t) { return k.initialized || An(), gn(k.parser.start, t, Ie(k.scanner.start, t)); } ue.scan = Ie; function Pe(t, n = null, e = null) { if (n && typeof n == "object") { if (e) throw Error(`linkifyjs: Invalid link type ${n}; must be a string`); e = n, n = null; } const i = new ce(e), o = ue(t), s = []; for (let a = 0; a < o.length; a++) { const l = o[a]; l.isLink && (!n || l.t === n) && i.check(l) && s.push(l.toFormattedObject(i)); } return s; } var de = "[\0-   ᠎ -\u2029  ]", Ln = new RegExp(de), Tn = new RegExp(`${de}$`), Cn = new RegExp(de, "g"); function xn(t) { return t.length === 1 ? t[0].isLink : t.length === 3 && t[1].isLink ? ["()", "[]"].includes(t[0].value + t[2].value) : !1; } function bn(t) { return new ee({ key: new ne("autolink"), appendTransaction: (n, e, i) => { const o = n.some((h) => h.docChanged) && !e.doc.eq(i.doc), s = n.some((h) => h.getMeta("preventAutolink")); if (!o || s) return; const { tr: a } = i, l = Qe(e.doc, [...n]); if (qe(l).forEach(({ newRange: h }) => { const c = Je(i.doc, h, (p) => p.isTextblock); let u, m; if (c.length > 1) u = c[0], m = i.doc.textBetween( u.pos, u.pos + u.node.nodeSize, void 0, " " ); else if (c.length) { const p = i.doc.textBetween(h.from, h.to, " ", " "); if (!Tn.test(p)) return; u = c[0], m = i.doc.textBetween(u.pos, h.to, void 0, " "); } if (u && m) { const p = m.split(Ln).filter(Boolean); if (p.length <= 0) return !1; const b = p[p.length - 1], E = u.pos + m.lastIndexOf(b); if (!b) return !1; const T = ue(b).map((g) => g.toObject(t.defaultProtocol)); if (!xn(T)) return !1; T.filter((g) => g.isLink).map((g) => ({ ...g, from: E + g.start + 1, to: E + g.end + 1 })).filter((g) => i.schema.marks.code ? !i.doc.rangeHasMark(g.from, g.to, i.schema.marks.code) : !0).filter((g) => t.validate(g.value)).filter((g) => t.shouldAutoLink(g.value)).forEach((g) => { Ve(g.from, g.to, i.doc).some((A) => A.mark.type === t.type) || a.addMark( g.from, g.to, t.type.create({ href: g.href }) ); }); } }), !!a.steps.length) return a; } }); } function Rn(t) { return new ee({ key: new ne("handleClickLink"), props: { handleClick: (n, e, i) => { var o, s; if (i.button !== 0 || !n.editable) return !1; let a = !1; if (t.enableClickSelection && (a = t.editor.commands.extendMarkRange(t.type.name)), t.openOnClick) { let l = null; if (i.target instanceof HTMLAnchorElement) l = i.target; else { let u = i.target; const m = []; for (; u.nodeName !== "DIV"; ) m.push(u), u = u.parentNode; l = m.find((p) => p.nodeName === "A"); } if (!l) return a; const d = Ye(n.state, t.type.name), h = (o = l == null ? void 0 : l.href) != null ? o : d.href, c = (s = l == null ? void 0 : l.target) != null ? s : d.target; l && h && (window.open(h, c), a = !0); } return a; } } }); } function yn(t) { return new ee({ key: new ne("handlePasteLink"), props: { handlePaste: (n, e, i) => { const { shouldAutoLink: o } = t, { state: s } = n, { selection: a } = s, { empty: l } = a; if (l) return !1; let d = ""; i.content.forEach((c) => { d += c.textContent; }); const h = Pe(d, { defaultProtocol: t.defaultProtocol }).find( (c) => c.isLink && c.value === d ); return !d || !h || o !== void 0 && !o(h.href) ? !1 : t.editor.commands.setMark(t.type, { href: h.href }); } } }); } function j(t, n) { const e = ["http", "https", "ftp", "ftps", "mailto", "tel", "callto", "sms", "cid", "xmpp"]; return n && n.forEach((i) => { const o = typeof i == "string" ? i : i.scheme; o && e.push(o); }), !t || t.replace(Cn, "").match( new RegExp( // eslint-disable-next-line no-useless-escape `^(?:(?:${e.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`, "i" ) ); } var On = Ge.create({ name: "link", priority: 1e3, keepOnSplit: !1, exitable: !0, onCreate() { this.options.validate && !this.options.shouldAutoLink && (this.options.shouldAutoLink = this.options.validate, console.warn("The `validate` option is deprecated. Rename to the `shouldAutoLink` option instead.")), this.options.protocols.forEach((t) => { if (typeof t == "string") { xe(t); return; } xe(t.scheme, t.optionalSlashes); }); }, onDestroy() { kn(); }, inclusive() { return this.options.autolink; }, addOptions() { return { openOnClick: !0, enableClickSelection: !1, linkOnPaste: !0, autolink: !0, protocols: [], defaultProtocol: "http", HTMLAttributes: { target: "_blank", rel: "noopener noreferrer nofollow", class: null }, isAllowedUri: (t, n) => !!j(t, n.protocols), validate: (t) => !!t, shouldAutoLink: (t) => !!t }; }, addAttributes() { return { href: { default: null, parseHTML(t) { return t.getAttribute("href"); } }, target: { default: this.options.HTMLAttributes.target }, rel: { default: this.options.HTMLAttributes.rel }, class: { default: this.options.HTMLAttributes.class } }; }, parseHTML() { return [ { tag: "a[href]", getAttrs: (t) => { const n = t.getAttribute("href"); return !n || !this.options.isAllowedUri(n, { defaultValidate: (e) => !!j(e, this.options.protocols), protocols: this.options.protocols, defaultProtocol: this.options.defaultProtocol }) ? !1 : null; } } ]; }, renderHTML({ HTMLAttributes: t }) { return this.options.isAllowedUri(t.href, { defaultValidate: (n) => !!j(n, this.options.protocols), protocols: this.options.protocols, defaultProtocol: this.options.defaultProtocol }) ? ["a", $t(this.options.HTMLAttributes, t), 0] : ["a", $t(this.options.HTMLAttributes, { ...t, href: "" }), 0]; }, markdownTokenName: "link", parseMarkdown: (t, n) => n.applyMark("link", n.parseInline(t.tokens || []), { href: t.href, title: t.title || null }), renderMarkdown: (t, n) => { var e; const i = ((e = t.attrs) == null ? void 0 : e.href) || ""; return `[${n.renderChildren(t)}](${i})`; }, addCommands() { return { setLink: (t) => ({ chain: n }) => { const { href: e } = t; return this.options.isAllowedUri(e, { defaultValidate: (i) => !!j(i, this.options.protocols), protocols: this.options.protocols, defaultProtocol: this.options.defaultProtocol }) ? n().setMark(this.name, t).setMeta("preventAutolink", !0).run() : !1; }, toggleLink: (t) => ({ chain: n }) => { const { href: e } = t || {}; return e && !this.options.isAllowedUri(e, { defaultValidate: (i) => !!j(i, this.options.protocols), protocols: this.options.protocols, defaultProtocol: this.options.defaultProtocol }) ? !1 : n().toggleMark(this.name, t, { extendEmptyMarkRange: !0 }).setMeta("preventAutolink", !0).run(); }, unsetLink: () => ({ chain: t }) => t().unsetMark(this.name, { extendEmptyMarkRange: !0 }).setMeta("preventAutolink", !0).run() }; }, addPasteRules() { return [ $e({ find: (t) => { const n = []; if (t) { const { protocols: e, defaultProtocol: i } = this.options, o = Pe(t).filter( (s) => s.isLink && this.options.isAllowedUri(s.value, { defaultValidate: (a) => !!j(a, e), protocols: e, defaultProtocol: i }) ); o.length && o.forEach((s) => { this.options.shouldAutoLink(s.value) && n.push({ text: s.value, data: { href: s.href }, index: s.start }); }); } return n; }, type: this.type, getAttributes: (t) => { var n; return { href: (n = t.data) == null ? void 0 : n.href }; } }) ]; }, addProseMirrorPlugins() { const t = [], { protocols: n, defaultProtocol: e } = this.options; return this.options.autolink && t.push( bn({ type: this.type, defaultProtocol: this.options.defaultProtocol, validate: (i) => this.options.isAllowedUri(i, { defaultValidate: (o) => !!j(o, n), protocols: n, defaultProtocol: e }), shouldAutoLink: this.options.shouldAutoLink }) ), t.push( Rn({ type: this.type, editor: this.editor, openOnClick: this.options.openOnClick === "whenNotEditable" ? !0 : this.options.openOnClick, enableClickSelection: this.options.enableClickSelection }) ), this.options.linkOnPaste && t.push( yn({ editor: this.editor, defaultProtocol: this.options.defaultProtocol, type: this.type, shouldAutoLink: this.options.shouldAutoLink }) ), t; } }); function jn() { const [t, n] = Gt(!1), e = Be(), i = ze(He.name), { isActive: o, icon: s, tooltip: a, target: l, action: d } = (i == null ? void 0 : i.componentProps) ?? {}, { dataState: h, editorDisabled: c, update: u } = We(o); function m(p, b, E) { c || d && (d({ link: p, text: b, openInNewTab: E }), n(!1), u()); } return i ? /* @__PURE__ */ G( Ze, { modal: !0, onOpenChange: n, open: t, children: [ /* @__PURE__ */ x( tn, { asChild: !0, "data-state": h ? "on" : "off", disabled: c, children: /* @__PURE__ */ x( Fe, { dataState: h, disabled: c, tooltip: a, children: /* @__PURE__ */ x(be, { name: s }) } ) } ), /* @__PURE__ */ x( en, { align: "start", className: "richtext-w-full", hideWhenDetached: !0, side: "bottom", children: /* @__PURE__ */ x( Sn, { editor: e, onSetLink: m, open: t, target: l } ) } ) ] } ) : /* @__PURE__ */ x(je, {}); } const He = /* @__PURE__ */ On.extend({ inclusive: !1, parseHTML() { return [ { tag: 'a[href]:not([data-type="button"]):not([href *= "javascript:" i])' } ]; }, renderHTML({ HTMLAttributes: t }) { return [ "a", $t(this.options.HTMLAttributes, t, { class: "link" }), 0 ]; }, //@ts-expect-error addOptions() { var e, i; const t = ((e = this.parent) == null ? void 0 : e.call(this)) || {}, n = (i = t.HTMLAttributes) == null ? void 0 : i.target; return { ...t, openOnClick: !1, button: ({ editor: o, t: s }) => ({ componentProps: { action: (a) => { const { link: l, text: d, openInNewTab: h } = a; if (!l) { o.chain().extendMarkRange("link").unsetLink().run(); return; } o.isActive("link") && o.chain().extendMarkRange("link").run(); const { from: c } = o.state.selection, u = d.length; o.chain().insertContent({ type: "text", text: d, marks: [ { type: "link", attrs: { href: /^https?:\/\//i.test(l) ? l : `http://${l}`, target: n ?? (h ? "_blank" : "") } } ] }).setLink({ href: l }).setTextSelection({ from: c, to: c + u }).focus().run(); }, isActive: () => o.isActive("link"), disabled: !o.can().setLink({ href: "" }), icon: "Link", tooltip: s("editor.link.tooltip"), target: n } }) }; } // addProseMirrorPlugins() { // return [ // new Plugin({ // key: new PluginKey(`richtextCustomPlugin${this.name}`), // props: { // handleClick: (view: EditorView, pos: number) => { // const { schema, doc, tr } = view.state; // const range = getMarkRange(doc.resolve(pos), schema.marks.link); // if (!range) { // return false; // } // // honor openOnClick setting // let mark: any = null; // doc.nodesBetween(range.from, range.to, (node) => { // mark = node.marks.find((m) => m.type === schema.marks.link); // return !mark; // }); // if (this.options.openOnClick && mark?.attrs.href && pos !== range.to) { // window.open(mark.attrs.href, mark.attrs.target || '_self'); // return true; // } // const $start = doc.resolve(range.from); // const $end = doc.resolve(range.to); // const transaction = tr.setSelection( // new TextSelection($start, $end) // ); // view.dispatch(transaction); // }, // }, // }), // ]; // }, }); function Sn(t) { const { t: n } = Xe(), [e, i] = Gt({ text: "", link: "" }), [o, s] = Gt(!1), a = me(null), l = me(null), d = Ke(He.name); Ue(() => { const c = () => { var et, W, C; const { from: u, to: m, empty: p } = t.editor.state.selection, b = d == null ? void 0 : d.options; let E = "", T = "", g = (et = b == null ? void 0 : b.HTMLAttributes) == null ? void 0 : et.target; const A = t.editor.state.doc.nodeAt(u); if (A) { const v = A.marks.find((F) => F.type.name === "link"); v ? (T = v.attrs.href || "", g = v.attrs.target, p ? E = A.text || "" : E = t.editor.state.doc.textBetween(u, m, " ")) : E = t.editor.state.doc.textBetween(u, m, " "); } A || (E = t.editor.state.doc.textBetween(u, m, " ")), i({ link: T, text: E }), s(t.target ? t.target === "_blank" : g === "_blank"), t.open && (E === "" ? (W = a.current) == null || W.focus() : (C = l.current) == null || C.focus()); }; return c(), t.editor.on("selectionUpdate", c), () => { t.editor.off("selectionUpdate", c); }; }, [t.editor, d, t.open]); function h(c) { c.preventDefault(), c.stopPropagation(), t == null || t.onSetLink(e.link, e.text, o), i({ text: "", link: "" }); } return /* @__PURE__ */ G("div", { className: "richtext-flex richtext-flex-col richtext-gap-2", children: [ /* @__PURE__ */ x(Ut, { className: "mb-[6px]", children: n("editor.link.dialog.text") }), /* @__PURE__ */ x("div", { className: "richtext-mb-[10px] richtext-flex richtext-w-full richtext-max-w-sm richtext-items-center richtext-gap-1.5", children: /* @__PURE__ */ x("div", { className: "richtext-relative richtext-w-full richtext-max-w-sm richtext-items-center", children: /* @__PURE__ */ x( ge, { className: "richtext-w-80", onChange: (c) => i({ ...e, text: c.target.value }), placeholder: "Text", ref: a, required: !0, type: "text", value: e.text } ) }) }), /* @__PURE__ */ x(Ut, { className: "mb-[6px]", children: n("editor.link.dialog.link") }), /* @__PURE__ */ x("div", { className: "richtext-flex richtext-w-full richtext-max-w-sm richtext-items-center richtext-gap-1.5", children: /* @__PURE__ */ G("div", { className: "richtext-relative richtext-w-full richtext-max-w-sm richtext-items-center", children: [ /* @__PURE__ */ x( ge, { className: "richtext-pl-10", onChange: (c) => i({ ...e, link: c.target.value }), ref: l, required: !0, type: "url", value: e.link } ), /* @__PURE__ */ x("span", { className: "richtext-absolute richtext-inset-y-0 richtext-start-0 richtext-flex richtext-items-center richtext-justify-center richtext-px-2", children: /* @__PURE__ */ x( be, { className: "richtext-size-5 richtext-text-muted-foreground", name: "Link" } ) }) ] }) }), !t.target && /* @__PURE__ */ G("div", { className: "richtext-flex richtext-items-center richtext-gap-1", children: [ /* @__PURE__ */ x( _e, { checked: o, onCheckedChange: (c) => { s(c); } } ), /* @__PURE__ */ x(Ut, { children: n("editor.link.dialog.openInNewTab") }) ] }), /* @__PURE__ */ G("div", { className: "richtext-mt-2 richtext-flex richtext-items-center richtext-justify-end richtext-gap-2", children: [ (t == null ? void 0 : t.onClose) && /* @__PURE__ */ x( pe, { onClick: t == null ? void 0 : t.onClose, type: "button", children: n("editor.link.dialog.button.cancel") } ), /* @__PURE__ */ x( pe, { onClick: h, type: "button", children: n("editor.link.dialog.button.apply") } ) ] }) ] }); } export { He as L, jn as R, Sn as a };