@tntx/markdown-preview-react
Version:
markdown 预览组件
1,813 lines (1,790 loc) • 72.1 kB
JavaScript
// src/MdPreviewer/index.tsx
import ReactMarkdown from "react-markdown";
import remarkGfm from "remark-gfm";
import rehypeHighlight from "rehype-highlight";
import rehypeRaw from "rehype-raw";
import "highlight.js/styles/github.css";
// #style-inject:#style-inject
function styleInject(css, { insertAt } = {}) {
if (!css || typeof document === "undefined")
return;
const head = document.head || document.getElementsByTagName("head")[0];
const style = document.createElement("style");
style.type = "text/css";
if (insertAt === "top") {
if (head.firstChild) {
head.insertBefore(style, head.firstChild);
} else {
head.appendChild(style);
}
} else {
head.appendChild(style);
}
if (style.styleSheet) {
style.styleSheet.cssText = css;
} else {
style.appendChild(document.createTextNode(css));
}
}
// src/MdPreviewer/github-markdown-light.css
styleInject(`.tntx-markdown-body {
color-scheme: light;
-ms-text-size-adjust: 100%;
-webkit-text-size-adjust: 100%;
margin: 0;
color: #1f2328;
font-family:
-apple-system,
BlinkMacSystemFont,
"Segoe UI",
"Noto Sans",
Helvetica,
Arial,
sans-serif,
"Apple Color Emoji",
"Segoe UI Emoji";
font-size: 16px;
line-height: 1.5;
word-wrap: break-word;
}
.tntx-markdown-body .octicon {
display: inline-block;
fill: currentColor;
vertical-align: text-bottom;
}
.tntx-markdown-body h1:hover .anchor .octicon-link:before,
.tntx-markdown-body h2:hover .anchor .octicon-link:before,
.tntx-markdown-body h3:hover .anchor .octicon-link:before,
.tntx-markdown-body h4:hover .anchor .octicon-link:before,
.tntx-markdown-body h5:hover .anchor .octicon-link:before,
.tntx-markdown-body h6:hover .anchor .octicon-link:before {
width: 16px;
height: 16px;
content: " ";
display: inline-block;
background-color: currentColor;
-webkit-mask-image: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' version='1.1' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg>");
mask-image: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' version='1.1' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg>");
}
.tntx-markdown-body details,
.tntx-markdown-body figcaption,
.tntx-markdown-body figure {
display: block;
}
.tntx-markdown-body summary {
display: list-item;
}
.tntx-markdown-body [hidden] {
display: none !important;
}
.tntx-markdown-body a {
background-color: transparent;
color: #0969da;
text-decoration: none;
}
.tntx-markdown-body abbr[title] {
border-bottom: none;
-webkit-text-decoration: underline dotted;
text-decoration: underline dotted;
}
.tntx-markdown-body b,
.tntx-markdown-body strong {
font-weight: 600;
}
.tntx-markdown-body dfn {
font-style: italic;
}
.tntx-markdown-body h1 {
margin: .67em 0;
font-weight: 600;
padding-bottom: .3em;
font-size: 2em;
}
.tntx-markdown-body mark {
background-color: #fff8c5;
color: #1f2328;
}
.tntx-markdown-body small {
font-size: 90%;
}
.tntx-markdown-body sub,
.tntx-markdown-body sup {
font-size: 75%;
line-height: 0;
position: relative;
vertical-align: baseline;
}
.tntx-markdown-body sub {
bottom: -0.25em;
}
.tntx-markdown-body sup {
top: -0.5em;
}
.tntx-markdown-body img {
border-style: none;
max-width: 100%;
box-sizing: content-box;
}
.tntx-markdown-body code,
.tntx-markdown-body kbd,
.tntx-markdown-body pre,
.tntx-markdown-body samp {
font-family: monospace;
font-size: 1em;
}
.tntx-markdown-body figure {
margin: 1em 2.5rem;
}
.tntx-markdown-body hr {
box-sizing: content-box;
overflow: hidden;
background: transparent;
border-bottom: 1px solid #d1d9e0b3;
height: .25em;
padding: 0;
margin: 1.5rem 0;
background-color: #d1d9e0;
border: 0;
}
.tntx-markdown-body input {
font: inherit;
margin: 0;
overflow: visible;
font-family: inherit;
font-size: inherit;
line-height: inherit;
}
.tntx-markdown-body [type=button],
.tntx-markdown-body [type=reset],
.tntx-markdown-body [type=submit] {
-webkit-appearance: button;
appearance: button;
}
.tntx-markdown-body [type=checkbox],
.tntx-markdown-body [type=radio] {
box-sizing: border-box;
padding: 0;
}
.tntx-markdown-body [type=number]::-webkit-inner-spin-button,
.tntx-markdown-body [type=number]::-webkit-outer-spin-button {
height: auto;
}
.tntx-markdown-body [type=search]::-webkit-search-cancel-button,
.tntx-markdown-body [type=search]::-webkit-search-decoration {
-webkit-appearance: none;
appearance: none;
}
.tntx-markdown-body ::-webkit-input-placeholder {
color: inherit;
opacity: .54;
}
.tntx-markdown-body ::-webkit-file-upload-button {
-webkit-appearance: button;
appearance: button;
font: inherit;
}
.tntx-markdown-body a:hover {
text-decoration: underline;
}
.tntx-markdown-body ::placeholder {
color: #59636e;
opacity: 1;
}
.tntx-markdown-body hr::before {
display: table;
content: "";
}
.tntx-markdown-body hr::after {
display: table;
clear: both;
content: "";
}
.tntx-markdown-body table {
border-spacing: 0;
border-collapse: collapse;
display: block;
width: max-content;
max-width: 100%;
overflow: auto;
font-variant: tabular-nums;
}
.tntx-markdown-body td,
.tntx-markdown-body th {
padding: 0;
}
.tntx-markdown-body details summary {
cursor: pointer;
}
.tntx-markdown-body a:focus,
.tntx-markdown-body [role=button]:focus,
.tntx-markdown-body input[type=radio]:focus,
.tntx-markdown-body input[type=checkbox]:focus {
outline: 2px solid #0969da;
outline-offset: -2px;
box-shadow: none;
}
.tntx-markdown-body a:focus:not(:focus-visible),
.tntx-markdown-body [role=button]:focus:not(:focus-visible),
.tntx-markdown-body input[type=radio]:focus:not(:focus-visible),
.tntx-markdown-body input[type=checkbox]:focus:not(:focus-visible) {
outline: solid 1px transparent;
}
.tntx-markdown-body a:focus-visible,
.tntx-markdown-body [role=button]:focus-visible,
.tntx-markdown-body input[type=radio]:focus-visible,
.tntx-markdown-body input[type=checkbox]:focus-visible {
outline: 2px solid #0969da;
outline-offset: -2px;
box-shadow: none;
}
.tntx-markdown-body a:not([class]):focus,
.tntx-markdown-body a:not([class]):focus-visible,
.tntx-markdown-body input[type=radio]:focus,
.tntx-markdown-body input[type=radio]:focus-visible,
.tntx-markdown-body input[type=checkbox]:focus,
.tntx-markdown-body input[type=checkbox]:focus-visible {
outline-offset: 0;
}
.tntx-markdown-body kbd {
display: inline-block;
padding: 0.25rem;
font:
11px ui-monospace,
SFMono-Regular,
SF Mono,
Menlo,
Consolas,
Liberation Mono,
monospace;
line-height: 10px;
color: #1f2328;
vertical-align: middle;
background-color: #f6f8fa;
border: solid 1px #d1d9e0b3;
border-bottom-color: #d1d9e0b3;
border-radius: 6px;
box-shadow: inset 0 -1px 0 #d1d9e0b3;
}
.tntx-markdown-body h1,
.tntx-markdown-body h2,
.tntx-markdown-body h3,
.tntx-markdown-body h4,
.tntx-markdown-body h5,
.tntx-markdown-body h6 {
margin-top: 1.5rem;
margin-bottom: 1rem;
font-weight: 600;
line-height: 1.25;
}
.tntx-markdown-body h2 {
font-weight: 600;
padding-bottom: .3em;
font-size: 1.5em;
}
.tntx-markdown-body h3 {
font-weight: 600;
font-size: 1.25em;
}
.tntx-markdown-body h4 {
font-weight: 600;
font-size: 1em;
}
.tntx-markdown-body h5 {
font-weight: 600;
font-size: .875em;
}
.tntx-markdown-body h6 {
font-weight: 600;
font-size: .85em;
color: #59636e;
}
.tntx-markdown-body p {
margin-top: 0;
margin-bottom: 10px;
}
.tntx-markdown-body blockquote {
margin: 0;
padding: 0 1em;
color: #59636e;
border-left: .25em solid #d1d9e0;
}
.tntx-markdown-body ul,
.tntx-markdown-body ol {
margin-top: 0;
margin-bottom: 0;
padding-left: 2em;
font-size: 14px;
}
.tntx-markdown-body ol ol,
.tntx-markdown-body ul ol {
list-style-type: lower-roman;
}
.tntx-markdown-body ul ul ol,
.tntx-markdown-body ul ol ol,
.tntx-markdown-body ol ul ol,
.tntx-markdown-body ol ol ol {
list-style-type: lower-alpha;
}
.tntx-markdown-body dd {
margin-left: 0;
}
.tntx-markdown-body tt,
.tntx-markdown-body code,
.tntx-markdown-body samp {
font-family:
ui-monospace,
SFMono-Regular,
SF Mono,
Menlo,
Consolas,
Liberation Mono,
monospace;
font-size: 12px;
}
.tntx-markdown-body pre {
margin-top: 0;
margin-bottom: 0;
font-family:
ui-monospace,
SFMono-Regular,
SF Mono,
Menlo,
Consolas,
Liberation Mono,
monospace;
font-size: 12px;
word-wrap: normal;
}
.tntx-markdown-body .octicon {
display: inline-block;
overflow: visible !important;
vertical-align: text-bottom;
fill: currentColor;
}
.tntx-markdown-body input::-webkit-outer-spin-button,
.tntx-markdown-body input::-webkit-inner-spin-button {
margin: 0;
appearance: none;
}
.tntx-markdown-body .mr-2 {
margin-right: 0.5rem !important;
}
.tntx-markdown-body::before {
display: table;
content: "";
}
.tntx-markdown-body::after {
display: table;
clear: both;
content: "";
}
.tntx-markdown-body > *:first-child {
margin-top: 0 !important;
}
.tntx-markdown-body > *:last-child {
margin-bottom: 0 !important;
}
.tntx-markdown-body a:not([href]) {
color: inherit;
text-decoration: none;
}
.tntx-markdown-body .absent {
color: #d1242f;
}
.tntx-markdown-body .anchor {
float: left;
padding-right: 0.25rem;
margin-left: -20px;
line-height: 1;
}
.tntx-markdown-body .anchor:focus {
outline: none;
}
.tntx-markdown-body p,
.tntx-markdown-body blockquote,
.tntx-markdown-body ul,
.tntx-markdown-body ol,
.tntx-markdown-body dl,
.tntx-markdown-body table,
.tntx-markdown-body pre,
.tntx-markdown-body details {
margin-top: 0;
margin-bottom: 1rem;
}
.tntx-markdown-body blockquote > :first-child {
margin-top: 0;
}
.tntx-markdown-body blockquote > :last-child {
margin-bottom: 0;
}
.tntx-markdown-body h1 .octicon-link,
.tntx-markdown-body h2 .octicon-link,
.tntx-markdown-body h3 .octicon-link,
.tntx-markdown-body h4 .octicon-link,
.tntx-markdown-body h5 .octicon-link,
.tntx-markdown-body h6 .octicon-link {
color: #1f2328;
vertical-align: middle;
visibility: hidden;
}
.tntx-markdown-body h1:hover .anchor,
.tntx-markdown-body h2:hover .anchor,
.tntx-markdown-body h3:hover .anchor,
.tntx-markdown-body h4:hover .anchor,
.tntx-markdown-body h5:hover .anchor,
.tntx-markdown-body h6:hover .anchor {
text-decoration: none;
}
.tntx-markdown-body h1:hover .anchor .octicon-link,
.tntx-markdown-body h2:hover .anchor .octicon-link,
.tntx-markdown-body h3:hover .anchor .octicon-link,
.tntx-markdown-body h4:hover .anchor .octicon-link,
.tntx-markdown-body h5:hover .anchor .octicon-link,
.tntx-markdown-body h6:hover .anchor .octicon-link {
visibility: visible;
}
.tntx-markdown-body h1 tt,
.tntx-markdown-body h1 code,
.tntx-markdown-body h2 tt,
.tntx-markdown-body h2 code,
.tntx-markdown-body h3 tt,
.tntx-markdown-body h3 code,
.tntx-markdown-body h4 tt,
.tntx-markdown-body h4 code,
.tntx-markdown-body h5 tt,
.tntx-markdown-body h5 code,
.tntx-markdown-body h6 tt,
.tntx-markdown-body h6 code {
padding: 0 .2em;
font-size: inherit;
}
.tntx-markdown-body summary h1,
.tntx-markdown-body summary h2,
.tntx-markdown-body summary h3,
.tntx-markdown-body summary h4,
.tntx-markdown-body summary h5,
.tntx-markdown-body summary h6 {
display: inline-block;
}
.tntx-markdown-body summary h1 .anchor,
.tntx-markdown-body summary h2 .anchor,
.tntx-markdown-body summary h3 .anchor,
.tntx-markdown-body summary h4 .anchor,
.tntx-markdown-body summary h5 .anchor,
.tntx-markdown-body summary h6 .anchor {
margin-left: -40px;
}
.tntx-markdown-body summary h1,
.tntx-markdown-body summary h2 {
padding-bottom: 0;
border-bottom: 0;
}
.tntx-markdown-body ul.no-list,
.tntx-markdown-body ol.no-list {
padding: 0;
list-style-type: none;
}
.tntx-markdown-body ol[type="a s"] {
list-style-type: lower-alpha;
}
.tntx-markdown-body ol[type="A s"] {
list-style-type: upper-alpha;
}
.tntx-markdown-body ol[type="i s"] {
list-style-type: lower-roman;
}
.tntx-markdown-body ol[type="I s"] {
list-style-type: upper-roman;
}
.tntx-markdown-body ol[type="1"] {
list-style-type: decimal;
}
.tntx-markdown-body div > ol:not([type]) {
list-style-type: decimal;
}
.tntx-markdown-body ul ul,
.tntx-markdown-body ul ol,
.tntx-markdown-body ol ol,
.tntx-markdown-body ol ul {
margin-top: 0;
margin-bottom: 0;
}
.tntx-markdown-body li > p {
margin-top: 1rem;
}
.tntx-markdown-body li + li {
margin-top: .25em;
}
.tntx-markdown-body dl {
padding: 0;
}
.tntx-markdown-body dl dt {
padding: 0;
margin-top: 1rem;
font-size: 1em;
font-style: italic;
font-weight: 600;
}
.tntx-markdown-body dl dd {
padding: 0 1rem;
margin-bottom: 1rem;
}
.tntx-markdown-body table th {
font-weight: 600;
}
.tntx-markdown-body table th,
.tntx-markdown-body table td {
padding: 6px 13px;
border: 1px solid #d1d9e0;
width: 1%;
}
.tntx-markdown-body table td > :last-child {
margin-bottom: 0;
}
.tntx-markdown-body table tr {
background-color: #ffffff;
border-top: 1px solid #d1d9e0b3;
}
.tntx-markdown-body table tr:nth-child(2n) {
background-color: #f6f8fa;
}
.tntx-markdown-body table img {
background-color: transparent;
}
.tntx-markdown-body img[align=right] {
padding-left: 20px;
}
.tntx-markdown-body img[align=left] {
padding-right: 20px;
}
.tntx-markdown-body .emoji {
max-width: none;
vertical-align: text-top;
background-color: transparent;
}
.tntx-markdown-body span.frame {
display: block;
overflow: hidden;
}
.tntx-markdown-body span.frame > span {
display: block;
float: left;
width: auto;
padding: 7px;
margin: 13px 0 0;
overflow: hidden;
border: 1px solid #d1d9e0;
}
.tntx-markdown-body span.frame span img {
display: block;
float: left;
}
.tntx-markdown-body span.frame span span {
display: block;
padding: 5px 0 0;
clear: both;
color: #1f2328;
}
.tntx-markdown-body span.align-center {
display: block;
overflow: hidden;
clear: both;
}
.tntx-markdown-body span.align-center > span {
display: block;
margin: 13px auto 0;
overflow: hidden;
text-align: center;
}
.tntx-markdown-body span.align-center span img {
margin: 0 auto;
text-align: center;
}
.tntx-markdown-body span.align-right {
display: block;
overflow: hidden;
clear: both;
}
.tntx-markdown-body span.align-right > span {
display: block;
margin: 13px 0 0;
overflow: hidden;
text-align: right;
}
.tntx-markdown-body span.align-right span img {
margin: 0;
text-align: right;
}
.tntx-markdown-body span.float-left {
display: block;
float: left;
margin-right: 13px;
overflow: hidden;
}
.tntx-markdown-body span.float-left span {
margin: 13px 0 0;
}
.tntx-markdown-body span.float-right {
display: block;
float: right;
margin-left: 13px;
overflow: hidden;
}
.tntx-markdown-body span.float-right > span {
display: block;
margin: 13px auto 0;
overflow: hidden;
text-align: right;
}
.tntx-markdown-body code,
.tntx-markdown-body tt {
padding: .2em .4em;
margin: 0;
font-size: 85%;
white-space: break-spaces;
background-color: #818b981f;
border-radius: 6px;
}
.tntx-markdown-body code br,
.tntx-markdown-body tt br {
display: none;
}
.tntx-markdown-body del code {
text-decoration: inherit;
}
.tntx-markdown-body samp {
font-size: 85%;
}
.tntx-markdown-body pre code {
font-size: 100%;
}
.tntx-markdown-body pre > code {
padding: 0;
margin: 0;
word-break: normal;
white-space: pre;
background: transparent;
border: 0;
}
.tntx-markdown-body .highlight {
margin-bottom: 1rem;
}
.tntx-markdown-body .highlight pre {
margin-bottom: 0;
word-break: normal;
}
.tntx-markdown-body .highlight pre,
.tntx-markdown-body pre {
padding: 1rem;
overflow: auto;
font-size: 85%;
line-height: 1.45;
color: #1f2328;
background-color: #f6f8fa;
border-radius: 6px;
}
.tntx-markdown-body pre code,
.tntx-markdown-body pre tt {
display: inline;
max-width: auto;
padding: 0;
margin: 0;
overflow: visible;
line-height: inherit;
word-wrap: normal;
background-color: transparent;
border: 0;
}
.tntx-markdown-body .csv-data td,
.tntx-markdown-body .csv-data th {
padding: 5px;
overflow: hidden;
font-size: 12px;
line-height: 1;
text-align: left;
white-space: nowrap;
}
.tntx-markdown-body .csv-data .blob-num {
padding: 10px 0.5rem 9px;
text-align: right;
background: #ffffff;
border: 0;
}
.tntx-markdown-body .csv-data tr {
border-top: 0;
}
.tntx-markdown-body .csv-data th {
font-weight: 600;
background: #f6f8fa;
border-top: 0;
}
.tntx-markdown-body [data-footnote-ref]::before {
content: "[";
}
.tntx-markdown-body [data-footnote-ref]::after {
content: "]";
}
.tntx-markdown-body .footnotes {
font-size: 12px;
color: #59636e;
border-top: 1px solid #d1d9e0;
}
.tntx-markdown-body .footnotes ol {
padding-left: 1rem;
}
.tntx-markdown-body .footnotes ol ul {
display: inline-block;
padding-left: 1rem;
margin-top: 1rem;
}
.tntx-markdown-body .footnotes li {
position: relative;
}
.tntx-markdown-body .footnotes li:target::before {
position: absolute;
top: calc(0.5rem*-1);
right: calc(0.5rem*-1);
bottom: calc(0.5rem*-1);
left: calc(1.5rem*-1);
pointer-events: none;
content: "";
border: 2px solid #0969da;
border-radius: 6px;
}
.tntx-markdown-body .footnotes li:target {
color: #1f2328;
}
.tntx-markdown-body .footnotes .data-footnote-backref g-emoji {
font-family: monospace;
}
.tntx-markdown-body body:has(:modal) {
padding-right: var(--dialog-scrollgutter) !important;
}
.tntx-markdown-body .pl-c {
color: #59636e;
}
.tntx-markdown-body .pl-c1,
.tntx-markdown-body .pl-s .pl-v {
color: #0550ae;
}
.tntx-markdown-body .pl-e,
.tntx-markdown-body .pl-en {
color: #6639ba;
}
.tntx-markdown-body .pl-smi,
.tntx-markdown-body .pl-s .pl-s1 {
color: #1f2328;
}
.tntx-markdown-body .pl-ent {
color: #0550ae;
}
.tntx-markdown-body .pl-k {
color: #cf222e;
}
.tntx-markdown-body .pl-s,
.tntx-markdown-body .pl-pds,
.tntx-markdown-body .pl-s .pl-pse .pl-s1,
.tntx-markdown-body .pl-sr,
.tntx-markdown-body .pl-sr .pl-cce,
.tntx-markdown-body .pl-sr .pl-sre,
.tntx-markdown-body .pl-sr .pl-sra {
color: #0a3069;
}
.tntx-markdown-body .pl-v,
.tntx-markdown-body .pl-smw {
color: #953800;
}
.tntx-markdown-body .pl-bu {
color: #82071e;
}
.tntx-markdown-body .pl-ii {
color: #f6f8fa;
background-color: #82071e;
}
.tntx-markdown-body .pl-c2 {
color: #f6f8fa;
background-color: #cf222e;
}
.tntx-markdown-body .pl-sr .pl-cce {
font-weight: bold;
color: #116329;
}
.tntx-markdown-body .pl-ml {
color: #3b2300;
}
.tntx-markdown-body .pl-mh,
.tntx-markdown-body .pl-mh .pl-en,
.tntx-markdown-body .pl-ms {
font-weight: bold;
color: #0550ae;
}
.tntx-markdown-body .pl-mi {
font-style: italic;
color: #1f2328;
}
.tntx-markdown-body .pl-mb {
font-weight: bold;
color: #1f2328;
}
.tntx-markdown-body .pl-md {
color: #82071e;
background-color: #ffebe9;
}
.tntx-markdown-body .pl-mi1 {
color: #116329;
background-color: #dafbe1;
}
.tntx-markdown-body .pl-mc {
color: #953800;
background-color: #ffd8b5;
}
.tntx-markdown-body .pl-mi2 {
color: #d1d9e0;
background-color: #0550ae;
}
.tntx-markdown-body .pl-mdr {
font-weight: bold;
color: #8250df;
}
.tntx-markdown-body .pl-ba {
color: #59636e;
}
.tntx-markdown-body .pl-sg {
color: #818b98;
}
.tntx-markdown-body .pl-corl {
text-decoration: underline;
color: #0a3069;
}
.tntx-markdown-body [role=button]:focus:not(:focus-visible),
.tntx-markdown-body [role=tabpanel][tabindex="0"]:focus:not(:focus-visible),
.tntx-markdown-body button:focus:not(:focus-visible),
.tntx-markdown-body summary:focus:not(:focus-visible),
.tntx-markdown-body a:focus:not(:focus-visible) {
outline: none;
box-shadow: none;
}
.tntx-markdown-body [tabindex="0"]:focus:not(:focus-visible),
.tntx-markdown-body details-dialog:focus:not(:focus-visible) {
outline: none;
}
.tntx-markdown-body g-emoji {
display: inline-block;
min-width: 1ch;
font-family:
"Apple Color Emoji",
"Segoe UI Emoji",
"Segoe UI Symbol";
font-size: 1em;
font-style: normal !important;
font-weight: 400;
line-height: 1;
vertical-align: -0.075em;
}
.tntx-markdown-body g-emoji img {
width: 1em;
height: 1em;
}
.tntx-markdown-body .task-list-item {
list-style-type: none;
}
.tntx-markdown-body .task-list-item label {
font-weight: 400;
}
.tntx-markdown-body .task-list-item.enabled label {
cursor: pointer;
}
.tntx-markdown-body .task-list-item + .task-list-item {
margin-top: 0.25rem;
}
.tntx-markdown-body .task-list-item .handle {
display: none;
}
.tntx-markdown-body .task-list-item-checkbox {
margin: 0 .2em .25em -1.4em;
vertical-align: middle;
}
.tntx-markdown-body ul:dir(rtl) .task-list-item-checkbox {
margin: 0 -1.6em .25em .2em;
}
.tntx-markdown-body ol:dir(rtl) .task-list-item-checkbox {
margin: 0 -1.6em .25em .2em;
}
.tntx-markdown-body .contains-task-list:hover .task-list-item-convert-container,
.tntx-markdown-body .contains-task-list:focus-within .task-list-item-convert-container {
display: block;
width: auto;
height: 24px;
overflow: visible;
clip: auto;
}
.tntx-markdown-body ::-webkit-calendar-picker-indicator {
filter: invert(50%);
}
.tntx-markdown-body .markdown-alert {
padding: 0.5rem 1rem;
margin-bottom: 1rem;
color: inherit;
border-left: .25em solid #d1d9e0;
}
.tntx-markdown-body .markdown-alert > :first-child {
margin-top: 0;
}
.tntx-markdown-body .markdown-alert > :last-child {
margin-bottom: 0;
}
.tntx-markdown-body .markdown-alert .markdown-alert-title {
display: flex;
font-weight: 500;
align-items: center;
line-height: 1;
}
.tntx-markdown-body .markdown-alert.markdown-alert-note {
border-left-color: #0969da;
}
.tntx-markdown-body .markdown-alert.markdown-alert-note .markdown-alert-title {
color: #0969da;
}
.tntx-markdown-body .markdown-alert.markdown-alert-important {
border-left-color: #8250df;
}
.tntx-markdown-body .markdown-alert.markdown-alert-important .markdown-alert-title {
color: #8250df;
}
.tntx-markdown-body .markdown-alert.markdown-alert-warning {
border-left-color: #9a6700;
}
.tntx-markdown-body .markdown-alert.markdown-alert-warning .markdown-alert-title {
color: #9a6700;
}
.tntx-markdown-body .markdown-alert.markdown-alert-tip {
border-left-color: #1a7f37;
}
.tntx-markdown-body .markdown-alert.markdown-alert-tip .markdown-alert-title {
color: #1a7f37;
}
.tntx-markdown-body .markdown-alert.markdown-alert-caution {
border-left-color: #cf222e;
}
.tntx-markdown-body .markdown-alert.markdown-alert-caution .markdown-alert-title {
color: #d1242f;
}
.tntx-markdown-body > *:first-child > .heading-element:first-child {
margin-top: 0 !important;
}
.tntx-markdown-body .highlight pre:has(+ .zeroclipboard-container) {
min-height: 52px;
}
`);
// src/MdPreviewer/index.tsx
import { jsx } from "react/jsx-runtime";
var MdPreviewer = ({ md }) => {
return /* @__PURE__ */ jsx("div", { className: "tntx-markdown-body", children: /* @__PURE__ */ jsx(
ReactMarkdown,
{
remarkPlugins: [remarkGfm],
rehypePlugins: [rehypeHighlight, rehypeRaw],
children: md
}
) });
};
var MdPreviewer_default = MdPreviewer;
// src/CodePreviewer/index.tsx
import { useState, useEffect as useEffect2 } from "react";
import { Tooltip } from "antd";
// ../../node_modules/.pnpm/@ant-design+icons@5.6.1_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@ant-design/icons/es/components/Context.js
import { createContext } from "react";
var IconContext = /* @__PURE__ */ createContext({});
var Context_default = IconContext;
// ../../node_modules/.pnpm/@babel+runtime@7.26.9/node_modules/@babel/runtime/helpers/esm/extends.js
function _extends() {
return _extends = Object.assign ? Object.assign.bind() : function(n) {
for (var e = 1; e < arguments.length; e++) {
var t = arguments[e];
for (var r in t)
({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
}
return n;
}, _extends.apply(null, arguments);
}
// ../../node_modules/.pnpm/@babel+runtime@7.26.9/node_modules/@babel/runtime/helpers/esm/arrayWithHoles.js
function _arrayWithHoles(r) {
if (Array.isArray(r))
return r;
}
// ../../node_modules/.pnpm/@babel+runtime@7.26.9/node_modules/@babel/runtime/helpers/esm/iterableToArrayLimit.js
function _iterableToArrayLimit(r, l) {
var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
if (null != t) {
var e, n, i, u, a = [], f = true, o = false;
try {
if (i = (t = t.call(r)).next, 0 === l) {
if (Object(t) !== t)
return;
f = false;
} else
for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = true)
;
} catch (r2) {
o = true, n = r2;
} finally {
try {
if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u))
return;
} finally {
if (o)
throw n;
}
}
return a;
}
}
// ../../node_modules/.pnpm/@babel+runtime@7.26.9/node_modules/@babel/runtime/helpers/esm/arrayLikeToArray.js
function _arrayLikeToArray(r, a) {
(null == a || a > r.length) && (a = r.length);
for (var e = 0, n = Array(a); e < a; e++)
n[e] = r[e];
return n;
}
// ../../node_modules/.pnpm/@babel+runtime@7.26.9/node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js
function _unsupportedIterableToArray(r, a) {
if (r) {
if ("string" == typeof r)
return _arrayLikeToArray(r, a);
var t = {}.toString.call(r).slice(8, -1);
return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;
}
}
// ../../node_modules/.pnpm/@babel+runtime@7.26.9/node_modules/@babel/runtime/helpers/esm/nonIterableRest.js
function _nonIterableRest() {
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}
// ../../node_modules/.pnpm/@babel+runtime@7.26.9/node_modules/@babel/runtime/helpers/esm/slicedToArray.js
function _slicedToArray(r, e) {
return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest();
}
// ../../node_modules/.pnpm/@babel+runtime@7.26.9/node_modules/@babel/runtime/helpers/esm/typeof.js
function _typeof(o) {
"@babel/helpers - typeof";
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o2) {
return typeof o2;
} : function(o2) {
return o2 && "function" == typeof Symbol && o2.constructor === Symbol && o2 !== Symbol.prototype ? "symbol" : typeof o2;
}, _typeof(o);
}
// ../../node_modules/.pnpm/@babel+runtime@7.26.9/node_modules/@babel/runtime/helpers/esm/toPrimitive.js
function toPrimitive(t, r) {
if ("object" != _typeof(t) || !t)
return t;
var e = t[Symbol.toPrimitive];
if (void 0 !== e) {
var i = e.call(t, r || "default");
if ("object" != _typeof(i))
return i;
throw new TypeError("@@toPrimitive must return a primitive value.");
}
return ("string" === r ? String : Number)(t);
}
// ../../node_modules/.pnpm/@babel+runtime@7.26.9/node_modules/@babel/runtime/helpers/esm/toPropertyKey.js
function toPropertyKey(t) {
var i = toPrimitive(t, "string");
return "symbol" == _typeof(i) ? i : i + "";
}
// ../../node_modules/.pnpm/@babel+runtime@7.26.9/node_modules/@babel/runtime/helpers/esm/defineProperty.js
function _defineProperty(e, r, t) {
return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
value: t,
enumerable: true,
configurable: true,
writable: true
}) : e[r] = t, e;
}
// ../../node_modules/.pnpm/@babel+runtime@7.26.9/node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js
function _objectWithoutPropertiesLoose(r, e) {
if (null == r)
return {};
var t = {};
for (var n in r)
if ({}.hasOwnProperty.call(r, n)) {
if (-1 !== e.indexOf(n))
continue;
t[n] = r[n];
}
return t;
}
// ../../node_modules/.pnpm/@babel+runtime@7.26.9/node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js
function _objectWithoutProperties(e, t) {
if (null == e)
return {};
var o, r, i = _objectWithoutPropertiesLoose(e, t);
if (Object.getOwnPropertySymbols) {
var n = Object.getOwnPropertySymbols(e);
for (r = 0; r < n.length; r++)
o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]);
}
return i;
}
// ../../node_modules/.pnpm/@ant-design+icons@5.6.1_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@ant-design/icons/es/components/AntdIcon.js
import * as React3 from "react";
import classNames from "classnames";
// ../../node_modules/.pnpm/@ant-design+fast-color@2.0.6/node_modules/@ant-design/fast-color/es/FastColor.js
var round = Math.round;
function splitColorStr(str, parseNum) {
const match = str.replace(/^[^(]*\((.*)/, "$1").replace(/\).*/, "").match(/\d*\.?\d+%?/g) || [];
const numList = match.map((item) => parseFloat(item));
for (let i = 0; i < 3; i += 1) {
numList[i] = parseNum(numList[i] || 0, match[i] || "", i);
}
if (match[3]) {
numList[3] = match[3].includes("%") ? numList[3] / 100 : numList[3];
} else {
numList[3] = 1;
}
return numList;
}
var parseHSVorHSL = (num, _, index) => index === 0 ? num : num / 100;
function limitRange(value, max) {
const mergedMax = max || 255;
if (value > mergedMax) {
return mergedMax;
}
if (value < 0) {
return 0;
}
return value;
}
var FastColor = class _FastColor {
constructor(input) {
_defineProperty(this, "isValid", true);
_defineProperty(this, "r", 0);
_defineProperty(this, "g", 0);
_defineProperty(this, "b", 0);
_defineProperty(this, "a", 1);
_defineProperty(this, "_h", void 0);
_defineProperty(this, "_s", void 0);
_defineProperty(this, "_l", void 0);
_defineProperty(this, "_v", void 0);
_defineProperty(this, "_max", void 0);
_defineProperty(this, "_min", void 0);
_defineProperty(this, "_brightness", void 0);
function matchFormat(str) {
return str[0] in input && str[1] in input && str[2] in input;
}
if (!input) {
} else if (typeof input === "string") {
let matchPrefix2 = function(prefix) {
return trimStr.startsWith(prefix);
};
var matchPrefix = matchPrefix2;
const trimStr = input.trim();
if (/^#?[A-F\d]{3,8}$/i.test(trimStr)) {
this.fromHexString(trimStr);
} else if (matchPrefix2("rgb")) {
this.fromRgbString(trimStr);
} else if (matchPrefix2("hsl")) {
this.fromHslString(trimStr);
} else if (matchPrefix2("hsv") || matchPrefix2("hsb")) {
this.fromHsvString(trimStr);
}
} else if (input instanceof _FastColor) {
this.r = input.r;
this.g = input.g;
this.b = input.b;
this.a = input.a;
this._h = input._h;
this._s = input._s;
this._l = input._l;
this._v = input._v;
} else if (matchFormat("rgb")) {
this.r = limitRange(input.r);
this.g = limitRange(input.g);
this.b = limitRange(input.b);
this.a = typeof input.a === "number" ? limitRange(input.a, 1) : 1;
} else if (matchFormat("hsl")) {
this.fromHsl(input);
} else if (matchFormat("hsv")) {
this.fromHsv(input);
} else {
throw new Error("@ant-design/fast-color: unsupported input " + JSON.stringify(input));
}
}
// ======================= Setter =======================
setR(value) {
return this._sc("r", value);
}
setG(value) {
return this._sc("g", value);
}
setB(value) {
return this._sc("b", value);
}
setA(value) {
return this._sc("a", value, 1);
}
setHue(value) {
const hsv = this.toHsv();
hsv.h = value;
return this._c(hsv);
}
// ======================= Getter =======================
/**
* Returns the perceived luminance of a color, from 0-1.
* @see http://www.w3.org/TR/2008/REC-WCAG20-20081211/#relativeluminancedef
*/
getLuminance() {
function adjustGamma(raw) {
const val = raw / 255;
return val <= 0.03928 ? val / 12.92 : Math.pow((val + 0.055) / 1.055, 2.4);
}
const R = adjustGamma(this.r);
const G = adjustGamma(this.g);
const B = adjustGamma(this.b);
return 0.2126 * R + 0.7152 * G + 0.0722 * B;
}
getHue() {
if (typeof this._h === "undefined") {
const delta = this.getMax() - this.getMin();
if (delta === 0) {
this._h = 0;
} else {
this._h = round(60 * (this.r === this.getMax() ? (this.g - this.b) / delta + (this.g < this.b ? 6 : 0) : this.g === this.getMax() ? (this.b - this.r) / delta + 2 : (this.r - this.g) / delta + 4));
}
}
return this._h;
}
getSaturation() {
if (typeof this._s === "undefined") {
const delta = this.getMax() - this.getMin();
if (delta === 0) {
this._s = 0;
} else {
this._s = delta / this.getMax();
}
}
return this._s;
}
getLightness() {
if (typeof this._l === "undefined") {
this._l = (this.getMax() + this.getMin()) / 510;
}
return this._l;
}
getValue() {
if (typeof this._v === "undefined") {
this._v = this.getMax() / 255;
}
return this._v;
}
/**
* Returns the perceived brightness of the color, from 0-255.
* Note: this is not the b of HSB
* @see http://www.w3.org/TR/AERT#color-contrast
*/
getBrightness() {
if (typeof this._brightness === "undefined") {
this._brightness = (this.r * 299 + this.g * 587 + this.b * 114) / 1e3;
}
return this._brightness;
}
// ======================== Func ========================
darken(amount = 10) {
const h = this.getHue();
const s = this.getSaturation();
let l = this.getLightness() - amount / 100;
if (l < 0) {
l = 0;
}
return this._c({
h,
s,
l,
a: this.a
});
}
lighten(amount = 10) {
const h = this.getHue();
const s = this.getSaturation();
let l = this.getLightness() + amount / 100;
if (l > 1) {
l = 1;
}
return this._c({
h,
s,
l,
a: this.a
});
}
/**
* Mix the current color a given amount with another color, from 0 to 100.
* 0 means no mixing (return current color).
*/
mix(input, amount = 50) {
const color = this._c(input);
const p = amount / 100;
const calc = (key) => (color[key] - this[key]) * p + this[key];
const rgba = {
r: round(calc("r")),
g: round(calc("g")),
b: round(calc("b")),
a: round(calc("a") * 100) / 100
};
return this._c(rgba);
}
/**
* Mix the color with pure white, from 0 to 100.
* Providing 0 will do nothing, providing 100 will always return white.
*/
tint(amount = 10) {
return this.mix({
r: 255,
g: 255,
b: 255,
a: 1
}, amount);
}
/**
* Mix the color with pure black, from 0 to 100.
* Providing 0 will do nothing, providing 100 will always return black.
*/
shade(amount = 10) {
return this.mix({
r: 0,
g: 0,
b: 0,
a: 1
}, amount);
}
onBackground(background) {
const bg = this._c(background);
const alpha = this.a + bg.a * (1 - this.a);
const calc = (key) => {
return round((this[key] * this.a + bg[key] * bg.a * (1 - this.a)) / alpha);
};
return this._c({
r: calc("r"),
g: calc("g"),
b: calc("b"),
a: alpha
});
}
// ======================= Status =======================
isDark() {
return this.getBrightness() < 128;
}
isLight() {
return this.getBrightness() >= 128;
}
// ======================== MISC ========================
equals(other) {
return this.r === other.r && this.g === other.g && this.b === other.b && this.a === other.a;
}
clone() {
return this._c(this);
}
// ======================= Format =======================
toHexString() {
let hex = "#";
const rHex = (this.r || 0).toString(16);
hex += rHex.length === 2 ? rHex : "0" + rHex;
const gHex = (this.g || 0).toString(16);
hex += gHex.length === 2 ? gHex : "0" + gHex;
const bHex = (this.b || 0).toString(16);
hex += bHex.length === 2 ? bHex : "0" + bHex;
if (typeof this.a === "number" && this.a >= 0 && this.a < 1) {
const aHex = round(this.a * 255).toString(16);
hex += aHex.length === 2 ? aHex : "0" + aHex;
}
return hex;
}
/** CSS support color pattern */
toHsl() {
return {
h: this.getHue(),
s: this.getSaturation(),
l: this.getLightness(),
a: this.a
};
}
/** CSS support color pattern */
toHslString() {
const h = this.getHue();
const s = round(this.getSaturation() * 100);
const l = round(this.getLightness() * 100);
return this.a !== 1 ? `hsla(${h},${s}%,${l}%,${this.a})` : `hsl(${h},${s}%,${l}%)`;
}
/** Same as toHsb */
toHsv() {
return {
h: this.getHue(),
s: this.getSaturation(),
v: this.getValue(),
a: this.a
};
}
toRgb() {
return {
r: this.r,
g: this.g,
b: this.b,
a: this.a
};
}
toRgbString() {
return this.a !== 1 ? `rgba(${this.r},${this.g},${this.b},${this.a})` : `rgb(${this.r},${this.g},${this.b})`;
}
toString() {
return this.toRgbString();
}
// ====================== Privates ======================
/** Return a new FastColor object with one channel changed */
_sc(rgb, value, max) {
const clone = this.clone();
clone[rgb] = limitRange(value, max);
return clone;
}
_c(input) {
return new this.constructor(input);
}
getMax() {
if (typeof this._max === "undefined") {
this._max = Math.max(this.r, this.g, this.b);
}
return this._max;
}
getMin() {
if (typeof this._min === "undefined") {
this._min = Math.min(this.r, this.g, this.b);
}
return this._min;
}
fromHexString(trimStr) {
const withoutPrefix = trimStr.replace("#", "");
function connectNum(index1, index2) {
return parseInt(withoutPrefix[index1] + withoutPrefix[index2 || index1], 16);
}
if (withoutPrefix.length < 6) {
this.r = connectNum(0);
this.g = connectNum(1);
this.b = connectNum(2);
this.a = withoutPrefix[3] ? connectNum(3) / 255 : 1;
} else {
this.r = connectNum(0, 1);
this.g = connectNum(2, 3);
this.b = connectNum(4, 5);
this.a = withoutPrefix[6] ? connectNum(6, 7) / 255 : 1;
}
}
fromHsl({
h,
s,
l,
a
}) {
this._h = h % 360;
this._s = s;
this._l = l;
this.a = typeof a === "number" ? a : 1;
if (s <= 0) {
const rgb = round(l * 255);
this.r = rgb;
this.g = rgb;
this.b = rgb;
}
let r = 0, g = 0, b = 0;
const huePrime = h / 60;
const chroma = (1 - Math.abs(2 * l - 1)) * s;
const secondComponent = chroma * (1 - Math.abs(huePrime % 2 - 1));
if (huePrime >= 0 && huePrime < 1) {
r = chroma;
g = secondComponent;
} else if (huePrime >= 1 && huePrime < 2) {
r = secondComponent;
g = chroma;
} else if (huePrime >= 2 && huePrime < 3) {
g = chroma;
b = secondComponent;
} else if (huePrime >= 3 && huePrime < 4) {
g = secondComponent;
b = chroma;
} else if (huePrime >= 4 && huePrime < 5) {
r = secondComponent;
b = chroma;
} else if (huePrime >= 5 && huePrime < 6) {
r = chroma;
b = secondComponent;
}
const lightnessModification = l - chroma / 2;
this.r = round((r + lightnessModification) * 255);
this.g = round((g + lightnessModification) * 255);
this.b = round((b + lightnessModification) * 255);
}
fromHsv({
h,
s,
v,
a
}) {
this._h = h % 360;
this._s = s;
this._v = v;
this.a = typeof a === "number" ? a : 1;
const vv = round(v * 255);
this.r = vv;
this.g = vv;
this.b = vv;
if (s <= 0) {
return;
}
const hh = h / 60;
const i = Math.floor(hh);
const ff = hh - i;
const p = round(v * (1 - s) * 255);
const q = round(v * (1 - s * ff) * 255);
const t = round(v * (1 - s * (1 - ff)) * 255);
switch (i) {
case 0:
this.g = t;
this.b = p;
break;
case 1:
this.r = q;
this.b = p;
break;
case 2:
this.r = p;
this.b = t;
break;
case 3:
this.r = p;
this.g = q;
break;
case 4:
this.r = t;
this.g = p;
break;
case 5:
default:
this.g = p;
this.b = q;
break;
}
}
fromHsvString(trimStr) {
const cells = splitColorStr(trimStr, parseHSVorHSL);
this.fromHsv({
h: cells[0],
s: cells[1],
v: cells[2],
a: cells[3]
});
}
fromHslString(trimStr) {
const cells = splitColorStr(trimStr, parseHSVorHSL);
this.fromHsl({
h: cells[0],
s: cells[1],
l: cells[2],
a: cells[3]
});
}
fromRgbString(trimStr) {
const cells = splitColorStr(trimStr, (num, txt) => (
// Convert percentage to number. e.g. 50% -> 128
txt.includes("%") ? round(num / 100 * 255) : num
));
this.r = cells[0];
this.g = cells[1];
this.b = cells[2];
this.a = cells[3];
}
};
// ../../node_modules/.pnpm/@ant-design+colors@7.2.0/node_modules/@ant-design/colors/es/generate.js
var hueStep = 2;
var saturationStep = 0.16;
var saturationStep2 = 0.05;
var brightnessStep1 = 0.05;
var brightnessStep2 = 0.15;
var lightColorCount = 5;
var darkColorCount = 4;
var darkColorMap = [{
index: 7,
amount: 15
}, {
index: 6,
amount: 25
}, {
index: 5,
amount: 30
}, {
index: 5,
amount: 45
}, {
index: 5,
amount: 65
}, {
index: 5,
amount: 85
}, {
index: 4,
amount: 90
}, {
index: 3,
amount: 95
}, {
index: 2,
amount: 97
}, {
index: 1,
amount: 98
}];
function getHue(hsv, i, light) {
var hue;
if (Math.round(hsv.h) >= 60 && Math.round(hsv.h) <= 240) {
hue = light ? Math.round(hsv.h) - hueStep * i : Math.round(hsv.h) + hueStep * i;
} else {
hue = light ? Math.round(hsv.h) + hueStep * i : Math.round(hsv.h) - hueStep * i;
}
if (hue < 0) {
hue += 360;
} else if (hue >= 360) {
hue -= 360;
}
return hue;
}
function getSaturation(hsv, i, light) {
if (hsv.h === 0 && hsv.s === 0) {
return hsv.s;
}
var saturation;
if (light) {
saturation = hsv.s - saturationStep * i;
} else if (i === darkColorCount) {
saturation = hsv.s + saturationStep;
} else {
saturation = hsv.s + saturationStep2 * i;
}
if (saturation > 1) {
saturation = 1;
}
if (light && i === lightColorCount && saturation > 0.1) {
saturation = 0.1;
}
if (saturation < 0.06) {
saturation = 0.06;
}
return Math.round(saturation * 100) / 100;
}
function getValue(hsv, i, light) {
var value;
if (light) {
value = hsv.v + brightnessStep1 * i;
} else {
value = hsv.v - brightnessStep2 * i;
}
value = Math.max(0, Math.min(1, value));
return Math.round(value * 100) / 100;
}
function generate(color) {
var opts = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
var patterns = [];
var pColor = new FastColor(color);
var hsv = pColor.toHsv();
for (var i = lightColorCount; i > 0; i -= 1) {
var c = new FastColor({
h: getHue(hsv, i, true),
s: getSaturation(hsv, i, true),
v: getValue(hsv, i, true)
});
patterns.push(c);
}
patterns.push(pColor);
for (var _i = 1; _i <= darkColorCount; _i += 1) {
var _c = new FastColor({
h: getHue(hsv, _i),
s: getSaturation(hsv, _i),
v: getValue(hsv, _i)
});
patterns.push(_c);
}
if (opts.theme === "dark") {
return darkColorMap.map(function(_ref) {
var index = _ref.index, amount = _ref.amount;
return new FastColor(opts.backgroundColor || "#141414").mix(patterns[index], amount).toHexString();
});
}
return patterns.map(function(c2) {
return c2.toHexString();
});
}
// ../../node_modules/.pnpm/@ant-design+colors@7.2.0/node_modules/@ant-design/colors/es/presets.js
var red = ["#fff1f0", "#ffccc7", "#ffa39e", "#ff7875", "#ff4d4f", "#f5222d", "#cf1322", "#a8071a", "#820014", "#5c0011"];
red.primary = red[5];
var volcano = ["#fff2e8", "#ffd8bf", "#ffbb96", "#ff9c6e", "#ff7a45", "#fa541c", "#d4380d", "#ad2102", "#871400", "#610b00"];
volcano.primary = volcano[5];
var orange = ["#fff7e6", "#ffe7ba", "#ffd591", "#ffc069", "#ffa940", "#fa8c16", "#d46b08", "#ad4e00", "#873800", "#612500"];
orange.primary = orange[5];
var gold = ["#fffbe6", "#fff1b8", "#ffe58f", "#ffd666", "#ffc53d", "#faad14", "#d48806", "#ad6800", "#874d00", "#613400"];
gold.primary = gold[5];
var yellow = ["#feffe6", "#ffffb8", "#fffb8f", "#fff566", "#ffec3d", "#fadb14", "#d4b106", "#ad8b00", "#876800", "#614700"];
yellow.primary = yellow[5];
var lime = ["#fcffe6", "#f4ffb8", "#eaff8f", "#d3f261", "#bae637", "#a0d911", "#7cb305", "#5b8c00", "#3f6600", "#254000"];
lime.primary = lime[5];
var green = ["#f6ffed", "#d9f7be", "#b7eb8f", "#95de64", "#73d13d", "#52c41a", "#389e0d", "#237804", "#135200", "#092b00"];
green.primary = green[5];
var cyan = ["#e6fffb", "#b5f5ec", "#87e8de", "#5cdbd3", "#36cfc9", "#13c2c2", "#08979c", "#006d75", "#00474f", "#002329"];
cyan.primary = cyan[5];
var blue = ["#e6f4ff", "#bae0ff", "#91caff", "#69b1ff", "#4096ff", "#1677ff", "#0958d9", "#003eb3", "#002c8c", "#001d66"];
blue.primary = blue[5];
var geekblue = ["#f0f5ff", "#d6e4ff", "#adc6ff", "#85a5ff", "#597ef7", "#2f54eb", "#1d39c4", "#10239e", "#061178", "#030852"];
geekblue.primary = geekblue[5];
var purple = ["#f9f0ff", "#efdbff", "#d3adf7", "#b37feb", "#9254de", "#722ed1", "#531dab", "#391085", "#22075e", "#120338"];
purple.primary = purple[5];
var magenta = ["#fff0f6", "#ffd6e7", "#ffadd2", "#ff85c0", "#f759ab", "#eb2f96", "#c41d7f", "#9e1068", "#780650", "#520339"];
magenta.primary = magenta[5];
var grey = ["#a6a6a6", "#999999", "#8c8c8c", "#808080", "#737373", "#666666", "#404040", "#1a1a1a", "#000000", "#000000"];
grey.primary = grey[5];
var redDark = ["#2a1215", "#431418", "#58181c", "#791a1f", "#a61d24", "#d32029", "#e84749", "#f37370", "#f89f9a", "#fac8c3"];
redDark.primary = redDark[5];
var volcanoDark = ["#2b1611", "#441d12", "#592716", "#7c3118", "#aa3e19", "#d84a1b", "#e87040", "#f3956a", "#f8b692", "#fad4bc"];
volcanoDark.primary = volcanoDark[5];
var orangeDark = ["#2b1d11", "#442a11", "#593815", "#7c4a15", "#aa6215", "#d87a16", "#e89a3c", "#f3b765", "#f8cf8d", "#fae3b7"];
orangeDark.primary = orangeDark[5];
var goldDark = ["#2b2111", "#443111", "#594214", "#7c5914", "#aa7714", "#d89614", "#e8b339", "#f3cc62", "#f8df8b", "#faedb5"];
goldDark.primary = goldDark[5];
var yellowDark = ["#2b2611", "#443b11", "#595014", "#7c6e14", "#aa9514", "#d8bd14", "#e8d639", "#f3ea62", "#f8f48b", "#fafab5"];
yellowDark.primary = yellowDark[5];
var limeDark = ["#1f2611", "#2e3c10", "#3e4f13", "#536d13", "#6f9412", "#8bbb11", "#a9d134", "#c9e75d", "#e4f88b", "#f0fab5"];
limeDark.primary = limeDark[5];
var greenDark = ["#162312", "#1d3712", "#274916", "#306317", "#3c8618", "#49aa19", "#6abe39", "#8fd460", "#b2e58b", "#d5f2bb"];
greenDark.primary = greenDark[5];
var cyanDark = ["#112123", "#113536", "#144848", "#146262", "#138585", "#13a8a8", "#33bcb7", "#58d1c9", "#84e2d8", "#b2f1e8"];
cyanDark.primary = cyanDark[5];
var blueDark = ["#111a2c", "#112545", "#15325b", "#15417e", "#1554ad", "#1668dc", "#3c89e8", "#65a9f3", "#8dc5f8", "#b7dcfa"];
blueDark.primary = blueDark[5];
var geekblueDark = ["#131629", "#161d40", "#1c2755", "#203175", "#263ea0", "#2b4acb", "#5273e0", "#7f9ef3", "#a8c1f8", "#d2e0fa"];
geekblueDark.primary = geekblueDark[5];
var purpleDark = ["#1a1325", "#24163a", "#301c4d", "#3e2069", "#51258f", "#642ab5", "#854eca", "#ab7ae0", "#cda8f0", "#ebd7fa"];
purpleDark.primary = purpleDark[5];
var magentaDark = ["#291321", "#40162f", "#551c3b", "#75204f", "#a02669", "#cb2b83", "#e0529c", "#f37fb7", "#f8a8cc", "#fad2e3"];
magentaDark.primary = magentaDark[5];
var greyDark = ["#151515", "#1f1f1f", "#2d2d2d", "#393939", "#494949", "#5a5a5a", "#6a6a6a", "#7b7b7b", "#888888", "#969696"];
greyDark.primary = greyDark[5];
// ../../node_modules/.pnpm/@babel+runtime@7.26.9/node_modules/@babel/runtime/helpers/esm/objectSpread2.js
function ownKeys(e, r) {
var t = Object.keys(e);
if (Object.getOwnPropertySymbols) {
var o = Object.getOwnPropertySymbols(e);
r && (o = o.filter(function(r2) {
return Object.getOwnPropertyDescriptor(e, r2).enumerable;
})), t.push.apply(t, o);
}
return t;
}
function _objectSpread2(e) {
for (var r = 1; r < arguments.length; r++) {
var t = null != arguments[r] ? arguments[r] : {};
r % 2 ? ownKeys(Object(t), true).forEach(function(r2) {
_defineProperty(e, r2, t[r2]);
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function(r2) {
Object.definePropert