@simon_he/vue-tui 1.1.13 → 1.1.15

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/agent.cjs CHANGED
@@ -9826,7 +9826,7 @@ var EMPTY_LAYOUT = Object.freeze({
9826
9826
  regions: Object.freeze([]),
9827
9827
  fixedRows: !1,
9828
9828
  rowCount: 0
9829
- }), MAX_KEYED_ROW_LAYOUT_CACHE_ENTRIES = 2048;
9829
+ }), MAX_KEYED_ROW_LAYOUT_CACHE_ENTRIES = 2048, RETAINED_ROW_LAYOUT_MARGIN_ROWS = 512;
9830
9830
  function clamp9(n, min, max) {
9831
9831
  return Math.max(min, Math.min(max, n));
9832
9832
  }
@@ -9930,7 +9930,7 @@ var TTranscriptView = (0, import_vue23.defineComponent)({
9930
9930
  "hoverRegion"
9931
9931
  ],
9932
9932
  setup(props, { emit, expose }) {
9933
- let { defaultStyle, observability } = useTerminal(), instance = (0, import_vue23.getCurrentInstance)(), rowsRef = (0, import_vue23.ref)(null), innerScrollTop = (0, import_vue23.ref)(normalizeInt2(props.defaultScrollTop)), hoveredRegion = (0, import_vue23.ref)(null), focusedRegion = (0, import_vue23.ref)(null), rowLayoutCache = /* @__PURE__ */ new Map(), keyedRowLayoutCache = /* @__PURE__ */ new Map(), previousWrappedLayout = null, previousWrappedDeps = null, canUseWrappedChangedRangeRepaint = !1, warnedLargeFlattenedRows = !1;
9933
+ let { defaultStyle, observability } = useTerminal(), instance = (0, import_vue23.getCurrentInstance)(), rowsRef = (0, import_vue23.ref)(null), innerScrollTop = (0, import_vue23.ref)(normalizeInt2(props.defaultScrollTop)), hoveredRegion = (0, import_vue23.ref)(null), focusedRegion = (0, import_vue23.ref)(null), rowLayoutCache = /* @__PURE__ */ new Map(), keyedRowLayoutCache = /* @__PURE__ */ new Map(), retainedWindow = null, previousWrappedLayout = null, previousWrappedDeps = null, canUseWrappedChangedRangeRepaint = !1, warnedLargeFlattenedRows = !1;
9934
9934
  function isScrollControlled() {
9935
9935
  return Object.prototype.hasOwnProperty.call(instance?.vnode.props ?? {}, "scrollTop");
9936
9936
  }
@@ -9986,6 +9986,18 @@ var TTranscriptView = (0, import_vue23.defineComponent)({
9986
9986
  for (let rowIndex of rowLayoutCache.keys())
9987
9987
  rowIndex >= count && rowLayoutCache.delete(rowIndex);
9988
9988
  }
9989
+ function pruneRowLayoutCacheOutsideWindow(count, top, bottom) {
9990
+ let start = Math.max(0, top - RETAINED_ROW_LAYOUT_MARGIN_ROWS), end = Math.min(count, bottom + RETAINED_ROW_LAYOUT_MARGIN_ROWS);
9991
+ if (!(retainedWindow && retainedWindow.start === start && retainedWindow.end === end)) {
9992
+ retainedWindow = { start, end };
9993
+ for (let [rowIndex, entry] of rowLayoutCache) {
9994
+ if (rowIndex >= start && rowIndex < end)
9995
+ continue;
9996
+ let identity = rowLayoutIdentityKey(entry.rowKey, entry.rowVersion);
9997
+ keyedRowLayoutCache.get(identity) === entry && keyedRowLayoutCache.delete(identity), rowLayoutCache.delete(rowIndex);
9998
+ }
9999
+ }
10000
+ }
9989
10001
  function sameWrappedDeps(a, b) {
9990
10002
  return !!a && a.width === b.width && a.baseStyle === b.baseStyle && a.hoverStyle === b.hoverStyle && a.focusStyle === b.focusStyle && a.hoverRegionId === b.hoverRegionId && a.focusedRegionId === b.focusedRegionId;
9991
10003
  }
@@ -10042,7 +10054,7 @@ var TTranscriptView = (0, import_vue23.defineComponent)({
10042
10054
  props.version, canUseWrappedChangedRangeRepaint = !1;
10043
10055
  let perfEnabled = observability.framePerf.enabled.value, perfStartedAt = perfEnabled ? framePerfNow() : 0, width = Math.max(1, Math.floor(props.w)), count = Math.max(0, normalizeInt2(props.source.rowCount()));
10044
10056
  if (!count)
10045
- return rowLayoutCache.clear(), keyedRowLayoutCache.clear(), previousWrappedLayout = null, previousWrappedDeps = null, perfEnabled && observability.framePerf.recordComponent({
10057
+ return rowLayoutCache.clear(), keyedRowLayoutCache.clear(), retainedWindow = null, previousWrappedLayout = null, previousWrappedDeps = null, perfEnabled && observability.framePerf.recordComponent({
10046
10058
  name: "TTranscriptView",
10047
10059
  id: instance?.uid == null ? void 0 : String(instance.uid),
10048
10060
  phase: "layout",
@@ -10079,6 +10091,7 @@ var TTranscriptView = (0, import_vue23.defineComponent)({
10079
10091
  let row = result.rows[0];
10080
10092
  visualRows[rowIndex] = row, regions.push(...row.hitRegions);
10081
10093
  }
10094
+ pruneRowLayoutCacheOutsideWindow(count, top, bottom);
10082
10095
  } else {
10083
10096
  let incremental = tryUpdateWrappedLayoutFromChangedRange(
10084
10097
  count,
@@ -15170,7 +15183,7 @@ function loadBuiltinMathRasterizer() {
15170
15183
  })()), builtinRasterizerLoad;
15171
15184
  }
15172
15185
 
15173
- // node_modules/.pnpm/stream-markdown-parser@1.2.19/node_modules/stream-markdown-parser/dist/index.js
15186
+ // node_modules/.pnpm/stream-markdown-parser@1.2.20/node_modules/stream-markdown-parser/dist/index.js
15174
15187
  var __create2 = Object.create, __defProp$1 = Object.defineProperty, __getOwnPropDesc2 = Object.getOwnPropertyDescriptor, __getOwnPropNames2 = Object.getOwnPropertyNames, __getProtoOf2 = Object.getPrototypeOf, __hasOwnProp2 = Object.prototype.hasOwnProperty, __commonJS = (cb, mod) => function() {
15175
15188
  return mod || (0, cb[__getOwnPropNames2(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
15176
15189
  }, __export$1 = (all) => {
@@ -15553,7 +15566,756 @@ var require_markdown_it_task_checkbox = /* @__PURE__ */ __commonJS({ "../../node
15553
15566
  function startsWithTodoMarkdown(token) {
15554
15567
  return /^\[[xX \u00A0]\][ \u00A0]/.test(token.content);
15555
15568
  }
15556
- } }), decodeMap = /* @__PURE__ */ new Map([
15569
+ } }), import_markdown_it_task_checkbox = /* @__PURE__ */ __toESM2(require_markdown_it_task_checkbox(), 1), ambiguousMinimalCodePoint = 161, ambiguousMaximumCodePoint = 1114109, ambiguousRanges = [
15570
+ 161,
15571
+ 161,
15572
+ 164,
15573
+ 164,
15574
+ 167,
15575
+ 168,
15576
+ 170,
15577
+ 170,
15578
+ 173,
15579
+ 174,
15580
+ 176,
15581
+ 180,
15582
+ 182,
15583
+ 186,
15584
+ 188,
15585
+ 191,
15586
+ 198,
15587
+ 198,
15588
+ 208,
15589
+ 208,
15590
+ 215,
15591
+ 216,
15592
+ 222,
15593
+ 225,
15594
+ 230,
15595
+ 230,
15596
+ 232,
15597
+ 234,
15598
+ 236,
15599
+ 237,
15600
+ 240,
15601
+ 240,
15602
+ 242,
15603
+ 243,
15604
+ 247,
15605
+ 250,
15606
+ 252,
15607
+ 252,
15608
+ 254,
15609
+ 254,
15610
+ 257,
15611
+ 257,
15612
+ 273,
15613
+ 273,
15614
+ 275,
15615
+ 275,
15616
+ 283,
15617
+ 283,
15618
+ 294,
15619
+ 295,
15620
+ 299,
15621
+ 299,
15622
+ 305,
15623
+ 307,
15624
+ 312,
15625
+ 312,
15626
+ 319,
15627
+ 322,
15628
+ 324,
15629
+ 324,
15630
+ 328,
15631
+ 331,
15632
+ 333,
15633
+ 333,
15634
+ 338,
15635
+ 339,
15636
+ 358,
15637
+ 359,
15638
+ 363,
15639
+ 363,
15640
+ 462,
15641
+ 462,
15642
+ 464,
15643
+ 464,
15644
+ 466,
15645
+ 466,
15646
+ 468,
15647
+ 468,
15648
+ 470,
15649
+ 470,
15650
+ 472,
15651
+ 472,
15652
+ 474,
15653
+ 474,
15654
+ 476,
15655
+ 476,
15656
+ 593,
15657
+ 593,
15658
+ 609,
15659
+ 609,
15660
+ 708,
15661
+ 708,
15662
+ 711,
15663
+ 711,
15664
+ 713,
15665
+ 715,
15666
+ 717,
15667
+ 717,
15668
+ 720,
15669
+ 720,
15670
+ 728,
15671
+ 731,
15672
+ 733,
15673
+ 733,
15674
+ 735,
15675
+ 735,
15676
+ 768,
15677
+ 879,
15678
+ 913,
15679
+ 929,
15680
+ 931,
15681
+ 937,
15682
+ 945,
15683
+ 961,
15684
+ 963,
15685
+ 969,
15686
+ 1025,
15687
+ 1025,
15688
+ 1040,
15689
+ 1103,
15690
+ 1105,
15691
+ 1105,
15692
+ 8208,
15693
+ 8208,
15694
+ 8211,
15695
+ 8214,
15696
+ 8216,
15697
+ 8217,
15698
+ 8220,
15699
+ 8221,
15700
+ 8224,
15701
+ 8226,
15702
+ 8228,
15703
+ 8231,
15704
+ 8240,
15705
+ 8240,
15706
+ 8242,
15707
+ 8243,
15708
+ 8245,
15709
+ 8245,
15710
+ 8251,
15711
+ 8251,
15712
+ 8254,
15713
+ 8254,
15714
+ 8308,
15715
+ 8308,
15716
+ 8319,
15717
+ 8319,
15718
+ 8321,
15719
+ 8324,
15720
+ 8364,
15721
+ 8364,
15722
+ 8451,
15723
+ 8451,
15724
+ 8453,
15725
+ 8453,
15726
+ 8457,
15727
+ 8457,
15728
+ 8467,
15729
+ 8467,
15730
+ 8470,
15731
+ 8470,
15732
+ 8481,
15733
+ 8482,
15734
+ 8486,
15735
+ 8486,
15736
+ 8491,
15737
+ 8491,
15738
+ 8531,
15739
+ 8532,
15740
+ 8539,
15741
+ 8542,
15742
+ 8544,
15743
+ 8555,
15744
+ 8560,
15745
+ 8569,
15746
+ 8585,
15747
+ 8585,
15748
+ 8592,
15749
+ 8601,
15750
+ 8632,
15751
+ 8633,
15752
+ 8658,
15753
+ 8658,
15754
+ 8660,
15755
+ 8660,
15756
+ 8679,
15757
+ 8679,
15758
+ 8704,
15759
+ 8704,
15760
+ 8706,
15761
+ 8707,
15762
+ 8711,
15763
+ 8712,
15764
+ 8715,
15765
+ 8715,
15766
+ 8719,
15767
+ 8719,
15768
+ 8721,
15769
+ 8721,
15770
+ 8725,
15771
+ 8725,
15772
+ 8730,
15773
+ 8730,
15774
+ 8733,
15775
+ 8736,
15776
+ 8739,
15777
+ 8739,
15778
+ 8741,
15779
+ 8741,
15780
+ 8743,
15781
+ 8748,
15782
+ 8750,
15783
+ 8750,
15784
+ 8756,
15785
+ 8759,
15786
+ 8764,
15787
+ 8765,
15788
+ 8776,
15789
+ 8776,
15790
+ 8780,
15791
+ 8780,
15792
+ 8786,
15793
+ 8786,
15794
+ 8800,
15795
+ 8801,
15796
+ 8804,
15797
+ 8807,
15798
+ 8810,
15799
+ 8811,
15800
+ 8814,
15801
+ 8815,
15802
+ 8834,
15803
+ 8835,
15804
+ 8838,
15805
+ 8839,
15806
+ 8853,
15807
+ 8853,
15808
+ 8857,
15809
+ 8857,
15810
+ 8869,
15811
+ 8869,
15812
+ 8895,
15813
+ 8895,
15814
+ 8978,
15815
+ 8978,
15816
+ 9312,
15817
+ 9449,
15818
+ 9451,
15819
+ 9547,
15820
+ 9552,
15821
+ 9587,
15822
+ 9600,
15823
+ 9615,
15824
+ 9618,
15825
+ 9621,
15826
+ 9632,
15827
+ 9633,
15828
+ 9635,
15829
+ 9641,
15830
+ 9650,
15831
+ 9651,
15832
+ 9654,
15833
+ 9655,
15834
+ 9660,
15835
+ 9661,
15836
+ 9664,
15837
+ 9665,
15838
+ 9670,
15839
+ 9672,
15840
+ 9675,
15841
+ 9675,
15842
+ 9678,
15843
+ 9681,
15844
+ 9698,
15845
+ 9701,
15846
+ 9711,
15847
+ 9711,
15848
+ 9733,
15849
+ 9734,
15850
+ 9737,
15851
+ 9737,
15852
+ 9742,
15853
+ 9743,
15854
+ 9756,
15855
+ 9756,
15856
+ 9758,
15857
+ 9758,
15858
+ 9792,
15859
+ 9792,
15860
+ 9794,
15861
+ 9794,
15862
+ 9824,
15863
+ 9825,
15864
+ 9827,
15865
+ 9829,
15866
+ 9831,
15867
+ 9834,
15868
+ 9836,
15869
+ 9837,
15870
+ 9839,
15871
+ 9839,
15872
+ 9886,
15873
+ 9887,
15874
+ 9919,
15875
+ 9919,
15876
+ 9926,
15877
+ 9933,
15878
+ 9935,
15879
+ 9939,
15880
+ 9941,
15881
+ 9953,
15882
+ 9955,
15883
+ 9955,
15884
+ 9960,
15885
+ 9961,
15886
+ 9963,
15887
+ 9969,
15888
+ 9972,
15889
+ 9972,
15890
+ 9974,
15891
+ 9977,
15892
+ 9979,
15893
+ 9980,
15894
+ 9982,
15895
+ 9983,
15896
+ 10045,
15897
+ 10045,
15898
+ 10102,
15899
+ 10111,
15900
+ 11094,
15901
+ 11097,
15902
+ 12872,
15903
+ 12879,
15904
+ 57344,
15905
+ 63743,
15906
+ 65024,
15907
+ 65039,
15908
+ 65533,
15909
+ 65533,
15910
+ 127232,
15911
+ 127242,
15912
+ 127248,
15913
+ 127277,
15914
+ 127280,
15915
+ 127337,
15916
+ 127344,
15917
+ 127373,
15918
+ 127375,
15919
+ 127376,
15920
+ 127387,
15921
+ 127404,
15922
+ 917760,
15923
+ 917999,
15924
+ 983040,
15925
+ 1048573,
15926
+ 1048576,
15927
+ 1114109
15928
+ ], fullwidthMinimalCodePoint = 12288, fullwidthMaximumCodePoint = 65510, fullwidthRanges = [
15929
+ 12288,
15930
+ 12288,
15931
+ 65281,
15932
+ 65376,
15933
+ 65504,
15934
+ 65510
15935
+ ], halfwidthMinimalCodePoint = 8361, halfwidthMaximumCodePoint = 65518, halfwidthRanges = [
15936
+ 8361,
15937
+ 8361,
15938
+ 65377,
15939
+ 65470,
15940
+ 65474,
15941
+ 65479,
15942
+ 65482,
15943
+ 65487,
15944
+ 65490,
15945
+ 65495,
15946
+ 65498,
15947
+ 65500,
15948
+ 65512,
15949
+ 65518
15950
+ ], narrowMinimalCodePoint = 32, narrowMaximumCodePoint = 10630, narrowRanges = [
15951
+ 32,
15952
+ 126,
15953
+ 162,
15954
+ 163,
15955
+ 165,
15956
+ 166,
15957
+ 172,
15958
+ 172,
15959
+ 175,
15960
+ 175,
15961
+ 10214,
15962
+ 10221,
15963
+ 10629,
15964
+ 10630
15965
+ ], wideMinimalCodePoint = 4352, wideMaximumCodePoint = 262141, wideRanges = [
15966
+ 4352,
15967
+ 4447,
15968
+ 8986,
15969
+ 8987,
15970
+ 9001,
15971
+ 9002,
15972
+ 9193,
15973
+ 9196,
15974
+ 9200,
15975
+ 9200,
15976
+ 9203,
15977
+ 9203,
15978
+ 9725,
15979
+ 9726,
15980
+ 9748,
15981
+ 9749,
15982
+ 9776,
15983
+ 9783,
15984
+ 9800,
15985
+ 9811,
15986
+ 9855,
15987
+ 9855,
15988
+ 9866,
15989
+ 9871,
15990
+ 9875,
15991
+ 9875,
15992
+ 9889,
15993
+ 9889,
15994
+ 9898,
15995
+ 9899,
15996
+ 9917,
15997
+ 9918,
15998
+ 9924,
15999
+ 9925,
16000
+ 9934,
16001
+ 9934,
16002
+ 9940,
16003
+ 9940,
16004
+ 9962,
16005
+ 9962,
16006
+ 9970,
16007
+ 9971,
16008
+ 9973,
16009
+ 9973,
16010
+ 9978,
16011
+ 9978,
16012
+ 9981,
16013
+ 9981,
16014
+ 9989,
16015
+ 9989,
16016
+ 9994,
16017
+ 9995,
16018
+ 10024,
16019
+ 10024,
16020
+ 10060,
16021
+ 10060,
16022
+ 10062,
16023
+ 10062,
16024
+ 10067,
16025
+ 10069,
16026
+ 10071,
16027
+ 10071,
16028
+ 10133,
16029
+ 10135,
16030
+ 10160,
16031
+ 10160,
16032
+ 10175,
16033
+ 10175,
16034
+ 11035,
16035
+ 11036,
16036
+ 11088,
16037
+ 11088,
16038
+ 11093,
16039
+ 11093,
16040
+ 11904,
16041
+ 11929,
16042
+ 11931,
16043
+ 12019,
16044
+ 12032,
16045
+ 12245,
16046
+ 12272,
16047
+ 12287,
16048
+ 12289,
16049
+ 12350,
16050
+ 12353,
16051
+ 12438,
16052
+ 12441,
16053
+ 12543,
16054
+ 12549,
16055
+ 12591,
16056
+ 12593,
16057
+ 12686,
16058
+ 12688,
16059
+ 12773,
16060
+ 12783,
16061
+ 12830,
16062
+ 12832,
16063
+ 12871,
16064
+ 12880,
16065
+ 42124,
16066
+ 42128,
16067
+ 42182,
16068
+ 43360,
16069
+ 43388,
16070
+ 44032,
16071
+ 55203,
16072
+ 63744,
16073
+ 64255,
16074
+ 65040,
16075
+ 65049,
16076
+ 65072,
16077
+ 65106,
16078
+ 65108,
16079
+ 65126,
16080
+ 65128,
16081
+ 65131,
16082
+ 94176,
16083
+ 94180,
16084
+ 94192,
16085
+ 94198,
16086
+ 94208,
16087
+ 101589,
16088
+ 101631,
16089
+ 101662,
16090
+ 101760,
16091
+ 101874,
16092
+ 110576,
16093
+ 110579,
16094
+ 110581,
16095
+ 110587,
16096
+ 110589,
16097
+ 110590,
16098
+ 110592,
16099
+ 110882,
16100
+ 110898,
16101
+ 110898,
16102
+ 110928,
16103
+ 110930,
16104
+ 110933,
16105
+ 110933,
16106
+ 110948,
16107
+ 110951,
16108
+ 110960,
16109
+ 111355,
16110
+ 119552,
16111
+ 119638,
16112
+ 119648,
16113
+ 119670,
16114
+ 126980,
16115
+ 126980,
16116
+ 127183,
16117
+ 127183,
16118
+ 127374,
16119
+ 127374,
16120
+ 127377,
16121
+ 127386,
16122
+ 127488,
16123
+ 127490,
16124
+ 127504,
16125
+ 127547,
16126
+ 127552,
16127
+ 127560,
16128
+ 127568,
16129
+ 127569,
16130
+ 127584,
16131
+ 127589,
16132
+ 127744,
16133
+ 127776,
16134
+ 127789,
16135
+ 127797,
16136
+ 127799,
16137
+ 127868,
16138
+ 127870,
16139
+ 127891,
16140
+ 127904,
16141
+ 127946,
16142
+ 127951,
16143
+ 127955,
16144
+ 127968,
16145
+ 127984,
16146
+ 127988,
16147
+ 127988,
16148
+ 127992,
16149
+ 128062,
16150
+ 128064,
16151
+ 128064,
16152
+ 128066,
16153
+ 128252,
16154
+ 128255,
16155
+ 128317,
16156
+ 128331,
16157
+ 128334,
16158
+ 128336,
16159
+ 128359,
16160
+ 128378,
16161
+ 128378,
16162
+ 128405,
16163
+ 128406,
16164
+ 128420,
16165
+ 128420,
16166
+ 128507,
16167
+ 128591,
16168
+ 128640,
16169
+ 128709,
16170
+ 128716,
16171
+ 128716,
16172
+ 128720,
16173
+ 128722,
16174
+ 128725,
16175
+ 128728,
16176
+ 128732,
16177
+ 128735,
16178
+ 128747,
16179
+ 128748,
16180
+ 128756,
16181
+ 128764,
16182
+ 128992,
16183
+ 129003,
16184
+ 129008,
16185
+ 129008,
16186
+ 129292,
16187
+ 129338,
16188
+ 129340,
16189
+ 129349,
16190
+ 129351,
16191
+ 129535,
16192
+ 129648,
16193
+ 129660,
16194
+ 129664,
16195
+ 129674,
16196
+ 129678,
16197
+ 129734,
16198
+ 129736,
16199
+ 129736,
16200
+ 129741,
16201
+ 129756,
16202
+ 129759,
16203
+ 129770,
16204
+ 129775,
16205
+ 129784,
16206
+ 131072,
16207
+ 196605,
16208
+ 196608,
16209
+ 262141
16210
+ ], isInRange = (ranges, codePoint) => {
16211
+ let low = 0, high = Math.floor(ranges.length / 2) - 1;
16212
+ for (; low <= high; ) {
16213
+ let mid = Math.floor((low + high) / 2), i = mid * 2;
16214
+ if (codePoint < ranges[i])
16215
+ high = mid - 1;
16216
+ else if (codePoint > ranges[i + 1])
16217
+ low = mid + 1;
16218
+ else
16219
+ return !0;
16220
+ }
16221
+ return !1;
16222
+ }, commonCjkCodePoint = 19968, [wideFastPathStart, wideFastPathEnd] = /* @__PURE__ */ findWideFastPathRange(wideRanges);
16223
+ function findWideFastPathRange(ranges) {
16224
+ let fastPathStart = ranges[0], fastPathEnd = ranges[1];
16225
+ for (let index = 0; index < ranges.length; index += 2) {
16226
+ let start = ranges[index], end = ranges[index + 1];
16227
+ if (commonCjkCodePoint >= start && commonCjkCodePoint <= end)
16228
+ return [start, end];
16229
+ end - start > fastPathEnd - fastPathStart && (fastPathStart = start, fastPathEnd = end);
16230
+ }
16231
+ return [fastPathStart, fastPathEnd];
16232
+ }
16233
+ var isAmbiguous = (codePoint) => codePoint < ambiguousMinimalCodePoint || codePoint > ambiguousMaximumCodePoint ? !1 : isInRange(ambiguousRanges, codePoint), isFullWidth = (codePoint) => codePoint < fullwidthMinimalCodePoint || codePoint > fullwidthMaximumCodePoint ? !1 : isInRange(fullwidthRanges, codePoint), isHalfWidth = (codePoint) => codePoint < halfwidthMinimalCodePoint || codePoint > halfwidthMaximumCodePoint ? !1 : isInRange(halfwidthRanges, codePoint), isNarrow = (codePoint) => codePoint < narrowMinimalCodePoint || codePoint > narrowMaximumCodePoint ? !1 : isInRange(narrowRanges, codePoint), isWide = (codePoint) => codePoint >= wideFastPathStart && codePoint <= wideFastPathEnd ? !0 : codePoint < wideMinimalCodePoint || codePoint > wideMaximumCodePoint ? !1 : isInRange(wideRanges, codePoint);
16234
+ function getCategory(codePoint) {
16235
+ return isAmbiguous(codePoint) ? "ambiguous" : isFullWidth(codePoint) ? "fullwidth" : isHalfWidth(codePoint) ? "halfwidth" : isNarrow(codePoint) ? "narrow" : isWide(codePoint) ? "wide" : "neutral";
16236
+ }
16237
+ function validate(codePoint) {
16238
+ if (!Number.isSafeInteger(codePoint))
16239
+ throw new TypeError(`Expected a code point, got \`${typeof codePoint}\`.`);
16240
+ }
16241
+ function eastAsianWidthType(codePoint) {
16242
+ return validate(codePoint), getCategory(codePoint);
16243
+ }
16244
+ function isEmoji(uc) {
16245
+ return /^\p{Emoji_Presentation}/u.test(String.fromCodePoint(uc));
16246
+ }
16247
+ function isCjkBase(uc) {
16248
+ if (uc < 4352)
16249
+ return !1;
16250
+ switch (eastAsianWidthType(uc)) {
16251
+ case "fullwidth":
16252
+ case "halfwidth":
16253
+ return !0;
16254
+ case "wide":
16255
+ return !isEmoji(uc);
16256
+ case "narrow":
16257
+ return !1;
16258
+ case "ambiguous":
16259
+ return null;
16260
+ case "neutral":
16261
+ return /^\p{sc=Hangul}/u.test(String.fromCodePoint(uc));
16262
+ }
16263
+ }
16264
+ function is2PreviousCjk(uc, prev) {
16265
+ return isCjkBase(uc) ?? (prev === 65025 && isQuotationMark(uc));
16266
+ function isQuotationMark(uc$1) {
16267
+ return uc$1 === 8216 || uc$1 === 8217 || uc$1 === 8220 || uc$1 === 8221;
16268
+ }
16269
+ }
16270
+ function isPreviousCjk(uc) {
16271
+ return isCjkBase(uc) ?? (917760 <= uc && uc <= 917999);
16272
+ }
16273
+ function isNextCjk(uc) {
16274
+ return isCjkBase(uc) ?? !1;
16275
+ }
16276
+ function nonEmojiGeneralUseVS(uc) {
16277
+ return uc >= 65024 && uc <= 65038;
16278
+ }
16279
+ function markdownItCjkFriendlyPlugin(md) {
16280
+ let PreviousState = md.inline.State;
16281
+ class CjkFriendlyState extends PreviousState {
16282
+ scanDelims(start, canSplitWord) {
16283
+ let max = this.posMax, marker = this.src.charCodeAt(start), [lastChar2, lastCharPos] = getLastCharCode(this.src, start), lastMainChar = lastChar2, twoPrevChar = null;
16284
+ nonEmojiGeneralUseVS(lastChar2) && (twoPrevChar = getLastCharCode(this.src, lastCharPos)[0], /^\p{Zs}/u.test(String.fromCodePoint(twoPrevChar)) || (lastMainChar = twoPrevChar));
16285
+ let pos = start;
16286
+ for (; pos < max && this.src.charCodeAt(pos) === marker; )
16287
+ pos++;
16288
+ let count = pos - start, nextChar = pos < max ? this.src.codePointAt(pos) : 32, isLastWhiteSpace = md.utils.isWhiteSpace(lastMainChar), isNextWhiteSpace = md.utils.isWhiteSpace(nextChar);
16289
+ if (isLastWhiteSpace || isNextWhiteSpace)
16290
+ return {
16291
+ can_open: !isNextWhiteSpace,
16292
+ can_close: !isLastWhiteSpace,
16293
+ length: count
16294
+ };
16295
+ let isLastPunctChar = md.utils.isMdAsciiPunct(lastMainChar) || md.utils.isPunctChar(String.fromCodePoint(lastMainChar)), isNextPunctChar = md.utils.isMdAsciiPunct(nextChar) || md.utils.isPunctChar(String.fromCodePoint(nextChar)), left_flanking = isLastPunctChar, right_flanking = isNextPunctChar;
16296
+ if (canSplitWord) {
16297
+ let isEitherCJKChar = isNextCjk(nextChar) || (twoPrevChar !== null ? is2PreviousCjk(twoPrevChar, lastChar2) : isPreviousCjk(lastChar2));
16298
+ left_flanking || (left_flanking = isEitherCJKChar || !isNextPunctChar), right_flanking || (right_flanking = isEitherCJKChar || !isLastPunctChar);
16299
+ }
16300
+ return {
16301
+ can_open: left_flanking,
16302
+ can_close: right_flanking,
16303
+ length: count
16304
+ };
16305
+ function getLastCharCode(str, pos$1) {
16306
+ if (pos$1 <= 0)
16307
+ return [32, -1];
16308
+ let charCode = str.charCodeAt(pos$1 - 1);
16309
+ if ((charCode & 64512) !== 56320)
16310
+ return [charCode, pos$1 - 1];
16311
+ let codePoint = str.codePointAt(pos$1 - 2);
16312
+ return codePoint > 65535 ? [codePoint, pos$1 - 2] : [charCode, pos$1 - 1];
16313
+ }
16314
+ }
16315
+ }
16316
+ md.inline.State = CjkFriendlyState;
16317
+ }
16318
+ var decodeMap = /* @__PURE__ */ new Map([
15557
16319
  [0, 65533],
15558
16320
  [128, 8364],
15559
16321
  [130, 8218],
@@ -15875,7 +16637,7 @@ var htmlDecoder = /* @__PURE__ */ getDecoder(htmlDecodeTree);
15875
16637
  function decodeHTML(htmlString, mode = DecodingMode.Legacy) {
15876
16638
  return htmlDecoder(htmlString, mode);
15877
16639
  }
15878
- var import_markdown_it_task_checkbox = /* @__PURE__ */ __toESM2(require_markdown_it_task_checkbox(), 1), decodeCache = {};
16640
+ var decodeCache = {};
15879
16641
  function getDecodeCache(exclude) {
15880
16642
  let cache = decodeCache[exclude];
15881
16643
  if (cache)
@@ -18344,6 +19106,13 @@ var ParserInline = class {
18344
19106
  constructor() {
18345
19107
  __publicField(this, "ruler");
18346
19108
  __publicField(this, "ruler2");
19109
+ /**
19110
+ * State class used for inline parsing, mirroring `ParserInline.prototype.State` in
19111
+ * markdown-it. Plugins subclass it (`scanDelims`, `push`, `pushPending`, ...) and assign
19112
+ * the subclass back to `md.inline.State`; the parser then constructs it with
19113
+ * `new this.State(...)`.
19114
+ */
19115
+ __publicField(this, "State", StateInline);
18347
19116
  __publicField(this, "cachedRulesVersion", -1);
18348
19117
  __publicField(this, "cachedRules", []);
18349
19118
  __publicField(this, "cachedRules2Version", -1);
@@ -18450,13 +19219,20 @@ var ParserInline = class {
18450
19219
  isDefaultRuleset() {
18451
19220
  return this.ruler.version === this.defaultRulerVersion && this.ruler2.version === this.defaultRuler2Version;
18452
19221
  }
19222
+ /**
19223
+ * Whether inline parsing still uses the stock `StateInline`. The plain-text fast paths
19224
+ * construct no state at all, so they must stand down once a plugin replaces `State`.
19225
+ */
19226
+ usesDefaultState() {
19227
+ return this.State === StateInline;
19228
+ }
18453
19229
  parseSource(src, md, env, outTokens) {
18454
- if (typeof src == "string" && src.length > 0 && this.isDefaultRuleset() && isPlainInlineText$1(src)) {
19230
+ if (typeof src == "string" && src.length > 0 && this.isDefaultRuleset() && this.usesDefaultState() && isPlainInlineText$1(src)) {
18455
19231
  let token = new Token("text", "", 0);
18456
19232
  token.content = src, outTokens.push(token);
18457
19233
  return;
18458
19234
  }
18459
- let state = new StateInline(src, md, env, outTokens);
19235
+ let state = new this.State(src, md, env, outTokens);
18460
19236
  this.tokenize(state);
18461
19237
  let rules2 = this.getRules2(), len = rules2.length;
18462
19238
  if (!(state.env && (Object.prototype.hasOwnProperty.call(state.env, "__mdtsRuleProfile") || Object.prototype.hasOwnProperty.call(state.env, "__mdtsProfileRules")))) {
@@ -18483,7 +19259,7 @@ var ParserInline = class {
18483
19259
  }
18484
19260
  };
18485
19261
  function inline(state) {
18486
- let tokens = state.tokens, canUsePlainTextFastPath = !!state.md?.inline?.isDefaultRuleset?.();
19262
+ let tokens = state.tokens, inlineParser = state.md?.inline, canUsePlainTextFastPath = !!inlineParser?.isDefaultRuleset?.() && inlineParser?.usesDefaultState?.() !== !1;
18487
19263
  for (let i = 0, l = tokens.length; i < l; i++) {
18488
19264
  let tok = tokens[i];
18489
19265
  if (tok.type === "inline" && state.md) {
@@ -23419,11 +24195,12 @@ function getParserRuleVersions(md) {
23419
24195
  core: md.core.ruler.version,
23420
24196
  block: md.block.ruler.version,
23421
24197
  inline: md.inline.ruler.version,
23422
- inline2: md.inline.ruler2.version
24198
+ inline2: md.inline.ruler2.version,
24199
+ inlineState: md.inline.State
23423
24200
  };
23424
24201
  }
23425
24202
  function hasParserRuleChanges(md, initial) {
23426
- return md.core.ruler.version !== initial.core || md.block.ruler.version !== initial.block || md.inline.ruler.version !== initial.inline || md.inline.ruler2.version !== initial.inline2;
24203
+ return md.core.ruler.version !== initial.core || md.block.ruler.version !== initial.block || md.inline.ruler.version !== initial.inline || md.inline.ruler2.version !== initial.inline2 || md.inline.State !== initial.inlineState;
23427
24204
  }
23428
24205
  function applyExperimentalOptions(options) {
23429
24206
  return options.experimental ? {
@@ -24112,7 +24889,7 @@ function container_plugin(md, name, options) {
24112
24889
  return tokens[idx].nesting === 1 && tokens[idx].attrJoin("class", name), slf.renderToken(tokens, idx, _options, env, slf);
24113
24890
  }
24114
24891
  options = options || {};
24115
- let min_markers = 3, marker_str = options.marker || ":", marker_char = marker_str.charCodeAt(0), marker_len = marker_str.length, validate = options.validate || validateDefault, render = options.render || renderDefault;
24892
+ let min_markers = 3, marker_str = options.marker || ":", marker_char = marker_str.charCodeAt(0), marker_len = marker_str.length, validate$1 = options.validate || validateDefault, render = options.render || renderDefault;
24116
24893
  function container(state, startLine, endLine, silent) {
24117
24894
  let pos, auto_closed = !1, start = state.bMarks[startLine] + state.tShift[startLine], max = state.eMarks[startLine];
24118
24895
  if (marker_char !== state.src.charCodeAt(start))
@@ -24124,7 +24901,7 @@ function container_plugin(md, name, options) {
24124
24901
  return !1;
24125
24902
  pos -= (pos - start) % marker_len;
24126
24903
  let markup = state.src.slice(start, pos), params = state.src.slice(pos, max);
24127
- if (!validate(params, markup))
24904
+ if (!validate$1(params, markup))
24128
24905
  return !1;
24129
24906
  if (silent)
24130
24907
  return !0;
@@ -25489,6 +26266,21 @@ function setSyntheticLinkOrigin(token, origin) {
25489
26266
  function readSyntheticLinkOrigin(token) {
25490
26267
  return syntheticLinkOrigins.get(token);
25491
26268
  }
26269
+ function resolveLinkMarkup(token) {
26270
+ if (!token)
26271
+ return "";
26272
+ let origin = readSyntheticLinkOrigin(token);
26273
+ if (origin === "linkify" || origin === "autolink")
26274
+ return origin;
26275
+ let markup = typeof token.markup == "string" ? token.markup : "";
26276
+ return markup === "linkify" || markup === "autolink" ? markup : "";
26277
+ }
26278
+ function copySyntheticLinkOrigin(from, to) {
26279
+ if (!from || !to)
26280
+ return;
26281
+ let origin = readSyntheticLinkOrigin(from);
26282
+ origin && syntheticLinkOrigins.set(to, origin);
26283
+ }
25492
26284
  function registerCacheStableLinkValidator(validateLink$1) {
25493
26285
  cacheStableLinkValidators.add(validateLink$1);
25494
26286
  }
@@ -25726,7 +26518,7 @@ function fixLinkToken(tokens, raw) {
25726
26518
  } else if (curToken?.type === "text" && curToken.content?.endsWith("(") && tokens[i + 1]?.type === "link_open") {
25727
26519
  let match = curToken.content.match(/\[([^\]]+)\]/);
25728
26520
  if (match) {
25729
- let beforeText = curToken.content.slice(0, match.index), emphasisMatch = beforeText.match(/(\*+)$/), origin = getSyntheticLinkOrigin(tokens[i + 1]?.markup), replacerTokens = [];
26521
+ let beforeText = curToken.content.slice(0, match.index), emphasisMatch = beforeText.match(/(\*+)$/), linkOpenMarkup = tokens[i + 1]?.markup, origin = (linkOpenMarkup === "linkify" || linkOpenMarkup === "autolink") && (match.index ?? 0) + match[0].length === curToken.content.length - 1 ? "explicit" : getSyntheticLinkOrigin(linkOpenMarkup), replacerTokens = [];
25730
26522
  if (emphasisMatch) {
25731
26523
  beforeText = beforeText.slice(0, emphasisMatch.index), beforeText && replacerTokens.push(textToken(beforeText));
25732
26524
  let text$1 = match[1], type = emphasisMatch[1].length;
@@ -27440,7 +28232,7 @@ function factory(opts = {}) {
27440
28232
  });
27441
28233
  registerCacheStableLinkValidator(validateLink$1), md.set({ validateLink: validateLink$1 });
27442
28234
  }
27443
- return applyInlineUrlValidation(md), applyLinkifyCandidateFilter(md), (opts.enableMath ?? !0) && applyMath(md, {
28235
+ return applyInlineUrlValidation(md), applyLinkifyCandidateFilter(md), (opts.cjkFriendly ?? !0) && md.use(markdownItCjkFriendlyPlugin), (opts.enableMath ?? !0) && applyMath(md, {
27444
28236
  ...getDefaultMathOptions() ?? {},
27445
28237
  ...opts.mathOptions ?? {}
27446
28238
  }), (opts.enableContainers ?? !0) && applyContainers(md), opts.enableFixIndentedCodeBlock !== !1 && applyFixIndentedCodeBlock(md), applyFixLinkTokens(md), applyFixStrongTokens(md), applyFixListItem(md), applyFixTableTokens(md), applyRenderRules(md), applyFixHtmlInlineTokens(md, { customHtmlTags: opts.customHtmlTags }), md;
@@ -27801,7 +28593,7 @@ function applyNodeSourceMapRange(node, token, endLine, options) {
27801
28593
  }
27802
28594
  function cloneTokenWithMutableChildren(token) {
27803
28595
  let copy = Object.assign(Object.create(Object.getPrototypeOf(token)), token);
27804
- return Array.isArray(token.attrs) && (copy.attrs = token.attrs.map((attr) => [...attr])), Array.isArray(token.map) && (copy.map = [...token.map]), Array.isArray(token.children) && (copy.children = token.children.map((child) => cloneTokenWithMutableChildren(child))), copy;
28596
+ return Array.isArray(token.attrs) && (copy.attrs = token.attrs.map((attr) => [...attr])), Array.isArray(token.map) && (copy.map = [...token.map]), Array.isArray(token.children) && (copy.children = token.children.map((child) => cloneTokenWithMutableChildren(child))), copySyntheticLinkOrigin(token, copy), copy;
27805
28597
  }
27806
28598
  function isPlainObject(value) {
27807
28599
  if (!value || typeof value != "object")
@@ -27892,6 +28684,10 @@ function canCloneMarkdownTokenFast(token, enumerableKeys) {
27892
28684
  return !0;
27893
28685
  }
27894
28686
  function cloneMarkdownToken(token, cloneObjectFields = !0) {
28687
+ let cloned = cloneMarkdownTokenValue(token, cloneObjectFields);
28688
+ return copySyntheticLinkOrigin(token, cloned), cloned;
28689
+ }
28690
+ function cloneMarkdownTokenValue(token, cloneObjectFields = !0) {
27895
28691
  if (!cloneObjectFields)
27896
28692
  return cloneTokenWithMutableChildren(token);
27897
28693
  let allKeys = Reflect.ownKeys(token), enumerableKeys = Object.keys(token);
@@ -29369,7 +30165,8 @@ function parseHtmlInlineCodeToken(token, tokens, i, parseInlineTokens$1, raw, pP
29369
30165
  attrs: normalizedAttrs,
29370
30166
  children: normalizedChildren$1,
29371
30167
  loading: !fragment$1.closed,
29372
- raw: fragment$1.html || code$1
30168
+ raw: fragment$1.html || code$1,
30169
+ markup: "html"
29373
30170
  }, fragment$1.nextIndex];
29374
30171
  }
29375
30172
  if (selfClosing)
@@ -29520,7 +30317,8 @@ function parseLinkToken(tokens, startIndex, parseInlineTokens$1, options) {
29520
30317
  children,
29521
30318
  raw: `[${linkText}](${href}${title ? ` "${title}"` : ""})`,
29522
30319
  loading,
29523
- attrs: normalizedAttrs
30320
+ attrs: normalizedAttrs,
30321
+ markup: resolveLinkMarkup(openToken)
29524
30322
  },
29525
30323
  nextIndex: i < tokens.length ? i + 1 : tokens.length
29526
30324
  };
@@ -29750,7 +30548,8 @@ function recoverMarkdownLinkFromTrailingText(state, token) {
29750
30548
  content: label,
29751
30549
  raw: label
29752
30550
  }],
29753
- raw: `[${label}](${href}${linkToken.title ? ` "${linkToken.title}"` : ""})`
30551
+ raw: `[${label}](${href}${linkToken.title ? ` "${linkToken.title}"` : ""})`,
30552
+ markup: resolveLinkMarkup(token)
29754
30553
  }), !0;
29755
30554
  }
29756
30555
  function recoverMarkdownImageFromLoadingImageTail(state, token) {
@@ -29813,7 +30612,8 @@ function buildLoadingOuterImageLinkNode(imageNode, href = "", title = null) {
29813
30612
  text: text$1,
29814
30613
  children: [imageNode],
29815
30614
  raw: `[${text$1}](${href}${title ? ` "${title}"` : ""})`,
29816
- loading: !0
30615
+ loading: !0,
30616
+ markup: ""
29817
30617
  };
29818
30618
  }
29819
30619
  function buildLoadingImageNodeFromRaw(raw) {
@@ -29937,7 +30737,8 @@ function handleInlineLinkContent(state, content, _token) {
29937
30737
  content: text$1,
29938
30738
  raw: text$1
29939
30739
  }],
29940
- loading: loading$1
30740
+ loading: loading$1,
30741
+ markup: ""
29941
30742
  }), state.index += index, !0;
29942
30743
  }
29943
30744
  let linkContentEnd = content.indexOf(")", linkEnd), href = linkContentEnd !== -1 ? content.slice(linkEnd + 2, linkContentEnd) : "", loading = linkContentEnd === -1, emphasisMatch = textNodeContent.match(/\*+$/);
@@ -29971,7 +30772,8 @@ function handleInlineLinkContent(state, content, _token) {
29971
30772
  content: text$1,
29972
30773
  raw: text$1
29973
30774
  }],
29974
- loading
30775
+ loading,
30776
+ markup: ""
29975
30777
  }), type === 1) {
29976
30778
  newTokens.push({
29977
30779
  type: "em_close",
@@ -30015,7 +30817,8 @@ function handleInlineLinkContent(state, content, _token) {
30015
30817
  content: text$1,
30016
30818
  raw: text$1
30017
30819
  }],
30018
- loading
30820
+ loading,
30821
+ markup: ""
30019
30822
  });
30020
30823
  let afterText = linkContentEnd !== -1 ? content.slice(linkContentEnd + 1) : "";
30021
30824
  return afterText && (state.dispatchToken({
@@ -30878,7 +31681,7 @@ function parseInlineTokens(tokens, raw, pPreToken, options) {
30878
31681
  function pushToken(token) {
30879
31682
  resetCurrentTextNode();
30880
31683
  let node = cloneTokenWithMutableChildren(token);
30881
- state.result.push(node);
31684
+ node.type === "link" && (node.markup = resolveLinkMarkup(token)), state.result.push(node);
30882
31685
  }
30883
31686
  function pushText(content, raw$1) {
30884
31687
  state.currentTextNode ? (state.currentTextNode.content += content, state.currentTextNode.raw += raw$1 ?? content) : (state.currentTextNode = {