@solibo/solibo-ui 0.2.14 → 0.2.16
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/README.md +16 -1
- package/dist/assets/index.css +1 -1
- package/dist/assets/index10.css +1 -1
- package/dist/assets/index11.css +1 -1
- package/dist/assets/index12.css +1 -1
- package/dist/assets/index13.css +1 -1
- package/dist/assets/index14.css +1 -1
- package/dist/assets/index15.css +1 -1
- package/dist/assets/index16.css +1 -1
- package/dist/assets/index17.css +1 -1
- package/dist/assets/index18.css +1 -1
- package/dist/assets/index19.css +1 -1
- package/dist/assets/index2.css +1 -1
- package/dist/assets/index20.css +1 -0
- package/dist/assets/index21.css +1 -0
- package/dist/assets/index22.css +1 -0
- package/dist/assets/index23.css +1 -0
- package/dist/assets/index24.css +1 -0
- package/dist/assets/index3.css +1 -1
- package/dist/assets/index4.css +1 -1
- package/dist/assets/index5.css +1 -1
- package/dist/assets/index6.css +1 -1
- package/dist/assets/index7.css +1 -1
- package/dist/assets/index8.css +1 -1
- package/dist/assets/index9.css +0 -1
- package/dist/components/accordion/index.cjs +1 -1
- package/dist/components/accordion/index.cjs.map +1 -1
- package/dist/components/accordion/index.js +14 -28
- package/dist/components/accordion/index.js.map +1 -1
- package/dist/components/aside/index.cjs +1 -1
- package/dist/components/aside/index.cjs.map +1 -1
- package/dist/components/aside/index.js +18 -16
- package/dist/components/aside/index.js.map +1 -1
- package/dist/components/banner/index.cjs +1 -1
- package/dist/components/banner/index.cjs.map +1 -1
- package/dist/components/banner/index.js +14 -35
- package/dist/components/banner/index.js.map +1 -1
- package/dist/components/branding/index.cjs +1 -1
- package/dist/components/branding/index.js +1 -1
- package/dist/components/button/index.cjs +1 -1
- package/dist/components/button/index.cjs.map +1 -1
- package/dist/components/button/index.js +23 -36
- package/dist/components/button/index.js.map +1 -1
- package/dist/components/card/index.cjs +1 -1
- package/dist/components/card/index.cjs.map +1 -1
- package/dist/components/card/index.js +11 -23
- package/dist/components/card/index.js.map +1 -1
- package/dist/components/checkbox/index.cjs +2 -0
- package/dist/components/checkbox/index.cjs.map +1 -0
- package/dist/components/checkbox/index.js +29 -0
- package/dist/components/checkbox/index.js.map +1 -0
- package/dist/components/dialog/index.cjs +1 -1
- package/dist/components/dialog/index.cjs.map +1 -1
- package/dist/components/dialog/index.js +9 -54
- package/dist/components/dialog/index.js.map +1 -1
- package/dist/components/dropdown/index.cjs +1 -1
- package/dist/components/dropdown/index.cjs.map +1 -1
- package/dist/components/dropdown/index.js +20 -15
- package/dist/components/dropdown/index.js.map +1 -1
- package/dist/components/dropzone/index.cjs +2 -0
- package/dist/components/dropzone/index.cjs.map +1 -0
- package/dist/components/dropzone/index.js +63 -0
- package/dist/components/dropzone/index.js.map +1 -0
- package/dist/components/editor/index.cjs +2 -2
- package/dist/components/editor/index.js +2 -2
- package/dist/components/figure/index.cjs +1 -1
- package/dist/components/figure/index.js +3 -3
- package/dist/components/file/index.cjs +2 -0
- package/dist/components/file/index.cjs.map +1 -0
- package/dist/components/file/index.js +27 -0
- package/dist/components/file/index.js.map +1 -0
- package/dist/components/footer/index.cjs +2 -0
- package/dist/components/footer/index.cjs.map +1 -0
- package/dist/components/footer/index.js +15 -0
- package/dist/components/footer/index.js.map +1 -0
- package/dist/components/form/index.cjs +1 -1
- package/dist/components/form/index.cjs.map +1 -1
- package/dist/components/form/index.js +5 -5
- package/dist/components/form/index.js.map +1 -1
- package/dist/components/header/index.cjs +1 -1
- package/dist/components/header/index.cjs.map +1 -1
- package/dist/components/header/index.js +10 -9
- package/dist/components/header/index.js.map +1 -1
- package/dist/components/icon/index.cjs +1 -1
- package/dist/components/icon/index.cjs.map +1 -1
- package/dist/components/icon/index.js +39 -35
- package/dist/components/icon/index.js.map +1 -1
- package/dist/components/input/index.cjs +1 -1
- package/dist/components/input/index.cjs.map +1 -1
- package/dist/components/input/index.js +13 -13
- package/dist/components/input/index.js.map +1 -1
- package/dist/components/layout/index.cjs +2 -0
- package/dist/components/layout/index.cjs.map +1 -0
- package/dist/components/layout/index.js +17 -0
- package/dist/components/layout/index.js.map +1 -0
- package/dist/components/link/index.cjs +1 -1
- package/dist/components/link/index.js +9 -9
- package/dist/components/list/index.cjs +1 -1
- package/dist/components/list/index.js +5 -5
- package/dist/components/nav/index.cjs +1 -1
- package/dist/components/nav/index.cjs.map +1 -1
- package/dist/components/nav/index.js +92 -24
- package/dist/components/nav/index.js.map +1 -1
- package/dist/components/toggle/index.cjs +2 -0
- package/dist/components/toggle/index.cjs.map +1 -0
- package/dist/components/toggle/index.js +30 -0
- package/dist/components/toggle/index.js.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +95 -35
- package/dist/index.js +36 -24
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/components/component/index.cjs +0 -2
- package/dist/components/component/index.cjs.map +0 -1
- package/dist/components/component/index.js +0 -30
- package/dist/components/component/index.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":["../../../src/components/card/index.tsx"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../../../src/components/card/index.tsx"],"sourcesContent":["import cx from 'classix';\n\nimport styles from './styles.module.css';\n\nexport type CardProps = {\n children: React.ReactNode;\n draft?: boolean;\n image?: React.ReactNode;\n onClick?: React.MouseEventHandler<HTMLElement>;\n};\n\nexport const Card = ({ children, draft, image, onClick }: CardProps) => {\n return (\n <article\n className={cx(styles.card, draft && styles.draft)}\n onClick={onClick}\n >\n {image}\n {children}\n </article>\n );\n};\n"],"names":["Card","children","draft","image","onClick","jsxs","cx","styles"],"mappings":"qNAWaA,EAAO,CAAC,CAAE,SAAAC,EAAU,MAAAC,EAAO,MAAAC,EAAO,QAAAC,KAE3CC,EAAAA,KAAC,UAAA,CACC,UAAWC,EAAAA,EAAGC,EAAO,KAAML,GAASK,EAAO,KAAK,EAChD,QAAAH,EAEC,SAAA,CAAAD,EACAF,CAAA,CAAA,CAAA"}
|
|
@@ -1,32 +1,20 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import {
|
|
3
|
-
import '../../assets/
|
|
4
|
-
card:
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
}, s = ({ ...e }) => /* @__PURE__ */ n(
|
|
1
|
+
import { jsxs as s } from "react/jsx-runtime";
|
|
2
|
+
import { t as o } from "../../classix-DG18itHa.js";
|
|
3
|
+
import '../../assets/index18.css';const e = "_card_19834_1", f = "_draft_19834_7", r = {
|
|
4
|
+
card: e,
|
|
5
|
+
draft: f
|
|
6
|
+
}, m = ({ children: t, draft: a, image: c, onClick: d }) => /* @__PURE__ */ s(
|
|
8
7
|
"article",
|
|
9
8
|
{
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
className: o(r.card, a && r.draft),
|
|
10
|
+
onClick: d,
|
|
12
11
|
children: [
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
e.headerText && /* @__PURE__ */ t(
|
|
16
|
-
a,
|
|
17
|
-
{
|
|
18
|
-
label: e.headerText,
|
|
19
|
-
size: 1,
|
|
20
|
-
subtitle: e.subHeaderText
|
|
21
|
-
}
|
|
22
|
-
),
|
|
23
|
-
e.contentText && /* @__PURE__ */ t("p", { children: e.contentText }),
|
|
24
|
-
e.children
|
|
25
|
-
] })
|
|
12
|
+
c,
|
|
13
|
+
t
|
|
26
14
|
]
|
|
27
15
|
}
|
|
28
16
|
);
|
|
29
17
|
export {
|
|
30
|
-
|
|
18
|
+
m as Card
|
|
31
19
|
};
|
|
32
20
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../src/components/card/index.tsx"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/components/card/index.tsx"],"sourcesContent":["import cx from 'classix';\n\nimport styles from './styles.module.css';\n\nexport type CardProps = {\n children: React.ReactNode;\n draft?: boolean;\n image?: React.ReactNode;\n onClick?: React.MouseEventHandler<HTMLElement>;\n};\n\nexport const Card = ({ children, draft, image, onClick }: CardProps) => {\n return (\n <article\n className={cx(styles.card, draft && styles.draft)}\n onClick={onClick}\n >\n {image}\n {children}\n </article>\n );\n};\n"],"names":["Card","children","draft","image","onClick","jsxs","cx","styles"],"mappings":";;;;;GAWaA,IAAO,CAAC,EAAE,UAAAC,GAAU,OAAAC,GAAO,OAAAC,GAAO,SAAAC,QAE3C,gBAAAC;AAAA,EAAC;AAAA,EAAA;AAAA,IACC,WAAWC,EAAGC,EAAO,MAAML,KAASK,EAAO,KAAK;AAAA,IAChD,SAAAH;AAAA,IAEC,UAAA;AAAA,MAAAD;AAAA,MACAF;AAAA,IAAA;AAAA,EAAA;AAAA;"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/index17.css');const e=require("react/jsx-runtime"),r=require("../../classix-5H4IWnMA.cjs"),x="_checkbox_rz5v8_1",b={checkbox:x},a=({checked:s,disabled:t,isLoading:c,label:o,onChange:l,...n})=>e.jsxs("label",{className:b.checkbox,children:[e.jsx("input",{checked:s,className:r.t(c&&"loading"),disabled:t||c,onChange:l,type:"checkbox",...n}),e.jsx("span",{children:o})]});exports.Checkbox=a;
|
|
2
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../../../src/components/checkbox/index.tsx"],"sourcesContent":["import cx from 'classix';\n\nimport styles from './styles.module.css';\n\nexport type CheckboxProps = React.InputHTMLAttributes<HTMLInputElement> & {\n checked?: boolean;\n disabled?: boolean;\n isLoading?: boolean;\n label?: string;\n onChange?: (e: React.ChangeEvent<HTMLInputElement>) => void;\n};\n\nexport const Checkbox = ({\n checked,\n disabled,\n isLoading,\n label,\n onChange,\n ...props\n}: CheckboxProps) => {\n return (\n <label className={styles.checkbox}>\n <input\n checked={checked}\n className={cx(isLoading && 'loading')}\n disabled={disabled || isLoading}\n onChange={onChange}\n type='checkbox'\n {...props}\n />\n <span>{label}</span>\n </label>\n );\n};\n"],"names":["Checkbox","checked","disabled","isLoading","label","onChange","props","jsxs","styles","jsx","cx"],"mappings":"kMAYaA,EAAW,CAAC,CACvB,QAAAC,EACA,SAAAC,EACA,UAAAC,EACA,MAAAC,EACA,SAAAC,EACA,GAAGC,CACL,IAEIC,EAAAA,KAAC,QAAA,CAAM,UAAWC,EAAO,SACvB,SAAA,CAAAC,EAAAA,IAAC,QAAA,CACC,QAAAR,EACA,UAAWS,EAAAA,EAAGP,GAAa,SAAS,EACpC,SAAUD,GAAYC,EACtB,SAAAE,EACA,KAAK,WACJ,GAAGC,CAAA,CAAA,EAENG,EAAAA,IAAC,QAAM,SAAAL,CAAA,CAAM,CAAA,EACf"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { jsxs as x, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { t as b } from "../../classix-DG18itHa.js";
|
|
3
|
+
import '../../assets/index17.css';const h = "_checkbox_rz5v8_1", n = {
|
|
4
|
+
checkbox: h
|
|
5
|
+
}, m = ({
|
|
6
|
+
checked: o,
|
|
7
|
+
disabled: s,
|
|
8
|
+
isLoading: c,
|
|
9
|
+
label: t,
|
|
10
|
+
onChange: r,
|
|
11
|
+
...l
|
|
12
|
+
}) => /* @__PURE__ */ x("label", { className: n.checkbox, children: [
|
|
13
|
+
/* @__PURE__ */ e(
|
|
14
|
+
"input",
|
|
15
|
+
{
|
|
16
|
+
checked: o,
|
|
17
|
+
className: b(c && "loading"),
|
|
18
|
+
disabled: s || c,
|
|
19
|
+
onChange: r,
|
|
20
|
+
type: "checkbox",
|
|
21
|
+
...l
|
|
22
|
+
}
|
|
23
|
+
),
|
|
24
|
+
/* @__PURE__ */ e("span", { children: t })
|
|
25
|
+
] });
|
|
26
|
+
export {
|
|
27
|
+
m as Checkbox
|
|
28
|
+
};
|
|
29
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/components/checkbox/index.tsx"],"sourcesContent":["import cx from 'classix';\n\nimport styles from './styles.module.css';\n\nexport type CheckboxProps = React.InputHTMLAttributes<HTMLInputElement> & {\n checked?: boolean;\n disabled?: boolean;\n isLoading?: boolean;\n label?: string;\n onChange?: (e: React.ChangeEvent<HTMLInputElement>) => void;\n};\n\nexport const Checkbox = ({\n checked,\n disabled,\n isLoading,\n label,\n onChange,\n ...props\n}: CheckboxProps) => {\n return (\n <label className={styles.checkbox}>\n <input\n checked={checked}\n className={cx(isLoading && 'loading')}\n disabled={disabled || isLoading}\n onChange={onChange}\n type='checkbox'\n {...props}\n />\n <span>{label}</span>\n </label>\n );\n};\n"],"names":["Checkbox","checked","disabled","isLoading","label","onChange","props","jsxs","styles","jsx","cx"],"mappings":";;;;GAYaA,IAAW,CAAC;AAAA,EACvB,SAAAC;AAAA,EACA,UAAAC;AAAA,EACA,WAAAC;AAAA,EACA,OAAAC;AAAA,EACA,UAAAC;AAAA,EACA,GAAGC;AACL,MAEI,gBAAAC,EAAC,SAAA,EAAM,WAAWC,EAAO,UACvB,UAAA;AAAA,EAAA,gBAAAC;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,SAAAR;AAAA,MACA,WAAWS,EAAGP,KAAa,SAAS;AAAA,MACpC,UAAUD,KAAYC;AAAA,MACtB,UAAAE;AAAA,MACA,MAAK;AAAA,MACJ,GAAGC;AAAA,IAAA;AAAA,EAAA;AAAA,EAEN,gBAAAG,EAAC,UAAM,UAAAL,EAAA,CAAM;AAAA,GACf;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/index16.css');const e=require("react/jsx-runtime"),a="_dialog_rmjos_1",i="_wrapper_rmjos_22",r={dialog:a,wrapper:i},l=({children:o,...s})=>e.jsx("div",{className:r.wrapper,children:e.jsx("dialog",{className:r.dialog,...s,children:o})});exports.Dialog=l;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":["../../../src/components/dialog/index.tsx"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../../../src/components/dialog/index.tsx"],"sourcesContent":["import styles from './styles.module.css';\n\nexport type DialogProps = React.DialogHTMLAttributes<HTMLDialogElement> & {\n children: React.ReactNode;\n};\n\nexport const Dialog = ({ children, ...props }: DialogProps) => {\n return (\n <div className={styles.wrapper}>\n <dialog\n className={styles.dialog}\n {...props}\n >\n {children}\n </dialog>\n </div>\n );\n};\n"],"names":["Dialog","children","props","jsx","styles"],"mappings":"sLAMaA,EAAS,CAAC,CAAE,SAAAC,EAAU,GAAGC,KAElCC,EAAAA,IAAC,MAAA,CAAI,UAAWC,EAAO,QACrB,SAAAD,EAAAA,IAAC,SAAA,CACC,UAAWC,EAAO,OACjB,GAAGF,EAEH,SAAAD,CAAA,CAAA,EAEL"}
|
|
@@ -1,61 +1,16 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
dialogButtons: m,
|
|
7
|
-
closeButton: g
|
|
8
|
-
}, B = ({
|
|
9
|
-
button: r,
|
|
10
|
-
children: l,
|
|
11
|
-
message: n,
|
|
12
|
-
title: e,
|
|
13
|
-
...c
|
|
14
|
-
}) => /* @__PURE__ */ o("div", { className: a.wrapper, children: /* @__PURE__ */ o(
|
|
1
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import '../../assets/index16.css';const e = "_dialog_rmjos_1", l = "_wrapper_rmjos_22", o = {
|
|
3
|
+
dialog: e,
|
|
4
|
+
wrapper: l
|
|
5
|
+
}, i = ({ children: a, ...s }) => /* @__PURE__ */ r("div", { className: o.wrapper, children: /* @__PURE__ */ r(
|
|
15
6
|
"dialog",
|
|
16
7
|
{
|
|
17
|
-
className:
|
|
18
|
-
...
|
|
19
|
-
children:
|
|
20
|
-
/* @__PURE__ */ o(
|
|
21
|
-
t,
|
|
22
|
-
{
|
|
23
|
-
variant: "secondary",
|
|
24
|
-
iconOnly: !0,
|
|
25
|
-
icon: "x",
|
|
26
|
-
className: a.closeButton
|
|
27
|
-
}
|
|
28
|
-
),
|
|
29
|
-
/* @__PURE__ */ o("h2", { children: e }),
|
|
30
|
-
/* @__PURE__ */ o("p", { children: n }),
|
|
31
|
-
/* @__PURE__ */ s(
|
|
32
|
-
"form",
|
|
33
|
-
{
|
|
34
|
-
method: "dialog",
|
|
35
|
-
className: a.dialogButtons,
|
|
36
|
-
children: [
|
|
37
|
-
/* @__PURE__ */ o(
|
|
38
|
-
t,
|
|
39
|
-
{
|
|
40
|
-
label: r,
|
|
41
|
-
variant: "secondary"
|
|
42
|
-
}
|
|
43
|
-
),
|
|
44
|
-
/* @__PURE__ */ o(
|
|
45
|
-
t,
|
|
46
|
-
{
|
|
47
|
-
label: r,
|
|
48
|
-
type: "submit",
|
|
49
|
-
variant: "primary"
|
|
50
|
-
}
|
|
51
|
-
)
|
|
52
|
-
]
|
|
53
|
-
}
|
|
54
|
-
)
|
|
55
|
-
] })
|
|
8
|
+
className: o.dialog,
|
|
9
|
+
...s,
|
|
10
|
+
children: a
|
|
56
11
|
}
|
|
57
12
|
) });
|
|
58
13
|
export {
|
|
59
|
-
|
|
14
|
+
i as Dialog
|
|
60
15
|
};
|
|
61
16
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../src/components/dialog/index.tsx"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/components/dialog/index.tsx"],"sourcesContent":["import styles from './styles.module.css';\n\nexport type DialogProps = React.DialogHTMLAttributes<HTMLDialogElement> & {\n children: React.ReactNode;\n};\n\nexport const Dialog = ({ children, ...props }: DialogProps) => {\n return (\n <div className={styles.wrapper}>\n <dialog\n className={styles.dialog}\n {...props}\n >\n {children}\n </dialog>\n </div>\n );\n};\n"],"names":["Dialog","children","props","jsx","styles"],"mappings":";;;;GAMaA,IAAS,CAAC,EAAE,UAAAC,GAAU,GAAGC,QAElC,gBAAAC,EAAC,OAAA,EAAI,WAAWC,EAAO,SACrB,UAAA,gBAAAD;AAAA,EAAC;AAAA,EAAA;AAAA,IACC,WAAWC,EAAO;AAAA,IACjB,GAAGF;AAAA,IAEH,UAAAD;AAAA,EAAA;AAAA,GAEL;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/index15.css');const n=require("react/jsx-runtime"),c=require("../../classix-5H4IWnMA.cjs"),d="_dropdown_128nx_1",a="_inline_128nx_15",u="_label_128nx_25",e={dropdown:d,inline:a,label:u},_=({children:t,inline:i,label:s,placeholder:o,...r})=>{const l=n.jsxs("select",{className:c.t(e.dropdown,i&&e.inline),...r,children:[o&&n.jsx("option",{value:"",hidden:!0,children:o}),t]});return s?n.jsxs("label",{className:e.label,children:[s,l]}):l};exports.Dropdown=_;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":["../../../src/components/dropdown/index.tsx"],"sourcesContent":["import styles from './styles.module.css';\n\nexport type DropdownProps = {\n children?: React.ReactNode;\n label?: string;\n placeholder?: string;\n};\n\nexport const Dropdown = ({ children, label, placeholder, ...props }: DropdownProps) => {\n
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../../../src/components/dropdown/index.tsx"],"sourcesContent":["import cx from 'classix';\n\nimport styles from './styles.module.css';\n\nexport type DropdownProps = React.SelectHTMLAttributes<HTMLSelectElement> & {\n children?: React.ReactNode;\n inline?: boolean;\n label?: string;\n placeholder?: string;\n};\n\nexport const Dropdown = ({ children, inline, label, placeholder, ...props }: DropdownProps) => {\n const selectElement = (\n <select\n className={cx(styles.dropdown, inline && styles.inline)}\n {...props}\n >\n {placeholder && (\n <option\n value={''}\n hidden\n >\n {placeholder}\n </option>\n )}\n {children}\n </select>\n );\n\n if (!label) {\n return selectElement;\n }\n\n return (\n <label className={styles.label}>\n {label}\n {selectElement}\n </label>\n );\n};\n"],"names":["Dropdown","children","inline","label","placeholder","props","selectElement","jsxs","cx","styles","jsx"],"mappings":"4PAWaA,EAAW,CAAC,CAAE,SAAAC,EAAU,OAAAC,EAAQ,MAAAC,EAAO,YAAAC,EAAa,GAAGC,KAA2B,CAC7F,MAAMC,EACJC,EAAAA,KAAC,SAAA,CACC,UAAWC,EAAAA,EAAGC,EAAO,SAAUP,GAAUO,EAAO,MAAM,EACrD,GAAGJ,EAEH,SAAA,CAAAD,GACCM,EAAAA,IAAC,SAAA,CACC,MAAO,GACP,OAAM,GAEL,SAAAN,CAAA,CAAA,EAGJH,CAAA,CAAA,CAAA,EAIL,OAAKE,EAKHI,EAAAA,KAAC,QAAA,CAAM,UAAWE,EAAO,MACtB,SAAA,CAAAN,EACAG,CAAA,EACH,EAPOA,CASX"}
|
|
@@ -1,29 +1,34 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import { jsxs as t, jsx as d } from "react/jsx-runtime";
|
|
2
|
+
import { t as c } from "../../classix-DG18itHa.js";
|
|
3
|
+
import '../../assets/index15.css';const _ = "_dropdown_128nx_1", a = "_inline_128nx_15", p = "_label_128nx_25", n = {
|
|
4
|
+
dropdown: _,
|
|
5
|
+
inline: a,
|
|
6
|
+
label: p
|
|
7
|
+
}, w = ({ children: r, inline: s, label: e, placeholder: o, ...i }) => {
|
|
8
|
+
const l = /* @__PURE__ */ t(
|
|
8
9
|
"select",
|
|
9
10
|
{
|
|
10
|
-
className:
|
|
11
|
-
...
|
|
11
|
+
className: c(n.dropdown, s && n.inline),
|
|
12
|
+
...i,
|
|
12
13
|
children: [
|
|
13
|
-
o && /* @__PURE__ */
|
|
14
|
+
o && /* @__PURE__ */ d(
|
|
14
15
|
"option",
|
|
15
16
|
{
|
|
16
|
-
|
|
17
|
+
value: "",
|
|
17
18
|
hidden: !0,
|
|
18
19
|
children: o
|
|
19
20
|
}
|
|
20
21
|
),
|
|
21
|
-
|
|
22
|
+
r
|
|
22
23
|
]
|
|
23
24
|
}
|
|
24
|
-
)
|
|
25
|
-
|
|
25
|
+
);
|
|
26
|
+
return e ? /* @__PURE__ */ t("label", { className: n.label, children: [
|
|
27
|
+
e,
|
|
28
|
+
l
|
|
29
|
+
] }) : l;
|
|
30
|
+
};
|
|
26
31
|
export {
|
|
27
|
-
|
|
32
|
+
w as Dropdown
|
|
28
33
|
};
|
|
29
34
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../src/components/dropdown/index.tsx"],"sourcesContent":["import styles from './styles.module.css';\n\nexport type DropdownProps = {\n children?: React.ReactNode;\n label?: string;\n placeholder?: string;\n};\n\nexport const Dropdown = ({ children, label, placeholder, ...props }: DropdownProps) => {\n
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/components/dropdown/index.tsx"],"sourcesContent":["import cx from 'classix';\n\nimport styles from './styles.module.css';\n\nexport type DropdownProps = React.SelectHTMLAttributes<HTMLSelectElement> & {\n children?: React.ReactNode;\n inline?: boolean;\n label?: string;\n placeholder?: string;\n};\n\nexport const Dropdown = ({ children, inline, label, placeholder, ...props }: DropdownProps) => {\n const selectElement = (\n <select\n className={cx(styles.dropdown, inline && styles.inline)}\n {...props}\n >\n {placeholder && (\n <option\n value={''}\n hidden\n >\n {placeholder}\n </option>\n )}\n {children}\n </select>\n );\n\n if (!label) {\n return selectElement;\n }\n\n return (\n <label className={styles.label}>\n {label}\n {selectElement}\n </label>\n );\n};\n"],"names":["Dropdown","children","inline","label","placeholder","props","selectElement","jsxs","cx","styles","jsx"],"mappings":";;;;;;GAWaA,IAAW,CAAC,EAAE,UAAAC,GAAU,QAAAC,GAAQ,OAAAC,GAAO,aAAAC,GAAa,GAAGC,QAA2B;AAC7F,QAAMC,IACJ,gBAAAC;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,WAAWC,EAAGC,EAAO,UAAUP,KAAUO,EAAO,MAAM;AAAA,MACrD,GAAGJ;AAAA,MAEH,UAAA;AAAA,QAAAD,KACC,gBAAAM;AAAA,UAAC;AAAA,UAAA;AAAA,YACC,OAAO;AAAA,YACP,QAAM;AAAA,YAEL,UAAAN;AAAA,UAAA;AAAA,QAAA;AAAA,QAGJH;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAIL,SAAKE,IAKH,gBAAAI,EAAC,SAAA,EAAM,WAAWE,EAAO,OACtB,UAAA;AAAA,IAAAN;AAAA,IACAG;AAAA,EAAA,GACH,IAPOA;AASX;"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/index14.css');const l=require("react/jsx-runtime"),T=require("../../classix-5H4IWnMA.cjs"),o=require("react"),_=require("../icon/index.cjs"),q="_dropzone_1cqsl_1",M="_highlight_1cqsl_41",z={dropzone:q,highlight:M},I=e=>{var d;const[f,y]=o.useState(!1),[F,v]=o.useState({empty:[],oversize:[],wrongType:[]}),[p,x]=o.useState([]),[D,a]=o.useState(!1),r=(t,i)=>s=>{s.preventDefault(),s.stopPropagation(),t(i)},c=r(a,!0),S=r(a,!1),g=t=>{if(!t)return;const i=Array.from(t),s=i.filter(n=>n.size===0),u=e.maxFileSizeMB?i.filter(n=>n.size>e.maxFileSizeMB*1024*1024):[],m=e.mimeTypes?i.filter(n=>{var h;return!((h=e.mimeTypes)!=null&&h.includes(n.type))}):[],j=i.filter(n=>n.size>0&&(e.maxFileSizeMB?n.size<=e.maxFileSizeMB*1024*1024:!0)&&(e.mimeTypes?e.mimeTypes.includes(n.type):!0));x(j),s.length>0||u.length>0||m.length>0?(v({empty:s,oversize:u,wrongType:m}),y(!0),console.log("validFiles",p),console.log("invalidFiles",F)):e.onUpload(t),a(!1)};return l.jsxs("div",{className:T.t(z.dropzone,D?z.highlight:""),onDragEnter:c,onDragLeave:S,onDragOver:c,onDrop:t=>{var i;t.preventDefault(),g((i=t.dataTransfer)==null?void 0:i.files)},children:[f&&l.jsx(l.Fragment,{}),l.jsxs("label",{htmlFor:e.inputId??"file-upload",children:[l.jsx(_.Icon,{name:"upload",size:"large"}),l.jsx("span",{children:e.label}),l.jsx("input",{type:"file",multiple:e.isMultiple,accept:(d=e.mimeTypes)==null?void 0:d.join(", "),id:e.inputId??"file-upload",onChange:t=>g(t.target.files)})]})]})};exports.Dropzone=I;
|
|
2
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../../../src/components/dropzone/index.tsx"],"sourcesContent":["import cx from 'classix';\nimport { useState } from 'react';\n\nimport { Icon } from '@/components/icon';\n\nimport styles from './styles.module.css';\n\nexport type DropzoneProps = {\n allowDirectoryUpload?: boolean;\n inputId?: string;\n isMultiple?: boolean;\n label?: string;\n maxFileSizeMB?: number;\n mimeTypes?: string[];\n onUpload: (uploadContent: File[] | FileList) => void;\n};\n\nexport const Dropzone = (props: DropzoneProps) => {\n const [showWarning, setShowWarning] = useState(false);\n const [invalidFiles, setInvalidFiles] = useState<{\n empty: File[];\n oversize: File[];\n wrongType: File[];\n }>({ empty: [], oversize: [], wrongType: [] });\n const [validFiles, setValidFiles] = useState<File[]>([]);\n const [dragging, setDragging] = useState(false);\n\n const makeDragHandler = (set: (v: boolean) => void, value: boolean) => (e: React.DragEvent) => {\n e.preventDefault();\n e.stopPropagation();\n set(value);\n };\n\n const onDragIn = makeDragHandler(setDragging, true);\n const onDragOut = makeDragHandler(setDragging, false);\n\n const handleUpload = (files: FileList | null) => {\n if (!files) {\n return;\n }\n\n const fileList = Array.from(files);\n\n const emptyFiles = fileList.filter((file) => file.size === 0);\n const oversizeFiles = props.maxFileSizeMB\n ? fileList.filter((file) => file.size > props.maxFileSizeMB! * 1024 * 1024)\n : [];\n const unsupportedFiles = props.mimeTypes\n ? fileList.filter((file) => !props.mimeTypes?.includes(file.type))\n : [];\n const validatedFiles = fileList.filter(\n (file) =>\n file.size > 0 &&\n (props.maxFileSizeMB ? file.size <= props.maxFileSizeMB * 1024 * 1024 : true) &&\n (props.mimeTypes ? props.mimeTypes.includes(file.type) : true)\n );\n\n setValidFiles(validatedFiles);\n\n if (emptyFiles.length > 0 || oversizeFiles.length > 0 || unsupportedFiles.length > 0) {\n setInvalidFiles({ empty: emptyFiles, oversize: oversizeFiles, wrongType: unsupportedFiles });\n setShowWarning(true);\n console.log('validFiles', validFiles);\n console.log('invalidFiles', invalidFiles);\n } else {\n props.onUpload(files);\n }\n\n setDragging(false);\n };\n\n return (\n <div\n className={cx(styles.dropzone, dragging ? styles.highlight : '')}\n onDragEnter={onDragIn}\n onDragLeave={onDragOut}\n onDragOver={onDragIn}\n onDrop={(e) => {\n e.preventDefault();\n handleUpload(e.dataTransfer?.files);\n }}\n >\n {/*TODO: show invalid files*/}\n {showWarning && <></>}\n\n <label htmlFor={props.inputId ?? 'file-upload'}>\n <Icon\n name={'upload'}\n size={'large'}\n />\n <span>{props.label}</span>\n <input\n type='file'\n multiple={props.isMultiple}\n accept={props.mimeTypes?.join(', ')}\n id={props.inputId ?? 'file-upload'}\n onChange={(e) => handleUpload(e.target.files)}\n />\n </label>\n </div>\n );\n};\n"],"names":["Dropzone","props","showWarning","setShowWarning","useState","invalidFiles","setInvalidFiles","validFiles","setValidFiles","dragging","setDragging","makeDragHandler","set","value","e","onDragIn","onDragOut","handleUpload","files","fileList","emptyFiles","file","oversizeFiles","unsupportedFiles","_a","validatedFiles","jsxs","cx","styles","jsx","Fragment","Icon"],"mappings":"wRAiBaA,EAAYC,GAAyB,OAChD,KAAM,CAACC,EAAaC,CAAc,EAAIC,EAAAA,SAAS,EAAK,EAC9C,CAACC,EAAcC,CAAe,EAAIF,EAAAA,SAIrC,CAAE,MAAO,CAAA,EAAI,SAAU,CAAA,EAAI,UAAW,CAAA,EAAI,EACvC,CAACG,EAAYC,CAAa,EAAIJ,EAAAA,SAAiB,CAAA,CAAE,EACjD,CAACK,EAAUC,CAAW,EAAIN,EAAAA,SAAS,EAAK,EAExCO,EAAkB,CAACC,EAA2BC,IAAoBC,GAAuB,CAC7FA,EAAE,eAAA,EACFA,EAAE,gBAAA,EACFF,EAAIC,CAAK,CACX,EAEME,EAAWJ,EAAgBD,EAAa,EAAI,EAC5CM,EAAYL,EAAgBD,EAAa,EAAK,EAE9CO,EAAgBC,GAA2B,CAC/C,GAAI,CAACA,EACH,OAGF,MAAMC,EAAW,MAAM,KAAKD,CAAK,EAE3BE,EAAaD,EAAS,OAAQE,GAASA,EAAK,OAAS,CAAC,EACtDC,EAAgBrB,EAAM,cACxBkB,EAAS,OAAQE,GAASA,EAAK,KAAOpB,EAAM,cAAiB,KAAO,IAAI,EACxE,CAAA,EACEsB,EAAmBtB,EAAM,UAC3BkB,EAAS,OAAQE,GAAA,OAAS,SAACG,EAAAvB,EAAM,YAAN,MAAAuB,EAAiB,SAASH,EAAK,OAAK,EAC/D,CAAA,EACEI,EAAiBN,EAAS,OAC7BE,GACCA,EAAK,KAAO,IACXpB,EAAM,cAAgBoB,EAAK,MAAQpB,EAAM,cAAgB,KAAO,KAAO,MACvEA,EAAM,UAAYA,EAAM,UAAU,SAASoB,EAAK,IAAI,EAAI,GAAA,EAG7Db,EAAciB,CAAc,EAExBL,EAAW,OAAS,GAAKE,EAAc,OAAS,GAAKC,EAAiB,OAAS,GACjFjB,EAAgB,CAAE,MAAOc,EAAY,SAAUE,EAAe,UAAWC,EAAkB,EAC3FpB,EAAe,EAAI,EACnB,QAAQ,IAAI,aAAcI,CAAU,EACpC,QAAQ,IAAI,eAAgBF,CAAY,GAExCJ,EAAM,SAASiB,CAAK,EAGtBR,EAAY,EAAK,CACnB,EAEA,OACEgB,EAAAA,KAAC,MAAA,CACC,UAAWC,EAAAA,EAAGC,EAAO,SAAUnB,EAAWmB,EAAO,UAAY,EAAE,EAC/D,YAAab,EACb,YAAaC,EACb,WAAYD,EACZ,OAASD,GAAM,OACbA,EAAE,eAAA,EACFG,GAAaO,EAAAV,EAAE,eAAF,YAAAU,EAAgB,KAAK,CACpC,EAGC,SAAA,CAAAtB,GAAe2B,EAAAA,IAAAC,EAAAA,SAAA,EAAE,EAElBJ,EAAAA,KAAC,QAAA,CAAM,QAASzB,EAAM,SAAW,cAC/B,SAAA,CAAA4B,EAAAA,IAACE,EAAAA,KAAA,CACC,KAAM,SACN,KAAM,OAAA,CAAA,EAERF,EAAAA,IAAC,OAAA,CAAM,SAAA5B,EAAM,KAAA,CAAM,EACnB4B,EAAAA,IAAC,QAAA,CACC,KAAK,OACL,SAAU5B,EAAM,WAChB,QAAQuB,EAAAvB,EAAM,YAAN,YAAAuB,EAAiB,KAAK,MAC9B,GAAIvB,EAAM,SAAW,cACrB,SAAWa,GAAMG,EAAaH,EAAE,OAAO,KAAK,CAAA,CAAA,CAC9C,CAAA,CACF,CAAA,CAAA,CAAA,CAGN"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { jsxs as f, jsx as o, Fragment as I } from "react/jsx-runtime";
|
|
2
|
+
import { t as M } from "../../classix-DG18itHa.js";
|
|
3
|
+
import { useState as s } from "react";
|
|
4
|
+
import { Icon as w } from "../icon/index.js";
|
|
5
|
+
import '../../assets/index14.css';const B = "_dropzone_1cqsl_1", j = "_highlight_1cqsl_41", z = {
|
|
6
|
+
dropzone: B,
|
|
7
|
+
highlight: j
|
|
8
|
+
}, U = (e) => {
|
|
9
|
+
var d;
|
|
10
|
+
const [p, F] = s(!1), [y, v] = s({ empty: [], oversize: [], wrongType: [] }), [D, T] = s([]), [x, a] = s(!1), r = (i, t) => (n) => {
|
|
11
|
+
n.preventDefault(), n.stopPropagation(), i(t);
|
|
12
|
+
}, g = r(a, !0), S = r(a, !1), m = (i) => {
|
|
13
|
+
if (!i)
|
|
14
|
+
return;
|
|
15
|
+
const t = Array.from(i), n = t.filter((l) => l.size === 0), c = e.maxFileSizeMB ? t.filter((l) => l.size > e.maxFileSizeMB * 1024 * 1024) : [], h = e.mimeTypes ? t.filter((l) => {
|
|
16
|
+
var u;
|
|
17
|
+
return !((u = e.mimeTypes) != null && u.includes(l.type));
|
|
18
|
+
}) : [], _ = t.filter(
|
|
19
|
+
(l) => l.size > 0 && (e.maxFileSizeMB ? l.size <= e.maxFileSizeMB * 1024 * 1024 : !0) && (e.mimeTypes ? e.mimeTypes.includes(l.type) : !0)
|
|
20
|
+
);
|
|
21
|
+
T(_), n.length > 0 || c.length > 0 || h.length > 0 ? (v({ empty: n, oversize: c, wrongType: h }), F(!0), console.log("validFiles", D), console.log("invalidFiles", y)) : e.onUpload(i), a(!1);
|
|
22
|
+
};
|
|
23
|
+
return /* @__PURE__ */ f(
|
|
24
|
+
"div",
|
|
25
|
+
{
|
|
26
|
+
className: M(z.dropzone, x ? z.highlight : ""),
|
|
27
|
+
onDragEnter: g,
|
|
28
|
+
onDragLeave: S,
|
|
29
|
+
onDragOver: g,
|
|
30
|
+
onDrop: (i) => {
|
|
31
|
+
var t;
|
|
32
|
+
i.preventDefault(), m((t = i.dataTransfer) == null ? void 0 : t.files);
|
|
33
|
+
},
|
|
34
|
+
children: [
|
|
35
|
+
p && /* @__PURE__ */ o(I, {}),
|
|
36
|
+
/* @__PURE__ */ f("label", { htmlFor: e.inputId ?? "file-upload", children: [
|
|
37
|
+
/* @__PURE__ */ o(
|
|
38
|
+
w,
|
|
39
|
+
{
|
|
40
|
+
name: "upload",
|
|
41
|
+
size: "large"
|
|
42
|
+
}
|
|
43
|
+
),
|
|
44
|
+
/* @__PURE__ */ o("span", { children: e.label }),
|
|
45
|
+
/* @__PURE__ */ o(
|
|
46
|
+
"input",
|
|
47
|
+
{
|
|
48
|
+
type: "file",
|
|
49
|
+
multiple: e.isMultiple,
|
|
50
|
+
accept: (d = e.mimeTypes) == null ? void 0 : d.join(", "),
|
|
51
|
+
id: e.inputId ?? "file-upload",
|
|
52
|
+
onChange: (i) => m(i.target.files)
|
|
53
|
+
}
|
|
54
|
+
)
|
|
55
|
+
] })
|
|
56
|
+
]
|
|
57
|
+
}
|
|
58
|
+
);
|
|
59
|
+
};
|
|
60
|
+
export {
|
|
61
|
+
U as Dropzone
|
|
62
|
+
};
|
|
63
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/components/dropzone/index.tsx"],"sourcesContent":["import cx from 'classix';\nimport { useState } from 'react';\n\nimport { Icon } from '@/components/icon';\n\nimport styles from './styles.module.css';\n\nexport type DropzoneProps = {\n allowDirectoryUpload?: boolean;\n inputId?: string;\n isMultiple?: boolean;\n label?: string;\n maxFileSizeMB?: number;\n mimeTypes?: string[];\n onUpload: (uploadContent: File[] | FileList) => void;\n};\n\nexport const Dropzone = (props: DropzoneProps) => {\n const [showWarning, setShowWarning] = useState(false);\n const [invalidFiles, setInvalidFiles] = useState<{\n empty: File[];\n oversize: File[];\n wrongType: File[];\n }>({ empty: [], oversize: [], wrongType: [] });\n const [validFiles, setValidFiles] = useState<File[]>([]);\n const [dragging, setDragging] = useState(false);\n\n const makeDragHandler = (set: (v: boolean) => void, value: boolean) => (e: React.DragEvent) => {\n e.preventDefault();\n e.stopPropagation();\n set(value);\n };\n\n const onDragIn = makeDragHandler(setDragging, true);\n const onDragOut = makeDragHandler(setDragging, false);\n\n const handleUpload = (files: FileList | null) => {\n if (!files) {\n return;\n }\n\n const fileList = Array.from(files);\n\n const emptyFiles = fileList.filter((file) => file.size === 0);\n const oversizeFiles = props.maxFileSizeMB\n ? fileList.filter((file) => file.size > props.maxFileSizeMB! * 1024 * 1024)\n : [];\n const unsupportedFiles = props.mimeTypes\n ? fileList.filter((file) => !props.mimeTypes?.includes(file.type))\n : [];\n const validatedFiles = fileList.filter(\n (file) =>\n file.size > 0 &&\n (props.maxFileSizeMB ? file.size <= props.maxFileSizeMB * 1024 * 1024 : true) &&\n (props.mimeTypes ? props.mimeTypes.includes(file.type) : true)\n );\n\n setValidFiles(validatedFiles);\n\n if (emptyFiles.length > 0 || oversizeFiles.length > 0 || unsupportedFiles.length > 0) {\n setInvalidFiles({ empty: emptyFiles, oversize: oversizeFiles, wrongType: unsupportedFiles });\n setShowWarning(true);\n console.log('validFiles', validFiles);\n console.log('invalidFiles', invalidFiles);\n } else {\n props.onUpload(files);\n }\n\n setDragging(false);\n };\n\n return (\n <div\n className={cx(styles.dropzone, dragging ? styles.highlight : '')}\n onDragEnter={onDragIn}\n onDragLeave={onDragOut}\n onDragOver={onDragIn}\n onDrop={(e) => {\n e.preventDefault();\n handleUpload(e.dataTransfer?.files);\n }}\n >\n {/*TODO: show invalid files*/}\n {showWarning && <></>}\n\n <label htmlFor={props.inputId ?? 'file-upload'}>\n <Icon\n name={'upload'}\n size={'large'}\n />\n <span>{props.label}</span>\n <input\n type='file'\n multiple={props.isMultiple}\n accept={props.mimeTypes?.join(', ')}\n id={props.inputId ?? 'file-upload'}\n onChange={(e) => handleUpload(e.target.files)}\n />\n </label>\n </div>\n );\n};\n"],"names":["Dropzone","props","showWarning","setShowWarning","useState","invalidFiles","setInvalidFiles","validFiles","setValidFiles","dragging","setDragging","makeDragHandler","set","value","e","onDragIn","onDragOut","handleUpload","files","fileList","emptyFiles","file","oversizeFiles","unsupportedFiles","_a","validatedFiles","jsxs","cx","styles","jsx","Fragment","Icon"],"mappings":";;;;;;;GAiBaA,IAAW,CAACC,MAAyB;;AAChD,QAAM,CAACC,GAAaC,CAAc,IAAIC,EAAS,EAAK,GAC9C,CAACC,GAAcC,CAAe,IAAIF,EAIrC,EAAE,OAAO,CAAA,GAAI,UAAU,CAAA,GAAI,WAAW,CAAA,GAAI,GACvC,CAACG,GAAYC,CAAa,IAAIJ,EAAiB,CAAA,CAAE,GACjD,CAACK,GAAUC,CAAW,IAAIN,EAAS,EAAK,GAExCO,IAAkB,CAACC,GAA2BC,MAAmB,CAACC,MAAuB;AAC7F,IAAAA,EAAE,eAAA,GACFA,EAAE,gBAAA,GACFF,EAAIC,CAAK;AAAA,EACX,GAEME,IAAWJ,EAAgBD,GAAa,EAAI,GAC5CM,IAAYL,EAAgBD,GAAa,EAAK,GAE9CO,IAAe,CAACC,MAA2B;AAC/C,QAAI,CAACA;AACH;AAGF,UAAMC,IAAW,MAAM,KAAKD,CAAK,GAE3BE,IAAaD,EAAS,OAAO,CAACE,MAASA,EAAK,SAAS,CAAC,GACtDC,IAAgBrB,EAAM,gBACxBkB,EAAS,OAAO,CAACE,MAASA,EAAK,OAAOpB,EAAM,gBAAiB,OAAO,IAAI,IACxE,CAAA,GACEsB,IAAmBtB,EAAM,YAC3BkB,EAAS,OAAO,CAACE,MAAA;;AAAS,gBAACG,IAAAvB,EAAM,cAAN,QAAAuB,EAAiB,SAASH,EAAK;AAAA,KAAK,IAC/D,CAAA,GACEI,IAAiBN,EAAS;AAAA,MAC9B,CAACE,MACCA,EAAK,OAAO,MACXpB,EAAM,gBAAgBoB,EAAK,QAAQpB,EAAM,gBAAgB,OAAO,OAAO,QACvEA,EAAM,YAAYA,EAAM,UAAU,SAASoB,EAAK,IAAI,IAAI;AAAA,IAAA;AAG7D,IAAAb,EAAciB,CAAc,GAExBL,EAAW,SAAS,KAAKE,EAAc,SAAS,KAAKC,EAAiB,SAAS,KACjFjB,EAAgB,EAAE,OAAOc,GAAY,UAAUE,GAAe,WAAWC,GAAkB,GAC3FpB,EAAe,EAAI,GACnB,QAAQ,IAAI,cAAcI,CAAU,GACpC,QAAQ,IAAI,gBAAgBF,CAAY,KAExCJ,EAAM,SAASiB,CAAK,GAGtBR,EAAY,EAAK;AAAA,EACnB;AAEA,SACE,gBAAAgB;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,WAAWC,EAAGC,EAAO,UAAUnB,IAAWmB,EAAO,YAAY,EAAE;AAAA,MAC/D,aAAab;AAAA,MACb,aAAaC;AAAA,MACb,YAAYD;AAAA,MACZ,QAAQ,CAACD,MAAM;;AACb,QAAAA,EAAE,eAAA,GACFG,GAAaO,IAAAV,EAAE,iBAAF,gBAAAU,EAAgB,KAAK;AAAA,MACpC;AAAA,MAGC,UAAA;AAAA,QAAAtB,KAAe,gBAAA2B,EAAAC,GAAA,EAAE;AAAA,QAElB,gBAAAJ,EAAC,SAAA,EAAM,SAASzB,EAAM,WAAW,eAC/B,UAAA;AAAA,UAAA,gBAAA4B;AAAA,YAACE;AAAA,YAAA;AAAA,cACC,MAAM;AAAA,cACN,MAAM;AAAA,YAAA;AAAA,UAAA;AAAA,UAER,gBAAAF,EAAC,QAAA,EAAM,UAAA5B,EAAM,MAAA,CAAM;AAAA,UACnB,gBAAA4B;AAAA,YAAC;AAAA,YAAA;AAAA,cACC,MAAK;AAAA,cACL,UAAU5B,EAAM;AAAA,cAChB,SAAQuB,IAAAvB,EAAM,cAAN,gBAAAuB,EAAiB,KAAK;AAAA,cAC9B,IAAIvB,EAAM,WAAW;AAAA,cACrB,UAAU,CAACa,MAAMG,EAAaH,EAAE,OAAO,KAAK;AAAA,YAAA;AAAA,UAAA;AAAA,QAC9C,EAAA,CACF;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGN;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/index12.css');const V=require("react/jsx-runtime"),U=require("react"),Ms=require("react-dom"),dn=require("../../classix-5H4IWnMA.cjs"),cr=require("../button/index.cjs"),fr=require("../icon/index.cjs"),o0=require("../input/index.cjs");function a0(n){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(n){for(const t in n)if(t!=="default"){const r=Object.getOwnPropertyDescriptor(n,t);Object.defineProperty(e,t,r.get?r:{enumerable:!0,get:()=>n[t]})}}return e.default=n,Object.freeze(e)}const Du=a0(U);function Wn(n){return{}}const qi={},l0={},va={},Nt={},Jt={},An={},Xt={},fu={},Qu={},On={},Pn={},Ue={},ji={},Ui={},c0={},wa={},f0={},Sa={},d0={},Ta={},Ca={},Br={},h0={},Ea={},Na={},ka={},p0={},g0={},m0={},Rs={},Aa={},b0={},Oa={},Pa={},y0={},du={},zi={},Yu={},x0={},_0={},dr={},hr={},v0={},w0={},S0={},Re=typeof window<"u"&&window.document!==void 0&&window.document.createElement!==void 0,T0=Re&&"documentMode"in document?document.documentMode:null,Ae=Re&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),ht=Re&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),$r=!(!Re||!("InputEvent"in window)||T0)&&"getTargetRanges"in new window.InputEvent("input"),hu=Re&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),Hn=Re&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,C0=Re&&/Android/.test(navigator.userAgent),Ia=Re&&/^(?=.*Chrome).*/i.test(navigator.userAgent),E0=Re&&C0&&Ia,Wi=Re&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&!Ia,Vn=1,mt=3,At=0,La=1,Yt=2,N0=0,k0=1,A0=2,Fr=4,qr=8,Hi=128,O0=112|(3|Fr|qr)|Hi,Vi=1,Gi=2,Ki=3,Ji=4,Xi=5,Zi=6,pu=hu||Hn||Wi?" ":"",Ze=`
|
|
2
2
|
|
|
3
3
|
`,P0=ht?" ":pu,Da="֑-߿יִ-﷽ﹰ-ﻼ",Ma="A-Za-zÀ-ÖØ-öø-ʸ̀-ࠀ-Ⰰ-︀--",I0=new RegExp("^[^"+Ma+"]*["+Da+"]"),L0=new RegExp("^[^"+Da+"]*["+Ma+"]"),Ot={bold:1,code:16,highlight:Hi,italic:2,strikethrough:Fr,subscript:32,superscript:64,underline:qr},D0={directionless:1,unmergeable:2},Bs={center:Gi,end:Zi,justify:Ji,left:Vi,right:Ki,start:Xi},M0={[Gi]:"center",[Zi]:"end",[Ji]:"justify",[Vi]:"left",[Ki]:"right",[Xi]:"start"},R0={normal:0,segmented:2,token:1},B0={[N0]:"normal",[A0]:"segmented",[k0]:"token"};function $0(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var L=$0(function(n){const e=new URLSearchParams;e.append("code",n);for(let t=1;t<arguments.length;t++)e.append("v",arguments[t]);throw Error(`Minified Lexical error #${n}; visit https://lexical.dev/docs/error?${e} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)});function jr(...n){const e=[];for(const t of n)if(t&&typeof t=="string")for(const[r]of t.matchAll(/\S+/g))e.push(r);return e}const F0=100;let ei=!1,Qi=0;function q0(n){Qi=n.timeStamp}function Mu(n,e,t){const r=n.nodeName==="BR",u=e.__lexicalLineBreak;return u&&(n===u||r&&n.previousSibling===u)||r&&mu(n,t)!==void 0}function j0(n,e,t){const r=Ne(t._window);let u=null,i=null;r!==null&&r.anchorNode===n&&(u=r.anchorOffset,i=r.focusOffset);const s=n.nodeValue;s!==null&&rs(e,s,u,i,!1)}function U0(n,e,t){if(I(n)){const r=n.anchor.getNode();if(r.is(t)&&n.format!==r.getFormat())return!1}return e.nodeType===mt&&t.isAttached()}function z0(n,e,t,r){for(let u=n;u&&!rf(u);u=Kn(u)){const i=mu(u,e);if(i!==void 0){const s=fe(i,t);if(s)return te(s)?void 0:[u,s]}else if(u===r)return[r,Wa(t)]}}function Ra(n,e,t){ei=!0;const r=performance.now()-Qi>F0;try{Te(n,()=>{const u=$()||function(c){return c.getEditorState().read(()=>{const d=$();return d!==null?d.clone():null})}(n),i=new Map,s=n.getRootElement(),o=n._editorState,a=n._blockCursorElement;let l=!1,f="";for(let c=0;c<e.length;c++){const d=e[c],p=d.type,m=d.target,g=z0(m,n,o,s);if(!g)continue;const[y,b]=g;if(p==="characterData")r&&M(b)&&U0(u,m,b)&&j0(m,b,n);else if(p==="childList"){l=!0;const _=d.addedNodes;for(let S=0;S<_.length;S++){const P=_[S],C=Ua(P),D=P.parentNode;if(D!=null&&P!==a&&C===null&&!Mu(P,D,n)){if(ht){const q=P.innerText||P.nodeValue;q&&(f+=q)}D.removeChild(P)}}const w=d.removedNodes,T=w.length;if(T>0){let S=0;for(let P=0;P<T;P++){const C=w[P];(Mu(C,m,n)||a===C)&&(m.appendChild(C),S++)}T!==S&&i.set(y,b)}}}if(i.size>0)for(const[c,d]of i)d.reconcileObservedMutation(c,n);const h=t.takeRecords();if(h.length>0){for(let c=0;c<h.length;c++){const d=h[c],p=d.addedNodes,m=d.target;for(let g=0;g<p.length;g++){const y=p[g],b=y.parentNode;b==null||y.nodeName!=="BR"||Mu(y,m,n)||b.removeChild(y)}}t.takeRecords()}u!==null&&(l&&(u.dirty=!0,Me(u)),ht&&Ka(n)&&u.insertRawText(f))})}finally{ei=!1}}function Ba(n){const e=n._observer;e!==null&&Ra(n,e.takeRecords(),e)}function $a(n){(function(e){Qi===0&&yu(e).addEventListener("textInput",q0,!0)})(n),n._observer=new MutationObserver((e,t)=>{Ra(n,e,t)})}function $s(n,e){const t=n.__mode,r=n.__format,u=n.__style,i=e.__mode,s=e.__format,o=e.__style;return!(t!==null&&t!==i||r!==null&&r!==s||u!==null&&u!==o)}function Fs(n,e){const t=n.mergeWithSibling(e),r=ue()._normalizedNodes;return r.add(n.__key),r.add(e.__key),t}function qs(n){let e,t,r=n;if(r.__text!==""||!r.isSimpleText()||r.isUnmergeable()){for(;(e=r.getPreviousSibling())!==null&&M(e)&&e.isSimpleText()&&!e.isUnmergeable();){if(e.__text!==""){if($s(e,r)){r=Fs(e,r);break}break}e.remove()}for(;(t=r.getNextSibling())!==null&&M(t)&&t.isSimpleText()&&!t.isUnmergeable();){if(t.__text!==""){if($s(r,t)){r=Fs(r,t);break}break}t.remove()}}else r.remove()}function Fa(n){return js(n.anchor),js(n.focus),n}function js(n){for(;n.type==="element";){const e=n.getNode(),t=n.offset;let r,u;if(t===e.getChildrenSize()?(r=e.getChildAtIndex(t-1),u=!0):(r=e.getChildAtIndex(t),u=!1),M(r)){n.set(r.__key,u?r.getTextContentSize():0,"text");break}if(!E(r))break;n.set(r.__key,u?r.getChildrenSize():0,"element")}}let W0=1;const H0=typeof queueMicrotask=="function"?queueMicrotask:n=>{Promise.resolve().then(n)};function Yi(n){const e=document.activeElement;if(e===null)return!1;const t=e.nodeName;return te(en(n))&&(t==="INPUT"||t==="TEXTAREA"||e.contentEditable==="true"&&gu(e)==null)}function Gn(n,e,t){const r=n.getRootElement();try{return r!==null&&r.contains(e)&&r.contains(t)&&e!==null&&!Yi(e)&&qa(e)===n}catch{return!1}}function es(n){return n instanceof Su}function qa(n){let e=n;for(;e!=null;){const t=gu(e);if(es(t))return t;e=Kn(e)}return null}function gu(n){return n?n.__lexicalEditor:null}function St(n){return n.isToken()||n.isSegmented()}function V0(n){return n.nodeType===mt}function Ur(n){let e=n;for(;e!=null;){if(V0(e))return e;e=e.firstChild}return null}function zr(n,e,t){const r=Ot[e];if(t!==null&&(n&r)==(t&r))return n;let u=n^r;return e==="subscript"?u&=-65:e==="superscript"&&(u&=-33),u}function ja(n){return M(n)||pt(n)||te(n)}function G0(n,e){if(e!=null)return void(n.__key=e);ye(),gl();const t=ue(),r=tt(),u=""+W0++;r._nodeMap.set(u,n),E(n)?t._dirtyElements.set(u,!0):t._dirtyLeaves.add(u),t._cloneNotNeeded.add(u),t._dirtyType=La,n.__key=u}function kt(n){const e=n.getParent();if(e!==null){const t=n.getWritable(),r=e.getWritable(),u=n.getPreviousSibling(),i=n.getNextSibling();if(u===null)if(i!==null){const s=i.getWritable();r.__first=i.__key,s.__prev=null}else r.__first=null;else{const s=u.getWritable();if(i!==null){const o=i.getWritable();o.__prev=s.__key,s.__next=o.__key}else s.__next=null;t.__prev=null}if(i===null)if(u!==null){const s=u.getWritable();r.__last=u.__key,s.__next=null}else r.__last=null;else{const s=i.getWritable();if(u!==null){const o=u.getWritable();o.__next=s.__key,s.__prev=o.__key}else s.__prev=null;t.__next=null}r.__size--,t.__parent=null}}function Wr(n){gl();const e=n.getLatest(),t=e.__parent,r=tt(),u=ue(),i=r._nodeMap,s=u._dirtyElements;t!==null&&function(a,l,f){let h=a;for(;h!==null;){if(f.has(h))return;const c=l.get(h);if(c===void 0)break;f.set(h,!1),h=c.__parent}}(t,i,s);const o=e.__key;u._dirtyType=La,E(n)?s.set(o,!0):u._dirtyLeaves.add(o)}function ce(n){ye();const e=ue(),t=e._compositionKey;if(n!==t){if(e._compositionKey=n,t!==null){const r=fe(t);r!==null&&r.getWritable()}if(n!==null){const r=fe(n);r!==null&&r.getWritable()}}}function lt(){return Yn()?null:ue()._compositionKey}function fe(n,e){const t=(e||tt())._nodeMap.get(n);return t===void 0?null:t}function Ua(n,e){const t=mu(n,ue());return t!==void 0?fe(t,e):null}function mu(n,e){return n[`__lexicalKey_${e._key}`]}function en(n,e){let t=n;for(;t!=null;){const r=Ua(t,e);if(r!==null)return r;t=Kn(t)}return null}function za(n){const e=n._decorators,t=Object.assign({},e);return n._pendingDecorators=t,t}function Us(n){return n.read(()=>ie().getTextContent())}function ie(){return Wa(tt())}function Wa(n){return n._nodeMap.get("root")}function Me(n){ye();const e=tt();n!==null&&(n.dirty=!0,n.setCachedNodes(null)),e._selection=n}function Gt(n){const e=ue(),t=function(r,u){let i=r;for(;i!=null;){const s=mu(i,u);if(s!==void 0)return s;i=Kn(i)}return null}(n,e);return t===null?n===e.getRootElement()?fe("root"):null:fe(t)}function zs(n,e){return e?n.getTextContentSize():0}function Ha(n){return/[\uD800-\uDBFF][\uDC00-\uDFFF]/g.test(n)}function ts(n){const e=[];let t=n;for(;t!==null;)e.push(t),t=t._parentEditor;return e}function Va(){return Math.random().toString(36).replace(/[^a-z]+/g,"").substr(0,5)}function Ga(n){return n.nodeType===mt?n.nodeValue:null}function ns(n,e,t){const r=Ne(e._window);if(r===null)return;const u=r.anchorNode;let{anchorOffset:i,focusOffset:s}=r;if(u!==null){let o=Ga(u);const a=en(u);if(o!==null&&M(a)){if(o===pu&&t){const l=t.length;o=t,i=l,s=l}o!==null&&rs(a,o,i,s,n)}}}function rs(n,e,t,r,u){let i=n;if(i.isAttached()&&(u||!i.isDirty())){const s=i.isComposing();let o=e;(s||u)&&e[e.length-1]===pu&&(o=e.slice(0,-1));const a=i.getTextContent();if(u||o!==a){if(o===""){if(ce(null),hu||Hn||Wi)i.remove();else{const m=ue();setTimeout(()=>{m.update(()=>{i.isAttached()&&i.remove()})},20)}return}const l=i.getParent(),f=Qn(),h=i.getTextContentSize(),c=lt(),d=i.getKey();if(i.isToken()||c!==null&&d===c&&!s||I(f)&&(l!==null&&!l.canInsertTextBefore()&&f.anchor.offset===0||f.anchor.key===n.__key&&f.anchor.offset===0&&!i.canInsertTextBefore()&&!s||f.focus.key===n.__key&&f.focus.offset===h&&!i.canInsertTextAfter()&&!s))return void i.markDirty();const p=$();if(!I(p)||t===null||r===null)return void i.setTextContent(o);if(p.setTextNodeRange(i,t,i,r),i.isSegmented()){const m=se(i.getTextContent());i.replace(m),i=m}i.setTextContent(o)}}}function K0(n,e){if(e.isSegmented())return!0;if(!n.isCollapsed())return!1;const t=n.anchor.offset,r=e.getParentOrThrow(),u=e.isToken();return t===0?!e.canInsertTextBefore()||!r.canInsertTextBefore()&&!e.isComposing()||u||function(i){const s=i.getPreviousSibling();return(M(s)||E(s)&&s.isInline())&&!s.canInsertTextAfter()}(e):t===e.getTextContentSize()&&(!e.canInsertTextAfter()||!r.canInsertTextAfter()&&!e.isComposing()||u)}function Ws(n){return n==="ArrowLeft"}function Hs(n){return n==="ArrowRight"}function _n(n,e){return Ae?n:e}function Vs(n){return n==="Enter"}function hn(n){return n==="Backspace"}function pn(n){return n==="Delete"}function Gs(n,e,t){return n.toLowerCase()==="a"&&_n(e,t)}function J0(){const n=ie();Me(Fa(n.select(0,n.getChildrenSize())))}function wn(n,e){n.__lexicalClassNameCache===void 0&&(n.__lexicalClassNameCache={});const t=n.__lexicalClassNameCache,r=t[e];if(r!==void 0)return r;const u=n[e];if(typeof u=="string"){const i=jr(u);return t[e]=i,i}return u}function us(n,e,t,r,u){if(t.size===0)return;const i=r.__type,s=r.__key,o=e.get(i);o===void 0&&L(33,i);const a=o.klass;let l=n.get(a);l===void 0&&(l=new Map,n.set(a,l));const f=l.get(s),h=f==="destroyed"&&u==="created";(f===void 0||h)&&l.set(s,h?"updated":u)}function Ks(n,e,t){const r=n.getParent();let u=t,i=n;return r!==null&&(e&&t===0?(u=i.getIndexWithinParent(),i=r):e||t!==i.getChildrenSize()||(u=i.getIndexWithinParent()+1,i=r)),i.getChildAtIndex(e?u-1:u)}function In(n,e){const t=n.offset;if(n.type==="element")return Ks(n.getNode(),e,t);{const r=n.getNode();if(e&&t===0||!e&&t===r.getTextContentSize()){const u=e?r.getPreviousSibling():r.getNextSibling();return u===null?Ks(r.getParentOrThrow(),e,r.getIndexWithinParent()+(e?0:1)):u}}return null}function Ka(n){const e=yu(n).event,t=e&&e.inputType;return t==="insertFromPaste"||t==="insertFromPasteAsQuotation"}function R(n,e,t){return yl(n,e,t)}function bu(n){return!he(n)&&!n.isLastChild()&&!n.isInline()}function Hr(n,e){const t=n._keyToDOMMap.get(e);return t===void 0&&L(75,e),t}function Kn(n){const e=n.assignedSlot||n.parentElement;return e!==null&&e.nodeType===11?e.host:e}function Sn(n,e){let t=n.getParent();for(;t!==null;){if(t.is(e))return!0;t=t.getParent()}return!1}function yu(n){const e=n._window;return e===null&&L(78),e}function X0(n){let e=n.getParentOrThrow();for(;e!==null;){if(Qe(e))return e;e=e.getParentOrThrow()}return e}function Qe(n){return he(n)||E(n)&&n.isShadowRoot()}function bt(n){const e=ue(),t=n.constructor.getType(),r=e._nodes.get(t);r===void 0&&L(200,n.constructor.name,t);const{replace:u,replaceWithKlass:i}=r;if(u!==null){const s=u(n),o=s.constructor;return i!==null?s instanceof i||L(201,i.name,i.getType(),o.name,o.getType(),n.constructor.name,t):s instanceof n.constructor&&o!==n.constructor||L(202,o.name,o.getType(),n.constructor.name,t),s.__key===n.__key&&L(203,n.constructor.name,t,o.name,o.getType()),s}return n}function Ru(n,e){!he(n.getParent())||E(e)||te(e)||L(99)}function Bu(n){return(te(n)||E(n)&&!n.canBeEmpty())&&!n.isInline()}function is(n,e,t){t.style.removeProperty("caret-color"),e._blockCursorElement=null;const r=n.parentElement;r!==null&&r.removeChild(n)}function Z0(n,e,t){let r=n._blockCursorElement;if(I(t)&&t.isCollapsed()&&t.anchor.type==="element"&&e.contains(document.activeElement)){const u=t.anchor,i=u.getNode(),s=u.offset;let o=!1,a=null;if(s===i.getChildrenSize())Bu(i.getChildAtIndex(s-1))&&(o=!0);else{const l=i.getChildAtIndex(s);if(l!==null&&Bu(l)){const f=l.getPreviousSibling();(f===null||Bu(f))&&(o=!0,a=n.getElementByKey(l.__key))}}if(o){const l=n.getElementByKey(i.__key);return r===null&&(n._blockCursorElement=r=function(f){const h=f.theme,c=document.createElement("div");c.contentEditable="false",c.setAttribute("data-lexical-cursor","true");let d=h.blockCursor;if(d!==void 0){if(typeof d=="string"){const p=jr(d);d=h.blockCursor=p}d!==void 0&&c.classList.add(...d)}return c}(n._config)),e.style.caretColor="transparent",void(a===null?l.appendChild(r):l.insertBefore(r,a))}}r!==null&&is(r,n,e)}function Ne(n){return Re?(n||window).getSelection():null}function Q0(n){return Rt(n)&&n.tagName==="A"}function Rt(n){return n.nodeType===1}function Js(n){return n.nodeType===11}function ti(n){const e=new RegExp(/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var|#text)$/,"i");return n.nodeName.match(e)!==null}function Vr(n){const e=new RegExp(/^(address|article|aside|blockquote|canvas|dd|div|dl|dt|fieldset|figcaption|figure|footer|form|h1|h2|h3|h4|h5|h6|header|hr|li|main|nav|noscript|ol|p|pre|section|table|td|tfoot|ul|video)$/,"i");return n.nodeName.match(e)!==null}function ot(n){if(te(n)&&!n.isInline())return!0;if(!E(n)||Qe(n))return!1;const e=n.getFirstChild(),t=e===null||pt(e)||M(e)||e.isInline();return!n.isInline()&&n.canBeEmpty()!==!1&&t}function gn(n,e){let t=n;for(;t!==null&&t.getParent()!==null&&!e(t);)t=t.getParentOrThrow();return e(t)?t:null}function Y0(){return ue()}const Xs=new WeakMap,ef=new Map;function tf(n){if(!n._readOnly&&n.isEmpty())return ef;n._readOnly||L(192);let e=Xs.get(n);if(!e){e=new Map,Xs.set(n,e);for(const[t,r]of n._nodeMap){const u=r.__type;let i=e.get(u);i||(i=new Map,e.set(u,i)),i.set(t,r)}}return e}function ss(n){const e=n.constructor.clone(n);return e.afterCloneFrom(n),e}function nf(n,e){const t=(parseInt(n.style.paddingInlineStart,10)||0)/40;e.setIndent(t)}function rf(n){return n.__lexicalUnmanaged===!0}function Ja(n,e,t,r,u,i){let s=n.getFirstChild();for(;s!==null;){const o=s.__key;s.__parent===e&&(E(s)&&Ja(s,o,t,r,u,i),t.has(o)||i.delete(o),u.push(o)),s=s.getNextSibling()}}let gt,pe,Ln,xu,ni,ri,Pt,De,ui,Dn,oe="",de="",Fe=null,Oe="",Xe="",Xa=!1,Mn=!1,Or=null;function Gr(n,e){const t=Pt.get(n);if(e!==null){const r=oi(n);r.parentNode===e&&e.removeChild(r)}if(De.has(n)||pe._keyToDOMMap.delete(n),E(t)){const r=Jr(t,Pt);ii(r,0,r.length-1,null)}t!==void 0&&us(Dn,Ln,xu,t,"destroyed")}function ii(n,e,t,r){let u=e;for(;u<=t;++u){const i=n[u];i!==void 0&&Gr(i,r)}}function wt(n,e){n.setProperty("text-align",e)}const uf="40px";function Za(n,e){const t=gt.theme.indent;if(typeof t=="string"){const u=n.classList.contains(t);e>0&&!u?n.classList.add(t):e<1&&u&&n.classList.remove(t)}const r=getComputedStyle(n).getPropertyValue("--lexical-indent-base-value")||uf;n.style.setProperty("padding-inline-start",e===0?"":`calc(${e} * ${r})`)}function Qa(n,e){const t=n.style;e===0?wt(t,""):e===Vi?wt(t,"left"):e===Gi?wt(t,"center"):e===Ki?wt(t,"right"):e===Ji?wt(t,"justify"):e===Xi?wt(t,"start"):e===Zi&&wt(t,"end")}function Kr(n,e){const t=De.get(n);t===void 0&&L(60);const r=t.createDOM(gt,pe);if(function(u,i,s){const o=s._keyToDOMMap;(function(a,l,f){a[`__lexicalKey_${l._key}`]=f})(i,s,u),o.set(u,i)}(n,r,pe),M(t)?r.setAttribute("data-lexical-text","true"):te(t)&&r.setAttribute("data-lexical-decorator","true"),E(t)){const u=t.__indent,i=t.__size;if(u!==0&&Za(r,u),i!==0){const o=i-1;(function(a,l,f,h){const c=de;de="",si(a,f,0,l,f.getDOMSlot(h)),el(f,h),de=c})(Jr(t,De),o,t,r)}const s=t.__format;s!==0&&Qa(r,s),t.isInline()||Ya(null,t,r),bu(t)&&(oe+=Ze,Xe+=Ze)}else{const u=t.getTextContent();if(te(t)){const i=t.decorate(pe,gt);i!==null&&tl(n,i),r.contentEditable="false"}else M(t)&&(t.isDirectionless()||(de+=u));oe+=u,Xe+=u}return e!==null&&e.insertChild(r),us(Dn,Ln,xu,t,"created"),r}function si(n,e,t,r,u){const i=oe;oe="";let s=t;for(;s<=r;++s){Kr(n[s],u);const o=De.get(n[s]);o!==null&&M(o)&&(Fe===null&&(Fe=o.getFormat()),Oe===""&&(Oe=o.getStyle()))}bu(e)&&(oe+=Ze),u.element.__lexicalTextContent=oe,oe=i+oe}function Zs(n,e){if(n){const t=n.__last;if(t){const r=e.get(t);if(r)return pt(r)?"line-break":te(r)&&r.isInline()?"decorator":null}return"empty"}return null}function Ya(n,e,t){const r=Zs(n,Pt),u=Zs(e,De);r!==u&&e.getDOMSlot(t).setManagedLineBreak(u)}function el(n,e){const t=e.__lexicalDirTextContent||"",r=e.__lexicalDir||"";if(t!==de||r!==Or){const i=de==="",s=i?Or:(u=de,I0.test(u)?"rtl":L0.test(u)?"ltr":null);if(s!==r){const o=e.classList,a=gt.theme;let l=r!==null?a[r]:void 0,f=s!==null?a[s]:void 0;if(l!==void 0){if(typeof l=="string"){const h=jr(l);l=a[r]=h}o.remove(...l)}if(s===null||i&&s==="ltr")e.removeAttribute("dir");else{if(f!==void 0){if(typeof f=="string"){const h=jr(f);f=a[s]=h}f!==void 0&&o.add(...f)}e.dir=s}Mn||(n.getWritable().__dir=s)}Or=s,e.__lexicalDirTextContent=de,e.__lexicalDir=s}var u}function sf(n,e,t){const r=de;var u;de="",Fe=null,Oe="",function(i,s,o){const a=oe,l=i.__size,f=s.__size;oe="";const h=o.element;if(l===1&&f===1){const c=i.__first,d=s.__first;if(c===d)vn(c,h);else{const m=oi(c),g=Kr(d,null);try{h.replaceChild(g,m)}catch(y){if(typeof y=="object"&&y!=null){const b=`${y.toString()} Parent: ${h.tagName}, new child: {tag: ${g.tagName} key: ${d}}, old child: {tag: ${m.tagName}, key: ${c}}.`;throw new Error(b)}throw y}Gr(c,null)}const p=De.get(d);M(p)&&(Fe===null&&(Fe=p.getFormat()),Oe===""&&(Oe=p.getStyle()))}else{const c=Jr(i,Pt),d=Jr(s,De);if(c.length!==l&&L(227),d.length!==f&&L(228),l===0)f!==0&&si(d,s,0,f-1,o);else if(f===0){if(l!==0){const p=o.after==null&&o.before==null&&o.element.__lexicalLineBreak==null;ii(c,0,l-1,p?null:h),p&&(h.textContent="")}}else(function(p,m,g,y,b,_){const w=y-1,T=b-1;let S,P,C=_.getFirstChild(),D=0,q=0;for(;D<=w&&q<=T;){const A=m[D],B=g[q];if(A===B)C=$u(vn(B,_.element)),D++,q++;else{S===void 0&&(S=new Set(m)),P===void 0&&(P=new Set(g));const O=P.has(A),k=S.has(B);if(O)if(k){const F=Hr(pe,B);F===C?C=$u(vn(B,_.element)):(_.withBefore(C).insertChild(F),vn(B,_.element)),D++,q++}else Kr(B,_.withBefore(C)),q++;else C=$u(oi(A)),Gr(A,_.element),D++}const x=De.get(B);x!==null&&M(x)&&(Fe===null&&(Fe=x.getFormat()),Oe===""&&(Oe=x.getStyle()))}const v=D>w,N=q>T;if(v&&!N){const A=g[T+1],B=A===void 0?null:pe.getElementByKey(A);si(g,p,q,T,_.withBefore(B))}else N&&!v&&ii(m,D,w,_.element)})(s,c,d,l,f,o)}bu(s)&&(oe+=Ze),h.__lexicalTextContent=oe,oe=a+oe}(n,e,e.getDOMSlot(t)),el(e,t),tn(u=e)&&Fe!=null&&Fe!==u.__textFormat&&!Mn&&(u.setTextFormat(Fe),u.setTextStyle(Oe)),function(i){tn(i)&&Oe!==""&&Oe!==i.__textStyle&&!Mn&&i.setTextStyle(Oe)}(e),de=r}function Jr(n,e){const t=[];let r=n.__first;for(;r!==null;){const u=e.get(r);u===void 0&&L(101),t.push(r),r=u.__next}return t}function vn(n,e){const t=Pt.get(n);let r=De.get(n);t!==void 0&&r!==void 0||L(61);const u=Xa||ri.has(n)||ni.has(n),i=Hr(pe,n);if(t===r&&!u){if(E(t)){const s=i.__lexicalTextContent;s!==void 0&&(oe+=s,Xe+=s);const o=i.__lexicalDirTextContent;o!==void 0&&(de+=o)}else{const s=t.getTextContent();M(t)&&!t.isDirectionless()&&(de+=s),Xe+=s,oe+=s}return i}if(t!==r&&u&&us(Dn,Ln,xu,r,"updated"),r.updateDOM(t,i,gt)){const s=Kr(n,null);return e===null&&L(62),e.replaceChild(s,i),Gr(n,null),s}if(E(t)&&E(r)){const s=r.__indent;s!==t.__indent&&Za(i,s);const o=r.__format;o!==t.__format&&Qa(i,o),u&&(sf(t,r,i),he(r)||r.isInline()||Ya(t,r,i)),bu(r)&&(oe+=Ze,Xe+=Ze)}else{const s=r.getTextContent();if(te(r)){const o=r.decorate(pe,gt);o!==null&&tl(n,o)}else M(r)&&!r.isDirectionless()&&(de+=s);oe+=s,Xe+=s}if(!Mn&&he(r)&&r.__cachedText!==Xe){const s=r.getWritable();s.__cachedText=Xe,r=s}return i}function tl(n,e){let t=pe._pendingDecorators;const r=pe._decorators;if(t===null){if(r[n]===e)return;t=za(pe)}t[n]=e}function $u(n){let e=n.nextSibling;return e!==null&&e===pe._blockCursorElement&&(e=e.nextSibling),e}function of(n,e,t,r,u,i){oe="",Xe="",de="",Xa=r===Yt,Or=null,pe=t,gt=t._config,Ln=t._nodes,xu=pe._listeners.mutation,ni=u,ri=i,Pt=n._nodeMap,De=e._nodeMap,Mn=e._readOnly,ui=new Map(t._keyToDOMMap);const s=new Map;return Dn=s,vn("root",null),pe=void 0,Ln=void 0,ni=void 0,ri=void 0,Pt=void 0,De=void 0,gt=void 0,ui=void 0,Dn=void 0,s}function oi(n){const e=ui.get(n);return e===void 0&&L(75,n),e}const Ve=Object.freeze({}),ai=30,li=[["keydown",function(n,e){if(Tn=n.timeStamp,nl=n.key,e.isComposing())return;const{key:t,shiftKey:r,ctrlKey:u,metaKey:i,altKey:s}=n;if(!R(e,c0,n)&&t!=null){if(function(o,a,l,f){return Hs(o)&&!a&&!f&&!l}(t,u,s,i))R(e,wa,n);else if(function(o,a,l,f,h){return Hs(o)&&!f&&!l&&(a||h)}(t,u,r,s,i))R(e,f0,n);else if(function(o,a,l,f){return Ws(o)&&!a&&!f&&!l}(t,u,s,i))R(e,Sa,n);else if(function(o,a,l,f,h){return Ws(o)&&!f&&!l&&(a||h)}(t,u,r,s,i))R(e,d0,n);else if(function(o,a,l){return function(f){return f==="ArrowUp"}(o)&&!a&&!l}(t,u,i))R(e,Ta,n);else if(function(o,a,l){return function(f){return f==="ArrowDown"}(o)&&!a&&!l}(t,u,i))R(e,Ca,n);else if(function(o,a){return Vs(o)&&a}(t,r))Cn=!0,R(e,Br,n);else if(function(o){return o===" "}(t))R(e,h0,n);else if(function(o,a){return Ae&&a&&o.toLowerCase()==="o"}(t,u))n.preventDefault(),Cn=!0,R(e,Jt,!0);else if(function(o,a){return Vs(o)&&!a}(t,r))Cn=!1,R(e,Br,n);else if(function(o,a,l,f){return Ae?!a&&!l&&(hn(o)||o.toLowerCase()==="h"&&f):!(f||a||l)&&hn(o)}(t,s,i,u))hn(t)?R(e,Ea,n):(n.preventDefault(),R(e,Nt,!0));else if(function(o){return o==="Escape"}(t))R(e,Na,n);else if(function(o,a,l,f,h){return Ae?!(l||f||h)&&(pn(o)||o.toLowerCase()==="d"&&a):!(a||f||h)&&pn(o)}(t,u,r,s,i))pn(t)?R(e,ka,n):(n.preventDefault(),R(e,Nt,!1));else if(function(o,a,l){return hn(o)&&(Ae?a:l)}(t,s,u))n.preventDefault(),R(e,On,!0);else if(function(o,a,l){return pn(o)&&(Ae?a:l)}(t,s,u))n.preventDefault(),R(e,On,!1);else if(function(o,a){return Ae&&a&&hn(o)}(t,i))n.preventDefault(),R(e,Pn,!0);else if(function(o,a){return Ae&&a&&pn(o)}(t,i))n.preventDefault(),R(e,Pn,!1);else if(function(o,a,l,f){return o.toLowerCase()==="b"&&!a&&_n(l,f)}(t,s,i,u))n.preventDefault(),R(e,Ue,"bold");else if(function(o,a,l,f){return o.toLowerCase()==="u"&&!a&&_n(l,f)}(t,s,i,u))n.preventDefault(),R(e,Ue,"underline");else if(function(o,a,l,f){return o.toLowerCase()==="i"&&!a&&_n(l,f)}(t,s,i,u))n.preventDefault(),R(e,Ue,"italic");else if(function(o,a,l,f){return o==="Tab"&&!a&&!l&&!f}(t,s,u,i))R(e,p0,n);else if(function(o,a,l,f){return o.toLowerCase()==="z"&&!a&&_n(l,f)}(t,r,i,u))n.preventDefault(),R(e,ji,void 0);else if(function(o,a,l,f){return Ae?o.toLowerCase()==="z"&&l&&a:o.toLowerCase()==="y"&&f||o.toLowerCase()==="z"&&f&&a}(t,r,i,u))n.preventDefault(),R(e,Ui,void 0);else{const o=e._editorState._selection;o===null||I(o)?!ht&&Gs(t,i,u)&&(n.preventDefault(),R(e,Yu,n)):function(a,l,f,h){return!l&&a.toLowerCase()==="c"&&(Ae?f:h)}(t,r,i,u)?(n.preventDefault(),R(e,du,n)):function(a,l,f,h){return!l&&a.toLowerCase()==="x"&&(Ae?f:h)}(t,r,i,u)?(n.preventDefault(),R(e,zi,n)):Gs(t,i,u)&&(n.preventDefault(),R(e,Yu,n))}(function(o,a,l,f){return o||a||l||f})(u,r,s,i)&&R(e,S0,n)}}],["pointerdown",function(n,e){const t=n.target,r=n.pointerType;t instanceof Node&&r!=="touch"&&Te(e,()=>{te(en(t))||(fi=!0)})}],["compositionstart",function(n,e){Te(e,()=>{const t=$();if(I(t)&&!e.isComposing()){const r=t.anchor,u=t.anchor.getNode();ce(r.key),(n.timeStamp<Tn+ai||r.type==="element"||!t.isCollapsed()||u.getFormat()!==t.format||M(u)&&u.getStyle()!==t.style)&&R(e,Xt,P0)}})}],["compositionend",function(n,e){ht?mn=!0:Te(e,()=>{Fu(e,n.data)})}],["input",function(n,e){n.stopPropagation(),Te(e,()=>{const t=$(),r=n.data,u=sl(n);if(r!=null&&I(t)&&il(t,u,r,n.timeStamp,!1)){mn&&(Fu(e,r),mn=!1);const i=t.anchor.getNode(),s=Ne(e._window);if(s===null)return;const o=t.isBackward(),a=o?t.anchor.offset:t.focus.offset,l=o?t.focus.offset:t.anchor.offset;$r&&!t.isCollapsed()&&M(i)&&s.anchorNode!==null&&i.getTextContent().slice(0,a)+r+i.getTextContent().slice(a+l)===Ga(s.anchorNode)||R(e,Xt,r);const f=r.length;ht&&f>1&&n.inputType==="insertCompositionText"&&!e.isComposing()&&(t.anchor.offset-=f),hu||Hn||Wi||!e.isComposing()||(Tn=0,ce(null))}else ns(!1,e,r!==null?r:void 0),mn&&(Fu(e,r||void 0),mn=!1);ye(),Ba(ue())}),Wt=null}],["click",function(n,e){Te(e,()=>{const t=$(),r=Ne(e._window),u=Qn();if(r){if(I(t)){const i=t.anchor,s=i.getNode();i.type==="element"&&i.offset===0&&t.isCollapsed()&&!he(s)&&ie().getChildrenSize()===1&&s.getTopLevelElementOrThrow().isEmpty()&&u!==null&&t.is(u)?(r.removeAllRanges(),t.dirty=!0):n.detail===3&&!t.isCollapsed()&&s!==t.focus.getNode()&&(E(s)?s.select(0):s.getParentOrThrow().select(0))}else if(n.pointerType==="touch"){const i=r.anchorNode;if(i!==null){const s=i.nodeType;(s===Vn||s===mt)&&Me(as(u,r,e,n))}}}R(e,va,n)})}],["cut",Ve],["copy",Ve],["dragstart",Ve],["dragover",Ve],["dragend",Ve],["paste",Ve],["focus",Ve],["blur",Ve],["drop",Ve]];$r&&li.push(["beforeinput",(n,e)=>function(t,r){const u=t.inputType,i=sl(t);u==="deleteCompositionText"||ht&&Ka(r)||u!=="insertCompositionText"&&Te(r,()=>{const s=$();if(u==="deleteContentBackward"){if(s===null){const d=Qn();if(!I(d))return;Me(d.clone())}if(I(s)){const d=s.anchor.key===s.focus.key;if(o=t.timeStamp,nl==="MediaLast"&&o<Tn+ai&&r.isComposing()&&d){if(ce(null),Tn=0,setTimeout(()=>{Te(r,()=>{ce(null)})},ai),I(s)){const p=s.anchor.getNode();p.markDirty(),s.format=p.getFormat(),M(p)||L(142),s.style=p.getStyle()}}else{ce(null),t.preventDefault();const p=s.anchor.getNode(),m=p.getTextContent(),g=p.canInsertTextAfter(),y=s.anchor.offset===0&&s.focus.offset===m.length;E0&&d&&!y&&g||R(r,Nt,!0)}return}}var o;if(!I(s))return;const a=t.data;Wt!==null&&ns(!1,r,Wt),s.dirty&&Wt===null||!s.isCollapsed()||he(s.anchor.getNode())||i===null||s.applyDOMRange(i),Wt=null;const l=s.anchor,f=s.focus,h=l.getNode(),c=f.getNode();if(u!=="insertText"&&u!=="insertTranspose")switch(t.preventDefault(),u){case"insertFromYank":case"insertFromDrop":case"insertReplacementText":R(r,Xt,t);break;case"insertFromComposition":ce(null),R(r,Xt,t);break;case"insertLineBreak":ce(null),R(r,Jt,!1);break;case"insertParagraph":ce(null),Cn&&!Hn?(Cn=!1,R(r,Jt,!1)):R(r,An,void 0);break;case"insertFromPaste":case"insertFromPasteAsQuotation":R(r,fu,t);break;case"deleteByComposition":(function(d,p){return d!==p||E(d)||E(p)||!d.isToken()||!p.isToken()})(h,c)&&R(r,Qu,t);break;case"deleteByDrag":case"deleteByCut":R(r,Qu,t);break;case"deleteContent":R(r,Nt,!1);break;case"deleteWordBackward":R(r,On,!0);break;case"deleteWordForward":R(r,On,!1);break;case"deleteHardLineBackward":case"deleteSoftLineBackward":R(r,Pn,!0);break;case"deleteContentForward":case"deleteHardLineForward":case"deleteSoftLineForward":R(r,Pn,!1);break;case"formatStrikeThrough":R(r,Ue,"strikethrough");break;case"formatBold":R(r,Ue,"bold");break;case"formatItalic":R(r,Ue,"italic");break;case"formatUnderline":R(r,Ue,"underline");break;case"historyUndo":R(r,ji,void 0);break;case"historyRedo":R(r,Ui,void 0)}else{if(a===`
|
|
4
4
|
`)t.preventDefault(),R(r,Jt,!1);else if(a===Ze)t.preventDefault(),R(r,An,void 0);else if(a==null&&t.dataTransfer){const d=t.dataTransfer.getData("text/plain");t.preventDefault(),s.insertRawText(d)}else a!=null&&il(s,i,a,t.timeStamp,!0)?(t.preventDefault(),R(r,Xt,a)):Wt=a;rl=t.timeStamp}})}(n,e)]);let Tn=0,nl=null,rl=0,Wt=null;const Xr=new WeakMap;let ci=!1,fi=!1,Cn=!1,mn=!1,ul=[0,"",0,"root",0];function il(n,e,t,r,u){const i=n.anchor,s=n.focus,o=i.getNode(),a=ue(),l=Ne(a._window),f=l!==null?l.anchorNode:null,h=i.key,c=a.getElementByKey(h),d=t.length;return h!==s.key||!M(o)||(!u&&(!$r||rl<r+50)||o.isDirty()&&d<2||Ha(t))&&i.offset!==s.offset&&!o.isComposing()||St(o)||o.isDirty()&&d>1||(u||!$r)&&c!==null&&!o.isComposing()&&f!==Ur(c)||l!==null&&e!==null&&(!e.collapsed||e.startContainer!==l.anchorNode||e.startOffset!==l.anchorOffset)||o.getFormat()!==n.format||o.getStyle()!==n.style||K0(n,o)}function Qs(n,e){return n!==null&&n.nodeValue!==null&&n.nodeType===mt&&e!==0&&e!==n.nodeValue.length}function Ys(n,e,t){const{anchorNode:r,anchorOffset:u,focusNode:i,focusOffset:s}=n;ci&&(ci=!1,Qs(r,u)&&Qs(i,s))||Te(e,()=>{if(!t)return void Me(null);if(!Gn(e,r,i))return;const o=$();if(I(o)){const a=o.anchor,l=a.getNode();if(o.isCollapsed()){n.type==="Range"&&n.anchorNode===n.focusNode&&(o.dirty=!0);const f=yu(e).event,h=f?f.timeStamp:performance.now(),[c,d,p,m,g]=ul,y=ie(),b=e.isComposing()===!1&&y.getTextContent()==="";if(h<g+200&&a.offset===p&&a.key===m)o.format=c,o.style=d;else if(a.type==="text")M(l)||L(141),o.format=l.getFormat(),o.style=l.getStyle();else if(a.type==="element"&&!b){const _=a.getNode();o.style="",_ instanceof an&&_.getChildrenSize()===0?(o.format=_.getTextFormat(),o.style=_.getTextStyle()):o.format=0}}else{const f=a.key,h=o.focus.key,c=o.getNodes(),d=c.length,p=o.isBackward(),m=p?s:u,g=p?u:s,y=p?h:f,b=p?f:h;let _=O0,w=!1;for(let T=0;T<d;T++){const S=c[T],P=S.getTextContentSize();if(M(S)&&P!==0&&!(T===0&&S.__key===y&&m===P||T===d-1&&S.__key===b&&g===0)&&(w=!0,_&=S.getFormat(),_===0))break}o.format=w?_:0}}R(e,qi,void 0)})}function sl(n){if(!n.getTargetRanges)return null;const e=n.getTargetRanges();return e.length===0?null:e[0]}function Fu(n,e){const t=n._compositionKey;if(ce(null),t!==null&&e!=null){if(e===""){const r=fe(t),u=Ur(n.getElementByKey(t));return void(u!==null&&u.nodeValue!==null&&M(r)&&rs(r,u.nodeValue,null,null,!0))}if(e[e.length-1]===`
|
|
@@ -54,5 +54,5 @@ vulnerable to XSS attacks. Please remove it from \`allowedTags\`.
|
|
|
54
54
|
Or, to disable this warning, add the \`allowVulnerableTags\` option
|
|
55
55
|
and ensure you are accounting for this risk.
|
|
56
56
|
|
|
57
|
-
`)});const o=e.nonTextTags||["script","style","textarea","option"];let a,l;e.allowedAttributes&&(a={},l={},Vt(e.allowedAttributes,function(x,O){a[O]=[];const k=[];x.forEach(function(F){typeof F=="string"&&F.indexOf("*")>=0?k.push(ya(F).replace(/\\\*/g,".*")):a[O].push(F)}),k.length&&(l[O]=new RegExp("^("+k.join("|")+")$"))}));const f={},h={},c={};Vt(e.allowedClasses,function(x,O){if(a&&(Je(a,O)||(a[O]=[]),a[O].push("class")),f[O]=x,Array.isArray(x)){const k=[];f[O]=[],c[O]=[],x.forEach(function(F){typeof F=="string"&&F.indexOf("*")>=0?k.push(ya(F).replace(/\\\*/g,".*")):F instanceof RegExp?c[O].push(F):f[O].push(F)}),k.length&&(h[O]=new RegExp("^("+k.join("|")+")$"))}});const d={};let p;Vt(e.transformTags,function(x,O){let k;typeof x=="function"?k=x:typeof x=="string"&&(k=zn.simpleTransform(x)),O==="*"?p=k:d[O]=k});let m,g,y,b,_,w,T=!1;P();const S=new pg.Parser({onopentag:function(x,O){if(e.onOpenTag&&e.onOpenTag(x,O),e.enforceHtmlBoundary&&x==="html"&&P(),_){w++;return}const k=new i(x,O);g.push(k);let F=!1;const Y=!!k.text;let ne;if(Je(d,x)&&(ne=d[x](x,O),k.attribs=O=ne.attribs,ne.text!==void 0&&(k.innerText=ne.text),x!==ne.tagName&&(k.name=x=ne.tagName,b[m]=ne.tagName)),p&&(ne=p(x,O),k.attribs=O=ne.attribs,x!==ne.tagName&&(k.name=x=ne.tagName,b[m]=ne.tagName)),(!s(x)||e.disallowedTagsMode==="recursiveEscape"&&!_g(y)||e.nestingLimit!=null&&m>=e.nestingLimit)&&(F=!0,y[m]=!0,(e.disallowedTagsMode==="discard"||e.disallowedTagsMode==="completelyDiscard")&&o.indexOf(x)!==-1&&(_=!0,w=1)),m++,F){if(e.disallowedTagsMode==="discard"||e.disallowedTagsMode==="completelyDiscard"){if(k.innerText&&!Y){const X=C(k.innerText);e.textFilter?r+=e.textFilter(X,x):r+=X,T=!0}return}u=r,r=""}r+="<"+x,x==="script"&&(e.allowedScriptHostnames||e.allowedScriptDomains)&&(k.innerText=""),F&&(e.disallowedTagsMode==="escape"||e.disallowedTagsMode==="recursiveEscape")&&e.preserveEscapedAttributes?Vt(O,function(X,G){r+=" "+G+'="'+C(X||"",!0)+'"'}):(!a||Je(a,x)||a["*"])&&Vt(O,function(X,G){if(!Sg.test(G)){delete k.attribs[G];return}if(X===""&&!e.allowedEmptyAttributes.includes(G)&&(e.nonBooleanAttributes.includes(G)||e.nonBooleanAttributes.includes("*"))){delete k.attribs[G];return}let it=!1;if(!a||Je(a,x)&&a[x].indexOf(G)!==-1||a["*"]&&a["*"].indexOf(G)!==-1||Je(l,x)&&l[x].test(G)||l["*"]&&l["*"].test(G))it=!0;else if(a&&a[x]){for(const W of a[x])if(gg(W)&&W.name&&W.name===G){it=!0;let J="";if(W.multiple===!0){const we=X.split(" ");for(const ge of we)W.values.indexOf(ge)!==-1&&(J===""?J=ge:J+=" "+ge)}else W.values.indexOf(X)>=0&&(J=X);X=J}}if(it){if(e.allowedSchemesAppliedToAttributes.indexOf(G)!==-1&&D(x,X)){delete k.attribs[G];return}if(x==="script"&&G==="src"){let W=!0;try{const J=q(X);if(e.allowedScriptHostnames||e.allowedScriptDomains){const we=(e.allowedScriptHostnames||[]).find(function(me){return me===J.url.hostname}),ge=(e.allowedScriptDomains||[]).find(function(me){return J.url.hostname===me||J.url.hostname.endsWith(`.${me}`)});W=we||ge}}catch{W=!1}if(!W){delete k.attribs[G];return}}if(x==="iframe"&&G==="src"){let W=!0;try{const J=q(X);if(J.isRelativeUrl)W=Je(e,"allowIframeRelativeUrls")?e.allowIframeRelativeUrls:!e.allowedIframeHostnames&&!e.allowedIframeDomains;else if(e.allowedIframeHostnames||e.allowedIframeDomains){const we=(e.allowedIframeHostnames||[]).find(function(me){return me===J.url.hostname}),ge=(e.allowedIframeDomains||[]).find(function(me){return J.url.hostname===me||J.url.hostname.endsWith(`.${me}`)});W=we||ge}}catch{W=!1}if(!W){delete k.attribs[G];return}}if(G==="srcset")try{let W=mg(X);if(W.forEach(function(J){D("srcset",J.url)&&(J.evil=!0)}),W=_a(W,function(J){return!J.evil}),W.length)X=vg(_a(W,function(J){return!J.evil})),k.attribs[G]=X;else{delete k.attribs[G];return}}catch{delete k.attribs[G];return}if(G==="class"){const W=f[x],J=f["*"],we=h[x],ge=c[x],me=c["*"],i0=h["*"],Ds=[we,i0].concat(ge,me).filter(function(s0){return s0});if(W&&J?X=B(X,xa(W,J),Ds):X=B(X,W||J,Ds),!X.length){delete k.attribs[G];return}}if(G==="style"){if(e.parseStyleAttributes)try{const W=bg(x+" {"+X+"}",{map:!1}),J=v(W,e.allowedStyles);if(X=N(J),X.length===0){delete k.attribs[G];return}}catch{typeof window<"u"&&console.warn('Failed to parse "'+x+" {"+X+`}", If you're running this in a browser, we recommend to disable style parsing: options.parseStyleAttributes: false, since this only works in a node environment due to a postcss dependency, More info: https://github.com/apostrophecms/sanitize-html/issues/547`),delete k.attribs[G];return}else if(e.allowedStyles)throw new Error("allowedStyles option cannot be used together with parseStyleAttributes: false.")}r+=" "+G,X&&X.length?r+='="'+C(X,!0)+'"':e.allowedEmptyAttributes.includes(G)&&(r+='=""')}else delete k.attribs[G]}),e.selfClosing.indexOf(x)!==-1?r+=" />":(r+=">",k.innerText&&!Y&&!e.textFilter&&(r+=C(k.innerText),T=!0)),F&&(r=u+C(r),u=""),k.openingTagLength=r.length-k.tagPosition},ontext:function(x){if(_)return;const O=g[g.length-1];let k;if(O&&(k=O.tag,x=O.innerText!==void 0?O.innerText:x),e.disallowedTagsMode==="completelyDiscard"&&!s(k))x="";else if((e.disallowedTagsMode==="discard"||e.disallowedTagsMode==="completelyDiscard")&&(k==="script"||k==="style"))r+=x;else if(!T){const F=C(x,!1);e.textFilter?r+=e.textFilter(F,k):r+=F}if(g.length){const F=g[g.length-1];F.text+=x}},onclosetag:function(x,O){if(e.onCloseTag&&e.onCloseTag(x,O),_)if(w--,!w)_=!1;else return;const k=g.pop();if(!k)return;if(k.tag!==x){g.push(k);return}_=e.enforceHtmlBoundary?x==="html":!1,m--;const F=y[m];if(F){if(delete y[m],e.disallowedTagsMode==="discard"||e.disallowedTagsMode==="completelyDiscard"){k.updateParentNodeText();return}u=r,r=""}if(b[m]&&(x=b[m],delete b[m]),e.exclusiveFilter){const Y=e.exclusiveFilter(k);if(Y==="excludeTag"){F&&(r=u,u=""),r=r.substring(0,k.tagPosition)+r.substring(k.tagPosition+k.openingTagLength);return}else if(Y){r=r.substring(0,k.tagPosition);return}}if(k.updateParentNodeMediaChildren(),k.updateParentNodeText(),e.selfClosing.indexOf(x)!==-1||O&&!s(x)&&["escape","recursiveEscape"].indexOf(e.disallowedTagsMode)>=0){F&&(r=u,u="");return}r+="</"+x+">",F&&(r=u+C(r),u=""),T=!1}},e.parser);return S.write(n),S.end(),r;function P(){r="",m=0,g=[],y={},b={},_=!1,w=0}function C(x,O){return typeof x!="string"&&(x=x+""),e.parser.decodeEntities&&(x=x.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">"),O&&(x=x.replace(/"/g,"""))),x=x.replace(/&(?![a-zA-Z0-9#]{1,20};)/g,"&").replace(/</g,"<").replace(/>/g,">"),O&&(x=x.replace(/"/g,""")),x}function D(x,O){for(O=O.replace(/[\x00-\x20]+/g,"");;){const Y=O.indexOf("<!--");if(Y===-1)break;const ne=O.indexOf("-->",Y+4);if(ne===-1)break;O=O.substring(0,Y)+O.substring(ne+3)}const k=O.match(/^([a-zA-Z][a-zA-Z0-9.\-+]*):/);if(!k)return O.match(/^[/\\]{2}/)?!e.allowProtocolRelative:!1;const F=k[1].toLowerCase();return Je(e.allowedSchemesByTag,x)?e.allowedSchemesByTag[x].indexOf(F)===-1:!e.allowedSchemes||e.allowedSchemes.indexOf(F)===-1}function q(x){if(x=x.replace(/^(\w+:)?\s*[\\/]\s*[\\/]/,"$1//"),x.startsWith("relative:"))throw new Error("relative: exploit attempt");let O="relative://relative-site";for(let Y=0;Y<100;Y++)O+=`/${Y}`;const k=new URL(x,O);return{isRelativeUrl:k&&k.hostname==="relative-site"&&k.protocol==="relative:",url:k}}function v(x,O){if(!O)return x;const k=x.nodes[0];let F;return O[k.selector]&&O["*"]?F=xa(O[k.selector],O["*"]):F=O[k.selector]||O["*"],F&&(x.nodes[0].nodes=k.nodes.reduce(A(F),[])),x}function N(x){return x.nodes[0].nodes.reduce(function(O,k){return O.push(`${k.prop}:${k.value}${k.important?" !important":""}`),O},[]).join(";")}function A(x){return function(O,k){return Je(x,k.prop)&&x[k.prop].some(function(Y){return Y.test(k.value)})&&O.push(k),O}}function B(x,O,k){return O?(x=x.split(/\s+/),x.filter(function(F){return O.indexOf(F)!==-1||k.some(function(Y){return Y.test(F)})}).join(" ")):x}}const Tg={decodeEntities:!0};zn.defaults={allowedTags:["address","article","aside","footer","header","h1","h2","h3","h4","h5","h6","hgroup","main","nav","section","blockquote","dd","div","dl","dt","figcaption","figure","hr","li","menu","ol","p","pre","ul","a","abbr","b","bdi","bdo","br","cite","code","data","dfn","em","i","kbd","mark","q","rb","rp","rt","rtc","ruby","s","samp","small","span","strong","sub","sup","time","u","var","wbr","caption","col","colgroup","table","tbody","td","tfoot","th","thead","tr"],nonBooleanAttributes:["abbr","accept","accept-charset","accesskey","action","allow","alt","as","autocapitalize","autocomplete","blocking","charset","cite","class","color","cols","colspan","content","contenteditable","coords","crossorigin","data","datetime","decoding","dir","dirname","download","draggable","enctype","enterkeyhint","fetchpriority","for","form","formaction","formenctype","formmethod","formtarget","headers","height","hidden","high","href","hreflang","http-equiv","id","imagesizes","imagesrcset","inputmode","integrity","is","itemid","itemprop","itemref","itemtype","kind","label","lang","list","loading","low","max","maxlength","media","method","min","minlength","name","nonce","optimum","pattern","ping","placeholder","popover","popovertarget","popovertargetaction","poster","preload","referrerpolicy","rel","rows","rowspan","sandbox","scope","shape","size","sizes","slot","span","spellcheck","src","srcdoc","srclang","srcset","start","step","style","tabindex","target","title","translate","type","usemap","value","width","wrap","onauxclick","onafterprint","onbeforematch","onbeforeprint","onbeforeunload","onbeforetoggle","onblur","oncancel","oncanplay","oncanplaythrough","onchange","onclick","onclose","oncontextlost","oncontextmenu","oncontextrestored","oncopy","oncuechange","oncut","ondblclick","ondrag","ondragend","ondragenter","ondragleave","ondragover","ondragstart","ondrop","ondurationchange","onemptied","onended","onerror","onfocus","onformdata","onhashchange","oninput","oninvalid","onkeydown","onkeypress","onkeyup","onlanguagechange","onload","onloadeddata","onloadedmetadata","onloadstart","onmessage","onmessageerror","onmousedown","onmouseenter","onmouseleave","onmousemove","onmouseout","onmouseover","onmouseup","onoffline","ononline","onpagehide","onpageshow","onpaste","onpause","onplay","onplaying","onpopstate","onprogress","onratechange","onreset","onresize","onrejectionhandled","onscroll","onscrollend","onsecuritypolicyviolation","onseeked","onseeking","onselect","onslotchange","onstalled","onstorage","onsubmit","onsuspend","ontimeupdate","ontoggle","onunhandledrejection","onunload","onvolumechange","onwaiting","onwheel"],disallowedTagsMode:"discard",allowedAttributes:{a:["href","name","target"],img:["src","srcset","alt","title","width","height","loading"]},allowedEmptyAttributes:["alt"],selfClosing:["img","br","hr","area","base","basefont","input","link","meta"],allowedSchemes:["http","https","ftp","mailto","tel"],allowedSchemesByTag:{},allowedSchemesAppliedToAttributes:["href","src","cite"],allowProtocolRelative:!0,enforceHtmlBoundary:!1,parseStyleAttributes:!0,preserveEscapedAttributes:!1};zn.simpleTransform=function(n,e,t){return t=t===void 0?!0:t,e=e||{},function(r,u){let i;if(t)for(i in e)u[i]=e[i];else u=e;return{tagName:n,attribs:u}}};const Cg=eh(wg),Eg="_editor_17n1f_1",Ng="_toolbar_17n1f_11",kg="_active_17n1f_32",Ag="_bold_17n1f_37",Og="_italic_17n1f_41",Pg="_link_17n1f_45",Ig="_list_17n1f_51",Lg="_paragraph_17n1f_52",Se={editor:Eg,toolbar:Ng,active:kg,bold:Ag,italic:Og,link:Pg,list:Ig,paragraph:Lg},Dg=()=>{const[n]=ke(),[e,t]=U.useState(!1),[r,u]=U.useState(!1),[i,s]=U.useState(!1),[o,a]=U.useState(!1),[l,f]=U.useState(""),h=U.useRef(null),c=()=>{n.dispatchCommand(Qt,{url:l,target:"_blank"})},d=U.useCallback(()=>{const p=$();if(I(p)){const m=p.getNodes();t(p.hasFormat("bold")),u(p.hasFormat("italic")),m.every(g=>{const y=g.getParent();a(K(y)||re(y)),Tt(y)?(s(!0),f(y.getURL())):(s(!1),f(""))})}},[]);return U.useEffect(()=>nt(n.registerUpdateListener(({editorState:p})=>{p.read(()=>{d()})})),[n,d]),V.jsxs("div",{className:Se.toolbar,children:[V.jsx(cr.Button,{className:dn.t(e&&Se.active),onClick:()=>{n.dispatchCommand(Ue,"bold")},title:"Bold",variant:"minimal",children:V.jsx(fr.Icon,{name:"bold"})}),V.jsx(cr.Button,{className:dn.t(r&&Se.active),onClick:()=>{n.dispatchCommand(Ue,"italic")},title:"Italic",variant:"minimal",children:V.jsx(fr.Icon,{name:"italic"})}),V.jsx(cr.Button,{className:dn.t(o&&Se.active),onClick:()=>{o?n.dispatchCommand($l,void 0):n.dispatchCommand(Bl,void 0)},title:"List",variant:"minimal",children:V.jsx(fr.Icon,{name:"list"})}),V.jsx(cr.Button,{className:dn.t(i&&Se.active),onClick:()=>{i?n.dispatchCommand(Qt,null):(n.dispatchCommand(Qt,{url:"https://"}),setTimeout(()=>h.current.focus(),0))},title:"Link",variant:"minimal",children:V.jsx(fr.Icon,{name:"link"})}),V.jsx(o0.Input,{className:dn.t(i&&Se.active),onBlur:()=>c(),onChange:p=>f(p.target.value),onKeyDown:p=>{p.key==="Enter"&&(p.preventDefault(),c())},ref:h,value:l})]})},Mg=/(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))/,Rg=/((https?:\/\/(www\.)?)|(www\.))[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_+.~#?&//=]*)/,Bg=[n=>{const e=Mg.exec(n);return e!=null&&e.length?{index:e.index,length:e[0].length,text:e[0],url:`mailto:${e[0]}`}:null},n=>{const e=Rg.exec(n);return e!=null&&e.length?{index:e.index,length:e[0].length,text:e[0],url:e[0].startsWith("http")?e[0]:`https://${e[0]}`}:null}];function $g(n){try{const e=new URL(n);return e.protocol==="http:"||e.protocol==="https:"}catch{return!1}}function Fg({content:n}){const[e]=ke();return U.useEffect(()=>{e.update(()=>{const r=new DOMParser().parseFromString(n??"","text/html"),u=Nl(e,r);ie().clear().select(),pl(u),Me(null)})},[e,n]),null}const qg=({autofocus:n=!1,autolink:e=!1,content:t,inline:r=!1,onChange:u})=>{const i={namespace:"Editor",theme:{link:Se.link,list:{ol:Se.list,ul:Se.list},paragraph:Se.paragraph,text:{bold:Se.bold,italic:Se.italic}},onError(s){throw s},nodes:[Cu,tr,ln,nr]};return V.jsx("div",{className:Se.editor,children:V.jsxs(cd,{initialConfig:i,children:[!r&&V.jsx(Dg,{}),V.jsx(Qd,{contentEditable:V.jsx(bd,{}),ErrorBoundary:vd}),n&&V.jsx(ed,{}),e&&V.jsx(ad,{matchers:Bg}),V.jsx(Ad,{}),t&&V.jsx(Fg,{content:t}),V.jsx(Od,{validateUrl:$g}),V.jsx(Pd,{}),u&&V.jsx(Ld,{onChange:(s,o)=>{s.read(()=>{const a=kl(o,null),l=Cg(a,{allowedTags:["a","b","br","i","li","ol","p","ul"]});u(l)})}})]})})};exports.Editor=qg;
|
|
57
|
+
`)});const o=e.nonTextTags||["script","style","textarea","option"];let a,l;e.allowedAttributes&&(a={},l={},Vt(e.allowedAttributes,function(x,O){a[O]=[];const k=[];x.forEach(function(F){typeof F=="string"&&F.indexOf("*")>=0?k.push(ya(F).replace(/\\\*/g,".*")):a[O].push(F)}),k.length&&(l[O]=new RegExp("^("+k.join("|")+")$"))}));const f={},h={},c={};Vt(e.allowedClasses,function(x,O){if(a&&(Je(a,O)||(a[O]=[]),a[O].push("class")),f[O]=x,Array.isArray(x)){const k=[];f[O]=[],c[O]=[],x.forEach(function(F){typeof F=="string"&&F.indexOf("*")>=0?k.push(ya(F).replace(/\\\*/g,".*")):F instanceof RegExp?c[O].push(F):f[O].push(F)}),k.length&&(h[O]=new RegExp("^("+k.join("|")+")$"))}});const d={};let p;Vt(e.transformTags,function(x,O){let k;typeof x=="function"?k=x:typeof x=="string"&&(k=zn.simpleTransform(x)),O==="*"?p=k:d[O]=k});let m,g,y,b,_,w,T=!1;P();const S=new pg.Parser({onopentag:function(x,O){if(e.onOpenTag&&e.onOpenTag(x,O),e.enforceHtmlBoundary&&x==="html"&&P(),_){w++;return}const k=new i(x,O);g.push(k);let F=!1;const Y=!!k.text;let ne;if(Je(d,x)&&(ne=d[x](x,O),k.attribs=O=ne.attribs,ne.text!==void 0&&(k.innerText=ne.text),x!==ne.tagName&&(k.name=x=ne.tagName,b[m]=ne.tagName)),p&&(ne=p(x,O),k.attribs=O=ne.attribs,x!==ne.tagName&&(k.name=x=ne.tagName,b[m]=ne.tagName)),(!s(x)||e.disallowedTagsMode==="recursiveEscape"&&!_g(y)||e.nestingLimit!=null&&m>=e.nestingLimit)&&(F=!0,y[m]=!0,(e.disallowedTagsMode==="discard"||e.disallowedTagsMode==="completelyDiscard")&&o.indexOf(x)!==-1&&(_=!0,w=1)),m++,F){if(e.disallowedTagsMode==="discard"||e.disallowedTagsMode==="completelyDiscard"){if(k.innerText&&!Y){const X=C(k.innerText);e.textFilter?r+=e.textFilter(X,x):r+=X,T=!0}return}u=r,r=""}r+="<"+x,x==="script"&&(e.allowedScriptHostnames||e.allowedScriptDomains)&&(k.innerText=""),F&&(e.disallowedTagsMode==="escape"||e.disallowedTagsMode==="recursiveEscape")&&e.preserveEscapedAttributes?Vt(O,function(X,G){r+=" "+G+'="'+C(X||"",!0)+'"'}):(!a||Je(a,x)||a["*"])&&Vt(O,function(X,G){if(!Sg.test(G)){delete k.attribs[G];return}if(X===""&&!e.allowedEmptyAttributes.includes(G)&&(e.nonBooleanAttributes.includes(G)||e.nonBooleanAttributes.includes("*"))){delete k.attribs[G];return}let it=!1;if(!a||Je(a,x)&&a[x].indexOf(G)!==-1||a["*"]&&a["*"].indexOf(G)!==-1||Je(l,x)&&l[x].test(G)||l["*"]&&l["*"].test(G))it=!0;else if(a&&a[x]){for(const W of a[x])if(gg(W)&&W.name&&W.name===G){it=!0;let J="";if(W.multiple===!0){const we=X.split(" ");for(const ge of we)W.values.indexOf(ge)!==-1&&(J===""?J=ge:J+=" "+ge)}else W.values.indexOf(X)>=0&&(J=X);X=J}}if(it){if(e.allowedSchemesAppliedToAttributes.indexOf(G)!==-1&&D(x,X)){delete k.attribs[G];return}if(x==="script"&&G==="src"){let W=!0;try{const J=q(X);if(e.allowedScriptHostnames||e.allowedScriptDomains){const we=(e.allowedScriptHostnames||[]).find(function(me){return me===J.url.hostname}),ge=(e.allowedScriptDomains||[]).find(function(me){return J.url.hostname===me||J.url.hostname.endsWith(`.${me}`)});W=we||ge}}catch{W=!1}if(!W){delete k.attribs[G];return}}if(x==="iframe"&&G==="src"){let W=!0;try{const J=q(X);if(J.isRelativeUrl)W=Je(e,"allowIframeRelativeUrls")?e.allowIframeRelativeUrls:!e.allowedIframeHostnames&&!e.allowedIframeDomains;else if(e.allowedIframeHostnames||e.allowedIframeDomains){const we=(e.allowedIframeHostnames||[]).find(function(me){return me===J.url.hostname}),ge=(e.allowedIframeDomains||[]).find(function(me){return J.url.hostname===me||J.url.hostname.endsWith(`.${me}`)});W=we||ge}}catch{W=!1}if(!W){delete k.attribs[G];return}}if(G==="srcset")try{let W=mg(X);if(W.forEach(function(J){D("srcset",J.url)&&(J.evil=!0)}),W=_a(W,function(J){return!J.evil}),W.length)X=vg(_a(W,function(J){return!J.evil})),k.attribs[G]=X;else{delete k.attribs[G];return}}catch{delete k.attribs[G];return}if(G==="class"){const W=f[x],J=f["*"],we=h[x],ge=c[x],me=c["*"],i0=h["*"],Ds=[we,i0].concat(ge,me).filter(function(s0){return s0});if(W&&J?X=B(X,xa(W,J),Ds):X=B(X,W||J,Ds),!X.length){delete k.attribs[G];return}}if(G==="style"){if(e.parseStyleAttributes)try{const W=bg(x+" {"+X+"}",{map:!1}),J=v(W,e.allowedStyles);if(X=N(J),X.length===0){delete k.attribs[G];return}}catch{typeof window<"u"&&console.warn('Failed to parse "'+x+" {"+X+`}", If you're running this in a browser, we recommend to disable style parsing: options.parseStyleAttributes: false, since this only works in a node environment due to a postcss dependency, More info: https://github.com/apostrophecms/sanitize-html/issues/547`),delete k.attribs[G];return}else if(e.allowedStyles)throw new Error("allowedStyles option cannot be used together with parseStyleAttributes: false.")}r+=" "+G,X&&X.length?r+='="'+C(X,!0)+'"':e.allowedEmptyAttributes.includes(G)&&(r+='=""')}else delete k.attribs[G]}),e.selfClosing.indexOf(x)!==-1?r+=" />":(r+=">",k.innerText&&!Y&&!e.textFilter&&(r+=C(k.innerText),T=!0)),F&&(r=u+C(r),u=""),k.openingTagLength=r.length-k.tagPosition},ontext:function(x){if(_)return;const O=g[g.length-1];let k;if(O&&(k=O.tag,x=O.innerText!==void 0?O.innerText:x),e.disallowedTagsMode==="completelyDiscard"&&!s(k))x="";else if((e.disallowedTagsMode==="discard"||e.disallowedTagsMode==="completelyDiscard")&&(k==="script"||k==="style"))r+=x;else if(!T){const F=C(x,!1);e.textFilter?r+=e.textFilter(F,k):r+=F}if(g.length){const F=g[g.length-1];F.text+=x}},onclosetag:function(x,O){if(e.onCloseTag&&e.onCloseTag(x,O),_)if(w--,!w)_=!1;else return;const k=g.pop();if(!k)return;if(k.tag!==x){g.push(k);return}_=e.enforceHtmlBoundary?x==="html":!1,m--;const F=y[m];if(F){if(delete y[m],e.disallowedTagsMode==="discard"||e.disallowedTagsMode==="completelyDiscard"){k.updateParentNodeText();return}u=r,r=""}if(b[m]&&(x=b[m],delete b[m]),e.exclusiveFilter){const Y=e.exclusiveFilter(k);if(Y==="excludeTag"){F&&(r=u,u=""),r=r.substring(0,k.tagPosition)+r.substring(k.tagPosition+k.openingTagLength);return}else if(Y){r=r.substring(0,k.tagPosition);return}}if(k.updateParentNodeMediaChildren(),k.updateParentNodeText(),e.selfClosing.indexOf(x)!==-1||O&&!s(x)&&["escape","recursiveEscape"].indexOf(e.disallowedTagsMode)>=0){F&&(r=u,u="");return}r+="</"+x+">",F&&(r=u+C(r),u=""),T=!1}},e.parser);return S.write(n),S.end(),r;function P(){r="",m=0,g=[],y={},b={},_=!1,w=0}function C(x,O){return typeof x!="string"&&(x=x+""),e.parser.decodeEntities&&(x=x.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">"),O&&(x=x.replace(/"/g,"""))),x=x.replace(/&(?![a-zA-Z0-9#]{1,20};)/g,"&").replace(/</g,"<").replace(/>/g,">"),O&&(x=x.replace(/"/g,""")),x}function D(x,O){for(O=O.replace(/[\x00-\x20]+/g,"");;){const Y=O.indexOf("<!--");if(Y===-1)break;const ne=O.indexOf("-->",Y+4);if(ne===-1)break;O=O.substring(0,Y)+O.substring(ne+3)}const k=O.match(/^([a-zA-Z][a-zA-Z0-9.\-+]*):/);if(!k)return O.match(/^[/\\]{2}/)?!e.allowProtocolRelative:!1;const F=k[1].toLowerCase();return Je(e.allowedSchemesByTag,x)?e.allowedSchemesByTag[x].indexOf(F)===-1:!e.allowedSchemes||e.allowedSchemes.indexOf(F)===-1}function q(x){if(x=x.replace(/^(\w+:)?\s*[\\/]\s*[\\/]/,"$1//"),x.startsWith("relative:"))throw new Error("relative: exploit attempt");let O="relative://relative-site";for(let Y=0;Y<100;Y++)O+=`/${Y}`;const k=new URL(x,O);return{isRelativeUrl:k&&k.hostname==="relative-site"&&k.protocol==="relative:",url:k}}function v(x,O){if(!O)return x;const k=x.nodes[0];let F;return O[k.selector]&&O["*"]?F=xa(O[k.selector],O["*"]):F=O[k.selector]||O["*"],F&&(x.nodes[0].nodes=k.nodes.reduce(A(F),[])),x}function N(x){return x.nodes[0].nodes.reduce(function(O,k){return O.push(`${k.prop}:${k.value}${k.important?" !important":""}`),O},[]).join(";")}function A(x){return function(O,k){return Je(x,k.prop)&&x[k.prop].some(function(Y){return Y.test(k.value)})&&O.push(k),O}}function B(x,O,k){return O?(x=x.split(/\s+/),x.filter(function(F){return O.indexOf(F)!==-1||k.some(function(Y){return Y.test(F)})}).join(" ")):x}}const Tg={decodeEntities:!0};zn.defaults={allowedTags:["address","article","aside","footer","header","h1","h2","h3","h4","h5","h6","hgroup","main","nav","section","blockquote","dd","div","dl","dt","figcaption","figure","hr","li","menu","ol","p","pre","ul","a","abbr","b","bdi","bdo","br","cite","code","data","dfn","em","i","kbd","mark","q","rb","rp","rt","rtc","ruby","s","samp","small","span","strong","sub","sup","time","u","var","wbr","caption","col","colgroup","table","tbody","td","tfoot","th","thead","tr"],nonBooleanAttributes:["abbr","accept","accept-charset","accesskey","action","allow","alt","as","autocapitalize","autocomplete","blocking","charset","cite","class","color","cols","colspan","content","contenteditable","coords","crossorigin","data","datetime","decoding","dir","dirname","download","draggable","enctype","enterkeyhint","fetchpriority","for","form","formaction","formenctype","formmethod","formtarget","headers","height","hidden","high","href","hreflang","http-equiv","id","imagesizes","imagesrcset","inputmode","integrity","is","itemid","itemprop","itemref","itemtype","kind","label","lang","list","loading","low","max","maxlength","media","method","min","minlength","name","nonce","optimum","pattern","ping","placeholder","popover","popovertarget","popovertargetaction","poster","preload","referrerpolicy","rel","rows","rowspan","sandbox","scope","shape","size","sizes","slot","span","spellcheck","src","srcdoc","srclang","srcset","start","step","style","tabindex","target","title","translate","type","usemap","value","width","wrap","onauxclick","onafterprint","onbeforematch","onbeforeprint","onbeforeunload","onbeforetoggle","onblur","oncancel","oncanplay","oncanplaythrough","onchange","onclick","onclose","oncontextlost","oncontextmenu","oncontextrestored","oncopy","oncuechange","oncut","ondblclick","ondrag","ondragend","ondragenter","ondragleave","ondragover","ondragstart","ondrop","ondurationchange","onemptied","onended","onerror","onfocus","onformdata","onhashchange","oninput","oninvalid","onkeydown","onkeypress","onkeyup","onlanguagechange","onload","onloadeddata","onloadedmetadata","onloadstart","onmessage","onmessageerror","onmousedown","onmouseenter","onmouseleave","onmousemove","onmouseout","onmouseover","onmouseup","onoffline","ononline","onpagehide","onpageshow","onpaste","onpause","onplay","onplaying","onpopstate","onprogress","onratechange","onreset","onresize","onrejectionhandled","onscroll","onscrollend","onsecuritypolicyviolation","onseeked","onseeking","onselect","onslotchange","onstalled","onstorage","onsubmit","onsuspend","ontimeupdate","ontoggle","onunhandledrejection","onunload","onvolumechange","onwaiting","onwheel"],disallowedTagsMode:"discard",allowedAttributes:{a:["href","name","target"],img:["src","srcset","alt","title","width","height","loading"]},allowedEmptyAttributes:["alt"],selfClosing:["img","br","hr","area","base","basefont","input","link","meta"],allowedSchemes:["http","https","ftp","mailto","tel"],allowedSchemesByTag:{},allowedSchemesAppliedToAttributes:["href","src","cite"],allowProtocolRelative:!0,enforceHtmlBoundary:!1,parseStyleAttributes:!0,preserveEscapedAttributes:!1};zn.simpleTransform=function(n,e,t){return t=t===void 0?!0:t,e=e||{},function(r,u){let i;if(t)for(i in e)u[i]=e[i];else u=e;return{tagName:n,attribs:u}}};const Cg=eh(wg),Eg="_editor_41sgr_1",Ng="_toolbar_41sgr_11",kg="_active_41sgr_33",Ag="_bold_41sgr_38",Og="_italic_41sgr_42",Pg="_link_41sgr_46",Ig="_list_41sgr_52",Lg="_paragraph_41sgr_53",Se={editor:Eg,toolbar:Ng,active:kg,bold:Ag,italic:Og,link:Pg,list:Ig,paragraph:Lg},Dg=()=>{const[n]=ke(),[e,t]=U.useState(!1),[r,u]=U.useState(!1),[i,s]=U.useState(!1),[o,a]=U.useState(!1),[l,f]=U.useState(""),h=U.useRef(null),c=()=>{n.dispatchCommand(Qt,{url:l,target:"_blank"})},d=U.useCallback(()=>{const p=$();if(I(p)){const m=p.getNodes();t(p.hasFormat("bold")),u(p.hasFormat("italic")),m.every(g=>{const y=g.getParent();a(K(y)||re(y)),Tt(y)?(s(!0),f(y.getURL())):(s(!1),f(""))})}},[]);return U.useEffect(()=>nt(n.registerUpdateListener(({editorState:p})=>{p.read(()=>{d()})})),[n,d]),V.jsxs("div",{className:Se.toolbar,children:[V.jsx(cr.Button,{className:dn.t(e&&Se.active),onClick:()=>{n.dispatchCommand(Ue,"bold")},title:"Bold",variant:"minimal",children:V.jsx(fr.Icon,{name:"bold"})}),V.jsx(cr.Button,{className:dn.t(r&&Se.active),onClick:()=>{n.dispatchCommand(Ue,"italic")},title:"Italic",variant:"minimal",children:V.jsx(fr.Icon,{name:"italic"})}),V.jsx(cr.Button,{className:dn.t(o&&Se.active),onClick:()=>{o?n.dispatchCommand($l,void 0):n.dispatchCommand(Bl,void 0)},title:"List",variant:"minimal",children:V.jsx(fr.Icon,{name:"list"})}),V.jsx(cr.Button,{className:dn.t(i&&Se.active),onClick:()=>{i?n.dispatchCommand(Qt,null):(n.dispatchCommand(Qt,{url:"https://"}),setTimeout(()=>h.current.focus(),0))},title:"Link",variant:"minimal",children:V.jsx(fr.Icon,{name:"link"})}),V.jsx(o0.Input,{className:dn.t(i&&Se.active),onBlur:()=>c(),onChange:p=>f(p.target.value),onKeyDown:p=>{p.key==="Enter"&&(p.preventDefault(),c())},ref:h,value:l})]})},Mg=/(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))/,Rg=/((https?:\/\/(www\.)?)|(www\.))[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_+.~#?&//=]*)/,Bg=[n=>{const e=Mg.exec(n);return e!=null&&e.length?{index:e.index,length:e[0].length,text:e[0],url:`mailto:${e[0]}`}:null},n=>{const e=Rg.exec(n);return e!=null&&e.length?{index:e.index,length:e[0].length,text:e[0],url:e[0].startsWith("http")?e[0]:`https://${e[0]}`}:null}];function $g(n){try{const e=new URL(n);return e.protocol==="http:"||e.protocol==="https:"}catch{return!1}}function Fg({content:n}){const[e]=ke();return U.useEffect(()=>{e.update(()=>{const r=new DOMParser().parseFromString(n??"","text/html"),u=Nl(e,r);ie().clear().select(),pl(u),Me(null)})},[e,n]),null}const qg=({autofocus:n=!1,autolink:e=!1,content:t,inline:r=!1,onChange:u})=>{const i={namespace:"Editor",theme:{link:Se.link,list:{ol:Se.list,ul:Se.list},paragraph:Se.paragraph,text:{bold:Se.bold,italic:Se.italic}},onError(s){throw s},nodes:[Cu,tr,ln,nr]};return V.jsx("div",{className:Se.editor,children:V.jsxs(cd,{initialConfig:i,children:[!r&&V.jsx(Dg,{}),V.jsx(Qd,{contentEditable:V.jsx(bd,{}),ErrorBoundary:vd}),n&&V.jsx(ed,{}),e&&V.jsx(ad,{matchers:Bg}),V.jsx(Ad,{}),t&&V.jsx(Fg,{content:t}),V.jsx(Od,{validateUrl:$g}),V.jsx(Pd,{}),u&&V.jsx(Ld,{onChange:(s,o)=>{s.read(()=>{const a=kl(o,null),l=Cg(a,{allowedTags:["a","b","br","i","li","ol","p","ul"]});u(l)})}})]})})};exports.Editor=qg;
|
|
58
58
|
//# sourceMappingURL=index.cjs.map
|