@ai-react-markdown/core 1.4.2 → 1.4.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +140 -22
- package/dist/index.cjs +777 -336
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +252 -29
- package/dist/index.d.ts +252 -29
- package/dist/index.js +735 -296
- package/dist/index.js.map +1 -1
- package/package.json +11 -3
package/dist/index.js
CHANGED
|
@@ -1513,7 +1513,7 @@ function preprocessAIMDContent(content, extraPreprocessors = defaultExtraPreproc
|
|
|
1513
1513
|
}
|
|
1514
1514
|
|
|
1515
1515
|
// src/components/MarkdownContent.tsx
|
|
1516
|
-
import { Fragment as
|
|
1516
|
+
import { Fragment as Fragment4, memo as memo2, useCallback as useCallback2, useEffect, useId as useId2, useMemo as useMemo4, useRef as useRef2, useState, useSyncExternalStore as useSyncExternalStore2 } from "react";
|
|
1517
1517
|
|
|
1518
1518
|
// src/components/markdown/Markdown.tsx
|
|
1519
1519
|
import { unreachable as unreachable2 } from "devlop";
|
|
@@ -1562,15 +1562,17 @@ function buildTransform(ctx) {
|
|
|
1562
1562
|
if (node.type === "element") {
|
|
1563
1563
|
const element = node;
|
|
1564
1564
|
let key;
|
|
1565
|
+
const properties = element.properties ?? {};
|
|
1565
1566
|
for (key in urlAttributes) {
|
|
1566
|
-
if (Object.hasOwn(urlAttributes, key) && Object.hasOwn(
|
|
1567
|
-
const value =
|
|
1567
|
+
if (Object.hasOwn(urlAttributes, key) && Object.hasOwn(properties, key)) {
|
|
1568
|
+
const value = properties[key];
|
|
1568
1569
|
const test = urlAttributes[key];
|
|
1569
1570
|
if (test === null || test.includes(element.tagName)) {
|
|
1570
|
-
|
|
1571
|
+
properties[key] = ctx.urlTransform(String(value || ""), key, element);
|
|
1571
1572
|
}
|
|
1572
1573
|
}
|
|
1573
1574
|
}
|
|
1575
|
+
element.properties = properties;
|
|
1574
1576
|
}
|
|
1575
1577
|
if (node.type === "element") {
|
|
1576
1578
|
const element = node;
|
|
@@ -1703,6 +1705,414 @@ import rehypeRaw from "rehype-raw";
|
|
|
1703
1705
|
import rehypeUnwrapImages from "rehype-unwrap-images";
|
|
1704
1706
|
import rehypeSanitize from "rehype-sanitize";
|
|
1705
1707
|
|
|
1708
|
+
// ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_arrayEach.js
|
|
1709
|
+
function arrayEach(array, iteratee) {
|
|
1710
|
+
var index = -1, length = array == null ? 0 : array.length;
|
|
1711
|
+
while (++index < length) {
|
|
1712
|
+
if (iteratee(array[index], index, array) === false) {
|
|
1713
|
+
break;
|
|
1714
|
+
}
|
|
1715
|
+
}
|
|
1716
|
+
return array;
|
|
1717
|
+
}
|
|
1718
|
+
var arrayEach_default = arrayEach;
|
|
1719
|
+
|
|
1720
|
+
// ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_nativeKeys.js
|
|
1721
|
+
var nativeKeys = overArg_default(Object.keys, Object);
|
|
1722
|
+
var nativeKeys_default = nativeKeys;
|
|
1723
|
+
|
|
1724
|
+
// ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseKeys.js
|
|
1725
|
+
var objectProto12 = Object.prototype;
|
|
1726
|
+
var hasOwnProperty10 = objectProto12.hasOwnProperty;
|
|
1727
|
+
function baseKeys(object) {
|
|
1728
|
+
if (!isPrototype_default(object)) {
|
|
1729
|
+
return nativeKeys_default(object);
|
|
1730
|
+
}
|
|
1731
|
+
var result = [];
|
|
1732
|
+
for (var key in Object(object)) {
|
|
1733
|
+
if (hasOwnProperty10.call(object, key) && key != "constructor") {
|
|
1734
|
+
result.push(key);
|
|
1735
|
+
}
|
|
1736
|
+
}
|
|
1737
|
+
return result;
|
|
1738
|
+
}
|
|
1739
|
+
var baseKeys_default = baseKeys;
|
|
1740
|
+
|
|
1741
|
+
// ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/keys.js
|
|
1742
|
+
function keys(object) {
|
|
1743
|
+
return isArrayLike_default(object) ? arrayLikeKeys_default(object) : baseKeys_default(object);
|
|
1744
|
+
}
|
|
1745
|
+
var keys_default = keys;
|
|
1746
|
+
|
|
1747
|
+
// ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseAssign.js
|
|
1748
|
+
function baseAssign(object, source) {
|
|
1749
|
+
return object && copyObject_default(source, keys_default(source), object);
|
|
1750
|
+
}
|
|
1751
|
+
var baseAssign_default = baseAssign;
|
|
1752
|
+
|
|
1753
|
+
// ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseAssignIn.js
|
|
1754
|
+
function baseAssignIn(object, source) {
|
|
1755
|
+
return object && copyObject_default(source, keysIn_default(source), object);
|
|
1756
|
+
}
|
|
1757
|
+
var baseAssignIn_default = baseAssignIn;
|
|
1758
|
+
|
|
1759
|
+
// ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_arrayFilter.js
|
|
1760
|
+
function arrayFilter(array, predicate) {
|
|
1761
|
+
var index = -1, length = array == null ? 0 : array.length, resIndex = 0, result = [];
|
|
1762
|
+
while (++index < length) {
|
|
1763
|
+
var value = array[index];
|
|
1764
|
+
if (predicate(value, index, array)) {
|
|
1765
|
+
result[resIndex++] = value;
|
|
1766
|
+
}
|
|
1767
|
+
}
|
|
1768
|
+
return result;
|
|
1769
|
+
}
|
|
1770
|
+
var arrayFilter_default = arrayFilter;
|
|
1771
|
+
|
|
1772
|
+
// ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/stubArray.js
|
|
1773
|
+
function stubArray() {
|
|
1774
|
+
return [];
|
|
1775
|
+
}
|
|
1776
|
+
var stubArray_default = stubArray;
|
|
1777
|
+
|
|
1778
|
+
// ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_getSymbols.js
|
|
1779
|
+
var objectProto13 = Object.prototype;
|
|
1780
|
+
var propertyIsEnumerable2 = objectProto13.propertyIsEnumerable;
|
|
1781
|
+
var nativeGetSymbols = Object.getOwnPropertySymbols;
|
|
1782
|
+
var getSymbols = !nativeGetSymbols ? stubArray_default : function(object) {
|
|
1783
|
+
if (object == null) {
|
|
1784
|
+
return [];
|
|
1785
|
+
}
|
|
1786
|
+
object = Object(object);
|
|
1787
|
+
return arrayFilter_default(nativeGetSymbols(object), function(symbol) {
|
|
1788
|
+
return propertyIsEnumerable2.call(object, symbol);
|
|
1789
|
+
});
|
|
1790
|
+
};
|
|
1791
|
+
var getSymbols_default = getSymbols;
|
|
1792
|
+
|
|
1793
|
+
// ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_copySymbols.js
|
|
1794
|
+
function copySymbols(source, object) {
|
|
1795
|
+
return copyObject_default(source, getSymbols_default(source), object);
|
|
1796
|
+
}
|
|
1797
|
+
var copySymbols_default = copySymbols;
|
|
1798
|
+
|
|
1799
|
+
// ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_arrayPush.js
|
|
1800
|
+
function arrayPush(array, values) {
|
|
1801
|
+
var index = -1, length = values.length, offset = array.length;
|
|
1802
|
+
while (++index < length) {
|
|
1803
|
+
array[offset + index] = values[index];
|
|
1804
|
+
}
|
|
1805
|
+
return array;
|
|
1806
|
+
}
|
|
1807
|
+
var arrayPush_default = arrayPush;
|
|
1808
|
+
|
|
1809
|
+
// ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_getSymbolsIn.js
|
|
1810
|
+
var nativeGetSymbols2 = Object.getOwnPropertySymbols;
|
|
1811
|
+
var getSymbolsIn = !nativeGetSymbols2 ? stubArray_default : function(object) {
|
|
1812
|
+
var result = [];
|
|
1813
|
+
while (object) {
|
|
1814
|
+
arrayPush_default(result, getSymbols_default(object));
|
|
1815
|
+
object = getPrototype_default(object);
|
|
1816
|
+
}
|
|
1817
|
+
return result;
|
|
1818
|
+
};
|
|
1819
|
+
var getSymbolsIn_default = getSymbolsIn;
|
|
1820
|
+
|
|
1821
|
+
// ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_copySymbolsIn.js
|
|
1822
|
+
function copySymbolsIn(source, object) {
|
|
1823
|
+
return copyObject_default(source, getSymbolsIn_default(source), object);
|
|
1824
|
+
}
|
|
1825
|
+
var copySymbolsIn_default = copySymbolsIn;
|
|
1826
|
+
|
|
1827
|
+
// ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseGetAllKeys.js
|
|
1828
|
+
function baseGetAllKeys(object, keysFunc, symbolsFunc) {
|
|
1829
|
+
var result = keysFunc(object);
|
|
1830
|
+
return isArray_default(object) ? result : arrayPush_default(result, symbolsFunc(object));
|
|
1831
|
+
}
|
|
1832
|
+
var baseGetAllKeys_default = baseGetAllKeys;
|
|
1833
|
+
|
|
1834
|
+
// ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_getAllKeys.js
|
|
1835
|
+
function getAllKeys(object) {
|
|
1836
|
+
return baseGetAllKeys_default(object, keys_default, getSymbols_default);
|
|
1837
|
+
}
|
|
1838
|
+
var getAllKeys_default = getAllKeys;
|
|
1839
|
+
|
|
1840
|
+
// ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_getAllKeysIn.js
|
|
1841
|
+
function getAllKeysIn(object) {
|
|
1842
|
+
return baseGetAllKeys_default(object, keysIn_default, getSymbolsIn_default);
|
|
1843
|
+
}
|
|
1844
|
+
var getAllKeysIn_default = getAllKeysIn;
|
|
1845
|
+
|
|
1846
|
+
// ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_DataView.js
|
|
1847
|
+
var DataView = getNative_default(root_default, "DataView");
|
|
1848
|
+
var DataView_default = DataView;
|
|
1849
|
+
|
|
1850
|
+
// ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_Promise.js
|
|
1851
|
+
var Promise2 = getNative_default(root_default, "Promise");
|
|
1852
|
+
var Promise_default = Promise2;
|
|
1853
|
+
|
|
1854
|
+
// ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_Set.js
|
|
1855
|
+
var Set2 = getNative_default(root_default, "Set");
|
|
1856
|
+
var Set_default = Set2;
|
|
1857
|
+
|
|
1858
|
+
// ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_WeakMap.js
|
|
1859
|
+
var WeakMap = getNative_default(root_default, "WeakMap");
|
|
1860
|
+
var WeakMap_default = WeakMap;
|
|
1861
|
+
|
|
1862
|
+
// ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_getTag.js
|
|
1863
|
+
var mapTag2 = "[object Map]";
|
|
1864
|
+
var objectTag3 = "[object Object]";
|
|
1865
|
+
var promiseTag = "[object Promise]";
|
|
1866
|
+
var setTag2 = "[object Set]";
|
|
1867
|
+
var weakMapTag2 = "[object WeakMap]";
|
|
1868
|
+
var dataViewTag2 = "[object DataView]";
|
|
1869
|
+
var dataViewCtorString = toSource_default(DataView_default);
|
|
1870
|
+
var mapCtorString = toSource_default(Map_default);
|
|
1871
|
+
var promiseCtorString = toSource_default(Promise_default);
|
|
1872
|
+
var setCtorString = toSource_default(Set_default);
|
|
1873
|
+
var weakMapCtorString = toSource_default(WeakMap_default);
|
|
1874
|
+
var getTag = baseGetTag_default;
|
|
1875
|
+
if (DataView_default && getTag(new DataView_default(new ArrayBuffer(1))) != dataViewTag2 || Map_default && getTag(new Map_default()) != mapTag2 || Promise_default && getTag(Promise_default.resolve()) != promiseTag || Set_default && getTag(new Set_default()) != setTag2 || WeakMap_default && getTag(new WeakMap_default()) != weakMapTag2) {
|
|
1876
|
+
getTag = function(value) {
|
|
1877
|
+
var result = baseGetTag_default(value), Ctor = result == objectTag3 ? value.constructor : void 0, ctorString = Ctor ? toSource_default(Ctor) : "";
|
|
1878
|
+
if (ctorString) {
|
|
1879
|
+
switch (ctorString) {
|
|
1880
|
+
case dataViewCtorString:
|
|
1881
|
+
return dataViewTag2;
|
|
1882
|
+
case mapCtorString:
|
|
1883
|
+
return mapTag2;
|
|
1884
|
+
case promiseCtorString:
|
|
1885
|
+
return promiseTag;
|
|
1886
|
+
case setCtorString:
|
|
1887
|
+
return setTag2;
|
|
1888
|
+
case weakMapCtorString:
|
|
1889
|
+
return weakMapTag2;
|
|
1890
|
+
}
|
|
1891
|
+
}
|
|
1892
|
+
return result;
|
|
1893
|
+
};
|
|
1894
|
+
}
|
|
1895
|
+
var getTag_default = getTag;
|
|
1896
|
+
|
|
1897
|
+
// ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_initCloneArray.js
|
|
1898
|
+
var objectProto14 = Object.prototype;
|
|
1899
|
+
var hasOwnProperty11 = objectProto14.hasOwnProperty;
|
|
1900
|
+
function initCloneArray(array) {
|
|
1901
|
+
var length = array.length, result = new array.constructor(length);
|
|
1902
|
+
if (length && typeof array[0] == "string" && hasOwnProperty11.call(array, "index")) {
|
|
1903
|
+
result.index = array.index;
|
|
1904
|
+
result.input = array.input;
|
|
1905
|
+
}
|
|
1906
|
+
return result;
|
|
1907
|
+
}
|
|
1908
|
+
var initCloneArray_default = initCloneArray;
|
|
1909
|
+
|
|
1910
|
+
// ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_cloneDataView.js
|
|
1911
|
+
function cloneDataView(dataView, isDeep) {
|
|
1912
|
+
var buffer = isDeep ? cloneArrayBuffer_default(dataView.buffer) : dataView.buffer;
|
|
1913
|
+
return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength);
|
|
1914
|
+
}
|
|
1915
|
+
var cloneDataView_default = cloneDataView;
|
|
1916
|
+
|
|
1917
|
+
// ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_cloneRegExp.js
|
|
1918
|
+
var reFlags = /\w*$/;
|
|
1919
|
+
function cloneRegExp(regexp) {
|
|
1920
|
+
var result = new regexp.constructor(regexp.source, reFlags.exec(regexp));
|
|
1921
|
+
result.lastIndex = regexp.lastIndex;
|
|
1922
|
+
return result;
|
|
1923
|
+
}
|
|
1924
|
+
var cloneRegExp_default = cloneRegExp;
|
|
1925
|
+
|
|
1926
|
+
// ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_cloneSymbol.js
|
|
1927
|
+
var symbolProto = Symbol_default ? Symbol_default.prototype : void 0;
|
|
1928
|
+
var symbolValueOf = symbolProto ? symbolProto.valueOf : void 0;
|
|
1929
|
+
function cloneSymbol(symbol) {
|
|
1930
|
+
return symbolValueOf ? Object(symbolValueOf.call(symbol)) : {};
|
|
1931
|
+
}
|
|
1932
|
+
var cloneSymbol_default = cloneSymbol;
|
|
1933
|
+
|
|
1934
|
+
// ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_initCloneByTag.js
|
|
1935
|
+
var boolTag2 = "[object Boolean]";
|
|
1936
|
+
var dateTag2 = "[object Date]";
|
|
1937
|
+
var mapTag3 = "[object Map]";
|
|
1938
|
+
var numberTag2 = "[object Number]";
|
|
1939
|
+
var regexpTag2 = "[object RegExp]";
|
|
1940
|
+
var setTag3 = "[object Set]";
|
|
1941
|
+
var stringTag2 = "[object String]";
|
|
1942
|
+
var symbolTag = "[object Symbol]";
|
|
1943
|
+
var arrayBufferTag2 = "[object ArrayBuffer]";
|
|
1944
|
+
var dataViewTag3 = "[object DataView]";
|
|
1945
|
+
var float32Tag2 = "[object Float32Array]";
|
|
1946
|
+
var float64Tag2 = "[object Float64Array]";
|
|
1947
|
+
var int8Tag2 = "[object Int8Array]";
|
|
1948
|
+
var int16Tag2 = "[object Int16Array]";
|
|
1949
|
+
var int32Tag2 = "[object Int32Array]";
|
|
1950
|
+
var uint8Tag2 = "[object Uint8Array]";
|
|
1951
|
+
var uint8ClampedTag2 = "[object Uint8ClampedArray]";
|
|
1952
|
+
var uint16Tag2 = "[object Uint16Array]";
|
|
1953
|
+
var uint32Tag2 = "[object Uint32Array]";
|
|
1954
|
+
function initCloneByTag(object, tag, isDeep) {
|
|
1955
|
+
var Ctor = object.constructor;
|
|
1956
|
+
switch (tag) {
|
|
1957
|
+
case arrayBufferTag2:
|
|
1958
|
+
return cloneArrayBuffer_default(object);
|
|
1959
|
+
case boolTag2:
|
|
1960
|
+
case dateTag2:
|
|
1961
|
+
return new Ctor(+object);
|
|
1962
|
+
case dataViewTag3:
|
|
1963
|
+
return cloneDataView_default(object, isDeep);
|
|
1964
|
+
case float32Tag2:
|
|
1965
|
+
case float64Tag2:
|
|
1966
|
+
case int8Tag2:
|
|
1967
|
+
case int16Tag2:
|
|
1968
|
+
case int32Tag2:
|
|
1969
|
+
case uint8Tag2:
|
|
1970
|
+
case uint8ClampedTag2:
|
|
1971
|
+
case uint16Tag2:
|
|
1972
|
+
case uint32Tag2:
|
|
1973
|
+
return cloneTypedArray_default(object, isDeep);
|
|
1974
|
+
case mapTag3:
|
|
1975
|
+
return new Ctor();
|
|
1976
|
+
case numberTag2:
|
|
1977
|
+
case stringTag2:
|
|
1978
|
+
return new Ctor(object);
|
|
1979
|
+
case regexpTag2:
|
|
1980
|
+
return cloneRegExp_default(object);
|
|
1981
|
+
case setTag3:
|
|
1982
|
+
return new Ctor();
|
|
1983
|
+
case symbolTag:
|
|
1984
|
+
return cloneSymbol_default(object);
|
|
1985
|
+
}
|
|
1986
|
+
}
|
|
1987
|
+
var initCloneByTag_default = initCloneByTag;
|
|
1988
|
+
|
|
1989
|
+
// ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseIsMap.js
|
|
1990
|
+
var mapTag4 = "[object Map]";
|
|
1991
|
+
function baseIsMap(value) {
|
|
1992
|
+
return isObjectLike_default(value) && getTag_default(value) == mapTag4;
|
|
1993
|
+
}
|
|
1994
|
+
var baseIsMap_default = baseIsMap;
|
|
1995
|
+
|
|
1996
|
+
// ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/isMap.js
|
|
1997
|
+
var nodeIsMap = nodeUtil_default && nodeUtil_default.isMap;
|
|
1998
|
+
var isMap = nodeIsMap ? baseUnary_default(nodeIsMap) : baseIsMap_default;
|
|
1999
|
+
var isMap_default = isMap;
|
|
2000
|
+
|
|
2001
|
+
// ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseIsSet.js
|
|
2002
|
+
var setTag4 = "[object Set]";
|
|
2003
|
+
function baseIsSet(value) {
|
|
2004
|
+
return isObjectLike_default(value) && getTag_default(value) == setTag4;
|
|
2005
|
+
}
|
|
2006
|
+
var baseIsSet_default = baseIsSet;
|
|
2007
|
+
|
|
2008
|
+
// ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/isSet.js
|
|
2009
|
+
var nodeIsSet = nodeUtil_default && nodeUtil_default.isSet;
|
|
2010
|
+
var isSet = nodeIsSet ? baseUnary_default(nodeIsSet) : baseIsSet_default;
|
|
2011
|
+
var isSet_default = isSet;
|
|
2012
|
+
|
|
2013
|
+
// ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseClone.js
|
|
2014
|
+
var CLONE_DEEP_FLAG = 1;
|
|
2015
|
+
var CLONE_FLAT_FLAG = 2;
|
|
2016
|
+
var CLONE_SYMBOLS_FLAG = 4;
|
|
2017
|
+
var argsTag3 = "[object Arguments]";
|
|
2018
|
+
var arrayTag2 = "[object Array]";
|
|
2019
|
+
var boolTag3 = "[object Boolean]";
|
|
2020
|
+
var dateTag3 = "[object Date]";
|
|
2021
|
+
var errorTag2 = "[object Error]";
|
|
2022
|
+
var funcTag3 = "[object Function]";
|
|
2023
|
+
var genTag2 = "[object GeneratorFunction]";
|
|
2024
|
+
var mapTag5 = "[object Map]";
|
|
2025
|
+
var numberTag3 = "[object Number]";
|
|
2026
|
+
var objectTag4 = "[object Object]";
|
|
2027
|
+
var regexpTag3 = "[object RegExp]";
|
|
2028
|
+
var setTag5 = "[object Set]";
|
|
2029
|
+
var stringTag3 = "[object String]";
|
|
2030
|
+
var symbolTag2 = "[object Symbol]";
|
|
2031
|
+
var weakMapTag3 = "[object WeakMap]";
|
|
2032
|
+
var arrayBufferTag3 = "[object ArrayBuffer]";
|
|
2033
|
+
var dataViewTag4 = "[object DataView]";
|
|
2034
|
+
var float32Tag3 = "[object Float32Array]";
|
|
2035
|
+
var float64Tag3 = "[object Float64Array]";
|
|
2036
|
+
var int8Tag3 = "[object Int8Array]";
|
|
2037
|
+
var int16Tag3 = "[object Int16Array]";
|
|
2038
|
+
var int32Tag3 = "[object Int32Array]";
|
|
2039
|
+
var uint8Tag3 = "[object Uint8Array]";
|
|
2040
|
+
var uint8ClampedTag3 = "[object Uint8ClampedArray]";
|
|
2041
|
+
var uint16Tag3 = "[object Uint16Array]";
|
|
2042
|
+
var uint32Tag3 = "[object Uint32Array]";
|
|
2043
|
+
var cloneableTags = {};
|
|
2044
|
+
cloneableTags[argsTag3] = cloneableTags[arrayTag2] = cloneableTags[arrayBufferTag3] = cloneableTags[dataViewTag4] = cloneableTags[boolTag3] = cloneableTags[dateTag3] = cloneableTags[float32Tag3] = cloneableTags[float64Tag3] = cloneableTags[int8Tag3] = cloneableTags[int16Tag3] = cloneableTags[int32Tag3] = cloneableTags[mapTag5] = cloneableTags[numberTag3] = cloneableTags[objectTag4] = cloneableTags[regexpTag3] = cloneableTags[setTag5] = cloneableTags[stringTag3] = cloneableTags[symbolTag2] = cloneableTags[uint8Tag3] = cloneableTags[uint8ClampedTag3] = cloneableTags[uint16Tag3] = cloneableTags[uint32Tag3] = true;
|
|
2045
|
+
cloneableTags[errorTag2] = cloneableTags[funcTag3] = cloneableTags[weakMapTag3] = false;
|
|
2046
|
+
function baseClone(value, bitmask, customizer, key, object, stack) {
|
|
2047
|
+
var result, isDeep = bitmask & CLONE_DEEP_FLAG, isFlat = bitmask & CLONE_FLAT_FLAG, isFull = bitmask & CLONE_SYMBOLS_FLAG;
|
|
2048
|
+
if (customizer) {
|
|
2049
|
+
result = object ? customizer(value, key, object, stack) : customizer(value);
|
|
2050
|
+
}
|
|
2051
|
+
if (result !== void 0) {
|
|
2052
|
+
return result;
|
|
2053
|
+
}
|
|
2054
|
+
if (!isObject_default(value)) {
|
|
2055
|
+
return value;
|
|
2056
|
+
}
|
|
2057
|
+
var isArr = isArray_default(value);
|
|
2058
|
+
if (isArr) {
|
|
2059
|
+
result = initCloneArray_default(value);
|
|
2060
|
+
if (!isDeep) {
|
|
2061
|
+
return copyArray_default(value, result);
|
|
2062
|
+
}
|
|
2063
|
+
} else {
|
|
2064
|
+
var tag = getTag_default(value), isFunc = tag == funcTag3 || tag == genTag2;
|
|
2065
|
+
if (isBuffer_default(value)) {
|
|
2066
|
+
return cloneBuffer_default(value, isDeep);
|
|
2067
|
+
}
|
|
2068
|
+
if (tag == objectTag4 || tag == argsTag3 || isFunc && !object) {
|
|
2069
|
+
result = isFlat || isFunc ? {} : initCloneObject_default(value);
|
|
2070
|
+
if (!isDeep) {
|
|
2071
|
+
return isFlat ? copySymbolsIn_default(value, baseAssignIn_default(result, value)) : copySymbols_default(value, baseAssign_default(result, value));
|
|
2072
|
+
}
|
|
2073
|
+
} else {
|
|
2074
|
+
if (!cloneableTags[tag]) {
|
|
2075
|
+
return object ? value : {};
|
|
2076
|
+
}
|
|
2077
|
+
result = initCloneByTag_default(value, tag, isDeep);
|
|
2078
|
+
}
|
|
2079
|
+
}
|
|
2080
|
+
stack || (stack = new Stack_default());
|
|
2081
|
+
var stacked = stack.get(value);
|
|
2082
|
+
if (stacked) {
|
|
2083
|
+
return stacked;
|
|
2084
|
+
}
|
|
2085
|
+
stack.set(value, result);
|
|
2086
|
+
if (isSet_default(value)) {
|
|
2087
|
+
value.forEach(function(subValue) {
|
|
2088
|
+
result.add(baseClone(subValue, bitmask, customizer, subValue, value, stack));
|
|
2089
|
+
});
|
|
2090
|
+
} else if (isMap_default(value)) {
|
|
2091
|
+
value.forEach(function(subValue, key2) {
|
|
2092
|
+
result.set(key2, baseClone(subValue, bitmask, customizer, key2, value, stack));
|
|
2093
|
+
});
|
|
2094
|
+
}
|
|
2095
|
+
var keysFunc = isFull ? isFlat ? getAllKeysIn_default : getAllKeys_default : isFlat ? keysIn_default : keys_default;
|
|
2096
|
+
var props = isArr ? void 0 : keysFunc(value);
|
|
2097
|
+
arrayEach_default(props || value, function(subValue, key2) {
|
|
2098
|
+
if (props) {
|
|
2099
|
+
key2 = subValue;
|
|
2100
|
+
subValue = value[key2];
|
|
2101
|
+
}
|
|
2102
|
+
assignValue_default(result, key2, baseClone(subValue, bitmask, customizer, key2, value, stack));
|
|
2103
|
+
});
|
|
2104
|
+
return result;
|
|
2105
|
+
}
|
|
2106
|
+
var baseClone_default = baseClone;
|
|
2107
|
+
|
|
2108
|
+
// ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/cloneDeep.js
|
|
2109
|
+
var CLONE_DEEP_FLAG2 = 1;
|
|
2110
|
+
var CLONE_SYMBOLS_FLAG2 = 4;
|
|
2111
|
+
function cloneDeep(value) {
|
|
2112
|
+
return baseClone_default(value, CLONE_DEEP_FLAG2 | CLONE_SYMBOLS_FLAG2);
|
|
2113
|
+
}
|
|
2114
|
+
var cloneDeep_default = cloneDeep;
|
|
2115
|
+
|
|
1706
2116
|
// src/components/sanitizeSchema.ts
|
|
1707
2117
|
import { defaultSchema } from "rehype-sanitize";
|
|
1708
2118
|
function mergeClassNameAllowlist(existing, extraClassNames) {
|
|
@@ -1719,7 +2129,7 @@ function mergeClassNameAllowlist(existing, extraClassNames) {
|
|
|
1719
2129
|
return entries;
|
|
1720
2130
|
}
|
|
1721
2131
|
var crossChunkTags = ["cross-chunk-link", "cross-chunk-image", "footnote-sup"];
|
|
1722
|
-
var sanitizeSchema = {
|
|
2132
|
+
var sanitizeSchema = cloneDeep_default({
|
|
1723
2133
|
...defaultSchema,
|
|
1724
2134
|
tagNames: [...defaultSchema.tagNames || [], "mark", ...crossChunkTags],
|
|
1725
2135
|
attributes: {
|
|
@@ -1729,7 +2139,7 @@ var sanitizeSchema = {
|
|
|
1729
2139
|
"cross-chunk-image": ["label", "referenceType", "documentId", "alt"],
|
|
1730
2140
|
"footnote-sup": ["label", "localOccurrence", "documentId"]
|
|
1731
2141
|
}
|
|
1732
|
-
};
|
|
2142
|
+
});
|
|
1733
2143
|
|
|
1734
2144
|
// src/components/rehypeRebaseHashLinks.ts
|
|
1735
2145
|
import { visit as visit2 } from "unist-util-visit";
|
|
@@ -2275,15 +2685,10 @@ function createRegistry(onEmpty) {
|
|
|
2275
2685
|
}
|
|
2276
2686
|
|
|
2277
2687
|
// src/components/AIMarkdownDocuments.tsx
|
|
2278
|
-
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
2688
|
+
import { Fragment as Fragment2, jsx as jsx3 } from "react/jsx-runtime";
|
|
2279
2689
|
var AIMarkdownDocumentsContext = createContext2(null);
|
|
2280
|
-
var
|
|
2281
|
-
|
|
2282
|
-
if (parent !== null) {
|
|
2283
|
-
throw new Error(
|
|
2284
|
-
"<AIMarkdownDocuments> must not be nested inside another <AIMarkdownDocuments>. Use a single top-level wrapper per coordinated scope."
|
|
2285
|
-
);
|
|
2286
|
-
}
|
|
2690
|
+
var NESTED_WRAPPER_MESSAGE = "<AIMarkdownDocuments> must not be nested inside another <AIMarkdownDocuments>. Use a single top-level wrapper per coordinated scope.";
|
|
2691
|
+
var AIMarkdownDocumentsRoot = ({ preserveOrphanReferences, children }) => {
|
|
2287
2692
|
const registriesRef = useRef(/* @__PURE__ */ new Map());
|
|
2288
2693
|
const value = useMemo2(
|
|
2289
2694
|
() => ({
|
|
@@ -2306,6 +2711,19 @@ var AIMarkdownDocuments = ({ preserveOrphanReferences = true, children }) => {
|
|
|
2306
2711
|
);
|
|
2307
2712
|
return /* @__PURE__ */ jsx3(AIMarkdownDocumentsContext.Provider, { value, children });
|
|
2308
2713
|
};
|
|
2714
|
+
var AIMarkdownDocuments = ({ preserveOrphanReferences = true, children }) => {
|
|
2715
|
+
const parent = useContext2(AIMarkdownDocumentsContext);
|
|
2716
|
+
if (parent !== null) {
|
|
2717
|
+
if (process.env.NODE_ENV !== "production") {
|
|
2718
|
+
throw new Error(NESTED_WRAPPER_MESSAGE);
|
|
2719
|
+
}
|
|
2720
|
+
console.error(
|
|
2721
|
+
`[ai-react-markdown] ${NESTED_WRAPPER_MESSAGE} Falling back to the outer wrapper; the inner wrapper is a no-op.`
|
|
2722
|
+
);
|
|
2723
|
+
return /* @__PURE__ */ jsx3(Fragment2, { children });
|
|
2724
|
+
}
|
|
2725
|
+
return /* @__PURE__ */ jsx3(AIMarkdownDocumentsRoot, { preserveOrphanReferences, children });
|
|
2726
|
+
};
|
|
2309
2727
|
function useDocumentRegistry(documentId) {
|
|
2310
2728
|
const ctx = useContext2(AIMarkdownDocumentsContext);
|
|
2311
2729
|
if (!ctx || !documentId) return null;
|
|
@@ -2428,10 +2846,44 @@ import { isValidElement, useCallback, useContext as useContext3, useSyncExternal
|
|
|
2428
2846
|
import { createContext as createContext3 } from "react";
|
|
2429
2847
|
var ChunkSymbolContext = createContext3(null);
|
|
2430
2848
|
|
|
2849
|
+
// src/components/crossChunkUrlContext.ts
|
|
2850
|
+
import { createContext as createContext4 } from "react";
|
|
2851
|
+
var CrossChunkUrlContext = createContext4(null);
|
|
2852
|
+
|
|
2853
|
+
// src/components/crossChunkUrlSanitize.ts
|
|
2854
|
+
function fakeElement(tagName, key, url) {
|
|
2855
|
+
return { type: "element", tagName, properties: { [key]: url }, children: [] };
|
|
2856
|
+
}
|
|
2857
|
+
function isRelative(url, colon) {
|
|
2858
|
+
if (colon === -1) return true;
|
|
2859
|
+
const slash = url.indexOf("/");
|
|
2860
|
+
const questionMark = url.indexOf("?");
|
|
2861
|
+
const numberSign = url.indexOf("#");
|
|
2862
|
+
if (slash !== -1 && colon > slash) return true;
|
|
2863
|
+
if (questionMark !== -1 && colon > questionMark) return true;
|
|
2864
|
+
if (numberSign !== -1 && colon > numberSign) return true;
|
|
2865
|
+
return false;
|
|
2866
|
+
}
|
|
2867
|
+
function isProtocolAllowed(url, allowed) {
|
|
2868
|
+
const colon = url.indexOf(":");
|
|
2869
|
+
if (isRelative(url, colon)) return true;
|
|
2870
|
+
const protocol = url.slice(0, colon);
|
|
2871
|
+
return allowed.some((p) => p === protocol);
|
|
2872
|
+
}
|
|
2873
|
+
function sanitizeCrossChunkUrl(rawUrl, key, tagName, urlTransform, schema) {
|
|
2874
|
+
const transformed = urlTransform(rawUrl, key, fakeElement(tagName, key, rawUrl));
|
|
2875
|
+
if (transformed == null) return "";
|
|
2876
|
+
const stringUrl = String(transformed);
|
|
2877
|
+
if (stringUrl === "") return "";
|
|
2878
|
+
const callerProtocols = schema.protocols;
|
|
2879
|
+
const allowed = callerProtocols === void 0 || callerProtocols === null ? sanitizeSchema.protocols?.[key] : callerProtocols[key];
|
|
2880
|
+
if (!allowed || allowed.length === 0) return stringUrl;
|
|
2881
|
+
return isProtocolAllowed(stringUrl, allowed) ? stringUrl : "";
|
|
2882
|
+
}
|
|
2883
|
+
|
|
2431
2884
|
// src/components/crossChunkPlaceholders.tsx
|
|
2432
2885
|
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
2433
2886
|
var SSR_NUM_SNAPSHOT = () => 0;
|
|
2434
|
-
var SSR_DEF_SNAPSHOT = () => null;
|
|
2435
2887
|
function coerceLocalOccurrence(v) {
|
|
2436
2888
|
if (v === void 0) return null;
|
|
2437
2889
|
if (typeof v === "number") return Number.isFinite(v) && v >= 1 ? Math.trunc(v) : null;
|
|
@@ -2480,14 +2932,23 @@ function literalLink(rt, label, children) {
|
|
|
2480
2932
|
function CrossChunkLink({ label, referenceType, children }) {
|
|
2481
2933
|
const { documentId } = useAIMarkdownRenderState();
|
|
2482
2934
|
const registry = useDocumentRegistry(documentId);
|
|
2935
|
+
const policy = useContext3(CrossChunkUrlContext);
|
|
2483
2936
|
const subscribe = useCallback((cb) => registry ? registry.subscribe(cb) : () => {
|
|
2484
2937
|
}, [registry]);
|
|
2485
|
-
const getSnapshot = useCallback(() => registry?.
|
|
2486
|
-
|
|
2938
|
+
const getSnapshot = useCallback(() => registry?.version ?? 0, [registry]);
|
|
2939
|
+
useSyncExternalStore(subscribe, getSnapshot, SSR_NUM_SNAPSHOT);
|
|
2940
|
+
const def = registry?.resolveLinkDef(label) ?? null;
|
|
2487
2941
|
if (!def) {
|
|
2488
2942
|
return literalLink(referenceType, label, children);
|
|
2489
2943
|
}
|
|
2490
|
-
|
|
2944
|
+
const url = sanitizeCrossChunkUrl(
|
|
2945
|
+
def.url,
|
|
2946
|
+
"href",
|
|
2947
|
+
"a",
|
|
2948
|
+
policy?.urlTransform ?? defaultUrlTransform,
|
|
2949
|
+
policy?.sanitizeSchema ?? sanitizeSchema
|
|
2950
|
+
);
|
|
2951
|
+
return /* @__PURE__ */ jsx4("a", { href: url, title: def.title, children });
|
|
2491
2952
|
}
|
|
2492
2953
|
function literalImage(rt, label, alt) {
|
|
2493
2954
|
switch (rt) {
|
|
@@ -2503,14 +2964,23 @@ function literalImage(rt, label, alt) {
|
|
|
2503
2964
|
function CrossChunkImage({ label, referenceType, alt = "" }) {
|
|
2504
2965
|
const { documentId } = useAIMarkdownRenderState();
|
|
2505
2966
|
const registry = useDocumentRegistry(documentId);
|
|
2967
|
+
const policy = useContext3(CrossChunkUrlContext);
|
|
2506
2968
|
const subscribe = useCallback((cb) => registry ? registry.subscribe(cb) : () => {
|
|
2507
2969
|
}, [registry]);
|
|
2508
|
-
const getSnapshot = useCallback(() => registry?.
|
|
2509
|
-
|
|
2970
|
+
const getSnapshot = useCallback(() => registry?.version ?? 0, [registry]);
|
|
2971
|
+
useSyncExternalStore(subscribe, getSnapshot, SSR_NUM_SNAPSHOT);
|
|
2972
|
+
const def = registry?.resolveLinkDef(label) ?? null;
|
|
2510
2973
|
if (!def) {
|
|
2511
2974
|
return literalImage(referenceType, label, alt);
|
|
2512
2975
|
}
|
|
2513
|
-
|
|
2976
|
+
const url = sanitizeCrossChunkUrl(
|
|
2977
|
+
def.url,
|
|
2978
|
+
"src",
|
|
2979
|
+
"img",
|
|
2980
|
+
policy?.urlTransform ?? defaultUrlTransform,
|
|
2981
|
+
policy?.sanitizeSchema ?? sanitizeSchema
|
|
2982
|
+
);
|
|
2983
|
+
return /* @__PURE__ */ jsx4("img", { src: url, alt, title: def.title });
|
|
2514
2984
|
}
|
|
2515
2985
|
var crossChunkComponents = {
|
|
2516
2986
|
"footnote-sup": FootnoteSupNumber,
|
|
@@ -2520,8 +2990,17 @@ var crossChunkComponents = {
|
|
|
2520
2990
|
|
|
2521
2991
|
// src/components/extractContributions.ts
|
|
2522
2992
|
import { SKIP, visit as visit6 } from "unist-util-visit";
|
|
2993
|
+
function fakeAnchorElement(url) {
|
|
2994
|
+
return { type: "element", tagName: "a", properties: { href: url }, children: [] };
|
|
2995
|
+
}
|
|
2996
|
+
function sanitizeDefUrl(url, urlTransform) {
|
|
2997
|
+
if (!urlTransform) return url;
|
|
2998
|
+
const result = urlTransform(url, "href", fakeAnchorElement(url));
|
|
2999
|
+
return result == null ? "" : String(result);
|
|
3000
|
+
}
|
|
2523
3001
|
function* extractContributions(mdast, options = {}) {
|
|
2524
3002
|
const phantomFn = options.phantomFootnoteLabels;
|
|
3003
|
+
const urlTransform = options.urlTransform;
|
|
2525
3004
|
const out = [];
|
|
2526
3005
|
visit6(mdast, (n) => {
|
|
2527
3006
|
if (n.type === "footnoteReference") {
|
|
@@ -2546,7 +3025,12 @@ function* extractContributions(mdast, options = {}) {
|
|
|
2546
3025
|
} else if (n.type === "definition") {
|
|
2547
3026
|
const d = n;
|
|
2548
3027
|
if (d.url === SENTINEL_LINK_URL) return;
|
|
2549
|
-
out.push({
|
|
3028
|
+
out.push({
|
|
3029
|
+
kind: "linkDef",
|
|
3030
|
+
label: normalizeId(d.identifier),
|
|
3031
|
+
url: sanitizeDefUrl(d.url, urlTransform),
|
|
3032
|
+
title: d.title
|
|
3033
|
+
});
|
|
2550
3034
|
}
|
|
2551
3035
|
});
|
|
2552
3036
|
for (const c of out) yield c;
|
|
@@ -2681,7 +3165,7 @@ function extractDefBodiesFromHast(hast, clobberPrefix) {
|
|
|
2681
3165
|
|
|
2682
3166
|
// src/components/aggregateFootnotesIfLast.tsx
|
|
2683
3167
|
import { memo, useMemo as useMemo3 } from "react";
|
|
2684
|
-
import { Fragment as
|
|
3168
|
+
import { Fragment as Fragment3, jsx as jsx5 } from "react/jsx-runtime";
|
|
2685
3169
|
function cloneHast(node) {
|
|
2686
3170
|
return JSON.parse(JSON.stringify(node));
|
|
2687
3171
|
}
|
|
@@ -2839,7 +3323,7 @@ var AggregateFootnotesIfLastImpl = ({
|
|
|
2839
3323
|
if (order.length === 0) return null;
|
|
2840
3324
|
if (order[order.length - 1] !== thisChunkSym) return null;
|
|
2841
3325
|
if (!tree) return null;
|
|
2842
|
-
return /* @__PURE__ */ jsx5(
|
|
3326
|
+
return /* @__PURE__ */ jsx5(Fragment3, { children: renderHastSubtree(cloneHast(tree), postOptions) });
|
|
2843
3327
|
};
|
|
2844
3328
|
var AggregateFootnotesIfLast = memo(AggregateFootnotesIfLastImpl);
|
|
2845
3329
|
AggregateFootnotesIfLast.displayName = "AggregateFootnotesIfLast";
|
|
@@ -2858,8 +3342,15 @@ var ExtraSyntaxRemarkPluginMap = {
|
|
|
2858
3342
|
};
|
|
2859
3343
|
var DefaultCustomComponents = {};
|
|
2860
3344
|
var BlockMemoizedRenderer = memo2(
|
|
2861
|
-
({
|
|
2862
|
-
|
|
3345
|
+
({
|
|
3346
|
+
content,
|
|
3347
|
+
usedComponents,
|
|
3348
|
+
remarkPlugins,
|
|
3349
|
+
rehypePlugins,
|
|
3350
|
+
remarkRehypeOptions,
|
|
3351
|
+
urlTransform,
|
|
3352
|
+
sanitizeSchema: usedSanitizeSchema
|
|
3353
|
+
}) => {
|
|
2863
3354
|
const allowedElements = void 0;
|
|
2864
3355
|
const disallowedElements = void 0;
|
|
2865
3356
|
const allowElement = void 0;
|
|
@@ -3034,8 +3525,10 @@ var BlockMemoizedRenderer = memo2(
|
|
|
3034
3525
|
const refs = [];
|
|
3035
3526
|
const defMeta = /* @__PURE__ */ new Map();
|
|
3036
3527
|
const linkDefs = /* @__PURE__ */ new Map();
|
|
3528
|
+
const resolvedUrlTransform = urlTransform ?? defaultUrlTransform;
|
|
3037
3529
|
for (const node of extractContributions(parsed.mdast, {
|
|
3038
|
-
phantomFootnoteLabels: targetPhantoms.missingFootnotes
|
|
3530
|
+
phantomFootnoteLabels: targetPhantoms.missingFootnotes,
|
|
3531
|
+
urlTransform: resolvedUrlTransform
|
|
3039
3532
|
})) {
|
|
3040
3533
|
if (node.kind === "ref") {
|
|
3041
3534
|
refs.push({ label: node.label, kind: node.refKind, referenceType: node.referenceType });
|
|
@@ -3089,10 +3582,17 @@ var BlockMemoizedRenderer = memo2(
|
|
|
3089
3582
|
ownFootnoteLabels: ownLabels.footnoteLabels,
|
|
3090
3583
|
ownLinkLabels: ownLabels.linkLabels
|
|
3091
3584
|
});
|
|
3092
|
-
}, [parsed, ownLabels, registry, targetPhantoms, sym, hast, clobberPrefix]);
|
|
3585
|
+
}, [parsed, ownLabels, registry, targetPhantoms, sym, hast, clobberPrefix, urlTransform]);
|
|
3093
3586
|
const rendered = renderBlocksWithCache(cacheRef, built.plan, built.globalCtx, postOptions);
|
|
3094
|
-
|
|
3095
|
-
|
|
3587
|
+
const crossChunkUrlPolicy = useMemo4(
|
|
3588
|
+
() => ({
|
|
3589
|
+
urlTransform: urlTransform || defaultUrlTransform,
|
|
3590
|
+
sanitizeSchema: usedSanitizeSchema
|
|
3591
|
+
}),
|
|
3592
|
+
[urlTransform, usedSanitizeSchema]
|
|
3593
|
+
);
|
|
3594
|
+
return /* @__PURE__ */ jsx6(CrossChunkUrlContext.Provider, { value: crossChunkUrlPolicy, children: /* @__PURE__ */ jsxs2(ChunkSymbolContext.Provider, { value: sym, children: [
|
|
3595
|
+
rendered.map(({ node, reactKey }) => /* @__PURE__ */ jsx6(Fragment4, { children: node }, reactKey)),
|
|
3096
3596
|
registry && sym ? /* @__PURE__ */ jsx6(
|
|
3097
3597
|
AggregateFootnotesIfLast,
|
|
3098
3598
|
{
|
|
@@ -3103,113 +3603,135 @@ var BlockMemoizedRenderer = memo2(
|
|
|
3103
3603
|
preserveOrphanReferences: effectivePreserveOrphan
|
|
3104
3604
|
}
|
|
3105
3605
|
) : null
|
|
3106
|
-
] });
|
|
3606
|
+
] }) });
|
|
3107
3607
|
}
|
|
3108
3608
|
);
|
|
3109
3609
|
BlockMemoizedRenderer.displayName = "BlockMemoizedRenderer";
|
|
3110
3610
|
var LegacyRenderer = memo2(
|
|
3111
|
-
|
|
3611
|
+
// `sanitizeSchema` is accepted (and ignored) here purely for prop-shape
|
|
3612
|
+
// parity with `BlockMemoizedRenderer` — legacy mode skips cross-chunk
|
|
3613
|
+
// coordination entirely, so there's no placeholder needing the schema.
|
|
3614
|
+
// Rebind to an underscore-prefixed local so the project's
|
|
3615
|
+
// no-unused-vars rule (which allows `_`-prefixed names) accepts it.
|
|
3616
|
+
({
|
|
3617
|
+
content,
|
|
3618
|
+
usedComponents,
|
|
3619
|
+
remarkPlugins,
|
|
3620
|
+
rehypePlugins,
|
|
3621
|
+
remarkRehypeOptions,
|
|
3622
|
+
urlTransform,
|
|
3623
|
+
sanitizeSchema: _sanitizeSchema
|
|
3624
|
+
}) => /* @__PURE__ */ jsx6(
|
|
3112
3625
|
Markdown_default,
|
|
3113
3626
|
{
|
|
3114
3627
|
remarkPlugins,
|
|
3115
3628
|
rehypePlugins,
|
|
3116
3629
|
remarkRehypeOptions,
|
|
3117
3630
|
components: usedComponents,
|
|
3631
|
+
urlTransform,
|
|
3118
3632
|
children: content
|
|
3119
3633
|
}
|
|
3120
3634
|
)
|
|
3121
3635
|
);
|
|
3122
3636
|
LegacyRenderer.displayName = "LegacyRenderer";
|
|
3123
|
-
var AIMarkdownContent = memo2(
|
|
3124
|
-
|
|
3125
|
-
|
|
3126
|
-
|
|
3127
|
-
|
|
3128
|
-
|
|
3129
|
-
|
|
3130
|
-
|
|
3131
|
-
|
|
3132
|
-
|
|
3133
|
-
|
|
3134
|
-
|
|
3135
|
-
|
|
3136
|
-
|
|
3137
|
-
|
|
3138
|
-
|
|
3139
|
-
|
|
3140
|
-
|
|
3141
|
-
|
|
3142
|
-
|
|
3143
|
-
|
|
3144
|
-
|
|
3145
|
-
|
|
3146
|
-
|
|
3147
|
-
|
|
3148
|
-
|
|
3637
|
+
var AIMarkdownContent = memo2(
|
|
3638
|
+
({ content, customComponents, urlTransform, sanitizeSchema: customSanitizeSchema }) => {
|
|
3639
|
+
const { config, clobberPrefix } = useAIMarkdownRenderState();
|
|
3640
|
+
const usedSanitizeSchema = customSanitizeSchema ?? sanitizeSchema;
|
|
3641
|
+
const { extraSyntaxRemarkPlugins, enableDefinitionList } = useMemo4(
|
|
3642
|
+
() => ({
|
|
3643
|
+
extraSyntaxRemarkPlugins: config.extraSyntaxSupported.map((syntax) => ExtraSyntaxRemarkPluginMap[syntax]),
|
|
3644
|
+
enableDefinitionList: config.extraSyntaxSupported.includes("DEFINITION_LIST" /* DEFINITION_LIST */)
|
|
3645
|
+
}),
|
|
3646
|
+
[config.extraSyntaxSupported]
|
|
3647
|
+
);
|
|
3648
|
+
const displayOptimizeRemarkPlugins = useMemo4(() => {
|
|
3649
|
+
return config.displayOptimizeAbilities.map((ability) => DisplayOptimizeRemarkPluginMap[ability]);
|
|
3650
|
+
}, [config.displayOptimizeAbilities]);
|
|
3651
|
+
const usedComponents = useMemo4(() => {
|
|
3652
|
+
return customComponents ? { ...DefaultCustomComponents, ...customComponents } : DefaultCustomComponents;
|
|
3653
|
+
}, [customComponents]);
|
|
3654
|
+
const remarkPlugins = useMemo4(
|
|
3655
|
+
() => [
|
|
3656
|
+
// --- Core plugins (always active) ---
|
|
3657
|
+
remarkGfm2,
|
|
3658
|
+
[
|
|
3659
|
+
remarkMath,
|
|
3660
|
+
{
|
|
3661
|
+
// Disable single-dollar inline math to avoid conflicts with currency
|
|
3662
|
+
// signs and other dollar usages; the preprocessor converts $...$ to $$...$$.
|
|
3663
|
+
singleDollarTextMath: false
|
|
3664
|
+
}
|
|
3665
|
+
],
|
|
3666
|
+
// --- Configurable extra syntax plugins ---
|
|
3667
|
+
...extraSyntaxRemarkPlugins,
|
|
3668
|
+
// --- Formatting & normalization ---
|
|
3669
|
+
remarkBreaks,
|
|
3670
|
+
remarkEmoji,
|
|
3671
|
+
remarkSqueezeParagraphs,
|
|
3672
|
+
remarkCjkFriendly,
|
|
3673
|
+
remarkCjkFriendlyGfmStrikethrough,
|
|
3674
|
+
// --- Configurable display optimizations ---
|
|
3675
|
+
...displayOptimizeRemarkPlugins
|
|
3149
3676
|
],
|
|
3150
|
-
|
|
3151
|
-
|
|
3152
|
-
|
|
3153
|
-
|
|
3154
|
-
|
|
3155
|
-
|
|
3156
|
-
|
|
3157
|
-
|
|
3158
|
-
|
|
3159
|
-
|
|
3160
|
-
|
|
3161
|
-
|
|
3162
|
-
|
|
3163
|
-
|
|
3164
|
-
|
|
3165
|
-
|
|
3166
|
-
|
|
3167
|
-
|
|
3168
|
-
|
|
3169
|
-
|
|
3170
|
-
|
|
3171
|
-
|
|
3172
|
-
|
|
3173
|
-
|
|
3174
|
-
|
|
3175
|
-
|
|
3176
|
-
|
|
3177
|
-
|
|
3178
|
-
|
|
3179
|
-
|
|
3180
|
-
|
|
3181
|
-
|
|
3182
|
-
|
|
3183
|
-
|
|
3184
|
-
|
|
3185
|
-
|
|
3186
|
-
|
|
3187
|
-
|
|
3188
|
-
|
|
3189
|
-
|
|
3190
|
-
|
|
3191
|
-
|
|
3192
|
-
|
|
3193
|
-
|
|
3194
|
-
|
|
3195
|
-
|
|
3196
|
-
|
|
3677
|
+
[extraSyntaxRemarkPlugins, displayOptimizeRemarkPlugins]
|
|
3678
|
+
);
|
|
3679
|
+
const rehypePlugins = useMemo4(
|
|
3680
|
+
() => [
|
|
3681
|
+
// Allow raw HTML through so rehype-sanitize can handle it.
|
|
3682
|
+
[rehypeRaw, { passThrough: [] }],
|
|
3683
|
+
// Sanitize HTML while allowing <mark> (highlight), KaTeX class names,
|
|
3684
|
+
// and any extra protocols the caller permitted via the `sanitizeSchema`
|
|
3685
|
+
// prop. Override `clobberPrefix` with the instance-scoped value so every
|
|
3686
|
+
// id and clobberable attribute is namespaced to this `<AIMarkdown>`
|
|
3687
|
+
// instance — the spread order is intentional: our prefix wins over any
|
|
3688
|
+
// caller-supplied prefix on the schema.
|
|
3689
|
+
[rehypeSanitize, { ...usedSanitizeSchema, clobberPrefix }],
|
|
3690
|
+
// Normalize the auto-generated `<section data-footnotes>`: strip the
|
|
3691
|
+
// sr-only `<h2>Footnotes</h2>` label and prepend `<hr>`. Keeps standalone
|
|
3692
|
+
// single-doc rendering visually consistent with the cross-chunk aggregate
|
|
3693
|
+
// footer (which builds the same shape from scratch).
|
|
3694
|
+
rehypeFooterAdorn,
|
|
3695
|
+
// Re-prefix intra-document hash hrefs so they match the ids that
|
|
3696
|
+
// rehype-sanitize just clobbered. Must use the SAME prefix as the schema
|
|
3697
|
+
// above — that's why both read from `clobberPrefix`.
|
|
3698
|
+
[rehypeRebaseHashLinks_default, { prefix: clobberPrefix }],
|
|
3699
|
+
rehypeKatex,
|
|
3700
|
+
rehypeUnwrapImages
|
|
3701
|
+
],
|
|
3702
|
+
[clobberPrefix, usedSanitizeSchema]
|
|
3703
|
+
);
|
|
3704
|
+
const remarkRehypeOptions = useMemo4(
|
|
3705
|
+
() => ({
|
|
3706
|
+
allowDangerousHtml: true,
|
|
3707
|
+
// Suppress mdast-util-to-hast's `user-content-` prefix on footnote
|
|
3708
|
+
// ids/hrefs; rehype-sanitize will apply the same prefix downstream
|
|
3709
|
+
// and `rehypeRebaseHashLinks` mirrors it onto matching hash hrefs.
|
|
3710
|
+
// Without this, ids would end up double-prefixed
|
|
3711
|
+
// (`user-content-user-content-fn-x`).
|
|
3712
|
+
clobberPrefix: "",
|
|
3713
|
+
handlers: {
|
|
3714
|
+
// Inject definition-list HAST handlers when the extension is active.
|
|
3715
|
+
...enableDefinitionList ? defListHastHandlers : {}
|
|
3716
|
+
}
|
|
3717
|
+
}),
|
|
3718
|
+
[enableDefinitionList]
|
|
3719
|
+
);
|
|
3720
|
+
const Renderer = config.blockMemoEnabled ? BlockMemoizedRenderer : LegacyRenderer;
|
|
3721
|
+
return /* @__PURE__ */ jsx6(
|
|
3722
|
+
Renderer,
|
|
3723
|
+
{
|
|
3724
|
+
content,
|
|
3725
|
+
usedComponents,
|
|
3726
|
+
remarkPlugins,
|
|
3727
|
+
rehypePlugins,
|
|
3728
|
+
remarkRehypeOptions,
|
|
3729
|
+
urlTransform,
|
|
3730
|
+
sanitizeSchema: usedSanitizeSchema
|
|
3197
3731
|
}
|
|
3198
|
-
|
|
3199
|
-
|
|
3200
|
-
|
|
3201
|
-
const Renderer = config.blockMemoEnabled ? BlockMemoizedRenderer : LegacyRenderer;
|
|
3202
|
-
return /* @__PURE__ */ jsx6(
|
|
3203
|
-
Renderer,
|
|
3204
|
-
{
|
|
3205
|
-
content,
|
|
3206
|
-
usedComponents,
|
|
3207
|
-
remarkPlugins,
|
|
3208
|
-
rehypePlugins,
|
|
3209
|
-
remarkRehypeOptions
|
|
3210
|
-
}
|
|
3211
|
-
);
|
|
3212
|
-
});
|
|
3732
|
+
);
|
|
3733
|
+
}
|
|
3734
|
+
);
|
|
3213
3735
|
AIMarkdownContent.displayName = "AIMarkdownContent";
|
|
3214
3736
|
var MarkdownContent_default = AIMarkdownContent;
|
|
3215
3737
|
|
|
@@ -3331,44 +3853,44 @@ var setToArray_default = setToArray;
|
|
|
3331
3853
|
// ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_equalByTag.js
|
|
3332
3854
|
var COMPARE_PARTIAL_FLAG2 = 1;
|
|
3333
3855
|
var COMPARE_UNORDERED_FLAG2 = 2;
|
|
3334
|
-
var
|
|
3335
|
-
var
|
|
3336
|
-
var
|
|
3337
|
-
var
|
|
3338
|
-
var
|
|
3339
|
-
var
|
|
3340
|
-
var
|
|
3341
|
-
var
|
|
3342
|
-
var
|
|
3343
|
-
var
|
|
3344
|
-
var
|
|
3345
|
-
var
|
|
3346
|
-
var
|
|
3856
|
+
var boolTag4 = "[object Boolean]";
|
|
3857
|
+
var dateTag4 = "[object Date]";
|
|
3858
|
+
var errorTag3 = "[object Error]";
|
|
3859
|
+
var mapTag6 = "[object Map]";
|
|
3860
|
+
var numberTag4 = "[object Number]";
|
|
3861
|
+
var regexpTag4 = "[object RegExp]";
|
|
3862
|
+
var setTag6 = "[object Set]";
|
|
3863
|
+
var stringTag4 = "[object String]";
|
|
3864
|
+
var symbolTag3 = "[object Symbol]";
|
|
3865
|
+
var arrayBufferTag4 = "[object ArrayBuffer]";
|
|
3866
|
+
var dataViewTag5 = "[object DataView]";
|
|
3867
|
+
var symbolProto2 = Symbol_default ? Symbol_default.prototype : void 0;
|
|
3868
|
+
var symbolValueOf2 = symbolProto2 ? symbolProto2.valueOf : void 0;
|
|
3347
3869
|
function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {
|
|
3348
3870
|
switch (tag) {
|
|
3349
|
-
case
|
|
3871
|
+
case dataViewTag5:
|
|
3350
3872
|
if (object.byteLength != other.byteLength || object.byteOffset != other.byteOffset) {
|
|
3351
3873
|
return false;
|
|
3352
3874
|
}
|
|
3353
3875
|
object = object.buffer;
|
|
3354
3876
|
other = other.buffer;
|
|
3355
|
-
case
|
|
3877
|
+
case arrayBufferTag4:
|
|
3356
3878
|
if (object.byteLength != other.byteLength || !equalFunc(new Uint8Array_default(object), new Uint8Array_default(other))) {
|
|
3357
3879
|
return false;
|
|
3358
3880
|
}
|
|
3359
3881
|
return true;
|
|
3360
|
-
case
|
|
3361
|
-
case
|
|
3362
|
-
case
|
|
3882
|
+
case boolTag4:
|
|
3883
|
+
case dateTag4:
|
|
3884
|
+
case numberTag4:
|
|
3363
3885
|
return eq_default(+object, +other);
|
|
3364
|
-
case
|
|
3886
|
+
case errorTag3:
|
|
3365
3887
|
return object.name == other.name && object.message == other.message;
|
|
3366
|
-
case
|
|
3367
|
-
case
|
|
3888
|
+
case regexpTag4:
|
|
3889
|
+
case stringTag4:
|
|
3368
3890
|
return object == other + "";
|
|
3369
|
-
case
|
|
3891
|
+
case mapTag6:
|
|
3370
3892
|
var convert = mapToArray_default;
|
|
3371
|
-
case
|
|
3893
|
+
case setTag6:
|
|
3372
3894
|
var isPartial = bitmask & COMPARE_PARTIAL_FLAG2;
|
|
3373
3895
|
convert || (convert = setToArray_default);
|
|
3374
3896
|
if (object.size != other.size && !isPartial) {
|
|
@@ -3383,103 +3905,19 @@ function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {
|
|
|
3383
3905
|
var result = equalArrays_default(convert(object), convert(other), bitmask, customizer, equalFunc, stack);
|
|
3384
3906
|
stack["delete"](object);
|
|
3385
3907
|
return result;
|
|
3386
|
-
case
|
|
3387
|
-
if (
|
|
3388
|
-
return
|
|
3908
|
+
case symbolTag3:
|
|
3909
|
+
if (symbolValueOf2) {
|
|
3910
|
+
return symbolValueOf2.call(object) == symbolValueOf2.call(other);
|
|
3389
3911
|
}
|
|
3390
3912
|
}
|
|
3391
3913
|
return false;
|
|
3392
3914
|
}
|
|
3393
3915
|
var equalByTag_default = equalByTag;
|
|
3394
3916
|
|
|
3395
|
-
// ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_arrayPush.js
|
|
3396
|
-
function arrayPush(array, values) {
|
|
3397
|
-
var index = -1, length = values.length, offset = array.length;
|
|
3398
|
-
while (++index < length) {
|
|
3399
|
-
array[offset + index] = values[index];
|
|
3400
|
-
}
|
|
3401
|
-
return array;
|
|
3402
|
-
}
|
|
3403
|
-
var arrayPush_default = arrayPush;
|
|
3404
|
-
|
|
3405
|
-
// ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseGetAllKeys.js
|
|
3406
|
-
function baseGetAllKeys(object, keysFunc, symbolsFunc) {
|
|
3407
|
-
var result = keysFunc(object);
|
|
3408
|
-
return isArray_default(object) ? result : arrayPush_default(result, symbolsFunc(object));
|
|
3409
|
-
}
|
|
3410
|
-
var baseGetAllKeys_default = baseGetAllKeys;
|
|
3411
|
-
|
|
3412
|
-
// ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_arrayFilter.js
|
|
3413
|
-
function arrayFilter(array, predicate) {
|
|
3414
|
-
var index = -1, length = array == null ? 0 : array.length, resIndex = 0, result = [];
|
|
3415
|
-
while (++index < length) {
|
|
3416
|
-
var value = array[index];
|
|
3417
|
-
if (predicate(value, index, array)) {
|
|
3418
|
-
result[resIndex++] = value;
|
|
3419
|
-
}
|
|
3420
|
-
}
|
|
3421
|
-
return result;
|
|
3422
|
-
}
|
|
3423
|
-
var arrayFilter_default = arrayFilter;
|
|
3424
|
-
|
|
3425
|
-
// ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/stubArray.js
|
|
3426
|
-
function stubArray() {
|
|
3427
|
-
return [];
|
|
3428
|
-
}
|
|
3429
|
-
var stubArray_default = stubArray;
|
|
3430
|
-
|
|
3431
|
-
// ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_getSymbols.js
|
|
3432
|
-
var objectProto12 = Object.prototype;
|
|
3433
|
-
var propertyIsEnumerable2 = objectProto12.propertyIsEnumerable;
|
|
3434
|
-
var nativeGetSymbols = Object.getOwnPropertySymbols;
|
|
3435
|
-
var getSymbols = !nativeGetSymbols ? stubArray_default : function(object) {
|
|
3436
|
-
if (object == null) {
|
|
3437
|
-
return [];
|
|
3438
|
-
}
|
|
3439
|
-
object = Object(object);
|
|
3440
|
-
return arrayFilter_default(nativeGetSymbols(object), function(symbol) {
|
|
3441
|
-
return propertyIsEnumerable2.call(object, symbol);
|
|
3442
|
-
});
|
|
3443
|
-
};
|
|
3444
|
-
var getSymbols_default = getSymbols;
|
|
3445
|
-
|
|
3446
|
-
// ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_nativeKeys.js
|
|
3447
|
-
var nativeKeys = overArg_default(Object.keys, Object);
|
|
3448
|
-
var nativeKeys_default = nativeKeys;
|
|
3449
|
-
|
|
3450
|
-
// ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseKeys.js
|
|
3451
|
-
var objectProto13 = Object.prototype;
|
|
3452
|
-
var hasOwnProperty10 = objectProto13.hasOwnProperty;
|
|
3453
|
-
function baseKeys(object) {
|
|
3454
|
-
if (!isPrototype_default(object)) {
|
|
3455
|
-
return nativeKeys_default(object);
|
|
3456
|
-
}
|
|
3457
|
-
var result = [];
|
|
3458
|
-
for (var key in Object(object)) {
|
|
3459
|
-
if (hasOwnProperty10.call(object, key) && key != "constructor") {
|
|
3460
|
-
result.push(key);
|
|
3461
|
-
}
|
|
3462
|
-
}
|
|
3463
|
-
return result;
|
|
3464
|
-
}
|
|
3465
|
-
var baseKeys_default = baseKeys;
|
|
3466
|
-
|
|
3467
|
-
// ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/keys.js
|
|
3468
|
-
function keys(object) {
|
|
3469
|
-
return isArrayLike_default(object) ? arrayLikeKeys_default(object) : baseKeys_default(object);
|
|
3470
|
-
}
|
|
3471
|
-
var keys_default = keys;
|
|
3472
|
-
|
|
3473
|
-
// ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_getAllKeys.js
|
|
3474
|
-
function getAllKeys(object) {
|
|
3475
|
-
return baseGetAllKeys_default(object, keys_default, getSymbols_default);
|
|
3476
|
-
}
|
|
3477
|
-
var getAllKeys_default = getAllKeys;
|
|
3478
|
-
|
|
3479
3917
|
// ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_equalObjects.js
|
|
3480
3918
|
var COMPARE_PARTIAL_FLAG3 = 1;
|
|
3481
|
-
var
|
|
3482
|
-
var
|
|
3919
|
+
var objectProto15 = Object.prototype;
|
|
3920
|
+
var hasOwnProperty12 = objectProto15.hasOwnProperty;
|
|
3483
3921
|
function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
|
|
3484
3922
|
var isPartial = bitmask & COMPARE_PARTIAL_FLAG3, objProps = getAllKeys_default(object), objLength = objProps.length, othProps = getAllKeys_default(other), othLength = othProps.length;
|
|
3485
3923
|
if (objLength != othLength && !isPartial) {
|
|
@@ -3488,7 +3926,7 @@ function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
|
|
|
3488
3926
|
var index = objLength;
|
|
3489
3927
|
while (index--) {
|
|
3490
3928
|
var key = objProps[index];
|
|
3491
|
-
if (!(isPartial ? key in other :
|
|
3929
|
+
if (!(isPartial ? key in other : hasOwnProperty12.call(other, key))) {
|
|
3492
3930
|
return false;
|
|
3493
3931
|
}
|
|
3494
3932
|
}
|
|
@@ -3525,69 +3963,18 @@ function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
|
|
|
3525
3963
|
}
|
|
3526
3964
|
var equalObjects_default = equalObjects;
|
|
3527
3965
|
|
|
3528
|
-
// ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_DataView.js
|
|
3529
|
-
var DataView = getNative_default(root_default, "DataView");
|
|
3530
|
-
var DataView_default = DataView;
|
|
3531
|
-
|
|
3532
|
-
// ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_Promise.js
|
|
3533
|
-
var Promise2 = getNative_default(root_default, "Promise");
|
|
3534
|
-
var Promise_default = Promise2;
|
|
3535
|
-
|
|
3536
|
-
// ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_Set.js
|
|
3537
|
-
var Set2 = getNative_default(root_default, "Set");
|
|
3538
|
-
var Set_default = Set2;
|
|
3539
|
-
|
|
3540
|
-
// ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_WeakMap.js
|
|
3541
|
-
var WeakMap = getNative_default(root_default, "WeakMap");
|
|
3542
|
-
var WeakMap_default = WeakMap;
|
|
3543
|
-
|
|
3544
|
-
// ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_getTag.js
|
|
3545
|
-
var mapTag3 = "[object Map]";
|
|
3546
|
-
var objectTag3 = "[object Object]";
|
|
3547
|
-
var promiseTag = "[object Promise]";
|
|
3548
|
-
var setTag3 = "[object Set]";
|
|
3549
|
-
var weakMapTag2 = "[object WeakMap]";
|
|
3550
|
-
var dataViewTag3 = "[object DataView]";
|
|
3551
|
-
var dataViewCtorString = toSource_default(DataView_default);
|
|
3552
|
-
var mapCtorString = toSource_default(Map_default);
|
|
3553
|
-
var promiseCtorString = toSource_default(Promise_default);
|
|
3554
|
-
var setCtorString = toSource_default(Set_default);
|
|
3555
|
-
var weakMapCtorString = toSource_default(WeakMap_default);
|
|
3556
|
-
var getTag = baseGetTag_default;
|
|
3557
|
-
if (DataView_default && getTag(new DataView_default(new ArrayBuffer(1))) != dataViewTag3 || Map_default && getTag(new Map_default()) != mapTag3 || Promise_default && getTag(Promise_default.resolve()) != promiseTag || Set_default && getTag(new Set_default()) != setTag3 || WeakMap_default && getTag(new WeakMap_default()) != weakMapTag2) {
|
|
3558
|
-
getTag = function(value) {
|
|
3559
|
-
var result = baseGetTag_default(value), Ctor = result == objectTag3 ? value.constructor : void 0, ctorString = Ctor ? toSource_default(Ctor) : "";
|
|
3560
|
-
if (ctorString) {
|
|
3561
|
-
switch (ctorString) {
|
|
3562
|
-
case dataViewCtorString:
|
|
3563
|
-
return dataViewTag3;
|
|
3564
|
-
case mapCtorString:
|
|
3565
|
-
return mapTag3;
|
|
3566
|
-
case promiseCtorString:
|
|
3567
|
-
return promiseTag;
|
|
3568
|
-
case setCtorString:
|
|
3569
|
-
return setTag3;
|
|
3570
|
-
case weakMapCtorString:
|
|
3571
|
-
return weakMapTag2;
|
|
3572
|
-
}
|
|
3573
|
-
}
|
|
3574
|
-
return result;
|
|
3575
|
-
};
|
|
3576
|
-
}
|
|
3577
|
-
var getTag_default = getTag;
|
|
3578
|
-
|
|
3579
3966
|
// ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseIsEqualDeep.js
|
|
3580
3967
|
var COMPARE_PARTIAL_FLAG4 = 1;
|
|
3581
|
-
var
|
|
3582
|
-
var
|
|
3583
|
-
var
|
|
3584
|
-
var
|
|
3585
|
-
var
|
|
3968
|
+
var argsTag4 = "[object Arguments]";
|
|
3969
|
+
var arrayTag3 = "[object Array]";
|
|
3970
|
+
var objectTag5 = "[object Object]";
|
|
3971
|
+
var objectProto16 = Object.prototype;
|
|
3972
|
+
var hasOwnProperty13 = objectProto16.hasOwnProperty;
|
|
3586
3973
|
function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
|
|
3587
|
-
var objIsArr = isArray_default(object), othIsArr = isArray_default(other), objTag = objIsArr ?
|
|
3588
|
-
objTag = objTag ==
|
|
3589
|
-
othTag = othTag ==
|
|
3590
|
-
var objIsObj = objTag ==
|
|
3974
|
+
var objIsArr = isArray_default(object), othIsArr = isArray_default(other), objTag = objIsArr ? arrayTag3 : getTag_default(object), othTag = othIsArr ? arrayTag3 : getTag_default(other);
|
|
3975
|
+
objTag = objTag == argsTag4 ? objectTag5 : objTag;
|
|
3976
|
+
othTag = othTag == argsTag4 ? objectTag5 : othTag;
|
|
3977
|
+
var objIsObj = objTag == objectTag5, othIsObj = othTag == objectTag5, isSameTag = objTag == othTag;
|
|
3591
3978
|
if (isSameTag && isBuffer_default(object)) {
|
|
3592
3979
|
if (!isBuffer_default(other)) {
|
|
3593
3980
|
return false;
|
|
@@ -3600,7 +3987,7 @@ function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
|
|
|
3600
3987
|
return objIsArr || isTypedArray_default(object) ? equalArrays_default(object, other, bitmask, customizer, equalFunc, stack) : equalByTag_default(object, other, objTag, bitmask, customizer, equalFunc, stack);
|
|
3601
3988
|
}
|
|
3602
3989
|
if (!(bitmask & COMPARE_PARTIAL_FLAG4)) {
|
|
3603
|
-
var objIsWrapped = objIsObj &&
|
|
3990
|
+
var objIsWrapped = objIsObj && hasOwnProperty13.call(object, "__wrapped__"), othIsWrapped = othIsObj && hasOwnProperty13.call(other, "__wrapped__");
|
|
3604
3991
|
if (objIsWrapped || othIsWrapped) {
|
|
3605
3992
|
var objUnwrapped = objIsWrapped ? object.value() : object, othUnwrapped = othIsWrapped ? other.value() : other;
|
|
3606
3993
|
stack || (stack = new Stack_default());
|
|
@@ -3645,6 +4032,28 @@ function useStableValue(value) {
|
|
|
3645
4032
|
return stableValue;
|
|
3646
4033
|
}
|
|
3647
4034
|
|
|
4035
|
+
// src/hooks/useReferenceFlipWarning.ts
|
|
4036
|
+
import { useRef as useRef4 } from "react";
|
|
4037
|
+
var __DEV__ = typeof process !== "undefined" && process.env.NODE_ENV !== "production";
|
|
4038
|
+
var FLIP_THRESHOLD = 3;
|
|
4039
|
+
var WARN_COOLDOWN_MS = 5e3;
|
|
4040
|
+
function trackFlip(state, value, propName, now) {
|
|
4041
|
+
if (state.prev === value) return;
|
|
4042
|
+
state.flips++;
|
|
4043
|
+
state.prev = value;
|
|
4044
|
+
if (state.flips < FLIP_THRESHOLD) return;
|
|
4045
|
+
if (now - state.lastWarnAt < WARN_COOLDOWN_MS) return;
|
|
4046
|
+
state.lastWarnAt = now;
|
|
4047
|
+
console.warn(
|
|
4048
|
+
`[AIMarkdown] \`${propName}\` reference is changing on every render. Define it at module scope or wrap with useMemo/useCallback to avoid discarding the per-block memo cache on every parent re-render.`
|
|
4049
|
+
);
|
|
4050
|
+
}
|
|
4051
|
+
function useReferenceFlipWarning(value, propName) {
|
|
4052
|
+
const stateRef = useRef4({ prev: value, flips: 0, lastWarnAt: -Infinity });
|
|
4053
|
+
if (!__DEV__) return;
|
|
4054
|
+
trackFlip(stateRef.current, value, propName, Date.now());
|
|
4055
|
+
}
|
|
4056
|
+
|
|
3648
4057
|
// src/components/typography/Default.tsx
|
|
3649
4058
|
import { memo as memo3, useMemo as useMemo5 } from "react";
|
|
3650
4059
|
import { jsx as jsx7 } from "react/jsx-runtime";
|
|
@@ -3659,6 +4068,13 @@ var DefaultTypography = memo3(({ children, fontSize, variant, colorScheme, style
|
|
|
3659
4068
|
DefaultTypography.displayName = "DefaultTypography";
|
|
3660
4069
|
var Default_default = DefaultTypography;
|
|
3661
4070
|
|
|
4071
|
+
// src/components/extendSanitizeSchema.ts
|
|
4072
|
+
function extendSanitizeSchema(modifier) {
|
|
4073
|
+
const draft = cloneDeep_default(sanitizeSchema);
|
|
4074
|
+
const result = modifier(draft);
|
|
4075
|
+
return result ?? draft;
|
|
4076
|
+
}
|
|
4077
|
+
|
|
3662
4078
|
// src/index.tsx
|
|
3663
4079
|
import { jsx as jsx8 } from "react/jsx-runtime";
|
|
3664
4080
|
var AIMarkdownComponent = ({
|
|
@@ -3674,15 +4090,20 @@ var AIMarkdownComponent = ({
|
|
|
3674
4090
|
ExtraStyles,
|
|
3675
4091
|
variant = "default",
|
|
3676
4092
|
colorScheme = "light",
|
|
3677
|
-
documentId
|
|
4093
|
+
documentId,
|
|
4094
|
+
urlTransform,
|
|
4095
|
+
sanitizeSchema: sanitizeSchema2
|
|
3678
4096
|
}) => {
|
|
3679
4097
|
const usedFontSize = fontSize === void 0 ? "0.9375rem" : typeof fontSize === "number" ? `${fontSize}px` : fontSize;
|
|
3680
4098
|
const generatedId = useId3();
|
|
3681
4099
|
const usedDocumentId = documentId && documentId.length > 0 ? documentId : generatedId;
|
|
4100
|
+
useReferenceFlipWarning(urlTransform, "urlTransform");
|
|
4101
|
+
useReferenceFlipWarning(sanitizeSchema2, "sanitizeSchema");
|
|
3682
4102
|
const stableDefaultConfig = useStableValue(defaultConfig);
|
|
3683
4103
|
const stableConfig = useStableValue(config);
|
|
3684
4104
|
const stablePreprocessors = useStableValue(contentPreprocessors);
|
|
3685
4105
|
const stableCustomComponents = useStableValue(customComponents);
|
|
4106
|
+
const stableSanitizeSchema = useStableValue(sanitizeSchema2);
|
|
3686
4107
|
const usedContent = useMemo6(
|
|
3687
4108
|
() => content ? preprocessAIMDContent(content, stablePreprocessors) : content,
|
|
3688
4109
|
[content, stablePreprocessors]
|
|
@@ -3705,7 +4126,23 @@ var AIMarkdownComponent = ({
|
|
|
3705
4126
|
variant,
|
|
3706
4127
|
colorScheme,
|
|
3707
4128
|
style: typographyStyle,
|
|
3708
|
-
children: ExtraStyles ? /* @__PURE__ */ jsx8(ExtraStyles, { children: /* @__PURE__ */ jsx8(
|
|
4129
|
+
children: ExtraStyles ? /* @__PURE__ */ jsx8(ExtraStyles, { children: /* @__PURE__ */ jsx8(
|
|
4130
|
+
MarkdownContent_default,
|
|
4131
|
+
{
|
|
4132
|
+
content: usedContent,
|
|
4133
|
+
customComponents: stableCustomComponents,
|
|
4134
|
+
urlTransform: urlTransform ?? void 0,
|
|
4135
|
+
sanitizeSchema: stableSanitizeSchema
|
|
4136
|
+
}
|
|
4137
|
+
) }) : /* @__PURE__ */ jsx8(
|
|
4138
|
+
MarkdownContent_default,
|
|
4139
|
+
{
|
|
4140
|
+
content: usedContent,
|
|
4141
|
+
customComponents: stableCustomComponents,
|
|
4142
|
+
urlTransform: urlTransform ?? void 0,
|
|
4143
|
+
sanitizeSchema: stableSanitizeSchema
|
|
4144
|
+
}
|
|
4145
|
+
)
|
|
3709
4146
|
}
|
|
3710
4147
|
)
|
|
3711
4148
|
}
|
|
@@ -3720,6 +4157,8 @@ export {
|
|
|
3720
4157
|
AIMarkdownRenderExtraSyntax,
|
|
3721
4158
|
index_default as default,
|
|
3722
4159
|
defaultAIMarkdownRenderConfig,
|
|
4160
|
+
defaultUrlTransform,
|
|
4161
|
+
extendSanitizeSchema,
|
|
3723
4162
|
useAIMarkdownMetadata,
|
|
3724
4163
|
useAIMarkdownRenderState,
|
|
3725
4164
|
useDocumentRegistry,
|