@aehrc/ecl-core 1.1.2 → 1.3.0
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/index.cjs +1388 -786
- package/dist/index.d.ts +359 -1
- package/dist/index.mjs +1388 -786
- package/package.json +5 -5
package/dist/index.mjs
CHANGED
|
@@ -1582,10 +1582,10 @@ function requireCallBind() {
|
|
|
1582
1582
|
var applyBind2 = requireApplyBind();
|
|
1583
1583
|
module.exports = function callBind2(originalFunction) {
|
|
1584
1584
|
var func = callBindBasic(arguments);
|
|
1585
|
-
var adjustedLength = originalFunction.length - (arguments.length - 1);
|
|
1585
|
+
var adjustedLength = 1 + originalFunction.length - (arguments.length - 1);
|
|
1586
1586
|
return setFunctionLength2(
|
|
1587
1587
|
func,
|
|
1588
|
-
|
|
1588
|
+
adjustedLength > 0 ? adjustedLength : 0,
|
|
1589
1589
|
true
|
|
1590
1590
|
);
|
|
1591
1591
|
};
|
|
@@ -1635,7 +1635,7 @@ function requireWhichTypedArray() {
|
|
|
1635
1635
|
if (descriptor && descriptor.get) {
|
|
1636
1636
|
var bound = callBind2(descriptor.get);
|
|
1637
1637
|
cache2[
|
|
1638
|
-
/** @type {`$${
|
|
1638
|
+
/** @type {`$${TypedArrayName}`} */
|
|
1639
1639
|
"$" + typedArray
|
|
1640
1640
|
] = bound;
|
|
1641
1641
|
}
|
|
@@ -1647,28 +1647,28 @@ function requireWhichTypedArray() {
|
|
|
1647
1647
|
var fn = arr.slice || arr.set;
|
|
1648
1648
|
if (fn) {
|
|
1649
1649
|
var bound = (
|
|
1650
|
-
/** @type {
|
|
1650
|
+
/** @type {BoundSlice | BoundSet} */
|
|
1651
1651
|
// @ts-expect-error TODO FIXME
|
|
1652
1652
|
callBind2(fn)
|
|
1653
1653
|
);
|
|
1654
1654
|
cache2[
|
|
1655
|
-
/** @type {`$${
|
|
1655
|
+
/** @type {`$${TypedArrayName}`} */
|
|
1656
1656
|
"$" + typedArray
|
|
1657
1657
|
] = bound;
|
|
1658
1658
|
}
|
|
1659
1659
|
});
|
|
1660
1660
|
}
|
|
1661
|
-
|
|
1661
|
+
function tryTypedArrays(value) {
|
|
1662
1662
|
var found = false;
|
|
1663
1663
|
forEach2(
|
|
1664
|
-
/** @type {Record
|
|
1664
|
+
/** @type {Record<`$${TypedArrayName}`, Getter>} */
|
|
1665
1665
|
cache2,
|
|
1666
|
-
/** @
|
|
1666
|
+
/** @param {Getter} getter @param {`$${TypedArrayName}`} typedArray */
|
|
1667
1667
|
function(getter, typedArray) {
|
|
1668
1668
|
if (!found) {
|
|
1669
1669
|
try {
|
|
1670
1670
|
if ("$" + getter(value) === typedArray) {
|
|
1671
|
-
found = /** @type {
|
|
1671
|
+
found = /** @type {TypedArrayName} */
|
|
1672
1672
|
$slice(typedArray, 1);
|
|
1673
1673
|
}
|
|
1674
1674
|
} catch (e) {
|
|
@@ -1677,18 +1677,18 @@ function requireWhichTypedArray() {
|
|
|
1677
1677
|
}
|
|
1678
1678
|
);
|
|
1679
1679
|
return found;
|
|
1680
|
-
}
|
|
1681
|
-
|
|
1680
|
+
}
|
|
1681
|
+
function trySlices(value) {
|
|
1682
1682
|
var found = false;
|
|
1683
1683
|
forEach2(
|
|
1684
|
-
/** @type {Record
|
|
1684
|
+
/** @type {Record<`$${TypedArrayName}`, Getter>} */
|
|
1685
1685
|
cache2,
|
|
1686
|
-
/** @
|
|
1686
|
+
/** @param {Getter} getter @param {`$${TypedArrayName}`} name */
|
|
1687
1687
|
function(getter, name) {
|
|
1688
1688
|
if (!found) {
|
|
1689
1689
|
try {
|
|
1690
1690
|
getter(value);
|
|
1691
|
-
found = /** @type {
|
|
1691
|
+
found = /** @type {TypedArrayName} */
|
|
1692
1692
|
$slice(name, 1);
|
|
1693
1693
|
} catch (e) {
|
|
1694
1694
|
}
|
|
@@ -1696,14 +1696,17 @@ function requireWhichTypedArray() {
|
|
|
1696
1696
|
}
|
|
1697
1697
|
);
|
|
1698
1698
|
return found;
|
|
1699
|
-
}
|
|
1699
|
+
}
|
|
1700
|
+
function isTATag(tag) {
|
|
1701
|
+
return $indexOf(typedArrays, tag) > -1;
|
|
1702
|
+
}
|
|
1700
1703
|
whichTypedArray = function whichTypedArray2(value) {
|
|
1701
1704
|
if (!value || typeof value !== "object") {
|
|
1702
1705
|
return false;
|
|
1703
1706
|
}
|
|
1704
1707
|
if (!hasToStringTag) {
|
|
1705
1708
|
var tag = $slice($toString(value), 8, -1);
|
|
1706
|
-
if (
|
|
1709
|
+
if (isTATag(tag)) {
|
|
1707
1710
|
return tag;
|
|
1708
1711
|
}
|
|
1709
1712
|
if (tag !== "Object") {
|
|
@@ -1733,7 +1736,7 @@ var hasRequiredTypes;
|
|
|
1733
1736
|
function requireTypes() {
|
|
1734
1737
|
if (hasRequiredTypes) return types;
|
|
1735
1738
|
hasRequiredTypes = 1;
|
|
1736
|
-
(function(exports
|
|
1739
|
+
(function(exports) {
|
|
1737
1740
|
var isArgumentsObject = /* @__PURE__ */ requireIsArguments$1();
|
|
1738
1741
|
var isGeneratorFunction2 = requireIsGeneratorFunction();
|
|
1739
1742
|
var whichTypedArray2 = /* @__PURE__ */ requireWhichTypedArray();
|
|
@@ -1764,64 +1767,64 @@ function requireTypes() {
|
|
|
1764
1767
|
return false;
|
|
1765
1768
|
}
|
|
1766
1769
|
}
|
|
1767
|
-
exports
|
|
1768
|
-
exports
|
|
1769
|
-
exports
|
|
1770
|
+
exports.isArgumentsObject = isArgumentsObject;
|
|
1771
|
+
exports.isGeneratorFunction = isGeneratorFunction2;
|
|
1772
|
+
exports.isTypedArray = isTypedArray2;
|
|
1770
1773
|
function isPromise(input) {
|
|
1771
1774
|
return typeof Promise !== "undefined" && input instanceof Promise || input !== null && typeof input === "object" && typeof input.then === "function" && typeof input.catch === "function";
|
|
1772
1775
|
}
|
|
1773
|
-
exports
|
|
1776
|
+
exports.isPromise = isPromise;
|
|
1774
1777
|
function isArrayBufferView(value) {
|
|
1775
1778
|
if (typeof ArrayBuffer !== "undefined" && ArrayBuffer.isView) {
|
|
1776
1779
|
return ArrayBuffer.isView(value);
|
|
1777
1780
|
}
|
|
1778
1781
|
return isTypedArray2(value) || isDataView(value);
|
|
1779
1782
|
}
|
|
1780
|
-
exports
|
|
1783
|
+
exports.isArrayBufferView = isArrayBufferView;
|
|
1781
1784
|
function isUint8Array(value) {
|
|
1782
1785
|
return whichTypedArray2(value) === "Uint8Array";
|
|
1783
1786
|
}
|
|
1784
|
-
exports
|
|
1787
|
+
exports.isUint8Array = isUint8Array;
|
|
1785
1788
|
function isUint8ClampedArray(value) {
|
|
1786
1789
|
return whichTypedArray2(value) === "Uint8ClampedArray";
|
|
1787
1790
|
}
|
|
1788
|
-
exports
|
|
1791
|
+
exports.isUint8ClampedArray = isUint8ClampedArray;
|
|
1789
1792
|
function isUint16Array(value) {
|
|
1790
1793
|
return whichTypedArray2(value) === "Uint16Array";
|
|
1791
1794
|
}
|
|
1792
|
-
exports
|
|
1795
|
+
exports.isUint16Array = isUint16Array;
|
|
1793
1796
|
function isUint32Array(value) {
|
|
1794
1797
|
return whichTypedArray2(value) === "Uint32Array";
|
|
1795
1798
|
}
|
|
1796
|
-
exports
|
|
1799
|
+
exports.isUint32Array = isUint32Array;
|
|
1797
1800
|
function isInt8Array(value) {
|
|
1798
1801
|
return whichTypedArray2(value) === "Int8Array";
|
|
1799
1802
|
}
|
|
1800
|
-
exports
|
|
1803
|
+
exports.isInt8Array = isInt8Array;
|
|
1801
1804
|
function isInt16Array(value) {
|
|
1802
1805
|
return whichTypedArray2(value) === "Int16Array";
|
|
1803
1806
|
}
|
|
1804
|
-
exports
|
|
1807
|
+
exports.isInt16Array = isInt16Array;
|
|
1805
1808
|
function isInt32Array(value) {
|
|
1806
1809
|
return whichTypedArray2(value) === "Int32Array";
|
|
1807
1810
|
}
|
|
1808
|
-
exports
|
|
1811
|
+
exports.isInt32Array = isInt32Array;
|
|
1809
1812
|
function isFloat32Array(value) {
|
|
1810
1813
|
return whichTypedArray2(value) === "Float32Array";
|
|
1811
1814
|
}
|
|
1812
|
-
exports
|
|
1815
|
+
exports.isFloat32Array = isFloat32Array;
|
|
1813
1816
|
function isFloat64Array(value) {
|
|
1814
1817
|
return whichTypedArray2(value) === "Float64Array";
|
|
1815
1818
|
}
|
|
1816
|
-
exports
|
|
1819
|
+
exports.isFloat64Array = isFloat64Array;
|
|
1817
1820
|
function isBigInt64Array(value) {
|
|
1818
1821
|
return whichTypedArray2(value) === "BigInt64Array";
|
|
1819
1822
|
}
|
|
1820
|
-
exports
|
|
1823
|
+
exports.isBigInt64Array = isBigInt64Array;
|
|
1821
1824
|
function isBigUint64Array(value) {
|
|
1822
1825
|
return whichTypedArray2(value) === "BigUint64Array";
|
|
1823
1826
|
}
|
|
1824
|
-
exports
|
|
1827
|
+
exports.isBigUint64Array = isBigUint64Array;
|
|
1825
1828
|
function isMapToString(value) {
|
|
1826
1829
|
return ObjectToString(value) === "[object Map]";
|
|
1827
1830
|
}
|
|
@@ -1832,7 +1835,7 @@ function requireTypes() {
|
|
|
1832
1835
|
}
|
|
1833
1836
|
return isMapToString.working ? isMapToString(value) : value instanceof Map;
|
|
1834
1837
|
}
|
|
1835
|
-
exports
|
|
1838
|
+
exports.isMap = isMap;
|
|
1836
1839
|
function isSetToString(value) {
|
|
1837
1840
|
return ObjectToString(value) === "[object Set]";
|
|
1838
1841
|
}
|
|
@@ -1843,7 +1846,7 @@ function requireTypes() {
|
|
|
1843
1846
|
}
|
|
1844
1847
|
return isSetToString.working ? isSetToString(value) : value instanceof Set;
|
|
1845
1848
|
}
|
|
1846
|
-
exports
|
|
1849
|
+
exports.isSet = isSet;
|
|
1847
1850
|
function isWeakMapToString(value) {
|
|
1848
1851
|
return ObjectToString(value) === "[object WeakMap]";
|
|
1849
1852
|
}
|
|
@@ -1854,7 +1857,7 @@ function requireTypes() {
|
|
|
1854
1857
|
}
|
|
1855
1858
|
return isWeakMapToString.working ? isWeakMapToString(value) : value instanceof WeakMap;
|
|
1856
1859
|
}
|
|
1857
|
-
exports
|
|
1860
|
+
exports.isWeakMap = isWeakMap;
|
|
1858
1861
|
function isWeakSetToString(value) {
|
|
1859
1862
|
return ObjectToString(value) === "[object WeakSet]";
|
|
1860
1863
|
}
|
|
@@ -1862,7 +1865,7 @@ function requireTypes() {
|
|
|
1862
1865
|
function isWeakSet(value) {
|
|
1863
1866
|
return isWeakSetToString(value);
|
|
1864
1867
|
}
|
|
1865
|
-
exports
|
|
1868
|
+
exports.isWeakSet = isWeakSet;
|
|
1866
1869
|
function isArrayBufferToString(value) {
|
|
1867
1870
|
return ObjectToString(value) === "[object ArrayBuffer]";
|
|
1868
1871
|
}
|
|
@@ -1873,7 +1876,7 @@ function requireTypes() {
|
|
|
1873
1876
|
}
|
|
1874
1877
|
return isArrayBufferToString.working ? isArrayBufferToString(value) : value instanceof ArrayBuffer;
|
|
1875
1878
|
}
|
|
1876
|
-
exports
|
|
1879
|
+
exports.isArrayBuffer = isArrayBuffer;
|
|
1877
1880
|
function isDataViewToString(value) {
|
|
1878
1881
|
return ObjectToString(value) === "[object DataView]";
|
|
1879
1882
|
}
|
|
@@ -1884,7 +1887,7 @@ function requireTypes() {
|
|
|
1884
1887
|
}
|
|
1885
1888
|
return isDataViewToString.working ? isDataViewToString(value) : value instanceof DataView;
|
|
1886
1889
|
}
|
|
1887
|
-
exports
|
|
1890
|
+
exports.isDataView = isDataView;
|
|
1888
1891
|
var SharedArrayBufferCopy = typeof SharedArrayBuffer !== "undefined" ? SharedArrayBuffer : void 0;
|
|
1889
1892
|
function isSharedArrayBufferToString(value) {
|
|
1890
1893
|
return ObjectToString(value) === "[object SharedArrayBuffer]";
|
|
@@ -1898,57 +1901,57 @@ function requireTypes() {
|
|
|
1898
1901
|
}
|
|
1899
1902
|
return isSharedArrayBufferToString.working ? isSharedArrayBufferToString(value) : value instanceof SharedArrayBufferCopy;
|
|
1900
1903
|
}
|
|
1901
|
-
exports
|
|
1904
|
+
exports.isSharedArrayBuffer = isSharedArrayBuffer;
|
|
1902
1905
|
function isAsyncFunction(value) {
|
|
1903
1906
|
return ObjectToString(value) === "[object AsyncFunction]";
|
|
1904
1907
|
}
|
|
1905
|
-
exports
|
|
1908
|
+
exports.isAsyncFunction = isAsyncFunction;
|
|
1906
1909
|
function isMapIterator(value) {
|
|
1907
1910
|
return ObjectToString(value) === "[object Map Iterator]";
|
|
1908
1911
|
}
|
|
1909
|
-
exports
|
|
1912
|
+
exports.isMapIterator = isMapIterator;
|
|
1910
1913
|
function isSetIterator(value) {
|
|
1911
1914
|
return ObjectToString(value) === "[object Set Iterator]";
|
|
1912
1915
|
}
|
|
1913
|
-
exports
|
|
1916
|
+
exports.isSetIterator = isSetIterator;
|
|
1914
1917
|
function isGeneratorObject(value) {
|
|
1915
1918
|
return ObjectToString(value) === "[object Generator]";
|
|
1916
1919
|
}
|
|
1917
|
-
exports
|
|
1920
|
+
exports.isGeneratorObject = isGeneratorObject;
|
|
1918
1921
|
function isWebAssemblyCompiledModule(value) {
|
|
1919
1922
|
return ObjectToString(value) === "[object WebAssembly.Module]";
|
|
1920
1923
|
}
|
|
1921
|
-
exports
|
|
1924
|
+
exports.isWebAssemblyCompiledModule = isWebAssemblyCompiledModule;
|
|
1922
1925
|
function isNumberObject(value) {
|
|
1923
1926
|
return checkBoxedPrimitive(value, numberValue);
|
|
1924
1927
|
}
|
|
1925
|
-
exports
|
|
1928
|
+
exports.isNumberObject = isNumberObject;
|
|
1926
1929
|
function isStringObject(value) {
|
|
1927
1930
|
return checkBoxedPrimitive(value, stringValue);
|
|
1928
1931
|
}
|
|
1929
|
-
exports
|
|
1932
|
+
exports.isStringObject = isStringObject;
|
|
1930
1933
|
function isBooleanObject(value) {
|
|
1931
1934
|
return checkBoxedPrimitive(value, booleanValue);
|
|
1932
1935
|
}
|
|
1933
|
-
exports
|
|
1936
|
+
exports.isBooleanObject = isBooleanObject;
|
|
1934
1937
|
function isBigIntObject(value) {
|
|
1935
1938
|
return BigIntSupported && checkBoxedPrimitive(value, bigIntValue);
|
|
1936
1939
|
}
|
|
1937
|
-
exports
|
|
1940
|
+
exports.isBigIntObject = isBigIntObject;
|
|
1938
1941
|
function isSymbolObject(value) {
|
|
1939
1942
|
return SymbolSupported && checkBoxedPrimitive(value, symbolValue);
|
|
1940
1943
|
}
|
|
1941
|
-
exports
|
|
1944
|
+
exports.isSymbolObject = isSymbolObject;
|
|
1942
1945
|
function isBoxedPrimitive(value) {
|
|
1943
1946
|
return isNumberObject(value) || isStringObject(value) || isBooleanObject(value) || isBigIntObject(value) || isSymbolObject(value);
|
|
1944
1947
|
}
|
|
1945
|
-
exports
|
|
1948
|
+
exports.isBoxedPrimitive = isBoxedPrimitive;
|
|
1946
1949
|
function isAnyArrayBuffer(value) {
|
|
1947
1950
|
return typeof Uint8Array !== "undefined" && (isArrayBuffer(value) || isSharedArrayBuffer(value));
|
|
1948
1951
|
}
|
|
1949
|
-
exports
|
|
1952
|
+
exports.isAnyArrayBuffer = isAnyArrayBuffer;
|
|
1950
1953
|
["isProxy", "isExternal", "isModuleNamespaceObject"].forEach(function(method) {
|
|
1951
|
-
Object.defineProperty(exports
|
|
1954
|
+
Object.defineProperty(exports, method, {
|
|
1952
1955
|
enumerable: false,
|
|
1953
1956
|
value: function() {
|
|
1954
1957
|
throw new Error(method + " is not supported in userland");
|
|
@@ -2005,7 +2008,7 @@ var hasRequiredUtil;
|
|
|
2005
2008
|
function requireUtil() {
|
|
2006
2009
|
if (hasRequiredUtil) return util;
|
|
2007
2010
|
hasRequiredUtil = 1;
|
|
2008
|
-
(function(exports
|
|
2011
|
+
(function(exports) {
|
|
2009
2012
|
var getOwnPropertyDescriptors = Object.getOwnPropertyDescriptors || function getOwnPropertyDescriptors2(obj) {
|
|
2010
2013
|
var keys = Object.keys(obj);
|
|
2011
2014
|
var descriptors = {};
|
|
@@ -2015,7 +2018,7 @@ function requireUtil() {
|
|
|
2015
2018
|
return descriptors;
|
|
2016
2019
|
};
|
|
2017
2020
|
var formatRegExp = /%[sdj%]/g;
|
|
2018
|
-
exports
|
|
2021
|
+
exports.format = function(f) {
|
|
2019
2022
|
if (!isString(f)) {
|
|
2020
2023
|
var objects = [];
|
|
2021
2024
|
for (var i = 0; i < arguments.length; i++) {
|
|
@@ -2053,13 +2056,13 @@ function requireUtil() {
|
|
|
2053
2056
|
}
|
|
2054
2057
|
return str;
|
|
2055
2058
|
};
|
|
2056
|
-
exports
|
|
2059
|
+
exports.deprecate = function(fn, msg) {
|
|
2057
2060
|
if (typeof process$1 !== "undefined" && process$1.noDeprecation === true) {
|
|
2058
2061
|
return fn;
|
|
2059
2062
|
}
|
|
2060
2063
|
if (typeof process$1 === "undefined") {
|
|
2061
2064
|
return function() {
|
|
2062
|
-
return exports
|
|
2065
|
+
return exports.deprecate(fn, msg).apply(this, arguments);
|
|
2063
2066
|
};
|
|
2064
2067
|
}
|
|
2065
2068
|
var warned = false;
|
|
@@ -2085,13 +2088,13 @@ function requireUtil() {
|
|
|
2085
2088
|
debugEnv = debugEnv.replace(/[|\\{}()[\]^$+?.]/g, "\\$&").replace(/\*/g, ".*").replace(/,/g, "$|^").toUpperCase();
|
|
2086
2089
|
debugEnvRegex = new RegExp("^" + debugEnv + "$", "i");
|
|
2087
2090
|
}
|
|
2088
|
-
exports
|
|
2091
|
+
exports.debuglog = function(set) {
|
|
2089
2092
|
set = set.toUpperCase();
|
|
2090
2093
|
if (!debugs[set]) {
|
|
2091
2094
|
if (debugEnvRegex.test(set)) {
|
|
2092
2095
|
var pid = process$1.pid;
|
|
2093
2096
|
debugs[set] = function() {
|
|
2094
|
-
var msg = exports
|
|
2097
|
+
var msg = exports.format.apply(exports, arguments);
|
|
2095
2098
|
console.error("%s %d: %s", set, pid, msg);
|
|
2096
2099
|
};
|
|
2097
2100
|
} else {
|
|
@@ -2111,7 +2114,7 @@ function requireUtil() {
|
|
|
2111
2114
|
if (isBoolean(opts)) {
|
|
2112
2115
|
ctx.showHidden = opts;
|
|
2113
2116
|
} else if (opts) {
|
|
2114
|
-
exports
|
|
2117
|
+
exports._extend(ctx, opts);
|
|
2115
2118
|
}
|
|
2116
2119
|
if (isUndefined(ctx.showHidden)) ctx.showHidden = false;
|
|
2117
2120
|
if (isUndefined(ctx.depth)) ctx.depth = 2;
|
|
@@ -2120,7 +2123,7 @@ function requireUtil() {
|
|
|
2120
2123
|
if (ctx.colors) ctx.stylize = stylizeWithColor;
|
|
2121
2124
|
return formatValue(ctx, obj, ctx.depth);
|
|
2122
2125
|
}
|
|
2123
|
-
exports
|
|
2126
|
+
exports.inspect = inspect;
|
|
2124
2127
|
inspect.colors = {
|
|
2125
2128
|
"bold": [1, 22],
|
|
2126
2129
|
"italic": [3, 23],
|
|
@@ -2167,7 +2170,7 @@ function requireUtil() {
|
|
|
2167
2170
|
}
|
|
2168
2171
|
function formatValue(ctx, value, recurseTimes) {
|
|
2169
2172
|
if (ctx.customInspect && value && isFunction(value.inspect) && // Filter out the util module, it's inspect function is special
|
|
2170
|
-
value.inspect !== exports
|
|
2173
|
+
value.inspect !== exports.inspect && // Also filter out any prototype objects using the circular check.
|
|
2171
2174
|
!(value.constructor && value.constructor.prototype === value)) {
|
|
2172
2175
|
var ret = value.inspect(recurseTimes, ctx);
|
|
2173
2176
|
if (!isString(ret)) {
|
|
@@ -2353,68 +2356,68 @@ function requireUtil() {
|
|
|
2353
2356
|
}
|
|
2354
2357
|
return braces[0] + base + " " + output.join(", ") + " " + braces[1];
|
|
2355
2358
|
}
|
|
2356
|
-
exports
|
|
2359
|
+
exports.types = requireTypes();
|
|
2357
2360
|
function isArray(ar) {
|
|
2358
2361
|
return Array.isArray(ar);
|
|
2359
2362
|
}
|
|
2360
|
-
exports
|
|
2363
|
+
exports.isArray = isArray;
|
|
2361
2364
|
function isBoolean(arg) {
|
|
2362
2365
|
return typeof arg === "boolean";
|
|
2363
2366
|
}
|
|
2364
|
-
exports
|
|
2367
|
+
exports.isBoolean = isBoolean;
|
|
2365
2368
|
function isNull(arg) {
|
|
2366
2369
|
return arg === null;
|
|
2367
2370
|
}
|
|
2368
|
-
exports
|
|
2371
|
+
exports.isNull = isNull;
|
|
2369
2372
|
function isNullOrUndefined(arg) {
|
|
2370
2373
|
return arg == null;
|
|
2371
2374
|
}
|
|
2372
|
-
exports
|
|
2375
|
+
exports.isNullOrUndefined = isNullOrUndefined;
|
|
2373
2376
|
function isNumber(arg) {
|
|
2374
2377
|
return typeof arg === "number";
|
|
2375
2378
|
}
|
|
2376
|
-
exports
|
|
2379
|
+
exports.isNumber = isNumber;
|
|
2377
2380
|
function isString(arg) {
|
|
2378
2381
|
return typeof arg === "string";
|
|
2379
2382
|
}
|
|
2380
|
-
exports
|
|
2383
|
+
exports.isString = isString;
|
|
2381
2384
|
function isSymbol(arg) {
|
|
2382
2385
|
return typeof arg === "symbol";
|
|
2383
2386
|
}
|
|
2384
|
-
exports
|
|
2387
|
+
exports.isSymbol = isSymbol;
|
|
2385
2388
|
function isUndefined(arg) {
|
|
2386
2389
|
return arg === void 0;
|
|
2387
2390
|
}
|
|
2388
|
-
exports
|
|
2391
|
+
exports.isUndefined = isUndefined;
|
|
2389
2392
|
function isRegExp(re) {
|
|
2390
2393
|
return isObject(re) && objectToString(re) === "[object RegExp]";
|
|
2391
2394
|
}
|
|
2392
|
-
exports
|
|
2393
|
-
exports
|
|
2395
|
+
exports.isRegExp = isRegExp;
|
|
2396
|
+
exports.types.isRegExp = isRegExp;
|
|
2394
2397
|
function isObject(arg) {
|
|
2395
2398
|
return typeof arg === "object" && arg !== null;
|
|
2396
2399
|
}
|
|
2397
|
-
exports
|
|
2400
|
+
exports.isObject = isObject;
|
|
2398
2401
|
function isDate(d) {
|
|
2399
2402
|
return isObject(d) && objectToString(d) === "[object Date]";
|
|
2400
2403
|
}
|
|
2401
|
-
exports
|
|
2402
|
-
exports
|
|
2404
|
+
exports.isDate = isDate;
|
|
2405
|
+
exports.types.isDate = isDate;
|
|
2403
2406
|
function isError(e) {
|
|
2404
2407
|
return isObject(e) && (objectToString(e) === "[object Error]" || e instanceof Error);
|
|
2405
2408
|
}
|
|
2406
|
-
exports
|
|
2407
|
-
exports
|
|
2409
|
+
exports.isError = isError;
|
|
2410
|
+
exports.types.isNativeError = isError;
|
|
2408
2411
|
function isFunction(arg) {
|
|
2409
2412
|
return typeof arg === "function";
|
|
2410
2413
|
}
|
|
2411
|
-
exports
|
|
2414
|
+
exports.isFunction = isFunction;
|
|
2412
2415
|
function isPrimitive(arg) {
|
|
2413
2416
|
return arg === null || typeof arg === "boolean" || typeof arg === "number" || typeof arg === "string" || typeof arg === "symbol" || // ES6 symbol
|
|
2414
2417
|
typeof arg === "undefined";
|
|
2415
2418
|
}
|
|
2416
|
-
exports
|
|
2417
|
-
exports
|
|
2419
|
+
exports.isPrimitive = isPrimitive;
|
|
2420
|
+
exports.isBuffer = requireIsBufferBrowser();
|
|
2418
2421
|
function objectToString(o) {
|
|
2419
2422
|
return Object.prototype.toString.call(o);
|
|
2420
2423
|
}
|
|
@@ -2444,11 +2447,11 @@ function requireUtil() {
|
|
|
2444
2447
|
].join(":");
|
|
2445
2448
|
return [d.getDate(), months[d.getMonth()], time].join(" ");
|
|
2446
2449
|
}
|
|
2447
|
-
exports
|
|
2448
|
-
console.log("%s - %s", timestamp(), exports
|
|
2450
|
+
exports.log = function() {
|
|
2451
|
+
console.log("%s - %s", timestamp(), exports.format.apply(exports, arguments));
|
|
2449
2452
|
};
|
|
2450
|
-
exports
|
|
2451
|
-
exports
|
|
2453
|
+
exports.inherits = requireInherits_browser();
|
|
2454
|
+
exports._extend = function(origin, add) {
|
|
2452
2455
|
if (!add || !isObject(add)) return origin;
|
|
2453
2456
|
var keys = Object.keys(add);
|
|
2454
2457
|
var i = keys.length;
|
|
@@ -2461,7 +2464,7 @@ function requireUtil() {
|
|
|
2461
2464
|
return Object.prototype.hasOwnProperty.call(obj, prop);
|
|
2462
2465
|
}
|
|
2463
2466
|
var kCustomPromisifiedSymbol = typeof Symbol !== "undefined" ? Symbol("util.promisify.custom") : void 0;
|
|
2464
|
-
exports
|
|
2467
|
+
exports.promisify = function promisify(original) {
|
|
2465
2468
|
if (typeof original !== "function")
|
|
2466
2469
|
throw new TypeError('The "original" argument must be of type Function');
|
|
2467
2470
|
if (kCustomPromisifiedSymbol && original[kCustomPromisifiedSymbol]) {
|
|
@@ -2513,7 +2516,7 @@ function requireUtil() {
|
|
|
2513
2516
|
getOwnPropertyDescriptors(original)
|
|
2514
2517
|
);
|
|
2515
2518
|
};
|
|
2516
|
-
exports
|
|
2519
|
+
exports.promisify.custom = kCustomPromisifiedSymbol;
|
|
2517
2520
|
function callbackifyOnRejected(reason, cb) {
|
|
2518
2521
|
if (!reason) {
|
|
2519
2522
|
var newReason = new Error("Promise was rejected with a falsy value");
|
|
@@ -2555,7 +2558,7 @@ function requireUtil() {
|
|
|
2555
2558
|
);
|
|
2556
2559
|
return callbackified;
|
|
2557
2560
|
}
|
|
2558
|
-
exports
|
|
2561
|
+
exports.callbackify = callbackify;
|
|
2559
2562
|
})(util);
|
|
2560
2563
|
return util;
|
|
2561
2564
|
}
|
|
@@ -4765,17 +4768,17 @@ var hasRequiredIntStream;
|
|
|
4765
4768
|
function requireIntStream() {
|
|
4766
4769
|
if (hasRequiredIntStream) return IntStream;
|
|
4767
4770
|
hasRequiredIntStream = 1;
|
|
4768
|
-
(function(exports
|
|
4771
|
+
(function(exports) {
|
|
4769
4772
|
/*!
|
|
4770
4773
|
* Copyright 2016 The ANTLR Project. All rights reserved.
|
|
4771
4774
|
* Licensed under the BSD-3-Clause license. See LICENSE file in the project root for license information.
|
|
4772
4775
|
*/
|
|
4773
|
-
Object.defineProperty(exports
|
|
4774
|
-
exports
|
|
4776
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4777
|
+
exports.IntStream = void 0;
|
|
4775
4778
|
(function(IntStream2) {
|
|
4776
4779
|
IntStream2.EOF = -1;
|
|
4777
4780
|
IntStream2.UNKNOWN_SOURCE_NAME = "<unknown>";
|
|
4778
|
-
})(exports
|
|
4781
|
+
})(exports.IntStream || (exports.IntStream = {}));
|
|
4779
4782
|
})(IntStream);
|
|
4780
4783
|
return IntStream;
|
|
4781
4784
|
}
|
|
@@ -4930,7 +4933,7 @@ var hasRequiredATNState;
|
|
|
4930
4933
|
function requireATNState() {
|
|
4931
4934
|
if (hasRequiredATNState) return ATNState;
|
|
4932
4935
|
hasRequiredATNState = 1;
|
|
4933
|
-
(function(exports
|
|
4936
|
+
(function(exports) {
|
|
4934
4937
|
/*!
|
|
4935
4938
|
* Copyright 2016 The ANTLR Project. All rights reserved.
|
|
4936
4939
|
* Licensed under the BSD-3-Clause license. See LICENSE file in the project root for license information.
|
|
@@ -4941,8 +4944,8 @@ function requireATNState() {
|
|
|
4941
4944
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
4942
4945
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
4943
4946
|
};
|
|
4944
|
-
Object.defineProperty(exports
|
|
4945
|
-
exports
|
|
4947
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4948
|
+
exports.ATNState = void 0;
|
|
4946
4949
|
const Decorators_1 = requireDecorators();
|
|
4947
4950
|
let ATNState$1 = class ATNState2 {
|
|
4948
4951
|
constructor() {
|
|
@@ -5051,10 +5054,10 @@ function requireATNState() {
|
|
|
5051
5054
|
__decorate([
|
|
5052
5055
|
Decorators_1.Override
|
|
5053
5056
|
], ATNState$1.prototype, "toString", null);
|
|
5054
|
-
exports
|
|
5057
|
+
exports.ATNState = ATNState$1;
|
|
5055
5058
|
(function(ATNState2) {
|
|
5056
5059
|
ATNState2.INVALID_STATE_NUMBER = -1;
|
|
5057
|
-
})(ATNState$1 = exports
|
|
5060
|
+
})(ATNState$1 = exports.ATNState || (exports.ATNState = {}));
|
|
5058
5061
|
})(ATNState);
|
|
5059
5062
|
return ATNState;
|
|
5060
5063
|
}
|
|
@@ -5063,13 +5066,13 @@ var hasRequiredATNStateType;
|
|
|
5063
5066
|
function requireATNStateType() {
|
|
5064
5067
|
if (hasRequiredATNStateType) return ATNStateType;
|
|
5065
5068
|
hasRequiredATNStateType = 1;
|
|
5066
|
-
(function(exports
|
|
5069
|
+
(function(exports) {
|
|
5067
5070
|
/*!
|
|
5068
5071
|
* Copyright 2016 The ANTLR Project. All rights reserved.
|
|
5069
5072
|
* Licensed under the BSD-3-Clause license. See LICENSE file in the project root for license information.
|
|
5070
5073
|
*/
|
|
5071
|
-
Object.defineProperty(exports
|
|
5072
|
-
exports
|
|
5074
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5075
|
+
exports.ATNStateType = void 0;
|
|
5073
5076
|
(function(ATNStateType2) {
|
|
5074
5077
|
ATNStateType2[ATNStateType2["INVALID_TYPE"] = 0] = "INVALID_TYPE";
|
|
5075
5078
|
ATNStateType2[ATNStateType2["BASIC"] = 1] = "BASIC";
|
|
@@ -5084,7 +5087,7 @@ function requireATNStateType() {
|
|
|
5084
5087
|
ATNStateType2[ATNStateType2["STAR_LOOP_ENTRY"] = 10] = "STAR_LOOP_ENTRY";
|
|
5085
5088
|
ATNStateType2[ATNStateType2["PLUS_LOOP_BACK"] = 11] = "PLUS_LOOP_BACK";
|
|
5086
5089
|
ATNStateType2[ATNStateType2["LOOP_END"] = 12] = "LOOP_END";
|
|
5087
|
-
})(exports
|
|
5090
|
+
})(exports.ATNStateType || (exports.ATNStateType = {}));
|
|
5088
5091
|
})(ATNStateType);
|
|
5089
5092
|
return ATNStateType;
|
|
5090
5093
|
}
|
|
@@ -5289,13 +5292,13 @@ var hasRequiredMurmurHash;
|
|
|
5289
5292
|
function requireMurmurHash() {
|
|
5290
5293
|
if (hasRequiredMurmurHash) return MurmurHash;
|
|
5291
5294
|
hasRequiredMurmurHash = 1;
|
|
5292
|
-
(function(exports
|
|
5295
|
+
(function(exports) {
|
|
5293
5296
|
/*!
|
|
5294
5297
|
* Copyright 2016 The ANTLR Project. All rights reserved.
|
|
5295
5298
|
* Licensed under the BSD-3-Clause license. See LICENSE file in the project root for license information.
|
|
5296
5299
|
*/
|
|
5297
|
-
Object.defineProperty(exports
|
|
5298
|
-
exports
|
|
5300
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5301
|
+
exports.MurmurHash = void 0;
|
|
5299
5302
|
(function(MurmurHash2) {
|
|
5300
5303
|
const DEFAULT_SEED = 0;
|
|
5301
5304
|
function initialize(seed = DEFAULT_SEED) {
|
|
@@ -5360,7 +5363,7 @@ function requireMurmurHash() {
|
|
|
5360
5363
|
}
|
|
5361
5364
|
return hash;
|
|
5362
5365
|
}
|
|
5363
|
-
})(exports
|
|
5366
|
+
})(exports.MurmurHash || (exports.MurmurHash = {}));
|
|
5364
5367
|
})(MurmurHash);
|
|
5365
5368
|
return MurmurHash;
|
|
5366
5369
|
}
|
|
@@ -5973,7 +5976,7 @@ var hasRequiredSemanticContext;
|
|
|
5973
5976
|
function requireSemanticContext() {
|
|
5974
5977
|
if (hasRequiredSemanticContext) return SemanticContext;
|
|
5975
5978
|
hasRequiredSemanticContext = 1;
|
|
5976
|
-
(function(exports
|
|
5979
|
+
(function(exports) {
|
|
5977
5980
|
/*!
|
|
5978
5981
|
* Copyright 2016 The ANTLR Project. All rights reserved.
|
|
5979
5982
|
* Licensed under the BSD-3-Clause license. See LICENSE file in the project root for license information.
|
|
@@ -5989,8 +5992,8 @@ function requireSemanticContext() {
|
|
|
5989
5992
|
decorator(target, key, paramIndex);
|
|
5990
5993
|
};
|
|
5991
5994
|
};
|
|
5992
|
-
Object.defineProperty(exports
|
|
5993
|
-
exports
|
|
5995
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5996
|
+
exports.SemanticContext = void 0;
|
|
5994
5997
|
const Array2DHashSet_1 = requireArray2DHashSet();
|
|
5995
5998
|
const ArrayEqualityComparator_1 = requireArrayEqualityComparator();
|
|
5996
5999
|
const MurmurHash_1 = requireMurmurHash();
|
|
@@ -6087,7 +6090,7 @@ function requireSemanticContext() {
|
|
|
6087
6090
|
return result;
|
|
6088
6091
|
}
|
|
6089
6092
|
};
|
|
6090
|
-
exports
|
|
6093
|
+
exports.SemanticContext = SemanticContext$1;
|
|
6091
6094
|
(function(SemanticContext2) {
|
|
6092
6095
|
const AND_HASHCODE = 40363613;
|
|
6093
6096
|
const OR_HASHCODE = 486279973;
|
|
@@ -6408,7 +6411,7 @@ function requireSemanticContext() {
|
|
|
6408
6411
|
__param(1, Decorators_1.NotNull)
|
|
6409
6412
|
], OR);
|
|
6410
6413
|
SemanticContext2.OR = OR;
|
|
6411
|
-
})(SemanticContext$1 = exports
|
|
6414
|
+
})(SemanticContext$1 = exports.SemanticContext || (exports.SemanticContext = {}));
|
|
6412
6415
|
})(SemanticContext);
|
|
6413
6416
|
return SemanticContext;
|
|
6414
6417
|
}
|
|
@@ -6591,13 +6594,13 @@ var hasRequiredArrays;
|
|
|
6591
6594
|
function requireArrays() {
|
|
6592
6595
|
if (hasRequiredArrays) return Arrays;
|
|
6593
6596
|
hasRequiredArrays = 1;
|
|
6594
|
-
(function(exports
|
|
6597
|
+
(function(exports) {
|
|
6595
6598
|
/*!
|
|
6596
6599
|
* Copyright 2016 The ANTLR Project. All rights reserved.
|
|
6597
6600
|
* Licensed under the BSD-3-Clause license. See LICENSE file in the project root for license information.
|
|
6598
6601
|
*/
|
|
6599
|
-
Object.defineProperty(exports
|
|
6600
|
-
exports
|
|
6602
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6603
|
+
exports.Arrays = void 0;
|
|
6601
6604
|
(function(Arrays2) {
|
|
6602
6605
|
function binarySearch(array, key, fromIndex, toIndex) {
|
|
6603
6606
|
return binarySearch0(array, fromIndex !== void 0 ? fromIndex : 0, toIndex !== void 0 ? toIndex : array.length, key);
|
|
@@ -6640,7 +6643,7 @@ function requireArrays() {
|
|
|
6640
6643
|
return result;
|
|
6641
6644
|
}
|
|
6642
6645
|
Arrays2.toString = toString;
|
|
6643
|
-
})(exports
|
|
6646
|
+
})(exports.Arrays || (exports.Arrays = {}));
|
|
6644
6647
|
})(Arrays);
|
|
6645
6648
|
return Arrays;
|
|
6646
6649
|
}
|
|
@@ -7072,13 +7075,13 @@ var hasRequiredToken;
|
|
|
7072
7075
|
function requireToken() {
|
|
7073
7076
|
if (hasRequiredToken) return Token;
|
|
7074
7077
|
hasRequiredToken = 1;
|
|
7075
|
-
(function(exports
|
|
7078
|
+
(function(exports) {
|
|
7076
7079
|
/*!
|
|
7077
7080
|
* Copyright 2016 The ANTLR Project. All rights reserved.
|
|
7078
7081
|
* Licensed under the BSD-3-Clause license. See LICENSE file in the project root for license information.
|
|
7079
7082
|
*/
|
|
7080
|
-
Object.defineProperty(exports
|
|
7081
|
-
exports
|
|
7083
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7084
|
+
exports.Token = void 0;
|
|
7082
7085
|
const IntStream_1 = requireIntStream();
|
|
7083
7086
|
(function(Token2) {
|
|
7084
7087
|
Token2.INVALID_TYPE = 0;
|
|
@@ -7088,7 +7091,7 @@ function requireToken() {
|
|
|
7088
7091
|
Token2.DEFAULT_CHANNEL = 0;
|
|
7089
7092
|
Token2.HIDDEN_CHANNEL = 1;
|
|
7090
7093
|
Token2.MIN_USER_CHANNEL_VALUE = 2;
|
|
7091
|
-
})(exports
|
|
7094
|
+
})(exports.Token || (exports.Token = {}));
|
|
7092
7095
|
})(Token);
|
|
7093
7096
|
return Token;
|
|
7094
7097
|
}
|
|
@@ -7310,7 +7313,7 @@ var hasRequiredCommonTokenFactory;
|
|
|
7310
7313
|
function requireCommonTokenFactory() {
|
|
7311
7314
|
if (hasRequiredCommonTokenFactory) return CommonTokenFactory;
|
|
7312
7315
|
hasRequiredCommonTokenFactory = 1;
|
|
7313
|
-
(function(exports
|
|
7316
|
+
(function(exports) {
|
|
7314
7317
|
/*!
|
|
7315
7318
|
* Copyright 2016 The ANTLR Project. All rights reserved.
|
|
7316
7319
|
* Licensed under the BSD-3-Clause license. See LICENSE file in the project root for license information.
|
|
@@ -7321,8 +7324,8 @@ function requireCommonTokenFactory() {
|
|
|
7321
7324
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
7322
7325
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7323
7326
|
};
|
|
7324
|
-
Object.defineProperty(exports
|
|
7325
|
-
exports
|
|
7327
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7328
|
+
exports.CommonTokenFactory = void 0;
|
|
7326
7329
|
const CommonToken_1 = requireCommonToken();
|
|
7327
7330
|
const Interval_1 = requireInterval();
|
|
7328
7331
|
const Decorators_1 = requireDecorators();
|
|
@@ -7358,10 +7361,10 @@ function requireCommonTokenFactory() {
|
|
|
7358
7361
|
__decorate([
|
|
7359
7362
|
Decorators_1.Override
|
|
7360
7363
|
], CommonTokenFactory$1.prototype, "createSimple", null);
|
|
7361
|
-
exports
|
|
7364
|
+
exports.CommonTokenFactory = CommonTokenFactory$1;
|
|
7362
7365
|
(function(CommonTokenFactory2) {
|
|
7363
7366
|
CommonTokenFactory2.DEFAULT = new CommonTokenFactory2();
|
|
7364
|
-
})(CommonTokenFactory$1 = exports
|
|
7367
|
+
})(CommonTokenFactory$1 = exports.CommonTokenFactory || (exports.CommonTokenFactory = {}));
|
|
7365
7368
|
})(CommonTokenFactory);
|
|
7366
7369
|
return CommonTokenFactory;
|
|
7367
7370
|
}
|
|
@@ -7549,7 +7552,7 @@ var hasRequiredPredictionContextCache;
|
|
|
7549
7552
|
function requirePredictionContextCache() {
|
|
7550
7553
|
if (hasRequiredPredictionContextCache) return PredictionContextCache;
|
|
7551
7554
|
hasRequiredPredictionContextCache = 1;
|
|
7552
|
-
(function(exports
|
|
7555
|
+
(function(exports) {
|
|
7553
7556
|
/*!
|
|
7554
7557
|
* Copyright 2016 The ANTLR Project. All rights reserved.
|
|
7555
7558
|
* Licensed under the BSD-3-Clause license. See LICENSE file in the project root for license information.
|
|
@@ -7560,8 +7563,8 @@ function requirePredictionContextCache() {
|
|
|
7560
7563
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
7561
7564
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7562
7565
|
};
|
|
7563
|
-
Object.defineProperty(exports
|
|
7564
|
-
exports
|
|
7566
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7567
|
+
exports.PredictionContextCache = void 0;
|
|
7565
7568
|
const Array2DHashMap_1 = requireArray2DHashMap();
|
|
7566
7569
|
const Decorators_1 = requireDecorators();
|
|
7567
7570
|
const ObjectEqualityComparator_1 = requireObjectEqualityComparator();
|
|
@@ -7613,7 +7616,7 @@ function requirePredictionContextCache() {
|
|
|
7613
7616
|
return result;
|
|
7614
7617
|
}
|
|
7615
7618
|
};
|
|
7616
|
-
exports
|
|
7619
|
+
exports.PredictionContextCache = PredictionContextCache$1;
|
|
7617
7620
|
PredictionContextCache$1.UNCACHED = new PredictionContextCache$1(false);
|
|
7618
7621
|
(function(PredictionContextCache2) {
|
|
7619
7622
|
class PredictionContextAndInt {
|
|
@@ -7677,7 +7680,7 @@ function requirePredictionContextCache() {
|
|
|
7677
7680
|
Decorators_1.Override
|
|
7678
7681
|
], IdentityCommutativePredictionContextOperands.prototype, "hashCode", null);
|
|
7679
7682
|
PredictionContextCache2.IdentityCommutativePredictionContextOperands = IdentityCommutativePredictionContextOperands;
|
|
7680
|
-
})(PredictionContextCache$1 = exports
|
|
7683
|
+
})(PredictionContextCache$1 = exports.PredictionContextCache || (exports.PredictionContextCache = {}));
|
|
7681
7684
|
})(PredictionContextCache);
|
|
7682
7685
|
return PredictionContextCache;
|
|
7683
7686
|
}
|
|
@@ -7685,7 +7688,7 @@ var hasRequiredPredictionContext;
|
|
|
7685
7688
|
function requirePredictionContext() {
|
|
7686
7689
|
if (hasRequiredPredictionContext) return PredictionContext;
|
|
7687
7690
|
hasRequiredPredictionContext = 1;
|
|
7688
|
-
(function(exports
|
|
7691
|
+
(function(exports) {
|
|
7689
7692
|
/*!
|
|
7690
7693
|
* Copyright 2016 The ANTLR Project. All rights reserved.
|
|
7691
7694
|
* Licensed under the BSD-3-Clause license. See LICENSE file in the project root for license information.
|
|
@@ -7701,8 +7704,8 @@ function requirePredictionContext() {
|
|
|
7701
7704
|
decorator(target, key, paramIndex);
|
|
7702
7705
|
};
|
|
7703
7706
|
};
|
|
7704
|
-
Object.defineProperty(exports
|
|
7705
|
-
exports
|
|
7707
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7708
|
+
exports.SingletonPredictionContext = exports.PredictionContext = void 0;
|
|
7706
7709
|
const Array2DHashMap_1 = requireArray2DHashMap();
|
|
7707
7710
|
const Array2DHashSet_1 = requireArray2DHashSet();
|
|
7708
7711
|
const Arrays_1 = requireArrays();
|
|
@@ -7964,7 +7967,7 @@ function requirePredictionContext() {
|
|
|
7964
7967
|
__param(1, Decorators_1.NotNull),
|
|
7965
7968
|
__param(2, Decorators_1.NotNull)
|
|
7966
7969
|
], PredictionContext$1, "getCachedContext", null);
|
|
7967
|
-
exports
|
|
7970
|
+
exports.PredictionContext = PredictionContext$1;
|
|
7968
7971
|
class EmptyPredictionContext extends PredictionContext$1 {
|
|
7969
7972
|
constructor(fullContext) {
|
|
7970
7973
|
super(PredictionContext$1.calculateEmptyHashCode());
|
|
@@ -8320,7 +8323,7 @@ function requirePredictionContext() {
|
|
|
8320
8323
|
SingletonPredictionContext = __decorate([
|
|
8321
8324
|
__param(0, Decorators_1.NotNull)
|
|
8322
8325
|
], SingletonPredictionContext);
|
|
8323
|
-
exports
|
|
8326
|
+
exports.SingletonPredictionContext = SingletonPredictionContext;
|
|
8324
8327
|
(function(PredictionContext2) {
|
|
8325
8328
|
PredictionContext2.EMPTY_LOCAL = new EmptyPredictionContext(false);
|
|
8326
8329
|
PredictionContext2.EMPTY_FULL = new EmptyPredictionContext(true);
|
|
@@ -8350,7 +8353,7 @@ function requirePredictionContext() {
|
|
|
8350
8353
|
Decorators_1.Override
|
|
8351
8354
|
], IdentityEqualityComparator.prototype, "equals", null);
|
|
8352
8355
|
PredictionContext2.IdentityEqualityComparator = IdentityEqualityComparator;
|
|
8353
|
-
})(PredictionContext$1 = exports
|
|
8356
|
+
})(PredictionContext$1 = exports.PredictionContext || (exports.PredictionContext = {}));
|
|
8354
8357
|
})(PredictionContext);
|
|
8355
8358
|
return PredictionContext;
|
|
8356
8359
|
}
|
|
@@ -9841,7 +9844,7 @@ var hasRequiredDFAState;
|
|
|
9841
9844
|
function requireDFAState() {
|
|
9842
9845
|
if (hasRequiredDFAState) return DFAState;
|
|
9843
9846
|
hasRequiredDFAState = 1;
|
|
9844
|
-
(function(exports
|
|
9847
|
+
(function(exports) {
|
|
9845
9848
|
/*!
|
|
9846
9849
|
* Copyright 2016 The ANTLR Project. All rights reserved.
|
|
9847
9850
|
* Licensed under the BSD-3-Clause license. See LICENSE file in the project root for license information.
|
|
@@ -9857,8 +9860,8 @@ function requireDFAState() {
|
|
|
9857
9860
|
decorator(target, key, paramIndex);
|
|
9858
9861
|
};
|
|
9859
9862
|
};
|
|
9860
|
-
Object.defineProperty(exports
|
|
9861
|
-
exports
|
|
9863
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9864
|
+
exports.DFAState = void 0;
|
|
9862
9865
|
const ATN_1 = requireATN();
|
|
9863
9866
|
const BitSet_1 = requireBitSet();
|
|
9864
9867
|
const MurmurHash_1 = requireMurmurHash();
|
|
@@ -10021,7 +10024,7 @@ function requireDFAState() {
|
|
|
10021
10024
|
__decorate([
|
|
10022
10025
|
Decorators_1.Override
|
|
10023
10026
|
], DFAState$1.prototype, "toString", null);
|
|
10024
|
-
exports
|
|
10027
|
+
exports.DFAState = DFAState$1;
|
|
10025
10028
|
(function(DFAState2) {
|
|
10026
10029
|
let PredPrediction = class PredPrediction {
|
|
10027
10030
|
constructor(pred, alt) {
|
|
@@ -10042,7 +10045,7 @@ function requireDFAState() {
|
|
|
10042
10045
|
__param(0, Decorators_1.NotNull)
|
|
10043
10046
|
], PredPrediction);
|
|
10044
10047
|
DFAState2.PredPrediction = PredPrediction;
|
|
10045
|
-
})(DFAState$1 = exports
|
|
10048
|
+
})(DFAState$1 = exports.DFAState || (exports.DFAState = {}));
|
|
10046
10049
|
})(DFAState);
|
|
10047
10050
|
return DFAState;
|
|
10048
10051
|
}
|
|
@@ -10050,7 +10053,7 @@ var hasRequiredATNSimulator;
|
|
|
10050
10053
|
function requireATNSimulator() {
|
|
10051
10054
|
if (hasRequiredATNSimulator) return ATNSimulator;
|
|
10052
10055
|
hasRequiredATNSimulator = 1;
|
|
10053
|
-
(function(exports
|
|
10056
|
+
(function(exports) {
|
|
10054
10057
|
/*!
|
|
10055
10058
|
* Copyright 2016 The ANTLR Project. All rights reserved.
|
|
10056
10059
|
* Licensed under the BSD-3-Clause license. See LICENSE file in the project root for license information.
|
|
@@ -10066,8 +10069,8 @@ function requireATNSimulator() {
|
|
|
10066
10069
|
decorator(target, key, paramIndex);
|
|
10067
10070
|
};
|
|
10068
10071
|
};
|
|
10069
|
-
Object.defineProperty(exports
|
|
10070
|
-
exports
|
|
10072
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10073
|
+
exports.ATNSimulator = void 0;
|
|
10071
10074
|
const ATNConfigSet_1 = requireATNConfigSet();
|
|
10072
10075
|
const DFAState_1 = requireDFAState();
|
|
10073
10076
|
const Decorators_1 = requireDecorators();
|
|
@@ -10107,10 +10110,10 @@ function requireATNSimulator() {
|
|
|
10107
10110
|
ATNSimulator$1 = __decorate([
|
|
10108
10111
|
__param(0, Decorators_1.NotNull)
|
|
10109
10112
|
], ATNSimulator$1);
|
|
10110
|
-
exports
|
|
10113
|
+
exports.ATNSimulator = ATNSimulator$1;
|
|
10111
10114
|
/* @__PURE__ */ (function(ATNSimulator2) {
|
|
10112
|
-
})(ATNSimulator$1 = exports
|
|
10113
|
-
exports
|
|
10115
|
+
})(ATNSimulator$1 = exports.ATNSimulator || (exports.ATNSimulator = {}));
|
|
10116
|
+
exports.ATNSimulator = ATNSimulator$1;
|
|
10114
10117
|
})(ATNSimulator);
|
|
10115
10118
|
return ATNSimulator;
|
|
10116
10119
|
}
|
|
@@ -11454,7 +11457,7 @@ var hasRequiredATN;
|
|
|
11454
11457
|
function requireATN() {
|
|
11455
11458
|
if (hasRequiredATN) return ATN;
|
|
11456
11459
|
hasRequiredATN = 1;
|
|
11457
|
-
(function(exports
|
|
11460
|
+
(function(exports) {
|
|
11458
11461
|
/*!
|
|
11459
11462
|
* Copyright 2016 The ANTLR Project. All rights reserved.
|
|
11460
11463
|
* Licensed under the BSD-3-Clause license. See LICENSE file in the project root for license information.
|
|
@@ -11470,8 +11473,8 @@ function requireATN() {
|
|
|
11470
11473
|
decorator(target, key, paramIndex);
|
|
11471
11474
|
};
|
|
11472
11475
|
};
|
|
11473
|
-
Object.defineProperty(exports
|
|
11474
|
-
exports
|
|
11476
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11477
|
+
exports.ATN = void 0;
|
|
11475
11478
|
const Array2DHashMap_1 = requireArray2DHashMap();
|
|
11476
11479
|
const DFA_1 = requireDFA();
|
|
11477
11480
|
const IntervalSet_1 = requireIntervalSet();
|
|
@@ -11664,11 +11667,11 @@ function requireATN() {
|
|
|
11664
11667
|
ATN$1 = __decorate([
|
|
11665
11668
|
__param(0, Decorators_1.NotNull)
|
|
11666
11669
|
], ATN$1);
|
|
11667
|
-
exports
|
|
11670
|
+
exports.ATN = ATN$1;
|
|
11668
11671
|
(function(ATN2) {
|
|
11669
11672
|
ATN2.INVALID_ALT_NUMBER = 0;
|
|
11670
|
-
})(ATN$1 = exports
|
|
11671
|
-
exports
|
|
11673
|
+
})(ATN$1 = exports.ATN || (exports.ATN = {}));
|
|
11674
|
+
exports.ATN = ATN$1;
|
|
11672
11675
|
})(ATN);
|
|
11673
11676
|
return ATN;
|
|
11674
11677
|
}
|
|
@@ -12107,7 +12110,7 @@ var hasRequiredLexerATNSimulator;
|
|
|
12107
12110
|
function requireLexerATNSimulator() {
|
|
12108
12111
|
if (hasRequiredLexerATNSimulator) return LexerATNSimulator;
|
|
12109
12112
|
hasRequiredLexerATNSimulator = 1;
|
|
12110
|
-
(function(exports
|
|
12113
|
+
(function(exports) {
|
|
12111
12114
|
/*!
|
|
12112
12115
|
* Copyright 2016 The ANTLR Project. All rights reserved.
|
|
12113
12116
|
* Licensed under the BSD-3-Clause license. See LICENSE file in the project root for license information.
|
|
@@ -12123,8 +12126,8 @@ function requireLexerATNSimulator() {
|
|
|
12123
12126
|
decorator(target, key, paramIndex);
|
|
12124
12127
|
};
|
|
12125
12128
|
};
|
|
12126
|
-
Object.defineProperty(exports
|
|
12127
|
-
exports
|
|
12129
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12130
|
+
exports.LexerATNSimulator = void 0;
|
|
12128
12131
|
const AcceptStateInfo_1 = requireAcceptStateInfo();
|
|
12129
12132
|
const ATN_1 = requireATN();
|
|
12130
12133
|
const ATNConfig_1 = requireATNConfig();
|
|
@@ -12685,7 +12688,7 @@ function requireLexerATNSimulator() {
|
|
|
12685
12688
|
LexerATNSimulator$1 = __decorate([
|
|
12686
12689
|
__param(0, Decorators_1.NotNull)
|
|
12687
12690
|
], LexerATNSimulator$1);
|
|
12688
|
-
exports
|
|
12691
|
+
exports.LexerATNSimulator = LexerATNSimulator$1;
|
|
12689
12692
|
(function(LexerATNSimulator2) {
|
|
12690
12693
|
LexerATNSimulator2.debug = false;
|
|
12691
12694
|
LexerATNSimulator2.dfa_debug = false;
|
|
@@ -12703,8 +12706,8 @@ function requireLexerATNSimulator() {
|
|
|
12703
12706
|
}
|
|
12704
12707
|
}
|
|
12705
12708
|
LexerATNSimulator2.SimState = SimState;
|
|
12706
|
-
})(LexerATNSimulator$1 = exports
|
|
12707
|
-
exports
|
|
12709
|
+
})(LexerATNSimulator$1 = exports.LexerATNSimulator || (exports.LexerATNSimulator = {}));
|
|
12710
|
+
exports.LexerATNSimulator = LexerATNSimulator$1;
|
|
12708
12711
|
})(LexerATNSimulator);
|
|
12709
12712
|
return LexerATNSimulator;
|
|
12710
12713
|
}
|
|
@@ -14270,7 +14273,7 @@ var hasRequiredLexerMoreAction;
|
|
|
14270
14273
|
function requireLexerMoreAction() {
|
|
14271
14274
|
if (hasRequiredLexerMoreAction) return LexerMoreAction;
|
|
14272
14275
|
hasRequiredLexerMoreAction = 1;
|
|
14273
|
-
(function(exports
|
|
14276
|
+
(function(exports) {
|
|
14274
14277
|
/*!
|
|
14275
14278
|
* Copyright 2016 The ANTLR Project. All rights reserved.
|
|
14276
14279
|
* Licensed under the BSD-3-Clause license. See LICENSE file in the project root for license information.
|
|
@@ -14286,8 +14289,8 @@ function requireLexerMoreAction() {
|
|
|
14286
14289
|
decorator(target, key, paramIndex);
|
|
14287
14290
|
};
|
|
14288
14291
|
};
|
|
14289
|
-
Object.defineProperty(exports
|
|
14290
|
-
exports
|
|
14292
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14293
|
+
exports.LexerMoreAction = void 0;
|
|
14291
14294
|
const MurmurHash_1 = requireMurmurHash();
|
|
14292
14295
|
const Decorators_1 = requireDecorators();
|
|
14293
14296
|
let LexerMoreAction$1 = class LexerMoreAction {
|
|
@@ -14349,10 +14352,10 @@ function requireLexerMoreAction() {
|
|
|
14349
14352
|
__decorate([
|
|
14350
14353
|
Decorators_1.Override
|
|
14351
14354
|
], LexerMoreAction$1.prototype, "toString", null);
|
|
14352
|
-
exports
|
|
14355
|
+
exports.LexerMoreAction = LexerMoreAction$1;
|
|
14353
14356
|
(function(LexerMoreAction2) {
|
|
14354
14357
|
LexerMoreAction2.INSTANCE = new LexerMoreAction2();
|
|
14355
|
-
})(LexerMoreAction$1 = exports
|
|
14358
|
+
})(LexerMoreAction$1 = exports.LexerMoreAction || (exports.LexerMoreAction = {}));
|
|
14356
14359
|
})(LexerMoreAction);
|
|
14357
14360
|
return LexerMoreAction;
|
|
14358
14361
|
}
|
|
@@ -14361,7 +14364,7 @@ var hasRequiredLexerPopModeAction;
|
|
|
14361
14364
|
function requireLexerPopModeAction() {
|
|
14362
14365
|
if (hasRequiredLexerPopModeAction) return LexerPopModeAction;
|
|
14363
14366
|
hasRequiredLexerPopModeAction = 1;
|
|
14364
|
-
(function(exports
|
|
14367
|
+
(function(exports) {
|
|
14365
14368
|
/*!
|
|
14366
14369
|
* Copyright 2016 The ANTLR Project. All rights reserved.
|
|
14367
14370
|
* Licensed under the BSD-3-Clause license. See LICENSE file in the project root for license information.
|
|
@@ -14377,8 +14380,8 @@ function requireLexerPopModeAction() {
|
|
|
14377
14380
|
decorator(target, key, paramIndex);
|
|
14378
14381
|
};
|
|
14379
14382
|
};
|
|
14380
|
-
Object.defineProperty(exports
|
|
14381
|
-
exports
|
|
14383
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14384
|
+
exports.LexerPopModeAction = void 0;
|
|
14382
14385
|
const MurmurHash_1 = requireMurmurHash();
|
|
14383
14386
|
const Decorators_1 = requireDecorators();
|
|
14384
14387
|
let LexerPopModeAction$1 = class LexerPopModeAction {
|
|
@@ -14440,10 +14443,10 @@ function requireLexerPopModeAction() {
|
|
|
14440
14443
|
__decorate([
|
|
14441
14444
|
Decorators_1.Override
|
|
14442
14445
|
], LexerPopModeAction$1.prototype, "toString", null);
|
|
14443
|
-
exports
|
|
14446
|
+
exports.LexerPopModeAction = LexerPopModeAction$1;
|
|
14444
14447
|
(function(LexerPopModeAction2) {
|
|
14445
14448
|
LexerPopModeAction2.INSTANCE = new LexerPopModeAction2();
|
|
14446
|
-
})(LexerPopModeAction$1 = exports
|
|
14449
|
+
})(LexerPopModeAction$1 = exports.LexerPopModeAction || (exports.LexerPopModeAction = {}));
|
|
14447
14450
|
})(LexerPopModeAction);
|
|
14448
14451
|
return LexerPopModeAction;
|
|
14449
14452
|
}
|
|
@@ -14555,7 +14558,7 @@ var hasRequiredLexerSkipAction;
|
|
|
14555
14558
|
function requireLexerSkipAction() {
|
|
14556
14559
|
if (hasRequiredLexerSkipAction) return LexerSkipAction;
|
|
14557
14560
|
hasRequiredLexerSkipAction = 1;
|
|
14558
|
-
(function(exports
|
|
14561
|
+
(function(exports) {
|
|
14559
14562
|
/*!
|
|
14560
14563
|
* Copyright 2016 The ANTLR Project. All rights reserved.
|
|
14561
14564
|
* Licensed under the BSD-3-Clause license. See LICENSE file in the project root for license information.
|
|
@@ -14571,8 +14574,8 @@ function requireLexerSkipAction() {
|
|
|
14571
14574
|
decorator(target, key, paramIndex);
|
|
14572
14575
|
};
|
|
14573
14576
|
};
|
|
14574
|
-
Object.defineProperty(exports
|
|
14575
|
-
exports
|
|
14577
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14578
|
+
exports.LexerSkipAction = void 0;
|
|
14576
14579
|
const MurmurHash_1 = requireMurmurHash();
|
|
14577
14580
|
const Decorators_1 = requireDecorators();
|
|
14578
14581
|
let LexerSkipAction$1 = class LexerSkipAction {
|
|
@@ -14634,10 +14637,10 @@ function requireLexerSkipAction() {
|
|
|
14634
14637
|
__decorate([
|
|
14635
14638
|
Decorators_1.Override
|
|
14636
14639
|
], LexerSkipAction$1.prototype, "toString", null);
|
|
14637
|
-
exports
|
|
14640
|
+
exports.LexerSkipAction = LexerSkipAction$1;
|
|
14638
14641
|
(function(LexerSkipAction2) {
|
|
14639
14642
|
LexerSkipAction2.INSTANCE = new LexerSkipAction2();
|
|
14640
|
-
})(LexerSkipAction$1 = exports
|
|
14643
|
+
})(LexerSkipAction$1 = exports.LexerSkipAction || (exports.LexerSkipAction = {}));
|
|
14641
14644
|
})(LexerSkipAction);
|
|
14642
14645
|
return LexerSkipAction;
|
|
14643
14646
|
}
|
|
@@ -15675,7 +15678,7 @@ var hasRequiredPredictionMode;
|
|
|
15675
15678
|
function requirePredictionMode() {
|
|
15676
15679
|
if (hasRequiredPredictionMode) return PredictionMode;
|
|
15677
15680
|
hasRequiredPredictionMode = 1;
|
|
15678
|
-
(function(exports
|
|
15681
|
+
(function(exports) {
|
|
15679
15682
|
/*!
|
|
15680
15683
|
* Copyright 2016 The ANTLR Project. All rights reserved.
|
|
15681
15684
|
* Licensed under the BSD-3-Clause license. See LICENSE file in the project root for license information.
|
|
@@ -15686,8 +15689,8 @@ function requirePredictionMode() {
|
|
|
15686
15689
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
15687
15690
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
15688
15691
|
};
|
|
15689
|
-
Object.defineProperty(exports
|
|
15690
|
-
exports
|
|
15692
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15693
|
+
exports.PredictionMode = void 0;
|
|
15691
15694
|
const Array2DHashMap_1 = requireArray2DHashMap();
|
|
15692
15695
|
const MurmurHash_1 = requireMurmurHash();
|
|
15693
15696
|
const Decorators_1 = requireDecorators();
|
|
@@ -15696,7 +15699,7 @@ function requirePredictionMode() {
|
|
|
15696
15699
|
PredictionMode2[PredictionMode2["SLL"] = 0] = "SLL";
|
|
15697
15700
|
PredictionMode2[PredictionMode2["LL"] = 1] = "LL";
|
|
15698
15701
|
PredictionMode2[PredictionMode2["LL_EXACT_AMBIG_DETECTION"] = 2] = "LL_EXACT_AMBIG_DETECTION";
|
|
15699
|
-
})(exports
|
|
15702
|
+
})(exports.PredictionMode || (exports.PredictionMode = {}));
|
|
15700
15703
|
(function(PredictionMode2) {
|
|
15701
15704
|
class AltAndContextMap extends Array2DHashMap_1.Array2DHashMap {
|
|
15702
15705
|
constructor() {
|
|
@@ -15752,7 +15755,7 @@ function requirePredictionMode() {
|
|
|
15752
15755
|
return true;
|
|
15753
15756
|
}
|
|
15754
15757
|
PredictionMode2.allConfigsInRuleStopStates = allConfigsInRuleStopStates;
|
|
15755
|
-
})(exports
|
|
15758
|
+
})(exports.PredictionMode || (exports.PredictionMode = {}));
|
|
15756
15759
|
})(PredictionMode);
|
|
15757
15760
|
return PredictionMode;
|
|
15758
15761
|
}
|
|
@@ -19201,13 +19204,13 @@ var hasRequiredCodePointBuffer;
|
|
|
19201
19204
|
function requireCodePointBuffer() {
|
|
19202
19205
|
if (hasRequiredCodePointBuffer) return CodePointBuffer;
|
|
19203
19206
|
hasRequiredCodePointBuffer = 1;
|
|
19204
|
-
(function(exports
|
|
19207
|
+
(function(exports) {
|
|
19205
19208
|
/*!
|
|
19206
19209
|
* Copyright 2016 The ANTLR Project. All rights reserved.
|
|
19207
19210
|
* Licensed under the BSD-3-Clause license. See LICENSE file in the project root for license information.
|
|
19208
19211
|
*/
|
|
19209
|
-
Object.defineProperty(exports
|
|
19210
|
-
exports
|
|
19212
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19213
|
+
exports.CodePointBuffer = void 0;
|
|
19211
19214
|
const assert2 = requireAssert();
|
|
19212
19215
|
const Character2 = requireCharacter();
|
|
19213
19216
|
class CodePointBuffer2 {
|
|
@@ -19241,7 +19244,7 @@ function requireCodePointBuffer() {
|
|
|
19241
19244
|
return new CodePointBuffer2.Builder(initialBufferSize);
|
|
19242
19245
|
}
|
|
19243
19246
|
}
|
|
19244
|
-
exports
|
|
19247
|
+
exports.CodePointBuffer = CodePointBuffer2;
|
|
19245
19248
|
(function(CodePointBuffer3) {
|
|
19246
19249
|
let Type;
|
|
19247
19250
|
(function(Type2) {
|
|
@@ -19418,7 +19421,7 @@ function requireCodePointBuffer() {
|
|
|
19418
19421
|
}
|
|
19419
19422
|
}
|
|
19420
19423
|
CodePointBuffer3.Builder = Builder;
|
|
19421
|
-
})(CodePointBuffer2 = exports
|
|
19424
|
+
})(CodePointBuffer2 = exports.CodePointBuffer || (exports.CodePointBuffer = {}));
|
|
19422
19425
|
})(CodePointBuffer);
|
|
19423
19426
|
return CodePointBuffer;
|
|
19424
19427
|
}
|
|
@@ -19558,13 +19561,13 @@ var hasRequiredCharStreams;
|
|
|
19558
19561
|
function requireCharStreams() {
|
|
19559
19562
|
if (hasRequiredCharStreams) return CharStreams;
|
|
19560
19563
|
hasRequiredCharStreams = 1;
|
|
19561
|
-
(function(exports
|
|
19564
|
+
(function(exports) {
|
|
19562
19565
|
/*!
|
|
19563
19566
|
* Copyright 2016 The ANTLR Project. All rights reserved.
|
|
19564
19567
|
* Licensed under the BSD-3-Clause license. See LICENSE file in the project root for license information.
|
|
19565
19568
|
*/
|
|
19566
|
-
Object.defineProperty(exports
|
|
19567
|
-
exports
|
|
19569
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19570
|
+
exports.CharStreams = void 0;
|
|
19568
19571
|
const CodePointBuffer_1 = requireCodePointBuffer();
|
|
19569
19572
|
const CodePointCharStream_1 = requireCodePointCharStream();
|
|
19570
19573
|
const IntStream_1 = requireIntStream();
|
|
@@ -19582,7 +19585,7 @@ function requireCharStreams() {
|
|
|
19582
19585
|
return CodePointCharStream_1.CodePointCharStream.fromBuffer(codePointBufferBuilder.build(), sourceName);
|
|
19583
19586
|
}
|
|
19584
19587
|
CharStreams2.fromString = fromString;
|
|
19585
|
-
})(exports
|
|
19588
|
+
})(exports.CharStreams || (exports.CharStreams = {}));
|
|
19586
19589
|
})(CharStreams);
|
|
19587
19590
|
return CharStreams;
|
|
19588
19591
|
}
|
|
@@ -22174,7 +22177,7 @@ var hasRequiredParseTreePatternMatcher;
|
|
|
22174
22177
|
function requireParseTreePatternMatcher() {
|
|
22175
22178
|
if (hasRequiredParseTreePatternMatcher) return ParseTreePatternMatcher;
|
|
22176
22179
|
hasRequiredParseTreePatternMatcher = 1;
|
|
22177
|
-
(function(exports
|
|
22180
|
+
(function(exports) {
|
|
22178
22181
|
/*!
|
|
22179
22182
|
* Copyright 2016 The ANTLR Project. All rights reserved.
|
|
22180
22183
|
* Licensed under the BSD-3-Clause license. See LICENSE file in the project root for license information.
|
|
@@ -22190,8 +22193,8 @@ function requireParseTreePatternMatcher() {
|
|
|
22190
22193
|
decorator(target, key, paramIndex);
|
|
22191
22194
|
};
|
|
22192
22195
|
};
|
|
22193
|
-
Object.defineProperty(exports
|
|
22194
|
-
exports
|
|
22196
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22197
|
+
exports.ParseTreePatternMatcher = void 0;
|
|
22195
22198
|
const BailErrorStrategy_1 = requireBailErrorStrategy();
|
|
22196
22199
|
const CharStreams_1 = requireCharStreams();
|
|
22197
22200
|
const CommonTokenStream_1 = requireCommonTokenStream();
|
|
@@ -22527,7 +22530,7 @@ function requireParseTreePatternMatcher() {
|
|
|
22527
22530
|
__param(1, Decorators_1.NotNull),
|
|
22528
22531
|
__param(2, Decorators_1.NotNull)
|
|
22529
22532
|
], ParseTreePatternMatcher$1.prototype, "matchImpl", null);
|
|
22530
|
-
exports
|
|
22533
|
+
exports.ParseTreePatternMatcher = ParseTreePatternMatcher$1;
|
|
22531
22534
|
(function(ParseTreePatternMatcher2) {
|
|
22532
22535
|
class CannotInvokeStartRule extends Error {
|
|
22533
22536
|
constructor(error) {
|
|
@@ -22542,7 +22545,7 @@ function requireParseTreePatternMatcher() {
|
|
|
22542
22545
|
}
|
|
22543
22546
|
}
|
|
22544
22547
|
ParseTreePatternMatcher2.StartRuleDoesNotConsumeFullPattern = StartRuleDoesNotConsumeFullPattern;
|
|
22545
|
-
})(ParseTreePatternMatcher$1 = exports
|
|
22548
|
+
})(ParseTreePatternMatcher$1 = exports.ParseTreePatternMatcher || (exports.ParseTreePatternMatcher = {}));
|
|
22546
22549
|
})(ParseTreePatternMatcher);
|
|
22547
22550
|
return ParseTreePatternMatcher;
|
|
22548
22551
|
}
|
|
@@ -24826,13 +24829,13 @@ var hasRequiredDependents;
|
|
|
24826
24829
|
function requireDependents() {
|
|
24827
24830
|
if (hasRequiredDependents) return Dependents;
|
|
24828
24831
|
hasRequiredDependents = 1;
|
|
24829
|
-
(function(exports
|
|
24832
|
+
(function(exports) {
|
|
24830
24833
|
/*!
|
|
24831
24834
|
* Copyright 2016 The ANTLR Project. All rights reserved.
|
|
24832
24835
|
* Licensed under the BSD-3-Clause license. See LICENSE file in the project root for license information.
|
|
24833
24836
|
*/
|
|
24834
|
-
Object.defineProperty(exports
|
|
24835
|
-
exports
|
|
24837
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
24838
|
+
exports.Dependents = void 0;
|
|
24836
24839
|
(function(Dependents2) {
|
|
24837
24840
|
Dependents2[Dependents2["SELF"] = 0] = "SELF";
|
|
24838
24841
|
Dependents2[Dependents2["PARENTS"] = 1] = "PARENTS";
|
|
@@ -24844,7 +24847,7 @@ function requireDependents() {
|
|
|
24844
24847
|
Dependents2[Dependents2["FOLLOWING_SIBLINGS"] = 7] = "FOLLOWING_SIBLINGS";
|
|
24845
24848
|
Dependents2[Dependents2["PRECEEDING"] = 8] = "PRECEEDING";
|
|
24846
24849
|
Dependents2[Dependents2["FOLLOWING"] = 9] = "FOLLOWING";
|
|
24847
|
-
})(exports
|
|
24850
|
+
})(exports.Dependents || (exports.Dependents = {}));
|
|
24848
24851
|
})(Dependents);
|
|
24849
24852
|
return Dependents;
|
|
24850
24853
|
}
|
|
@@ -25607,7 +25610,7 @@ var hasRequiredAntlr4ts;
|
|
|
25607
25610
|
function requireAntlr4ts() {
|
|
25608
25611
|
if (hasRequiredAntlr4ts) return antlr4ts;
|
|
25609
25612
|
hasRequiredAntlr4ts = 1;
|
|
25610
|
-
(function(exports
|
|
25613
|
+
(function(exports) {
|
|
25611
25614
|
/*!
|
|
25612
25615
|
* Copyright 2016 The ANTLR Project. All rights reserved.
|
|
25613
25616
|
* Licensed under the BSD-3-Clause license. See LICENSE file in the project root for license information.
|
|
@@ -25621,59 +25624,60 @@ function requireAntlr4ts() {
|
|
|
25621
25624
|
if (k2 === void 0) k2 = k;
|
|
25622
25625
|
o[k2] = m[k];
|
|
25623
25626
|
}));
|
|
25624
|
-
var __exportStar = antlr4ts && antlr4ts.__exportStar || function(m,
|
|
25625
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(
|
|
25627
|
+
var __exportStar = antlr4ts && antlr4ts.__exportStar || function(m, exports2) {
|
|
25628
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports2, p)) __createBinding(exports2, m, p);
|
|
25626
25629
|
};
|
|
25627
|
-
Object.defineProperty(exports
|
|
25628
|
-
__exportStar(requireANTLRErrorListener(), exports
|
|
25629
|
-
__exportStar(requireANTLRErrorStrategy(), exports
|
|
25630
|
-
__exportStar(requireANTLRInputStream(), exports
|
|
25631
|
-
__exportStar(requireBailErrorStrategy(), exports
|
|
25632
|
-
__exportStar(requireBufferedTokenStream(), exports
|
|
25633
|
-
__exportStar(requireCharStream(), exports
|
|
25634
|
-
__exportStar(requireCharStreams(), exports
|
|
25635
|
-
__exportStar(requireCodePointBuffer(), exports
|
|
25636
|
-
__exportStar(requireCodePointCharStream(), exports
|
|
25637
|
-
__exportStar(requireCommonToken(), exports
|
|
25638
|
-
__exportStar(requireCommonTokenFactory(), exports
|
|
25639
|
-
__exportStar(requireCommonTokenStream(), exports
|
|
25640
|
-
__exportStar(requireConsoleErrorListener(), exports
|
|
25641
|
-
__exportStar(requireDefaultErrorStrategy(), exports
|
|
25642
|
-
__exportStar(requireDependents(), exports
|
|
25643
|
-
__exportStar(requireDiagnosticErrorListener(), exports
|
|
25644
|
-
__exportStar(requireFailedPredicateException(), exports
|
|
25645
|
-
__exportStar(requireInputMismatchException(), exports
|
|
25646
|
-
__exportStar(requireInterpreterRuleContext(), exports
|
|
25647
|
-
__exportStar(requireIntStream(), exports
|
|
25648
|
-
__exportStar(requireLexer(), exports
|
|
25649
|
-
__exportStar(requireLexerInterpreter(), exports
|
|
25650
|
-
__exportStar(requireLexerNoViableAltException(), exports
|
|
25651
|
-
__exportStar(requireListTokenSource(), exports
|
|
25652
|
-
__exportStar(requireNoViableAltException(), exports
|
|
25653
|
-
__exportStar(requireParser(), exports
|
|
25654
|
-
__exportStar(requireParserErrorListener(), exports
|
|
25655
|
-
__exportStar(requireParserInterpreter(), exports
|
|
25656
|
-
__exportStar(requireParserRuleContext(), exports
|
|
25657
|
-
__exportStar(requireProxyErrorListener(), exports
|
|
25658
|
-
__exportStar(requireProxyParserErrorListener(), exports
|
|
25659
|
-
__exportStar(requireRecognitionException(), exports
|
|
25660
|
-
__exportStar(requireRecognizer(), exports
|
|
25661
|
-
__exportStar(requireRuleContext(), exports
|
|
25662
|
-
__exportStar(requireRuleContextWithAltNum(), exports
|
|
25663
|
-
__exportStar(requireRuleDependency(), exports
|
|
25664
|
-
__exportStar(requireRuleVersion(), exports
|
|
25665
|
-
__exportStar(requireToken(), exports
|
|
25666
|
-
__exportStar(requireTokenFactory(), exports
|
|
25667
|
-
__exportStar(requireTokenSource(), exports
|
|
25668
|
-
__exportStar(requireTokenStream(), exports
|
|
25669
|
-
__exportStar(requireTokenStreamRewriter(), exports
|
|
25670
|
-
__exportStar(requireVocabulary(), exports
|
|
25671
|
-
__exportStar(requireVocabularyImpl(), exports
|
|
25672
|
-
__exportStar(requireWritableToken(), exports
|
|
25630
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25631
|
+
__exportStar(requireANTLRErrorListener(), exports);
|
|
25632
|
+
__exportStar(requireANTLRErrorStrategy(), exports);
|
|
25633
|
+
__exportStar(requireANTLRInputStream(), exports);
|
|
25634
|
+
__exportStar(requireBailErrorStrategy(), exports);
|
|
25635
|
+
__exportStar(requireBufferedTokenStream(), exports);
|
|
25636
|
+
__exportStar(requireCharStream(), exports);
|
|
25637
|
+
__exportStar(requireCharStreams(), exports);
|
|
25638
|
+
__exportStar(requireCodePointBuffer(), exports);
|
|
25639
|
+
__exportStar(requireCodePointCharStream(), exports);
|
|
25640
|
+
__exportStar(requireCommonToken(), exports);
|
|
25641
|
+
__exportStar(requireCommonTokenFactory(), exports);
|
|
25642
|
+
__exportStar(requireCommonTokenStream(), exports);
|
|
25643
|
+
__exportStar(requireConsoleErrorListener(), exports);
|
|
25644
|
+
__exportStar(requireDefaultErrorStrategy(), exports);
|
|
25645
|
+
__exportStar(requireDependents(), exports);
|
|
25646
|
+
__exportStar(requireDiagnosticErrorListener(), exports);
|
|
25647
|
+
__exportStar(requireFailedPredicateException(), exports);
|
|
25648
|
+
__exportStar(requireInputMismatchException(), exports);
|
|
25649
|
+
__exportStar(requireInterpreterRuleContext(), exports);
|
|
25650
|
+
__exportStar(requireIntStream(), exports);
|
|
25651
|
+
__exportStar(requireLexer(), exports);
|
|
25652
|
+
__exportStar(requireLexerInterpreter(), exports);
|
|
25653
|
+
__exportStar(requireLexerNoViableAltException(), exports);
|
|
25654
|
+
__exportStar(requireListTokenSource(), exports);
|
|
25655
|
+
__exportStar(requireNoViableAltException(), exports);
|
|
25656
|
+
__exportStar(requireParser(), exports);
|
|
25657
|
+
__exportStar(requireParserErrorListener(), exports);
|
|
25658
|
+
__exportStar(requireParserInterpreter(), exports);
|
|
25659
|
+
__exportStar(requireParserRuleContext(), exports);
|
|
25660
|
+
__exportStar(requireProxyErrorListener(), exports);
|
|
25661
|
+
__exportStar(requireProxyParserErrorListener(), exports);
|
|
25662
|
+
__exportStar(requireRecognitionException(), exports);
|
|
25663
|
+
__exportStar(requireRecognizer(), exports);
|
|
25664
|
+
__exportStar(requireRuleContext(), exports);
|
|
25665
|
+
__exportStar(requireRuleContextWithAltNum(), exports);
|
|
25666
|
+
__exportStar(requireRuleDependency(), exports);
|
|
25667
|
+
__exportStar(requireRuleVersion(), exports);
|
|
25668
|
+
__exportStar(requireToken(), exports);
|
|
25669
|
+
__exportStar(requireTokenFactory(), exports);
|
|
25670
|
+
__exportStar(requireTokenSource(), exports);
|
|
25671
|
+
__exportStar(requireTokenStream(), exports);
|
|
25672
|
+
__exportStar(requireTokenStreamRewriter(), exports);
|
|
25673
|
+
__exportStar(requireVocabulary(), exports);
|
|
25674
|
+
__exportStar(requireVocabularyImpl(), exports);
|
|
25675
|
+
__exportStar(requireWritableToken(), exports);
|
|
25673
25676
|
})(antlr4ts);
|
|
25674
25677
|
return antlr4ts;
|
|
25675
25678
|
}
|
|
25676
25679
|
var antlr4tsExports = requireAntlr4ts();
|
|
25680
|
+
var PredictionModeExports = requirePredictionMode();
|
|
25677
25681
|
var ATNDeserializerExports = requireATNDeserializer();
|
|
25678
25682
|
var LexerExports = requireLexer();
|
|
25679
25683
|
var LexerATNSimulatorExports = requireLexerATNSimulator();
|
|
@@ -50915,6 +50919,8 @@ var NodeType = /* @__PURE__ */ ((NodeType2) => {
|
|
|
50915
50919
|
NodeType2["ConstraintOperator"] = "ConstraintOperator";
|
|
50916
50920
|
NodeType2["LogicalOperator"] = "LogicalOperator";
|
|
50917
50921
|
NodeType2["Refinement"] = "Refinement";
|
|
50922
|
+
NodeType2["AttributeSet"] = "AttributeSet";
|
|
50923
|
+
NodeType2["AttributeGroup"] = "AttributeGroup";
|
|
50918
50924
|
NodeType2["Attribute"] = "Attribute";
|
|
50919
50925
|
NodeType2["AttributeName"] = "AttributeName";
|
|
50920
50926
|
NodeType2["AttributeValue"] = "AttributeValue";
|
|
@@ -51109,76 +51115,106 @@ class ECLASTVisitor extends AbstractParseTreeVisitorExports.AbstractParseTreeVis
|
|
|
51109
51115
|
};
|
|
51110
51116
|
}
|
|
51111
51117
|
visitEclrefinement(ctx) {
|
|
51118
|
+
const content = this.buildRefinement(ctx);
|
|
51112
51119
|
const attributes = [];
|
|
51113
|
-
|
|
51120
|
+
collectAttributes$1(content, attributes);
|
|
51121
|
+
return {
|
|
51122
|
+
type: NodeType.Refinement,
|
|
51123
|
+
range: this.getRange(ctx),
|
|
51124
|
+
attributes,
|
|
51125
|
+
content
|
|
51126
|
+
};
|
|
51127
|
+
}
|
|
51128
|
+
/**
|
|
51129
|
+
* eclrefinement : subrefinement ws (conjunctionrefinementset | disjunctionrefinementset)?
|
|
51130
|
+
*
|
|
51131
|
+
* The grammar forbids mixing conjunction and disjunction at the same level, so
|
|
51132
|
+
* at most one of the two sets is present and the resulting set is homogeneous.
|
|
51133
|
+
*/
|
|
51134
|
+
buildRefinement(ctx) {
|
|
51135
|
+
const first = this.buildSubrefinement(ctx.subrefinement());
|
|
51114
51136
|
const conjSet = ctx.conjunctionrefinementset();
|
|
51115
51137
|
if (conjSet) {
|
|
51116
|
-
const
|
|
51117
|
-
|
|
51118
|
-
this.collectAttributesFromSubrefinement(sub, attributes);
|
|
51119
|
-
}
|
|
51138
|
+
const rest = conjSet.subrefinement().map((sub) => this.buildSubrefinement(sub));
|
|
51139
|
+
return this.makeSet(ctx, "AND", conjunctionStyle(conjSet.conjunction()), [first, ...rest]);
|
|
51120
51140
|
}
|
|
51121
51141
|
const disjSet = ctx.disjunctionrefinementset();
|
|
51122
51142
|
if (disjSet) {
|
|
51123
|
-
const
|
|
51124
|
-
|
|
51125
|
-
this.collectAttributesFromSubrefinement(sub, attributes);
|
|
51126
|
-
}
|
|
51143
|
+
const rest = disjSet.subrefinement().map((sub) => this.buildSubrefinement(sub));
|
|
51144
|
+
return this.makeSet(ctx, "OR", ",", [first, ...rest]);
|
|
51127
51145
|
}
|
|
51128
|
-
return
|
|
51129
|
-
type: NodeType.Refinement,
|
|
51130
|
-
range: this.getRange(ctx),
|
|
51131
|
-
attributes
|
|
51132
|
-
};
|
|
51146
|
+
return first;
|
|
51133
51147
|
}
|
|
51134
|
-
|
|
51148
|
+
/** subrefinement : eclattributeset | eclattributegroup | ( eclrefinement ) */
|
|
51149
|
+
buildSubrefinement(ctx) {
|
|
51135
51150
|
const attrSet = ctx.eclattributeset();
|
|
51136
51151
|
if (attrSet) {
|
|
51137
|
-
this.
|
|
51138
|
-
return;
|
|
51152
|
+
return this.buildAttributeSet(attrSet);
|
|
51139
51153
|
}
|
|
51140
51154
|
const attrGroup = ctx.eclattributegroup();
|
|
51141
51155
|
if (attrGroup) {
|
|
51142
|
-
const
|
|
51143
|
-
|
|
51144
|
-
|
|
51156
|
+
const content = this.buildAttributeSet(attrGroup.eclattributeset());
|
|
51157
|
+
if (!content) {
|
|
51158
|
+
return null;
|
|
51159
|
+
}
|
|
51160
|
+
const cardinality = attrGroup.cardinality();
|
|
51161
|
+
const group = {
|
|
51162
|
+
type: NodeType.AttributeGroup,
|
|
51163
|
+
range: this.getRange(ctx),
|
|
51164
|
+
content
|
|
51165
|
+
};
|
|
51166
|
+
if (cardinality) {
|
|
51167
|
+
group.cardinality = "[" + cardinality.text + "]";
|
|
51168
|
+
}
|
|
51169
|
+
return group;
|
|
51145
51170
|
}
|
|
51146
51171
|
const nestedRef = ctx.eclrefinement();
|
|
51147
|
-
|
|
51148
|
-
const nested = this.visitEclrefinement(nestedRef);
|
|
51149
|
-
attributes.push(...nested.attributes);
|
|
51150
|
-
}
|
|
51172
|
+
return nestedRef ? markParenthesized(this.buildRefinement(nestedRef)) : null;
|
|
51151
51173
|
}
|
|
51152
|
-
|
|
51153
|
-
|
|
51174
|
+
/** eclattributeset : subattributeset ws (conjunctionattributeset | disjunctionattributeset)? */
|
|
51175
|
+
buildAttributeSet(ctx) {
|
|
51176
|
+
const first = this.buildSubattributeSet(ctx.subattributeset());
|
|
51154
51177
|
const conjSet = ctx.conjunctionattributeset();
|
|
51155
51178
|
if (conjSet) {
|
|
51156
|
-
const
|
|
51157
|
-
|
|
51158
|
-
this.collectAttributeFromSubattributeset(sub, attributes);
|
|
51159
|
-
}
|
|
51179
|
+
const rest = conjSet.subattributeset().map((sub) => this.buildSubattributeSet(sub));
|
|
51180
|
+
return this.makeSet(ctx, "AND", conjunctionStyle(conjSet.conjunction()), [first, ...rest]);
|
|
51160
51181
|
}
|
|
51161
51182
|
const disjSet = ctx.disjunctionattributeset();
|
|
51162
51183
|
if (disjSet) {
|
|
51163
|
-
const
|
|
51164
|
-
|
|
51165
|
-
this.collectAttributeFromSubattributeset(sub, attributes);
|
|
51166
|
-
}
|
|
51184
|
+
const rest = disjSet.subattributeset().map((sub) => this.buildSubattributeSet(sub));
|
|
51185
|
+
return this.makeSet(ctx, "OR", ",", [first, ...rest]);
|
|
51167
51186
|
}
|
|
51187
|
+
return first;
|
|
51168
51188
|
}
|
|
51169
|
-
|
|
51189
|
+
/** subattributeset : eclattribute | ( eclattributeset ) */
|
|
51190
|
+
buildSubattributeSet(ctx) {
|
|
51170
51191
|
const attr = ctx.eclattribute();
|
|
51171
51192
|
if (attr) {
|
|
51172
|
-
|
|
51173
|
-
if (attrNode) {
|
|
51174
|
-
attributes.push(attrNode);
|
|
51175
|
-
}
|
|
51176
|
-
return;
|
|
51193
|
+
return this.visitEclattribute(attr);
|
|
51177
51194
|
}
|
|
51178
51195
|
const nestedSet = ctx.eclattributeset();
|
|
51179
|
-
|
|
51180
|
-
|
|
51196
|
+
return nestedSet ? markParenthesized(this.buildAttributeSet(nestedSet)) : null;
|
|
51197
|
+
}
|
|
51198
|
+
/**
|
|
51199
|
+
* Build a set node from its members, dropping members that failed to parse.
|
|
51200
|
+
* Collapses to the single member when only one survives, so a set node always
|
|
51201
|
+
* represents a real operator in the source.
|
|
51202
|
+
*/
|
|
51203
|
+
makeSet(ctx, operator, style, members) {
|
|
51204
|
+
const present = members.filter((m) => m !== null);
|
|
51205
|
+
if (present.length === 0) {
|
|
51206
|
+
return null;
|
|
51181
51207
|
}
|
|
51208
|
+
if (present.length === 1) {
|
|
51209
|
+
return present[0];
|
|
51210
|
+
}
|
|
51211
|
+
return {
|
|
51212
|
+
type: NodeType.AttributeSet,
|
|
51213
|
+
range: this.getRange(ctx),
|
|
51214
|
+
operator,
|
|
51215
|
+
conjunctionStyle: operator === "AND" ? style : ",",
|
|
51216
|
+
members: present
|
|
51217
|
+
};
|
|
51182
51218
|
}
|
|
51183
51219
|
// eslint-disable-next-line sonarjs/cognitive-complexity -- ANTLR visitor with multiple grammar rule branches
|
|
51184
51220
|
visitEclattribute(ctx) {
|
|
@@ -51241,12 +51277,14 @@ class ECLASTVisitor extends AbstractParseTreeVisitorExports.AbstractParseTreeVis
|
|
|
51241
51277
|
rawValue: ctx.text
|
|
51242
51278
|
};
|
|
51243
51279
|
}
|
|
51280
|
+
const cardinalityCtx = ctx.cardinality();
|
|
51244
51281
|
return {
|
|
51245
51282
|
type: NodeType.Attribute,
|
|
51246
51283
|
range: this.getRange(ctx),
|
|
51247
51284
|
name: attrName,
|
|
51248
51285
|
value,
|
|
51249
|
-
reversed
|
|
51286
|
+
reversed,
|
|
51287
|
+
cardinality: cardinalityCtx ? "[" + cardinalityCtx.text + "]" : void 0
|
|
51250
51288
|
};
|
|
51251
51289
|
}
|
|
51252
51290
|
// Dotted expressions
|
|
@@ -51449,6 +51487,28 @@ class ECLASTVisitor extends AbstractParseTreeVisitorExports.AbstractParseTreeVis
|
|
|
51449
51487
|
}
|
|
51450
51488
|
}
|
|
51451
51489
|
}
|
|
51490
|
+
function conjunctionStyle(conjunctions) {
|
|
51491
|
+
return conjunctions.some((c) => !c.text.trimStart().startsWith(",")) ? "AND" : ",";
|
|
51492
|
+
}
|
|
51493
|
+
function collectAttributes$1(node, out) {
|
|
51494
|
+
if (!node) return;
|
|
51495
|
+
switch (node.type) {
|
|
51496
|
+
case NodeType.Attribute:
|
|
51497
|
+
out.push(node);
|
|
51498
|
+
break;
|
|
51499
|
+
case NodeType.AttributeGroup:
|
|
51500
|
+
collectAttributes$1(node.content, out);
|
|
51501
|
+
break;
|
|
51502
|
+
case NodeType.AttributeSet:
|
|
51503
|
+
for (const member of node.members) {
|
|
51504
|
+
collectAttributes$1(member, out);
|
|
51505
|
+
}
|
|
51506
|
+
break;
|
|
51507
|
+
}
|
|
51508
|
+
}
|
|
51509
|
+
function markParenthesized(node) {
|
|
51510
|
+
return (node == null ? void 0 : node.type) === NodeType.AttributeSet ? { ...node, parenthesized: true } : node;
|
|
51511
|
+
}
|
|
51452
51512
|
class ECLErrorListener {
|
|
51453
51513
|
constructor() {
|
|
51454
51514
|
__publicField(this, "errors", []);
|
|
@@ -51814,34 +51874,12 @@ function computeColumn(text, i, baseColumn) {
|
|
|
51814
51874
|
}
|
|
51815
51875
|
let lastInput = null;
|
|
51816
51876
|
let lastResult = null;
|
|
51817
|
-
function
|
|
51818
|
-
if (input === lastInput && lastResult !== null) {
|
|
51819
|
-
return lastResult;
|
|
51820
|
-
}
|
|
51877
|
+
function runParseAttempt(input, predictionMode) {
|
|
51821
51878
|
const inputStream = new antlr4tsExports.ANTLRInputStream(input);
|
|
51822
51879
|
const lexer = new ECLLexer(inputStream);
|
|
51823
51880
|
const tokenStream = new antlr4tsExports.CommonTokenStream(lexer);
|
|
51824
|
-
tokenStream.fill();
|
|
51825
|
-
const tokens = tokenStream.getTokens().map((token) => {
|
|
51826
|
-
var _a;
|
|
51827
|
-
return {
|
|
51828
|
-
type: token.type,
|
|
51829
|
-
text: token.text ?? "",
|
|
51830
|
-
range: {
|
|
51831
|
-
start: {
|
|
51832
|
-
line: token.line,
|
|
51833
|
-
column: token.charPositionInLine,
|
|
51834
|
-
offset: token.startIndex
|
|
51835
|
-
},
|
|
51836
|
-
end: {
|
|
51837
|
-
line: token.line,
|
|
51838
|
-
column: token.charPositionInLine + (((_a = token.text) == null ? void 0 : _a.length) ?? 0),
|
|
51839
|
-
offset: token.stopIndex + 1
|
|
51840
|
-
}
|
|
51841
|
-
}
|
|
51842
|
-
};
|
|
51843
|
-
});
|
|
51844
51881
|
const parser = new ECLParser(tokenStream);
|
|
51882
|
+
parser.interpreter.setPredictionMode(predictionMode);
|
|
51845
51883
|
const errorListener = new ECLErrorListener();
|
|
51846
51884
|
parser.removeErrorListeners();
|
|
51847
51885
|
parser.addErrorListener(errorListener);
|
|
@@ -51866,7 +51904,44 @@ function parseECL(input) {
|
|
|
51866
51904
|
}
|
|
51867
51905
|
} catch {
|
|
51868
51906
|
}
|
|
51869
|
-
|
|
51907
|
+
return { ast, errors: errorListener.getErrors() };
|
|
51908
|
+
}
|
|
51909
|
+
function parseWithFallback(input) {
|
|
51910
|
+
const sll = runParseAttempt(input, PredictionModeExports.PredictionMode.SLL);
|
|
51911
|
+
if (sll.ast !== null && sll.errors.length === 0) {
|
|
51912
|
+
return sll;
|
|
51913
|
+
}
|
|
51914
|
+
return runParseAttempt(input, PredictionModeExports.PredictionMode.LL);
|
|
51915
|
+
}
|
|
51916
|
+
function parseECL(input) {
|
|
51917
|
+
if (input === lastInput && lastResult !== null) {
|
|
51918
|
+
return lastResult;
|
|
51919
|
+
}
|
|
51920
|
+
const tokenInputStream = new antlr4tsExports.ANTLRInputStream(input);
|
|
51921
|
+
const tokenLexer = new ECLLexer(tokenInputStream);
|
|
51922
|
+
const tokenStream = new antlr4tsExports.CommonTokenStream(tokenLexer);
|
|
51923
|
+
tokenStream.fill();
|
|
51924
|
+
const tokens = tokenStream.getTokens().map((token) => {
|
|
51925
|
+
var _a;
|
|
51926
|
+
return {
|
|
51927
|
+
type: token.type,
|
|
51928
|
+
text: token.text ?? "",
|
|
51929
|
+
range: {
|
|
51930
|
+
start: {
|
|
51931
|
+
line: token.line,
|
|
51932
|
+
column: token.charPositionInLine,
|
|
51933
|
+
offset: token.startIndex
|
|
51934
|
+
},
|
|
51935
|
+
end: {
|
|
51936
|
+
line: token.line,
|
|
51937
|
+
column: token.charPositionInLine + (((_a = token.text) == null ? void 0 : _a.length) ?? 0),
|
|
51938
|
+
offset: token.stopIndex + 1
|
|
51939
|
+
}
|
|
51940
|
+
}
|
|
51941
|
+
};
|
|
51942
|
+
});
|
|
51943
|
+
const { ast, errors: parseErrors } = parseWithFallback(input);
|
|
51944
|
+
const existingErrors = parseErrors;
|
|
51870
51945
|
if (existingErrors.length > 0) {
|
|
51871
51946
|
const issues = analyzeExpression(input);
|
|
51872
51947
|
if (issues.mixedOperator) {
|
|
@@ -51953,7 +52028,7 @@ function parseECL(input) {
|
|
|
51953
52028
|
const warnings = ast ? checkMixedRefinementOperators(ast, input) : [];
|
|
51954
52029
|
const result = {
|
|
51955
52030
|
ast,
|
|
51956
|
-
errors:
|
|
52031
|
+
errors: parseErrors,
|
|
51957
52032
|
warnings,
|
|
51958
52033
|
tokens
|
|
51959
52034
|
};
|
|
@@ -51966,6 +52041,7 @@ function extractConceptIds(ast, options) {
|
|
|
51966
52041
|
const deduplicate = (options == null ? void 0 : options.deduplicate) ?? true;
|
|
51967
52042
|
const seenIds = /* @__PURE__ */ new Set();
|
|
51968
52043
|
function visitNode(node) {
|
|
52044
|
+
if (!node) return;
|
|
51969
52045
|
switch (node.type) {
|
|
51970
52046
|
case NodeType.ConceptReference:
|
|
51971
52047
|
if (!deduplicate || !seenIds.has(node.conceptId)) {
|
|
@@ -51991,7 +52067,7 @@ function extractConceptIds(ast, options) {
|
|
|
51991
52067
|
}
|
|
51992
52068
|
break;
|
|
51993
52069
|
case NodeType.ExpressionConstraint:
|
|
51994
|
-
|
|
52070
|
+
visitNode(node.expression);
|
|
51995
52071
|
break;
|
|
51996
52072
|
case NodeType.SubExpressionConstraint:
|
|
51997
52073
|
visitNode(node.focus);
|
|
@@ -52269,8 +52345,141 @@ function isValidDescriptionId(sctid) {
|
|
|
52269
52345
|
const partitionId = sctid.substring(sctid.length - 3, sctid.length - 1);
|
|
52270
52346
|
return partitionId === "01" || partitionId === "11";
|
|
52271
52347
|
}
|
|
52348
|
+
class TerminologyError extends Error {
|
|
52349
|
+
constructor(message, options = {}) {
|
|
52350
|
+
super(message);
|
|
52351
|
+
/**
|
|
52352
|
+
* The underlying failure.
|
|
52353
|
+
*
|
|
52354
|
+
* Declared explicitly (rather than relying on `Error.cause`) so it is part of
|
|
52355
|
+
* the emitted type declarations and is present on every runtime.
|
|
52356
|
+
*/
|
|
52357
|
+
__publicField(this, "cause");
|
|
52358
|
+
/** The request URL, when known. */
|
|
52359
|
+
__publicField(this, "url");
|
|
52360
|
+
/** The HTTP status, present only on {@link TerminologyHttpError}. */
|
|
52361
|
+
__publicField(this, "status");
|
|
52362
|
+
this.name = "TerminologyError";
|
|
52363
|
+
this.cause = options.cause;
|
|
52364
|
+
this.url = options.url;
|
|
52365
|
+
this.status = options.status;
|
|
52366
|
+
}
|
|
52367
|
+
}
|
|
52368
|
+
class TerminologyTransportError extends TerminologyError {
|
|
52369
|
+
constructor(message, options = {}) {
|
|
52370
|
+
super(message, options);
|
|
52371
|
+
__publicField(this, "kind", "transport");
|
|
52372
|
+
/** True when the failure was a client-side timeout rather than a hard failure. */
|
|
52373
|
+
__publicField(this, "timedOut");
|
|
52374
|
+
this.name = "TerminologyTransportError";
|
|
52375
|
+
this.timedOut = options.timedOut ?? false;
|
|
52376
|
+
}
|
|
52377
|
+
}
|
|
52378
|
+
class TerminologyHttpError extends TerminologyError {
|
|
52379
|
+
constructor(message, options) {
|
|
52380
|
+
super(message, options);
|
|
52381
|
+
__publicField(this, "kind", "http");
|
|
52382
|
+
/** The HTTP reason phrase, when the client exposes one. */
|
|
52383
|
+
__publicField(this, "statusText");
|
|
52384
|
+
this.name = "TerminologyHttpError";
|
|
52385
|
+
this.statusText = options.statusText;
|
|
52386
|
+
}
|
|
52387
|
+
}
|
|
52388
|
+
function isTerminologyError(value) {
|
|
52389
|
+
if (value instanceof TerminologyError) return true;
|
|
52390
|
+
if (!(value instanceof Error)) return false;
|
|
52391
|
+
const kind = value.kind;
|
|
52392
|
+
return value.name === "TerminologyTransportError" && kind === "transport" || value.name === "TerminologyHttpError" && kind === "http";
|
|
52393
|
+
}
|
|
52394
|
+
function isTerminologyTransportError(value) {
|
|
52395
|
+
return isTerminologyError(value) && value.kind === "transport";
|
|
52396
|
+
}
|
|
52397
|
+
function isTerminologyHttpError(value) {
|
|
52398
|
+
return isTerminologyError(value) && value.kind === "http";
|
|
52399
|
+
}
|
|
52400
|
+
function isAbortLike(error) {
|
|
52401
|
+
if (typeof error !== "object" || error === null) return false;
|
|
52402
|
+
const name = error.name;
|
|
52403
|
+
return name === "AbortError" || name === "TimeoutError";
|
|
52404
|
+
}
|
|
52405
|
+
function describe(error) {
|
|
52406
|
+
if (error instanceof Error) return error.message;
|
|
52407
|
+
return String(error);
|
|
52408
|
+
}
|
|
52409
|
+
function toTransportError(error, options) {
|
|
52410
|
+
if (isTerminologyTransportError(error)) return error;
|
|
52411
|
+
const timedOut = isAbortLike(error);
|
|
52412
|
+
const after = options.timeoutMs === void 0 ? "" : ` after ${options.timeoutMs}ms`;
|
|
52413
|
+
const reason = timedOut ? `timed out${after}` : `failed: ${describe(error)}`;
|
|
52414
|
+
return new TerminologyTransportError(`Could not reach the terminology server — ${options.operation} ${reason}`, {
|
|
52415
|
+
cause: error,
|
|
52416
|
+
url: options.url,
|
|
52417
|
+
timedOut
|
|
52418
|
+
});
|
|
52419
|
+
}
|
|
52420
|
+
function toHttpError(options) {
|
|
52421
|
+
const suffix = options.detail ? `: ${options.detail}` : "";
|
|
52422
|
+
return new TerminologyHttpError(
|
|
52423
|
+
`Terminology server returned HTTP ${options.status} for ${options.operation}${suffix}`,
|
|
52424
|
+
options
|
|
52425
|
+
);
|
|
52426
|
+
}
|
|
52272
52427
|
const DEFAULT_USER_AGENT = "ecl-lsp/1.0.0";
|
|
52273
52428
|
const IS_BROWSER = typeof globalThis !== "undefined" && "document" in globalThis;
|
|
52429
|
+
function isEclEvaluationStrategy(value) {
|
|
52430
|
+
return value === "auto" || value === "implicit-url" || value === "post";
|
|
52431
|
+
}
|
|
52432
|
+
class ConcurrencyQueue {
|
|
52433
|
+
constructor(max2) {
|
|
52434
|
+
__publicField(this, "running", 0);
|
|
52435
|
+
__publicField(this, "waiters", []);
|
|
52436
|
+
this.max = max2;
|
|
52437
|
+
}
|
|
52438
|
+
run(fn) {
|
|
52439
|
+
return new Promise((resolve, reject) => {
|
|
52440
|
+
const attempt = () => {
|
|
52441
|
+
this.running++;
|
|
52442
|
+
fn().then(resolve, reject).finally(() => {
|
|
52443
|
+
this.running--;
|
|
52444
|
+
const next = this.waiters.shift();
|
|
52445
|
+
if (next) next();
|
|
52446
|
+
});
|
|
52447
|
+
};
|
|
52448
|
+
if (this.running < this.max) attempt();
|
|
52449
|
+
else this.waiters.push(attempt);
|
|
52450
|
+
});
|
|
52451
|
+
}
|
|
52452
|
+
}
|
|
52453
|
+
const RETRY_BASE_DELAY_MS = 500;
|
|
52454
|
+
const RETRY_MAX_DELAY_MS = 1e4;
|
|
52455
|
+
const RETRY_MAX_ATTEMPTS = 3;
|
|
52456
|
+
const RETRY_JITTER_MS = 200;
|
|
52457
|
+
const CANONICAL_URL_RESERVED = [
|
|
52458
|
+
["|", "%7C"],
|
|
52459
|
+
// FHIR canonical `system|version` delimiter — the issue #68 corruption
|
|
52460
|
+
["#", "%23"],
|
|
52461
|
+
// URL fragment delimiter; also introduces ECL concrete values such as `#20`
|
|
52462
|
+
["&", "%26"],
|
|
52463
|
+
// separates parameters within the canonical URL's own query string
|
|
52464
|
+
["+", "%2B"],
|
|
52465
|
+
// read as a space by form-style query decoders
|
|
52466
|
+
["?", "%3F"]
|
|
52467
|
+
// query string introducer
|
|
52468
|
+
];
|
|
52469
|
+
function encodeEclForCanonicalUrl(expression) {
|
|
52470
|
+
let encoded = expression.replaceAll("%", "%25");
|
|
52471
|
+
for (const [character, escape] of CANONICAL_URL_RESERVED) {
|
|
52472
|
+
encoded = encoded.replaceAll(character, escape);
|
|
52473
|
+
}
|
|
52474
|
+
return encoded;
|
|
52475
|
+
}
|
|
52476
|
+
const VALUE_SET_NOT_FOUND = /value\s*sets?\s*not\s*found/i;
|
|
52477
|
+
const IMPLICIT_VALUE_SET_UNSUPPORTED = [
|
|
52478
|
+
/implicit[^.]*value\s*sets?[^.]*not\s*supported/i,
|
|
52479
|
+
/not\s*supported[^.]*implicit[^.]*value\s*sets?/i
|
|
52480
|
+
];
|
|
52481
|
+
class EvaluationIssueError extends Error {
|
|
52482
|
+
}
|
|
52274
52483
|
const _FhirTerminologyService = class _FhirTerminologyService {
|
|
52275
52484
|
constructor(options = {}) {
|
|
52276
52485
|
__publicField(this, "cache", /* @__PURE__ */ new Map());
|
|
@@ -52283,9 +52492,28 @@ const _FhirTerminologyService = class _FhirTerminologyService {
|
|
|
52283
52492
|
__publicField(this, "searchCacheTTL");
|
|
52284
52493
|
// milliseconds
|
|
52285
52494
|
__publicField(this, "snomedVersion");
|
|
52495
|
+
__publicField(this, "evaluationStrategy");
|
|
52286
52496
|
__publicField(this, "onResolvedVersion");
|
|
52287
52497
|
__publicField(this, "resolvedVersion", null);
|
|
52498
|
+
/**
|
|
52499
|
+
* Latched once a POST `ValueSet/$expand` fallback has succeeded in `'auto'` mode: the
|
|
52500
|
+
* server has demonstrated it cannot serve the implicit ValueSet URL form, so subsequent
|
|
52501
|
+
* evaluations skip the wasted round-trip for the lifetime of this instance.
|
|
52502
|
+
*/
|
|
52503
|
+
__publicField(this, "usePostExpand", false);
|
|
52504
|
+
/**
|
|
52505
|
+
* Latched once a bulk `ValueSet/$expand` has been rejected with a 4xx: the server does
|
|
52506
|
+
* not accept a POSTed ValueSet enumerating concepts in `compose.include.concept`, and
|
|
52507
|
+
* the request shape never varies, so retrying it on every validation pass only costs a
|
|
52508
|
+
* wasted round-trip and a console warning (issue #55). 5xx responses are treated as
|
|
52509
|
+
* transient and do not latch.
|
|
52510
|
+
*/
|
|
52511
|
+
__publicField(this, "bulkExpandUnsupported", false);
|
|
52512
|
+
__publicField(this, "queue");
|
|
52288
52513
|
var _a;
|
|
52514
|
+
const maxConcurrency = options.maxConcurrency ?? 25;
|
|
52515
|
+
if (maxConcurrency <= 0) throw new Error(`maxConcurrency must be > 0, got ${maxConcurrency}`);
|
|
52516
|
+
this.queue = new ConcurrencyQueue(maxConcurrency);
|
|
52289
52517
|
this.baseUrl = options.baseUrl ?? "https://tx.ontoserver.csiro.au/fhir";
|
|
52290
52518
|
this.timeout = options.timeout ?? 2e3;
|
|
52291
52519
|
this.userAgent = options.userAgent ?? DEFAULT_USER_AGENT;
|
|
@@ -52293,6 +52521,7 @@ const _FhirTerminologyService = class _FhirTerminologyService {
|
|
|
52293
52521
|
this.searchTimeout = 5e3;
|
|
52294
52522
|
this.searchCacheTTL = 5 * 60 * 1e3;
|
|
52295
52523
|
this.snomedVersion = ((_a = options.snomedVersion) == null ? void 0 : _a.trim()) ? options.snomedVersion.trim() : void 0;
|
|
52524
|
+
this.evaluationStrategy = isEclEvaluationStrategy(options.evaluationStrategy) ? options.evaluationStrategy : "auto";
|
|
52296
52525
|
this.onResolvedVersion = options.onResolvedVersion;
|
|
52297
52526
|
}
|
|
52298
52527
|
/** The SNOMED CT system URL base for implicit ValueSet URLs. */
|
|
@@ -52379,53 +52608,150 @@ const _FhirTerminologyService = class _FhirTerminologyService {
|
|
|
52379
52608
|
clearTimeout(timeoutId);
|
|
52380
52609
|
}
|
|
52381
52610
|
}
|
|
52611
|
+
/**
|
|
52612
|
+
* Perform a request, translating any network-level failure (connection
|
|
52613
|
+
* refused, DNS failure, timeout/abort) into a {@link TerminologyTransportError}
|
|
52614
|
+
* so callers can tell "server unreachable" from "server said no".
|
|
52615
|
+
*/
|
|
52616
|
+
async request(url, timeoutMs, operation, init) {
|
|
52617
|
+
try {
|
|
52618
|
+
return await this.fetchQueued(url, timeoutMs, init);
|
|
52619
|
+
} catch (error) {
|
|
52620
|
+
throw toTransportError(error, { url, operation, timeoutMs });
|
|
52621
|
+
}
|
|
52622
|
+
}
|
|
52623
|
+
/** Read the body of an error response, extracting a FHIR OperationOutcome if present. */
|
|
52624
|
+
static async readErrorBody(response) {
|
|
52625
|
+
var _a, _b;
|
|
52626
|
+
let text;
|
|
52627
|
+
try {
|
|
52628
|
+
text = await response.text();
|
|
52629
|
+
} catch {
|
|
52630
|
+
return { outcome: null, detail: void 0 };
|
|
52631
|
+
}
|
|
52632
|
+
let parsed;
|
|
52633
|
+
try {
|
|
52634
|
+
parsed = JSON.parse(text);
|
|
52635
|
+
} catch {
|
|
52636
|
+
const trimmed = text.trim();
|
|
52637
|
+
return { outcome: null, detail: trimmed ? trimmed.slice(0, 200) : void 0 };
|
|
52638
|
+
}
|
|
52639
|
+
const outcome = typeof parsed === "object" && parsed !== null && parsed.resourceType === "OperationOutcome" ? parsed : null;
|
|
52640
|
+
const issue = (_a = outcome == null ? void 0 : outcome.issue) == null ? void 0 : _a[0];
|
|
52641
|
+
const detail = (issue == null ? void 0 : issue.diagnostics) ?? ((_b = issue == null ? void 0 : issue.details) == null ? void 0 : _b.text);
|
|
52642
|
+
return { outcome, detail };
|
|
52643
|
+
}
|
|
52644
|
+
/**
|
|
52645
|
+
* True when an error response is the server's well-formed way of saying
|
|
52646
|
+
* "I do not know this code" — the one case that maps to `null` rather than
|
|
52647
|
+
* an exception.
|
|
52648
|
+
*
|
|
52649
|
+
* A 404 is only accepted as such when the body is a real FHIR
|
|
52650
|
+
* OperationOutcome; a bare 404 (wrong base URL, proxy page) is a fault.
|
|
52651
|
+
*/
|
|
52652
|
+
static isUnknownCodeResponse(status, outcome) {
|
|
52653
|
+
if (!outcome) return false;
|
|
52654
|
+
if (status === 404) return true;
|
|
52655
|
+
if (status !== 400 && status !== 422) return false;
|
|
52656
|
+
return (outcome.issue ?? []).some((issue) => {
|
|
52657
|
+
var _a;
|
|
52658
|
+
if (issue.code && _FhirTerminologyService.UNKNOWN_CODE_ISSUE_CODES.has(issue.code.toLowerCase())) {
|
|
52659
|
+
return true;
|
|
52660
|
+
}
|
|
52661
|
+
const prose = `${issue.diagnostics ?? ""} ${((_a = issue.details) == null ? void 0 : _a.text) ?? ""}`.toLowerCase();
|
|
52662
|
+
return _FhirTerminologyService.UNKNOWN_CODE_PHRASES.some((phrase) => prose.includes(phrase));
|
|
52663
|
+
});
|
|
52664
|
+
}
|
|
52665
|
+
/**
|
|
52666
|
+
* Look up a single concept.
|
|
52667
|
+
*
|
|
52668
|
+
* @returns the concept, or `null` when the terminology server gave a
|
|
52669
|
+
* well-formed answer saying the code is unknown to it.
|
|
52670
|
+
* @throws {TerminologyTransportError} when the server could not be reached,
|
|
52671
|
+
* the request timed out, or the response body was unusable.
|
|
52672
|
+
* @throws {TerminologyHttpError} when the server answered with an error
|
|
52673
|
+
* status that is not an "unknown code" response.
|
|
52674
|
+
*/
|
|
52675
|
+
async fetchWithRetry(url, timeoutMs, init) {
|
|
52676
|
+
for (let attempt = 0; attempt < RETRY_MAX_ATTEMPTS; attempt++) {
|
|
52677
|
+
const response = await this.fetchWithTimeout(url, timeoutMs, init);
|
|
52678
|
+
if (response.status !== 429) return response;
|
|
52679
|
+
if (attempt === RETRY_MAX_ATTEMPTS - 1) {
|
|
52680
|
+
throw new Error(`FHIR request rate-limited after ${RETRY_MAX_ATTEMPTS} attempts`);
|
|
52681
|
+
}
|
|
52682
|
+
const retryAfterHeader = response.headers.get("Retry-After");
|
|
52683
|
+
const retryAfterMs = retryAfterHeader ? parseInt(retryAfterHeader, 10) * 1e3 : 0;
|
|
52684
|
+
const backoff = Math.min(RETRY_BASE_DELAY_MS * Math.pow(2, attempt), RETRY_MAX_DELAY_MS);
|
|
52685
|
+
const jitter = Math.random() * RETRY_JITTER_MS;
|
|
52686
|
+
const waitMs = Math.max(retryAfterMs, backoff + jitter);
|
|
52687
|
+
await new Promise((resolve) => setTimeout(resolve, waitMs));
|
|
52688
|
+
}
|
|
52689
|
+
throw new Error("Unreachable");
|
|
52690
|
+
}
|
|
52691
|
+
fetchQueued(url, timeoutMs, init) {
|
|
52692
|
+
return this.queue.run(() => this.fetchWithRetry(url, timeoutMs, init));
|
|
52693
|
+
}
|
|
52382
52694
|
async getConceptInfo(conceptId) {
|
|
52383
52695
|
var _a;
|
|
52384
52696
|
const cached = this.cache.get(conceptId);
|
|
52385
52697
|
if (cached) {
|
|
52386
52698
|
return cached;
|
|
52387
52699
|
}
|
|
52388
|
-
|
|
52389
|
-
|
|
52390
|
-
|
|
52391
|
-
|
|
52392
|
-
|
|
52393
|
-
|
|
52394
|
-
|
|
52700
|
+
let url = `${this.baseUrl}/CodeSystem/$lookup?system=http://snomed.info/sct&code=${encodeURIComponent(conceptId)}`;
|
|
52701
|
+
if (this.snomedVersion) {
|
|
52702
|
+
url += `&version=${encodeURIComponent(this.snomedVersion)}`;
|
|
52703
|
+
}
|
|
52704
|
+
const operation = `$lookup of concept ${conceptId}`;
|
|
52705
|
+
const response = await this.request(url, this.timeout, operation);
|
|
52706
|
+
if (!response.ok) {
|
|
52707
|
+
const { outcome, detail } = await _FhirTerminologyService.readErrorBody(response);
|
|
52708
|
+
if (_FhirTerminologyService.isUnknownCodeResponse(response.status, outcome)) {
|
|
52395
52709
|
return null;
|
|
52396
52710
|
}
|
|
52397
|
-
|
|
52398
|
-
|
|
52399
|
-
|
|
52400
|
-
|
|
52401
|
-
|
|
52402
|
-
|
|
52403
|
-
const parts = prop.part ?? [];
|
|
52404
|
-
const codePart = parts.find((p) => p.name === "code" && p.valueCode === "inactive");
|
|
52405
|
-
return codePart !== void 0;
|
|
52711
|
+
throw toHttpError({
|
|
52712
|
+
status: response.status,
|
|
52713
|
+
statusText: response.statusText,
|
|
52714
|
+
url,
|
|
52715
|
+
operation,
|
|
52716
|
+
detail
|
|
52406
52717
|
});
|
|
52407
|
-
|
|
52408
|
-
|
|
52409
|
-
|
|
52410
|
-
|
|
52411
|
-
active = false;
|
|
52412
|
-
}
|
|
52413
|
-
}
|
|
52414
|
-
const conceptInfo = {
|
|
52415
|
-
id: conceptId,
|
|
52416
|
-
fsn: display,
|
|
52417
|
-
pt: display,
|
|
52418
|
-
// Simplified - would need to parse designations
|
|
52419
|
-
active
|
|
52420
|
-
};
|
|
52421
|
-
if (this.cache.size < 1e4) {
|
|
52422
|
-
this.cache.set(conceptId, conceptInfo);
|
|
52423
|
-
}
|
|
52424
|
-
return conceptInfo;
|
|
52718
|
+
}
|
|
52719
|
+
let data;
|
|
52720
|
+
try {
|
|
52721
|
+
data = await response.json();
|
|
52425
52722
|
} catch (error) {
|
|
52426
|
-
|
|
52427
|
-
|
|
52723
|
+
throw new TerminologyTransportError(`Terminology server returned an unreadable response for ${operation}`, {
|
|
52724
|
+
cause: error,
|
|
52725
|
+
url
|
|
52726
|
+
});
|
|
52727
|
+
}
|
|
52728
|
+
const params = data.parameter ?? [];
|
|
52729
|
+
this.captureResolvedVersionFromLookup(params);
|
|
52730
|
+
const display = ((_a = params.find((p) => p.name === "display")) == null ? void 0 : _a.valueString) ?? "";
|
|
52731
|
+
const properties = params.filter((p) => p.name === "property");
|
|
52732
|
+
const inactiveProperty = properties.find((prop) => {
|
|
52733
|
+
const parts = prop.part ?? [];
|
|
52734
|
+
const codePart = parts.find((p) => p.name === "code" && p.valueCode === "inactive");
|
|
52735
|
+
return codePart !== void 0;
|
|
52736
|
+
});
|
|
52737
|
+
let active = true;
|
|
52738
|
+
if (inactiveProperty) {
|
|
52739
|
+
const valuePart = (inactiveProperty.part ?? []).find((p) => p.name === "value");
|
|
52740
|
+
if ((valuePart == null ? void 0 : valuePart.valueBoolean) === true) {
|
|
52741
|
+
active = false;
|
|
52742
|
+
}
|
|
52743
|
+
}
|
|
52744
|
+
const conceptInfo = {
|
|
52745
|
+
id: conceptId,
|
|
52746
|
+
fsn: display,
|
|
52747
|
+
pt: display,
|
|
52748
|
+
// Simplified - would need to parse designations
|
|
52749
|
+
active
|
|
52750
|
+
};
|
|
52751
|
+
if (this.cache.size < 1e4) {
|
|
52752
|
+
this.cache.set(conceptId, conceptInfo);
|
|
52428
52753
|
}
|
|
52754
|
+
return conceptInfo;
|
|
52429
52755
|
}
|
|
52430
52756
|
async getHistoricalAssociations(conceptId) {
|
|
52431
52757
|
const entries = Object.entries(_FhirTerminologyService.ASSOCIATION_REFSETS);
|
|
@@ -52444,7 +52770,7 @@ const _FhirTerminologyService = class _FhirTerminologyService {
|
|
|
52444
52770
|
const cmUrl = `${this.snomedSystemUrl}?fhir_cm=${refsetId}`;
|
|
52445
52771
|
const targetUrl = "http://snomed.info/sct?fhir_vs";
|
|
52446
52772
|
const url = `${this.baseUrl}/ConceptMap/$translate?code=${encodeURIComponent(conceptId)}&system=${encodeURIComponent("http://snomed.info/sct")}&target=${encodeURIComponent(targetUrl)}&url=${encodeURIComponent(cmUrl)}`;
|
|
52447
|
-
const response = await this.
|
|
52773
|
+
const response = await this.fetchQueued(url, this.timeout, {
|
|
52448
52774
|
headers: { Accept: "application/fhir+json" }
|
|
52449
52775
|
});
|
|
52450
52776
|
if (!response.ok) return [];
|
|
@@ -52467,11 +52793,65 @@ const _FhirTerminologyService = class _FhirTerminologyService {
|
|
|
52467
52793
|
return [];
|
|
52468
52794
|
}
|
|
52469
52795
|
}
|
|
52796
|
+
/**
|
|
52797
|
+
* Validate a batch of concepts.
|
|
52798
|
+
*
|
|
52799
|
+
* A `null` map value means the terminology server positively reported the
|
|
52800
|
+
* code as unknown. Failures are never reported as `null` — they reject.
|
|
52801
|
+
*
|
|
52802
|
+
* @throws {TerminologyTransportError} when the server could not be reached.
|
|
52803
|
+
* @throws {TerminologyHttpError} when the server answered with an error status.
|
|
52804
|
+
*/
|
|
52470
52805
|
async validateConcepts(conceptIds) {
|
|
52471
52806
|
const results = /* @__PURE__ */ new Map();
|
|
52472
52807
|
if (conceptIds.length === 0) {
|
|
52473
52808
|
return results;
|
|
52474
52809
|
}
|
|
52810
|
+
const uncachedIds = this.partitionCached(conceptIds, results);
|
|
52811
|
+
if (uncachedIds.length === 0) {
|
|
52812
|
+
return results;
|
|
52813
|
+
}
|
|
52814
|
+
if (this.bulkExpandUnsupported) {
|
|
52815
|
+
await this.lookupEach(uncachedIds, results);
|
|
52816
|
+
return results;
|
|
52817
|
+
}
|
|
52818
|
+
try {
|
|
52819
|
+
const expandResults = await this.bulkExpand(uncachedIds);
|
|
52820
|
+
const missingIds = this.mergeExpandResults(uncachedIds, expandResults, results);
|
|
52821
|
+
await this.lookupEach(missingIds, results);
|
|
52822
|
+
return results;
|
|
52823
|
+
} catch (error) {
|
|
52824
|
+
if (isTerminologyTransportError(error)) throw error;
|
|
52825
|
+
if (isTerminologyHttpError(error) && error.status >= 400 && error.status < 500) {
|
|
52826
|
+
this.bulkExpandUnsupported = true;
|
|
52827
|
+
}
|
|
52828
|
+
await this.lookupEach(uncachedIds, results);
|
|
52829
|
+
return results;
|
|
52830
|
+
}
|
|
52831
|
+
}
|
|
52832
|
+
/**
|
|
52833
|
+
* Move concepts found in a bulk expansion into `results` (and the cache),
|
|
52834
|
+
* returning the IDs that were absent and still need an individual lookup.
|
|
52835
|
+
*/
|
|
52836
|
+
mergeExpandResults(uncachedIds, expandResults, results) {
|
|
52837
|
+
const missingIds = [];
|
|
52838
|
+
for (const id of uncachedIds) {
|
|
52839
|
+
const info = expandResults.get(id);
|
|
52840
|
+
if (info) {
|
|
52841
|
+
results.set(id, info);
|
|
52842
|
+
if (this.cache.size < 1e4) {
|
|
52843
|
+
this.cache.set(id, info);
|
|
52844
|
+
}
|
|
52845
|
+
} else {
|
|
52846
|
+
missingIds.push(id);
|
|
52847
|
+
}
|
|
52848
|
+
}
|
|
52849
|
+
return missingIds;
|
|
52850
|
+
}
|
|
52851
|
+
/**
|
|
52852
|
+
* Move already-cached concepts into `results`, returning the IDs still to fetch.
|
|
52853
|
+
*/
|
|
52854
|
+
partitionCached(conceptIds, results) {
|
|
52475
52855
|
const uncachedIds = [];
|
|
52476
52856
|
for (const id of conceptIds) {
|
|
52477
52857
|
const cachedInfo = this.cache.get(id);
|
|
@@ -52481,40 +52861,17 @@ const _FhirTerminologyService = class _FhirTerminologyService {
|
|
|
52481
52861
|
uncachedIds.push(id);
|
|
52482
52862
|
}
|
|
52483
52863
|
}
|
|
52484
|
-
|
|
52485
|
-
|
|
52486
|
-
|
|
52487
|
-
|
|
52488
|
-
|
|
52489
|
-
|
|
52490
|
-
|
|
52491
|
-
const info = expandResults.get(id);
|
|
52492
|
-
if (info) {
|
|
52493
|
-
results.set(id, info);
|
|
52494
|
-
if (this.cache.size < 1e4) {
|
|
52495
|
-
this.cache.set(id, info);
|
|
52496
|
-
}
|
|
52497
|
-
} else {
|
|
52498
|
-
missingIds.push(id);
|
|
52499
|
-
}
|
|
52500
|
-
}
|
|
52501
|
-
if (missingIds.length > 0) {
|
|
52502
|
-
const lookups = missingIds.map(async (id) => {
|
|
52503
|
-
const info = await this.getConceptInfo(id);
|
|
52504
|
-
results.set(id, info);
|
|
52505
|
-
});
|
|
52506
|
-
await Promise.all(lookups);
|
|
52507
|
-
}
|
|
52508
|
-
return results;
|
|
52509
|
-
} catch (error) {
|
|
52510
|
-
console.warn("Bulk concept validation failed, falling back to individual lookups:", error);
|
|
52511
|
-
const lookups = uncachedIds.map(async (id) => {
|
|
52864
|
+
return uncachedIds;
|
|
52865
|
+
}
|
|
52866
|
+
/** Look each concept up individually, recording the result (or `null` if absent). */
|
|
52867
|
+
async lookupEach(conceptIds, results) {
|
|
52868
|
+
if (conceptIds.length === 0) return;
|
|
52869
|
+
await Promise.all(
|
|
52870
|
+
conceptIds.map(async (id) => {
|
|
52512
52871
|
const info = await this.getConceptInfo(id);
|
|
52513
52872
|
results.set(id, info);
|
|
52514
|
-
})
|
|
52515
|
-
|
|
52516
|
-
return results;
|
|
52517
|
-
}
|
|
52873
|
+
})
|
|
52874
|
+
);
|
|
52518
52875
|
}
|
|
52519
52876
|
async bulkExpand(conceptIds) {
|
|
52520
52877
|
var _a, _b;
|
|
@@ -52531,13 +52888,21 @@ const _FhirTerminologyService = class _FhirTerminologyService {
|
|
|
52531
52888
|
resourceType: "ValueSet",
|
|
52532
52889
|
compose: { include: [include] }
|
|
52533
52890
|
};
|
|
52534
|
-
const
|
|
52891
|
+
const operation = `bulk $expand of ${conceptIds.length} concept(s)`;
|
|
52892
|
+
const response = await this.request(url, this.timeout, operation, {
|
|
52535
52893
|
method: "POST",
|
|
52536
52894
|
headers: { "Content-Type": "application/fhir+json" },
|
|
52537
52895
|
body: JSON.stringify(valueSet)
|
|
52538
52896
|
});
|
|
52539
52897
|
if (!response.ok) {
|
|
52540
|
-
|
|
52898
|
+
const { detail } = await _FhirTerminologyService.readErrorBody(response);
|
|
52899
|
+
throw toHttpError({
|
|
52900
|
+
status: response.status,
|
|
52901
|
+
statusText: response.statusText,
|
|
52902
|
+
url,
|
|
52903
|
+
operation,
|
|
52904
|
+
detail
|
|
52905
|
+
});
|
|
52541
52906
|
}
|
|
52542
52907
|
const data = await response.json();
|
|
52543
52908
|
this.captureResolvedVersion((_a = data.expansion) == null ? void 0 : _a.parameter);
|
|
@@ -52566,6 +52931,14 @@ const _FhirTerminologyService = class _FhirTerminologyService {
|
|
|
52566
52931
|
}
|
|
52567
52932
|
return results;
|
|
52568
52933
|
}
|
|
52934
|
+
/**
|
|
52935
|
+
* Search for concepts by text or SCTID.
|
|
52936
|
+
*
|
|
52937
|
+
* An empty result set means the server found no matches.
|
|
52938
|
+
*
|
|
52939
|
+
* @throws {TerminologyTransportError} when the server could not be reached.
|
|
52940
|
+
* @throws {TerminologyHttpError} when the server answered with an error status.
|
|
52941
|
+
*/
|
|
52569
52942
|
// eslint-disable-next-line sonarjs/cognitive-complexity -- FHIR response parser with nested property traversal
|
|
52570
52943
|
async searchConcepts(query) {
|
|
52571
52944
|
if (!query || query.trim().length === 0) {
|
|
@@ -52592,22 +52965,17 @@ const _FhirTerminologyService = class _FhirTerminologyService {
|
|
|
52592
52965
|
}
|
|
52593
52966
|
entriesToDelete.forEach((key) => this.searchCache.delete(key));
|
|
52594
52967
|
}
|
|
52595
|
-
|
|
52596
|
-
|
|
52597
|
-
|
|
52598
|
-
|
|
52599
|
-
|
|
52600
|
-
response = await this.searchByFilter(trimmedQuery);
|
|
52601
|
-
}
|
|
52602
|
-
this.searchCache.set(trimmedQuery, {
|
|
52603
|
-
data: response,
|
|
52604
|
-
timestamp: Date.now()
|
|
52605
|
-
});
|
|
52606
|
-
return response;
|
|
52607
|
-
} catch (error) {
|
|
52608
|
-
console.warn(`Search failed for query "${trimmedQuery}":`, error);
|
|
52609
|
-
throw new Error("Terminology server unavailable");
|
|
52968
|
+
let response;
|
|
52969
|
+
if (/^\d+$/.test(trimmedQuery) && isValidSnomedId(trimmedQuery)) {
|
|
52970
|
+
response = await this.lookupById(trimmedQuery);
|
|
52971
|
+
} else {
|
|
52972
|
+
response = await this.searchByFilter(trimmedQuery);
|
|
52610
52973
|
}
|
|
52974
|
+
this.searchCache.set(trimmedQuery, {
|
|
52975
|
+
data: response,
|
|
52976
|
+
timestamp: Date.now()
|
|
52977
|
+
});
|
|
52978
|
+
return response;
|
|
52611
52979
|
}
|
|
52612
52980
|
async lookupById(conceptId) {
|
|
52613
52981
|
const info = await this.getConceptInfo(conceptId);
|
|
@@ -52626,26 +52994,116 @@ const _FhirTerminologyService = class _FhirTerminologyService {
|
|
|
52626
52994
|
};
|
|
52627
52995
|
}
|
|
52628
52996
|
async evaluateEcl(expression, limit = 200) {
|
|
52629
|
-
var _a, _b, _c, _d, _e;
|
|
52630
52997
|
if (!expression || expression.trim().length === 0) {
|
|
52631
52998
|
return { total: 0, concepts: [], truncated: false };
|
|
52632
52999
|
}
|
|
52633
|
-
const
|
|
52634
|
-
const
|
|
52635
|
-
|
|
52636
|
-
|
|
52637
|
-
|
|
52638
|
-
|
|
52639
|
-
|
|
52640
|
-
|
|
52641
|
-
|
|
52642
|
-
|
|
52643
|
-
|
|
52644
|
-
|
|
53000
|
+
const trimmed = expression.trim();
|
|
53001
|
+
const deadline = Date.now() + this.evaluationTimeout;
|
|
53002
|
+
try {
|
|
53003
|
+
return await this.runEvaluationStrategy(trimmed, limit, deadline);
|
|
53004
|
+
} catch (error) {
|
|
53005
|
+
if (!(error instanceof EvaluationIssueError)) throw error;
|
|
53006
|
+
throw this.createEvaluationError(trimmed, error);
|
|
53007
|
+
}
|
|
53008
|
+
}
|
|
53009
|
+
/**
|
|
53010
|
+
* Transport selection for {@link evaluateEcl}.
|
|
53011
|
+
*
|
|
53012
|
+
* A forced `'post'` strategy — or a latched successful POST fallback — goes straight to
|
|
53013
|
+
* `POST ValueSet/$expand`. Otherwise the implicit ValueSet URL GET runs first, and in
|
|
53014
|
+
* `'auto'` mode a failure whose *shape* says the server cannot serve implicit ValueSets
|
|
53015
|
+
* (issue #55) is retried over POST.
|
|
53016
|
+
*/
|
|
53017
|
+
async runEvaluationStrategy(expression, limit, deadline) {
|
|
53018
|
+
if (this.evaluationStrategy === "post" || this.usePostExpand) {
|
|
53019
|
+
return await this.evaluateViaPostExpand(expression, limit, deadline);
|
|
53020
|
+
}
|
|
53021
|
+
const response = await this.fetchQueued(
|
|
53022
|
+
this.buildImplicitEvaluationUrl(expression, limit),
|
|
53023
|
+
this.remainingTimeout(deadline)
|
|
53024
|
+
);
|
|
53025
|
+
if (response.ok) {
|
|
53026
|
+
return this.parseEvaluationResponse(await response.json());
|
|
53027
|
+
}
|
|
53028
|
+
const outcome = await this.readOperationOutcome(response);
|
|
53029
|
+
if (this.evaluationStrategy === "implicit-url" || !this.shouldFallbackToPostExpand(response.status, outcome)) {
|
|
53030
|
+
throw new EvaluationIssueError(outcome.issue);
|
|
53031
|
+
}
|
|
53032
|
+
try {
|
|
53033
|
+
const result = await this.evaluateViaPostExpand(expression, limit, deadline);
|
|
53034
|
+
this.usePostExpand = true;
|
|
53035
|
+
return result;
|
|
53036
|
+
} catch (error) {
|
|
53037
|
+
if (!(error instanceof EvaluationIssueError)) throw error;
|
|
53038
|
+
throw new EvaluationIssueError(
|
|
53039
|
+
`${error.message} (POST ValueSet/$expand fallback; the implicit ValueSet URL also failed: ${outcome.issue})`,
|
|
53040
|
+
{ cause: error }
|
|
53041
|
+
);
|
|
53042
|
+
}
|
|
53043
|
+
}
|
|
53044
|
+
/** `GET ValueSet/$expand?url=<canonical implicit ECL ValueSet>` — see {@link encodeEclForCanonicalUrl}. */
|
|
53045
|
+
buildImplicitEvaluationUrl(expression, limit) {
|
|
53046
|
+
const implicitVsUrl = `${this.snomedSystemUrl}?fhir_vs=ecl/${encodeEclForCanonicalUrl(expression)}`;
|
|
53047
|
+
return `${this.baseUrl}/ValueSet/$expand?url=${encodeURIComponent(implicitVsUrl)}&count=${limit}`;
|
|
53048
|
+
}
|
|
53049
|
+
/**
|
|
53050
|
+
* `POST ValueSet/$expand` carrying the ECL in `compose.include.filter` with
|
|
53051
|
+
* `property: "constraint"` — the form requested in issue #55. The expression travels in a
|
|
53052
|
+
* JSON body, so it needs no escaping at all.
|
|
53053
|
+
*/
|
|
53054
|
+
async evaluateViaPostExpand(expression, limit, deadline) {
|
|
53055
|
+
const include = {
|
|
53056
|
+
system: "http://snomed.info/sct",
|
|
53057
|
+
// eslint-disable-line sonarjs/no-clear-text-protocols -- FHIR system URI, not a network URL
|
|
53058
|
+
...this.snomedVersion ? { version: this.snomedVersion } : {},
|
|
53059
|
+
filter: [{ property: "constraint", op: "=", value: expression }]
|
|
53060
|
+
};
|
|
53061
|
+
const response = await this.fetchQueued(
|
|
53062
|
+
`${this.baseUrl}/ValueSet/$expand?count=${limit}`,
|
|
53063
|
+
this.remainingTimeout(deadline),
|
|
53064
|
+
{
|
|
53065
|
+
method: "POST",
|
|
53066
|
+
headers: { "Content-Type": "application/fhir+json", Accept: "application/fhir+json" },
|
|
53067
|
+
body: JSON.stringify({ resourceType: "ValueSet", compose: { include: [include] } })
|
|
52645
53068
|
}
|
|
52646
|
-
|
|
53069
|
+
);
|
|
53070
|
+
if (!response.ok) {
|
|
53071
|
+
throw new EvaluationIssueError((await this.readOperationOutcome(response)).issue);
|
|
52647
53072
|
}
|
|
52648
|
-
|
|
53073
|
+
return this.parseEvaluationResponse(await response.json());
|
|
53074
|
+
}
|
|
53075
|
+
/**
|
|
53076
|
+
* True when an implicit-URL failure indicates the implicit ValueSet *form* is unsupported
|
|
53077
|
+
* rather than the expression being invalid.
|
|
53078
|
+
*
|
|
53079
|
+
* Deliberately excludes a bare HTTP 422: that is also how a genuine ECL syntax error
|
|
53080
|
+
* presents, and retrying those over POST would only turn one clear error into two requests
|
|
53081
|
+
* and a muddled message. The `'not-found'` OperationOutcome code is still honoured on any
|
|
53082
|
+
* status, which covers servers that report a missing implicit ValueSet as 422.
|
|
53083
|
+
*/
|
|
53084
|
+
shouldFallbackToPostExpand(status, outcome) {
|
|
53085
|
+
return status === 404 || status === 414 || outcome.code === "not-found" || VALUE_SET_NOT_FOUND.test(outcome.issue) || IMPLICIT_VALUE_SET_UNSUPPORTED.some((pattern) => pattern.test(outcome.issue));
|
|
53086
|
+
}
|
|
53087
|
+
/** Remaining milliseconds in the shared evaluation budget; throws once it is spent. */
|
|
53088
|
+
remainingTimeout(deadline) {
|
|
53089
|
+
const remaining = deadline - Date.now();
|
|
53090
|
+
if (remaining <= 0) {
|
|
53091
|
+
throw new EvaluationIssueError("evaluation timed out");
|
|
53092
|
+
}
|
|
53093
|
+
return remaining;
|
|
53094
|
+
}
|
|
53095
|
+
/** The machine-readable code and human-readable text of a FHIR error response. */
|
|
53096
|
+
async readOperationOutcome(response) {
|
|
53097
|
+
var _a, _b;
|
|
53098
|
+
const data = await response.json().catch(() => null);
|
|
53099
|
+
const first = (_a = data == null ? void 0 : data.issue) == null ? void 0 : _a[0];
|
|
53100
|
+
return {
|
|
53101
|
+
code: first == null ? void 0 : first.code,
|
|
53102
|
+
issue: (first == null ? void 0 : first.diagnostics) ?? ((_b = first == null ? void 0 : first.details) == null ? void 0 : _b.text) ?? `HTTP ${response.status}`
|
|
53103
|
+
};
|
|
53104
|
+
}
|
|
53105
|
+
/** Shared expansion mapping for both the implicit-URL and POST evaluation transports. */
|
|
53106
|
+
parseEvaluationResponse(data) {
|
|
52649
53107
|
const expansion = data.expansion ?? {};
|
|
52650
53108
|
this.captureResolvedVersion(expansion.parameter);
|
|
52651
53109
|
const total = typeof expansion.total === "number" ? expansion.total : 0;
|
|
@@ -52660,11 +53118,31 @@ Note: Some ECL 2.2 filter syntax (e.g. {{ D id = ... }}) may not be supported by
|
|
|
52660
53118
|
truncated: total > concepts.length
|
|
52661
53119
|
};
|
|
52662
53120
|
}
|
|
53121
|
+
createEvaluationError(expression, error) {
|
|
53122
|
+
const issue = error.message;
|
|
53123
|
+
if (expression.includes("{{") && /no viable alternative/i.test(issue)) {
|
|
53124
|
+
const cleaned = issue.replace(/^\[[0-9a-f-]+\]:\s*/i, "");
|
|
53125
|
+
return new Error(
|
|
53126
|
+
`FHIR evaluation failed: ${cleaned}
|
|
53127
|
+
Note: Some ECL 2.2 filter syntax (e.g. {{ D id = ... }}) may not be supported by this terminology server.`,
|
|
53128
|
+
{ cause: error }
|
|
53129
|
+
);
|
|
53130
|
+
}
|
|
53131
|
+
return new Error(`FHIR evaluation failed: ${issue}`, { cause: error });
|
|
53132
|
+
}
|
|
52663
53133
|
async searchByFilter(filter) {
|
|
52664
53134
|
const url = `${this.baseUrl}/ValueSet/$expand?url=${this.snomedSystemUrl}?fhir_vs&filter=${encodeURIComponent(filter)}&count=21&includeDesignations=true&activeOnly=true`;
|
|
52665
|
-
const
|
|
53135
|
+
const operation = `concept search for "${filter}"`;
|
|
53136
|
+
const response = await this.request(url, this.searchTimeout, operation);
|
|
52666
53137
|
if (!response.ok) {
|
|
52667
|
-
|
|
53138
|
+
const { detail } = await _FhirTerminologyService.readErrorBody(response);
|
|
53139
|
+
throw toHttpError({
|
|
53140
|
+
status: response.status,
|
|
53141
|
+
statusText: response.statusText,
|
|
53142
|
+
url,
|
|
53143
|
+
operation,
|
|
53144
|
+
detail
|
|
53145
|
+
});
|
|
52668
53146
|
}
|
|
52669
53147
|
const data = await response.json();
|
|
52670
53148
|
const expansion = data.expansion ?? {};
|
|
@@ -52690,9 +53168,17 @@ Note: Some ECL 2.2 filter syntax (e.g. {{ D id = ... }}) may not be supported by
|
|
|
52690
53168
|
async getSnomedEditions() {
|
|
52691
53169
|
var _a;
|
|
52692
53170
|
const url = `${this.baseUrl}/CodeSystem?url=http://snomed.info/sct`;
|
|
52693
|
-
const
|
|
53171
|
+
const operation = "SNOMED CT edition discovery";
|
|
53172
|
+
const response = await this.request(url, this.searchTimeout, operation);
|
|
52694
53173
|
if (!response.ok) {
|
|
52695
|
-
|
|
53174
|
+
const { detail } = await _FhirTerminologyService.readErrorBody(response);
|
|
53175
|
+
throw toHttpError({
|
|
53176
|
+
status: response.status,
|
|
53177
|
+
statusText: response.statusText,
|
|
53178
|
+
url,
|
|
53179
|
+
operation,
|
|
53180
|
+
detail
|
|
53181
|
+
});
|
|
52696
53182
|
}
|
|
52697
53183
|
const data = await response.json();
|
|
52698
53184
|
const editionMap = /* @__PURE__ */ new Map();
|
|
@@ -52717,6 +53203,10 @@ Note: Some ECL 2.2 filter syntax (e.g. {{ D id = ... }}) may not be supported by
|
|
|
52717
53203
|
return editions;
|
|
52718
53204
|
}
|
|
52719
53205
|
};
|
|
53206
|
+
/** Issue codes a FHIR server uses to say "this code is not in the code system". */
|
|
53207
|
+
__publicField(_FhirTerminologyService, "UNKNOWN_CODE_ISSUE_CODES", /* @__PURE__ */ new Set(["not-found", "code-invalid", "invalid-code"]));
|
|
53208
|
+
/** Phrases servers use in OperationOutcome prose when a code is unknown. */
|
|
53209
|
+
__publicField(_FhirTerminologyService, "UNKNOWN_CODE_PHRASES", ["unknown code", "not found", "invalid code", "unable to find"]);
|
|
52720
53210
|
/** Map of SNOMED CT historical association reference set IDs to association types. */
|
|
52721
53211
|
__publicField(_FhirTerminologyService, "ASSOCIATION_REFSETS", {
|
|
52722
53212
|
"900000000000527005": "same-as",
|
|
@@ -53192,13 +53682,13 @@ function printAst(ast, sourceText, options) {
|
|
|
53192
53682
|
if (!ast) {
|
|
53193
53683
|
return "";
|
|
53194
53684
|
}
|
|
53195
|
-
return printExpression$1(ast, 0, 0, options, sourceText);
|
|
53685
|
+
return printExpression$1(ast, 0, 0, options, sourceText, true);
|
|
53196
53686
|
}
|
|
53197
|
-
function printExpression$1(node, depth, column, opts, src) {
|
|
53687
|
+
function printExpression$1(node, depth, column, opts, src, isRoot = false) {
|
|
53198
53688
|
const inner = node.expression;
|
|
53199
53689
|
switch (inner.type) {
|
|
53200
53690
|
case NodeType.SubExpressionConstraint:
|
|
53201
|
-
return printSubExpression$1(inner, depth, column, opts, src);
|
|
53691
|
+
return printSubExpression$1(inner, depth, column, opts, src, isRoot);
|
|
53202
53692
|
case NodeType.CompoundExpression:
|
|
53203
53693
|
return printCompoundExpression$1(inner, depth, column, opts, src);
|
|
53204
53694
|
case NodeType.RefinedExpression:
|
|
@@ -53211,7 +53701,7 @@ function printExpression$1(node, depth, column, opts, src) {
|
|
|
53211
53701
|
}
|
|
53212
53702
|
}
|
|
53213
53703
|
}
|
|
53214
|
-
function printSubExpression$1(node, depth, column, opts, src) {
|
|
53704
|
+
function printSubExpression$1(node, depth, column, opts, src, isRoot = false) {
|
|
53215
53705
|
let result = "";
|
|
53216
53706
|
if (node.operator) {
|
|
53217
53707
|
result += node.operator.operator + " ";
|
|
@@ -53228,10 +53718,11 @@ function printSubExpression$1(node, depth, column, opts, src) {
|
|
|
53228
53718
|
break;
|
|
53229
53719
|
case NodeType.ExpressionConstraint: {
|
|
53230
53720
|
const innerExpr = node.focus;
|
|
53231
|
-
if (opts.removeRedundantParentheses && !node.operator && !node.memberOf) {
|
|
53721
|
+
if (opts.removeRedundantParentheses && !node.operator && !node.memberOf && !node.filters && !node.historySupplement) {
|
|
53232
53722
|
const inner = innerExpr.expression;
|
|
53233
|
-
|
|
53234
|
-
|
|
53723
|
+
const needsParens = !isRoot && (inner.type === NodeType.RefinedExpression || inner.type === NodeType.DottedExpression);
|
|
53724
|
+
if (inner.type !== NodeType.CompoundExpression && !needsParens) {
|
|
53725
|
+
result += printExpression$1(innerExpr, depth, column + result.length, opts, src, isRoot);
|
|
53235
53726
|
break;
|
|
53236
53727
|
}
|
|
53237
53728
|
}
|
|
@@ -53263,7 +53754,7 @@ function printSubExpression$1(node, depth, column, opts, src) {
|
|
|
53263
53754
|
}
|
|
53264
53755
|
function printCompoundExpression$1(node, depth, column, opts, src) {
|
|
53265
53756
|
const op = node.operator.operator;
|
|
53266
|
-
const opSep =
|
|
53757
|
+
const opSep = ` ${op} `;
|
|
53267
53758
|
let operands = node.operands;
|
|
53268
53759
|
if (opts.removeRedundantParentheses && (op === "AND" || op === "OR")) {
|
|
53269
53760
|
operands = flattenSameOperatorOperands(operands, op);
|
|
@@ -53326,42 +53817,84 @@ function printRefinedExpression$1(node, depth, column, opts, src) {
|
|
|
53326
53817
|
}
|
|
53327
53818
|
const focusIsMultilineParen = focus.includes("\n") && node.expression.focus.type === NodeType.ExpressionConstraint;
|
|
53328
53819
|
const attrDepth = focusIsMultilineParen ? depth + 2 : depth + 1;
|
|
53329
|
-
const
|
|
53330
|
-
|
|
53331
|
-
|
|
53332
|
-
|
|
53333
|
-
|
|
53334
|
-
const attrs = node.refinement.attributes.map((a) => printAttribute$1(a, attrDepth + 1, innerInd.length, opts, src));
|
|
53335
|
-
return focus + ":\n" + ind + "{\n" + attrs.map((a) => innerInd + a).join(",\n") + "\n" + ind + "}";
|
|
53336
|
-
}
|
|
53337
|
-
const attrParts = [];
|
|
53338
|
-
let prevEnd = node.refinement.range.start.offset;
|
|
53339
|
-
for (const attr of node.refinement.attributes) {
|
|
53340
|
-
const printed = printAttribute$1(attr, attrDepth, ind.length, opts, src);
|
|
53341
|
-
const inBraces = isAttrInBraceGroup$1(attr, prevEnd, src);
|
|
53342
|
-
attrParts.push(ind + (inBraces ? "{ " + printed + " }" : printed));
|
|
53343
|
-
prevEnd = attr.range.end.offset;
|
|
53344
|
-
}
|
|
53345
|
-
return focus + ":\n" + attrParts.join(",\n");
|
|
53346
|
-
}
|
|
53347
|
-
function isAttrInBraceGroup$1(attr, prevEnd, src) {
|
|
53348
|
-
const gap = src.slice(prevEnd, attr.range.start.offset);
|
|
53349
|
-
return gap.includes("{");
|
|
53820
|
+
const content = node.refinement.content;
|
|
53821
|
+
if (!content) {
|
|
53822
|
+
return focus + ":";
|
|
53823
|
+
}
|
|
53824
|
+
return focus + ":\n" + printMemberBlock(content, attrDepth, opts, src);
|
|
53350
53825
|
}
|
|
53351
|
-
function
|
|
53352
|
-
|
|
53353
|
-
|
|
53354
|
-
|
|
53355
|
-
|
|
53356
|
-
|
|
53357
|
-
|
|
53358
|
-
|
|
53826
|
+
function setSeparator(node) {
|
|
53827
|
+
if (node.operator === "OR") return " OR ";
|
|
53828
|
+
return node.conjunctionStyle === "AND" ? " AND " : ", ";
|
|
53829
|
+
}
|
|
53830
|
+
function flattenSameOperatorMembers$1(node, opts) {
|
|
53831
|
+
const result = [];
|
|
53832
|
+
for (const member of node.members) {
|
|
53833
|
+
const redundant = member.type === NodeType.AttributeSet && member.operator === node.operator && (!member.parenthesized || opts.removeRedundantParentheses);
|
|
53834
|
+
if (redundant) {
|
|
53835
|
+
result.push(...flattenSameOperatorMembers$1(member, opts));
|
|
53836
|
+
} else {
|
|
53837
|
+
result.push(member);
|
|
53838
|
+
}
|
|
53359
53839
|
}
|
|
53360
|
-
return
|
|
53840
|
+
return result;
|
|
53841
|
+
}
|
|
53842
|
+
function printRefinementMember$1(node, depth, column, opts, src) {
|
|
53843
|
+
switch (node.type) {
|
|
53844
|
+
case NodeType.Attribute:
|
|
53845
|
+
return printAttribute$1(node, depth, column, opts, src);
|
|
53846
|
+
case NodeType.AttributeGroup: {
|
|
53847
|
+
const prefix = (node.cardinality ? node.cardinality + " " : "") + "{ ";
|
|
53848
|
+
return prefix + printRefinementMember$1(node.content, depth, column + prefix.length, opts, src) + " }";
|
|
53849
|
+
}
|
|
53850
|
+
case NodeType.AttributeSet: {
|
|
53851
|
+
const members = flattenSameOperatorMembers$1(node, opts);
|
|
53852
|
+
const sep = setSeparator(node);
|
|
53853
|
+
const parts = [];
|
|
53854
|
+
let col = column;
|
|
53855
|
+
for (const member of members) {
|
|
53856
|
+
const text = printNestedMember(member, depth, col, opts, src);
|
|
53857
|
+
parts.push(text);
|
|
53858
|
+
col += text.length + sep.length;
|
|
53859
|
+
}
|
|
53860
|
+
return parts.join(sep);
|
|
53861
|
+
}
|
|
53862
|
+
}
|
|
53863
|
+
}
|
|
53864
|
+
function printNestedMember(node, depth, column, opts, src) {
|
|
53865
|
+
if (node.type === NodeType.AttributeSet) {
|
|
53866
|
+
return "(" + printRefinementMember$1(node, depth, column + 1, opts, src) + ")";
|
|
53867
|
+
}
|
|
53868
|
+
return printRefinementMember$1(node, depth, column, opts, src);
|
|
53869
|
+
}
|
|
53870
|
+
function printMemberBlock(node, depth, opts, src) {
|
|
53871
|
+
const ind = getIndentString(depth, opts);
|
|
53872
|
+
if (node.type === NodeType.AttributeGroup) {
|
|
53873
|
+
const card = node.cardinality ? node.cardinality + " " : "";
|
|
53874
|
+
return ind + card + "{\n" + printMemberBlock(node.content, depth + 1, opts, src) + "\n" + ind + "}";
|
|
53875
|
+
}
|
|
53876
|
+
if (node.type === NodeType.AttributeSet) {
|
|
53877
|
+
const members = flattenSameOperatorMembers$1(node, opts);
|
|
53878
|
+
const rendered = members.map((member) => {
|
|
53879
|
+
const line = ind + printNestedMember(member, depth, ind.length, opts, src);
|
|
53880
|
+
if (member.type === NodeType.AttributeGroup && opts.maxLineLength > 0 && line.length > opts.maxLineLength) {
|
|
53881
|
+
return printMemberBlock(member, depth, opts, src);
|
|
53882
|
+
}
|
|
53883
|
+
return line;
|
|
53884
|
+
});
|
|
53885
|
+
if (node.operator === "AND" && node.conjunctionStyle === ",") {
|
|
53886
|
+
return rendered.join(",\n");
|
|
53887
|
+
}
|
|
53888
|
+
const keyword = node.operator;
|
|
53889
|
+
return rendered.map((text, i) => i === 0 ? text : ind + keyword + " " + text.slice(ind.length)).join("\n");
|
|
53890
|
+
}
|
|
53891
|
+
return ind + printAttribute$1(node, depth, ind.length, opts, src);
|
|
53892
|
+
}
|
|
53893
|
+
function printRefinement$1(node, depth, opts, src) {
|
|
53894
|
+
return node.content ? printRefinementMember$1(node.content, depth, 0, opts, src) : "";
|
|
53361
53895
|
}
|
|
53362
53896
|
function printAttribute$1(node, depth, column, opts, src) {
|
|
53363
|
-
const
|
|
53364
|
-
const cardinalityPrefix = preNameSrc.length > 0 ? preNameSrc + " " : "";
|
|
53897
|
+
const cardinalityPrefix = node.cardinality ? node.cardinality + " " : "";
|
|
53365
53898
|
let name;
|
|
53366
53899
|
if (node.name.conceptId) {
|
|
53367
53900
|
name = node.name.term ? node.name.conceptId + normalizeTerm(node.name.term) : node.name.conceptId;
|
|
@@ -53395,6 +53928,336 @@ function lastLineLength(text) {
|
|
|
53395
53928
|
const lastNewline = text.lastIndexOf("\n");
|
|
53396
53929
|
return lastNewline === -1 ? text.length : text.length - lastNewline - 1;
|
|
53397
53930
|
}
|
|
53931
|
+
function printCanonical(ast, sourceText, outerOperator) {
|
|
53932
|
+
if (ast.type === NodeType.SubExpressionConstraint) {
|
|
53933
|
+
return printSubExpression(ast, sourceText, outerOperator);
|
|
53934
|
+
}
|
|
53935
|
+
return printExpression(ast, sourceText, outerOperator);
|
|
53936
|
+
}
|
|
53937
|
+
function printExpression(node, src, outerOperator) {
|
|
53938
|
+
const inner = node.expression;
|
|
53939
|
+
switch (inner.type) {
|
|
53940
|
+
case NodeType.SubExpressionConstraint:
|
|
53941
|
+
return printSubExpression(inner, src, outerOperator);
|
|
53942
|
+
case NodeType.CompoundExpression:
|
|
53943
|
+
return printCompoundExpression(inner, src);
|
|
53944
|
+
case NodeType.RefinedExpression:
|
|
53945
|
+
return printRefinedExpression(inner, src);
|
|
53946
|
+
case NodeType.DottedExpression:
|
|
53947
|
+
return printDottedExpression(inner, src);
|
|
53948
|
+
default: {
|
|
53949
|
+
const _exhaustive = inner;
|
|
53950
|
+
return String(_exhaustive);
|
|
53951
|
+
}
|
|
53952
|
+
}
|
|
53953
|
+
}
|
|
53954
|
+
function printSubExpression(node, src, outerOperator) {
|
|
53955
|
+
let result = "";
|
|
53956
|
+
if (node.operator) {
|
|
53957
|
+
result += node.operator.operator;
|
|
53958
|
+
}
|
|
53959
|
+
if (node.memberOf) {
|
|
53960
|
+
result += "^";
|
|
53961
|
+
}
|
|
53962
|
+
switch (node.focus.type) {
|
|
53963
|
+
case NodeType.ConceptReference:
|
|
53964
|
+
result += printConceptReference(node.focus);
|
|
53965
|
+
break;
|
|
53966
|
+
case NodeType.Wildcard:
|
|
53967
|
+
result += "*";
|
|
53968
|
+
break;
|
|
53969
|
+
case NodeType.ExpressionConstraint: {
|
|
53970
|
+
const innerExpr = node.focus.expression;
|
|
53971
|
+
if (innerExpr.type !== NodeType.CompoundExpression) {
|
|
53972
|
+
result += printExpression(node.focus, src, outerOperator);
|
|
53973
|
+
} else if (outerOperator && innerExpr.operator.operator === outerOperator) {
|
|
53974
|
+
result += printExpression(node.focus, src, outerOperator);
|
|
53975
|
+
} else {
|
|
53976
|
+
result += "(" + printExpression(node.focus, src) + ")";
|
|
53977
|
+
}
|
|
53978
|
+
break;
|
|
53979
|
+
}
|
|
53980
|
+
}
|
|
53981
|
+
if (node.filters) {
|
|
53982
|
+
for (const filter of node.filters) {
|
|
53983
|
+
const filterText = src.slice(filter.range.start.offset, filter.range.end.offset);
|
|
53984
|
+
result += " " + filterText.replaceAll(/\s+/g, " ").trim();
|
|
53985
|
+
}
|
|
53986
|
+
}
|
|
53987
|
+
if (node.historySupplement) {
|
|
53988
|
+
const histText = src.slice(node.historySupplement.range.start.offset, node.historySupplement.range.end.offset);
|
|
53989
|
+
result += " " + histText.replaceAll(/\s+/g, " ").trim();
|
|
53990
|
+
}
|
|
53991
|
+
return result;
|
|
53992
|
+
}
|
|
53993
|
+
function printCompoundExpression(node, src) {
|
|
53994
|
+
const op = node.operator.operator;
|
|
53995
|
+
return node.operands.map((operand) => printSubExpression(operand, src, op)).join(` ${op} `);
|
|
53996
|
+
}
|
|
53997
|
+
function printRefinedExpression(node, src) {
|
|
53998
|
+
const focus = printSubExpression(node.expression, src);
|
|
53999
|
+
const refinement = printRefinement(node.refinement, src);
|
|
54000
|
+
return focus + ":" + refinement;
|
|
54001
|
+
}
|
|
54002
|
+
function printDottedExpression(node, src) {
|
|
54003
|
+
const source = printSubExpression(node.source, src);
|
|
54004
|
+
const dots = node.attributes.map((a) => printSubExpression(a.attributeName, src));
|
|
54005
|
+
return source + dots.map((d) => "." + d).join("");
|
|
54006
|
+
}
|
|
54007
|
+
function printRefinement(node, src) {
|
|
54008
|
+
return node.content ? printRefinementMember(node.content, src) : "";
|
|
54009
|
+
}
|
|
54010
|
+
function printRefinementMember(node, src) {
|
|
54011
|
+
switch (node.type) {
|
|
54012
|
+
case NodeType.Attribute:
|
|
54013
|
+
return printAttribute(node, src);
|
|
54014
|
+
case NodeType.AttributeGroup:
|
|
54015
|
+
return (node.cardinality ?? "") + "{" + printRefinementMember(node.content, src) + "}";
|
|
54016
|
+
case NodeType.AttributeSet: {
|
|
54017
|
+
const sep = node.operator === "OR" ? " OR " : ",";
|
|
54018
|
+
return node.members.map(
|
|
54019
|
+
(member) => member.type === NodeType.AttributeSet ? "(" + printRefinementMember(member, src) + ")" : printRefinementMember(member, src)
|
|
54020
|
+
).join(sep);
|
|
54021
|
+
}
|
|
54022
|
+
}
|
|
54023
|
+
}
|
|
54024
|
+
function printAttribute(node, src) {
|
|
54025
|
+
const cardinalityPrefix = node.cardinality ? node.cardinality + " " : "";
|
|
54026
|
+
let name;
|
|
54027
|
+
if (node.name.conceptId) {
|
|
54028
|
+
name = node.name.conceptId;
|
|
54029
|
+
} else if (node.name.expression) {
|
|
54030
|
+
name = printSubExpression(node.name.expression, src);
|
|
54031
|
+
} else {
|
|
54032
|
+
name = src.slice(node.name.range.start.offset, node.name.range.end.offset).trim();
|
|
54033
|
+
}
|
|
54034
|
+
const between = src.slice(node.name.range.end.offset, node.value.range.start.offset);
|
|
54035
|
+
const opMatch = /(!?=|[<>]=)/.exec(between);
|
|
54036
|
+
const compOp = opMatch ? opMatch[1] : "=";
|
|
54037
|
+
const hasHashPrefix = between.includes("#");
|
|
54038
|
+
let value;
|
|
54039
|
+
if (node.value.expression) {
|
|
54040
|
+
value = printSubExpression(node.value.expression, src);
|
|
54041
|
+
} else if (node.value.rawValue) {
|
|
54042
|
+
value = hasHashPrefix ? "#" + node.value.rawValue : node.value.rawValue;
|
|
54043
|
+
} else {
|
|
54044
|
+
value = src.slice(node.value.range.start.offset, node.value.range.end.offset).trim();
|
|
54045
|
+
}
|
|
54046
|
+
const reversed = node.reversed ? "R " : "";
|
|
54047
|
+
return cardinalityPrefix + reversed + name + " " + compOp + " " + value;
|
|
54048
|
+
}
|
|
54049
|
+
function printConceptReference(node) {
|
|
54050
|
+
return node.conceptId;
|
|
54051
|
+
}
|
|
54052
|
+
function normaliseAst(ast, sourceText) {
|
|
54053
|
+
return normaliseExpression(ast, sourceText);
|
|
54054
|
+
}
|
|
54055
|
+
function normaliseExpression(node, src) {
|
|
54056
|
+
const inner = node.expression;
|
|
54057
|
+
let normalised;
|
|
54058
|
+
switch (inner.type) {
|
|
54059
|
+
case NodeType.SubExpressionConstraint:
|
|
54060
|
+
normalised = normaliseSubExpression(inner, src);
|
|
54061
|
+
break;
|
|
54062
|
+
case NodeType.CompoundExpression:
|
|
54063
|
+
normalised = normaliseCompoundExpression(inner, src);
|
|
54064
|
+
break;
|
|
54065
|
+
case NodeType.RefinedExpression:
|
|
54066
|
+
normalised = normaliseRefinedExpression(inner, src);
|
|
54067
|
+
break;
|
|
54068
|
+
case NodeType.DottedExpression:
|
|
54069
|
+
normalised = normaliseDottedExpression(inner, src);
|
|
54070
|
+
break;
|
|
54071
|
+
default: {
|
|
54072
|
+
const _exhaustive = inner;
|
|
54073
|
+
normalised = _exhaustive;
|
|
54074
|
+
}
|
|
54075
|
+
}
|
|
54076
|
+
return { ...node, expression: normalised };
|
|
54077
|
+
}
|
|
54078
|
+
function normaliseSubExpression(node, src) {
|
|
54079
|
+
let focus;
|
|
54080
|
+
switch (node.focus.type) {
|
|
54081
|
+
case NodeType.ConceptReference:
|
|
54082
|
+
focus = stripTerm(node.focus);
|
|
54083
|
+
break;
|
|
54084
|
+
case NodeType.Wildcard:
|
|
54085
|
+
focus = { ...node.focus };
|
|
54086
|
+
break;
|
|
54087
|
+
case NodeType.ExpressionConstraint:
|
|
54088
|
+
focus = normaliseExpression(node.focus, src);
|
|
54089
|
+
break;
|
|
54090
|
+
}
|
|
54091
|
+
return {
|
|
54092
|
+
...node,
|
|
54093
|
+
operator: node.operator ? { ...node.operator } : void 0,
|
|
54094
|
+
focus,
|
|
54095
|
+
filters: node.filters ? node.filters.map(copyFilter) : void 0,
|
|
54096
|
+
historySupplement: node.historySupplement ? { ...node.historySupplement } : void 0
|
|
54097
|
+
};
|
|
54098
|
+
}
|
|
54099
|
+
function normaliseCompoundExpression(node, src) {
|
|
54100
|
+
const op = node.operator.operator;
|
|
54101
|
+
let normOperands = node.operands.map((o) => normaliseSubExpression(o, src));
|
|
54102
|
+
if (op === "AND" || op === "OR") {
|
|
54103
|
+
normOperands = flattenSameOperator(normOperands, op, src);
|
|
54104
|
+
}
|
|
54105
|
+
if (op === "AND" || op === "OR") {
|
|
54106
|
+
normOperands.sort((a, b) => {
|
|
54107
|
+
const ka = printCanonical(a, src);
|
|
54108
|
+
const kb = printCanonical(b, src);
|
|
54109
|
+
return ka.localeCompare(kb);
|
|
54110
|
+
});
|
|
54111
|
+
}
|
|
54112
|
+
return {
|
|
54113
|
+
...node,
|
|
54114
|
+
operator: { ...node.operator },
|
|
54115
|
+
operands: normOperands
|
|
54116
|
+
};
|
|
54117
|
+
}
|
|
54118
|
+
function flattenSameOperator(operands, operator, src) {
|
|
54119
|
+
const result = [];
|
|
54120
|
+
for (const operand of operands) {
|
|
54121
|
+
if (operand.focus.type === NodeType.ExpressionConstraint && !operand.operator && !operand.memberOf && !operand.filters && !operand.historySupplement) {
|
|
54122
|
+
const inner = operand.focus.expression;
|
|
54123
|
+
if (inner.type === NodeType.CompoundExpression && inner.operator.operator === operator) {
|
|
54124
|
+
const innerNorm = normaliseCompoundExpression(inner, src);
|
|
54125
|
+
result.push(...innerNorm.operands);
|
|
54126
|
+
continue;
|
|
54127
|
+
}
|
|
54128
|
+
}
|
|
54129
|
+
result.push(operand);
|
|
54130
|
+
}
|
|
54131
|
+
return result;
|
|
54132
|
+
}
|
|
54133
|
+
function normaliseRefinedExpression(node, src) {
|
|
54134
|
+
return {
|
|
54135
|
+
...node,
|
|
54136
|
+
expression: normaliseSubExpression(node.expression, src),
|
|
54137
|
+
refinement: normaliseRefinement(node.refinement, src)
|
|
54138
|
+
};
|
|
54139
|
+
}
|
|
54140
|
+
function normaliseRefinement(node, src) {
|
|
54141
|
+
const content = node.content ? normaliseRefinementMember(node.content, src) : null;
|
|
54142
|
+
const attributes = [];
|
|
54143
|
+
collectAttributes(content, attributes);
|
|
54144
|
+
return { ...node, attributes, content };
|
|
54145
|
+
}
|
|
54146
|
+
function normaliseRefinementMember(node, src) {
|
|
54147
|
+
switch (node.type) {
|
|
54148
|
+
case NodeType.Attribute:
|
|
54149
|
+
return normaliseAttribute(node, src);
|
|
54150
|
+
case NodeType.AttributeGroup:
|
|
54151
|
+
return { ...node, content: normaliseRefinementMember(node.content, src) };
|
|
54152
|
+
case NodeType.AttributeSet: {
|
|
54153
|
+
const members = flattenSameOperatorMembers(node).map((m) => normaliseRefinementMember(m, src));
|
|
54154
|
+
members.sort((a, b) => compareRefinementMembers(a, b, src));
|
|
54155
|
+
return { ...node, conjunctionStyle: ",", members };
|
|
54156
|
+
}
|
|
54157
|
+
}
|
|
54158
|
+
}
|
|
54159
|
+
function flattenSameOperatorMembers(node) {
|
|
54160
|
+
const result = [];
|
|
54161
|
+
for (const member of node.members) {
|
|
54162
|
+
if (member.type === NodeType.AttributeSet && member.operator === node.operator) {
|
|
54163
|
+
result.push(...flattenSameOperatorMembers(member));
|
|
54164
|
+
} else {
|
|
54165
|
+
result.push(member);
|
|
54166
|
+
}
|
|
54167
|
+
}
|
|
54168
|
+
return result;
|
|
54169
|
+
}
|
|
54170
|
+
function collectAttributes(node, out) {
|
|
54171
|
+
if (!node) return;
|
|
54172
|
+
switch (node.type) {
|
|
54173
|
+
case NodeType.Attribute:
|
|
54174
|
+
out.push(node);
|
|
54175
|
+
break;
|
|
54176
|
+
case NodeType.AttributeGroup:
|
|
54177
|
+
collectAttributes(node.content, out);
|
|
54178
|
+
break;
|
|
54179
|
+
case NodeType.AttributeSet:
|
|
54180
|
+
for (const member of node.members) {
|
|
54181
|
+
collectAttributes(member, out);
|
|
54182
|
+
}
|
|
54183
|
+
break;
|
|
54184
|
+
}
|
|
54185
|
+
}
|
|
54186
|
+
function compareRefinementMembers(a, b, src) {
|
|
54187
|
+
if (a.type === NodeType.Attribute && b.type === NodeType.Attribute) {
|
|
54188
|
+
return compareAttributes(a, b, src);
|
|
54189
|
+
}
|
|
54190
|
+
if (a.type === NodeType.Attribute) return -1;
|
|
54191
|
+
if (b.type === NodeType.Attribute) return 1;
|
|
54192
|
+
return printRefinementMember(a, src).localeCompare(printRefinementMember(b, src));
|
|
54193
|
+
}
|
|
54194
|
+
function compareAttributes(a, b, src) {
|
|
54195
|
+
const aId = a.name.conceptId;
|
|
54196
|
+
const bId = b.name.conceptId;
|
|
54197
|
+
if (aId && bId) {
|
|
54198
|
+
const aBig = BigInt(aId);
|
|
54199
|
+
const bBig = BigInt(bId);
|
|
54200
|
+
if (aBig < bBig) return -1;
|
|
54201
|
+
if (aBig > bBig) return 1;
|
|
54202
|
+
return 0;
|
|
54203
|
+
}
|
|
54204
|
+
if (aId) return -1;
|
|
54205
|
+
if (bId) return 1;
|
|
54206
|
+
const aKey = a.name.expression ? printCanonical(a.name.expression, src) : "";
|
|
54207
|
+
const bKey = b.name.expression ? printCanonical(b.name.expression, src) : "";
|
|
54208
|
+
return aKey.localeCompare(bKey);
|
|
54209
|
+
}
|
|
54210
|
+
function normaliseAttribute(node, src) {
|
|
54211
|
+
return {
|
|
54212
|
+
...node,
|
|
54213
|
+
name: normaliseAttributeName(node.name, src),
|
|
54214
|
+
value: normaliseAttributeValue(node.value, src)
|
|
54215
|
+
};
|
|
54216
|
+
}
|
|
54217
|
+
function normaliseAttributeName(node, src) {
|
|
54218
|
+
return {
|
|
54219
|
+
...node,
|
|
54220
|
+
term: void 0,
|
|
54221
|
+
// §5.1: strip display terms
|
|
54222
|
+
expression: node.expression ? normaliseSubExpression(node.expression, src) : void 0
|
|
54223
|
+
};
|
|
54224
|
+
}
|
|
54225
|
+
function normaliseAttributeValue(node, src) {
|
|
54226
|
+
return {
|
|
54227
|
+
...node,
|
|
54228
|
+
expression: node.expression ? normaliseSubExpression(node.expression, src) : void 0
|
|
54229
|
+
};
|
|
54230
|
+
}
|
|
54231
|
+
function normaliseDottedExpression(node, src) {
|
|
54232
|
+
return {
|
|
54233
|
+
...node,
|
|
54234
|
+
source: normaliseSubExpression(node.source, src),
|
|
54235
|
+
attributes: node.attributes.map((a) => ({
|
|
54236
|
+
...a,
|
|
54237
|
+
attributeName: normaliseSubExpression(a.attributeName, src)
|
|
54238
|
+
}))
|
|
54239
|
+
};
|
|
54240
|
+
}
|
|
54241
|
+
function stripTerm(node) {
|
|
54242
|
+
return { ...node, term: void 0 };
|
|
54243
|
+
}
|
|
54244
|
+
function copyFilter(node) {
|
|
54245
|
+
return { ...node };
|
|
54246
|
+
}
|
|
54247
|
+
function structuralSignature(ast, sourceText) {
|
|
54248
|
+
return printCanonical(normaliseAst(ast, sourceText), sourceText);
|
|
54249
|
+
}
|
|
54250
|
+
function signatureOf(text) {
|
|
54251
|
+
try {
|
|
54252
|
+
const { ast, errors: errors2 } = parseECL(text);
|
|
54253
|
+
if (!ast || errors2.length > 0) {
|
|
54254
|
+
return null;
|
|
54255
|
+
}
|
|
54256
|
+
return structuralSignature(ast, text);
|
|
54257
|
+
} catch {
|
|
54258
|
+
return null;
|
|
54259
|
+
}
|
|
54260
|
+
}
|
|
53398
54261
|
function splitExpressions(text) {
|
|
53399
54262
|
const delimiter = "/* ECL-END */";
|
|
53400
54263
|
const delimiterPositions = [];
|
|
@@ -53564,23 +54427,43 @@ function normalizeFilterBlocks(text) {
|
|
|
53564
54427
|
return match.toLowerCase() === lower ? canonical : match;
|
|
53565
54428
|
});
|
|
53566
54429
|
}
|
|
53567
|
-
normalized = normalized.replace(/\s*(
|
|
54430
|
+
normalized = normalized.replace(/\s*(!=|>=|<=)\s*/g, " $1 ");
|
|
54431
|
+
normalized = normalized.replace(new RegExp("\\s*(?<![!<>])=\\s*", "g"), " = ");
|
|
53568
54432
|
normalized = normalized.replace(/,\s*/g, ", ");
|
|
53569
54433
|
normalized = normalized.replace(/ {2,}/g, " ");
|
|
53570
54434
|
normalized = normalized.replace(/^\s*/, " ").replace(/\s*$/, " ");
|
|
53571
54435
|
return "{{" + normalized + "}}";
|
|
53572
54436
|
});
|
|
53573
54437
|
}
|
|
54438
|
+
function applyAstPrinter(normalizedText, options) {
|
|
54439
|
+
try {
|
|
54440
|
+
const reParsed = parseECL(normalizedText);
|
|
54441
|
+
const coversAll = reParsed.ast && reParsed.errors.length === 0 && reParsed.ast.range.end.offset >= normalizedText.trimEnd().length;
|
|
54442
|
+
if (!coversAll || !reParsed.ast) {
|
|
54443
|
+
return normalizedText;
|
|
54444
|
+
}
|
|
54445
|
+
const before = structuralSignature(reParsed.ast, normalizedText);
|
|
54446
|
+
const printed = printAst(reParsed.ast, normalizedText, options);
|
|
54447
|
+
return signatureOf(printed) === before ? printed : normalizedText;
|
|
54448
|
+
} catch {
|
|
54449
|
+
return normalizedText;
|
|
54450
|
+
}
|
|
54451
|
+
}
|
|
53574
54452
|
function formatExpressionBody(text, options, ast) {
|
|
53575
54453
|
const { comments, textWithoutComments } = extractComments(text);
|
|
53576
54454
|
const nonDelimiterComments = comments.filter((c) => c.content.trim() !== "/* ECL-END */");
|
|
53577
54455
|
let formatted = normalizeFilterBlocks(textWithoutComments);
|
|
53578
54456
|
formatted = formatted.replace(
|
|
53579
|
-
//
|
|
54457
|
+
// Bounded ECL expression text; no ReDoS risk.
|
|
54458
|
+
// Measured quadratic in the length of a contiguous whitespace run, not exponential.
|
|
54459
|
+
// Realistic ECL has no such runs: 500 expressions (43 KB) format in ~47 ms, while only a
|
|
54460
|
+
// synthetic 32 K-char whitespace run reaches ~2.6 s. The input is the document the user
|
|
54461
|
+
// opened, not untrusted network data.
|
|
54462
|
+
// eslint-disable-next-line sonarjs/super-linear-regex -- see note above
|
|
53580
54463
|
new RegExp("(\\S?)(?<![A-Za-z])\\s*(AND|OR|MINUS)\\s*(?![A-Za-z])(\\S?)", "g"),
|
|
53581
|
-
(
|
|
53582
|
-
const formattedOp =
|
|
53583
|
-
return
|
|
54464
|
+
(_match, before, op, after) => {
|
|
54465
|
+
const formattedOp = ` ${op} `;
|
|
54466
|
+
return before + formattedOp + after;
|
|
53584
54467
|
}
|
|
53585
54468
|
);
|
|
53586
54469
|
formatted = formatted.replace(/[ \t]*(:)[ \t]*/g, formatRefinementColon("$1"));
|
|
@@ -53588,23 +54471,21 @@ function formatExpressionBody(text, options, ast) {
|
|
|
53588
54471
|
formatted = formatted.replace(new RegExp("[ \\t]*(?<![!<>])(=)[ \\t]*", "g"), formatRefinementEquals("$1"));
|
|
53589
54472
|
formatted = formatted.replace(/(<<|<|>>|>)\s*(\d)/g, "$1 $2");
|
|
53590
54473
|
formatted = formatted.replace(/(\d)\s+(\|)/g, "$1$2");
|
|
53591
|
-
formatted = formatted.replace(/\|([^|]+)\|/g, (
|
|
54474
|
+
formatted = formatted.replace(/\|([^|]+)\|/g, (_match, content) => {
|
|
53592
54475
|
return normalizeTerm(content);
|
|
53593
54476
|
});
|
|
53594
54477
|
if (ast) {
|
|
53595
|
-
|
|
53596
|
-
const reParsed = parseECL(formatted);
|
|
53597
|
-
const astCoversAll = reParsed.ast && reParsed.errors.length === 0 && reParsed.ast.range.end.offset >= formatted.trimEnd().length;
|
|
53598
|
-
if (astCoversAll && reParsed.ast) {
|
|
53599
|
-
formatted = printAst(reParsed.ast, formatted, options);
|
|
53600
|
-
} else {
|
|
53601
|
-
}
|
|
53602
|
-
} catch {
|
|
53603
|
-
}
|
|
54478
|
+
formatted = applyAstPrinter(formatted, options);
|
|
53604
54479
|
}
|
|
53605
54480
|
if (options.breakOnRefinementComma) {
|
|
53606
54481
|
formatted = applyRefinementCommaBreaks(formatted, options);
|
|
53607
54482
|
}
|
|
54483
|
+
{
|
|
54484
|
+
const baseline = signatureOf(normalizeFilterBlocks(textWithoutComments));
|
|
54485
|
+
if (baseline !== null && signatureOf(formatted) !== baseline) {
|
|
54486
|
+
formatted = textWithoutComments;
|
|
54487
|
+
}
|
|
54488
|
+
}
|
|
53608
54489
|
const withComments = reinsertComments(formatted.trim(), text, nonDelimiterComments);
|
|
53609
54490
|
return withComments;
|
|
53610
54491
|
}
|
|
@@ -55608,14 +56489,12 @@ async function getFhirFilterCompletions(keyword, terminologyService) {
|
|
|
55608
56489
|
}
|
|
55609
56490
|
try {
|
|
55610
56491
|
const response = await terminologyService.evaluateEcl(ecl, EXPANSION_LIMIT);
|
|
55611
|
-
const items = response.concepts.map(
|
|
55612
|
-
|
|
55613
|
-
|
|
55614
|
-
|
|
55615
|
-
|
|
55616
|
-
|
|
55617
|
-
})
|
|
55618
|
-
);
|
|
56492
|
+
const items = response.concepts.map((concept, index) => ({
|
|
56493
|
+
label: `${concept.code} |${concept.display}|`,
|
|
56494
|
+
kind: "value",
|
|
56495
|
+
detail: concept.display,
|
|
56496
|
+
sortText: `e-${(20 + index).toString().padStart(3, "0")}`
|
|
56497
|
+
}));
|
|
55619
56498
|
cache.set(key, { items, timestamp: Date.now() });
|
|
55620
56499
|
return items;
|
|
55621
56500
|
} catch {
|
|
@@ -55826,62 +56705,45 @@ const eclTokenTypes = [
|
|
|
55826
56705
|
// 8 — history supplement keywords
|
|
55827
56706
|
];
|
|
55828
56707
|
const eclTokenModifiers = [];
|
|
55829
|
-
const NT = {
|
|
55830
|
-
ExpressionConstraint: "ExpressionConstraint",
|
|
55831
|
-
SubExpressionConstraint: "SubExpressionConstraint",
|
|
55832
|
-
CompoundExpression: "CompoundExpression",
|
|
55833
|
-
RefinedExpression: "RefinedExpression",
|
|
55834
|
-
DottedExpression: "DottedExpression",
|
|
55835
|
-
DottedAttribute: "DottedAttribute",
|
|
55836
|
-
Refinement: "Refinement",
|
|
55837
|
-
Attribute: "Attribute",
|
|
55838
|
-
FilterConstraint: "FilterConstraint",
|
|
55839
|
-
HistorySupplement: "HistorySupplement"
|
|
55840
|
-
};
|
|
55841
56708
|
function collectAttributeNamePositions(ast, lineOffsets) {
|
|
55842
56709
|
const positions = /* @__PURE__ */ new Set();
|
|
55843
56710
|
function visit(node) {
|
|
55844
|
-
|
|
55845
|
-
if (!(node == null ? void 0 : node.type)) return;
|
|
56711
|
+
if (!node) return;
|
|
55846
56712
|
switch (node.type) {
|
|
55847
|
-
case
|
|
55848
|
-
|
|
56713
|
+
case NodeType.ExpressionConstraint:
|
|
56714
|
+
visit(node.expression);
|
|
55849
56715
|
break;
|
|
55850
|
-
case
|
|
55851
|
-
|
|
55852
|
-
|
|
55853
|
-
|
|
55854
|
-
}
|
|
55855
|
-
if (node.historySupplement) visit(node.historySupplement);
|
|
56716
|
+
case NodeType.SubExpressionConstraint:
|
|
56717
|
+
visit(node.focus);
|
|
56718
|
+
for (const f of node.filters ?? []) visit(f);
|
|
56719
|
+
visit(node.historySupplement);
|
|
55856
56720
|
break;
|
|
55857
|
-
case
|
|
56721
|
+
case NodeType.CompoundExpression:
|
|
55858
56722
|
for (const op of node.operands) visit(op);
|
|
55859
56723
|
break;
|
|
55860
|
-
case
|
|
56724
|
+
case NodeType.RefinedExpression:
|
|
55861
56725
|
visit(node.expression);
|
|
55862
56726
|
visit(node.refinement);
|
|
55863
56727
|
break;
|
|
55864
|
-
case
|
|
56728
|
+
case NodeType.DottedExpression:
|
|
55865
56729
|
visit(node.source);
|
|
55866
56730
|
for (const attr of node.attributes) visit(attr);
|
|
55867
56731
|
break;
|
|
55868
|
-
case
|
|
55869
|
-
|
|
55870
|
-
markSubExpressionAsAttrName(node.attributeName, lineOffsets, positions);
|
|
55871
|
-
}
|
|
56732
|
+
case NodeType.DottedAttribute:
|
|
56733
|
+
markSubExpressionAsAttrName(node.attributeName, lineOffsets, positions);
|
|
55872
56734
|
break;
|
|
55873
|
-
case
|
|
56735
|
+
case NodeType.Refinement:
|
|
55874
56736
|
for (const attr of node.attributes) visit(attr);
|
|
55875
56737
|
break;
|
|
55876
|
-
case
|
|
56738
|
+
case NodeType.Attribute:
|
|
55877
56739
|
markAttributeName(node.name, lineOffsets, positions);
|
|
55878
|
-
|
|
56740
|
+
visit(node.value.expression);
|
|
55879
56741
|
break;
|
|
55880
|
-
case
|
|
56742
|
+
case NodeType.FilterConstraint:
|
|
55881
56743
|
for (const ce of node.conceptExpressions) visit(ce);
|
|
55882
56744
|
break;
|
|
55883
|
-
case
|
|
55884
|
-
|
|
56745
|
+
case NodeType.HistorySupplement:
|
|
56746
|
+
visit(node.subsetExpression);
|
|
55885
56747
|
break;
|
|
55886
56748
|
}
|
|
55887
56749
|
}
|
|
@@ -56115,275 +56977,6 @@ function isInsideFilterBlock(ranges, matchStart, matchEnd) {
|
|
|
56115
56977
|
}
|
|
56116
56978
|
return false;
|
|
56117
56979
|
}
|
|
56118
|
-
function printCanonical(ast, sourceText, outerOperator) {
|
|
56119
|
-
if (ast.type === NodeType.SubExpressionConstraint) {
|
|
56120
|
-
return printSubExpression(ast, sourceText, outerOperator);
|
|
56121
|
-
}
|
|
56122
|
-
return printExpression(ast, sourceText, outerOperator);
|
|
56123
|
-
}
|
|
56124
|
-
function printExpression(node, src, outerOperator) {
|
|
56125
|
-
const inner = node.expression;
|
|
56126
|
-
switch (inner.type) {
|
|
56127
|
-
case NodeType.SubExpressionConstraint:
|
|
56128
|
-
return printSubExpression(inner, src, outerOperator);
|
|
56129
|
-
case NodeType.CompoundExpression:
|
|
56130
|
-
return printCompoundExpression(inner, src);
|
|
56131
|
-
case NodeType.RefinedExpression:
|
|
56132
|
-
return printRefinedExpression(inner, src);
|
|
56133
|
-
case NodeType.DottedExpression:
|
|
56134
|
-
return printDottedExpression(inner, src);
|
|
56135
|
-
default: {
|
|
56136
|
-
const _exhaustive = inner;
|
|
56137
|
-
return String(_exhaustive);
|
|
56138
|
-
}
|
|
56139
|
-
}
|
|
56140
|
-
}
|
|
56141
|
-
function printSubExpression(node, src, outerOperator) {
|
|
56142
|
-
let result = "";
|
|
56143
|
-
if (node.operator) {
|
|
56144
|
-
result += node.operator.operator;
|
|
56145
|
-
}
|
|
56146
|
-
if (node.memberOf) {
|
|
56147
|
-
result += "^";
|
|
56148
|
-
}
|
|
56149
|
-
switch (node.focus.type) {
|
|
56150
|
-
case NodeType.ConceptReference:
|
|
56151
|
-
result += printConceptReference(node.focus);
|
|
56152
|
-
break;
|
|
56153
|
-
case NodeType.Wildcard:
|
|
56154
|
-
result += "*";
|
|
56155
|
-
break;
|
|
56156
|
-
case NodeType.ExpressionConstraint: {
|
|
56157
|
-
const innerExpr = node.focus.expression;
|
|
56158
|
-
if (innerExpr.type !== NodeType.CompoundExpression) {
|
|
56159
|
-
result += printExpression(node.focus, src, outerOperator);
|
|
56160
|
-
} else if (outerOperator && innerExpr.operator.operator === outerOperator) {
|
|
56161
|
-
result += printExpression(node.focus, src, outerOperator);
|
|
56162
|
-
} else {
|
|
56163
|
-
result += "(" + printExpression(node.focus, src) + ")";
|
|
56164
|
-
}
|
|
56165
|
-
break;
|
|
56166
|
-
}
|
|
56167
|
-
}
|
|
56168
|
-
if (node.filters) {
|
|
56169
|
-
for (const filter of node.filters) {
|
|
56170
|
-
const filterText = src.slice(filter.range.start.offset, filter.range.end.offset);
|
|
56171
|
-
result += " " + filterText.replaceAll(/\s+/g, " ").trim();
|
|
56172
|
-
}
|
|
56173
|
-
}
|
|
56174
|
-
if (node.historySupplement) {
|
|
56175
|
-
const histText = src.slice(node.historySupplement.range.start.offset, node.historySupplement.range.end.offset);
|
|
56176
|
-
result += " " + histText.replaceAll(/\s+/g, " ").trim();
|
|
56177
|
-
}
|
|
56178
|
-
return result;
|
|
56179
|
-
}
|
|
56180
|
-
function printCompoundExpression(node, src) {
|
|
56181
|
-
const op = node.operator.operator;
|
|
56182
|
-
return node.operands.map((operand) => printSubExpression(operand, src, op)).join(` ${op} `);
|
|
56183
|
-
}
|
|
56184
|
-
function printRefinedExpression(node, src) {
|
|
56185
|
-
const focus = printSubExpression(node.expression, src);
|
|
56186
|
-
const refinement = printRefinement(node.refinement, src);
|
|
56187
|
-
return focus + ":" + refinement;
|
|
56188
|
-
}
|
|
56189
|
-
function printDottedExpression(node, src) {
|
|
56190
|
-
const source = printSubExpression(node.source, src);
|
|
56191
|
-
const dots = node.attributes.map((a) => printSubExpression(a.attributeName, src));
|
|
56192
|
-
return source + dots.map((d) => "." + d).join("");
|
|
56193
|
-
}
|
|
56194
|
-
function printRefinement(node, src) {
|
|
56195
|
-
const parts = [];
|
|
56196
|
-
let prevEnd = node.range.start.offset;
|
|
56197
|
-
for (const attr of node.attributes) {
|
|
56198
|
-
const printed = printAttribute(attr, src);
|
|
56199
|
-
const inBraces = isAttrInBraceGroup(attr, prevEnd, src);
|
|
56200
|
-
parts.push(inBraces ? "{" + printed + "}" : printed);
|
|
56201
|
-
prevEnd = attr.range.end.offset;
|
|
56202
|
-
}
|
|
56203
|
-
return parts.join(",");
|
|
56204
|
-
}
|
|
56205
|
-
function isAttrInBraceGroup(attr, prevEnd, src) {
|
|
56206
|
-
const gap = src.slice(prevEnd, attr.range.start.offset);
|
|
56207
|
-
return gap.includes("{");
|
|
56208
|
-
}
|
|
56209
|
-
function printAttribute(node, src) {
|
|
56210
|
-
const preNameSrc = src.slice(node.range.start.offset, node.name.range.start.offset).trim();
|
|
56211
|
-
const cardinalityRaw = preNameSrc.replace(/^\{?\s*/, "").trim();
|
|
56212
|
-
const cardinalityPrefix = cardinalityRaw.length > 0 ? cardinalityRaw + " " : "";
|
|
56213
|
-
let name;
|
|
56214
|
-
if (node.name.conceptId) {
|
|
56215
|
-
name = node.name.conceptId;
|
|
56216
|
-
} else if (node.name.expression) {
|
|
56217
|
-
name = printSubExpression(node.name.expression, src);
|
|
56218
|
-
} else {
|
|
56219
|
-
name = src.slice(node.name.range.start.offset, node.name.range.end.offset).trim();
|
|
56220
|
-
}
|
|
56221
|
-
const between = src.slice(node.name.range.end.offset, node.value.range.start.offset);
|
|
56222
|
-
const opMatch = /(!?=|[<>]=)/.exec(between);
|
|
56223
|
-
const compOp = opMatch ? opMatch[1] : "=";
|
|
56224
|
-
const hasHashPrefix = between.includes("#");
|
|
56225
|
-
let value;
|
|
56226
|
-
if (node.value.expression) {
|
|
56227
|
-
value = printSubExpression(node.value.expression, src);
|
|
56228
|
-
} else if (node.value.rawValue) {
|
|
56229
|
-
value = hasHashPrefix ? "#" + node.value.rawValue : node.value.rawValue;
|
|
56230
|
-
} else {
|
|
56231
|
-
value = src.slice(node.value.range.start.offset, node.value.range.end.offset).trim();
|
|
56232
|
-
}
|
|
56233
|
-
const reversed = node.reversed ? "R " : "";
|
|
56234
|
-
return cardinalityPrefix + reversed + name + " " + compOp + " " + value;
|
|
56235
|
-
}
|
|
56236
|
-
function printConceptReference(node) {
|
|
56237
|
-
return node.conceptId;
|
|
56238
|
-
}
|
|
56239
|
-
function normaliseAst(ast, sourceText) {
|
|
56240
|
-
return normaliseExpression(ast, sourceText);
|
|
56241
|
-
}
|
|
56242
|
-
function normaliseExpression(node, src) {
|
|
56243
|
-
const inner = node.expression;
|
|
56244
|
-
let normalised;
|
|
56245
|
-
switch (inner.type) {
|
|
56246
|
-
case NodeType.SubExpressionConstraint:
|
|
56247
|
-
normalised = normaliseSubExpression(inner, src);
|
|
56248
|
-
break;
|
|
56249
|
-
case NodeType.CompoundExpression:
|
|
56250
|
-
normalised = normaliseCompoundExpression(inner, src);
|
|
56251
|
-
break;
|
|
56252
|
-
case NodeType.RefinedExpression:
|
|
56253
|
-
normalised = normaliseRefinedExpression(inner, src);
|
|
56254
|
-
break;
|
|
56255
|
-
case NodeType.DottedExpression:
|
|
56256
|
-
normalised = normaliseDottedExpression(inner, src);
|
|
56257
|
-
break;
|
|
56258
|
-
default: {
|
|
56259
|
-
const _exhaustive = inner;
|
|
56260
|
-
normalised = _exhaustive;
|
|
56261
|
-
}
|
|
56262
|
-
}
|
|
56263
|
-
return { ...node, expression: normalised };
|
|
56264
|
-
}
|
|
56265
|
-
function normaliseSubExpression(node, src) {
|
|
56266
|
-
let focus;
|
|
56267
|
-
switch (node.focus.type) {
|
|
56268
|
-
case NodeType.ConceptReference:
|
|
56269
|
-
focus = stripTerm(node.focus);
|
|
56270
|
-
break;
|
|
56271
|
-
case NodeType.Wildcard:
|
|
56272
|
-
focus = { ...node.focus };
|
|
56273
|
-
break;
|
|
56274
|
-
case NodeType.ExpressionConstraint:
|
|
56275
|
-
focus = normaliseExpression(node.focus, src);
|
|
56276
|
-
break;
|
|
56277
|
-
}
|
|
56278
|
-
return {
|
|
56279
|
-
...node,
|
|
56280
|
-
operator: node.operator ? { ...node.operator } : void 0,
|
|
56281
|
-
focus,
|
|
56282
|
-
filters: node.filters ? node.filters.map(copyFilter) : void 0,
|
|
56283
|
-
historySupplement: node.historySupplement ? { ...node.historySupplement } : void 0
|
|
56284
|
-
};
|
|
56285
|
-
}
|
|
56286
|
-
function normaliseCompoundExpression(node, src) {
|
|
56287
|
-
const op = node.operator.operator;
|
|
56288
|
-
let normOperands = node.operands.map((o) => normaliseSubExpression(o, src));
|
|
56289
|
-
if (op === "AND" || op === "OR") {
|
|
56290
|
-
normOperands = flattenSameOperator(normOperands, op, src);
|
|
56291
|
-
}
|
|
56292
|
-
if (op === "AND" || op === "OR") {
|
|
56293
|
-
normOperands.sort((a, b) => {
|
|
56294
|
-
const ka = printCanonical(a, src);
|
|
56295
|
-
const kb = printCanonical(b, src);
|
|
56296
|
-
return ka.localeCompare(kb);
|
|
56297
|
-
});
|
|
56298
|
-
}
|
|
56299
|
-
return {
|
|
56300
|
-
...node,
|
|
56301
|
-
operator: { ...node.operator },
|
|
56302
|
-
operands: normOperands
|
|
56303
|
-
};
|
|
56304
|
-
}
|
|
56305
|
-
function flattenSameOperator(operands, operator, src) {
|
|
56306
|
-
const result = [];
|
|
56307
|
-
for (const operand of operands) {
|
|
56308
|
-
if (operand.focus.type === NodeType.ExpressionConstraint && !operand.operator && !operand.memberOf && !operand.filters && !operand.historySupplement) {
|
|
56309
|
-
const inner = operand.focus.expression;
|
|
56310
|
-
if (inner.type === NodeType.CompoundExpression && inner.operator.operator === operator) {
|
|
56311
|
-
const innerNorm = normaliseCompoundExpression(inner, src);
|
|
56312
|
-
result.push(...innerNorm.operands);
|
|
56313
|
-
continue;
|
|
56314
|
-
}
|
|
56315
|
-
}
|
|
56316
|
-
result.push(operand);
|
|
56317
|
-
}
|
|
56318
|
-
return result;
|
|
56319
|
-
}
|
|
56320
|
-
function normaliseRefinedExpression(node, src) {
|
|
56321
|
-
return {
|
|
56322
|
-
...node,
|
|
56323
|
-
expression: normaliseSubExpression(node.expression, src),
|
|
56324
|
-
refinement: normaliseRefinement(node.refinement, src)
|
|
56325
|
-
};
|
|
56326
|
-
}
|
|
56327
|
-
function normaliseRefinement(node, src) {
|
|
56328
|
-
const normAttrs = node.attributes.map((a) => normaliseAttribute(a, src));
|
|
56329
|
-
normAttrs.sort((a, b) => compareAttributes(a, b, src));
|
|
56330
|
-
return { ...node, attributes: normAttrs };
|
|
56331
|
-
}
|
|
56332
|
-
function compareAttributes(a, b, src) {
|
|
56333
|
-
const aId = a.name.conceptId;
|
|
56334
|
-
const bId = b.name.conceptId;
|
|
56335
|
-
if (aId && bId) {
|
|
56336
|
-
const aBig = BigInt(aId);
|
|
56337
|
-
const bBig = BigInt(bId);
|
|
56338
|
-
if (aBig < bBig) return -1;
|
|
56339
|
-
if (aBig > bBig) return 1;
|
|
56340
|
-
return 0;
|
|
56341
|
-
}
|
|
56342
|
-
if (aId) return -1;
|
|
56343
|
-
if (bId) return 1;
|
|
56344
|
-
const aKey = a.name.expression ? printCanonical(a.name.expression, src) : "";
|
|
56345
|
-
const bKey = b.name.expression ? printCanonical(b.name.expression, src) : "";
|
|
56346
|
-
return aKey.localeCompare(bKey);
|
|
56347
|
-
}
|
|
56348
|
-
function normaliseAttribute(node, src) {
|
|
56349
|
-
return {
|
|
56350
|
-
...node,
|
|
56351
|
-
name: normaliseAttributeName(node.name, src),
|
|
56352
|
-
value: normaliseAttributeValue(node.value, src)
|
|
56353
|
-
};
|
|
56354
|
-
}
|
|
56355
|
-
function normaliseAttributeName(node, src) {
|
|
56356
|
-
return {
|
|
56357
|
-
...node,
|
|
56358
|
-
term: void 0,
|
|
56359
|
-
// §5.1: strip display terms
|
|
56360
|
-
expression: node.expression ? normaliseSubExpression(node.expression, src) : void 0
|
|
56361
|
-
};
|
|
56362
|
-
}
|
|
56363
|
-
function normaliseAttributeValue(node, src) {
|
|
56364
|
-
return {
|
|
56365
|
-
...node,
|
|
56366
|
-
expression: node.expression ? normaliseSubExpression(node.expression, src) : void 0
|
|
56367
|
-
};
|
|
56368
|
-
}
|
|
56369
|
-
function normaliseDottedExpression(node, src) {
|
|
56370
|
-
return {
|
|
56371
|
-
...node,
|
|
56372
|
-
source: normaliseSubExpression(node.source, src),
|
|
56373
|
-
attributes: node.attributes.map(
|
|
56374
|
-
(a) => ({
|
|
56375
|
-
...a,
|
|
56376
|
-
attributeName: normaliseSubExpression(a.attributeName, src)
|
|
56377
|
-
})
|
|
56378
|
-
)
|
|
56379
|
-
};
|
|
56380
|
-
}
|
|
56381
|
-
function stripTerm(node) {
|
|
56382
|
-
return { ...node, term: void 0 };
|
|
56383
|
-
}
|
|
56384
|
-
function copyFilter(node) {
|
|
56385
|
-
return { ...node };
|
|
56386
|
-
}
|
|
56387
56980
|
class CanonicaliseError extends Error {
|
|
56388
56981
|
constructor(message, parseErrors) {
|
|
56389
56982
|
super(message);
|
|
@@ -57429,6 +58022,9 @@ export {
|
|
|
57429
58022
|
CanonicaliseError,
|
|
57430
58023
|
FhirTerminologyService,
|
|
57431
58024
|
REFACTORING_RESOLVE_KIND,
|
|
58025
|
+
TerminologyError,
|
|
58026
|
+
TerminologyHttpError,
|
|
58027
|
+
TerminologyTransportError,
|
|
57432
58028
|
allArticles,
|
|
57433
58029
|
analyzeExpression,
|
|
57434
58030
|
buildReplacementText,
|
|
@@ -57466,6 +58062,10 @@ export {
|
|
|
57466
58062
|
getValidOperatorsAtPosition,
|
|
57467
58063
|
groupIntoExpressions,
|
|
57468
58064
|
isConceptPositionValid,
|
|
58065
|
+
isEclEvaluationStrategy,
|
|
58066
|
+
isTerminologyError,
|
|
58067
|
+
isTerminologyHttpError,
|
|
58068
|
+
isTerminologyTransportError,
|
|
57469
58069
|
isValidConceptId,
|
|
57470
58070
|
isValidDescriptionId,
|
|
57471
58071
|
isValidSnomedId,
|
|
@@ -57477,6 +58077,8 @@ export {
|
|
|
57477
58077
|
refineParseError,
|
|
57478
58078
|
resolveAddDisplayTerms,
|
|
57479
58079
|
resolveUnifiedSimplify,
|
|
58080
|
+
toHttpError,
|
|
58081
|
+
toTransportError,
|
|
57480
58082
|
validateBoolean,
|
|
57481
58083
|
validateIndentSize,
|
|
57482
58084
|
validateIndentStyle,
|