@loopstack/loopstack-studio 0.25.0 → 0.25.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/ai-elements/message.js +2 -2
- package/dist/components/ai-elements/reasoning.js +9 -9
- package/dist/loopstack-studio.css +1 -1
- package/dist/node_modules/@chevrotain/gast/lib/src/helpers.js +2 -5
- package/dist/node_modules/@chevrotain/gast/lib/src/model.js +69 -72
- package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/{architecture-7HQA4BMR.js → architecture-YZFGNWBL.js} +2 -2
- package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/{chunk-TQ3KTPDO.js → chunk-2KRD3SAO.js} +1 -1
- package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/{chunk-4F5CHEZ2.js → chunk-67CJDMHE.js} +1 -1
- package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/{chunk-UMXZTB3W.js → chunk-7N4EOEYR.js} +5 -2
- package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/{chunk-PL6DKKU2.js → chunk-AA7GKIK3.js} +1 -1
- package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/chunk-CIAEETIT.js +23 -0
- package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/{chunk-SJTYNZTY.js → chunk-FOC6F5B3.js} +1 -1
- package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/chunk-K5T4RW27.js +1197 -0
- package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/{chunk-FRFDVMJY.js → chunk-KGLVRYIC.js} +1 -1
- package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/{chunk-B2363JML.js → chunk-LIHQZDEY.js} +1 -1
- package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/chunk-ORNJ4GCN.js +29 -0
- package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/{gitGraph-G5XIXVHT.js → gitGraph-7Q5UKJZL.js} +2 -2
- package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/info-OMHHGYJF.js +3 -0
- package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/packet-4T2RLAQJ.js +3 -0
- package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/pie-ZZUOXDRM.js +3 -0
- package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/radar-PYXPWWZC.js +3 -0
- package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/treeView-SZITEDCU.js +3 -0
- package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/treemap-W4RFUUIX.js +3 -0
- package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/wardley-RL74JXVD.js +3 -0
- package/dist/node_modules/@mermaid-js/parser/dist/mermaid-parser.core.js +27 -17
- package/dist/node_modules/@upsetjs/venn.js/build/venn.esm.js +903 -0
- package/dist/node_modules/@xyflow/react/dist/esm/index.js +76 -75
- package/dist/node_modules/@xyflow/system/dist/esm/index.js +30 -28
- package/dist/node_modules/chevrotain/lib/src/parse/cst/cst_visitor.js +31 -40
- package/dist/node_modules/chevrotain/lib/src/parse/errors_public.js +23 -26
- package/dist/node_modules/chevrotain/lib/src/parse/exceptions_public.js +12 -13
- package/dist/node_modules/chevrotain/lib/src/parse/grammar/checks.js +181 -205
- package/dist/node_modules/chevrotain/lib/src/parse/grammar/first.js +11 -13
- package/dist/node_modules/chevrotain/lib/src/parse/grammar/follow.js +12 -13
- package/dist/node_modules/chevrotain/lib/src/parse/grammar/gast/gast_resolver_public.js +8 -9
- package/dist/node_modules/chevrotain/lib/src/parse/grammar/interpreter.js +176 -183
- package/dist/node_modules/chevrotain/lib/src/parse/grammar/llk_lookahead.js +17 -19
- package/dist/node_modules/chevrotain/lib/src/parse/grammar/lookahead.js +153 -160
- package/dist/node_modules/chevrotain/lib/src/parse/grammar/resolver.js +10 -12
- package/dist/node_modules/chevrotain/lib/src/parse/grammar/rest.js +36 -38
- package/dist/node_modules/chevrotain/lib/src/parse/parser/parser.js +37 -45
- package/dist/node_modules/chevrotain/lib/src/parse/parser/traits/error_handler.js +12 -14
- package/dist/node_modules/chevrotain/lib/src/parse/parser/traits/gast_recorder.js +80 -86
- package/dist/node_modules/chevrotain/lib/src/parse/parser/traits/lexer_adapter.js +6 -2
- package/dist/node_modules/chevrotain/lib/src/parse/parser/traits/looksahead.js +39 -41
- package/dist/node_modules/chevrotain/lib/src/parse/parser/traits/perf_tracer.js +7 -8
- package/dist/node_modules/chevrotain/lib/src/parse/parser/traits/recognizer_api.js +69 -70
- package/dist/node_modules/chevrotain/lib/src/parse/parser/traits/recognizer_engine.js +215 -205
- package/dist/node_modules/chevrotain/lib/src/parse/parser/traits/recoverable.js +76 -76
- package/dist/node_modules/chevrotain/lib/src/parse/parser/traits/tree_builder.js +29 -39
- package/dist/node_modules/chevrotain/lib/src/scan/lexer.js +252 -274
- package/dist/node_modules/chevrotain/lib/src/scan/lexer_public.js +93 -106
- package/dist/node_modules/chevrotain/lib/src/scan/reg_exp.js +61 -61
- package/dist/node_modules/chevrotain/lib/src/scan/tokens.js +31 -41
- package/dist/node_modules/chevrotain/lib/src/scan/tokens_public.js +15 -18
- package/dist/node_modules/chevrotain-allstar/lib/all-star-lookahead.js +226 -226
- package/dist/node_modules/chevrotain-allstar/lib/atn.js +17 -17
- package/dist/node_modules/cytoscape/dist/cytoscape.esm.js +17 -14
- package/dist/node_modules/dagre-d3-es/src/dagre/greedy-fas.js +19 -19
- package/dist/node_modules/dagre-d3-es/src/dagre/layout.js +48 -48
- package/dist/node_modules/dagre-d3-es/src/dagre/nesting-graph.js +9 -9
- package/dist/node_modules/dagre-d3-es/src/dagre/order/cross-count.js +3 -3
- package/dist/node_modules/dagre-d3-es/src/dagre/order/index.js +11 -11
- package/dist/node_modules/dagre-d3-es/src/dagre/order/init-order.js +4 -4
- package/dist/node_modules/dagre-d3-es/src/dagre/order/resolve-conflicts.js +4 -4
- package/dist/node_modules/dagre-d3-es/src/dagre/order/sort-subgraph.js +8 -8
- package/dist/node_modules/dagre-d3-es/src/dagre/order/sort.js +5 -5
- package/dist/node_modules/dagre-d3-es/src/dagre/position/bk.js +61 -61
- package/dist/node_modules/dagre-d3-es/src/dagre/position/index.js +1 -1
- package/dist/node_modules/dagre-d3-es/src/dagre/rank/network-simplex.js +25 -25
- package/dist/node_modules/dagre-d3-es/src/dagre/rank/util.js +8 -8
- package/dist/node_modules/dagre-d3-es/src/dagre/util.js +48 -48
- package/dist/node_modules/dagre-d3-es/src/graphlib/graph.js +109 -109
- package/dist/node_modules/dagre-d3-es/src/graphlib/json.js +17 -17
- package/dist/node_modules/dompurify/dist/purify.es.js +67 -67
- package/dist/node_modules/katex/dist/katex.js +1256 -1209
- package/dist/node_modules/khroma/dist/methods/transparentize.js +3 -0
- package/dist/node_modules/lodash-es/_baseClone.js +2 -2
- package/dist/node_modules/lodash-es/_baseMatchesProperty.js +6 -6
- package/dist/node_modules/lodash-es/_baseToString.js +1 -1
- package/dist/node_modules/lodash-es/_baseUniq.js +1 -1
- package/dist/node_modules/lodash-es/_createSet.js +1 -1
- package/dist/node_modules/lodash-es/_getAllKeys.js +2 -2
- package/dist/node_modules/lodash-es/_getAllKeysIn.js +1 -1
- package/dist/node_modules/lodash-es/findIndex.js +2 -2
- package/dist/node_modules/lodash-es/flatMap.js +1 -1
- package/dist/node_modules/lodash-es/forEach.js +1 -1
- package/dist/node_modules/lodash-es/max.js +1 -1
- package/dist/node_modules/lodash-es/min.js +1 -1
- package/dist/node_modules/lodash-es/minBy.js +1 -1
- package/dist/node_modules/lodash-es/reduce.js +1 -1
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/architectureDiagram-Q4EWVU46.js +691 -0
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{blockDiagram-VD42YOAC.js → blockDiagram-DXYQGD6D.js} +183 -157
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{c4Diagram-YG6GDRKO.js → c4Diagram-AHTNJAMY.js} +65 -63
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/chunk-336JU56O.js +47 -0
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{chunk-EXTU4WIE.js → chunk-426QAEUC.js} +1 -1
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{chunk-B4BG7PRW.js → chunk-4TB4RGXK.js} +533 -393
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/chunk-5FUZZQ4R.js +3638 -0
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{chunk-S3R3BYOJ.js → chunk-5PVQY5BW.js} +1 -1
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{chunk-HN2XXSSU.js → chunk-BSJP7CBP.js} +20 -14
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{chunk-QN33PNHL.js → chunk-EDXVE4YY.js} +1 -1
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/chunk-ENJZ2VHE.js +568 -0
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/chunk-ICPOFSXX.js +2320 -0
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{chunk-DI55MBZ5.js → chunk-OYMX7WX6.js} +35 -21
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/chunk-U2HBQHQK.js +272 -0
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{chunk-ATLVNIR6.js → chunk-X2U36JSP.js} +1 -1
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{chunk-MI3HLSF2.js → chunk-XPW4576I.js} +11 -7
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/chunk-YZCP3GAM.js +60 -0
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/chunk-ZZ45TVLE.js +30 -0
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{classDiagram-2ON5EDUG.js → classDiagram-6PBFFD2Q.js} +12 -11
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{classDiagram-v2-WZHVMYZB.js → classDiagram-v2-HSJHXN6E.js} +12 -11
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{dagre-6UL2VRFP.js → dagre-KV5264BT.js} +8 -8
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/diagram-5BDNPKRD.js +99 -0
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{diagram-PSM6KHXK.js → diagram-G4DWMVQ6.js} +20 -23
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/diagram-MMDJMWI5.js +211 -0
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{diagram-S2PKOQOG.js → diagram-TYMM5635.js} +4 -4
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{erDiagram-Q2GNP2WA.js → erDiagram-SMLLAGMA.js} +486 -386
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{flowDiagram-NV44I4VS.js → flowDiagram-DWJPFMVM.js} +915 -898
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{ganttDiagram-JELNMOA3.js → ganttDiagram-T4ZO3ILL.js} +59 -29
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/gitGraphDiagram-UUTBAWPF.js +728 -0
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/infoDiagram-42DDH7IO.js +17 -0
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/ishikawaDiagram-UXIWVN3A.js +714 -0
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{journeyDiagram-XKPGCS4Q.js → journeyDiagram-VCZTEJTY.js} +32 -32
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{kanban-definition-3W4ZIXB7.js → kanban-definition-6JOO6SKY.js} +13 -9
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{mindmap-definition-VGOIOE7T.js → mindmap-definition-QFDTVHPH.js} +105 -59
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/pieDiagram-DEJITSTG.js +117 -0
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{quadrantDiagram-AYHSOK5B.js → quadrantDiagram-34T5L4WZ.js} +1 -1
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{requirementDiagram-UZGBJVZJ.js → requirementDiagram-MS252O5E.js} +49 -19
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{sankeyDiagram-TZEHDZUN.js → sankeyDiagram-XADWPNL6.js} +1 -1
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/sequenceDiagram-FGHM5R23.js +4155 -0
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{stateDiagram-FKZM4ZOC.js → stateDiagram-FHFEXIEX.js} +12 -12
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{stateDiagram-v2-4FDKWEC3.js → stateDiagram-v2-QKLJ7IA2.js} +11 -11
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/timeline-definition-GMOUNBTQ.js +1071 -0
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/vennDiagram-DHZGUBPP.js +959 -0
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/wardleyDiagram-NUSXRM2D.js +574 -0
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{xychartDiagram-PRI3JC2R.js → xychartDiagram-5P7HB3ND.js} +38 -35
- package/dist/node_modules/mermaid/dist/mermaid.core.js +235 -192
- package/dist/node_modules/nanoid/url-alphabet/index.js +1 -1
- package/dist/node_modules/remend/dist/index.js +333 -264
- package/dist/node_modules/streamdown/dist/chunk-BO2N2NFS.js +2498 -0
- package/dist/node_modules/streamdown/dist/highlighted-body-OFNGDK62.js +35 -0
- package/dist/node_modules/streamdown/dist/index.js +1 -1
- package/dist/node_modules/streamdown/dist/mermaid-GHXKKRXX.js +3 -0
- package/dist/node_modules/streamdown/node_modules/marked/lib/marked.esm.js +672 -667
- package/dist/pages/DashboardPage.js +3 -3
- package/package.json +2 -2
- package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/chunk-TCCFYFTB.js +0 -787
- package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/info-VBDWY6EO.js +0 -3
- package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/packet-DYOGHKS2.js +0 -3
- package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/pie-VRWISCQL.js +0 -3
- package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/radar-ZZBFDIW7.js +0 -3
- package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/treemap-GDKQZRPO.js +0 -3
- package/dist/node_modules/chevrotain/lib/src/parse/parser/traits/context_assist.js +0 -16
- package/dist/node_modules/lodash-es/_arrayAggregator.js +0 -9
- package/dist/node_modules/lodash-es/_arrayEvery.js +0 -6
- package/dist/node_modules/lodash-es/_baseAggregator.js +0 -8
- package/dist/node_modules/lodash-es/_baseDifference.js +0 -22
- package/dist/node_modules/lodash-es/_baseEvery.js +0 -9
- package/dist/node_modules/lodash-es/_baseIsRegExp.js +0 -8
- package/dist/node_modules/lodash-es/_baseSlice.js +0 -8
- package/dist/node_modules/lodash-es/_baseSome.js +0 -9
- package/dist/node_modules/lodash-es/_createAggregator.js +0 -12
- package/dist/node_modules/lodash-es/assign.js +0 -14
- package/dist/node_modules/lodash-es/compact.js +0 -9
- package/dist/node_modules/lodash-es/difference.js +0 -8
- package/dist/node_modules/lodash-es/drop.js +0 -8
- package/dist/node_modules/lodash-es/dropRight.js +0 -8
- package/dist/node_modules/lodash-es/every.js +0 -11
- package/dist/node_modules/lodash-es/groupBy.js +0 -6
- package/dist/node_modules/lodash-es/head.js +0 -5
- package/dist/node_modules/lodash-es/includes.js +0 -13
- package/dist/node_modules/lodash-es/indexOf.js +0 -11
- package/dist/node_modules/lodash-es/isRegExp.js +0 -5
- package/dist/node_modules/lodash-es/negate.js +0 -16
- package/dist/node_modules/lodash-es/pickBy.js +0 -15
- package/dist/node_modules/lodash-es/reject.js +0 -10
- package/dist/node_modules/lodash-es/some.js +0 -11
- package/dist/node_modules/lodash-es/uniq.js +0 -6
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/architectureDiagram-VXUJARFQ.js +0 -673
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/chunk-ABZYJK2D.js +0 -1547
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/chunk-CVBHYZKI.js +0 -10
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/chunk-DR5Q36YT.js +0 -135
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/chunk-JA3XYJ7Z.js +0 -247
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/chunk-JZLCHNYA.js +0 -3516
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/chunk-N4CR4FBY.js +0 -39
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/chunk-QXUST7PY.js +0 -497
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/chunk-TZMSLE5B.js +0 -55
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/diagram-QEK2KX5R.js +0 -211
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/gitGraphDiagram-V2S2FVAM.js +0 -621
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/infoDiagram-HS3SLOUP.js +0 -18
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/pieDiagram-ADFJNKIX.js +0 -117
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/sequenceDiagram-WL72ISMW.js +0 -3560
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/timeline-definition-IT6M3QCI.js +0 -833
- package/dist/node_modules/streamdown/dist/chunk-RLXIAIE6.js +0 -2189
- package/dist/node_modules/streamdown/dist/highlighted-body-B3W2YXNL.js +0 -33
- package/dist/node_modules/streamdown/dist/mermaid-3ZIDBTTL.js +0 -3
|
@@ -0,0 +1,2498 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { SKIP, visitParents } from "../../unist-util-visit-parents/lib/index.js";
|
|
3
|
+
import { visit } from "../../unist-util-visit/lib/index.js";
|
|
4
|
+
import remarkGfm from "../../remark-gfm/lib/index.js";
|
|
5
|
+
import { harden } from "../../rehype-harden/dist/index.js";
|
|
6
|
+
import rehypeRaw from "../../rehype-raw/lib/index.js";
|
|
7
|
+
import { defaultSchema } from "../../hast-util-sanitize/lib/schema.js";
|
|
8
|
+
import rehypeSanitize from "../../rehype-sanitize/lib/index.js";
|
|
9
|
+
import { $e } from "../../remend/dist/index.js";
|
|
10
|
+
import { toJsxRuntime } from "../../hast-util-to-jsx-runtime/lib/index.js";
|
|
11
|
+
import { urlAttributes } from "../../html-url-attributes/lib/index.js";
|
|
12
|
+
import remarkParse from "../../remark-parse/lib/index.js";
|
|
13
|
+
import remarkRehype from "../../remark-rehype/lib/index.js";
|
|
14
|
+
import { unified } from "../../unified/lib/index.js";
|
|
15
|
+
import { x } from "../node_modules/marked/lib/marked.esm.js";
|
|
16
|
+
import { Suspense, cloneElement, createContext, createElement, isValidElement, lazy, memo, useCallback, useContext, useEffect, useId, useMemo, useRef, useState, useTransition } from "react";
|
|
17
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
18
|
+
import { clsx } from "clsx";
|
|
19
|
+
import { twMerge } from "tailwind-merge";
|
|
20
|
+
import { createPortal } from "react-dom";
|
|
21
|
+
var Bn = 300, An = "300px", On = 500;
|
|
22
|
+
function Rt(e = {}) {
|
|
23
|
+
let { immediate: t = !1, debounceDelay: n = Bn, rootMargin: r = An, idleTimeout: i = On } = e, [a, o] = useState(!1), s = useRef(null), c = useRef(null), l = useRef(null), u = useMemo(() => (e) => {
|
|
24
|
+
let t = Date.now();
|
|
25
|
+
return window.setTimeout(() => {
|
|
26
|
+
e({
|
|
27
|
+
didTimeout: !1,
|
|
28
|
+
timeRemaining: () => Math.max(0, 50 - (Date.now() - t))
|
|
29
|
+
});
|
|
30
|
+
}, 1);
|
|
31
|
+
}, []), d = useMemo(() => typeof window < "u" && window.requestIdleCallback ? (e, t) => window.requestIdleCallback(e, t) : u, [u]), f = useMemo(() => typeof window < "u" && window.cancelIdleCallback ? (e) => window.cancelIdleCallback(e) : (e) => {
|
|
32
|
+
clearTimeout(e);
|
|
33
|
+
}, []);
|
|
34
|
+
return useEffect(() => {
|
|
35
|
+
if (t) {
|
|
36
|
+
o(!0);
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
let e = s.current;
|
|
40
|
+
if (!e) return;
|
|
41
|
+
c.current &&= (clearTimeout(c.current), null), l.current &&= (f(l.current), null);
|
|
42
|
+
let a = () => {
|
|
43
|
+
c.current &&= (clearTimeout(c.current), null), l.current &&= (f(l.current), null);
|
|
44
|
+
}, u = (e) => {
|
|
45
|
+
l.current = d((t) => {
|
|
46
|
+
t.timeRemaining() > 0 || t.didTimeout ? (o(!0), e.disconnect()) : l.current = d(() => {
|
|
47
|
+
o(!0), e.disconnect();
|
|
48
|
+
}, { timeout: i / 2 });
|
|
49
|
+
}, { timeout: i });
|
|
50
|
+
}, p = (e) => {
|
|
51
|
+
a(), c.current = window.setTimeout(() => {
|
|
52
|
+
var t;
|
|
53
|
+
let n = e.takeRecords();
|
|
54
|
+
(n.length === 0 || (t = n.at(-1)?.isIntersecting) != null && t) && u(e);
|
|
55
|
+
}, n);
|
|
56
|
+
}, m = (e, t) => {
|
|
57
|
+
e.isIntersecting ? p(t) : a();
|
|
58
|
+
}, h = new IntersectionObserver((e) => {
|
|
59
|
+
for (let t of e) m(t, h);
|
|
60
|
+
}, {
|
|
61
|
+
rootMargin: r,
|
|
62
|
+
threshold: 0
|
|
63
|
+
});
|
|
64
|
+
return h.observe(e), () => {
|
|
65
|
+
c.current && clearTimeout(c.current), l.current && f(l.current), h.disconnect();
|
|
66
|
+
};
|
|
67
|
+
}, [
|
|
68
|
+
t,
|
|
69
|
+
n,
|
|
70
|
+
r,
|
|
71
|
+
i,
|
|
72
|
+
f,
|
|
73
|
+
d
|
|
74
|
+
]), {
|
|
75
|
+
shouldRender: a,
|
|
76
|
+
containerRef: s
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
var St = /\s/, Fn = /^\s+$/, zn = new Set([
|
|
80
|
+
"code",
|
|
81
|
+
"pre",
|
|
82
|
+
"svg",
|
|
83
|
+
"math",
|
|
84
|
+
"annotation"
|
|
85
|
+
]), _n = (e) => typeof e == "object" && !!e && "type" in e && e.type === "element", qn = (e) => e.some((e) => _n(e) && zn.has(e.tagName)), $n = (e) => {
|
|
86
|
+
let t = [], n = "", r = !1;
|
|
87
|
+
for (let i of e) {
|
|
88
|
+
let e = St.test(i);
|
|
89
|
+
e !== r && n && (t.push(n), n = ""), n += i, r = e;
|
|
90
|
+
}
|
|
91
|
+
return n && t.push(n), t;
|
|
92
|
+
}, Wn = (e) => {
|
|
93
|
+
let t = [], n = "";
|
|
94
|
+
for (let r of e) St.test(r) ? n += r : (n &&= (t.push(n), ""), t.push(r));
|
|
95
|
+
return n && t.push(n), t;
|
|
96
|
+
}, Zn = (e, t, n, r, i, a) => {
|
|
97
|
+
let o = `--sd-animation:sd-${t};--sd-duration:${i ? 0 : n}ms;--sd-easing:${r}`;
|
|
98
|
+
return a && (o += `;--sd-delay:${a}ms`), {
|
|
99
|
+
type: "element",
|
|
100
|
+
tagName: "span",
|
|
101
|
+
properties: {
|
|
102
|
+
"data-sd-animate": !0,
|
|
103
|
+
style: o
|
|
104
|
+
},
|
|
105
|
+
children: [{
|
|
106
|
+
type: "text",
|
|
107
|
+
value: e
|
|
108
|
+
}]
|
|
109
|
+
};
|
|
110
|
+
}, Xn = (t, n, r, i, a) => {
|
|
111
|
+
let o = n.at(-1);
|
|
112
|
+
if (!(o && "children" in o)) return;
|
|
113
|
+
if (qn(n)) return SKIP;
|
|
114
|
+
let s = o, c = s.children.indexOf(t);
|
|
115
|
+
if (c === -1) return;
|
|
116
|
+
let l = t.value;
|
|
117
|
+
if (!l.trim()) {
|
|
118
|
+
a.count += l.length;
|
|
119
|
+
return;
|
|
120
|
+
}
|
|
121
|
+
let u = r.sep === "char" ? Wn(l) : $n(l), d = i.prevContentLength, f = u.map((e) => {
|
|
122
|
+
let t = a.count;
|
|
123
|
+
if (a.count += e.length, Fn.test(e)) return {
|
|
124
|
+
type: "text",
|
|
125
|
+
value: e
|
|
126
|
+
};
|
|
127
|
+
let n = d > 0 && t < d, i = n ? 0 : a.newIndex++ * r.stagger;
|
|
128
|
+
return Zn(e, r.animation, r.duration, r.easing, n, i);
|
|
129
|
+
});
|
|
130
|
+
return s.children.splice(c, 1, ...f), c + f.length;
|
|
131
|
+
}, Jn = 0;
|
|
132
|
+
function be(e) {
|
|
133
|
+
let n = {
|
|
134
|
+
animation: e?.animation ?? "fadeIn",
|
|
135
|
+
duration: e?.duration ?? 150,
|
|
136
|
+
easing: e?.easing ?? "ease",
|
|
137
|
+
sep: e?.sep ?? "word",
|
|
138
|
+
stagger: e?.stagger ?? 40
|
|
139
|
+
}, r = {
|
|
140
|
+
prevContentLength: 0,
|
|
141
|
+
lastRenderCharCount: 0
|
|
142
|
+
}, i = Jn++, a = () => (e) => {
|
|
143
|
+
let i = {
|
|
144
|
+
count: 0,
|
|
145
|
+
newIndex: 0
|
|
146
|
+
};
|
|
147
|
+
visitParents(e, "text", (e, t) => Xn(e, t, n, r, i)), r.lastRenderCharCount = i.count, r.prevContentLength = 0;
|
|
148
|
+
};
|
|
149
|
+
return Object.defineProperty(a, "name", { value: `rehypeAnimate$${i}` }), {
|
|
150
|
+
name: "animate",
|
|
151
|
+
type: "animate",
|
|
152
|
+
rehypePlugin: a,
|
|
153
|
+
setPrevContentLength(e) {
|
|
154
|
+
r.prevContentLength = e;
|
|
155
|
+
},
|
|
156
|
+
getLastRenderCharCount() {
|
|
157
|
+
let e = r.lastRenderCharCount;
|
|
158
|
+
return r.lastRenderCharCount = 0, e;
|
|
159
|
+
}
|
|
160
|
+
};
|
|
161
|
+
}
|
|
162
|
+
be();
|
|
163
|
+
var et = createContext(!1), tt = () => useContext(et), he = (...e) => twMerge(clsx(e)), Gn = (e, t) => {
|
|
164
|
+
if (!e || !t) return t;
|
|
165
|
+
let n = `${e}:`;
|
|
166
|
+
return t.split(/\s+/).filter(Boolean).map((t) => t.startsWith(n) ? t : `${e}:${t}`).join(" ");
|
|
167
|
+
}, Dt = (e) => e ? (...t) => Gn(e, twMerge(clsx(t))) : he, W = (e, t, n) => {
|
|
168
|
+
let r = typeof t == "string" && n.startsWith("text/csv") ? "" : "", i = typeof t == "string" ? new Blob([r + t], { type: n }) : t, a = URL.createObjectURL(i), o = document.createElement("a");
|
|
169
|
+
o.href = a, o.download = e, document.body.appendChild(o), o.click(), document.body.removeChild(o), URL.revokeObjectURL(a);
|
|
170
|
+
}, Ee = createContext(he), y = () => useContext(Ee), tr = he("block", "before:content-[counter(line)]", "before:inline-block", "before:[counter-increment:line]", "before:w-6", "before:mr-4", "before:text-[13px]", "before:text-right", "before:text-muted-foreground/50", "before:font-mono", "before:select-none"), or = (e) => {
|
|
171
|
+
let t = {};
|
|
172
|
+
for (let n of e.split(";")) {
|
|
173
|
+
let e = n.indexOf(":");
|
|
174
|
+
if (e > 0) {
|
|
175
|
+
let r = n.slice(0, e).trim(), i = n.slice(e + 1).trim();
|
|
176
|
+
r && i && (t[r] = i);
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
return t;
|
|
180
|
+
}, At = memo(({ children: e, result: t, language: n, className: r, startLine: i, lineNumbers: a = !0, ...o }) => {
|
|
181
|
+
let s = y(), c = useMemo(() => s(tr), [s]), l = useMemo(() => {
|
|
182
|
+
let e = {};
|
|
183
|
+
return t.bg && (e["--sdm-bg"] = t.bg), t.fg && (e["--sdm-fg"] = t.fg), t.rootStyle && Object.assign(e, or(t.rootStyle)), e;
|
|
184
|
+
}, [
|
|
185
|
+
t.bg,
|
|
186
|
+
t.fg,
|
|
187
|
+
t.rootStyle
|
|
188
|
+
]);
|
|
189
|
+
return jsx("div", {
|
|
190
|
+
className: s(r, "overflow-x-auto rounded-md border border-border bg-background p-4 text-sm"),
|
|
191
|
+
"data-language": n,
|
|
192
|
+
"data-streamdown": "code-block-body",
|
|
193
|
+
...o,
|
|
194
|
+
children: jsx("pre", {
|
|
195
|
+
className: s(r, "bg-[var(--sdm-bg,inherit]", "dark:bg-[var(--shiki-dark-bg,var(--sdm-bg,inherit)]"),
|
|
196
|
+
style: l,
|
|
197
|
+
children: jsx("code", {
|
|
198
|
+
className: a ? s("[counter-increment:line_0] [counter-reset:line]") : void 0,
|
|
199
|
+
style: a && i && i > 1 ? { counterReset: `line ${i - 1}` } : void 0,
|
|
200
|
+
children: t.tokens.map((e, t) => jsx("span", {
|
|
201
|
+
className: a ? c : void 0,
|
|
202
|
+
children: e.length === 0 || e.length === 1 && e[0].content === "" ? "\n" : e.map((e, t) => {
|
|
203
|
+
let n = {}, r = !!e.bgColor;
|
|
204
|
+
if (e.color && (n["--sdm-c"] = e.color), e.bgColor && (n["--sdm-tbg"] = e.bgColor), e.htmlStyle) for (let [t, i] of Object.entries(e.htmlStyle)) t === "color" ? n["--sdm-c"] = i : t === "background-color" ? (n["--sdm-tbg"] = i, r = !0) : n[t] = i;
|
|
205
|
+
return jsx("span", {
|
|
206
|
+
className: s("text-[var(--sdm-c,inherit)]", "dark:text-[var(--shiki-dark,var(--sdm-c,inherit))]", r && "bg-[var(--sdm-tbg)]", r && "dark:bg-[var(--shiki-dark-bg,var(--sdm-tbg))]"),
|
|
207
|
+
style: n,
|
|
208
|
+
...e.htmlAttrs,
|
|
209
|
+
children: e.content
|
|
210
|
+
}, t);
|
|
211
|
+
})
|
|
212
|
+
}, t))
|
|
213
|
+
})
|
|
214
|
+
})
|
|
215
|
+
});
|
|
216
|
+
}, (e, t) => e.result === t.result && e.language === t.language && e.className === t.className && e.startLine === t.startLine && e.lineNumbers === t.lineNumbers), ot = ({ className: e, language: t, style: n, isIncomplete: r, ...i }) => jsx("div", {
|
|
217
|
+
className: y()("my-4 flex w-full flex-col gap-2 rounded-xl border border-border bg-sidebar p-2", e),
|
|
218
|
+
"data-incomplete": r || void 0,
|
|
219
|
+
"data-language": t,
|
|
220
|
+
"data-streamdown": "code-block",
|
|
221
|
+
style: {
|
|
222
|
+
contentVisibility: "auto",
|
|
223
|
+
containIntrinsicSize: "auto 200px",
|
|
224
|
+
...n
|
|
225
|
+
},
|
|
226
|
+
...i
|
|
227
|
+
}), nt = createContext({ code: "" }), He = () => useContext(nt), rt = ({ language: e }) => {
|
|
228
|
+
let t = y();
|
|
229
|
+
return jsx("div", {
|
|
230
|
+
className: t("flex h-8 items-center text-muted-foreground text-xs"),
|
|
231
|
+
"data-language": e,
|
|
232
|
+
"data-streamdown": "code-block-header",
|
|
233
|
+
children: jsx("span", {
|
|
234
|
+
className: t("ml-1 font-mono lowercase"),
|
|
235
|
+
children: e
|
|
236
|
+
})
|
|
237
|
+
});
|
|
238
|
+
}, lr = (e) => {
|
|
239
|
+
let t = e.length;
|
|
240
|
+
for (; t > 0 && e[t - 1] === "\n";) t--;
|
|
241
|
+
return e.slice(0, t);
|
|
242
|
+
}, cr = lazy(() => import("./highlighted-body-OFNGDK62.js").then((e) => ({ default: e.HighlightedCodeBlockBody }))), st = ({ code: e, language: t, className: n, children: r, isIncomplete: i = !1, startLine: a, lineNumbers: o, ...s }) => {
|
|
243
|
+
let c = y(), l = useMemo(() => lr(e), [e]), u = useMemo(() => ({
|
|
244
|
+
bg: "transparent",
|
|
245
|
+
fg: "inherit",
|
|
246
|
+
tokens: l.split("\n").map((e) => [{
|
|
247
|
+
content: e,
|
|
248
|
+
color: "inherit",
|
|
249
|
+
bgColor: "transparent",
|
|
250
|
+
htmlStyle: {},
|
|
251
|
+
offset: 0
|
|
252
|
+
}])
|
|
253
|
+
}), [l]);
|
|
254
|
+
return jsx(nt.Provider, {
|
|
255
|
+
value: { code: e },
|
|
256
|
+
children: jsxs(ot, {
|
|
257
|
+
isIncomplete: i,
|
|
258
|
+
language: t,
|
|
259
|
+
children: [
|
|
260
|
+
jsx(rt, { language: t }),
|
|
261
|
+
r ? jsx("div", {
|
|
262
|
+
className: c("pointer-events-none sticky top-2 z-10 -mt-10 flex h-8 items-center justify-end"),
|
|
263
|
+
children: jsx("div", {
|
|
264
|
+
className: c("pointer-events-auto flex shrink-0 items-center gap-2 rounded-md border border-sidebar bg-sidebar/80 px-1.5 py-1 supports-[backdrop-filter]:bg-sidebar/70 supports-[backdrop-filter]:backdrop-blur"),
|
|
265
|
+
"data-streamdown": "code-block-actions",
|
|
266
|
+
children: r
|
|
267
|
+
})
|
|
268
|
+
}) : null,
|
|
269
|
+
jsx(Suspense, {
|
|
270
|
+
fallback: jsx(At, {
|
|
271
|
+
className: n,
|
|
272
|
+
language: t,
|
|
273
|
+
lineNumbers: o,
|
|
274
|
+
result: u,
|
|
275
|
+
startLine: a,
|
|
276
|
+
...s
|
|
277
|
+
}),
|
|
278
|
+
children: jsx(cr, {
|
|
279
|
+
className: n,
|
|
280
|
+
code: l,
|
|
281
|
+
language: t,
|
|
282
|
+
lineNumbers: o,
|
|
283
|
+
raw: u,
|
|
284
|
+
startLine: a,
|
|
285
|
+
...s
|
|
286
|
+
})
|
|
287
|
+
})
|
|
288
|
+
]
|
|
289
|
+
})
|
|
290
|
+
});
|
|
291
|
+
}, we = {
|
|
292
|
+
CheckIcon: (e) => jsx("svg", {
|
|
293
|
+
color: "currentColor",
|
|
294
|
+
height: 16,
|
|
295
|
+
strokeLinejoin: "round",
|
|
296
|
+
viewBox: "0 0 16 16",
|
|
297
|
+
width: 16,
|
|
298
|
+
...e,
|
|
299
|
+
children: jsx("path", {
|
|
300
|
+
clipRule: "evenodd",
|
|
301
|
+
d: "M15.5607 3.99999L15.0303 4.53032L6.23744 13.3232C5.55403 14.0066 4.44599 14.0066 3.76257 13.3232L4.2929 12.7929L3.76257 13.3232L0.969676 10.5303L0.439346 9.99999L1.50001 8.93933L2.03034 9.46966L4.82323 12.2626C4.92086 12.3602 5.07915 12.3602 5.17678 12.2626L13.9697 3.46966L14.5 2.93933L15.5607 3.99999Z",
|
|
302
|
+
fill: "currentColor",
|
|
303
|
+
fillRule: "evenodd"
|
|
304
|
+
})
|
|
305
|
+
}),
|
|
306
|
+
CopyIcon: (e) => jsx("svg", {
|
|
307
|
+
color: "currentColor",
|
|
308
|
+
height: 16,
|
|
309
|
+
strokeLinejoin: "round",
|
|
310
|
+
viewBox: "0 0 16 16",
|
|
311
|
+
width: 16,
|
|
312
|
+
...e,
|
|
313
|
+
children: jsx("path", {
|
|
314
|
+
clipRule: "evenodd",
|
|
315
|
+
d: "M2.75 0.5C1.7835 0.5 1 1.2835 1 2.25V9.75C1 10.7165 1.7835 11.5 2.75 11.5H3.75H4.5V10H3.75H2.75C2.61193 10 2.5 9.88807 2.5 9.75V2.25C2.5 2.11193 2.61193 2 2.75 2H8.25C8.38807 2 8.5 2.11193 8.5 2.25V3H10V2.25C10 1.2835 9.2165 0.5 8.25 0.5H2.75ZM7.75 4.5C6.7835 4.5 6 5.2835 6 6.25V13.75C6 14.7165 6.7835 15.5 7.75 15.5H13.25C14.2165 15.5 15 14.7165 15 13.75V6.25C15 5.2835 14.2165 4.5 13.25 4.5H7.75ZM7.5 6.25C7.5 6.11193 7.61193 6 7.75 6H13.25C13.3881 6 13.5 6.11193 13.5 6.25V13.75C13.5 13.8881 13.3881 14 13.25 14H7.75C7.61193 14 7.5 13.8881 7.5 13.75V6.25Z",
|
|
316
|
+
fill: "currentColor",
|
|
317
|
+
fillRule: "evenodd"
|
|
318
|
+
})
|
|
319
|
+
}),
|
|
320
|
+
DownloadIcon: (e) => jsx("svg", {
|
|
321
|
+
color: "currentColor",
|
|
322
|
+
height: 16,
|
|
323
|
+
strokeLinejoin: "round",
|
|
324
|
+
viewBox: "0 0 16 16",
|
|
325
|
+
width: 16,
|
|
326
|
+
...e,
|
|
327
|
+
children: jsx("path", {
|
|
328
|
+
clipRule: "evenodd",
|
|
329
|
+
d: "M8.75 1V1.75V8.68934L10.7197 6.71967L11.25 6.18934L12.3107 7.25L11.7803 7.78033L8.70711 10.8536C8.31658 11.2441 7.68342 11.2441 7.29289 10.8536L4.21967 7.78033L3.68934 7.25L4.75 6.18934L5.28033 6.71967L7.25 8.68934V1.75V1H8.75ZM13.5 9.25V13.5H2.5V9.25V8.5H1V9.25V14C1 14.5523 1.44771 15 2 15H14C14.5523 15 15 14.5523 15 14V9.25V8.5H13.5V9.25Z",
|
|
330
|
+
fill: "currentColor",
|
|
331
|
+
fillRule: "evenodd"
|
|
332
|
+
})
|
|
333
|
+
}),
|
|
334
|
+
ExternalLinkIcon: (e) => jsx("svg", {
|
|
335
|
+
color: "currentColor",
|
|
336
|
+
height: 16,
|
|
337
|
+
strokeLinejoin: "round",
|
|
338
|
+
viewBox: "0 0 16 16",
|
|
339
|
+
width: 16,
|
|
340
|
+
...e,
|
|
341
|
+
children: jsx("path", {
|
|
342
|
+
clipRule: "evenodd",
|
|
343
|
+
d: "M13.5 10.25V13.25C13.5 13.3881 13.3881 13.5 13.25 13.5H2.75C2.61193 13.5 2.5 13.3881 2.5 13.25L2.5 2.75C2.5 2.61193 2.61193 2.5 2.75 2.5H5.75H6.5V1H5.75H2.75C1.7835 1 1 1.7835 1 2.75V13.25C1 14.2165 1.7835 15 2.75 15H13.25C14.2165 15 15 14.2165 15 13.25V10.25V9.5H13.5V10.25ZM9 1H9.75H14.2495C14.6637 1 14.9995 1.33579 14.9995 1.75V6.25V7H13.4995V6.25V3.56066L8.53033 8.52978L8 9.06011L6.93934 7.99945L7.46967 7.46912L12.4388 2.5H9.75H9V1Z",
|
|
344
|
+
fill: "currentColor",
|
|
345
|
+
fillRule: "evenodd"
|
|
346
|
+
})
|
|
347
|
+
}),
|
|
348
|
+
Loader2Icon: (e) => jsxs("svg", {
|
|
349
|
+
color: "currentColor",
|
|
350
|
+
height: 16,
|
|
351
|
+
strokeLinejoin: "round",
|
|
352
|
+
viewBox: "0 0 16 16",
|
|
353
|
+
width: 16,
|
|
354
|
+
...e,
|
|
355
|
+
children: [
|
|
356
|
+
jsx("path", {
|
|
357
|
+
d: "M8 0V4",
|
|
358
|
+
stroke: "currentColor",
|
|
359
|
+
strokeWidth: "1.5"
|
|
360
|
+
}),
|
|
361
|
+
jsx("path", {
|
|
362
|
+
d: "M8 16V12",
|
|
363
|
+
opacity: "0.5",
|
|
364
|
+
stroke: "currentColor",
|
|
365
|
+
strokeWidth: "1.5"
|
|
366
|
+
}),
|
|
367
|
+
jsx("path", {
|
|
368
|
+
d: "M3.29773 1.52783L5.64887 4.7639",
|
|
369
|
+
opacity: "0.9",
|
|
370
|
+
stroke: "currentColor",
|
|
371
|
+
strokeWidth: "1.5"
|
|
372
|
+
}),
|
|
373
|
+
jsx("path", {
|
|
374
|
+
d: "M12.7023 1.52783L10.3511 4.7639",
|
|
375
|
+
opacity: "0.1",
|
|
376
|
+
stroke: "currentColor",
|
|
377
|
+
strokeWidth: "1.5"
|
|
378
|
+
}),
|
|
379
|
+
jsx("path", {
|
|
380
|
+
d: "M12.7023 14.472L10.3511 11.236",
|
|
381
|
+
opacity: "0.4",
|
|
382
|
+
stroke: "currentColor",
|
|
383
|
+
strokeWidth: "1.5"
|
|
384
|
+
}),
|
|
385
|
+
jsx("path", {
|
|
386
|
+
d: "M3.29773 14.472L5.64887 11.236",
|
|
387
|
+
opacity: "0.6",
|
|
388
|
+
stroke: "currentColor",
|
|
389
|
+
strokeWidth: "1.5"
|
|
390
|
+
}),
|
|
391
|
+
jsx("path", {
|
|
392
|
+
d: "M15.6085 5.52783L11.8043 6.7639",
|
|
393
|
+
opacity: "0.2",
|
|
394
|
+
stroke: "currentColor",
|
|
395
|
+
strokeWidth: "1.5"
|
|
396
|
+
}),
|
|
397
|
+
jsx("path", {
|
|
398
|
+
d: "M0.391602 10.472L4.19583 9.23598",
|
|
399
|
+
opacity: "0.7",
|
|
400
|
+
stroke: "currentColor",
|
|
401
|
+
strokeWidth: "1.5"
|
|
402
|
+
}),
|
|
403
|
+
jsx("path", {
|
|
404
|
+
d: "M15.6085 10.4722L11.8043 9.2361",
|
|
405
|
+
opacity: "0.3",
|
|
406
|
+
stroke: "currentColor",
|
|
407
|
+
strokeWidth: "1.5"
|
|
408
|
+
}),
|
|
409
|
+
jsx("path", {
|
|
410
|
+
d: "M0.391602 5.52783L4.19583 6.7639",
|
|
411
|
+
opacity: "0.8",
|
|
412
|
+
stroke: "currentColor",
|
|
413
|
+
strokeWidth: "1.5"
|
|
414
|
+
})
|
|
415
|
+
]
|
|
416
|
+
}),
|
|
417
|
+
Maximize2Icon: (e) => jsx("svg", {
|
|
418
|
+
color: "currentColor",
|
|
419
|
+
height: 16,
|
|
420
|
+
strokeLinejoin: "round",
|
|
421
|
+
viewBox: "0 0 16 16",
|
|
422
|
+
width: 16,
|
|
423
|
+
...e,
|
|
424
|
+
children: jsx("path", {
|
|
425
|
+
clipRule: "evenodd",
|
|
426
|
+
d: "M1 5.25V6H2.5V5.25V2.5H5.25H6V1H5.25H2C1.44772 1 1 1.44772 1 2V5.25ZM5.25 14.9994H6V13.4994H5.25H2.5V10.7494V9.99939H1V10.7494V13.9994C1 14.5517 1.44772 14.9994 2 14.9994H5.25ZM15 10V10.75V14C15 14.5523 14.5523 15 14 15H10.75H10V13.5H10.75H13.5V10.75V10H15ZM10.75 1H10V2.5H10.75H13.5V5.25V6H15V5.25V2C15 1.44772 14.5523 1 14 1H10.75Z",
|
|
427
|
+
fill: "currentColor",
|
|
428
|
+
fillRule: "evenodd"
|
|
429
|
+
})
|
|
430
|
+
}),
|
|
431
|
+
RotateCcwIcon: (e) => jsx("svg", {
|
|
432
|
+
color: "currentColor",
|
|
433
|
+
height: 16,
|
|
434
|
+
strokeLinejoin: "round",
|
|
435
|
+
viewBox: "0 0 16 16",
|
|
436
|
+
width: 16,
|
|
437
|
+
...e,
|
|
438
|
+
children: jsx("path", {
|
|
439
|
+
clipRule: "evenodd",
|
|
440
|
+
d: "M13.5 8C13.5 4.96643 11.0257 2.5 7.96452 2.5C5.42843 2.5 3.29365 4.19393 2.63724 6.5H5.25H6V8H5.25H0.75C0.335787 8 0 7.66421 0 7.25V2.75V2H1.5V2.75V5.23347C2.57851 2.74164 5.06835 1 7.96452 1C11.8461 1 15 4.13001 15 8C15 11.87 11.8461 15 7.96452 15C5.62368 15 3.54872 13.8617 2.27046 12.1122L1.828 11.5066L3.03915 10.6217L3.48161 11.2273C4.48831 12.6051 6.12055 13.5 7.96452 13.5C11.0257 13.5 13.5 11.0336 13.5 8Z",
|
|
441
|
+
fill: "currentColor",
|
|
442
|
+
fillRule: "evenodd"
|
|
443
|
+
})
|
|
444
|
+
}),
|
|
445
|
+
XIcon: (e) => jsx("svg", {
|
|
446
|
+
color: "currentColor",
|
|
447
|
+
height: 16,
|
|
448
|
+
strokeLinejoin: "round",
|
|
449
|
+
viewBox: "0 0 16 16",
|
|
450
|
+
width: 16,
|
|
451
|
+
...e,
|
|
452
|
+
children: jsx("path", {
|
|
453
|
+
clipRule: "evenodd",
|
|
454
|
+
d: "M12.4697 13.5303L13 14.0607L14.0607 13L13.5303 12.4697L9.06065 7.99999L13.5303 3.53032L14.0607 2.99999L13 1.93933L12.4697 2.46966L7.99999 6.93933L3.53032 2.46966L2.99999 1.93933L1.93933 2.99999L2.46966 3.53032L6.93933 7.99999L2.46966 12.4697L1.93933 13L2.99999 14.0607L3.53032 13.5303L7.99999 9.06065L12.4697 13.5303Z",
|
|
455
|
+
fill: "currentColor",
|
|
456
|
+
fillRule: "evenodd"
|
|
457
|
+
})
|
|
458
|
+
}),
|
|
459
|
+
ZoomInIcon: (e) => jsx("svg", {
|
|
460
|
+
color: "currentColor",
|
|
461
|
+
height: 16,
|
|
462
|
+
strokeLinejoin: "round",
|
|
463
|
+
viewBox: "0 0 16 16",
|
|
464
|
+
width: 16,
|
|
465
|
+
...e,
|
|
466
|
+
children: jsx("path", {
|
|
467
|
+
clipRule: "evenodd",
|
|
468
|
+
d: "M1.5 6.5C1.5 3.73858 3.73858 1.5 6.5 1.5C9.26142 1.5 11.5 3.73858 11.5 6.5C11.5 9.26142 9.26142 11.5 6.5 11.5C3.73858 11.5 1.5 9.26142 1.5 6.5ZM6.5 0C2.91015 0 0 2.91015 0 6.5C0 10.0899 2.91015 13 6.5 13C8.02469 13 9.42677 12.475 10.5353 11.596L13.9697 15.0303L14.5 15.5607L15.5607 14.5L15.0303 13.9697L11.596 10.5353C12.475 9.42677 13 8.02469 13 6.5C13 2.91015 10.0899 0 6.5 0ZM4.125 5.875H4.75H5.875V4.75V4.125H7.125V4.75V5.875H8.25H8.875V7.125H8.25H7.125V8.25V8.875H5.875V8.25V7.125H4.75H4.125V5.875Z",
|
|
469
|
+
fill: "currentColor",
|
|
470
|
+
fillRule: "evenodd"
|
|
471
|
+
})
|
|
472
|
+
}),
|
|
473
|
+
ZoomOutIcon: (e) => jsx("svg", {
|
|
474
|
+
color: "currentColor",
|
|
475
|
+
height: 16,
|
|
476
|
+
strokeLinejoin: "round",
|
|
477
|
+
viewBox: "0 0 16 16",
|
|
478
|
+
width: 16,
|
|
479
|
+
...e,
|
|
480
|
+
children: jsx("path", {
|
|
481
|
+
clipRule: "evenodd",
|
|
482
|
+
d: "M1.5 6.5C1.5 3.73858 3.73858 1.5 6.5 1.5C9.26142 1.5 11.5 3.73858 11.5 6.5C11.5 9.26142 9.26142 11.5 6.5 11.5C3.73858 11.5 1.5 9.26142 1.5 6.5ZM6.5 0C2.91015 0 0 2.91015 0 6.5C0 10.0899 2.91015 13 6.5 13C8.02469 13 9.42677 12.475 10.5353 11.596L13.9697 15.0303L14.5 15.5607L15.5607 14.5L15.0303 13.9697L11.596 10.5353C12.475 9.42677 13 8.02469 13 6.5C13 2.91015 10.0899 0 6.5 0ZM4.125 5.875H4.75H8.25H8.875V7.125H8.25H4.75H4.125V5.875Z",
|
|
483
|
+
fill: "currentColor",
|
|
484
|
+
fillRule: "evenodd"
|
|
485
|
+
})
|
|
486
|
+
})
|
|
487
|
+
}, Ut = createContext(we), fr = (e, t) => {
|
|
488
|
+
if (e === t) return !0;
|
|
489
|
+
if (!(e && t)) return e === t;
|
|
490
|
+
let n = Object.keys(e), r = Object.keys(t);
|
|
491
|
+
return n.length === r.length ? n.every((n) => e[n] === t[n]) : !1;
|
|
492
|
+
}, at = ({ icons: e, children: t }) => {
|
|
493
|
+
let n = useRef(e), r = useRef(e ? {
|
|
494
|
+
...we,
|
|
495
|
+
...e
|
|
496
|
+
} : we);
|
|
497
|
+
fr(n.current, e) || (n.current = e, r.current = e ? {
|
|
498
|
+
...we,
|
|
499
|
+
...e
|
|
500
|
+
} : we);
|
|
501
|
+
let i = r.current;
|
|
502
|
+
return jsx(Ut.Provider, {
|
|
503
|
+
value: i,
|
|
504
|
+
children: t
|
|
505
|
+
});
|
|
506
|
+
}, L = () => useContext(Ut), De = {
|
|
507
|
+
copyCode: "Copy Code",
|
|
508
|
+
downloadFile: "Download file",
|
|
509
|
+
downloadDiagram: "Download diagram",
|
|
510
|
+
downloadDiagramAsSvg: "Download diagram as SVG",
|
|
511
|
+
downloadDiagramAsPng: "Download diagram as PNG",
|
|
512
|
+
downloadDiagramAsMmd: "Download diagram as MMD",
|
|
513
|
+
viewFullscreen: "View fullscreen",
|
|
514
|
+
exitFullscreen: "Exit fullscreen",
|
|
515
|
+
mermaidFormatSvg: "SVG",
|
|
516
|
+
mermaidFormatPng: "PNG",
|
|
517
|
+
mermaidFormatMmd: "MMD",
|
|
518
|
+
copyTable: "Copy table",
|
|
519
|
+
copyTableAsMarkdown: "Copy table as Markdown",
|
|
520
|
+
copyTableAsCsv: "Copy table as CSV",
|
|
521
|
+
copyTableAsTsv: "Copy table as TSV",
|
|
522
|
+
downloadTable: "Download table",
|
|
523
|
+
downloadTableAsCsv: "Download table as CSV",
|
|
524
|
+
downloadTableAsMarkdown: "Download table as Markdown",
|
|
525
|
+
tableFormatMarkdown: "Markdown",
|
|
526
|
+
tableFormatCsv: "CSV",
|
|
527
|
+
tableFormatTsv: "TSV",
|
|
528
|
+
imageNotAvailable: "Image not available",
|
|
529
|
+
downloadImage: "Download image",
|
|
530
|
+
openExternalLink: "Open external link?",
|
|
531
|
+
externalLinkWarning: "You're about to visit an external website.",
|
|
532
|
+
close: "Close",
|
|
533
|
+
copyLink: "Copy link",
|
|
534
|
+
copied: "Copied",
|
|
535
|
+
openLink: "Open link"
|
|
536
|
+
}, Be = createContext(De), D = () => useContext(Be), Ae = ({ onCopy: e, onError: t, timeout: n = 2e3, children: r, className: i, code: a, ...o }) => {
|
|
537
|
+
let s = y(), [c, l] = useState(!1), u = useRef(0), { code: d } = He(), { isAnimating: f } = useContext(R), p = D(), m = a ?? d, h = async () => {
|
|
538
|
+
var r;
|
|
539
|
+
if (typeof window > "u" || !((r = navigator == null ? void 0 : navigator.clipboard) != null && r.writeText)) {
|
|
540
|
+
t?.(/* @__PURE__ */ Error("Clipboard API not available"));
|
|
541
|
+
return;
|
|
542
|
+
}
|
|
543
|
+
try {
|
|
544
|
+
c || (await navigator.clipboard.writeText(m), l(!0), e?.(), u.current = window.setTimeout(() => l(!1), n));
|
|
545
|
+
} catch (e) {
|
|
546
|
+
t?.(e);
|
|
547
|
+
}
|
|
548
|
+
};
|
|
549
|
+
useEffect(() => () => {
|
|
550
|
+
window.clearTimeout(u.current);
|
|
551
|
+
}, []);
|
|
552
|
+
let g = L(), _ = c ? g.CheckIcon : g.CopyIcon;
|
|
553
|
+
return jsx("button", {
|
|
554
|
+
className: s("cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50", i),
|
|
555
|
+
"data-streamdown": "code-block-copy-button",
|
|
556
|
+
disabled: f,
|
|
557
|
+
onClick: h,
|
|
558
|
+
title: p.copyCode,
|
|
559
|
+
type: "button",
|
|
560
|
+
...o,
|
|
561
|
+
children: r ?? jsx(_, { size: 14 })
|
|
562
|
+
});
|
|
563
|
+
}, Yt = {
|
|
564
|
+
"1c": "1c",
|
|
565
|
+
"1c-query": "1cq",
|
|
566
|
+
abap: "abap",
|
|
567
|
+
"actionscript-3": "as",
|
|
568
|
+
ada: "ada",
|
|
569
|
+
adoc: "adoc",
|
|
570
|
+
"angular-html": "html",
|
|
571
|
+
"angular-ts": "ts",
|
|
572
|
+
apache: "conf",
|
|
573
|
+
apex: "cls",
|
|
574
|
+
apl: "apl",
|
|
575
|
+
applescript: "applescript",
|
|
576
|
+
ara: "ara",
|
|
577
|
+
asciidoc: "adoc",
|
|
578
|
+
asm: "asm",
|
|
579
|
+
astro: "astro",
|
|
580
|
+
awk: "awk",
|
|
581
|
+
ballerina: "bal",
|
|
582
|
+
bash: "sh",
|
|
583
|
+
bat: "bat",
|
|
584
|
+
batch: "bat",
|
|
585
|
+
be: "be",
|
|
586
|
+
beancount: "beancount",
|
|
587
|
+
berry: "berry",
|
|
588
|
+
bibtex: "bib",
|
|
589
|
+
bicep: "bicep",
|
|
590
|
+
blade: "blade.php",
|
|
591
|
+
bsl: "bsl",
|
|
592
|
+
c: "c",
|
|
593
|
+
"c#": "cs",
|
|
594
|
+
"c++": "cpp",
|
|
595
|
+
cadence: "cdc",
|
|
596
|
+
cairo: "cairo",
|
|
597
|
+
cdc: "cdc",
|
|
598
|
+
clarity: "clar",
|
|
599
|
+
clj: "clj",
|
|
600
|
+
clojure: "clj",
|
|
601
|
+
"closure-templates": "soy",
|
|
602
|
+
cmake: "cmake",
|
|
603
|
+
cmd: "cmd",
|
|
604
|
+
cobol: "cob",
|
|
605
|
+
codeowners: "CODEOWNERS",
|
|
606
|
+
codeql: "ql",
|
|
607
|
+
coffee: "coffee",
|
|
608
|
+
coffeescript: "coffee",
|
|
609
|
+
"common-lisp": "lisp",
|
|
610
|
+
console: "sh",
|
|
611
|
+
coq: "v",
|
|
612
|
+
cpp: "cpp",
|
|
613
|
+
cql: "cql",
|
|
614
|
+
crystal: "cr",
|
|
615
|
+
cs: "cs",
|
|
616
|
+
csharp: "cs",
|
|
617
|
+
css: "css",
|
|
618
|
+
csv: "csv",
|
|
619
|
+
cue: "cue",
|
|
620
|
+
cypher: "cql",
|
|
621
|
+
d: "d",
|
|
622
|
+
dart: "dart",
|
|
623
|
+
dax: "dax",
|
|
624
|
+
desktop: "desktop",
|
|
625
|
+
diff: "diff",
|
|
626
|
+
docker: "dockerfile",
|
|
627
|
+
dockerfile: "dockerfile",
|
|
628
|
+
dotenv: "env",
|
|
629
|
+
"dream-maker": "dm",
|
|
630
|
+
edge: "edge",
|
|
631
|
+
elisp: "el",
|
|
632
|
+
elixir: "ex",
|
|
633
|
+
elm: "elm",
|
|
634
|
+
"emacs-lisp": "el",
|
|
635
|
+
erb: "erb",
|
|
636
|
+
erl: "erl",
|
|
637
|
+
erlang: "erl",
|
|
638
|
+
f: "f",
|
|
639
|
+
"f#": "fs",
|
|
640
|
+
f03: "f03",
|
|
641
|
+
f08: "f08",
|
|
642
|
+
f18: "f18",
|
|
643
|
+
f77: "f77",
|
|
644
|
+
f90: "f90",
|
|
645
|
+
f95: "f95",
|
|
646
|
+
fennel: "fnl",
|
|
647
|
+
fish: "fish",
|
|
648
|
+
fluent: "ftl",
|
|
649
|
+
for: "for",
|
|
650
|
+
"fortran-fixed-form": "f",
|
|
651
|
+
"fortran-free-form": "f90",
|
|
652
|
+
fs: "fs",
|
|
653
|
+
fsharp: "fs",
|
|
654
|
+
fsl: "fsl",
|
|
655
|
+
ftl: "ftl",
|
|
656
|
+
gdresource: "tres",
|
|
657
|
+
gdscript: "gd",
|
|
658
|
+
gdshader: "gdshader",
|
|
659
|
+
genie: "gs",
|
|
660
|
+
gherkin: "feature",
|
|
661
|
+
"git-commit": "gitcommit",
|
|
662
|
+
"git-rebase": "gitrebase",
|
|
663
|
+
gjs: "js",
|
|
664
|
+
gleam: "gleam",
|
|
665
|
+
"glimmer-js": "js",
|
|
666
|
+
"glimmer-ts": "ts",
|
|
667
|
+
glsl: "glsl",
|
|
668
|
+
gnuplot: "plt",
|
|
669
|
+
go: "go",
|
|
670
|
+
gql: "gql",
|
|
671
|
+
graphql: "graphql",
|
|
672
|
+
groovy: "groovy",
|
|
673
|
+
gts: "gts",
|
|
674
|
+
hack: "hack",
|
|
675
|
+
haml: "haml",
|
|
676
|
+
handlebars: "hbs",
|
|
677
|
+
haskell: "hs",
|
|
678
|
+
haxe: "hx",
|
|
679
|
+
hbs: "hbs",
|
|
680
|
+
hcl: "hcl",
|
|
681
|
+
hjson: "hjson",
|
|
682
|
+
hlsl: "hlsl",
|
|
683
|
+
hs: "hs",
|
|
684
|
+
html: "html",
|
|
685
|
+
"html-derivative": "html",
|
|
686
|
+
http: "http",
|
|
687
|
+
hxml: "hxml",
|
|
688
|
+
hy: "hy",
|
|
689
|
+
imba: "imba",
|
|
690
|
+
ini: "ini",
|
|
691
|
+
jade: "jade",
|
|
692
|
+
java: "java",
|
|
693
|
+
javascript: "js",
|
|
694
|
+
jinja: "jinja",
|
|
695
|
+
jison: "jison",
|
|
696
|
+
jl: "jl",
|
|
697
|
+
js: "js",
|
|
698
|
+
json: "json",
|
|
699
|
+
json5: "json5",
|
|
700
|
+
jsonc: "jsonc",
|
|
701
|
+
jsonl: "jsonl",
|
|
702
|
+
jsonnet: "jsonnet",
|
|
703
|
+
jssm: "jssm",
|
|
704
|
+
jsx: "jsx",
|
|
705
|
+
julia: "jl",
|
|
706
|
+
kotlin: "kt",
|
|
707
|
+
kql: "kql",
|
|
708
|
+
kt: "kt",
|
|
709
|
+
kts: "kts",
|
|
710
|
+
kusto: "kql",
|
|
711
|
+
latex: "tex",
|
|
712
|
+
lean: "lean",
|
|
713
|
+
lean4: "lean",
|
|
714
|
+
less: "less",
|
|
715
|
+
liquid: "liquid",
|
|
716
|
+
lisp: "lisp",
|
|
717
|
+
lit: "lit",
|
|
718
|
+
llvm: "ll",
|
|
719
|
+
log: "log",
|
|
720
|
+
logo: "logo",
|
|
721
|
+
lua: "lua",
|
|
722
|
+
luau: "luau",
|
|
723
|
+
make: "mak",
|
|
724
|
+
makefile: "mak",
|
|
725
|
+
markdown: "md",
|
|
726
|
+
marko: "marko",
|
|
727
|
+
matlab: "m",
|
|
728
|
+
md: "md",
|
|
729
|
+
mdc: "mdc",
|
|
730
|
+
mdx: "mdx",
|
|
731
|
+
mediawiki: "wiki",
|
|
732
|
+
mermaid: "mmd",
|
|
733
|
+
mips: "s",
|
|
734
|
+
mipsasm: "s",
|
|
735
|
+
mmd: "mmd",
|
|
736
|
+
mojo: "mojo",
|
|
737
|
+
move: "move",
|
|
738
|
+
nar: "nar",
|
|
739
|
+
narrat: "narrat",
|
|
740
|
+
nextflow: "nf",
|
|
741
|
+
nf: "nf",
|
|
742
|
+
nginx: "conf",
|
|
743
|
+
nim: "nim",
|
|
744
|
+
nix: "nix",
|
|
745
|
+
nu: "nu",
|
|
746
|
+
nushell: "nu",
|
|
747
|
+
objc: "m",
|
|
748
|
+
"objective-c": "m",
|
|
749
|
+
"objective-cpp": "mm",
|
|
750
|
+
ocaml: "ml",
|
|
751
|
+
pascal: "pas",
|
|
752
|
+
perl: "pl",
|
|
753
|
+
perl6: "p6",
|
|
754
|
+
php: "php",
|
|
755
|
+
plsql: "pls",
|
|
756
|
+
po: "po",
|
|
757
|
+
polar: "polar",
|
|
758
|
+
postcss: "pcss",
|
|
759
|
+
pot: "pot",
|
|
760
|
+
potx: "potx",
|
|
761
|
+
powerquery: "pq",
|
|
762
|
+
powershell: "ps1",
|
|
763
|
+
prisma: "prisma",
|
|
764
|
+
prolog: "pl",
|
|
765
|
+
properties: "properties",
|
|
766
|
+
proto: "proto",
|
|
767
|
+
protobuf: "proto",
|
|
768
|
+
ps: "ps",
|
|
769
|
+
ps1: "ps1",
|
|
770
|
+
pug: "pug",
|
|
771
|
+
puppet: "pp",
|
|
772
|
+
purescript: "purs",
|
|
773
|
+
py: "py",
|
|
774
|
+
python: "py",
|
|
775
|
+
ql: "ql",
|
|
776
|
+
qml: "qml",
|
|
777
|
+
qmldir: "qmldir",
|
|
778
|
+
qss: "qss",
|
|
779
|
+
r: "r",
|
|
780
|
+
racket: "rkt",
|
|
781
|
+
raku: "raku",
|
|
782
|
+
razor: "cshtml",
|
|
783
|
+
rb: "rb",
|
|
784
|
+
reg: "reg",
|
|
785
|
+
regex: "regex",
|
|
786
|
+
regexp: "regexp",
|
|
787
|
+
rel: "rel",
|
|
788
|
+
riscv: "s",
|
|
789
|
+
rs: "rs",
|
|
790
|
+
rst: "rst",
|
|
791
|
+
ruby: "rb",
|
|
792
|
+
rust: "rs",
|
|
793
|
+
sas: "sas",
|
|
794
|
+
sass: "sass",
|
|
795
|
+
scala: "scala",
|
|
796
|
+
scheme: "scm",
|
|
797
|
+
scss: "scss",
|
|
798
|
+
sdbl: "sdbl",
|
|
799
|
+
sh: "sh",
|
|
800
|
+
shader: "shader",
|
|
801
|
+
shaderlab: "shader",
|
|
802
|
+
shell: "sh",
|
|
803
|
+
shellscript: "sh",
|
|
804
|
+
shellsession: "sh",
|
|
805
|
+
smalltalk: "st",
|
|
806
|
+
solidity: "sol",
|
|
807
|
+
soy: "soy",
|
|
808
|
+
sparql: "rq",
|
|
809
|
+
spl: "spl",
|
|
810
|
+
splunk: "spl",
|
|
811
|
+
sql: "sql",
|
|
812
|
+
"ssh-config": "config",
|
|
813
|
+
stata: "do",
|
|
814
|
+
styl: "styl",
|
|
815
|
+
stylus: "styl",
|
|
816
|
+
svelte: "svelte",
|
|
817
|
+
swift: "swift",
|
|
818
|
+
"system-verilog": "sv",
|
|
819
|
+
systemd: "service",
|
|
820
|
+
talon: "talon",
|
|
821
|
+
talonscript: "talon",
|
|
822
|
+
tasl: "tasl",
|
|
823
|
+
tcl: "tcl",
|
|
824
|
+
templ: "templ",
|
|
825
|
+
terraform: "tf",
|
|
826
|
+
tex: "tex",
|
|
827
|
+
tf: "tf",
|
|
828
|
+
tfvars: "tfvars",
|
|
829
|
+
toml: "toml",
|
|
830
|
+
ts: "ts",
|
|
831
|
+
"ts-tags": "ts",
|
|
832
|
+
tsp: "tsp",
|
|
833
|
+
tsv: "tsv",
|
|
834
|
+
tsx: "tsx",
|
|
835
|
+
turtle: "ttl",
|
|
836
|
+
twig: "twig",
|
|
837
|
+
typ: "typ",
|
|
838
|
+
typescript: "ts",
|
|
839
|
+
typespec: "tsp",
|
|
840
|
+
typst: "typ",
|
|
841
|
+
v: "v",
|
|
842
|
+
vala: "vala",
|
|
843
|
+
vb: "vb",
|
|
844
|
+
verilog: "v",
|
|
845
|
+
vhdl: "vhdl",
|
|
846
|
+
vim: "vim",
|
|
847
|
+
viml: "vim",
|
|
848
|
+
vimscript: "vim",
|
|
849
|
+
vue: "vue",
|
|
850
|
+
"vue-html": "html",
|
|
851
|
+
"vue-vine": "vine",
|
|
852
|
+
vy: "vy",
|
|
853
|
+
vyper: "vy",
|
|
854
|
+
wasm: "wasm",
|
|
855
|
+
wenyan: "wy",
|
|
856
|
+
wgsl: "wgsl",
|
|
857
|
+
wiki: "wiki",
|
|
858
|
+
wikitext: "wiki",
|
|
859
|
+
wit: "wit",
|
|
860
|
+
wl: "wl",
|
|
861
|
+
wolfram: "wl",
|
|
862
|
+
xml: "xml",
|
|
863
|
+
xsl: "xsl",
|
|
864
|
+
yaml: "yaml",
|
|
865
|
+
yml: "yml",
|
|
866
|
+
zenscript: "zs",
|
|
867
|
+
zig: "zig",
|
|
868
|
+
zsh: "zsh",
|
|
869
|
+
文言: "wy"
|
|
870
|
+
}, it = ({ onDownload: e, onError: t, language: n, children: r, className: i, code: a, ...o }) => {
|
|
871
|
+
let s = y(), { code: c } = He(), { isAnimating: l } = useContext(R), u = D(), d = L(), f = a ?? c, p = `file.${n && n in Yt ? Yt[n] : "txt"}`, m = () => {
|
|
872
|
+
try {
|
|
873
|
+
W(p, f, "text/plain"), e?.();
|
|
874
|
+
} catch (e) {
|
|
875
|
+
t?.(e);
|
|
876
|
+
}
|
|
877
|
+
};
|
|
878
|
+
return jsx("button", {
|
|
879
|
+
className: s("cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50", i),
|
|
880
|
+
"data-streamdown": "code-block-download-button",
|
|
881
|
+
disabled: l,
|
|
882
|
+
onClick: m,
|
|
883
|
+
title: u.downloadFile,
|
|
884
|
+
type: "button",
|
|
885
|
+
...o,
|
|
886
|
+
children: r ?? jsx(d.DownloadIcon, { size: 14 })
|
|
887
|
+
});
|
|
888
|
+
}, Oe = () => {
|
|
889
|
+
let { Loader2Icon: e } = L(), t = y();
|
|
890
|
+
return jsxs("div", {
|
|
891
|
+
className: t("w-full divide-y divide-border overflow-hidden rounded-xl border border-border"),
|
|
892
|
+
children: [jsx("div", { className: t("h-[46px] w-full bg-muted/80") }), jsx("div", {
|
|
893
|
+
className: t("flex w-full items-center justify-center p-4"),
|
|
894
|
+
children: jsx(e, { className: t("size-4 animate-spin") })
|
|
895
|
+
})]
|
|
896
|
+
});
|
|
897
|
+
}, Mr = /\.[^/.]+$/, oo = ({ node: e, className: t, src: n, alt: r, onLoad: i, onError: a, ...o }) => {
|
|
898
|
+
let { DownloadIcon: s } = L(), c = y(), l = useRef(null), [u, d] = useState(!1), [f, p] = useState(!1), m = D(), h = o.width != null || o.height != null, g = (u || h) && !f, _ = f && !h;
|
|
899
|
+
useEffect(() => {
|
|
900
|
+
let e = l.current;
|
|
901
|
+
if (e != null && e.complete) {
|
|
902
|
+
let t = e.naturalWidth > 0;
|
|
903
|
+
d(t), p(!t);
|
|
904
|
+
}
|
|
905
|
+
}, []);
|
|
906
|
+
let v = useCallback((e) => {
|
|
907
|
+
d(!0), p(!1), i?.(e);
|
|
908
|
+
}, [i]), b = useCallback((e) => {
|
|
909
|
+
d(!1), p(!0), a?.(e);
|
|
910
|
+
}, [a]), S = async () => {
|
|
911
|
+
if (n) try {
|
|
912
|
+
let e = await (await fetch(n)).blob(), t = new URL(n, window.location.origin).pathname.split("/").pop() || "", i = t.split(".").pop(), a = t.includes(".") && i !== void 0 && i.length <= 4, o = "";
|
|
913
|
+
if (a) o = t;
|
|
914
|
+
else {
|
|
915
|
+
let n = e.type, i = "png";
|
|
916
|
+
n.includes("jpeg") || n.includes("jpg") ? i = "jpg" : n.includes("png") ? i = "png" : n.includes("svg") ? i = "svg" : n.includes("gif") ? i = "gif" : n.includes("webp") && (i = "webp"), o = `${(r || t || "image").replace(Mr, "")}.${i}`;
|
|
917
|
+
}
|
|
918
|
+
W(o, e, e.type);
|
|
919
|
+
} catch {
|
|
920
|
+
window.open(n, "_blank");
|
|
921
|
+
}
|
|
922
|
+
};
|
|
923
|
+
return n ? jsxs("div", {
|
|
924
|
+
className: c("group relative my-4 inline-block"),
|
|
925
|
+
"data-streamdown": "image-wrapper",
|
|
926
|
+
children: [
|
|
927
|
+
jsx("img", {
|
|
928
|
+
alt: r,
|
|
929
|
+
className: c("max-w-full rounded-lg", _ && "hidden", t),
|
|
930
|
+
"data-streamdown": "image",
|
|
931
|
+
onError: b,
|
|
932
|
+
onLoad: v,
|
|
933
|
+
ref: l,
|
|
934
|
+
src: n,
|
|
935
|
+
...o
|
|
936
|
+
}),
|
|
937
|
+
_ && jsx("span", {
|
|
938
|
+
className: c("text-muted-foreground text-xs italic"),
|
|
939
|
+
"data-streamdown": "image-fallback",
|
|
940
|
+
children: m.imageNotAvailable
|
|
941
|
+
}),
|
|
942
|
+
jsx("div", { className: c("pointer-events-none absolute inset-0 hidden rounded-lg bg-black/10 group-hover:block") }),
|
|
943
|
+
g && jsx("button", {
|
|
944
|
+
className: c("absolute right-2 bottom-2 flex h-8 w-8 cursor-pointer items-center justify-center rounded-md border border-border bg-background/90 shadow-sm backdrop-blur-sm transition-all duration-200 hover:bg-background", "opacity-0 group-hover:opacity-100"),
|
|
945
|
+
onClick: S,
|
|
946
|
+
title: m.downloadImage,
|
|
947
|
+
type: "button",
|
|
948
|
+
children: jsx(s, { size: 14 })
|
|
949
|
+
})
|
|
950
|
+
]
|
|
951
|
+
}) : null;
|
|
952
|
+
}, ke = 0, le = () => {
|
|
953
|
+
ke += 1, ke === 1 && (document.body.style.overflow = "hidden");
|
|
954
|
+
}, ce = () => {
|
|
955
|
+
ke = Math.max(0, ke - 1), ke === 0 && (document.body.style.overflow = "");
|
|
956
|
+
}, so = ({ url: e, isOpen: t, onClose: n, onConfirm: r }) => {
|
|
957
|
+
let { CheckIcon: i, CopyIcon: a, ExternalLinkIcon: o, XIcon: s } = L(), c = y(), [l, u] = useState(!1), d = D(), f = useCallback(async () => {
|
|
958
|
+
try {
|
|
959
|
+
await navigator.clipboard.writeText(e), u(!0), setTimeout(() => u(!1), 2e3);
|
|
960
|
+
} catch {}
|
|
961
|
+
}, [e]), p = useCallback(() => {
|
|
962
|
+
r(), n();
|
|
963
|
+
}, [r, n]);
|
|
964
|
+
return useEffect(() => {
|
|
965
|
+
if (t) {
|
|
966
|
+
le();
|
|
967
|
+
let e = (e) => {
|
|
968
|
+
e.key === "Escape" && n();
|
|
969
|
+
};
|
|
970
|
+
return document.addEventListener("keydown", e), () => {
|
|
971
|
+
document.removeEventListener("keydown", e), ce();
|
|
972
|
+
};
|
|
973
|
+
}
|
|
974
|
+
}, [t, n]), t ? jsx("div", {
|
|
975
|
+
className: c("fixed inset-0 z-50 flex items-center justify-center bg-background/50 backdrop-blur-sm"),
|
|
976
|
+
"data-streamdown": "link-safety-modal",
|
|
977
|
+
onClick: n,
|
|
978
|
+
onKeyDown: (e) => {
|
|
979
|
+
e.key === "Escape" && n();
|
|
980
|
+
},
|
|
981
|
+
role: "button",
|
|
982
|
+
tabIndex: 0,
|
|
983
|
+
children: jsxs("div", {
|
|
984
|
+
className: c("relative mx-4 flex w-full max-w-md flex-col gap-4 rounded-xl border bg-background p-6 shadow-lg"),
|
|
985
|
+
onClick: (e) => e.stopPropagation(),
|
|
986
|
+
onKeyDown: (e) => e.stopPropagation(),
|
|
987
|
+
role: "presentation",
|
|
988
|
+
children: [
|
|
989
|
+
jsx("button", {
|
|
990
|
+
className: c("absolute top-4 right-4 rounded-md p-1 text-muted-foreground transition-all hover:bg-muted hover:text-foreground"),
|
|
991
|
+
onClick: n,
|
|
992
|
+
title: d.close,
|
|
993
|
+
type: "button",
|
|
994
|
+
children: jsx(s, { size: 16 })
|
|
995
|
+
}),
|
|
996
|
+
jsxs("div", {
|
|
997
|
+
className: c("flex flex-col gap-2"),
|
|
998
|
+
children: [jsxs("div", {
|
|
999
|
+
className: c("flex items-center gap-2 font-semibold text-lg"),
|
|
1000
|
+
children: [jsx(o, { size: 20 }), jsx("span", { children: d.openExternalLink })]
|
|
1001
|
+
}), jsx("p", {
|
|
1002
|
+
className: c("text-muted-foreground text-sm"),
|
|
1003
|
+
children: d.externalLinkWarning
|
|
1004
|
+
})]
|
|
1005
|
+
}),
|
|
1006
|
+
jsx("div", {
|
|
1007
|
+
className: c("break-all rounded-md bg-muted p-3 font-mono text-sm", e.length > 100 && "max-h-32 overflow-y-auto"),
|
|
1008
|
+
children: e
|
|
1009
|
+
}),
|
|
1010
|
+
jsxs("div", {
|
|
1011
|
+
className: c("flex gap-2"),
|
|
1012
|
+
children: [jsx("button", {
|
|
1013
|
+
className: c("flex flex-1 items-center justify-center gap-2 rounded-md border bg-background px-4 py-2 font-medium text-sm transition-all hover:bg-muted"),
|
|
1014
|
+
onClick: f,
|
|
1015
|
+
type: "button",
|
|
1016
|
+
children: l ? jsxs(Fragment$1, { children: [jsx(i, { size: 14 }), jsx("span", { children: d.copied })] }) : jsxs(Fragment$1, { children: [jsx(a, { size: 14 }), jsx("span", { children: d.copyLink })] })
|
|
1017
|
+
}), jsxs("button", {
|
|
1018
|
+
className: c("flex flex-1 items-center justify-center gap-2 rounded-md bg-primary px-4 py-2 font-medium text-primary-foreground text-sm transition-all hover:bg-primary/90"),
|
|
1019
|
+
onClick: p,
|
|
1020
|
+
type: "button",
|
|
1021
|
+
children: [jsx(o, { size: 14 }), jsx("span", { children: d.openLink })]
|
|
1022
|
+
})]
|
|
1023
|
+
})
|
|
1024
|
+
]
|
|
1025
|
+
})
|
|
1026
|
+
}) : null;
|
|
1027
|
+
}, Ve = createContext(null), ct = () => useContext(Ve), Li = () => ct()?.code ?? null, de = () => ct()?.mermaid ?? null, ao = (e) => {
|
|
1028
|
+
var t;
|
|
1029
|
+
let n = ct();
|
|
1030
|
+
return n != null && n.renderers && e && (t = n.renderers.find((t) => Array.isArray(t.language) ? t.language.includes(e) : t.language === e)) != null ? t : null;
|
|
1031
|
+
}, io = (e, t) => new Promise((t, n) => {
|
|
1032
|
+
let r = "data:image/svg+xml;base64," + btoa(unescape(encodeURIComponent(e))), i = new Image();
|
|
1033
|
+
i.crossOrigin = "anonymous", i.onload = () => {
|
|
1034
|
+
let e = document.createElement("canvas"), r = i.width * 5, a = i.height * 5;
|
|
1035
|
+
e.width = r, e.height = a;
|
|
1036
|
+
let o = e.getContext("2d");
|
|
1037
|
+
if (!o) {
|
|
1038
|
+
n(/* @__PURE__ */ Error("Failed to create 2D canvas context for PNG export"));
|
|
1039
|
+
return;
|
|
1040
|
+
}
|
|
1041
|
+
o.drawImage(i, 0, 0, r, a), e.toBlob((e) => {
|
|
1042
|
+
if (!e) {
|
|
1043
|
+
n(/* @__PURE__ */ Error("Failed to create PNG blob"));
|
|
1044
|
+
return;
|
|
1045
|
+
}
|
|
1046
|
+
t(e);
|
|
1047
|
+
}, "image/png");
|
|
1048
|
+
}, i.onerror = () => n(/* @__PURE__ */ Error("Failed to load SVG image")), i.src = r;
|
|
1049
|
+
}), co = ({ chart: e, children: t, className: n, onDownload: r, config: i, onError: a }) => {
|
|
1050
|
+
let o = y(), [s, c] = useState(!1), l = useRef(null), { isAnimating: u } = useContext(R), d = L(), f = de(), p = D(), m = async (t) => {
|
|
1051
|
+
try {
|
|
1052
|
+
if (t === "mmd") {
|
|
1053
|
+
W("diagram.mmd", e, "text/plain"), c(!1), r?.(t);
|
|
1054
|
+
return;
|
|
1055
|
+
}
|
|
1056
|
+
if (!f) {
|
|
1057
|
+
a?.(/* @__PURE__ */ Error("Mermaid plugin not available"));
|
|
1058
|
+
return;
|
|
1059
|
+
}
|
|
1060
|
+
let n = f.getMermaid(i), o = e.split("").reduce((e, t) => (e << 5) - e + t.charCodeAt(0) | 0, 0), s = `mermaid-${Math.abs(o)}-${Date.now()}-${Math.random().toString(36).substring(2, 9)}`, { svg: l } = await n.render(s, e);
|
|
1061
|
+
if (!l) {
|
|
1062
|
+
a?.(/* @__PURE__ */ Error("SVG not found. Please wait for the diagram to render."));
|
|
1063
|
+
return;
|
|
1064
|
+
}
|
|
1065
|
+
if (t === "svg") {
|
|
1066
|
+
W("diagram.svg", l, "image/svg+xml"), c(!1), r?.(t);
|
|
1067
|
+
return;
|
|
1068
|
+
}
|
|
1069
|
+
if (t === "png") {
|
|
1070
|
+
W("diagram.png", await io(l), "image/png"), r?.(t), c(!1);
|
|
1071
|
+
return;
|
|
1072
|
+
}
|
|
1073
|
+
} catch (e) {
|
|
1074
|
+
a?.(e);
|
|
1075
|
+
}
|
|
1076
|
+
};
|
|
1077
|
+
return useEffect(() => {
|
|
1078
|
+
let e = (e) => {
|
|
1079
|
+
let t = e.composedPath();
|
|
1080
|
+
l.current && !t.includes(l.current) && c(!1);
|
|
1081
|
+
};
|
|
1082
|
+
return document.addEventListener("mousedown", e), () => {
|
|
1083
|
+
document.removeEventListener("mousedown", e);
|
|
1084
|
+
};
|
|
1085
|
+
}, []), jsxs("div", {
|
|
1086
|
+
className: o("relative"),
|
|
1087
|
+
ref: l,
|
|
1088
|
+
children: [jsx("button", {
|
|
1089
|
+
className: o("cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50", n),
|
|
1090
|
+
disabled: u,
|
|
1091
|
+
onClick: () => c(!s),
|
|
1092
|
+
title: p.downloadDiagram,
|
|
1093
|
+
type: "button",
|
|
1094
|
+
children: t ?? jsx(d.DownloadIcon, { size: 14 })
|
|
1095
|
+
}), s ? jsxs("div", {
|
|
1096
|
+
className: o("absolute top-full right-0 z-10 mt-1 min-w-[120px] overflow-hidden rounded-md border border-border bg-background shadow-lg"),
|
|
1097
|
+
children: [
|
|
1098
|
+
jsx("button", {
|
|
1099
|
+
className: o("w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40"),
|
|
1100
|
+
onClick: () => m("svg"),
|
|
1101
|
+
title: p.downloadDiagramAsSvg,
|
|
1102
|
+
type: "button",
|
|
1103
|
+
children: p.mermaidFormatSvg
|
|
1104
|
+
}),
|
|
1105
|
+
jsx("button", {
|
|
1106
|
+
className: o("w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40"),
|
|
1107
|
+
onClick: () => m("png"),
|
|
1108
|
+
title: p.downloadDiagramAsPng,
|
|
1109
|
+
type: "button",
|
|
1110
|
+
children: p.mermaidFormatPng
|
|
1111
|
+
}),
|
|
1112
|
+
jsx("button", {
|
|
1113
|
+
className: o("w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40"),
|
|
1114
|
+
onClick: () => m("mmd"),
|
|
1115
|
+
title: p.downloadDiagramAsMmd,
|
|
1116
|
+
type: "button",
|
|
1117
|
+
children: p.mermaidFormatMmd
|
|
1118
|
+
})
|
|
1119
|
+
]
|
|
1120
|
+
}) : null]
|
|
1121
|
+
});
|
|
1122
|
+
}, fo = ({ chart: e, config: t, onFullscreen: n, onExit: r, className: i, ...a }) => {
|
|
1123
|
+
let { Maximize2Icon: o, XIcon: s } = L(), c = y(), [l, u] = useState(!1), { isAnimating: d, controls: f } = useContext(R), p = D(), m = (() => {
|
|
1124
|
+
if (typeof f == "boolean") return f;
|
|
1125
|
+
let e = f.mermaid;
|
|
1126
|
+
return e === !1 ? !1 : e === !0 || e === void 0 ? !0 : e.panZoom !== !1;
|
|
1127
|
+
})(), h = () => {
|
|
1128
|
+
u(!l);
|
|
1129
|
+
};
|
|
1130
|
+
return useEffect(() => {
|
|
1131
|
+
if (l) {
|
|
1132
|
+
le();
|
|
1133
|
+
let e = (e) => {
|
|
1134
|
+
e.key === "Escape" && u(!1);
|
|
1135
|
+
};
|
|
1136
|
+
return document.addEventListener("keydown", e), () => {
|
|
1137
|
+
document.removeEventListener("keydown", e), ce();
|
|
1138
|
+
};
|
|
1139
|
+
}
|
|
1140
|
+
}, [l]), useEffect(() => {
|
|
1141
|
+
l ? n?.() : r && r();
|
|
1142
|
+
}, [
|
|
1143
|
+
l,
|
|
1144
|
+
n,
|
|
1145
|
+
r
|
|
1146
|
+
]), jsxs(Fragment$1, { children: [jsx("button", {
|
|
1147
|
+
className: c("cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50", i),
|
|
1148
|
+
disabled: d,
|
|
1149
|
+
onClick: h,
|
|
1150
|
+
title: p.viewFullscreen,
|
|
1151
|
+
type: "button",
|
|
1152
|
+
...a,
|
|
1153
|
+
children: jsx(o, { size: 14 })
|
|
1154
|
+
}), l ? createPortal(jsxs("div", {
|
|
1155
|
+
className: c("fixed inset-0 z-50 flex items-center justify-center bg-background/95 backdrop-blur-sm"),
|
|
1156
|
+
onClick: h,
|
|
1157
|
+
onKeyDown: (e) => {
|
|
1158
|
+
e.key === "Escape" && h();
|
|
1159
|
+
},
|
|
1160
|
+
role: "button",
|
|
1161
|
+
tabIndex: 0,
|
|
1162
|
+
children: [jsx("button", {
|
|
1163
|
+
className: c("absolute top-4 right-4 z-10 rounded-md p-2 text-muted-foreground transition-all hover:bg-muted hover:text-foreground"),
|
|
1164
|
+
onClick: h,
|
|
1165
|
+
title: p.exitFullscreen,
|
|
1166
|
+
type: "button",
|
|
1167
|
+
children: jsx(s, { size: 20 })
|
|
1168
|
+
}), jsx("div", {
|
|
1169
|
+
className: c("flex size-full items-center justify-center p-4"),
|
|
1170
|
+
onClick: (e) => e.stopPropagation(),
|
|
1171
|
+
onKeyDown: (e) => e.stopPropagation(),
|
|
1172
|
+
role: "presentation",
|
|
1173
|
+
children: jsx(po, {
|
|
1174
|
+
chart: e,
|
|
1175
|
+
className: c("size-full [&_svg]:h-auto [&_svg]:w-auto"),
|
|
1176
|
+
config: t,
|
|
1177
|
+
fullscreen: !0,
|
|
1178
|
+
showControls: m
|
|
1179
|
+
})
|
|
1180
|
+
})]
|
|
1181
|
+
}), document.body) : null] });
|
|
1182
|
+
}, ue = (e) => {
|
|
1183
|
+
let t = [], n = [], r = e.querySelectorAll("thead th");
|
|
1184
|
+
for (let e of r) t.push(e.textContent?.trim() || "");
|
|
1185
|
+
let i = e.querySelectorAll("tbody tr");
|
|
1186
|
+
for (let e of i) {
|
|
1187
|
+
let t = [], r = e.querySelectorAll("td");
|
|
1188
|
+
for (let e of r) t.push(e.textContent?.trim() || "");
|
|
1189
|
+
n.push(t);
|
|
1190
|
+
}
|
|
1191
|
+
return {
|
|
1192
|
+
headers: t,
|
|
1193
|
+
rows: n
|
|
1194
|
+
};
|
|
1195
|
+
}, ne = (e) => {
|
|
1196
|
+
let { headers: t, rows: n } = e, r = (e) => {
|
|
1197
|
+
let t = !1, n = !1;
|
|
1198
|
+
for (let r of e) {
|
|
1199
|
+
if (r === "\"") {
|
|
1200
|
+
t = !0, n = !0;
|
|
1201
|
+
break;
|
|
1202
|
+
}
|
|
1203
|
+
(r === "," || r === "\n") && (t = !0);
|
|
1204
|
+
}
|
|
1205
|
+
return t ? n ? `"${e.replace(/"/g, "\"\"")}"` : `"${e}"` : e;
|
|
1206
|
+
}, i = t.length > 0 ? n.length + 1 : n.length, a = Array(i), o = 0;
|
|
1207
|
+
t.length > 0 && (a[o] = t.map(r).join(","), o += 1);
|
|
1208
|
+
for (let e of n) a[o] = e.map(r).join(","), o += 1;
|
|
1209
|
+
return a.join("\n");
|
|
1210
|
+
}, dt = (e) => {
|
|
1211
|
+
let { headers: t, rows: n } = e, r = (e) => {
|
|
1212
|
+
let t = !1;
|
|
1213
|
+
for (let n of e) if (n === " " || n === "\n" || n === "\r") {
|
|
1214
|
+
t = !0;
|
|
1215
|
+
break;
|
|
1216
|
+
}
|
|
1217
|
+
if (!t) return e;
|
|
1218
|
+
let n = [];
|
|
1219
|
+
for (let t of e) t === " " ? n.push("\\t") : t === "\n" ? n.push("\\n") : t === "\r" ? n.push("\\r") : n.push(t);
|
|
1220
|
+
return n.join("");
|
|
1221
|
+
}, i = t.length > 0 ? n.length + 1 : n.length, a = Array(i), o = 0;
|
|
1222
|
+
t.length > 0 && (a[o] = t.map(r).join(" "), o += 1);
|
|
1223
|
+
for (let e of n) a[o] = e.map(r).join(" "), o += 1;
|
|
1224
|
+
return a.join("\n");
|
|
1225
|
+
}, je = (e) => {
|
|
1226
|
+
let t = !1;
|
|
1227
|
+
for (let n of e) if (n === "\\" || n === "|") {
|
|
1228
|
+
t = !0;
|
|
1229
|
+
break;
|
|
1230
|
+
}
|
|
1231
|
+
if (!t) return e;
|
|
1232
|
+
let n = [];
|
|
1233
|
+
for (let t of e) t === "\\" ? n.push("\\\\") : t === "|" ? n.push("\\|") : n.push(t);
|
|
1234
|
+
return n.join("");
|
|
1235
|
+
}, re = (e) => {
|
|
1236
|
+
let { headers: t, rows: n } = e;
|
|
1237
|
+
if (t.length === 0) return "";
|
|
1238
|
+
let r = Array(n.length + 2), i = 0;
|
|
1239
|
+
r[i] = `| ${t.map((e) => je(e)).join(" | ")} |`, i += 1;
|
|
1240
|
+
let a = Array(t.length);
|
|
1241
|
+
for (let e = 0; e < t.length; e += 1) a[e] = "---";
|
|
1242
|
+
r[i] = `| ${a.join(" | ")} |`, i += 1;
|
|
1243
|
+
for (let e of n) if (e.length < t.length) {
|
|
1244
|
+
let n = Array(t.length);
|
|
1245
|
+
for (let r = 0; r < t.length; r += 1) n[r] = r < e.length ? je(e[r]) : "";
|
|
1246
|
+
r[i] = `| ${n.join(" | ")} |`, i += 1;
|
|
1247
|
+
} else r[i] = `| ${e.map((e) => je(e)).join(" | ")} |`, i += 1;
|
|
1248
|
+
return r.join("\n");
|
|
1249
|
+
}, Te = ({ children: e, className: t, onCopy: n, onError: r, timeout: i = 2e3 }) => {
|
|
1250
|
+
let a = y(), [o, s] = useState(!1), [c, l] = useState(!1), u = useRef(null), d = useRef(0), { isAnimating: f } = useContext(R), p = D(), m = async (e) => {
|
|
1251
|
+
var t;
|
|
1252
|
+
if (typeof window > "u" || !((t = navigator == null ? void 0 : navigator.clipboard) != null && t.write)) {
|
|
1253
|
+
r?.(/* @__PURE__ */ Error("Clipboard API not available"));
|
|
1254
|
+
return;
|
|
1255
|
+
}
|
|
1256
|
+
try {
|
|
1257
|
+
let t = (u.current?.closest("[data-streamdown=\"table-wrapper\"]"))?.querySelector("table");
|
|
1258
|
+
if (!t) {
|
|
1259
|
+
r?.(/* @__PURE__ */ Error("Table not found"));
|
|
1260
|
+
return;
|
|
1261
|
+
}
|
|
1262
|
+
let a = ue(t), o = ({
|
|
1263
|
+
csv: ne,
|
|
1264
|
+
tsv: dt,
|
|
1265
|
+
md: re
|
|
1266
|
+
}[e] || re)(a), c = new ClipboardItem({
|
|
1267
|
+
"text/plain": new Blob([o], { type: "text/plain" }),
|
|
1268
|
+
"text/html": new Blob([t.outerHTML], { type: "text/html" })
|
|
1269
|
+
});
|
|
1270
|
+
await navigator.clipboard.write([c]), l(!0), s(!1), n?.(e), d.current = window.setTimeout(() => l(!1), i);
|
|
1271
|
+
} catch (e) {
|
|
1272
|
+
r?.(e);
|
|
1273
|
+
}
|
|
1274
|
+
};
|
|
1275
|
+
useEffect(() => {
|
|
1276
|
+
let e = (e) => {
|
|
1277
|
+
let t = e.composedPath();
|
|
1278
|
+
u.current && !t.includes(u.current) && s(!1);
|
|
1279
|
+
};
|
|
1280
|
+
return document.addEventListener("mousedown", e), () => {
|
|
1281
|
+
document.removeEventListener("mousedown", e), window.clearTimeout(d.current);
|
|
1282
|
+
};
|
|
1283
|
+
}, []);
|
|
1284
|
+
let h = L(), g = c ? h.CheckIcon : h.CopyIcon;
|
|
1285
|
+
return jsxs("div", {
|
|
1286
|
+
className: a("relative"),
|
|
1287
|
+
ref: u,
|
|
1288
|
+
children: [jsx("button", {
|
|
1289
|
+
className: a("cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50", t),
|
|
1290
|
+
disabled: f,
|
|
1291
|
+
onClick: () => s(!o),
|
|
1292
|
+
title: p.copyTable,
|
|
1293
|
+
type: "button",
|
|
1294
|
+
children: e ?? jsx(g, {
|
|
1295
|
+
height: 14,
|
|
1296
|
+
width: 14
|
|
1297
|
+
})
|
|
1298
|
+
}), o ? jsxs("div", {
|
|
1299
|
+
className: a("absolute top-full right-0 z-20 mt-1 min-w-[120px] overflow-hidden rounded-md border border-border bg-background shadow-lg"),
|
|
1300
|
+
children: [
|
|
1301
|
+
jsx("button", {
|
|
1302
|
+
className: a("w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40"),
|
|
1303
|
+
onClick: () => m("md"),
|
|
1304
|
+
title: p.copyTableAsMarkdown,
|
|
1305
|
+
type: "button",
|
|
1306
|
+
children: p.tableFormatMarkdown
|
|
1307
|
+
}),
|
|
1308
|
+
jsx("button", {
|
|
1309
|
+
className: a("w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40"),
|
|
1310
|
+
onClick: () => m("csv"),
|
|
1311
|
+
title: p.copyTableAsCsv,
|
|
1312
|
+
type: "button",
|
|
1313
|
+
children: p.tableFormatCsv
|
|
1314
|
+
}),
|
|
1315
|
+
jsx("button", {
|
|
1316
|
+
className: a("w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40"),
|
|
1317
|
+
onClick: () => m("tsv"),
|
|
1318
|
+
title: p.copyTableAsTsv,
|
|
1319
|
+
type: "button",
|
|
1320
|
+
children: p.tableFormatTsv
|
|
1321
|
+
})
|
|
1322
|
+
]
|
|
1323
|
+
}) : null]
|
|
1324
|
+
});
|
|
1325
|
+
}, Pe = ({ children: e, className: t, onDownload: n, onError: r }) => {
|
|
1326
|
+
let i = y(), [a, o] = useState(!1), s = useRef(null), { isAnimating: c } = useContext(R), l = D(), u = L(), d = (e) => {
|
|
1327
|
+
try {
|
|
1328
|
+
let t = (s.current?.closest("[data-streamdown=\"table-wrapper\"]"))?.querySelector("table");
|
|
1329
|
+
if (!t) {
|
|
1330
|
+
r?.(/* @__PURE__ */ Error("Table not found"));
|
|
1331
|
+
return;
|
|
1332
|
+
}
|
|
1333
|
+
let i = ue(t), a = e === "csv" ? ne(i) : re(i);
|
|
1334
|
+
W(`table.${e === "csv" ? "csv" : "md"}`, a, e === "csv" ? "text/csv" : "text/markdown"), o(!1), n?.(e);
|
|
1335
|
+
} catch (e) {
|
|
1336
|
+
r?.(e);
|
|
1337
|
+
}
|
|
1338
|
+
};
|
|
1339
|
+
return useEffect(() => {
|
|
1340
|
+
let e = (e) => {
|
|
1341
|
+
let t = e.composedPath();
|
|
1342
|
+
s.current && !t.includes(s.current) && o(!1);
|
|
1343
|
+
};
|
|
1344
|
+
return document.addEventListener("mousedown", e), () => {
|
|
1345
|
+
document.removeEventListener("mousedown", e);
|
|
1346
|
+
};
|
|
1347
|
+
}, []), jsxs("div", {
|
|
1348
|
+
className: i("relative"),
|
|
1349
|
+
ref: s,
|
|
1350
|
+
children: [jsx("button", {
|
|
1351
|
+
className: i("cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50", t),
|
|
1352
|
+
disabled: c,
|
|
1353
|
+
onClick: () => o(!a),
|
|
1354
|
+
title: l.downloadTable,
|
|
1355
|
+
type: "button",
|
|
1356
|
+
children: e ?? jsx(u.DownloadIcon, { size: 14 })
|
|
1357
|
+
}), a ? jsxs("div", {
|
|
1358
|
+
className: i("absolute top-full right-0 z-20 mt-1 min-w-[120px] overflow-hidden rounded-md border border-border bg-background shadow-lg"),
|
|
1359
|
+
children: [jsx("button", {
|
|
1360
|
+
className: i("w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40"),
|
|
1361
|
+
onClick: () => d("csv"),
|
|
1362
|
+
title: l.downloadTableAsCsv,
|
|
1363
|
+
type: "button",
|
|
1364
|
+
children: l.tableFormatCsv
|
|
1365
|
+
}), jsx("button", {
|
|
1366
|
+
className: i("w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40"),
|
|
1367
|
+
onClick: () => d("markdown"),
|
|
1368
|
+
title: l.downloadTableAsMarkdown,
|
|
1369
|
+
type: "button",
|
|
1370
|
+
children: l.tableFormatMarkdown
|
|
1371
|
+
})]
|
|
1372
|
+
}) : null]
|
|
1373
|
+
});
|
|
1374
|
+
}, Co = ({ children: e, className: t, showCopy: n = !0, showDownload: r = !0 }) => {
|
|
1375
|
+
let { Maximize2Icon: i, XIcon: a } = L(), o = y(), [s, c] = useState(!1), { isAnimating: l } = useContext(R), u = D(), d = () => {
|
|
1376
|
+
c(!0);
|
|
1377
|
+
}, f = () => {
|
|
1378
|
+
c(!1);
|
|
1379
|
+
};
|
|
1380
|
+
return useEffect(() => {
|
|
1381
|
+
if (s) {
|
|
1382
|
+
le();
|
|
1383
|
+
let e = (e) => {
|
|
1384
|
+
e.key === "Escape" && c(!1);
|
|
1385
|
+
};
|
|
1386
|
+
return document.addEventListener("keydown", e), () => {
|
|
1387
|
+
document.removeEventListener("keydown", e), ce();
|
|
1388
|
+
};
|
|
1389
|
+
}
|
|
1390
|
+
}, [s]), jsxs(Fragment$1, { children: [jsx("button", {
|
|
1391
|
+
className: o("cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50", t),
|
|
1392
|
+
disabled: l,
|
|
1393
|
+
onClick: d,
|
|
1394
|
+
title: u.viewFullscreen,
|
|
1395
|
+
type: "button",
|
|
1396
|
+
children: jsx(i, { size: 14 })
|
|
1397
|
+
}), s ? createPortal(jsx("div", {
|
|
1398
|
+
"aria-label": u.viewFullscreen,
|
|
1399
|
+
"aria-modal": "true",
|
|
1400
|
+
className: o("fixed inset-0 z-50 flex flex-col bg-background"),
|
|
1401
|
+
"data-streamdown": "table-fullscreen",
|
|
1402
|
+
onClick: f,
|
|
1403
|
+
onKeyDown: (e) => {
|
|
1404
|
+
e.key === "Escape" && f();
|
|
1405
|
+
},
|
|
1406
|
+
role: "dialog",
|
|
1407
|
+
children: jsxs("div", {
|
|
1408
|
+
className: o("flex h-full flex-col"),
|
|
1409
|
+
onClick: (e) => e.stopPropagation(),
|
|
1410
|
+
onKeyDown: (e) => e.stopPropagation(),
|
|
1411
|
+
role: "presentation",
|
|
1412
|
+
children: [jsxs("div", {
|
|
1413
|
+
className: o("flex items-center justify-end gap-1 p-4"),
|
|
1414
|
+
children: [
|
|
1415
|
+
n ? jsx(Te, {}) : null,
|
|
1416
|
+
r ? jsx(Pe, {}) : null,
|
|
1417
|
+
jsx("button", {
|
|
1418
|
+
className: o("rounded-md p-1 text-muted-foreground transition-all hover:bg-muted hover:text-foreground"),
|
|
1419
|
+
onClick: f,
|
|
1420
|
+
title: u.exitFullscreen,
|
|
1421
|
+
type: "button",
|
|
1422
|
+
children: jsx(a, { size: 20 })
|
|
1423
|
+
})
|
|
1424
|
+
]
|
|
1425
|
+
}), jsx("div", {
|
|
1426
|
+
className: o("flex-1 overflow-auto p-4 pt-0 [&_thead]:sticky [&_thead]:top-0 [&_thead]:z-10"),
|
|
1427
|
+
children: jsx("table", {
|
|
1428
|
+
className: o("w-full border-collapse border border-border"),
|
|
1429
|
+
"data-streamdown": "table",
|
|
1430
|
+
children: e
|
|
1431
|
+
})
|
|
1432
|
+
})]
|
|
1433
|
+
})
|
|
1434
|
+
}), document.body) : null] });
|
|
1435
|
+
}, vo = ({ children: e, className: t, showControls: n, showCopy: r = !0, showDownload: i = !0, showFullscreen: a = !0, ...o }) => {
|
|
1436
|
+
let s = y(), c = n && r, l = n && i, u = n && a, d = c || l || u;
|
|
1437
|
+
return jsxs("div", {
|
|
1438
|
+
className: s("my-4 flex flex-col gap-2 rounded-lg border border-border bg-sidebar p-2"),
|
|
1439
|
+
"data-streamdown": "table-wrapper",
|
|
1440
|
+
children: [d ? jsxs("div", {
|
|
1441
|
+
className: s("flex items-center justify-end gap-1"),
|
|
1442
|
+
children: [
|
|
1443
|
+
c ? jsx(Te, {}) : null,
|
|
1444
|
+
l ? jsx(Pe, {}) : null,
|
|
1445
|
+
u ? jsx(Co, {
|
|
1446
|
+
showCopy: c,
|
|
1447
|
+
showDownload: l,
|
|
1448
|
+
children: e
|
|
1449
|
+
}) : null
|
|
1450
|
+
]
|
|
1451
|
+
}) : null, jsx("div", {
|
|
1452
|
+
className: s("border-collapse overflow-x-auto overflow-y-auto rounded-md border border-border bg-background"),
|
|
1453
|
+
children: jsx("table", {
|
|
1454
|
+
className: s("w-full divide-y divide-border", t),
|
|
1455
|
+
"data-streamdown": "table",
|
|
1456
|
+
...o,
|
|
1457
|
+
children: e
|
|
1458
|
+
})
|
|
1459
|
+
})]
|
|
1460
|
+
});
|
|
1461
|
+
}, es = /startLine=(\d+)/, ts = /\bnoLineNumbers\b/, os = lazy(() => import("./mermaid-GHXKKRXX.js").then((e) => ({ default: e.Mermaid }))), ns = /language-([^\s]+)/;
|
|
1462
|
+
function qe(e, t) {
|
|
1463
|
+
if (!(e != null && e.position || t != null && t.position)) return !0;
|
|
1464
|
+
if (!(e != null && e.position && t != null && t.position)) return !1;
|
|
1465
|
+
let n = e.position.start, r = t.position.start, i = e.position.end, a = t.position.end;
|
|
1466
|
+
return n?.line === r?.line && n?.column === r?.column && i?.line === a?.line && i?.column === a?.column;
|
|
1467
|
+
}
|
|
1468
|
+
function E(e, t) {
|
|
1469
|
+
return e.className === t.className && qe(e.node, t.node);
|
|
1470
|
+
}
|
|
1471
|
+
var ft = (e, t) => typeof e == "boolean" ? e : e[t] !== !1, pt = (e, t) => {
|
|
1472
|
+
if (typeof e == "boolean") return e;
|
|
1473
|
+
let n = e.table;
|
|
1474
|
+
return n === !1 ? !1 : n === !0 || n === void 0 ? !0 : n[t] !== !1;
|
|
1475
|
+
}, To = (e, t) => {
|
|
1476
|
+
if (typeof e == "boolean") return e;
|
|
1477
|
+
let n = e.code;
|
|
1478
|
+
return n === !1 ? !1 : n === !0 || n === void 0 ? !0 : n[t] !== !1;
|
|
1479
|
+
}, Fe = (e, t) => {
|
|
1480
|
+
if (typeof e == "boolean") return e;
|
|
1481
|
+
let n = e.mermaid;
|
|
1482
|
+
return n === !1 ? !1 : n === !0 || n === void 0 ? !0 : n[t] !== !1;
|
|
1483
|
+
}, bt = memo(({ children: e, className: t, node: n, ...r }) => jsx("ol", {
|
|
1484
|
+
className: y()("list-inside list-decimal whitespace-normal [li_&]:pl-6", t),
|
|
1485
|
+
"data-streamdown": "ordered-list",
|
|
1486
|
+
...r,
|
|
1487
|
+
children: e
|
|
1488
|
+
}), (e, t) => E(e, t));
|
|
1489
|
+
bt.displayName = "MarkdownOl";
|
|
1490
|
+
var Po = memo(({ children: e, className: t, node: n, ...r }) => jsx("li", {
|
|
1491
|
+
className: y()("py-1 [&>p]:inline", t),
|
|
1492
|
+
"data-streamdown": "list-item",
|
|
1493
|
+
...r,
|
|
1494
|
+
children: e
|
|
1495
|
+
}), (e, t) => e.className === t.className && qe(e.node, t.node));
|
|
1496
|
+
Po.displayName = "MarkdownLi";
|
|
1497
|
+
var Mo = memo(({ children: e, className: t, node: n, ...r }) => jsx("ul", {
|
|
1498
|
+
className: y()("list-inside list-disc whitespace-normal [li_&]:pl-6", t),
|
|
1499
|
+
"data-streamdown": "unordered-list",
|
|
1500
|
+
...r,
|
|
1501
|
+
children: e
|
|
1502
|
+
}), (e, t) => E(e, t));
|
|
1503
|
+
Mo.displayName = "MarkdownUl";
|
|
1504
|
+
var Io = memo(({ className: e, node: t, ...n }) => jsx("hr", {
|
|
1505
|
+
className: y()("my-6 border-border", e),
|
|
1506
|
+
"data-streamdown": "horizontal-rule",
|
|
1507
|
+
...n
|
|
1508
|
+
}), (e, t) => E(e, t));
|
|
1509
|
+
Io.displayName = "MarkdownHr";
|
|
1510
|
+
var No = memo(({ children: e, className: t, node: n, ...r }) => jsx("span", {
|
|
1511
|
+
className: y()("font-semibold", t),
|
|
1512
|
+
"data-streamdown": "strong",
|
|
1513
|
+
...r,
|
|
1514
|
+
children: e
|
|
1515
|
+
}), (e, t) => E(e, t));
|
|
1516
|
+
No.displayName = "MarkdownStrong";
|
|
1517
|
+
var Lo = memo(({ children: e, className: t, href: n, node: r, ...i }) => {
|
|
1518
|
+
let a = y(), { linkSafety: o } = useContext(R), [s, c] = useState(!1), l = n === "streamdown:incomplete-link", u = useCallback(async (e) => {
|
|
1519
|
+
if (!(!(o != null && o.enabled && n) || l)) {
|
|
1520
|
+
if (e.preventDefault(), o.onLinkCheck && await o.onLinkCheck(n)) {
|
|
1521
|
+
window.open(n, "_blank", "noreferrer");
|
|
1522
|
+
return;
|
|
1523
|
+
}
|
|
1524
|
+
c(!0);
|
|
1525
|
+
}
|
|
1526
|
+
}, [
|
|
1527
|
+
o,
|
|
1528
|
+
n,
|
|
1529
|
+
l
|
|
1530
|
+
]), d = useCallback(() => {
|
|
1531
|
+
n && window.open(n, "_blank", "noreferrer");
|
|
1532
|
+
}, [n]), f = useCallback(() => {
|
|
1533
|
+
c(!1);
|
|
1534
|
+
}, []), p = {
|
|
1535
|
+
url: n ?? "",
|
|
1536
|
+
isOpen: s,
|
|
1537
|
+
onClose: f,
|
|
1538
|
+
onConfirm: d
|
|
1539
|
+
};
|
|
1540
|
+
return o != null && o.enabled && n ? jsxs(Fragment$1, { children: [jsx("button", {
|
|
1541
|
+
className: a("wrap-anywhere appearance-none text-left font-medium text-primary underline", t),
|
|
1542
|
+
"data-incomplete": l,
|
|
1543
|
+
"data-streamdown": "link",
|
|
1544
|
+
onClick: u,
|
|
1545
|
+
type: "button",
|
|
1546
|
+
children: e
|
|
1547
|
+
}), o.renderModal ? o.renderModal(p) : jsx(so, { ...p })] }) : jsx("a", {
|
|
1548
|
+
className: a("wrap-anywhere font-medium text-primary underline", t),
|
|
1549
|
+
"data-incomplete": l,
|
|
1550
|
+
"data-streamdown": "link",
|
|
1551
|
+
href: n,
|
|
1552
|
+
rel: "noreferrer",
|
|
1553
|
+
target: "_blank",
|
|
1554
|
+
...i,
|
|
1555
|
+
children: e
|
|
1556
|
+
});
|
|
1557
|
+
}, (e, t) => E(e, t) && e.href === t.href);
|
|
1558
|
+
Lo.displayName = "MarkdownA";
|
|
1559
|
+
var Ro = memo(({ children: e, className: t, node: n, ...r }) => jsx("h1", {
|
|
1560
|
+
className: y()("mt-6 mb-2 font-semibold text-3xl", t),
|
|
1561
|
+
"data-streamdown": "heading-1",
|
|
1562
|
+
...r,
|
|
1563
|
+
children: e
|
|
1564
|
+
}), (e, t) => E(e, t));
|
|
1565
|
+
Ro.displayName = "MarkdownH1";
|
|
1566
|
+
var So = memo(({ children: e, className: t, node: n, ...r }) => jsx("h2", {
|
|
1567
|
+
className: y()("mt-6 mb-2 font-semibold text-2xl", t),
|
|
1568
|
+
"data-streamdown": "heading-2",
|
|
1569
|
+
...r,
|
|
1570
|
+
children: e
|
|
1571
|
+
}), (e, t) => E(e, t));
|
|
1572
|
+
So.displayName = "MarkdownH2";
|
|
1573
|
+
var Eo = memo(({ children: e, className: t, node: n, ...r }) => jsx("h3", {
|
|
1574
|
+
className: y()("mt-6 mb-2 font-semibold text-xl", t),
|
|
1575
|
+
"data-streamdown": "heading-3",
|
|
1576
|
+
...r,
|
|
1577
|
+
children: e
|
|
1578
|
+
}), (e, t) => E(e, t));
|
|
1579
|
+
Eo.displayName = "MarkdownH3";
|
|
1580
|
+
var Ho = memo(({ children: e, className: t, node: n, ...r }) => jsx("h4", {
|
|
1581
|
+
className: y()("mt-6 mb-2 font-semibold text-lg", t),
|
|
1582
|
+
"data-streamdown": "heading-4",
|
|
1583
|
+
...r,
|
|
1584
|
+
children: e
|
|
1585
|
+
}), (e, t) => E(e, t));
|
|
1586
|
+
Ho.displayName = "MarkdownH4";
|
|
1587
|
+
var Do = memo(({ children: e, className: t, node: n, ...r }) => jsx("h5", {
|
|
1588
|
+
className: y()("mt-6 mb-2 font-semibold text-base", t),
|
|
1589
|
+
"data-streamdown": "heading-5",
|
|
1590
|
+
...r,
|
|
1591
|
+
children: e
|
|
1592
|
+
}), (e, t) => E(e, t));
|
|
1593
|
+
Do.displayName = "MarkdownH5";
|
|
1594
|
+
var Bo = memo(({ children: e, className: t, node: n, ...r }) => jsx("h6", {
|
|
1595
|
+
className: y()("mt-6 mb-2 font-semibold text-sm", t),
|
|
1596
|
+
"data-streamdown": "heading-6",
|
|
1597
|
+
...r,
|
|
1598
|
+
children: e
|
|
1599
|
+
}), (e, t) => E(e, t));
|
|
1600
|
+
Bo.displayName = "MarkdownH6";
|
|
1601
|
+
var Ao = memo(({ children: e, className: t, node: n, ...r }) => {
|
|
1602
|
+
let { controls: i } = useContext(R);
|
|
1603
|
+
return jsx(vo, {
|
|
1604
|
+
className: t,
|
|
1605
|
+
showControls: ft(i, "table"),
|
|
1606
|
+
showCopy: pt(i, "copy"),
|
|
1607
|
+
showDownload: pt(i, "download"),
|
|
1608
|
+
showFullscreen: pt(i, "fullscreen"),
|
|
1609
|
+
...r,
|
|
1610
|
+
children: e
|
|
1611
|
+
});
|
|
1612
|
+
}, (e, t) => E(e, t));
|
|
1613
|
+
Ao.displayName = "MarkdownTable";
|
|
1614
|
+
var Oo = memo(({ children: e, className: t, node: n, ...r }) => jsx("thead", {
|
|
1615
|
+
className: y()("bg-muted/80", t),
|
|
1616
|
+
"data-streamdown": "table-header",
|
|
1617
|
+
...r,
|
|
1618
|
+
children: e
|
|
1619
|
+
}), (e, t) => E(e, t));
|
|
1620
|
+
Oo.displayName = "MarkdownThead";
|
|
1621
|
+
var Vo = memo(({ children: e, className: t, node: n, ...r }) => jsx("tbody", {
|
|
1622
|
+
className: y()("divide-y divide-border", t),
|
|
1623
|
+
"data-streamdown": "table-body",
|
|
1624
|
+
...r,
|
|
1625
|
+
children: e
|
|
1626
|
+
}), (e, t) => E(e, t));
|
|
1627
|
+
Vo.displayName = "MarkdownTbody";
|
|
1628
|
+
var jo = memo(({ children: e, className: t, node: n, ...r }) => jsx("tr", {
|
|
1629
|
+
className: y()("border-border", t),
|
|
1630
|
+
"data-streamdown": "table-row",
|
|
1631
|
+
...r,
|
|
1632
|
+
children: e
|
|
1633
|
+
}), (e, t) => E(e, t));
|
|
1634
|
+
jo.displayName = "MarkdownTr";
|
|
1635
|
+
var Fo = memo(({ children: e, className: t, node: n, ...r }) => jsx("th", {
|
|
1636
|
+
className: y()("whitespace-nowrap px-4 py-2 text-left font-semibold text-sm", t),
|
|
1637
|
+
"data-streamdown": "table-header-cell",
|
|
1638
|
+
...r,
|
|
1639
|
+
children: e
|
|
1640
|
+
}), (e, t) => E(e, t));
|
|
1641
|
+
Fo.displayName = "MarkdownTh";
|
|
1642
|
+
var zo = memo(({ children: e, className: t, node: n, ...r }) => jsx("td", {
|
|
1643
|
+
className: y()("px-4 py-2 text-sm", t),
|
|
1644
|
+
"data-streamdown": "table-cell",
|
|
1645
|
+
...r,
|
|
1646
|
+
children: e
|
|
1647
|
+
}), (e, t) => E(e, t));
|
|
1648
|
+
zo.displayName = "MarkdownTd";
|
|
1649
|
+
var _o = memo(({ children: e, className: t, node: n, ...r }) => jsx("blockquote", {
|
|
1650
|
+
className: y()("my-4 border-muted-foreground/30 border-l-4 pl-4 text-muted-foreground italic", t),
|
|
1651
|
+
"data-streamdown": "blockquote",
|
|
1652
|
+
...r,
|
|
1653
|
+
children: e
|
|
1654
|
+
}), (e, t) => E(e, t));
|
|
1655
|
+
_o.displayName = "MarkdownBlockquote";
|
|
1656
|
+
var qo = memo(({ children: e, className: t, node: n, ...r }) => jsx("sup", {
|
|
1657
|
+
className: y()("text-sm", t),
|
|
1658
|
+
"data-streamdown": "superscript",
|
|
1659
|
+
...r,
|
|
1660
|
+
children: e
|
|
1661
|
+
}), (e, t) => E(e, t));
|
|
1662
|
+
qo.displayName = "MarkdownSup";
|
|
1663
|
+
var $o = memo(({ children: e, className: t, node: n, ...r }) => jsx("sub", {
|
|
1664
|
+
className: y()("text-sm", t),
|
|
1665
|
+
"data-streamdown": "subscript",
|
|
1666
|
+
...r,
|
|
1667
|
+
children: e
|
|
1668
|
+
}), (e, t) => E(e, t));
|
|
1669
|
+
$o.displayName = "MarkdownSub";
|
|
1670
|
+
var Wo = memo(({ children: e, className: t, node: n, ...r }) => {
|
|
1671
|
+
if ("data-footnotes" in r) {
|
|
1672
|
+
let n = (e) => {
|
|
1673
|
+
if (!isValidElement(e)) return !1;
|
|
1674
|
+
let t = Array.isArray(e.props.children) ? e.props.children : [e.props.children], n = !1, r = !1;
|
|
1675
|
+
for (let e of t) if (e) {
|
|
1676
|
+
if (typeof e == "string") e.trim() !== "" && (n = !0);
|
|
1677
|
+
else if (isValidElement(e)) if (e.props?.["data-footnote-backref"] !== void 0) r = !0;
|
|
1678
|
+
else {
|
|
1679
|
+
let t = Array.isArray(e.props.children) ? e.props.children : [e.props.children];
|
|
1680
|
+
for (let e of t) {
|
|
1681
|
+
if (typeof e == "string" && e.trim() !== "") {
|
|
1682
|
+
n = !0;
|
|
1683
|
+
break;
|
|
1684
|
+
}
|
|
1685
|
+
if (isValidElement(e) && e.props?.["data-footnote-backref"] === void 0) {
|
|
1686
|
+
n = !0;
|
|
1687
|
+
break;
|
|
1688
|
+
}
|
|
1689
|
+
}
|
|
1690
|
+
}
|
|
1691
|
+
}
|
|
1692
|
+
return r && !n;
|
|
1693
|
+
}, i = Array.isArray(e) ? e.map((e) => {
|
|
1694
|
+
if (!isValidElement(e)) return e;
|
|
1695
|
+
if (e.type === bt) {
|
|
1696
|
+
let t = (Array.isArray(e.props.children) ? e.props.children : [e.props.children]).filter((e) => !n(e));
|
|
1697
|
+
return t.length === 0 ? null : {
|
|
1698
|
+
...e,
|
|
1699
|
+
props: {
|
|
1700
|
+
...e.props,
|
|
1701
|
+
children: t
|
|
1702
|
+
}
|
|
1703
|
+
};
|
|
1704
|
+
}
|
|
1705
|
+
return e;
|
|
1706
|
+
}) : e;
|
|
1707
|
+
return (Array.isArray(i) ? i.some((e) => e !== null) : i !== null) ? jsx("section", {
|
|
1708
|
+
className: t,
|
|
1709
|
+
...r,
|
|
1710
|
+
children: i
|
|
1711
|
+
}) : null;
|
|
1712
|
+
}
|
|
1713
|
+
return jsx("section", {
|
|
1714
|
+
className: t,
|
|
1715
|
+
...r,
|
|
1716
|
+
children: e
|
|
1717
|
+
});
|
|
1718
|
+
}, (e, t) => E(e, t));
|
|
1719
|
+
Wo.displayName = "MarkdownSection";
|
|
1720
|
+
var Zo = memo(({ node: e, className: t, children: n, ...r }) => {
|
|
1721
|
+
let i = y(), a = !("data-block" in r), { mermaid: o, controls: s, lineNumbers: c } = useContext(R), l = de(), u = tt(), d = (t?.match(ns))?.at(1) ?? "", f = ao(d);
|
|
1722
|
+
if (a) return jsx("code", {
|
|
1723
|
+
className: i("rounded bg-muted px-1.5 py-0.5 font-mono text-sm", t),
|
|
1724
|
+
"data-streamdown": "inline-code",
|
|
1725
|
+
...r,
|
|
1726
|
+
children: n
|
|
1727
|
+
});
|
|
1728
|
+
let p = e?.properties?.metastring, m = p?.match(es), g = m ? Number.parseInt(m[1], 10) : void 0, _ = g !== void 0 && g >= 1 ? g : void 0, v = !(p && ts.test(p)) && c !== !1, S = "";
|
|
1729
|
+
if (isValidElement(n) && n.props && typeof n.props == "object" && "children" in n.props && typeof n.props.children == "string" ? S = n.props.children : typeof n == "string" && (S = n), f) {
|
|
1730
|
+
let e = f.component;
|
|
1731
|
+
return jsx(Suspense, {
|
|
1732
|
+
fallback: jsx(Oe, {}),
|
|
1733
|
+
children: jsx(e, {
|
|
1734
|
+
code: S,
|
|
1735
|
+
isIncomplete: u,
|
|
1736
|
+
language: d,
|
|
1737
|
+
meta: p
|
|
1738
|
+
})
|
|
1739
|
+
});
|
|
1740
|
+
}
|
|
1741
|
+
if (d === "mermaid" && l) {
|
|
1742
|
+
let e = ft(s, "mermaid"), n = Fe(s, "download"), r = Fe(s, "copy"), a = Fe(s, "fullscreen"), c = Fe(s, "panZoom"), l = e && (n || r || a);
|
|
1743
|
+
return jsx(Suspense, {
|
|
1744
|
+
fallback: jsx(Oe, {}),
|
|
1745
|
+
children: jsxs("div", {
|
|
1746
|
+
className: i("group relative my-4 flex w-full flex-col gap-2 rounded-xl border border-border bg-sidebar p-2", t),
|
|
1747
|
+
"data-streamdown": "mermaid-block",
|
|
1748
|
+
children: [
|
|
1749
|
+
jsx("div", {
|
|
1750
|
+
className: i("flex h-8 items-center text-muted-foreground text-xs"),
|
|
1751
|
+
children: jsx("span", {
|
|
1752
|
+
className: i("ml-1 font-mono lowercase"),
|
|
1753
|
+
children: "mermaid"
|
|
1754
|
+
})
|
|
1755
|
+
}),
|
|
1756
|
+
l ? jsx("div", {
|
|
1757
|
+
className: i("pointer-events-none sticky top-2 z-10 -mt-10 flex h-8 items-center justify-end"),
|
|
1758
|
+
children: jsxs("div", {
|
|
1759
|
+
className: i("pointer-events-auto flex shrink-0 items-center gap-2 rounded-md border border-sidebar bg-sidebar/80 px-1.5 py-1 supports-[backdrop-filter]:bg-sidebar/70 supports-[backdrop-filter]:backdrop-blur"),
|
|
1760
|
+
"data-streamdown": "mermaid-block-actions",
|
|
1761
|
+
children: [
|
|
1762
|
+
n ? jsx(co, {
|
|
1763
|
+
chart: S,
|
|
1764
|
+
config: o?.config
|
|
1765
|
+
}) : null,
|
|
1766
|
+
r ? jsx(Ae, { code: S }) : null,
|
|
1767
|
+
a ? jsx(fo, {
|
|
1768
|
+
chart: S,
|
|
1769
|
+
config: o?.config
|
|
1770
|
+
}) : null
|
|
1771
|
+
]
|
|
1772
|
+
})
|
|
1773
|
+
}) : null,
|
|
1774
|
+
jsx("div", {
|
|
1775
|
+
className: i("rounded-md border border-border bg-background"),
|
|
1776
|
+
children: jsx(os, {
|
|
1777
|
+
chart: S,
|
|
1778
|
+
config: o?.config,
|
|
1779
|
+
showControls: c
|
|
1780
|
+
})
|
|
1781
|
+
})
|
|
1782
|
+
]
|
|
1783
|
+
})
|
|
1784
|
+
});
|
|
1785
|
+
}
|
|
1786
|
+
let C = ft(s, "code"), w = To(s, "download"), ai = To(s, "copy");
|
|
1787
|
+
return jsx(st, {
|
|
1788
|
+
className: t,
|
|
1789
|
+
code: S,
|
|
1790
|
+
isIncomplete: u,
|
|
1791
|
+
language: d,
|
|
1792
|
+
lineNumbers: v,
|
|
1793
|
+
startLine: _,
|
|
1794
|
+
children: C ? jsxs(Fragment$1, { children: [w ? jsx(it, {
|
|
1795
|
+
code: S,
|
|
1796
|
+
language: d
|
|
1797
|
+
}) : null, ai ? jsx(Ae, {}) : null] }) : null
|
|
1798
|
+
});
|
|
1799
|
+
}, (e, t) => e.className === t.className && qe(e.node, t.node));
|
|
1800
|
+
Zo.displayName = "MarkdownCode";
|
|
1801
|
+
var Xo = memo(oo, (e, t) => e.className === t.className && qe(e.node, t.node));
|
|
1802
|
+
Xo.displayName = "MarkdownImg";
|
|
1803
|
+
var Jo = memo(({ children: e, node: t, ...n }) => {
|
|
1804
|
+
let r = (Array.isArray(e) ? e : [e]).filter((e) => e != null && e !== "");
|
|
1805
|
+
if (r.length === 1 && isValidElement(r[0])) {
|
|
1806
|
+
let t = r[0].props.node?.tagName;
|
|
1807
|
+
if (t === "img" || t === "code" && "data-block" in r[0].props) return jsx(Fragment$1, { children: e });
|
|
1808
|
+
}
|
|
1809
|
+
return jsx("p", {
|
|
1810
|
+
...n,
|
|
1811
|
+
children: e
|
|
1812
|
+
});
|
|
1813
|
+
}, (e, t) => E(e, t));
|
|
1814
|
+
Jo.displayName = "MarkdownParagraph";
|
|
1815
|
+
var Ko = {
|
|
1816
|
+
ol: bt,
|
|
1817
|
+
li: Po,
|
|
1818
|
+
ul: Mo,
|
|
1819
|
+
hr: Io,
|
|
1820
|
+
strong: No,
|
|
1821
|
+
a: Lo,
|
|
1822
|
+
h1: Ro,
|
|
1823
|
+
h2: So,
|
|
1824
|
+
h3: Eo,
|
|
1825
|
+
h4: Ho,
|
|
1826
|
+
h5: Do,
|
|
1827
|
+
h6: Bo,
|
|
1828
|
+
table: Ao,
|
|
1829
|
+
thead: Oo,
|
|
1830
|
+
tbody: Vo,
|
|
1831
|
+
tr: jo,
|
|
1832
|
+
th: Fo,
|
|
1833
|
+
td: zo,
|
|
1834
|
+
blockquote: _o,
|
|
1835
|
+
code: Zo,
|
|
1836
|
+
img: Xo,
|
|
1837
|
+
pre: ({ children: e }) => isValidElement(e) ? cloneElement(e, { "data-block": "true" }) : e,
|
|
1838
|
+
sup: qo,
|
|
1839
|
+
sub: $o,
|
|
1840
|
+
p: Jo,
|
|
1841
|
+
section: Wo
|
|
1842
|
+
}, as = /[\u0590-\u08FF\uFB1D-\uFDFF\uFE70-\uFEFF]/, is = /\p{L}/u;
|
|
1843
|
+
function $e$1(e) {
|
|
1844
|
+
let t = e.replace(/^#{1,6}\s+/gm, "").replace(/(\*{1,3}|_{1,3})/g, "").replace(/`[^`]*`/g, "").replace(/\[([^\]]*)\]\([^)]*\)/g, "$1").replace(/^[\s>*\-+\d.]+/gm, "");
|
|
1845
|
+
for (let e of t) {
|
|
1846
|
+
if (as.test(e)) return "rtl";
|
|
1847
|
+
if (is.test(e)) return "ltr";
|
|
1848
|
+
}
|
|
1849
|
+
return "ltr";
|
|
1850
|
+
}
|
|
1851
|
+
var ls = /^[ \t]{0,3}(`{3,}|~{3,})/, cs = /^\|?[ \t]*:?-{1,}:?[ \t]*(\|[ \t]*:?-{1,}:?[ \t]*)*\|?$/, ht = (e) => {
|
|
1852
|
+
let t = e.split("\n"), n = null, r = 0;
|
|
1853
|
+
for (let e of t) {
|
|
1854
|
+
let t = ls.exec(e);
|
|
1855
|
+
if (n === null) {
|
|
1856
|
+
if (t) {
|
|
1857
|
+
let e = t[1];
|
|
1858
|
+
n = e[0], r = e.length;
|
|
1859
|
+
}
|
|
1860
|
+
} else if (t) {
|
|
1861
|
+
let e = t[1], i = e[0], a = e.length;
|
|
1862
|
+
i === n && a >= r && (n = null, r = 0);
|
|
1863
|
+
}
|
|
1864
|
+
}
|
|
1865
|
+
return n !== null;
|
|
1866
|
+
}, Uo = (e) => {
|
|
1867
|
+
let t = e.split("\n");
|
|
1868
|
+
for (let e of t) {
|
|
1869
|
+
let t = e.trim();
|
|
1870
|
+
if (t.length > 0 && t.includes("|") && cs.test(t)) return !0;
|
|
1871
|
+
}
|
|
1872
|
+
return !1;
|
|
1873
|
+
}, Go = () => (e) => {
|
|
1874
|
+
visit(e, "html", (e, t, n) => {
|
|
1875
|
+
!n || typeof t != "number" || (n.children[t] = {
|
|
1876
|
+
type: "text",
|
|
1877
|
+
value: e.value
|
|
1878
|
+
});
|
|
1879
|
+
});
|
|
1880
|
+
}, Qo = [], en = { allowDangerousHtml: !0 }, We = /* @__PURE__ */ new WeakMap(), tn = new class {
|
|
1881
|
+
constructor() {
|
|
1882
|
+
this.cache = /* @__PURE__ */ new Map(), this.keyCache = /* @__PURE__ */ new WeakMap(), this.maxSize = 100;
|
|
1883
|
+
}
|
|
1884
|
+
generateCacheKey(e) {
|
|
1885
|
+
let t = this.keyCache.get(e);
|
|
1886
|
+
if (t) return t;
|
|
1887
|
+
let n = e.rehypePlugins, r = e.remarkPlugins, i = e.remarkRehypeOptions;
|
|
1888
|
+
if (!(n || r || i)) {
|
|
1889
|
+
let t = "default";
|
|
1890
|
+
return this.keyCache.set(e, t), t;
|
|
1891
|
+
}
|
|
1892
|
+
let a = (e) => {
|
|
1893
|
+
if (!e || e.length === 0) return "";
|
|
1894
|
+
let t = "";
|
|
1895
|
+
for (let n = 0; n < e.length; n += 1) {
|
|
1896
|
+
let r = e[n];
|
|
1897
|
+
if (n > 0 && (t += ","), Array.isArray(r)) {
|
|
1898
|
+
let [e, n] = r;
|
|
1899
|
+
if (typeof e == "function") {
|
|
1900
|
+
let n = We.get(e);
|
|
1901
|
+
n || (n = e.name, We.set(e, n)), t += n;
|
|
1902
|
+
} else t += String(e);
|
|
1903
|
+
t += ":", t += JSON.stringify(n);
|
|
1904
|
+
} else if (typeof r == "function") {
|
|
1905
|
+
let e = We.get(r);
|
|
1906
|
+
e || (e = r.name, We.set(r, e)), t += e;
|
|
1907
|
+
} else t += String(r);
|
|
1908
|
+
}
|
|
1909
|
+
return t;
|
|
1910
|
+
}, o = a(n), s = `${a(r)}::${o}::${i ? JSON.stringify(i) : ""}`;
|
|
1911
|
+
return this.keyCache.set(e, s), s;
|
|
1912
|
+
}
|
|
1913
|
+
get(e) {
|
|
1914
|
+
let t = this.generateCacheKey(e), n = this.cache.get(t);
|
|
1915
|
+
return n && (this.cache.delete(t), this.cache.set(t, n)), n;
|
|
1916
|
+
}
|
|
1917
|
+
set(e, t) {
|
|
1918
|
+
let n = this.generateCacheKey(e);
|
|
1919
|
+
if (this.cache.size >= this.maxSize) {
|
|
1920
|
+
let e = this.cache.keys().next().value;
|
|
1921
|
+
e && this.cache.delete(e);
|
|
1922
|
+
}
|
|
1923
|
+
this.cache.set(n, t);
|
|
1924
|
+
}
|
|
1925
|
+
clear() {
|
|
1926
|
+
this.cache.clear();
|
|
1927
|
+
}
|
|
1928
|
+
}(), Ct = (e) => {
|
|
1929
|
+
let t = ws(e), n = e.children || "";
|
|
1930
|
+
return Ps(t.runSync(t.parse(n), n), e);
|
|
1931
|
+
}, ws = (e) => {
|
|
1932
|
+
let t = tn.get(e);
|
|
1933
|
+
if (t) return t;
|
|
1934
|
+
let n = ks(e);
|
|
1935
|
+
return tn.set(e, n), n;
|
|
1936
|
+
}, Cs = (e) => e.some((e) => Array.isArray(e) ? e[0] === rehypeRaw : e === rehypeRaw), ks = (e) => {
|
|
1937
|
+
let t = e.rehypePlugins || Qo, n = e.remarkPlugins || Qo, r = Cs(t) ? n : [...n, Go], i = e.remarkRehypeOptions ? {
|
|
1938
|
+
...en,
|
|
1939
|
+
...e.remarkRehypeOptions
|
|
1940
|
+
} : en;
|
|
1941
|
+
return unified().use(remarkParse).use(r).use(remarkRehype, i).use(t);
|
|
1942
|
+
}, on = (e) => e, vs = (e, t, n, r) => {
|
|
1943
|
+
n ? e.children.splice(t, 1) : e.children[t] = {
|
|
1944
|
+
type: "text",
|
|
1945
|
+
value: r
|
|
1946
|
+
};
|
|
1947
|
+
}, xs = (e, t) => {
|
|
1948
|
+
for (let n in urlAttributes) if (Object.hasOwn(urlAttributes, n) && Object.hasOwn(e.properties, n)) {
|
|
1949
|
+
let r = e.properties[n], i = urlAttributes[n];
|
|
1950
|
+
(i === null || i.includes(e.tagName)) && (e.properties[n] = t(String(r || ""), n, e) ?? void 0);
|
|
1951
|
+
}
|
|
1952
|
+
}, Ts = (e, t, n, r, i, a) => {
|
|
1953
|
+
let o = !1;
|
|
1954
|
+
return r ? o = !r.includes(e.tagName) : i && (o = i.includes(e.tagName)), !o && a && typeof t == "number" && (o = !a(e, t, n)), o;
|
|
1955
|
+
}, Ps = (e, t) => {
|
|
1956
|
+
let { allowElement: r, allowedElements: i, disallowedElements: a, skipHtml: o, unwrapDisallowed: s, urlTransform: c } = t;
|
|
1957
|
+
if (r || i || a || o || c) {
|
|
1958
|
+
let t = c || on;
|
|
1959
|
+
visit(e, (e, n, c) => {
|
|
1960
|
+
if (e.type === "raw" && c && typeof n == "number") return vs(c, n, o, e.value), n;
|
|
1961
|
+
if (e.type === "element" && (xs(e, t), Ts(e, n, c, i, a, r) && c && typeof n == "number")) return s && e.children ? c.children.splice(n, 1, ...e.children) : c.children.splice(n, 1), n;
|
|
1962
|
+
});
|
|
1963
|
+
}
|
|
1964
|
+
return toJsxRuntime(e, {
|
|
1965
|
+
Fragment: Fragment$1,
|
|
1966
|
+
components: t.components,
|
|
1967
|
+
ignoreInvalidStyle: !0,
|
|
1968
|
+
jsx,
|
|
1969
|
+
jsxs,
|
|
1970
|
+
passKeys: !0,
|
|
1971
|
+
passNode: !0
|
|
1972
|
+
});
|
|
1973
|
+
}, Is = /\[\^[\w-]{1,200}\](?!:)/, Ns = /\[\^[\w-]{1,200}\]:/, Ls = /<(\w+)[\s>]/, Rs = new Set([
|
|
1974
|
+
"area",
|
|
1975
|
+
"base",
|
|
1976
|
+
"br",
|
|
1977
|
+
"col",
|
|
1978
|
+
"embed",
|
|
1979
|
+
"hr",
|
|
1980
|
+
"img",
|
|
1981
|
+
"input",
|
|
1982
|
+
"link",
|
|
1983
|
+
"meta",
|
|
1984
|
+
"param",
|
|
1985
|
+
"source",
|
|
1986
|
+
"track",
|
|
1987
|
+
"wbr"
|
|
1988
|
+
]), nn = /* @__PURE__ */ new Map(), rn = /* @__PURE__ */ new Map(), Ss = (e) => {
|
|
1989
|
+
let t = e.toLowerCase(), n = nn.get(t);
|
|
1990
|
+
if (n) return n;
|
|
1991
|
+
let r = RegExp(`<${t}(?=[\\s>/])[^>]*>`, "gi");
|
|
1992
|
+
return nn.set(t, r), r;
|
|
1993
|
+
}, Es = (e) => {
|
|
1994
|
+
let t = e.toLowerCase(), n = rn.get(t);
|
|
1995
|
+
if (n) return n;
|
|
1996
|
+
let r = RegExp(`</${t}(?=[\\s>])[^>]*>`, "gi");
|
|
1997
|
+
return rn.set(t, r), r;
|
|
1998
|
+
}, sn = (e, t) => {
|
|
1999
|
+
if (Rs.has(t.toLowerCase())) return 0;
|
|
2000
|
+
let n = e.match(Ss(t));
|
|
2001
|
+
if (!n) return 0;
|
|
2002
|
+
let r = 0;
|
|
2003
|
+
for (let e of n) e.trimEnd().endsWith("/>") || (r += 1);
|
|
2004
|
+
return r;
|
|
2005
|
+
}, an = (e, t) => {
|
|
2006
|
+
let n = e.match(Es(t));
|
|
2007
|
+
return n ? n.length : 0;
|
|
2008
|
+
}, Hs = (e) => {
|
|
2009
|
+
let t = 0;
|
|
2010
|
+
for (let n = 0; n < e.length - 1; n += 1) e[n] === "$" && e[n + 1] === "$" && (t += 1, n += 1);
|
|
2011
|
+
return t;
|
|
2012
|
+
}, kt = (e) => {
|
|
2013
|
+
let t = Is.test(e), n = Ns.test(e);
|
|
2014
|
+
if (t || n) return [e];
|
|
2015
|
+
let r = x.lex(e, { gfm: !0 }), i = [], a = [], o = !1;
|
|
2016
|
+
for (let e of r) {
|
|
2017
|
+
let t = e.raw, n = i.length;
|
|
2018
|
+
if (a.length > 0) {
|
|
2019
|
+
i[n - 1] += t;
|
|
2020
|
+
let e = a.at(-1), r = sn(t, e), o = an(t, e);
|
|
2021
|
+
for (let t = 0; t < r; t += 1) a.push(e);
|
|
2022
|
+
for (let t = 0; t < o; t += 1) a.length > 0 && a.at(-1) === e && a.pop();
|
|
2023
|
+
continue;
|
|
2024
|
+
}
|
|
2025
|
+
if (e.type === "html" && e.block) {
|
|
2026
|
+
let e = t.match(Ls);
|
|
2027
|
+
if (e) {
|
|
2028
|
+
let n = e[1];
|
|
2029
|
+
sn(t, n) > an(t, n) && a.push(n);
|
|
2030
|
+
}
|
|
2031
|
+
}
|
|
2032
|
+
if (n > 0 && !o) {
|
|
2033
|
+
let e = i[n - 1];
|
|
2034
|
+
if (Hs(e) % 2 == 1) {
|
|
2035
|
+
i[n - 1] = e + t;
|
|
2036
|
+
continue;
|
|
2037
|
+
}
|
|
2038
|
+
}
|
|
2039
|
+
i.push(t), e.type !== "space" && (o = e.type === "code");
|
|
2040
|
+
}
|
|
2041
|
+
return i;
|
|
2042
|
+
}, ln = (e, t) => {
|
|
2043
|
+
if (!t.length) return e;
|
|
2044
|
+
let n = e;
|
|
2045
|
+
for (let e of t) {
|
|
2046
|
+
let t = RegExp(`(<${e}(?=[\\s>/])[^>]*>)([\\s\\S]*?)(</${e}\\s*>)`, "gi");
|
|
2047
|
+
n = n.replace(t, (e, t, n, r) => {
|
|
2048
|
+
if (!n.includes("\n\n")) return t + n + r;
|
|
2049
|
+
let i = n.replace(/\n\n/g, "\n<!---->\n");
|
|
2050
|
+
return `${t}${(i.startsWith("\n") ? "" : "\n") + i + (i.endsWith("\n") ? "" : "\n")}${r}
|
|
2051
|
+
|
|
2052
|
+
`;
|
|
2053
|
+
});
|
|
2054
|
+
}
|
|
2055
|
+
return n;
|
|
2056
|
+
}, Ds = /([\\`*_~[\]|])/g, Bs = (e) => e.replace(Ds, "\\$1"), cn = (e, t) => {
|
|
2057
|
+
if (!t.length) return e;
|
|
2058
|
+
let n = e;
|
|
2059
|
+
for (let e of t) {
|
|
2060
|
+
let t = RegExp(`(<${e}(?=[\\s>/])[^>]*>)([\\s\\S]*?)(</${e}\\s*>)`, "gi");
|
|
2061
|
+
n = n.replace(t, (e, t, n, r) => t + Bs(n).replace(/\n\n/g, " ") + r);
|
|
2062
|
+
}
|
|
2063
|
+
return n;
|
|
2064
|
+
}, dn = (e) => e.type === "text" ? e.value : "children" in e && Array.isArray(e.children) ? e.children.map(dn).join("") : "", mn = (e) => (t) => {
|
|
2065
|
+
if (!e || e.length === 0) return;
|
|
2066
|
+
let r = new Set(e.map((e) => e.toLowerCase()));
|
|
2067
|
+
visit(t, "element", (e) => {
|
|
2068
|
+
if (r.has(e.tagName.toLowerCase())) {
|
|
2069
|
+
let t = dn(e);
|
|
2070
|
+
e.children = t ? [{
|
|
2071
|
+
type: "text",
|
|
2072
|
+
value: t
|
|
2073
|
+
}] : [];
|
|
2074
|
+
}
|
|
2075
|
+
});
|
|
2076
|
+
}, un = () => (e) => {
|
|
2077
|
+
visit(e, "code", (e) => {
|
|
2078
|
+
e.meta && (e.data = e.data ?? {}, e.data.hProperties = {
|
|
2079
|
+
...e.data.hProperties ?? {},
|
|
2080
|
+
metastring: e.meta
|
|
2081
|
+
});
|
|
2082
|
+
});
|
|
2083
|
+
}, Zs = /^[ \t]*<[\w!/?-]/, Xs = /(^|\n)[ \t]{4,}(?=<[\w!/?-])/g, Js = (e) => typeof e != "string" || e.length === 0 || !Zs.test(e) ? e : e.replace(Xs, "$1"), Ze = {
|
|
2084
|
+
...defaultSchema,
|
|
2085
|
+
protocols: {
|
|
2086
|
+
...defaultSchema.protocols,
|
|
2087
|
+
href: [...defaultSchema.protocols?.href ?? [], "tel"]
|
|
2088
|
+
},
|
|
2089
|
+
attributes: {
|
|
2090
|
+
...defaultSchema.attributes,
|
|
2091
|
+
code: [...defaultSchema.attributes?.code ?? [], "metastring"]
|
|
2092
|
+
}
|
|
2093
|
+
}, xt = {
|
|
2094
|
+
raw: rehypeRaw,
|
|
2095
|
+
sanitize: [rehypeSanitize, Ze],
|
|
2096
|
+
harden: [harden, {
|
|
2097
|
+
allowedImagePrefixes: ["*"],
|
|
2098
|
+
allowedLinkPrefixes: ["*"],
|
|
2099
|
+
allowedProtocols: ["*"],
|
|
2100
|
+
defaultOrigin: void 0,
|
|
2101
|
+
allowDataImages: !0
|
|
2102
|
+
}]
|
|
2103
|
+
}, Ks = {
|
|
2104
|
+
gfm: [remarkGfm, {}],
|
|
2105
|
+
codeMeta: un
|
|
2106
|
+
}, gn = Object.values(xt), Us = Object.values(Ks), Gs = {
|
|
2107
|
+
block: " ▋",
|
|
2108
|
+
circle: " ●"
|
|
2109
|
+
}, vn = ["github-light", "github-dark"], xn = { enabled: !0 }, R = createContext({
|
|
2110
|
+
shikiTheme: vn,
|
|
2111
|
+
controls: !0,
|
|
2112
|
+
isAnimating: !1,
|
|
2113
|
+
lineNumbers: !0,
|
|
2114
|
+
mode: "streaming",
|
|
2115
|
+
mermaid: void 0,
|
|
2116
|
+
linkSafety: xn
|
|
2117
|
+
}), Tn = memo(({ content: e, shouldParseIncompleteMarkdown: t, shouldNormalizeHtmlIndentation: n, index: r, isIncomplete: i, dir: a, animatePlugin: o, ...s }) => {
|
|
2118
|
+
if (o) {
|
|
2119
|
+
let e = o.getLastRenderCharCount();
|
|
2120
|
+
o.setPrevContentLength(e);
|
|
2121
|
+
}
|
|
2122
|
+
let c = typeof e == "string" && n ? Js(e) : e, l = jsx(Ct, {
|
|
2123
|
+
...s,
|
|
2124
|
+
children: c
|
|
2125
|
+
});
|
|
2126
|
+
return jsx(et.Provider, {
|
|
2127
|
+
value: i,
|
|
2128
|
+
children: a ? jsx("div", {
|
|
2129
|
+
dir: a,
|
|
2130
|
+
style: { display: "contents" },
|
|
2131
|
+
children: l
|
|
2132
|
+
}) : l
|
|
2133
|
+
});
|
|
2134
|
+
}, (e, t) => {
|
|
2135
|
+
if (e.content !== t.content || e.shouldNormalizeHtmlIndentation !== t.shouldNormalizeHtmlIndentation || e.index !== t.index || e.isIncomplete !== t.isIncomplete || e.dir !== t.dir) return !1;
|
|
2136
|
+
if (e.components !== t.components) {
|
|
2137
|
+
let n = Object.keys(e.components || {}), r = Object.keys(t.components || {});
|
|
2138
|
+
if (n.length !== r.length || n.some((n) => e.components?.[n] !== t.components?.[n])) return !1;
|
|
2139
|
+
}
|
|
2140
|
+
return !(e.rehypePlugins !== t.rehypePlugins || e.remarkPlugins !== t.remarkPlugins);
|
|
2141
|
+
});
|
|
2142
|
+
Tn.displayName = "Block";
|
|
2143
|
+
var Qs = memo(({ children: e, mode: t = "streaming", dir: n, parseIncompleteMarkdown: r = !0, normalizeHtmlIndentation: i = !1, components: a, rehypePlugins: o = gn, remarkPlugins: l = Us, className: u, shikiTheme: d = vn, mermaid: f, controls: p = !0, isAnimating: m = !1, animated: h, BlockComponent: g = Tn, parseMarkdownIntoBlocksFn: _ = kt, caret: b, plugins: S, remend: C, linkSafety: w = xn, lineNumbers: T = !0, allowedTags: k, literalTagContent: A, translations: j, icons: M, prefix: N, onAnimationStart: P, onAnimationEnd: F, ...I }) => {
|
|
2144
|
+
let z = useId(), [ci, li] = useTransition(), B = useMemo(() => Dt(N), [N]), V = useRef(null), H = useRef(P), U = useRef(F);
|
|
2145
|
+
H.current = P, U.current = F, useEffect(() => {
|
|
2146
|
+
var e, n, r;
|
|
2147
|
+
if (t === "static") return;
|
|
2148
|
+
let i = V.current;
|
|
2149
|
+
if (V.current = m, i === null) {
|
|
2150
|
+
m && ((e = H.current) == null || e.call(H));
|
|
2151
|
+
return;
|
|
2152
|
+
}
|
|
2153
|
+
m && !i ? (n = H.current) == null || n.call(H) : !m && i && ((r = U.current) == null || r.call(U));
|
|
2154
|
+
}, [m, t]);
|
|
2155
|
+
let G = useMemo(() => k ? Object.keys(k) : [], [k]), K = useMemo(() => {
|
|
2156
|
+
if (typeof e != "string") return "";
|
|
2157
|
+
let n = t === "streaming" && r ? $e(e, C) : e;
|
|
2158
|
+
return A && A.length > 0 && (n = cn(n, A)), G.length > 0 && (n = ln(n, G)), n;
|
|
2159
|
+
}, [
|
|
2160
|
+
e,
|
|
2161
|
+
t,
|
|
2162
|
+
r,
|
|
2163
|
+
C,
|
|
2164
|
+
G,
|
|
2165
|
+
A
|
|
2166
|
+
]), q = useMemo(() => _(K), [K, _]), [ui, J] = useState(q);
|
|
2167
|
+
useEffect(() => {
|
|
2168
|
+
t === "streaming" && !Z ? li(() => {
|
|
2169
|
+
J(q);
|
|
2170
|
+
}) : J(q);
|
|
2171
|
+
}, [q, t]);
|
|
2172
|
+
let Y = t === "streaming" ? ui : q, di = useMemo(() => n === "auto" ? Y.map($e$1) : void 0, [Y, n]), fi = useMemo(() => Y.map((e, t) => `${z}-${t}`), [Y.length, z]), X = useMemo(() => h === !0 ? "true" : h ? JSON.stringify(h) : "", [h]), Z = useMemo(() => X ? X === "true" ? be() : be(h) : null, [X]), Q = useMemo(() => ({
|
|
2173
|
+
shikiTheme: (S?.code)?.getThemes() ?? d,
|
|
2174
|
+
controls: p,
|
|
2175
|
+
isAnimating: m,
|
|
2176
|
+
lineNumbers: T,
|
|
2177
|
+
mode: t,
|
|
2178
|
+
mermaid: f,
|
|
2179
|
+
linkSafety: w
|
|
2180
|
+
}), [
|
|
2181
|
+
d,
|
|
2182
|
+
p,
|
|
2183
|
+
m,
|
|
2184
|
+
T,
|
|
2185
|
+
t,
|
|
2186
|
+
f,
|
|
2187
|
+
w,
|
|
2188
|
+
S?.code
|
|
2189
|
+
]), pi = useMemo(() => ({
|
|
2190
|
+
...De,
|
|
2191
|
+
...j
|
|
2192
|
+
}), [useMemo(() => j ? JSON.stringify(j) : "", [j])]), mi = useMemo(() => {
|
|
2193
|
+
let { inlineCode: e, ...t } = a ?? {}, n = {
|
|
2194
|
+
...Ko,
|
|
2195
|
+
...t
|
|
2196
|
+
};
|
|
2197
|
+
if (e) {
|
|
2198
|
+
let t = n.code;
|
|
2199
|
+
n.code = (n) => "data-block" in n ? t ? createElement(t, n) : null : createElement(e, n);
|
|
2200
|
+
}
|
|
2201
|
+
return n;
|
|
2202
|
+
}, [a]), hi = useMemo(() => {
|
|
2203
|
+
let e = [];
|
|
2204
|
+
return S != null && S.cjk && (e = [...e, ...S.cjk.remarkPluginsBefore]), e = [...e, ...l], S != null && S.cjk && (e = [...e, ...S.cjk.remarkPluginsAfter]), S != null && S.math && (e = [...e, S.math.remarkPlugin]), e;
|
|
2205
|
+
}, [
|
|
2206
|
+
l,
|
|
2207
|
+
S?.math,
|
|
2208
|
+
S?.cjk
|
|
2209
|
+
]), gi = useMemo(() => {
|
|
2210
|
+
let e = o;
|
|
2211
|
+
if (k && Object.keys(k).length > 0 && o === gn) {
|
|
2212
|
+
let t = {
|
|
2213
|
+
...Ze,
|
|
2214
|
+
tagNames: [...Ze.tagNames ?? [], ...Object.keys(k)],
|
|
2215
|
+
attributes: {
|
|
2216
|
+
...Ze.attributes,
|
|
2217
|
+
...k
|
|
2218
|
+
}
|
|
2219
|
+
};
|
|
2220
|
+
e = [
|
|
2221
|
+
xt.raw,
|
|
2222
|
+
[rehypeSanitize, t],
|
|
2223
|
+
xt.harden
|
|
2224
|
+
];
|
|
2225
|
+
}
|
|
2226
|
+
return A && A.length > 0 && (e = [...e, [mn, A]]), S != null && S.math && (e = [...e, S.math.rehypePlugin]), Z && m && (e = [...e, Z.rehypePlugin]), e;
|
|
2227
|
+
}, [
|
|
2228
|
+
o,
|
|
2229
|
+
S?.math,
|
|
2230
|
+
Z,
|
|
2231
|
+
m,
|
|
2232
|
+
k,
|
|
2233
|
+
A
|
|
2234
|
+
]), $ = useMemo(() => {
|
|
2235
|
+
if (!m || Y.length === 0) return !1;
|
|
2236
|
+
let e = Y.at(-1);
|
|
2237
|
+
return ht(e) || Uo(e);
|
|
2238
|
+
}, [m, Y]), _i = useMemo(() => b && m && !$ ? { "--streamdown-caret": `"${Gs[b]}"` } : void 0, [
|
|
2239
|
+
b,
|
|
2240
|
+
m,
|
|
2241
|
+
$
|
|
2242
|
+
]);
|
|
2243
|
+
return t === "static" ? jsx(Be.Provider, {
|
|
2244
|
+
value: pi,
|
|
2245
|
+
children: jsx(Ve.Provider, {
|
|
2246
|
+
value: S ?? null,
|
|
2247
|
+
children: jsx(R.Provider, {
|
|
2248
|
+
value: Q,
|
|
2249
|
+
children: jsx(at, {
|
|
2250
|
+
icons: M,
|
|
2251
|
+
children: jsx(Ee.Provider, {
|
|
2252
|
+
value: B,
|
|
2253
|
+
children: jsx("div", {
|
|
2254
|
+
className: B("space-y-4 whitespace-normal [&>*:first-child]:mt-0 [&>*:last-child]:mb-0", u),
|
|
2255
|
+
dir: n === "auto" ? $e$1(K) : n,
|
|
2256
|
+
children: jsx(Ct, {
|
|
2257
|
+
components: mi,
|
|
2258
|
+
rehypePlugins: gi,
|
|
2259
|
+
remarkPlugins: hi,
|
|
2260
|
+
...I,
|
|
2261
|
+
children: K
|
|
2262
|
+
})
|
|
2263
|
+
})
|
|
2264
|
+
})
|
|
2265
|
+
})
|
|
2266
|
+
})
|
|
2267
|
+
})
|
|
2268
|
+
}) : jsx(Be.Provider, {
|
|
2269
|
+
value: pi,
|
|
2270
|
+
children: jsx(Ve.Provider, {
|
|
2271
|
+
value: S ?? null,
|
|
2272
|
+
children: jsx(R.Provider, {
|
|
2273
|
+
value: Q,
|
|
2274
|
+
children: jsx(at, {
|
|
2275
|
+
icons: M,
|
|
2276
|
+
children: jsx(Ee.Provider, {
|
|
2277
|
+
value: B,
|
|
2278
|
+
children: jsxs("div", {
|
|
2279
|
+
className: B("space-y-4 whitespace-normal [&>*:first-child]:mt-0 [&>*:last-child]:mb-0", b && !$ ? "[&>*:last-child]:after:inline [&>*:last-child]:after:align-baseline [&>*:last-child]:after:content-[var(--streamdown-caret)]" : null, u),
|
|
2280
|
+
style: _i,
|
|
2281
|
+
children: [Y.length === 0 && b && m && jsx("span", {}), Y.map((e, t) => {
|
|
2282
|
+
let a = t === Y.length - 1, o = m && a && ht(e);
|
|
2283
|
+
return jsx(g, {
|
|
2284
|
+
animatePlugin: Z,
|
|
2285
|
+
components: mi,
|
|
2286
|
+
content: e,
|
|
2287
|
+
dir: di?.[t] ?? (n === "auto" ? void 0 : n),
|
|
2288
|
+
index: t,
|
|
2289
|
+
isIncomplete: o,
|
|
2290
|
+
rehypePlugins: gi,
|
|
2291
|
+
remarkPlugins: hi,
|
|
2292
|
+
shouldNormalizeHtmlIndentation: i,
|
|
2293
|
+
shouldParseIncompleteMarkdown: r,
|
|
2294
|
+
...I
|
|
2295
|
+
}, fi[t]);
|
|
2296
|
+
})]
|
|
2297
|
+
})
|
|
2298
|
+
})
|
|
2299
|
+
})
|
|
2300
|
+
})
|
|
2301
|
+
})
|
|
2302
|
+
});
|
|
2303
|
+
}, (e, t) => e.children === t.children && e.shikiTheme === t.shikiTheme && e.isAnimating === t.isAnimating && e.animated === t.animated && e.mode === t.mode && e.plugins === t.plugins && e.className === t.className && e.linkSafety === t.linkSafety && e.lineNumbers === t.lineNumbers && e.normalizeHtmlIndentation === t.normalizeHtmlIndentation && e.literalTagContent === t.literalTagContent && JSON.stringify(e.translations) === JSON.stringify(t.translations) && e.prefix === t.prefix && e.dir === t.dir);
|
|
2304
|
+
Qs.displayName = "Streamdown";
|
|
2305
|
+
var Nn = ({ children: e, className: t, minZoom: n = .5, maxZoom: r = 3, zoomStep: i = .1, showControls: a = !0, initialZoom: o = 1, fullscreen: s = !1 }) => {
|
|
2306
|
+
let { RotateCcwIcon: c, ZoomInIcon: l, ZoomOutIcon: u } = L(), d = y(), f = useRef(null), p = useRef(null), [m, h] = useState(o), [g, _] = useState({
|
|
2307
|
+
x: 0,
|
|
2308
|
+
y: 0
|
|
2309
|
+
}), [v, b] = useState(!1), [S, C] = useState({
|
|
2310
|
+
x: 0,
|
|
2311
|
+
y: 0
|
|
2312
|
+
}), [T, oi] = useState({
|
|
2313
|
+
x: 0,
|
|
2314
|
+
y: 0
|
|
2315
|
+
}), O = useCallback((e) => {
|
|
2316
|
+
h((t) => Math.max(n, Math.min(r, t + e)));
|
|
2317
|
+
}, [n, r]), si = useCallback(() => {
|
|
2318
|
+
O(i);
|
|
2319
|
+
}, [O, i]), k = useCallback(() => {
|
|
2320
|
+
O(-i);
|
|
2321
|
+
}, [O, i]), A = useCallback(() => {
|
|
2322
|
+
h(o), _({
|
|
2323
|
+
x: 0,
|
|
2324
|
+
y: 0
|
|
2325
|
+
});
|
|
2326
|
+
}, [o]), j = useCallback((e) => {
|
|
2327
|
+
e.preventDefault(), O(e.deltaY > 0 ? -i : i);
|
|
2328
|
+
}, [O, i]), M = useCallback((e) => {
|
|
2329
|
+
if (e.button !== 0 || e.isPrimary === !1) return;
|
|
2330
|
+
b(!0), C({
|
|
2331
|
+
x: e.clientX,
|
|
2332
|
+
y: e.clientY
|
|
2333
|
+
}), oi(g);
|
|
2334
|
+
let t = e.currentTarget;
|
|
2335
|
+
t instanceof HTMLElement && t.setPointerCapture(e.pointerId);
|
|
2336
|
+
}, [g]), N = useCallback((e) => {
|
|
2337
|
+
if (!v) return;
|
|
2338
|
+
e.preventDefault();
|
|
2339
|
+
let t = e.clientX - S.x, n = e.clientY - S.y;
|
|
2340
|
+
_({
|
|
2341
|
+
x: T.x + t,
|
|
2342
|
+
y: T.y + n
|
|
2343
|
+
});
|
|
2344
|
+
}, [
|
|
2345
|
+
v,
|
|
2346
|
+
S,
|
|
2347
|
+
T
|
|
2348
|
+
]), P = useCallback((e) => {
|
|
2349
|
+
b(!1);
|
|
2350
|
+
let t = e.currentTarget;
|
|
2351
|
+
t instanceof HTMLElement && t.releasePointerCapture(e.pointerId);
|
|
2352
|
+
}, []);
|
|
2353
|
+
return useEffect(() => {
|
|
2354
|
+
let e = f.current;
|
|
2355
|
+
if (e) return e.addEventListener("wheel", j, { passive: !1 }), () => {
|
|
2356
|
+
e.removeEventListener("wheel", j);
|
|
2357
|
+
};
|
|
2358
|
+
}, [j]), useEffect(() => {
|
|
2359
|
+
let e = p.current;
|
|
2360
|
+
if (e && v) return document.body.style.userSelect = "none", e.addEventListener("pointermove", N, { passive: !1 }), e.addEventListener("pointerup", P), e.addEventListener("pointercancel", P), () => {
|
|
2361
|
+
document.body.style.userSelect = "", e.removeEventListener("pointermove", N), e.removeEventListener("pointerup", P), e.removeEventListener("pointercancel", P);
|
|
2362
|
+
};
|
|
2363
|
+
}, [
|
|
2364
|
+
v,
|
|
2365
|
+
N,
|
|
2366
|
+
P
|
|
2367
|
+
]), jsxs("div", {
|
|
2368
|
+
className: d("relative flex flex-col", s ? "h-full w-full" : "min-h-28 w-full", t),
|
|
2369
|
+
ref: f,
|
|
2370
|
+
style: { cursor: v ? "grabbing" : "grab" },
|
|
2371
|
+
children: [a ? jsxs("div", {
|
|
2372
|
+
className: d("absolute z-10 flex flex-col gap-1 rounded-md border border-border bg-background/80 p-1 supports-[backdrop-filter]:bg-background/70 supports-[backdrop-filter]:backdrop-blur-sm", s ? "bottom-4 left-4" : "bottom-2 left-2"),
|
|
2373
|
+
children: [
|
|
2374
|
+
jsx("button", {
|
|
2375
|
+
className: d("flex items-center justify-center rounded p-1.5 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50"),
|
|
2376
|
+
disabled: m >= r,
|
|
2377
|
+
onClick: si,
|
|
2378
|
+
title: "Zoom in",
|
|
2379
|
+
type: "button",
|
|
2380
|
+
children: jsx(l, { size: 16 })
|
|
2381
|
+
}),
|
|
2382
|
+
jsx("button", {
|
|
2383
|
+
className: d("flex items-center justify-center rounded p-1.5 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50"),
|
|
2384
|
+
disabled: m <= n,
|
|
2385
|
+
onClick: k,
|
|
2386
|
+
title: "Zoom out",
|
|
2387
|
+
type: "button",
|
|
2388
|
+
children: jsx(u, { size: 16 })
|
|
2389
|
+
}),
|
|
2390
|
+
jsx("button", {
|
|
2391
|
+
className: d("flex items-center justify-center rounded p-1.5 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground"),
|
|
2392
|
+
onClick: A,
|
|
2393
|
+
title: "Reset zoom and pan",
|
|
2394
|
+
type: "button",
|
|
2395
|
+
children: jsx(c, { size: 16 })
|
|
2396
|
+
})
|
|
2397
|
+
]
|
|
2398
|
+
}) : null, jsx("div", {
|
|
2399
|
+
className: d("flex-1 origin-center transition-transform duration-150 ease-out", s ? "flex h-full w-full items-center justify-center" : "flex w-full items-center justify-center"),
|
|
2400
|
+
onPointerDown: M,
|
|
2401
|
+
ref: p,
|
|
2402
|
+
role: "application",
|
|
2403
|
+
style: {
|
|
2404
|
+
transform: `translate(${g.x}px, ${g.y}px) scale(${m})`,
|
|
2405
|
+
transformOrigin: "center center",
|
|
2406
|
+
touchAction: "none",
|
|
2407
|
+
willChange: "transform"
|
|
2408
|
+
},
|
|
2409
|
+
children: e
|
|
2410
|
+
})]
|
|
2411
|
+
});
|
|
2412
|
+
}, po = ({ chart: e, className: t, config: n, fullscreen: r = !1, showControls: i = !0 }) => {
|
|
2413
|
+
let a = y(), [o, s] = useState(null), [c, l] = useState(!1), [u, d] = useState(""), [f, p] = useState(""), [m, h] = useState(0), { mermaid: g } = useContext(R), _ = de(), v = g?.errorComponent, { shouldRender: b, containerRef: S } = Rt({ immediate: r });
|
|
2414
|
+
if (useEffect(() => {
|
|
2415
|
+
if (b) {
|
|
2416
|
+
if (!_) {
|
|
2417
|
+
s("Mermaid plugin not available. Please add the mermaid plugin to enable diagram rendering.");
|
|
2418
|
+
return;
|
|
2419
|
+
}
|
|
2420
|
+
(async () => {
|
|
2421
|
+
try {
|
|
2422
|
+
s(null), l(!0);
|
|
2423
|
+
let t = _.getMermaid(n), r = e.split("").reduce((e, t) => (e << 5) - e + t.charCodeAt(0) | 0, 0), i = `mermaid-${Math.abs(r)}-${Date.now()}-${Math.random().toString(36).substring(2, 9)}`, { svg: a } = await t.render(i, e);
|
|
2424
|
+
d(a), p(a);
|
|
2425
|
+
} catch (e) {
|
|
2426
|
+
f || u || s(e instanceof Error ? e.message : "Failed to render Mermaid chart");
|
|
2427
|
+
} finally {
|
|
2428
|
+
l(!1);
|
|
2429
|
+
}
|
|
2430
|
+
})();
|
|
2431
|
+
}
|
|
2432
|
+
}, [
|
|
2433
|
+
e,
|
|
2434
|
+
n,
|
|
2435
|
+
m,
|
|
2436
|
+
b,
|
|
2437
|
+
_
|
|
2438
|
+
]), !(b || u || f)) return jsx("div", {
|
|
2439
|
+
className: a("my-4 min-h-[200px]", t),
|
|
2440
|
+
ref: S
|
|
2441
|
+
});
|
|
2442
|
+
if (c && !u && !f) return jsx("div", {
|
|
2443
|
+
className: a("my-4 flex justify-center p-4", t),
|
|
2444
|
+
ref: S,
|
|
2445
|
+
children: jsxs("div", {
|
|
2446
|
+
className: a("flex items-center space-x-2 text-muted-foreground"),
|
|
2447
|
+
children: [jsx("div", { className: a("h-4 w-4 animate-spin rounded-full border-current border-b-2") }), jsx("span", {
|
|
2448
|
+
className: a("text-sm"),
|
|
2449
|
+
children: "Loading diagram..."
|
|
2450
|
+
})]
|
|
2451
|
+
})
|
|
2452
|
+
});
|
|
2453
|
+
if (o && !u && !f) return v ? jsx("div", {
|
|
2454
|
+
ref: S,
|
|
2455
|
+
children: jsx(v, {
|
|
2456
|
+
chart: e,
|
|
2457
|
+
error: o,
|
|
2458
|
+
retry: () => h((e) => e + 1)
|
|
2459
|
+
})
|
|
2460
|
+
}) : jsxs("div", {
|
|
2461
|
+
className: a("rounded-md bg-red-50 p-4", t),
|
|
2462
|
+
ref: S,
|
|
2463
|
+
children: [jsxs("p", {
|
|
2464
|
+
className: a("font-mono text-red-700 text-sm"),
|
|
2465
|
+
children: ["Mermaid Error: ", o]
|
|
2466
|
+
}), jsxs("details", {
|
|
2467
|
+
className: a("mt-2"),
|
|
2468
|
+
children: [jsx("summary", {
|
|
2469
|
+
className: a("cursor-pointer text-red-600 text-xs"),
|
|
2470
|
+
children: "Show Code"
|
|
2471
|
+
}), jsx("pre", {
|
|
2472
|
+
className: a("mt-2 overflow-x-auto rounded bg-red-100 p-2 text-red-800 text-xs"),
|
|
2473
|
+
children: e
|
|
2474
|
+
})]
|
|
2475
|
+
})]
|
|
2476
|
+
});
|
|
2477
|
+
let C = u || f;
|
|
2478
|
+
return jsx("div", {
|
|
2479
|
+
className: a("size-full", t),
|
|
2480
|
+
"data-streamdown": "mermaid",
|
|
2481
|
+
ref: S,
|
|
2482
|
+
children: jsx(Nn, {
|
|
2483
|
+
className: a(r ? "size-full overflow-hidden" : "overflow-hidden", t),
|
|
2484
|
+
fullscreen: r,
|
|
2485
|
+
maxZoom: 3,
|
|
2486
|
+
minZoom: .5,
|
|
2487
|
+
showControls: i,
|
|
2488
|
+
zoomStep: .1,
|
|
2489
|
+
children: jsx("div", {
|
|
2490
|
+
"aria-label": "Mermaid chart",
|
|
2491
|
+
className: a("flex justify-center", r ? "size-full items-center" : null),
|
|
2492
|
+
dangerouslySetInnerHTML: { __html: C },
|
|
2493
|
+
role: "img"
|
|
2494
|
+
})
|
|
2495
|
+
})
|
|
2496
|
+
});
|
|
2497
|
+
};
|
|
2498
|
+
export { $e$1 as $e, Ae, At, De, Js, Ks, Li, Oe, Pe, Qs, R, Te, Tn, be, dt, it, je, kt, ne, on, ot, po, re, rt, st, tt, ue, xt };
|