@hyperjump/json-schema 0.21.0 → 0.23.1

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.
@@ -1,6 +1,6 @@
1
1
  var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
2
2
 
3
- var justCurryIt = curry$a;
3
+ var justCurryIt$2 = curry$j;
4
4
 
5
5
  /*
6
6
  function add(a, b, c) {
@@ -25,7 +25,7 @@ var justCurryIt = curry$a;
25
25
  milesToKm(10); // 16.2
26
26
  */
27
27
 
28
- function curry$a(fn, arity) {
28
+ function curry$j(fn, arity) {
29
29
  return function curried() {
30
30
  if (arity == null) {
31
31
  arity = fn.length;
@@ -1896,84 +1896,84 @@ const pathRelative$1 = (from, to) => {
1896
1896
 
1897
1897
  var common$1 = { jsonTypeOf: jsonTypeOf$2, resolveUrl: resolveUrl$3, urlFragment: urlFragment$1, pathRelative: pathRelative$1 };
1898
1898
 
1899
- const curry$9 = justCurryIt;
1899
+ const curry$i = justCurryIt$2;
1900
1900
 
1901
1901
 
1902
- const nil$2 = "";
1902
+ const nil$3 = "";
1903
1903
 
1904
- const compile$P = (pointer) => {
1904
+ const compile$Q = (pointer) => {
1905
1905
  if (pointer.length > 0 && pointer[0] !== "/") {
1906
1906
  throw Error("Invalid JSON Pointer");
1907
1907
  }
1908
1908
 
1909
- return pointer.split("/").slice(1).map(unescape);
1909
+ return pointer.split("/").slice(1).map(unescape$1);
1910
1910
  };
1911
1911
 
1912
- const get$1 = (pointer, value = undefined) => {
1913
- const ptr = compile$P(pointer);
1912
+ const get$3 = (pointer, value = undefined) => {
1913
+ const ptr = compile$Q(pointer);
1914
1914
 
1915
1915
  const fn = (value) => ptr.reduce(([value, pointer], segment) => {
1916
- return [applySegment(value, segment, pointer), append(segment, pointer)];
1916
+ return [applySegment$1(value, segment, pointer), append$1(segment, pointer)];
1917
1917
  }, [value, ""])[0];
1918
1918
 
1919
1919
  return value === undefined ? fn : fn(value);
1920
1920
  };
1921
1921
 
1922
- const set = (pointer, subject = undefined, value = undefined) => {
1923
- const ptr = compile$P(pointer);
1924
- const fn = curry$9((subject, value) => _set(ptr, subject, value, nil$2));
1922
+ const set$1 = (pointer, subject = undefined, value = undefined) => {
1923
+ const ptr = compile$Q(pointer);
1924
+ const fn = curry$i((subject, value) => _set$1(ptr, subject, value, nil$3));
1925
1925
  return subject === undefined ? fn : fn(subject, value);
1926
1926
  };
1927
1927
 
1928
- const _set = (pointer, subject, value, cursor) => {
1928
+ const _set$1 = (pointer, subject, value, cursor) => {
1929
1929
  if (pointer.length === 0) {
1930
1930
  return value;
1931
1931
  } else if (pointer.length > 1) {
1932
1932
  const segment = pointer.shift();
1933
- return { ...subject, [segment]: _set(pointer, applySegment(subject, segment, cursor), value, append(segment, cursor)) };
1933
+ return { ...subject, [segment]: _set$1(pointer, applySegment$1(subject, segment, cursor), value, append$1(segment, cursor)) };
1934
1934
  } else if (Array.isArray(subject)) {
1935
1935
  const clonedSubject = [...subject];
1936
- const segment = computeSegment(subject, pointer[0]);
1936
+ const segment = computeSegment$1(subject, pointer[0]);
1937
1937
  clonedSubject[segment] = value;
1938
1938
  return clonedSubject;
1939
1939
  } else if (typeof subject === "object" && subject !== null) {
1940
1940
  return { ...subject, [pointer[0]]: value };
1941
1941
  } else {
1942
- return applySegment(subject, pointer[0], cursor);
1942
+ return applySegment$1(subject, pointer[0], cursor);
1943
1943
  }
1944
1944
  };
1945
1945
 
1946
- const assign = (pointer, subject = undefined, value = undefined) => {
1947
- const ptr = compile$P(pointer);
1948
- const fn = curry$9((subject, value) => _assign(ptr, subject, value, nil$2));
1946
+ const assign$1 = (pointer, subject = undefined, value = undefined) => {
1947
+ const ptr = compile$Q(pointer);
1948
+ const fn = curry$i((subject, value) => _assign$1(ptr, subject, value, nil$3));
1949
1949
  return subject === undefined ? fn : fn(subject, value);
1950
1950
  };
1951
1951
 
1952
- const _assign = (pointer, subject, value, cursor) => {
1952
+ const _assign$1 = (pointer, subject, value, cursor) => {
1953
1953
  if (pointer.length === 0) {
1954
1954
  return;
1955
- } else if (pointer.length === 1 && !isScalar(subject)) {
1956
- const segment = computeSegment(subject, pointer[0]);
1955
+ } else if (pointer.length === 1 && !isScalar$1(subject)) {
1956
+ const segment = computeSegment$1(subject, pointer[0]);
1957
1957
  subject[segment] = value;
1958
1958
  } else {
1959
1959
  const segment = pointer.shift();
1960
- _assign(pointer, applySegment(subject, segment, cursor), value, append(segment, cursor));
1960
+ _assign$1(pointer, applySegment$1(subject, segment, cursor), value, append$1(segment, cursor));
1961
1961
  }
1962
1962
  };
1963
1963
 
1964
- const unset = (pointer, subject = undefined) => {
1965
- const ptr = compile$P(pointer);
1966
- const fn = (subject) => _unset(ptr, subject, nil$2);
1964
+ const unset$1 = (pointer, subject = undefined) => {
1965
+ const ptr = compile$Q(pointer);
1966
+ const fn = (subject) => _unset$1(ptr, subject, nil$3);
1967
1967
  return subject === undefined ? fn : fn(subject);
1968
1968
  };
1969
1969
 
1970
- const _unset = (pointer, subject, cursor) => {
1970
+ const _unset$1 = (pointer, subject, cursor) => {
1971
1971
  if (pointer.length == 0) {
1972
1972
  return undefined;
1973
1973
  } else if (pointer.length > 1) {
1974
1974
  const segment = pointer.shift();
1975
- const value = applySegment(subject, segment, cursor);
1976
- return { ...subject, [segment]: _unset(pointer, value, append(segment, cursor)) };
1975
+ const value = applySegment$1(subject, segment, cursor);
1976
+ return { ...subject, [segment]: _unset$1(pointer, value, append$1(segment, cursor)) };
1977
1977
  } else if (Array.isArray(subject)) {
1978
1978
  return subject.filter((_, ndx) => ndx != pointer[0]);
1979
1979
  } else if (typeof subject === "object" && subject !== null) {
@@ -1981,54 +1981,54 @@ const _unset = (pointer, subject, cursor) => {
1981
1981
  const { [pointer[0]]: _, ...result } = subject;
1982
1982
  return result;
1983
1983
  } else {
1984
- return applySegment(subject, pointer[0], cursor);
1984
+ return applySegment$1(subject, pointer[0], cursor);
1985
1985
  }
1986
1986
  };
1987
1987
 
1988
- const remove = (pointer, subject = undefined) => {
1989
- const ptr = compile$P(pointer);
1990
- const fn = (subject) => _remove(ptr, subject, nil$2);
1988
+ const remove$1 = (pointer, subject = undefined) => {
1989
+ const ptr = compile$Q(pointer);
1990
+ const fn = (subject) => _remove$1(ptr, subject, nil$3);
1991
1991
  return subject === undefined ? fn : fn(subject);
1992
1992
  };
1993
1993
 
1994
- const _remove = (pointer, subject, cursor) => {
1994
+ const _remove$1 = (pointer, subject, cursor) => {
1995
1995
  if (pointer.length === 0) {
1996
1996
  return;
1997
1997
  } else if (pointer.length > 1) {
1998
1998
  const segment = pointer.shift();
1999
- const value = applySegment(subject, segment, cursor);
2000
- _remove(pointer, value, append(segment, cursor));
1999
+ const value = applySegment$1(subject, segment, cursor);
2000
+ _remove$1(pointer, value, append$1(segment, cursor));
2001
2001
  } else if (Array.isArray(subject)) {
2002
2002
  subject.splice(pointer[0], 1);
2003
2003
  } else if (typeof subject === "object" && subject !== null) {
2004
2004
  delete subject[pointer[0]];
2005
2005
  } else {
2006
- applySegment(subject, pointer[0], cursor);
2006
+ applySegment$1(subject, pointer[0], cursor);
2007
2007
  }
2008
2008
  };
2009
2009
 
2010
- const append = curry$9((segment, pointer) => pointer + "/" + escape(segment));
2010
+ const append$1 = curry$i((segment, pointer) => pointer + "/" + escape$2(segment));
2011
2011
 
2012
- const escape = (segment) => segment.toString().replace(/~/g, "~0").replace(/\//g, "~1");
2013
- const unescape = (segment) => segment.toString().replace(/~1/g, "/").replace(/~0/g, "~");
2014
- const computeSegment = (value, segment) => Array.isArray(value) && segment === "-" ? value.length : segment;
2012
+ const escape$2 = (segment) => segment.toString().replace(/~/g, "~0").replace(/\//g, "~1");
2013
+ const unescape$1 = (segment) => segment.toString().replace(/~1/g, "/").replace(/~0/g, "~");
2014
+ const computeSegment$1 = (value, segment) => Array.isArray(value) && segment === "-" ? value.length : segment;
2015
2015
 
2016
- const applySegment = (value, segment, cursor = "") => {
2016
+ const applySegment$1 = (value, segment, cursor = "") => {
2017
2017
  if (value === undefined) {
2018
2018
  throw TypeError(`Value at '${cursor}' is undefined and does not have property '${segment}'`);
2019
2019
  } else if (value === null) {
2020
2020
  throw TypeError(`Value at '${cursor}' is null and does not have property '${segment}'`);
2021
- } else if (isScalar(value)) {
2021
+ } else if (isScalar$1(value)) {
2022
2022
  throw TypeError(`Value at '${cursor}' is a ${typeof value} and does not have property '${segment}'`);
2023
2023
  } else {
2024
- const computedSegment = computeSegment(value, segment);
2024
+ const computedSegment = computeSegment$1(value, segment);
2025
2025
  return value[computedSegment];
2026
2026
  }
2027
2027
  };
2028
2028
 
2029
- const isScalar = (value) => value === null || typeof value !== "object";
2029
+ const isScalar$1 = (value) => value === null || typeof value !== "object";
2030
2030
 
2031
- var lib$3 = { nil: nil$2, append, get: get$1, set, assign, unset, remove };
2031
+ var lib$6 = { nil: nil$3, append: append$1, get: get$3, set: set$1, assign: assign$1, unset: unset$1, remove: remove$1 };
2032
2032
 
2033
2033
  const $__value = Symbol("$__value");
2034
2034
  const $__href = Symbol("$__href");
@@ -2044,261 +2044,1299 @@ const value$2 = (ref) => ref[$__value];
2044
2044
 
2045
2045
  var reference = { cons: cons$1, isReference, href, value: value$2 };
2046
2046
 
2047
- const JsonPointer$1 = lib$3;
2048
- const curry$8 = justCurryIt;
2047
+ const JsonPointer$3 = lib$6;
2048
+ const curry$h = justCurryIt$2;
2049
2049
  const { resolveUrl: resolveUrl$2, jsonTypeOf: jsonTypeOf$1 } = common$1;
2050
2050
  const Reference$2 = reference;
2051
2051
 
2052
2052
 
2053
- const nil$1 = Object.freeze({ id: "", pointer: "", instance: undefined, value: undefined });
2054
- const cons = (instance, id = "") => Object.freeze({ ...nil$1, id: resolveUrl$2(id, ""), instance, value: instance });
2053
+ const nil$2 = Object.freeze({ id: "", pointer: "", instance: undefined, value: undefined });
2054
+ const cons = (instance, id = "") => Object.freeze({ ...nil$2, id: resolveUrl$2(id, ""), instance, value: instance });
2055
+
2056
+ const get$2 = (url, instance = nil$2) => {
2057
+ if (!url.startsWith("#")) {
2058
+ throw Error(`No JSON document found at '${url.split("#")[0]}'`);
2059
+ }
2060
+
2061
+ return Object.freeze({ ...instance, pointer: url.substr(1) });
2062
+ };
2063
+
2055
2064
  const uri$1 = (doc) => `${doc.id}#${encodeURI(doc.pointer)}`;
2056
2065
  const value$1 = (doc) => Reference$2.isReference(doc.value) ? Reference$2.value(doc.value) : doc.value;
2057
2066
  const has$1 = (key, doc) => key in value$1(doc);
2058
- const typeOf$1 = curry$8((doc, type) => jsonTypeOf$1(value$1(doc), type));
2067
+ const typeOf$1 = curry$h((doc, type) => jsonTypeOf$1(value$1(doc), type));
2059
2068
 
2060
2069
  const step$1 = (key, doc) => Object.freeze({
2061
2070
  ...doc,
2062
- pointer: JsonPointer$1.append(key, doc.pointer),
2071
+ pointer: JsonPointer$3.append(key, doc.pointer),
2063
2072
  value: value$1(doc)[key]
2064
2073
  });
2065
2074
 
2066
- const entries$3 = (doc) => Object.keys(value$1(doc))
2075
+ const entries$5 = (doc) => Object.keys(value$1(doc))
2067
2076
  .map((key) => [key, step$1(key, doc)]);
2068
2077
 
2069
2078
  const keys$1 = (doc) => Object.keys(value$1(doc));
2070
2079
 
2071
- const map$4 = curry$8((fn, doc) => value$1(doc)
2080
+ const map$7 = curry$h((fn, doc) => value$1(doc)
2072
2081
  .map((item, ndx, array, thisArg) => fn(step$1(ndx, doc), ndx, array, thisArg)));
2073
2082
 
2074
- const filter$1 = curry$8((fn, doc) => value$1(doc)
2083
+ const forEach = curry$h((fn, doc) => value$1(doc)
2084
+ .forEach((item, ndx, array, thisArg) => fn(step$1(ndx, doc), ndx, array, thisArg)));
2085
+
2086
+ const filter$2 = curry$h((fn, doc) => value$1(doc)
2075
2087
  .map((item, ndx, array, thisArg) => step$1(ndx, doc))
2076
2088
  .filter((item, ndx, array, thisArg) => fn(item, ndx, array, thisArg)));
2077
2089
 
2078
- const reduce$3 = curry$8((fn, acc, doc) => value$1(doc)
2090
+ const reduce$6 = curry$h((fn, acc, doc) => value$1(doc)
2079
2091
  .reduce((acc, item, ndx) => fn(acc, step$1(ndx, doc), ndx), acc));
2080
2092
 
2081
- const every$1 = curry$8((fn, doc) => value$1(doc)
2093
+ const every$2 = curry$h((fn, doc) => value$1(doc)
2082
2094
  .every((item, ndx, array, thisArg) => fn(step$1(ndx, doc), ndx, array, thisArg)));
2083
2095
 
2084
- const some$1 = curry$8((fn, doc) => value$1(doc)
2096
+ const some$2 = curry$h((fn, doc) => value$1(doc)
2085
2097
  .some((item, ndx, array, thisArg) => fn(step$1(ndx, doc), ndx, array, thisArg)));
2086
2098
 
2087
2099
  const length$1 = (doc) => value$1(doc).length;
2088
2100
 
2089
- var instance = { nil: nil$1, cons, uri: uri$1, value: value$1, has: has$1, typeOf: typeOf$1, step: step$1, entries: entries$3, keys: keys$1, map: map$4, filter: filter$1, reduce: reduce$3, every: every$1, some: some$1, length: length$1 };
2101
+ var instance = {
2102
+ nil: nil$2, cons, get: get$2, uri: uri$1, value: value$1, has: has$1, typeOf: typeOf$1, length: length$1,
2103
+ step: step$1, entries: entries$5, keys: keys$1, map: map$7, forEach, filter: filter$2, reduce: reduce$6, every: every$2, some: some$2
2104
+ };
2090
2105
 
2091
- var entries$2 = async (doc) => Object.entries(await doc);
2106
+ var entries$4 = async (doc) => Object.entries(await doc);
2092
2107
 
2093
- const curry$7 = justCurryIt;
2108
+ const curry$g = justCurryIt$2;
2094
2109
 
2095
2110
 
2096
- var map$3 = curry$7(async (fn, doc) => (await doc).map(fn));
2111
+ var map$6 = curry$g(async (fn, doc) => (await doc).map(fn));
2097
2112
 
2098
- const curry$6 = justCurryIt;
2113
+ const curry$f = justCurryIt$2;
2099
2114
 
2100
2115
 
2101
- var reduce$2 = curry$6(async (fn, acc, doc) => {
2116
+ var reduce$5 = curry$f(async (fn, acc, doc) => {
2102
2117
  return (await doc).reduce(async (acc, item) => fn(await acc, item), acc);
2103
2118
  });
2104
2119
 
2105
- const curry$5 = justCurryIt;
2106
- const reduce$1 = reduce$2;
2120
+ const curry$e = justCurryIt$2;
2121
+ const reduce$4 = reduce$5;
2107
2122
 
2108
2123
 
2109
- var filter = curry$5(async (fn, doc, options = {}) => {
2110
- return reduce$1(async (acc, item) => {
2124
+ var filter$1 = curry$e(async (fn, doc, options = {}) => {
2125
+ return reduce$4(async (acc, item) => {
2111
2126
  return (await fn(item)) ? acc.concat([item]) : acc;
2112
2127
  }, [], doc, options);
2113
2128
  });
2114
2129
 
2115
- const curry$4 = justCurryIt;
2116
- const map$2 = map$3;
2130
+ const curry$d = justCurryIt$2;
2131
+ const map$5 = map$6;
2117
2132
 
2118
2133
 
2119
- var some = curry$4(async (fn, doc) => {
2120
- const results = await map$2(fn, doc);
2134
+ var some$1 = curry$d(async (fn, doc) => {
2135
+ const results = await map$5(fn, doc);
2121
2136
  return (await Promise.all(results))
2122
2137
  .some((a) => a);
2123
2138
  });
2124
2139
 
2125
- const curry$3 = justCurryIt;
2126
- const map$1 = map$3;
2140
+ const curry$c = justCurryIt$2;
2141
+ const map$4 = map$6;
2127
2142
 
2128
2143
 
2129
- var every = curry$3(async (fn, doc) => {
2130
- const results = await map$1(fn, doc);
2144
+ var every$1 = curry$c(async (fn, doc) => {
2145
+ const results = await map$4(fn, doc);
2131
2146
  return (await Promise.all(results))
2132
2147
  .every((a) => a);
2133
2148
  });
2134
2149
 
2135
- const curry$2 = justCurryIt;
2150
+ const curry$b = justCurryIt$2;
2136
2151
 
2137
2152
 
2138
- var pipeline$1 = curry$2((fns, doc) => {
2153
+ var pipeline$3 = curry$b((fns, doc) => {
2139
2154
  return fns.reduce(async (acc, fn) => fn(await acc), doc);
2140
2155
  });
2141
2156
 
2142
- var all = (doc) => Promise.all(doc);
2157
+ var all$1 = (doc) => Promise.all(doc);
2143
2158
 
2144
- const pipeline = pipeline$1;
2145
- const entries$1 = entries$2;
2146
- const reduce = reduce$2;
2159
+ const pipeline$2 = pipeline$3;
2160
+ const entries$3 = entries$4;
2161
+ const reduce$3 = reduce$5;
2147
2162
 
2148
2163
 
2149
- var allValues = (doc) => {
2150
- return pipeline([
2151
- entries$1,
2152
- reduce(async (acc, [propertyName, propertyValue]) => {
2164
+ var allValues$1 = (doc) => {
2165
+ return pipeline$2([
2166
+ entries$3,
2167
+ reduce$3(async (acc, [propertyName, propertyValue]) => {
2153
2168
  acc[propertyName] = await propertyValue;
2154
2169
  return acc;
2155
2170
  }, {})
2156
2171
  ], doc);
2157
2172
  };
2158
2173
 
2159
- var lib$2 = {
2160
- entries: entries$2,
2161
- map: map$3,
2162
- filter: filter,
2163
- reduce: reduce$2,
2164
- some: some,
2165
- every: every,
2166
- pipeline: pipeline$1,
2167
- all: all,
2168
- allValues: allValues
2174
+ var lib$5 = {
2175
+ entries: entries$4,
2176
+ map: map$6,
2177
+ filter: filter$1,
2178
+ reduce: reduce$5,
2179
+ some: some$1,
2180
+ every: every$1,
2181
+ pipeline: pipeline$3,
2182
+ all: all$1,
2183
+ allValues: allValues$1
2169
2184
  };
2170
2185
 
2171
- var fetch_browser = fetch;
2172
-
2173
- var contentType = {};
2174
-
2175
- /*!
2176
- * content-type
2177
- * Copyright(c) 2015 Douglas Christopher Wilson
2178
- * MIT Licensed
2179
- */
2180
-
2181
- /**
2182
- * RegExp to match *( ";" parameter ) in RFC 7231 sec 3.1.1.1
2183
- *
2184
- * parameter = token "=" ( token / quoted-string )
2185
- * token = 1*tchar
2186
- * tchar = "!" / "#" / "$" / "%" / "&" / "'" / "*"
2187
- * / "+" / "-" / "." / "^" / "_" / "`" / "|" / "~"
2188
- * / DIGIT / ALPHA
2189
- * ; any VCHAR, except delimiters
2190
- * quoted-string = DQUOTE *( qdtext / quoted-pair ) DQUOTE
2191
- * qdtext = HTAB / SP / %x21 / %x23-5B / %x5D-7E / obs-text
2192
- * obs-text = %x80-FF
2193
- * quoted-pair = "\" ( HTAB / SP / VCHAR / obs-text )
2194
- */
2195
- var PARAM_REGEXP = /; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g;
2196
- var TEXT_REGEXP = /^[\u000b\u0020-\u007e\u0080-\u00ff]+$/;
2197
- var TOKEN_REGEXP = /^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;
2198
-
2199
- /**
2200
- * RegExp to match quoted-pair in RFC 7230 sec 3.2.6
2201
- *
2202
- * quoted-pair = "\" ( HTAB / SP / VCHAR / obs-text )
2203
- * obs-text = %x80-FF
2204
- */
2205
- var QESC_REGEXP = /\\([\u000b\u0020-\u00ff])/g;
2206
-
2207
- /**
2208
- * RegExp to match chars that must be quoted-pair in RFC 7230 sec 3.2.6
2209
- */
2210
- var QUOTE_REGEXP = /([\\"])/g;
2211
-
2212
- /**
2213
- * RegExp to match type in RFC 7231 sec 3.1.1.1
2214
- *
2215
- * media-type = type "/" subtype
2216
- * type = token
2217
- * subtype = token
2218
- */
2219
- var TYPE_REGEXP = /^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;
2220
-
2221
- /**
2222
- * Module exports.
2223
- * @public
2224
- */
2225
-
2226
- contentType.format = format$1;
2227
- contentType.parse = parse$1;
2228
-
2229
- /**
2230
- * Format object to media type.
2231
- *
2232
- * @param {object} obj
2233
- * @return {string}
2234
- * @public
2235
- */
2186
+ var justCurryIt$1 = curry$a;
2236
2187
 
2237
- function format$1 (obj) {
2238
- if (!obj || typeof obj !== 'object') {
2239
- throw new TypeError('argument obj is required')
2188
+ /*
2189
+ function add(a, b, c) {
2190
+ return a + b + c;
2240
2191
  }
2192
+ curry(add)(1)(2)(3); // 6
2193
+ curry(add)(1)(2)(2); // 5
2194
+ curry(add)(2)(4, 3); // 9
2241
2195
 
2242
- var parameters = obj.parameters;
2243
- var type = obj.type;
2196
+ function add(...args) {
2197
+ return args.reduce((sum, n) => sum + n, 0)
2198
+ }
2199
+ var curryAdd4 = curry(add, 4)
2200
+ curryAdd4(1)(2, 3)(4); // 10
2244
2201
 
2245
- if (!type || !TYPE_REGEXP.test(type)) {
2246
- throw new TypeError('invalid type')
2202
+ function converter(ratio, input) {
2203
+ return (input*ratio).toFixed(1);
2247
2204
  }
2205
+ const curriedConverter = curry(converter)
2206
+ const milesToKm = curriedConverter(1.62);
2207
+ milesToKm(35); // 56.7
2208
+ milesToKm(10); // 16.2
2209
+ */
2248
2210
 
2249
- var string = type;
2211
+ function curry$a(fn, arity) {
2212
+ return function curried() {
2213
+ if (arity == null) {
2214
+ arity = fn.length;
2215
+ }
2216
+ var args = [].slice.call(arguments);
2217
+ if (args.length >= arity) {
2218
+ return fn.apply(this, args);
2219
+ } else {
2220
+ return function() {
2221
+ return curried.apply(this, args.concat([].slice.call(arguments)));
2222
+ };
2223
+ }
2224
+ };
2225
+ }
2250
2226
 
2251
- // append parameters
2252
- if (parameters && typeof parameters === 'object') {
2253
- var param;
2254
- var params = Object.keys(parameters).sort();
2227
+ const curry$9 = justCurryIt$1;
2255
2228
 
2256
- for (var i = 0; i < params.length; i++) {
2257
- param = params[i];
2258
2229
 
2259
- if (!TOKEN_REGEXP.test(param)) {
2260
- throw new TypeError('invalid parameter name')
2261
- }
2230
+ const nil$1 = "";
2262
2231
 
2263
- string += '; ' + param + '=' + qstring(parameters[param]);
2264
- }
2232
+ const compile$P = (pointer) => {
2233
+ if (pointer.length > 0 && pointer[0] !== "/") {
2234
+ throw Error("Invalid JSON Pointer");
2265
2235
  }
2266
2236
 
2267
- return string
2268
- }
2237
+ return pointer.split("/").slice(1).map(unescape);
2238
+ };
2269
2239
 
2270
- /**
2271
- * Parse media type to object.
2272
- *
2273
- * @param {string|object} string
2274
- * @return {Object}
2275
- * @public
2276
- */
2240
+ const get$1 = (pointer, value = undefined) => {
2241
+ const ptr = compile$P(pointer);
2277
2242
 
2278
- function parse$1 (string) {
2279
- if (!string) {
2280
- throw new TypeError('argument string is required')
2281
- }
2243
+ const fn = (value) => ptr.reduce(([value, pointer], segment) => {
2244
+ return [applySegment(value, segment, pointer), append(segment, pointer)];
2245
+ }, [value, ""])[0];
2282
2246
 
2283
- // support req/res-like objects as argument
2284
- var header = typeof string === 'object'
2285
- ? getcontenttype(string)
2286
- : string;
2247
+ return value === undefined ? fn : fn(value);
2248
+ };
2287
2249
 
2288
- if (typeof header !== 'string') {
2289
- throw new TypeError('argument string is required to be a string')
2250
+ const set = (pointer, subject = undefined, value = undefined) => {
2251
+ const ptr = compile$P(pointer);
2252
+ const fn = curry$9((subject, value) => _set(ptr, subject, value, nil$1));
2253
+ return subject === undefined ? fn : fn(subject, value);
2254
+ };
2255
+
2256
+ const _set = (pointer, subject, value, cursor) => {
2257
+ if (pointer.length === 0) {
2258
+ return value;
2259
+ } else if (pointer.length > 1) {
2260
+ if (Array.isArray(subject)) {
2261
+ const index = pointer.shift();
2262
+ const clonedSubject = [...subject];
2263
+ clonedSubject[index] = _set(pointer, applySegment(subject, index, cursor), value, append(index, cursor));
2264
+ return clonedSubject;
2265
+ } else {
2266
+ const segment = pointer.shift();
2267
+ return { ...subject, [segment]: _set(pointer, applySegment(subject, segment, cursor), value, append(segment, cursor)) };
2268
+ }
2269
+ } else if (Array.isArray(subject)) {
2270
+ const clonedSubject = [...subject];
2271
+ const segment = computeSegment(subject, pointer[0]);
2272
+ clonedSubject[segment] = value;
2273
+ return clonedSubject;
2274
+ } else if (typeof subject === "object" && subject !== null) {
2275
+ return { ...subject, [pointer[0]]: value };
2276
+ } else {
2277
+ return applySegment(subject, pointer[0], cursor);
2290
2278
  }
2279
+ };
2291
2280
 
2292
- var index = header.indexOf(';');
2293
- var type = index !== -1
2294
- ? header.substr(0, index).trim()
2295
- : header.trim();
2281
+ const assign = (pointer, subject = undefined, value = undefined) => {
2282
+ const ptr = compile$P(pointer);
2283
+ const fn = curry$9((subject, value) => _assign(ptr, subject, value, nil$1));
2284
+ return subject === undefined ? fn : fn(subject, value);
2285
+ };
2296
2286
 
2297
- if (!TYPE_REGEXP.test(type)) {
2298
- throw new TypeError('invalid media type')
2287
+ const _assign = (pointer, subject, value, cursor) => {
2288
+ if (pointer.length === 0) {
2289
+ return;
2290
+ } else if (pointer.length === 1 && !isScalar(subject)) {
2291
+ const segment = computeSegment(subject, pointer[0]);
2292
+ subject[segment] = value;
2293
+ } else {
2294
+ const segment = pointer.shift();
2295
+ _assign(pointer, applySegment(subject, segment, cursor), value, append(segment, cursor));
2299
2296
  }
2297
+ };
2300
2298
 
2301
- var obj = new ContentType(type.toLowerCase());
2299
+ const unset = (pointer, subject = undefined) => {
2300
+ const ptr = compile$P(pointer);
2301
+ const fn = (subject) => _unset(ptr, subject, nil$1);
2302
+ return subject === undefined ? fn : fn(subject);
2303
+ };
2304
+
2305
+ const _unset = (pointer, subject, cursor) => {
2306
+ if (pointer.length == 0) {
2307
+ return undefined;
2308
+ } else if (pointer.length > 1) {
2309
+ const segment = pointer.shift();
2310
+ const value = applySegment(subject, segment, cursor);
2311
+ return { ...subject, [segment]: _unset(pointer, value, append(segment, cursor)) };
2312
+ } else if (Array.isArray(subject)) {
2313
+ return subject.filter((_, ndx) => ndx != pointer[0]);
2314
+ } else if (typeof subject === "object" && subject !== null) {
2315
+ // eslint-disable-next-line no-unused-vars
2316
+ const { [pointer[0]]: _, ...result } = subject;
2317
+ return result;
2318
+ } else {
2319
+ return applySegment(subject, pointer[0], cursor);
2320
+ }
2321
+ };
2322
+
2323
+ const remove = (pointer, subject = undefined) => {
2324
+ const ptr = compile$P(pointer);
2325
+ const fn = (subject) => _remove(ptr, subject, nil$1);
2326
+ return subject === undefined ? fn : fn(subject);
2327
+ };
2328
+
2329
+ const _remove = (pointer, subject, cursor) => {
2330
+ if (pointer.length === 0) {
2331
+ return;
2332
+ } else if (pointer.length > 1) {
2333
+ const segment = pointer.shift();
2334
+ const value = applySegment(subject, segment, cursor);
2335
+ _remove(pointer, value, append(segment, cursor));
2336
+ } else if (Array.isArray(subject)) {
2337
+ subject.splice(pointer[0], 1);
2338
+ } else if (typeof subject === "object" && subject !== null) {
2339
+ delete subject[pointer[0]];
2340
+ } else {
2341
+ applySegment(subject, pointer[0], cursor);
2342
+ }
2343
+ };
2344
+
2345
+ const append = curry$9((segment, pointer) => pointer + "/" + escape$1(segment));
2346
+
2347
+ const escape$1 = (segment) => segment.toString().replace(/~/g, "~0").replace(/\//g, "~1");
2348
+ const unescape = (segment) => segment.toString().replace(/~1/g, "/").replace(/~0/g, "~");
2349
+ const computeSegment = (value, segment) => Array.isArray(value) && segment === "-" ? value.length : segment;
2350
+
2351
+ const applySegment = (value, segment, cursor = "") => {
2352
+ if (value === undefined) {
2353
+ throw TypeError(`Value at '${cursor}' is undefined and does not have property '${segment}'`);
2354
+ } else if (value === null) {
2355
+ throw TypeError(`Value at '${cursor}' is null and does not have property '${segment}'`);
2356
+ } else if (isScalar(value)) {
2357
+ throw TypeError(`Value at '${cursor}' is a ${typeof value} and does not have property '${segment}'`);
2358
+ } else {
2359
+ const computedSegment = computeSegment(value, segment);
2360
+ return value[computedSegment];
2361
+ }
2362
+ };
2363
+
2364
+ const isScalar = (value) => value === null || typeof value !== "object";
2365
+
2366
+ var lib$4 = { nil: nil$1, append, get: get$1, set, assign, unset, remove };
2367
+
2368
+ var moo$1 = {exports: {}};
2369
+
2370
+ (function (module) {
2371
+ (function(root, factory) {
2372
+ if (module.exports) {
2373
+ module.exports = factory();
2374
+ } else {
2375
+ root.moo = factory();
2376
+ }
2377
+ }(commonjsGlobal, function() {
2378
+
2379
+ var hasOwnProperty = Object.prototype.hasOwnProperty;
2380
+ var toString = Object.prototype.toString;
2381
+ var hasSticky = typeof new RegExp().sticky === 'boolean';
2382
+
2383
+ /***************************************************************************/
2384
+
2385
+ function isRegExp(o) { return o && toString.call(o) === '[object RegExp]' }
2386
+ function isObject(o) { return o && typeof o === 'object' && !isRegExp(o) && !Array.isArray(o) }
2387
+
2388
+ function reEscape(s) {
2389
+ return s.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&')
2390
+ }
2391
+ function reGroups(s) {
2392
+ var re = new RegExp('|' + s);
2393
+ return re.exec('').length - 1
2394
+ }
2395
+ function reCapture(s) {
2396
+ return '(' + s + ')'
2397
+ }
2398
+ function reUnion(regexps) {
2399
+ if (!regexps.length) return '(?!)'
2400
+ var source = regexps.map(function(s) {
2401
+ return "(?:" + s + ")"
2402
+ }).join('|');
2403
+ return "(?:" + source + ")"
2404
+ }
2405
+
2406
+ function regexpOrLiteral(obj) {
2407
+ if (typeof obj === 'string') {
2408
+ return '(?:' + reEscape(obj) + ')'
2409
+
2410
+ } else if (isRegExp(obj)) {
2411
+ // TODO: consider /u support
2412
+ if (obj.ignoreCase) throw new Error('RegExp /i flag not allowed')
2413
+ if (obj.global) throw new Error('RegExp /g flag is implied')
2414
+ if (obj.sticky) throw new Error('RegExp /y flag is implied')
2415
+ if (obj.multiline) throw new Error('RegExp /m flag is implied')
2416
+ return obj.source
2417
+
2418
+ } else {
2419
+ throw new Error('Not a pattern: ' + obj)
2420
+ }
2421
+ }
2422
+
2423
+ function objectToRules(object) {
2424
+ var keys = Object.getOwnPropertyNames(object);
2425
+ var result = [];
2426
+ for (var i = 0; i < keys.length; i++) {
2427
+ var key = keys[i];
2428
+ var thing = object[key];
2429
+ var rules = [].concat(thing);
2430
+ if (key === 'include') {
2431
+ for (var j = 0; j < rules.length; j++) {
2432
+ result.push({include: rules[j]});
2433
+ }
2434
+ continue
2435
+ }
2436
+ var match = [];
2437
+ rules.forEach(function(rule) {
2438
+ if (isObject(rule)) {
2439
+ if (match.length) result.push(ruleOptions(key, match));
2440
+ result.push(ruleOptions(key, rule));
2441
+ match = [];
2442
+ } else {
2443
+ match.push(rule);
2444
+ }
2445
+ });
2446
+ if (match.length) result.push(ruleOptions(key, match));
2447
+ }
2448
+ return result
2449
+ }
2450
+
2451
+ function arrayToRules(array) {
2452
+ var result = [];
2453
+ for (var i = 0; i < array.length; i++) {
2454
+ var obj = array[i];
2455
+ if (obj.include) {
2456
+ var include = [].concat(obj.include);
2457
+ for (var j = 0; j < include.length; j++) {
2458
+ result.push({include: include[j]});
2459
+ }
2460
+ continue
2461
+ }
2462
+ if (!obj.type) {
2463
+ throw new Error('Rule has no type: ' + JSON.stringify(obj))
2464
+ }
2465
+ result.push(ruleOptions(obj.type, obj));
2466
+ }
2467
+ return result
2468
+ }
2469
+
2470
+ function ruleOptions(type, obj) {
2471
+ if (!isObject(obj)) {
2472
+ obj = { match: obj };
2473
+ }
2474
+ if (obj.include) {
2475
+ throw new Error('Matching rules cannot also include states')
2476
+ }
2477
+
2478
+ // nb. error and fallback imply lineBreaks
2479
+ var options = {
2480
+ defaultType: type,
2481
+ lineBreaks: !!obj.error || !!obj.fallback,
2482
+ pop: false,
2483
+ next: null,
2484
+ push: null,
2485
+ error: false,
2486
+ fallback: false,
2487
+ value: null,
2488
+ type: null,
2489
+ shouldThrow: false,
2490
+ };
2491
+
2492
+ // Avoid Object.assign(), so we support IE9+
2493
+ for (var key in obj) {
2494
+ if (hasOwnProperty.call(obj, key)) {
2495
+ options[key] = obj[key];
2496
+ }
2497
+ }
2498
+
2499
+ // type transform cannot be a string
2500
+ if (typeof options.type === 'string' && type !== options.type) {
2501
+ throw new Error("Type transform cannot be a string (type '" + options.type + "' for token '" + type + "')")
2502
+ }
2503
+
2504
+ // convert to array
2505
+ var match = options.match;
2506
+ options.match = Array.isArray(match) ? match : match ? [match] : [];
2507
+ options.match.sort(function(a, b) {
2508
+ return isRegExp(a) && isRegExp(b) ? 0
2509
+ : isRegExp(b) ? -1 : isRegExp(a) ? +1 : b.length - a.length
2510
+ });
2511
+ return options
2512
+ }
2513
+
2514
+ function toRules(spec) {
2515
+ return Array.isArray(spec) ? arrayToRules(spec) : objectToRules(spec)
2516
+ }
2517
+
2518
+ var defaultErrorRule = ruleOptions('error', {lineBreaks: true, shouldThrow: true});
2519
+ function compileRules(rules, hasStates) {
2520
+ var errorRule = null;
2521
+ var fast = Object.create(null);
2522
+ var fastAllowed = true;
2523
+ var unicodeFlag = null;
2524
+ var groups = [];
2525
+ var parts = [];
2526
+
2527
+ // If there is a fallback rule, then disable fast matching
2528
+ for (var i = 0; i < rules.length; i++) {
2529
+ if (rules[i].fallback) {
2530
+ fastAllowed = false;
2531
+ }
2532
+ }
2533
+
2534
+ for (var i = 0; i < rules.length; i++) {
2535
+ var options = rules[i];
2536
+
2537
+ if (options.include) {
2538
+ // all valid inclusions are removed by states() preprocessor
2539
+ throw new Error('Inheritance is not allowed in stateless lexers')
2540
+ }
2541
+
2542
+ if (options.error || options.fallback) {
2543
+ // errorRule can only be set once
2544
+ if (errorRule) {
2545
+ if (!options.fallback === !errorRule.fallback) {
2546
+ throw new Error("Multiple " + (options.fallback ? "fallback" : "error") + " rules not allowed (for token '" + options.defaultType + "')")
2547
+ } else {
2548
+ throw new Error("fallback and error are mutually exclusive (for token '" + options.defaultType + "')")
2549
+ }
2550
+ }
2551
+ errorRule = options;
2552
+ }
2553
+
2554
+ var match = options.match.slice();
2555
+ if (fastAllowed) {
2556
+ while (match.length && typeof match[0] === 'string' && match[0].length === 1) {
2557
+ var word = match.shift();
2558
+ fast[word.charCodeAt(0)] = options;
2559
+ }
2560
+ }
2561
+
2562
+ // Warn about inappropriate state-switching options
2563
+ if (options.pop || options.push || options.next) {
2564
+ if (!hasStates) {
2565
+ throw new Error("State-switching options are not allowed in stateless lexers (for token '" + options.defaultType + "')")
2566
+ }
2567
+ if (options.fallback) {
2568
+ throw new Error("State-switching options are not allowed on fallback tokens (for token '" + options.defaultType + "')")
2569
+ }
2570
+ }
2571
+
2572
+ // Only rules with a .match are included in the RegExp
2573
+ if (match.length === 0) {
2574
+ continue
2575
+ }
2576
+ fastAllowed = false;
2577
+
2578
+ groups.push(options);
2579
+
2580
+ // Check unicode flag is used everywhere or nowhere
2581
+ for (var j = 0; j < match.length; j++) {
2582
+ var obj = match[j];
2583
+ if (!isRegExp(obj)) {
2584
+ continue
2585
+ }
2586
+
2587
+ if (unicodeFlag === null) {
2588
+ unicodeFlag = obj.unicode;
2589
+ } else if (unicodeFlag !== obj.unicode && options.fallback === false) {
2590
+ throw new Error('If one rule is /u then all must be')
2591
+ }
2592
+ }
2593
+
2594
+ // convert to RegExp
2595
+ var pat = reUnion(match.map(regexpOrLiteral));
2596
+
2597
+ // validate
2598
+ var regexp = new RegExp(pat);
2599
+ if (regexp.test("")) {
2600
+ throw new Error("RegExp matches empty string: " + regexp)
2601
+ }
2602
+ var groupCount = reGroups(pat);
2603
+ if (groupCount > 0) {
2604
+ throw new Error("RegExp has capture groups: " + regexp + "\nUse (?: … ) instead")
2605
+ }
2606
+
2607
+ // try and detect rules matching newlines
2608
+ if (!options.lineBreaks && regexp.test('\n')) {
2609
+ throw new Error('Rule should declare lineBreaks: ' + regexp)
2610
+ }
2611
+
2612
+ // store regex
2613
+ parts.push(reCapture(pat));
2614
+ }
2615
+
2616
+
2617
+ // If there's no fallback rule, use the sticky flag so we only look for
2618
+ // matches at the current index.
2619
+ //
2620
+ // If we don't support the sticky flag, then fake it using an irrefutable
2621
+ // match (i.e. an empty pattern).
2622
+ var fallbackRule = errorRule && errorRule.fallback;
2623
+ var flags = hasSticky && !fallbackRule ? 'ym' : 'gm';
2624
+ var suffix = hasSticky || fallbackRule ? '' : '|';
2625
+
2626
+ if (unicodeFlag === true) flags += "u";
2627
+ var combined = new RegExp(reUnion(parts) + suffix, flags);
2628
+ return {regexp: combined, groups: groups, fast: fast, error: errorRule || defaultErrorRule}
2629
+ }
2630
+
2631
+ function compile(rules) {
2632
+ var result = compileRules(toRules(rules));
2633
+ return new Lexer({start: result}, 'start')
2634
+ }
2635
+
2636
+ function checkStateGroup(g, name, map) {
2637
+ var state = g && (g.push || g.next);
2638
+ if (state && !map[state]) {
2639
+ throw new Error("Missing state '" + state + "' (in token '" + g.defaultType + "' of state '" + name + "')")
2640
+ }
2641
+ if (g && g.pop && +g.pop !== 1) {
2642
+ throw new Error("pop must be 1 (in token '" + g.defaultType + "' of state '" + name + "')")
2643
+ }
2644
+ }
2645
+ function compileStates(states, start) {
2646
+ var all = states.$all ? toRules(states.$all) : [];
2647
+ delete states.$all;
2648
+
2649
+ var keys = Object.getOwnPropertyNames(states);
2650
+ if (!start) start = keys[0];
2651
+
2652
+ var ruleMap = Object.create(null);
2653
+ for (var i = 0; i < keys.length; i++) {
2654
+ var key = keys[i];
2655
+ ruleMap[key] = toRules(states[key]).concat(all);
2656
+ }
2657
+ for (var i = 0; i < keys.length; i++) {
2658
+ var key = keys[i];
2659
+ var rules = ruleMap[key];
2660
+ var included = Object.create(null);
2661
+ for (var j = 0; j < rules.length; j++) {
2662
+ var rule = rules[j];
2663
+ if (!rule.include) continue
2664
+ var splice = [j, 1];
2665
+ if (rule.include !== key && !included[rule.include]) {
2666
+ included[rule.include] = true;
2667
+ var newRules = ruleMap[rule.include];
2668
+ if (!newRules) {
2669
+ throw new Error("Cannot include nonexistent state '" + rule.include + "' (in state '" + key + "')")
2670
+ }
2671
+ for (var k = 0; k < newRules.length; k++) {
2672
+ var newRule = newRules[k];
2673
+ if (rules.indexOf(newRule) !== -1) continue
2674
+ splice.push(newRule);
2675
+ }
2676
+ }
2677
+ rules.splice.apply(rules, splice);
2678
+ j--;
2679
+ }
2680
+ }
2681
+
2682
+ var map = Object.create(null);
2683
+ for (var i = 0; i < keys.length; i++) {
2684
+ var key = keys[i];
2685
+ map[key] = compileRules(ruleMap[key], true);
2686
+ }
2687
+
2688
+ for (var i = 0; i < keys.length; i++) {
2689
+ var name = keys[i];
2690
+ var state = map[name];
2691
+ var groups = state.groups;
2692
+ for (var j = 0; j < groups.length; j++) {
2693
+ checkStateGroup(groups[j], name, map);
2694
+ }
2695
+ var fastKeys = Object.getOwnPropertyNames(state.fast);
2696
+ for (var j = 0; j < fastKeys.length; j++) {
2697
+ checkStateGroup(state.fast[fastKeys[j]], name, map);
2698
+ }
2699
+ }
2700
+
2701
+ return new Lexer(map, start)
2702
+ }
2703
+
2704
+ function keywordTransform(map) {
2705
+ var reverseMap = Object.create(null);
2706
+ var byLength = Object.create(null);
2707
+ var types = Object.getOwnPropertyNames(map);
2708
+ for (var i = 0; i < types.length; i++) {
2709
+ var tokenType = types[i];
2710
+ var item = map[tokenType];
2711
+ var keywordList = Array.isArray(item) ? item : [item];
2712
+ keywordList.forEach(function(keyword) {
2713
+ (byLength[keyword.length] = byLength[keyword.length] || []).push(keyword);
2714
+ if (typeof keyword !== 'string') {
2715
+ throw new Error("keyword must be string (in keyword '" + tokenType + "')")
2716
+ }
2717
+ reverseMap[keyword] = tokenType;
2718
+ });
2719
+ }
2720
+
2721
+ // fast string lookup
2722
+ // https://jsperf.com/string-lookups
2723
+ function str(x) { return JSON.stringify(x) }
2724
+ var source = '';
2725
+ source += 'switch (value.length) {\n';
2726
+ for (var length in byLength) {
2727
+ var keywords = byLength[length];
2728
+ source += 'case ' + length + ':\n';
2729
+ source += 'switch (value) {\n';
2730
+ keywords.forEach(function(keyword) {
2731
+ var tokenType = reverseMap[keyword];
2732
+ source += 'case ' + str(keyword) + ': return ' + str(tokenType) + '\n';
2733
+ });
2734
+ source += '}\n';
2735
+ }
2736
+ source += '}\n';
2737
+ return Function('value', source) // type
2738
+ }
2739
+
2740
+ /***************************************************************************/
2741
+
2742
+ var Lexer = function(states, state) {
2743
+ this.startState = state;
2744
+ this.states = states;
2745
+ this.buffer = '';
2746
+ this.stack = [];
2747
+ this.reset();
2748
+ };
2749
+
2750
+ Lexer.prototype.reset = function(data, info) {
2751
+ this.buffer = data || '';
2752
+ this.index = 0;
2753
+ this.line = info ? info.line : 1;
2754
+ this.col = info ? info.col : 1;
2755
+ this.queuedToken = info ? info.queuedToken : null;
2756
+ this.queuedThrow = info ? info.queuedThrow : null;
2757
+ this.setState(info ? info.state : this.startState);
2758
+ this.stack = info && info.stack ? info.stack.slice() : [];
2759
+ return this
2760
+ };
2761
+
2762
+ Lexer.prototype.save = function() {
2763
+ return {
2764
+ line: this.line,
2765
+ col: this.col,
2766
+ state: this.state,
2767
+ stack: this.stack.slice(),
2768
+ queuedToken: this.queuedToken,
2769
+ queuedThrow: this.queuedThrow,
2770
+ }
2771
+ };
2772
+
2773
+ Lexer.prototype.setState = function(state) {
2774
+ if (!state || this.state === state) return
2775
+ this.state = state;
2776
+ var info = this.states[state];
2777
+ this.groups = info.groups;
2778
+ this.error = info.error;
2779
+ this.re = info.regexp;
2780
+ this.fast = info.fast;
2781
+ };
2782
+
2783
+ Lexer.prototype.popState = function() {
2784
+ this.setState(this.stack.pop());
2785
+ };
2786
+
2787
+ Lexer.prototype.pushState = function(state) {
2788
+ this.stack.push(this.state);
2789
+ this.setState(state);
2790
+ };
2791
+
2792
+ var eat = hasSticky ? function(re, buffer) { // assume re is /y
2793
+ return re.exec(buffer)
2794
+ } : function(re, buffer) { // assume re is /g
2795
+ var match = re.exec(buffer);
2796
+ // will always match, since we used the |(?:) trick
2797
+ if (match[0].length === 0) {
2798
+ return null
2799
+ }
2800
+ return match
2801
+ };
2802
+
2803
+ Lexer.prototype._getGroup = function(match) {
2804
+ var groupCount = this.groups.length;
2805
+ for (var i = 0; i < groupCount; i++) {
2806
+ if (match[i + 1] !== undefined) {
2807
+ return this.groups[i]
2808
+ }
2809
+ }
2810
+ throw new Error('Cannot find token type for matched text')
2811
+ };
2812
+
2813
+ function tokenToString() {
2814
+ return this.value
2815
+ }
2816
+
2817
+ Lexer.prototype.next = function() {
2818
+ var index = this.index;
2819
+
2820
+ // If a fallback token matched, we don't need to re-run the RegExp
2821
+ if (this.queuedGroup) {
2822
+ var token = this._token(this.queuedGroup, this.queuedText, index);
2823
+ this.queuedGroup = null;
2824
+ this.queuedText = "";
2825
+ return token
2826
+ }
2827
+
2828
+ var buffer = this.buffer;
2829
+ if (index === buffer.length) {
2830
+ return // EOF
2831
+ }
2832
+
2833
+ // Fast matching for single characters
2834
+ var group = this.fast[buffer.charCodeAt(index)];
2835
+ if (group) {
2836
+ return this._token(group, buffer.charAt(index), index)
2837
+ }
2838
+
2839
+ // Execute RegExp
2840
+ var re = this.re;
2841
+ re.lastIndex = index;
2842
+ var match = eat(re, buffer);
2843
+
2844
+ // Error tokens match the remaining buffer
2845
+ var error = this.error;
2846
+ if (match == null) {
2847
+ return this._token(error, buffer.slice(index, buffer.length), index)
2848
+ }
2849
+
2850
+ var group = this._getGroup(match);
2851
+ var text = match[0];
2852
+
2853
+ if (error.fallback && match.index !== index) {
2854
+ this.queuedGroup = group;
2855
+ this.queuedText = text;
2856
+
2857
+ // Fallback tokens contain the unmatched portion of the buffer
2858
+ return this._token(error, buffer.slice(index, match.index), index)
2859
+ }
2860
+
2861
+ return this._token(group, text, index)
2862
+ };
2863
+
2864
+ Lexer.prototype._token = function(group, text, offset) {
2865
+ // count line breaks
2866
+ var lineBreaks = 0;
2867
+ if (group.lineBreaks) {
2868
+ var matchNL = /\n/g;
2869
+ var nl = 1;
2870
+ if (text === '\n') {
2871
+ lineBreaks = 1;
2872
+ } else {
2873
+ while (matchNL.exec(text)) { lineBreaks++; nl = matchNL.lastIndex; }
2874
+ }
2875
+ }
2876
+
2877
+ var token = {
2878
+ type: (typeof group.type === 'function' && group.type(text)) || group.defaultType,
2879
+ value: typeof group.value === 'function' ? group.value(text) : text,
2880
+ text: text,
2881
+ toString: tokenToString,
2882
+ offset: offset,
2883
+ lineBreaks: lineBreaks,
2884
+ line: this.line,
2885
+ col: this.col,
2886
+ };
2887
+ // nb. adding more props to token object will make V8 sad!
2888
+
2889
+ var size = text.length;
2890
+ this.index += size;
2891
+ this.line += lineBreaks;
2892
+ if (lineBreaks !== 0) {
2893
+ this.col = size - nl + 1;
2894
+ } else {
2895
+ this.col += size;
2896
+ }
2897
+
2898
+ // throw, if no rule with {error: true}
2899
+ if (group.shouldThrow) {
2900
+ throw new Error(this.formatError(token, "invalid syntax"))
2901
+ }
2902
+
2903
+ if (group.pop) this.popState();
2904
+ else if (group.push) this.pushState(group.push);
2905
+ else if (group.next) this.setState(group.next);
2906
+
2907
+ return token
2908
+ };
2909
+
2910
+ if (typeof Symbol !== 'undefined' && Symbol.iterator) {
2911
+ var LexerIterator = function(lexer) {
2912
+ this.lexer = lexer;
2913
+ };
2914
+
2915
+ LexerIterator.prototype.next = function() {
2916
+ var token = this.lexer.next();
2917
+ return {value: token, done: !token}
2918
+ };
2919
+
2920
+ LexerIterator.prototype[Symbol.iterator] = function() {
2921
+ return this
2922
+ };
2923
+
2924
+ Lexer.prototype[Symbol.iterator] = function() {
2925
+ return new LexerIterator(this)
2926
+ };
2927
+ }
2928
+
2929
+ Lexer.prototype.formatError = function(token, message) {
2930
+ if (token == null) {
2931
+ // An undefined token indicates EOF
2932
+ var text = this.buffer.slice(this.index);
2933
+ var token = {
2934
+ text: text,
2935
+ offset: this.index,
2936
+ lineBreaks: text.indexOf('\n') === -1 ? 0 : 1,
2937
+ line: this.line,
2938
+ col: this.col,
2939
+ };
2940
+ }
2941
+ var start = Math.max(0, token.offset - token.col + 1);
2942
+ var eol = token.lineBreaks ? token.text.indexOf('\n') : token.text.length;
2943
+ var firstLine = this.buffer.substring(start, token.offset + eol);
2944
+ message += " at line " + token.line + " col " + token.col + ":\n\n";
2945
+ message += " " + firstLine + "\n";
2946
+ message += " " + Array(token.col).join(" ") + "^";
2947
+ return message
2948
+ };
2949
+
2950
+ Lexer.prototype.clone = function() {
2951
+ return new Lexer(this.states, this.state)
2952
+ };
2953
+
2954
+ Lexer.prototype.has = function(tokenType) {
2955
+ return true
2956
+ };
2957
+
2958
+
2959
+ return {
2960
+ compile: compile,
2961
+ states: compileStates,
2962
+ error: Object.freeze({error: true}),
2963
+ fallback: Object.freeze({fallback: true}),
2964
+ keywords: keywordTransform,
2965
+ }
2966
+
2967
+ }));
2968
+ } (moo$1));
2969
+
2970
+ const moo = moo$1.exports;
2971
+
2972
+
2973
+ const digit = `[0-9]`;
2974
+ const digit19 = `[1-9]`;
2975
+ const hexdig = `[0-9a-fA-F]`;
2976
+
2977
+ // String
2978
+ const unescaped = `[\\x20-\\x21\\x23-\\x5b\\x5d-\\u{10ffff}]`;
2979
+ const escape = `\\\\`;
2980
+ const escaped = `${escape}(?:["\\/\\\\brfnt]|u${hexdig}{4})`;
2981
+ const char = `(?:${unescaped}|${escaped})`;
2982
+ const string = `"${char}*"`;
2983
+
2984
+ // Number
2985
+ const int = `(?:0|${digit19}${digit}*)`;
2986
+ const frac = `\\.${digit}+`;
2987
+ const e = `[eE]`;
2988
+ const exp = `${e}[-+]?${digit}+`;
2989
+ const number = `-?${int}(?:${frac})?(?:${exp})?`;
2990
+
2991
+ // Whitespace
2992
+ const whitespace = `(?:(?:\\r?\\n)|[ \\t])+`;
2993
+
2994
+ var lexer = (json) => {
2995
+ const lexer = moo.states({
2996
+ main: {
2997
+ WS: { match: new RegExp(whitespace, "u"), lineBreaks: true },
2998
+ true: { match: "true", value: () => true },
2999
+ false: { match: "false", value: () => false },
3000
+ null: { match: "null", value: () => null },
3001
+ number: { match: new RegExp(number, "u"), value: parseFloat },
3002
+ string: { match: new RegExp(string, "u"), value: JSON.parse },
3003
+ "{": "{",
3004
+ "}": "}",
3005
+ "[": "[",
3006
+ "]": "]",
3007
+ ":": ":",
3008
+ ",": ",",
3009
+ error: moo.error
3010
+ }
3011
+ });
3012
+ lexer.reset(json);
3013
+
3014
+ const _next = () => {
3015
+ let token;
3016
+ do {
3017
+ token = lexer.next();
3018
+ if (token?.type === "error") {
3019
+ throw SyntaxError(lexer.formatError(token, "Unrecognized token"));
3020
+ }
3021
+ } while (token?.type === "WS");
3022
+
3023
+ return token;
3024
+ };
3025
+
3026
+ let previous;
3027
+ let nextToken = _next();
3028
+
3029
+ const next = (expectedType = undefined) => {
3030
+ previous = nextToken;
3031
+ nextToken = _next();
3032
+ if (expectedType && previous?.type !== expectedType) {
3033
+ throw SyntaxError(lexer.formatError(previous, `Expected a '${expectedType}'`));
3034
+ }
3035
+ return previous;
3036
+ };
3037
+
3038
+ const peek = () => nextToken;
3039
+
3040
+ const defaultErrorToken = { offset: 0, line: 1, col: 0, text: "" };
3041
+ const syntaxError = (message) => {
3042
+ const referenceToken = previous || defaultErrorToken;
3043
+ const errorToken = {
3044
+ ...referenceToken,
3045
+ offset: referenceToken.offset + referenceToken.text.length,
3046
+ col: referenceToken.col + referenceToken.text.length
3047
+ };
3048
+ throw new SyntaxError(lexer.formatError(errorToken, message));
3049
+ };
3050
+
3051
+ return { next, peek, syntaxError };
3052
+ };
3053
+
3054
+ const JsonPointer$2 = lib$4;
3055
+ const jsonLexer = lexer;
3056
+
3057
+
3058
+ const defaultReviver = (key, value) => value;
3059
+ const parse$3 = (json, reviver = defaultReviver) => {
3060
+ const lexer = jsonLexer(json);
3061
+ const value = parseValue(lexer, "", JsonPointer$2.nil, reviver);
3062
+
3063
+ const token = lexer.peek();
3064
+ if (token) {
3065
+ lexer.syntaxError("A value has been parsed, but more tokens were found");
3066
+ }
3067
+ return value;
3068
+ };
3069
+
3070
+ const parseValue = (lexer, key, pointer, reviver) => {
3071
+ let value;
3072
+ const token = lexer.next();
3073
+ switch (token?.type) {
3074
+ case "true":
3075
+ case "false":
3076
+ case "null":
3077
+ case "number":
3078
+ case "string":
3079
+ value = token.value;
3080
+ break;
3081
+ case "{":
3082
+ value = parseObject(lexer, key, pointer, reviver);
3083
+ break;
3084
+ case "[":
3085
+ value = parseArray(lexer, key, pointer, reviver);
3086
+ break;
3087
+ default:
3088
+ lexer.syntaxError("Expected a JSON value");
3089
+ }
3090
+
3091
+ return reviver(key, value, pointer);
3092
+ };
3093
+
3094
+ const parseObject = (lexer, key, pointer, reviver) => {
3095
+ const value = {};
3096
+
3097
+ if (lexer.peek()?.type !== "}") {
3098
+ parseProperties(lexer, key, pointer, reviver, value);
3099
+ }
3100
+
3101
+ lexer.next("}");
3102
+
3103
+ return value;
3104
+ };
3105
+
3106
+ const parseProperties = (lexer, key, pointer, reviver, value) => {
3107
+ const propertyName = lexer.next("string").value;
3108
+ lexer.next(":");
3109
+ if (!isValueToken(lexer.peek())) {
3110
+ lexer.syntaxError("Expected a JSON value");
3111
+ }
3112
+ value[propertyName] = parseValue(lexer, propertyName, JsonPointer$2.append(propertyName, pointer), reviver);
3113
+
3114
+ if (lexer.peek()?.type === ",") {
3115
+ lexer.next(); // burn comma
3116
+ parseProperties(lexer, propertyName, pointer, reviver, value);
3117
+ } else if (isValueToken(lexer.peek())) {
3118
+ lexer.next(",");
3119
+ }
3120
+ };
3121
+
3122
+ const parseArray = (lexer, key, pointer, reviver) => {
3123
+ const value = [];
3124
+
3125
+ if (lexer.peek()?.type !== "]") {
3126
+ parseItems(lexer, 0, pointer, reviver, value);
3127
+ }
3128
+
3129
+ lexer.next("]");
3130
+
3131
+ return value;
3132
+ };
3133
+
3134
+ const parseItems = (lexer, key, pointer, reviver, value) => {
3135
+ if (!isValueToken(lexer.peek())) {
3136
+ lexer.syntaxError("Expected a JSON value");
3137
+ }
3138
+ value[key] = parseValue(lexer, key, JsonPointer$2.append(key, pointer), reviver);
3139
+ if (lexer.peek()?.type === ",") {
3140
+ lexer.next(); // burn comma
3141
+ parseItems(lexer, key + 1, pointer, reviver, value);
3142
+ } else if (isValueToken(lexer.peek())) {
3143
+ lexer.next(",");
3144
+ }
3145
+ };
3146
+
3147
+ const valueType = new Set(["string", "number", "true", "false", "null", "[", "{"]);
3148
+ const isValueToken = (token) => valueType.has(token?.type);
3149
+
3150
+ var parse_1 = parse$3;
3151
+
3152
+ const JsonPointer$1 = lib$4;
3153
+
3154
+
3155
+ const defaultReplacer = (key, value) => value;
3156
+ const stringify$2 = (value, replacer = defaultReplacer, space = "") => {
3157
+ return stringifyValue(value, replacer, space, "", JsonPointer$1.nil, 1);
3158
+ };
3159
+
3160
+ const stringifyValue = (value, replacer, space, key, pointer, depth) => {
3161
+ value = replacer(key, value, pointer);
3162
+ let result;
3163
+ if (Array.isArray(value)) {
3164
+ result = stringifyArray(value, replacer, space, pointer, depth);
3165
+ } else if (typeof value === "object" && value !== null) {
3166
+ result = stringifyObject(value, replacer, space, pointer, depth);
3167
+ } else {
3168
+ result = JSON.stringify(value);
3169
+ }
3170
+
3171
+ return result;
3172
+ };
3173
+
3174
+ const stringifyArray = (value, replacer, space, pointer, depth) => {
3175
+ if (value.length === 0) {
3176
+ space = "";
3177
+ }
3178
+ const padding = space ? `\n${space.repeat(depth - 1)}` : "";
3179
+ return "[" + padding + space + value
3180
+ .map((item, index) => {
3181
+ const indexPointer = JsonPointer$1.append(index, pointer);
3182
+ return stringifyValue(item, replacer, space, index, indexPointer, depth + 1);
3183
+ })
3184
+ .join(`,${padding}${space}`) + padding + "]";
3185
+ };
3186
+
3187
+ const stringifyObject = (value, replacer, space, pointer, depth) => {
3188
+ if (Object.keys(value).length === 0) {
3189
+ space = "";
3190
+ }
3191
+ const padding = space ? `\n${space.repeat(depth - 1)}` : "";
3192
+ const spacing = space ? " " : "";
3193
+ return "{" + padding + space + Object.entries(value)
3194
+ .map(([key, value]) => {
3195
+ const keyPointer = JsonPointer$1.append(key, pointer);
3196
+ return JSON.stringify(key) + ":" + spacing + stringifyValue(value, replacer, space, key, keyPointer, depth + 1);
3197
+ })
3198
+ .join(`,${padding}${space}`) + padding + "}";
3199
+ };
3200
+
3201
+ var stringify_1 = stringify$2;
3202
+
3203
+ const parse$2 = parse_1;
3204
+ const stringify$1 = stringify_1;
3205
+
3206
+
3207
+ var lib$3 = { parse: parse$2, stringify: stringify$1 };
3208
+
3209
+ var fetch_browser = fetch;
3210
+
3211
+ var contentType = {};
3212
+
3213
+ /*!
3214
+ * content-type
3215
+ * Copyright(c) 2015 Douglas Christopher Wilson
3216
+ * MIT Licensed
3217
+ */
3218
+
3219
+ /**
3220
+ * RegExp to match *( ";" parameter ) in RFC 7231 sec 3.1.1.1
3221
+ *
3222
+ * parameter = token "=" ( token / quoted-string )
3223
+ * token = 1*tchar
3224
+ * tchar = "!" / "#" / "$" / "%" / "&" / "'" / "*"
3225
+ * / "+" / "-" / "." / "^" / "_" / "`" / "|" / "~"
3226
+ * / DIGIT / ALPHA
3227
+ * ; any VCHAR, except delimiters
3228
+ * quoted-string = DQUOTE *( qdtext / quoted-pair ) DQUOTE
3229
+ * qdtext = HTAB / SP / %x21 / %x23-5B / %x5D-7E / obs-text
3230
+ * obs-text = %x80-FF
3231
+ * quoted-pair = "\" ( HTAB / SP / VCHAR / obs-text )
3232
+ */
3233
+ var PARAM_REGEXP = /; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g;
3234
+ var TEXT_REGEXP = /^[\u000b\u0020-\u007e\u0080-\u00ff]+$/;
3235
+ var TOKEN_REGEXP = /^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;
3236
+
3237
+ /**
3238
+ * RegExp to match quoted-pair in RFC 7230 sec 3.2.6
3239
+ *
3240
+ * quoted-pair = "\" ( HTAB / SP / VCHAR / obs-text )
3241
+ * obs-text = %x80-FF
3242
+ */
3243
+ var QESC_REGEXP = /\\([\u000b\u0020-\u00ff])/g;
3244
+
3245
+ /**
3246
+ * RegExp to match chars that must be quoted-pair in RFC 7230 sec 3.2.6
3247
+ */
3248
+ var QUOTE_REGEXP = /([\\"])/g;
3249
+
3250
+ /**
3251
+ * RegExp to match type in RFC 7231 sec 3.1.1.1
3252
+ *
3253
+ * media-type = type "/" subtype
3254
+ * type = token
3255
+ * subtype = token
3256
+ */
3257
+ var TYPE_REGEXP = /^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;
3258
+
3259
+ /**
3260
+ * Module exports.
3261
+ * @public
3262
+ */
3263
+
3264
+ contentType.format = format$1;
3265
+ contentType.parse = parse$1;
3266
+
3267
+ /**
3268
+ * Format object to media type.
3269
+ *
3270
+ * @param {object} obj
3271
+ * @return {string}
3272
+ * @public
3273
+ */
3274
+
3275
+ function format$1 (obj) {
3276
+ if (!obj || typeof obj !== 'object') {
3277
+ throw new TypeError('argument obj is required')
3278
+ }
3279
+
3280
+ var parameters = obj.parameters;
3281
+ var type = obj.type;
3282
+
3283
+ if (!type || !TYPE_REGEXP.test(type)) {
3284
+ throw new TypeError('invalid type')
3285
+ }
3286
+
3287
+ var string = type;
3288
+
3289
+ // append parameters
3290
+ if (parameters && typeof parameters === 'object') {
3291
+ var param;
3292
+ var params = Object.keys(parameters).sort();
3293
+
3294
+ for (var i = 0; i < params.length; i++) {
3295
+ param = params[i];
3296
+
3297
+ if (!TOKEN_REGEXP.test(param)) {
3298
+ throw new TypeError('invalid parameter name')
3299
+ }
3300
+
3301
+ string += '; ' + param + '=' + qstring(parameters[param]);
3302
+ }
3303
+ }
3304
+
3305
+ return string
3306
+ }
3307
+
3308
+ /**
3309
+ * Parse media type to object.
3310
+ *
3311
+ * @param {string|object} string
3312
+ * @return {Object}
3313
+ * @public
3314
+ */
3315
+
3316
+ function parse$1 (string) {
3317
+ if (!string) {
3318
+ throw new TypeError('argument string is required')
3319
+ }
3320
+
3321
+ // support req/res-like objects as argument
3322
+ var header = typeof string === 'object'
3323
+ ? getcontenttype(string)
3324
+ : string;
3325
+
3326
+ if (typeof header !== 'string') {
3327
+ throw new TypeError('argument string is required to be a string')
3328
+ }
3329
+
3330
+ var index = header.indexOf(';');
3331
+ var type = index !== -1
3332
+ ? header.substr(0, index).trim()
3333
+ : header.trim();
3334
+
3335
+ if (!TYPE_REGEXP.test(type)) {
3336
+ throw new TypeError('invalid media type')
3337
+ }
3338
+
3339
+ var obj = new ContentType(type.toLowerCase());
2302
3340
 
2303
3341
  // parse parameters
2304
3342
  if (index !== -1) {
@@ -2403,11 +3441,11 @@ const addPlugin = (contentType, plugin) => {
2403
3441
  };
2404
3442
 
2405
3443
  const parse = (response) => {
2406
- const contentType = contentTypeParser.parse(response.headers.get("content-type")).type;
2407
- if (!(contentType in mediaTypePlugins)) {
2408
- throw Error(`${response.url} is not a schema. Found a document with media type: ${contentType}`);
3444
+ const contentType = contentTypeParser.parse(response.headers.get("content-type"));
3445
+ if (!(contentType.type in mediaTypePlugins)) {
3446
+ throw Error(`${response.url} is not a schema. Found a document with media type: ${contentType.type}`);
2409
3447
  }
2410
- return mediaTypePlugins[contentType].parse(response);
3448
+ return mediaTypePlugins[contentType.type].parse(response, contentType.parameters);
2411
3449
  };
2412
3450
 
2413
3451
  const getContentType = (path) => {
@@ -2422,9 +3460,10 @@ const getContentType = (path) => {
2422
3460
 
2423
3461
  var mediaTypes = { addPlugin, parse, getContentType };
2424
3462
 
2425
- const curry$1 = justCurryIt;
2426
- const Pact$a = lib$2;
2427
- const JsonPointer = lib$3;
3463
+ const curry$8 = justCurryIt$2;
3464
+ const Pact$a = lib$5;
3465
+ const Json = lib$3;
3466
+ const JsonPointer = lib$6;
2428
3467
  const { jsonTypeOf, resolveUrl: resolveUrl$1, urlFragment, pathRelative } = common$1;
2429
3468
  const fetch$1 = fetch_browser;
2430
3469
  const Reference$1 = reference;
@@ -2439,6 +3478,8 @@ const config = {};
2439
3478
  const dialectJsonSchemaVersion = {};
2440
3479
 
2441
3480
  const setConfig = (jsonSchemaVersion, key, value) => {
3481
+ dialectJsonSchemaVersion[jsonSchemaVersion] = jsonSchemaVersion;
3482
+
2442
3483
  if (!config[jsonSchemaVersion]) {
2443
3484
  config[jsonSchemaVersion] = {};
2444
3485
  }
@@ -2453,62 +3494,61 @@ const getConfig = (dialectId, key) => {
2453
3494
  // Schema Management
2454
3495
  const schemaStore = {};
2455
3496
  const schemaStoreAlias = {};
3497
+ const add$1 = (schema, retrievalUri = "", defaultDialectId = "") => {
3498
+ const dialectId = getDialectId(schema, retrievalUri, defaultDialectId);
2456
3499
 
2457
- const add$1 = (schema, url = "", defaultSchemaVersion = "") => {
2458
- schema = JSON.parse(JSON.stringify(schema));
2459
- const externalId = resolveUrl$1(url, "");
3500
+ const id = getBaseUri(schema, retrievalUri, dialectJsonSchemaVersion[dialectId]);
2460
3501
 
2461
- // Dialect / JSON Schema Version
2462
- const dialectId = resolveUrl$1(schema["$schema"] || defaultSchemaVersion, "");
2463
- if (!dialectId) {
2464
- throw Error("Couldn't determine schema dialect");
2465
- }
2466
- delete schema["$schema"];
3502
+ // Extract embedded schemas and collect anchors
3503
+ const embeddedToken = getConfig(dialectId, "embeddedToken");
3504
+ const baseToken = getConfig(dialectId, "baseToken");
3505
+ const anchorToken = getConfig(dialectId, "anchorToken");
3506
+ const dynamicAnchorToken = getConfig(dialectId, "dynamicAnchorToken");
3507
+ const jrefToken = getConfig(dialectId, "jrefToken");
2467
3508
 
2468
- // JSON Schema version
2469
- if (!(dialectId in dialectJsonSchemaVersion)) {
2470
- if (schema?.$vocabulary?.[core201909Id] === true && dialectId === getSchemaIdentifier(schema, externalId, core201909Id)[0]) {
2471
- dialectJsonSchemaVersion[dialectId] = core201909Id;
2472
- } else if (schema?.$vocabulary?.[core202012Id] === true && dialectId === getSchemaIdentifier(schema, externalId, core202012Id)[0]) {
2473
- dialectJsonSchemaVersion[dialectId] = core202012Id;
2474
- } else if (dialectId === getSchemaIdentifier(schema, externalId, dialectId)[0]) {
2475
- dialectJsonSchemaVersion[dialectId] = dialectId;
2476
- } else if (!(dialectId in schemaStore)) {
2477
- throw Error(`Couldn't determine JSON Schema version for dialect: '${dialectId}'`);
2478
- } else {
2479
- const metaSchema = schemaStore[dialectId];
2480
- if (metaSchema.vocabulary[core201909Id] === true) {
2481
- dialectJsonSchemaVersion[dialectId] = core201909Id;
2482
- } else if (metaSchema.vocabulary[core202012Id] === true) {
2483
- dialectJsonSchemaVersion[dialectId] = core202012Id;
2484
- } else {
2485
- dialectJsonSchemaVersion[dialectId] = dialectJsonSchemaVersion[metaSchema.dialectId];
3509
+ const dynamicAnchors = {};
3510
+ const anchors = { "": "" };
3511
+
3512
+ schema = Json.parse(JSON.stringify(schema), (key, value, pointer) => {
3513
+ if (jsonTypeOf(value, "object")) {
3514
+ // Embedded Schema
3515
+ const embeddedSchemaDialectId = typeof value.$schema === "string" ? resolveUrl$1(value.$schema, "") : dialectId;
3516
+ const embeddedEmbeddedToken = getConfig(embeddedSchemaDialectId, "embeddedToken");
3517
+ const embeddedAnchorToken = getConfig(embeddedSchemaDialectId, "anchorToken");
3518
+ if (typeof value[embeddedEmbeddedToken] === "string" && (embeddedEmbeddedToken !== embeddedAnchorToken || value[embeddedEmbeddedToken][0] !== "#") && pointer !== "") {
3519
+ const embeddedRetrievalUri = resolveUrl$1(id, value[embeddedEmbeddedToken]);
3520
+ add$1(value, embeddedRetrievalUri, dialectId);
3521
+ return Reference$1.cons(value[embeddedEmbeddedToken], value);
3522
+ }
3523
+
3524
+ if (typeof value[jrefToken] === "string") {
3525
+ return Reference$1.cons(value[jrefToken], value);
3526
+ }
3527
+
3528
+ if (typeof value[anchorToken] === "string" && pointer !== JsonPointer.nil) {
3529
+ const anchor = anchorToken !== embeddedToken ? value[anchorToken] : value[anchorToken].slice(1);
3530
+ anchors[anchor] = pointer;
3531
+ delete value[anchorToken];
3532
+ }
3533
+
3534
+ if (typeof value[dynamicAnchorToken] === "string") {
3535
+ dynamicAnchors[value[dynamicAnchorToken]] = `${id}#${pointer}`;
3536
+ anchors[value[dynamicAnchorToken]] = pointer;
3537
+ delete value[dynamicAnchorToken];
2486
3538
  }
2487
3539
  }
2488
- }
2489
3540
 
2490
- // Internal Identifier
2491
- const [id, fragment] = getSchemaIdentifier(schema, externalId, dialectJsonSchemaVersion[dialectId]);
2492
- if (!id) {
2493
- throw Error("Couldn't determine an identifier for the schema");
2494
- }
2495
- const baseToken = getConfig(dialectId, "baseToken");
2496
- delete schema[baseToken];
2497
- if (externalId) {
2498
- schemaStoreAlias[externalId] = id;
2499
- }
3541
+ return value;
3542
+ });
3543
+ console.log(embeddedIds);
2500
3544
 
2501
- const anchorToken = getConfig(dialectId, "anchorToken");
2502
- if (fragment && baseToken === anchorToken) {
2503
- schema[anchorToken] = anchorToken !== baseToken ? encodeURI(fragment) : `#${encodeURI(fragment)}`;
2504
- }
3545
+ delete schema.$schema;
3546
+ delete schema[baseToken];
2505
3547
 
2506
3548
  // recursiveAnchor
2507
- const dynamicAnchors = {};
2508
3549
  const recursiveAnchorToken = getConfig(dialectId, "recursiveAnchorToken");
2509
3550
  if (schema[recursiveAnchorToken] === true) {
2510
3551
  dynamicAnchors[""] = `${id}#`;
2511
- schema[anchorToken] = "";
2512
3552
  delete schema[recursiveAnchorToken];
2513
3553
  }
2514
3554
 
@@ -2523,69 +3563,66 @@ const add$1 = (schema, url = "", defaultSchemaVersion = "") => {
2523
3563
  }
2524
3564
 
2525
3565
  // Store Schema
2526
- const anchors = { "": "" };
2527
3566
  schemaStore[id] = {
2528
- id: id,
2529
- dialectId: dialectId,
2530
- schema: processSchema(schema, id, dialectId, JsonPointer.nil, anchors, dynamicAnchors),
2531
- anchors: anchors,
2532
- dynamicAnchors: dynamicAnchors,
2533
- vocabulary: vocabulary,
3567
+ id,
3568
+ dialectId,
3569
+ schema,
3570
+ anchors,
3571
+ dynamicAnchors,
3572
+ vocabulary,
2534
3573
  validated: false
2535
3574
  };
3575
+ if (id === "https://example.com/schema/root") {
3576
+ console.log(Object.keys(schemaStore).filter((id) => !/json-schema\.org/.test(id)));
3577
+ }
2536
3578
 
2537
- return id;
3579
+ if (retrievalUri) {
3580
+ schemaStoreAlias[resolveUrl$1(retrievalUri, "")] = id;
3581
+ }
2538
3582
  };
2539
3583
 
2540
- const getSchemaIdentifier = (schema, externalId, jsonSchemaVersion) => {
2541
- const baseToken = config[jsonSchemaVersion]?.["baseToken"];
2542
- const internalUrl = resolveUrl$1(externalId, schema[baseToken] || "");
2543
- return [resolveUrl$1(internalUrl, ""), urlFragment(internalUrl)];
2544
- };
2545
-
2546
- const processSchema = (subject, id, dialectId, pointer, anchors, dynamicAnchors) => {
2547
- if (jsonTypeOf(subject, "object")) {
2548
- const embeddedSchemaDialectId = typeof subject.$schema === "string" ? resolveUrl$1(subject.$schema, "") : dialectId;
2549
- const embeddedEmbeddedToken = getConfig(embeddedSchemaDialectId, "embeddedToken");
2550
- const embeddedAnchorToken = getConfig(embeddedSchemaDialectId, "anchorToken");
2551
- if (typeof subject[embeddedEmbeddedToken] === "string" && (embeddedEmbeddedToken !== embeddedAnchorToken || subject[embeddedEmbeddedToken][0] !== "#")) {
2552
- const ref = resolveUrl$1(id, subject[embeddedEmbeddedToken]);
2553
- const embeddedBaseToken = getConfig(embeddedSchemaDialectId, "baseToken");
2554
- subject[embeddedBaseToken] = ref;
2555
- add$1(subject, ref, dialectId);
2556
- return Reference$1.cons(subject[embeddedEmbeddedToken], subject);
2557
- }
2558
-
2559
- const anchorToken = getConfig(dialectId, "anchorToken");
2560
- const dynamicAnchorToken = getConfig(dialectId, "dynamicAnchorToken");
2561
- if (typeof subject[dynamicAnchorToken] === "string") {
2562
- dynamicAnchors[subject[dynamicAnchorToken]] = `${id}#${encodeURI(pointer)}`;
2563
- anchors[subject[dynamicAnchorToken]] = pointer;
2564
- delete subject[dynamicAnchorToken];
2565
- }
2566
-
2567
- const embeddedToken = getConfig(dialectId, "embeddedToken");
2568
- if (typeof subject[anchorToken] === "string") {
2569
- const anchor = anchorToken !== embeddedToken ? subject[anchorToken] : subject[anchorToken].slice(1);
2570
- anchors[anchor] = pointer;
2571
- delete subject[anchorToken];
2572
- }
3584
+ const getDialectId = (schema, retrievalUri, defaultDialectId) => {
3585
+ const dialectId = resolveUrl$1(schema.$schema || defaultDialectId, "");
3586
+ if (!dialectId) {
3587
+ throw Error("Couldn't determine schema dialect");
3588
+ }
2573
3589
 
2574
- const jrefToken = getConfig(dialectId, "jrefToken");
2575
- if (typeof subject[jrefToken] === "string") {
2576
- return Reference$1.cons(subject[jrefToken], subject);
3590
+ // Determine JSON Schema version
3591
+ if (!(dialectId in dialectJsonSchemaVersion)) {
3592
+ if (schema?.$vocabulary?.[core201909Id] === true && dialectId === getBaseUri(schema, retrievalUri, core201909Id)) {
3593
+ // Self describing 2019-09 meta-schema
3594
+ dialectJsonSchemaVersion[dialectId] = core201909Id;
3595
+ } else if (schema?.$vocabulary?.[core202012Id] === true && dialectId === getBaseUri(schema, retrievalUri, core202012Id)) {
3596
+ // Self describing 2020-12 meta-schema
3597
+ dialectJsonSchemaVersion[dialectId] = core202012Id;
3598
+ } else {
3599
+ // Need to look at meta-schema to determine version
3600
+ const metaSchema = schemaStore[dialectId];
3601
+ if (!metaSchema) {
3602
+ throw Error(`Couldn't determine JSON Schema version for dialect: '${dialectId}'`);
3603
+ } else if (metaSchema.vocabulary[core201909Id] === true) {
3604
+ dialectJsonSchemaVersion[dialectId] = core201909Id;
3605
+ } else if (metaSchema.vocabulary[core202012Id] === true) {
3606
+ dialectJsonSchemaVersion[dialectId] = core202012Id;
3607
+ } else {
3608
+ // Assume the jsonSchemaVersion is the meta-schema's dialectId (non-standard behavior)
3609
+ dialectJsonSchemaVersion[dialectId] = dialectJsonSchemaVersion[metaSchema.dialectId];
3610
+ }
2577
3611
  }
3612
+ }
2578
3613
 
2579
- for (const key in subject) {
2580
- subject[key] = processSchema(subject[key], id, dialectId, JsonPointer.append(key, pointer), anchors, dynamicAnchors);
2581
- }
3614
+ return dialectId;
3615
+ };
2582
3616
 
2583
- return subject;
2584
- } else if (Array.isArray(subject)) {
2585
- return subject.map((item, ndx) => processSchema(item, id, dialectId, JsonPointer.append(ndx, pointer), anchors, dynamicAnchors));
2586
- } else {
2587
- return subject;
3617
+ const getBaseUri = (schema, retrievalUri, jsonSchemaVersion) => {
3618
+ const baseToken = config[jsonSchemaVersion]?.["baseToken"];
3619
+ const relativeBaseUri = typeof schema[baseToken] === "string" ? schema[baseToken] : "";
3620
+ const baseUri = resolveUrl$1(resolveUrl$1(retrievalUri, relativeBaseUri), "");
3621
+ if (!baseUri) {
3622
+ throw Error("Couldn't determine an identifier for the schema");
2588
3623
  }
3624
+
3625
+ return baseUri;
2589
3626
  };
2590
3627
 
2591
3628
  const hasStoredSchema = (id) => id in schemaStore || id in schemaStoreAlias;
@@ -2620,7 +3657,23 @@ const get = async (url, contextDoc = nil) => {
2620
3657
  throw Error(`Failed to retrieve schema with id: ${id}`);
2621
3658
  }
2622
3659
 
2623
- add$1(await MediaTypes$1.parse(response), id);
3660
+ const [schema, defaultDialectId] = await MediaTypes$1.parse(response);
3661
+
3662
+ let dialectId;
3663
+ if (schema.$schema) {
3664
+ dialectId = resolveUrl$1(schema.$schema, "");
3665
+ } else if (defaultDialectId) {
3666
+ dialectId = resolveUrl$1(id, defaultDialectId);
3667
+ } else {
3668
+ dialectId = "";
3669
+ }
3670
+
3671
+ // Make sure the meta-schema is loaded if this isn't a known dialect
3672
+ if (dialectId && id !== dialectId && !(dialectId in dialectJsonSchemaVersion)) {
3673
+ await get(dialectId);
3674
+ }
3675
+
3676
+ add$1(schema, id, dialectId);
2624
3677
  }
2625
3678
 
2626
3679
  const storedSchema = getStoredSchema(id);
@@ -2663,14 +3716,14 @@ const step = (key, doc) => {
2663
3716
 
2664
3717
  const keys = (doc) => Object.keys(value(doc));
2665
3718
 
2666
- const entries = (doc) => Pact$a.pipeline([
3719
+ const entries$2 = (doc) => Pact$a.pipeline([
2667
3720
  value,
2668
3721
  Object.keys,
2669
3722
  Pact$a.map(async (key) => [key, await step(key, doc)]),
2670
3723
  Pact$a.all
2671
3724
  ], doc);
2672
3725
 
2673
- const map = curry$1((fn, doc) => Pact$a.pipeline([
3726
+ const map$3 = curry$8((fn, doc) => Pact$a.pipeline([
2674
3727
  value,
2675
3728
  Pact$a.map(async (item, ndx) => fn(await step(ndx, doc), ndx)),
2676
3729
  Pact$a.all
@@ -2686,41 +3739,43 @@ const toSchemaDefaultOptions = {
2686
3739
  const toSchema = (schemaDoc, options = {}) => {
2687
3740
  const fullOptions = { ...toSchemaDefaultOptions, ...options };
2688
3741
 
2689
- const schema = JSON.parse(JSON.stringify(schemaDoc.schema, (key, value) => {
2690
- if (!Reference$1.isReference(value)) {
2691
- return value;
3742
+ const anchorToken = getConfig(schemaDoc.dialectId, "anchorToken");
3743
+ const dynamicAnchorToken = getConfig(schemaDoc.dialectId, "dynamicAnchorToken");
3744
+
3745
+ const anchors = {};
3746
+ for (const anchor in schemaDoc.anchors) {
3747
+ if (anchor !== "" && !schemaDoc.dynamicAnchors[anchor]) {
3748
+ anchors[schemaDoc.anchors[anchor]] = anchor;
2692
3749
  }
3750
+ }
3751
+
3752
+ const dynamicAnchors = {};
3753
+ for (const anchor in schemaDoc.dynamicAnchors) {
3754
+ const pointer = urlFragment(schemaDoc.dynamicAnchors[anchor]);
3755
+ dynamicAnchors[pointer] = anchor;
3756
+ }
2693
3757
 
2694
- const refValue = Reference$1.value(value);
2695
- const embeddedDialect = typeof refValue.$schema === "string" ? resolveUrl$1(refValue.$schema, "") : schemaDoc.dialectId;
2696
- const embeddedToken = getConfig(embeddedDialect, "embeddedToken");
2697
- if (!fullOptions.includeEmbedded && embeddedToken in refValue) {
2698
- return;
3758
+ const schema = JSON.parse(Json.stringify(schemaDoc.schema, (key, value, pointer) => {
3759
+ if (Reference$1.isReference(value)) {
3760
+ const refValue = Reference$1.value(value);
3761
+ const embeddedDialect = typeof refValue.$schema === "string" ? resolveUrl$1(refValue.$schema, "") : schemaDoc.dialectId;
3762
+ const embeddedToken = getConfig(embeddedDialect, "embeddedToken");
3763
+ if (!fullOptions.includeEmbedded && embeddedToken in refValue) {
3764
+ return;
3765
+ } else {
3766
+ return Reference$1.value(value);
3767
+ }
2699
3768
  } else {
2700
- return Reference$1.value(value);
3769
+ if (pointer in anchors) {
3770
+ value = { [anchorToken]: anchors[pointer], ...value };
3771
+ }
3772
+ if (pointer in dynamicAnchors) {
3773
+ value = { [dynamicAnchorToken]: dynamicAnchors[pointer], ...value };
3774
+ }
3775
+ return value;
2701
3776
  }
2702
3777
  }));
2703
3778
 
2704
- const dynamicAnchorToken = getConfig(schemaDoc.dialectId, "dynamicAnchorToken");
2705
- Object.entries(schemaDoc.dynamicAnchors)
2706
- .forEach(([anchor, uri]) => {
2707
- const pointer = urlFragment(uri);
2708
- JsonPointer.assign(pointer, schema, {
2709
- [dynamicAnchorToken]: anchor,
2710
- ...JsonPointer.get(pointer, schema)
2711
- });
2712
- });
2713
-
2714
- const anchorToken = getConfig(schemaDoc.dialectId, "anchorToken");
2715
- Object.entries(schemaDoc.anchors)
2716
- .filter(([anchor]) => anchor !== "")
2717
- .forEach(([anchor, pointer]) => {
2718
- JsonPointer.assign(pointer, schema, {
2719
- [anchorToken]: anchor,
2720
- ...JsonPointer.get(pointer, schema)
2721
- });
2722
- });
2723
-
2724
3779
  const baseToken = getConfig(schemaDoc.dialectId, "baseToken");
2725
3780
  const id = relativeUri(fullOptions.parentId, schemaDoc.id);
2726
3781
  const dialect = fullOptions.parentDialect === schemaDoc.dialectId ? "" : schemaDoc.dialectId;
@@ -2743,7 +3798,7 @@ const relativeUri = (from, to) => {
2743
3798
  var schema$5 = {
2744
3799
  setConfig, getConfig,
2745
3800
  add: add$1, get, markValidated,
2746
- uri, value, getAnchorPointer, typeOf, has, step, keys, entries, map, length,
3801
+ uri, value, getAnchorPointer, typeOf, has, step, keys, entries: entries$2, map: map$3, length,
2747
3802
  toSchema
2748
3803
  };
2749
3804
 
@@ -2757,13 +3812,22 @@ class InvalidSchemaError$3 extends Error {
2757
3812
 
2758
3813
  var invalidSchemaError = InvalidSchemaError$3;
2759
3814
 
2760
- const curry = justCurryIt;
3815
+ const Schema$R = schema$5;
3816
+
3817
+
3818
+ const compile$O = (schema) => Schema$R.value(schema);
3819
+ const interpret$O = () => true;
3820
+
3821
+ var metaData$4 = { compile: compile$O, interpret: interpret$O };
3822
+
3823
+ const curry$7 = justCurryIt$2;
2761
3824
  const PubSub$1 = pubsub.exports;
2762
3825
  const { resolveUrl } = common$1;
2763
3826
  const Instance$E = instance;
2764
- const Schema$R = schema$5;
3827
+ const Schema$Q = schema$5;
2765
3828
  const InvalidSchemaError$2 = invalidSchemaError;
2766
3829
  const MediaTypes = mediaTypes;
3830
+ const metaData$3 = metaData$4;
2767
3831
 
2768
3832
 
2769
3833
  const FLAG = "FLAG", BASIC = "BASIC", DETAILED = "DETAILED", VERBOSE = "VERBOSE";
@@ -2772,24 +3836,27 @@ let metaOutputFormat = DETAILED;
2772
3836
  let shouldMetaValidate = true;
2773
3837
 
2774
3838
  MediaTypes.addPlugin("application/schema+json", {
2775
- parse: async (response) => await response.json(),
3839
+ parse: async (response, contentTypeParameters) => [
3840
+ await response.json(),
3841
+ contentTypeParameters.schema || contentTypeParameters.profile
3842
+ ],
2776
3843
  matcher: (path) => path.endsWith(".schema.json")
2777
3844
  });
2778
3845
 
2779
3846
  const validate$2 = async (schema, value = undefined, outputFormat = undefined) => {
2780
- const compiled = await compile$O(schema);
2781
- const interpretAst = (value, outputFormat) => interpret$O(compiled, Instance$E.cons(value), outputFormat);
3847
+ const compiled = await compile$N(schema);
3848
+ const interpretAst = (value, outputFormat) => interpret$N(compiled, Instance$E.cons(value), outputFormat);
2782
3849
 
2783
3850
  return value === undefined ? interpretAst : interpretAst(value, outputFormat);
2784
3851
  };
2785
3852
 
2786
- const compile$O = async (schema) => {
3853
+ const compile$N = async (schema) => {
2787
3854
  const ast = { metaData: {} };
2788
3855
  const schemaUri = await compileSchema(schema, ast);
2789
3856
  return { ast, schemaUri };
2790
3857
  };
2791
3858
 
2792
- const interpret$O = curry(({ ast, schemaUri }, value, outputFormat = FLAG) => {
3859
+ const interpret$N = curry$7(({ ast, schemaUri }, value, outputFormat = FLAG) => {
2793
3860
  if (![FLAG, BASIC, DETAILED, VERBOSE].includes(outputFormat)) {
2794
3861
  throw Error(`The '${outputFormat}' error format is not supported`);
2795
3862
  }
@@ -2843,7 +3910,7 @@ const setShouldMetaValidate = (isEnabled) => {
2843
3910
  };
2844
3911
 
2845
3912
  const _keywords = {};
2846
- const getKeyword = (id) => _keywords[id];
3913
+ const getKeyword = (id) => _keywords[id] || metaData$3;
2847
3914
  const hasKeyword = (id) => id in _keywords;
2848
3915
  const addKeyword = (id, keywordHandler) => {
2849
3916
  _keywords[id] = {
@@ -2864,10 +3931,10 @@ const compileSchema = async (schema, ast) => {
2864
3931
 
2865
3932
  // Vocabularies
2866
3933
  if (!hasKeyword(`${schema.dialectId}#validate`)) {
2867
- const metaSchema = await Schema$R.get(schema.dialectId);
3934
+ const metaSchema = await Schema$Q.get(schema.dialectId);
2868
3935
 
2869
3936
  // Check for mandatory vocabularies
2870
- const mandatoryVocabularies = Schema$R.getConfig(metaSchema.id, "mandatoryVocabularies") || [];
3937
+ const mandatoryVocabularies = Schema$Q.getConfig(metaSchema.id, "mandatoryVocabularies") || [];
2871
3938
  mandatoryVocabularies.forEach((vocabularyId) => {
2872
3939
  if (!metaSchema.vocabulary[vocabularyId]) {
2873
3940
  throw Error(`Vocabulary '${vocabularyId}' must be explicitly declared and required`);
@@ -2890,13 +3957,13 @@ const compileSchema = async (schema, ast) => {
2890
3957
 
2891
3958
  // Meta validation
2892
3959
  if (shouldMetaValidate && !schema.validated) {
2893
- Schema$R.markValidated(schema.id);
3960
+ Schema$Q.markValidated(schema.id);
2894
3961
 
2895
3962
  // Compile
2896
3963
  if (!(schema.dialectId in metaValidators)) {
2897
- const metaSchema = await Schema$R.get(schema.dialectId);
2898
- const compiledSchema = await compile$O(metaSchema);
2899
- metaValidators[metaSchema.id] = interpret$O(compiledSchema);
3964
+ const metaSchema = await Schema$Q.get(schema.dialectId);
3965
+ const compiledSchema = await compile$N(metaSchema);
3966
+ metaValidators[metaSchema.id] = interpret$N(compiledSchema);
2900
3967
  }
2901
3968
 
2902
3969
  // Interpret
@@ -2919,7 +3986,7 @@ const compileSchema = async (schema, ast) => {
2919
3986
  };
2920
3987
 
2921
3988
  const followReferences = async (doc) => {
2922
- return Schema$R.typeOf(doc, "string") ? followReferences(await Schema$R.get(Schema$R.value(doc), doc)) : doc;
3989
+ return Schema$Q.typeOf(doc, "string") ? followReferences(await Schema$Q.get(Schema$Q.value(doc), doc)) : doc;
2923
3990
  };
2924
3991
 
2925
3992
  const interpretSchema = (schemaUri, instance, ast, dynamicAnchors) => {
@@ -2947,27 +4014,19 @@ const getKeywordId = (schemaUri, ast) => {
2947
4014
  };
2948
4015
 
2949
4016
  const add = (schema, url = "", defaultSchemaVersion = "") => {
2950
- const id = Schema$R.add(schema, url, defaultSchemaVersion);
4017
+ const id = Schema$Q.add(schema, url, defaultSchemaVersion);
2951
4018
  delete metaValidators[id];
2952
4019
  };
2953
4020
 
2954
4021
  var core$2 = {
2955
- validate: validate$2, compile: compile$O, interpret: interpret$O,
4022
+ validate: validate$2, compile: compile$N, interpret: interpret$N,
2956
4023
  setMetaOutputFormat, setShouldMetaValidate, FLAG, BASIC, DETAILED, VERBOSE,
2957
4024
  add, getKeyword, hasKeyword, defineVocabulary,
2958
4025
  compileSchema, interpretSchema, collectEvaluatedProperties: collectEvaluatedProperties$e, collectEvaluatedItems: collectEvaluatedItems$f,
2959
4026
  addMediaTypePlugin: MediaTypes.addPlugin
2960
4027
  };
2961
4028
 
2962
- const Schema$Q = schema$5;
2963
-
2964
-
2965
- const compile$N = (schema) => Schema$Q.value(schema);
2966
- const interpret$N = () => true;
2967
-
2968
- var metaData$3 = { compile: compile$N, interpret: interpret$N };
2969
-
2970
- const Pact$9 = lib$2;
4029
+ const Pact$9 = lib$5;
2971
4030
  const PubSub = pubsub.exports;
2972
4031
  const Core$x = core$2;
2973
4032
  const Instance$D = instance;
@@ -2990,7 +4049,7 @@ const compile$M = async (schema, ast) => {
2990
4049
  typeof schemaValue === "boolean" ? schemaValue : await Pact$9.pipeline([
2991
4050
  Schema$P.entries,
2992
4051
  Pact$9.map(([keyword, keywordSchema]) => [`${schema.dialectId}#${keyword}`, keywordSchema]),
2993
- Pact$9.filter(([keywordId]) => Core$x.hasKeyword(keywordId) && keywordId !== `${schema.dialectId}#validate`),
4052
+ Pact$9.filter(([keywordId]) => keywordId !== `${schema.dialectId}#validate`),
2994
4053
  Pact$9.map(async ([keywordId, keywordSchema]) => {
2995
4054
  const keywordAst = await Core$x.getKeyword(keywordId).compile(keywordSchema, ast, schema);
2996
4055
  return [keywordId, Schema$P.uri(keywordSchema), keywordAst];
@@ -3066,7 +4125,7 @@ const collectEvaluatedItems$e = (uri, instance, ast, dynamicAnchors, isTop = fal
3066
4125
 
3067
4126
  var validate$1 = { compile: compile$M, interpret: interpret$M, collectEvaluatedProperties: collectEvaluatedProperties$d, collectEvaluatedItems: collectEvaluatedItems$e };
3068
4127
 
3069
- const metaData$2 = metaData$3;
4128
+ const metaData$2 = metaData$4;
3070
4129
  const validate = validate$1;
3071
4130
 
3072
4131
 
@@ -3080,9 +4139,9 @@ const Keywords$2 = keywords$6;
3080
4139
  const InvalidSchemaError$1 = invalidSchemaError;
3081
4140
 
3082
4141
 
3083
- var lib$1 = { Core: Core$w, Schema: Schema$O, Instance: Instance$C, Reference, Keywords: Keywords$2, InvalidSchemaError: InvalidSchemaError$1 };
4142
+ var lib$2 = { Core: Core$w, Schema: Schema$O, Instance: Instance$C, Reference, Keywords: Keywords$2, InvalidSchemaError: InvalidSchemaError$1 };
3084
4143
 
3085
- const { Core: Core$v, Schema: Schema$N, Instance: Instance$B } = lib$1;
4144
+ const { Core: Core$v, Schema: Schema$N, Instance: Instance$B } = lib$2;
3086
4145
 
3087
4146
 
3088
4147
  const compile$L = async (schema, ast, parentSchema) => {
@@ -3110,7 +4169,7 @@ const interpret$L = ([numberOfItems, additionalItems], instance, ast, dynamicAnc
3110
4169
 
3111
4170
  var additionalItems = { compile: compile$L, interpret: interpret$L };
3112
4171
 
3113
- const { Core: Core$u, Schema: Schema$M, Instance: Instance$A } = lib$1;
4172
+ const { Core: Core$u, Schema: Schema$M, Instance: Instance$A } = lib$2;
3114
4173
 
3115
4174
 
3116
4175
  const compile$K = async (schema, ast, parentSchema) => {
@@ -3134,7 +4193,7 @@ const collectEvaluatedItems$d = (keywordValue, instance, ast, dynamicAnchors) =>
3134
4193
 
3135
4194
  var additionalItems6 = { compile: compile$K, interpret: interpret$K, collectEvaluatedItems: collectEvaluatedItems$d };
3136
4195
 
3137
- const { Core: Core$t, Schema: Schema$L, Instance: Instance$z } = lib$1;
4196
+ const { Core: Core$t, Schema: Schema$L, Instance: Instance$z } = lib$2;
3138
4197
 
3139
4198
 
3140
4199
  const compile$J = async (schema, ast, parentSchema) => {
@@ -3168,7 +4227,7 @@ const interpret$J = ([propertyNames, propertyNamePatterns, additionalProperties]
3168
4227
 
3169
4228
  var additionalProperties = { compile: compile$J, interpret: interpret$J };
3170
4229
 
3171
- const { Core: Core$s, Schema: Schema$K, Instance: Instance$y } = lib$1;
4230
+ const { Core: Core$s, Schema: Schema$K, Instance: Instance$y } = lib$2;
3172
4231
 
3173
4232
 
3174
4233
  const compile$I = async (schema, ast, parentSchema) => {
@@ -3197,8 +4256,129 @@ const collectEvaluatedProperties$c = (keywordValue, instance, ast, dynamicAnchor
3197
4256
 
3198
4257
  var additionalProperties6 = { compile: compile$I, interpret: interpret$I, collectEvaluatedProperties: collectEvaluatedProperties$c };
3199
4258
 
3200
- const { Core: Core$r, Schema: Schema$J } = lib$1;
3201
- const Pact$8 = lib$2;
4259
+ var entries$1 = async (doc) => Object.entries(await doc);
4260
+
4261
+ var justCurryIt = curry$6;
4262
+
4263
+ /*
4264
+ function add(a, b, c) {
4265
+ return a + b + c;
4266
+ }
4267
+ curry(add)(1)(2)(3); // 6
4268
+ curry(add)(1)(2)(2); // 5
4269
+ curry(add)(2)(4, 3); // 9
4270
+
4271
+ function add(...args) {
4272
+ return args.reduce((sum, n) => sum + n, 0)
4273
+ }
4274
+ var curryAdd4 = curry(add, 4)
4275
+ curryAdd4(1)(2, 3)(4); // 10
4276
+
4277
+ function converter(ratio, input) {
4278
+ return (input*ratio).toFixed(1);
4279
+ }
4280
+ const curriedConverter = curry(converter)
4281
+ const milesToKm = curriedConverter(1.62);
4282
+ milesToKm(35); // 56.7
4283
+ milesToKm(10); // 16.2
4284
+ */
4285
+
4286
+ function curry$6(fn, arity) {
4287
+ return function curried() {
4288
+ if (arity == null) {
4289
+ arity = fn.length;
4290
+ }
4291
+ var args = [].slice.call(arguments);
4292
+ if (args.length >= arity) {
4293
+ return fn.apply(this, args);
4294
+ } else {
4295
+ return function() {
4296
+ return curried.apply(this, args.concat([].slice.call(arguments)));
4297
+ };
4298
+ }
4299
+ };
4300
+ }
4301
+
4302
+ const curry$5 = justCurryIt;
4303
+
4304
+
4305
+ var map$2 = curry$5(async (fn, doc) => (await doc).map(fn));
4306
+
4307
+ const curry$4 = justCurryIt;
4308
+
4309
+
4310
+ var reduce$2 = curry$4(async (fn, acc, doc) => {
4311
+ return (await doc).reduce(async (acc, item) => fn(await acc, item), acc);
4312
+ });
4313
+
4314
+ const curry$3 = justCurryIt;
4315
+ const reduce$1 = reduce$2;
4316
+
4317
+
4318
+ var filter = curry$3(async (fn, doc, options = {}) => {
4319
+ return reduce$1(async (acc, item) => {
4320
+ return (await fn(item)) ? acc.concat([item]) : acc;
4321
+ }, [], doc, options);
4322
+ });
4323
+
4324
+ const curry$2 = justCurryIt;
4325
+ const map$1 = map$2;
4326
+
4327
+
4328
+ var some = curry$2(async (fn, doc) => {
4329
+ const results = await map$1(fn, doc);
4330
+ return (await Promise.all(results))
4331
+ .some((a) => a);
4332
+ });
4333
+
4334
+ const curry$1 = justCurryIt;
4335
+ const map = map$2;
4336
+
4337
+
4338
+ var every = curry$1(async (fn, doc) => {
4339
+ const results = await map(fn, doc);
4340
+ return (await Promise.all(results))
4341
+ .every((a) => a);
4342
+ });
4343
+
4344
+ const curry = justCurryIt;
4345
+
4346
+
4347
+ var pipeline$1 = curry((fns, doc) => {
4348
+ return fns.reduce(async (acc, fn) => fn(await acc), doc);
4349
+ });
4350
+
4351
+ var all = (doc) => Promise.all(doc);
4352
+
4353
+ const pipeline = pipeline$1;
4354
+ const entries = entries$1;
4355
+ const reduce = reduce$2;
4356
+
4357
+
4358
+ var allValues = (doc) => {
4359
+ return pipeline([
4360
+ entries,
4361
+ reduce(async (acc, [propertyName, propertyValue]) => {
4362
+ acc[propertyName] = await propertyValue;
4363
+ return acc;
4364
+ }, {})
4365
+ ], doc);
4366
+ };
4367
+
4368
+ var lib$1 = {
4369
+ entries: entries$1,
4370
+ map: map$2,
4371
+ filter: filter,
4372
+ reduce: reduce$2,
4373
+ some: some,
4374
+ every: every,
4375
+ pipeline: pipeline$1,
4376
+ all: all,
4377
+ allValues: allValues
4378
+ };
4379
+
4380
+ const { Core: Core$r, Schema: Schema$J } = lib$2;
4381
+ const Pact$8 = lib$1;
3202
4382
 
3203
4383
 
3204
4384
  const compile$H = (schema, ast) => Pact$8.pipeline([
@@ -3226,8 +4406,8 @@ const collectEvaluatedItems$c = (allOf, instance, ast, dynamicAnchors) => {
3226
4406
 
3227
4407
  var allOf = { compile: compile$H, interpret: interpret$H, collectEvaluatedProperties: collectEvaluatedProperties$b, collectEvaluatedItems: collectEvaluatedItems$c };
3228
4408
 
3229
- const { Core: Core$q, Schema: Schema$I } = lib$1;
3230
- const Pact$7 = lib$2;
4409
+ const { Core: Core$q, Schema: Schema$I } = lib$2;
4410
+ const Pact$7 = lib$1;
3231
4411
 
3232
4412
 
3233
4413
  const compile$G = (schema, ast) => Pact$7.pipeline([
@@ -3315,7 +4495,7 @@ function stringify(val, allowUndefined) {
3315
4495
 
3316
4496
  var fastestStableStringify = function(obj) { return '' + stringify(obj, false); };
3317
4497
 
3318
- const { Schema: Schema$H, Instance: Instance$x } = lib$1;
4498
+ const { Schema: Schema$H, Instance: Instance$x } = lib$2;
3319
4499
  const jsonStringify$2 = fastestStableStringify;
3320
4500
 
3321
4501
 
@@ -3324,7 +4504,7 @@ const interpret$F = (const_, instance) => jsonStringify$2(Instance$x.value(insta
3324
4504
 
3325
4505
  var _const = { compile: compile$F, interpret: interpret$F };
3326
4506
 
3327
- const { Core: Core$p, Instance: Instance$w } = lib$1;
4507
+ const { Core: Core$p, Instance: Instance$w } = lib$2;
3328
4508
 
3329
4509
 
3330
4510
  const compile$E = (schema, ast) => Core$p.compileSchema(schema, ast);
@@ -3335,7 +4515,7 @@ const interpret$E = (contains, instance, ast, dynamicAnchors) => {
3335
4515
 
3336
4516
  var contains = { compile: compile$E, interpret: interpret$E };
3337
4517
 
3338
- const { Core: Core$o, Schema: Schema$G, Instance: Instance$v } = lib$1;
4518
+ const { Core: Core$o, Schema: Schema$G, Instance: Instance$v } = lib$2;
3339
4519
 
3340
4520
 
3341
4521
  const compile$D = async (schema, ast, parentSchema) => {
@@ -3369,8 +4549,8 @@ const collectEvaluatedItems$a = (keywordValue, instance, ast, dynamicAnchors) =>
3369
4549
 
3370
4550
  var containsMinContainsMaxContains = { compile: compile$D, interpret: interpret$D, collectEvaluatedItems: collectEvaluatedItems$a };
3371
4551
 
3372
- const { Core: Core$n, Schema: Schema$F } = lib$1;
3373
- const Pact$6 = lib$2;
4552
+ const { Core: Core$n, Schema: Schema$F } = lib$2;
4553
+ const Pact$6 = lib$1;
3374
4554
 
3375
4555
 
3376
4556
  const compile$C = async (schema, ast) => {
@@ -3385,8 +4565,8 @@ const interpret$C = () => true;
3385
4565
 
3386
4566
  var definitions = { compile: compile$C, interpret: interpret$C };
3387
4567
 
3388
- const { Core: Core$m, Schema: Schema$E, Instance: Instance$u } = lib$1;
3389
- const Pact$5 = lib$2;
4568
+ const { Core: Core$m, Schema: Schema$E, Instance: Instance$u } = lib$2;
4569
+ const Pact$5 = lib$1;
3390
4570
 
3391
4571
 
3392
4572
  const compile$B = (schema, ast) => Pact$5.pipeline([
@@ -3415,8 +4595,8 @@ const interpret$B = (dependencies, instance, ast, dynamicAnchors) => {
3415
4595
 
3416
4596
  var dependencies = { compile: compile$B, interpret: interpret$B };
3417
4597
 
3418
- const { Schema: Schema$D, Instance: Instance$t } = lib$1;
3419
- const Pact$4 = lib$2;
4598
+ const { Schema: Schema$D, Instance: Instance$t } = lib$2;
4599
+ const Pact$4 = lib$1;
3420
4600
 
3421
4601
 
3422
4602
  const compile$A = (schema) => Pact$4.pipeline([
@@ -3435,8 +4615,8 @@ const interpret$A = (dependentRequired, instance) => {
3435
4615
 
3436
4616
  var dependentRequired = { compile: compile$A, interpret: interpret$A };
3437
4617
 
3438
- const { Core: Core$l, Schema: Schema$C, Instance: Instance$s } = lib$1;
3439
- const Pact$3 = lib$2;
4618
+ const { Core: Core$l, Schema: Schema$C, Instance: Instance$s } = lib$2;
4619
+ const Pact$3 = lib$1;
3440
4620
 
3441
4621
 
3442
4622
  const compile$z = (schema, ast) => Pact$3.pipeline([
@@ -3466,7 +4646,7 @@ const collectEvaluatedProperties$9 = (dependentSchemas, instance, ast, dynamicAn
3466
4646
 
3467
4647
  var dependentSchemas = { compile: compile$z, interpret: interpret$z, collectEvaluatedProperties: collectEvaluatedProperties$9 };
3468
4648
 
3469
- const { Schema: Schema$B, Instance: Instance$r } = lib$1;
4649
+ const { Schema: Schema$B, Instance: Instance$r } = lib$2;
3470
4650
  const jsonStringify$1 = fastestStableStringify;
3471
4651
 
3472
4652
 
@@ -3475,7 +4655,7 @@ const interpret$y = (enum_, instance) => enum_.some((enumValue) => jsonStringify
3475
4655
 
3476
4656
  var _enum = { compile: compile$y, interpret: interpret$y };
3477
4657
 
3478
- const { Schema: Schema$A, Instance: Instance$q } = lib$1;
4658
+ const { Schema: Schema$A, Instance: Instance$q } = lib$2;
3479
4659
 
3480
4660
 
3481
4661
  const compile$x = async (schema) => Schema$A.value(schema);
@@ -3483,7 +4663,7 @@ const interpret$x = (exclusiveMaximum, instance) => !Instance$q.typeOf(instance,
3483
4663
 
3484
4664
  var exclusiveMaximum = { compile: compile$x, interpret: interpret$x };
3485
4665
 
3486
- const { Schema: Schema$z, Instance: Instance$p } = lib$1;
4666
+ const { Schema: Schema$z, Instance: Instance$p } = lib$2;
3487
4667
 
3488
4668
 
3489
4669
  const compile$w = async (schema) => Schema$z.value(schema);
@@ -3491,7 +4671,7 @@ const interpret$w = (exclusiveMinimum, instance) => !Instance$p.typeOf(instance,
3491
4671
 
3492
4672
  var exclusiveMinimum = { compile: compile$w, interpret: interpret$w };
3493
4673
 
3494
- const { Core: Core$k } = lib$1;
4674
+ const { Core: Core$k } = lib$2;
3495
4675
 
3496
4676
 
3497
4677
  const compile$v = (schema, ast) => Core$k.compileSchema(schema, ast);
@@ -3511,7 +4691,7 @@ const collectEvaluatedItems$9 = (ifSchema, instance, ast, dynamicAnchors) => {
3511
4691
 
3512
4692
  var _if = { compile: compile$v, interpret: interpret$v, collectEvaluatedProperties: collectEvaluatedProperties$8, collectEvaluatedItems: collectEvaluatedItems$9 };
3513
4693
 
3514
- const { Core: Core$j, Schema: Schema$y } = lib$1;
4694
+ const { Core: Core$j, Schema: Schema$y } = lib$2;
3515
4695
 
3516
4696
 
3517
4697
  const compile$u = async (schema, ast, parentSchema) => {
@@ -3555,7 +4735,7 @@ const collectEvaluatedItems$8 = ([guard, block], instance, ast, dynamicAnchors)
3555
4735
 
3556
4736
  var then = { compile: compile$u, interpret: interpret$u, collectEvaluatedProperties: collectEvaluatedProperties$7, collectEvaluatedItems: collectEvaluatedItems$8 };
3557
4737
 
3558
- const { Core: Core$i, Schema: Schema$x } = lib$1;
4738
+ const { Core: Core$i, Schema: Schema$x } = lib$2;
3559
4739
 
3560
4740
 
3561
4741
  const compile$t = async (schema, ast, parentSchema) => {
@@ -3599,7 +4779,7 @@ const collectEvaluatedItems$7 = ([guard, block], instance, ast, dynamicAnchors)
3599
4779
 
3600
4780
  var _else = { compile: compile$t, interpret: interpret$t, collectEvaluatedProperties: collectEvaluatedProperties$6, collectEvaluatedItems: collectEvaluatedItems$7 };
3601
4781
 
3602
- const { Core: Core$h, Schema: Schema$w, Instance: Instance$o } = lib$1;
4782
+ const { Core: Core$h, Schema: Schema$w, Instance: Instance$o } = lib$2;
3603
4783
 
3604
4784
 
3605
4785
  const compile$s = async (schema, ast) => {
@@ -3631,7 +4811,7 @@ const collectEvaluatedItems$6 = (items, instance, ast, dynamicAnchors) => {
3631
4811
 
3632
4812
  var items = { compile: compile$s, interpret: interpret$s, collectEvaluatedItems: collectEvaluatedItems$6 };
3633
4813
 
3634
- const { Core: Core$g, Schema: Schema$v, Instance: Instance$n } = lib$1;
4814
+ const { Core: Core$g, Schema: Schema$v, Instance: Instance$n } = lib$2;
3635
4815
 
3636
4816
 
3637
4817
  const compile$r = async (schema, ast, parentSchema) => {
@@ -3655,7 +4835,7 @@ const collectEvaluatedItems$5 = (keywordValue, instance, ast, dynamicAnchors) =>
3655
4835
 
3656
4836
  var items202012 = { compile: compile$r, interpret: interpret$r, collectEvaluatedItems: collectEvaluatedItems$5 };
3657
4837
 
3658
- const { Schema: Schema$u, Instance: Instance$m } = lib$1;
4838
+ const { Schema: Schema$u, Instance: Instance$m } = lib$2;
3659
4839
 
3660
4840
 
3661
4841
  const compile$q = (schema) => Schema$u.value(schema);
@@ -3663,7 +4843,7 @@ const interpret$q = (maxItems, instance) => !Instance$m.typeOf(instance, "array"
3663
4843
 
3664
4844
  var maxItems = { compile: compile$q, interpret: interpret$q };
3665
4845
 
3666
- const { Schema: Schema$t, Instance: Instance$l } = lib$1;
4846
+ const { Schema: Schema$t, Instance: Instance$l } = lib$2;
3667
4847
 
3668
4848
 
3669
4849
  const compile$p = (schema) => Schema$t.value(schema);
@@ -3671,7 +4851,7 @@ const interpret$p = (maxLength, instance) => !Instance$l.typeOf(instance, "strin
3671
4851
 
3672
4852
  var maxLength = { compile: compile$p, interpret: interpret$p };
3673
4853
 
3674
- const { Schema: Schema$s, Instance: Instance$k } = lib$1;
4854
+ const { Schema: Schema$s, Instance: Instance$k } = lib$2;
3675
4855
 
3676
4856
 
3677
4857
  const compile$o = (schema) => Schema$s.value(schema);
@@ -3679,7 +4859,7 @@ const interpret$o = (maxLength, instance) => !Instance$k.typeOf(instance, "strin
3679
4859
 
3680
4860
  var maxLength6 = { compile: compile$o, interpret: interpret$o };
3681
4861
 
3682
- const { Schema: Schema$r, Instance: Instance$j } = lib$1;
4862
+ const { Schema: Schema$r, Instance: Instance$j } = lib$2;
3683
4863
 
3684
4864
 
3685
4865
  const compile$n = (schema) => Schema$r.value(schema);
@@ -3687,7 +4867,7 @@ const interpret$n = (maxProperties, instance) => !Instance$j.typeOf(instance, "o
3687
4867
 
3688
4868
  var maxProperties = { compile: compile$n, interpret: interpret$n };
3689
4869
 
3690
- const { Schema: Schema$q, Instance: Instance$i } = lib$1;
4870
+ const { Schema: Schema$q, Instance: Instance$i } = lib$2;
3691
4871
 
3692
4872
 
3693
4873
  const compile$m = async (schema, ast, parentSchema) => {
@@ -3708,7 +4888,7 @@ const interpret$m = ([maximum, isExclusive], instance) => {
3708
4888
 
3709
4889
  var maximumExclusiveMaximum = { compile: compile$m, interpret: interpret$m };
3710
4890
 
3711
- const { Schema: Schema$p, Instance: Instance$h } = lib$1;
4891
+ const { Schema: Schema$p, Instance: Instance$h } = lib$2;
3712
4892
 
3713
4893
 
3714
4894
  const compile$l = async (schema) => Schema$p.value(schema);
@@ -3716,7 +4896,7 @@ const interpret$l = (maximum, instance) => !Instance$h.typeOf(instance, "number"
3716
4896
 
3717
4897
  var maximum = { compile: compile$l, interpret: interpret$l };
3718
4898
 
3719
- const { Schema: Schema$o, Instance: Instance$g } = lib$1;
4899
+ const { Schema: Schema$o, Instance: Instance$g } = lib$2;
3720
4900
 
3721
4901
 
3722
4902
  const compile$k = (schema) => Schema$o.value(schema);
@@ -3724,7 +4904,7 @@ const interpret$k = (minItems, instance) => !Instance$g.typeOf(instance, "array"
3724
4904
 
3725
4905
  var minItems = { compile: compile$k, interpret: interpret$k };
3726
4906
 
3727
- const { Schema: Schema$n, Instance: Instance$f } = lib$1;
4907
+ const { Schema: Schema$n, Instance: Instance$f } = lib$2;
3728
4908
 
3729
4909
 
3730
4910
  const compile$j = (schema) => Schema$n.value(schema);
@@ -3732,7 +4912,7 @@ const interpret$j = (minLength, instance) => !Instance$f.typeOf(instance, "strin
3732
4912
 
3733
4913
  var minLength = { compile: compile$j, interpret: interpret$j };
3734
4914
 
3735
- const { Schema: Schema$m, Instance: Instance$e } = lib$1;
4915
+ const { Schema: Schema$m, Instance: Instance$e } = lib$2;
3736
4916
 
3737
4917
 
3738
4918
  const compile$i = (schema) => Schema$m.value(schema);
@@ -3740,7 +4920,7 @@ const interpret$i = (minLength, instance) => !Instance$e.typeOf(instance, "strin
3740
4920
 
3741
4921
  var minLength6 = { compile: compile$i, interpret: interpret$i };
3742
4922
 
3743
- const { Schema: Schema$l, Instance: Instance$d } = lib$1;
4923
+ const { Schema: Schema$l, Instance: Instance$d } = lib$2;
3744
4924
 
3745
4925
 
3746
4926
  const compile$h = (schema) => Schema$l.value(schema);
@@ -3748,7 +4928,7 @@ const interpret$h = (minProperties, instance) => !Instance$d.typeOf(instance, "o
3748
4928
 
3749
4929
  var minProperties = { compile: compile$h, interpret: interpret$h };
3750
4930
 
3751
- const { Schema: Schema$k, Instance: Instance$c } = lib$1;
4931
+ const { Schema: Schema$k, Instance: Instance$c } = lib$2;
3752
4932
 
3753
4933
 
3754
4934
  const compile$g = async (schema, ast, parentSchema) => {
@@ -3769,7 +4949,7 @@ const interpret$g = ([minimum, isExclusive], instance) => {
3769
4949
 
3770
4950
  var minimumExclusiveMinimum = { compile: compile$g, interpret: interpret$g };
3771
4951
 
3772
- const { Schema: Schema$j, Instance: Instance$b } = lib$1;
4952
+ const { Schema: Schema$j, Instance: Instance$b } = lib$2;
3773
4953
 
3774
4954
 
3775
4955
  const compile$f = async (schema) => Schema$j.value(schema);
@@ -3777,7 +4957,7 @@ const interpret$f = (minimum, instance) => !Instance$b.typeOf(instance, "number"
3777
4957
 
3778
4958
  var minimum = { compile: compile$f, interpret: interpret$f };
3779
4959
 
3780
- const { Schema: Schema$i, Instance: Instance$a } = lib$1;
4960
+ const { Schema: Schema$i, Instance: Instance$a } = lib$2;
3781
4961
 
3782
4962
 
3783
4963
  const compile$e = (schema) => Schema$i.value(schema);
@@ -3795,7 +4975,7 @@ const numberEqual = (a, b) => Math.abs(a - b) < 1.19209290e-7;
3795
4975
 
3796
4976
  var multipleOf = { compile: compile$e, interpret: interpret$e };
3797
4977
 
3798
- const { Core: Core$f } = lib$1;
4978
+ const { Core: Core$f } = lib$2;
3799
4979
 
3800
4980
 
3801
4981
  const compile$d = Core$f.compileSchema;
@@ -3803,7 +4983,7 @@ const interpret$d = (not, instance, ast, dynamicAnchors) => !Core$f.interpretSch
3803
4983
 
3804
4984
  var not = { compile: compile$d, interpret: interpret$d };
3805
4985
 
3806
- const { Core: Core$e, Schema: Schema$h } = lib$1;
4986
+ const { Core: Core$e, Schema: Schema$h } = lib$2;
3807
4987
 
3808
4988
 
3809
4989
  const compile$c = async (schema, ast) => {
@@ -3852,7 +5032,7 @@ const collectEvaluatedItems$4 = (oneOf, instance, ast, dynamicAnchors) => {
3852
5032
 
3853
5033
  var oneOf = { compile: compile$c, interpret: interpret$c, collectEvaluatedProperties: collectEvaluatedProperties$5, collectEvaluatedItems: collectEvaluatedItems$4 };
3854
5034
 
3855
- const { Schema: Schema$g, Instance: Instance$9 } = lib$1;
5035
+ const { Schema: Schema$g, Instance: Instance$9 } = lib$2;
3856
5036
 
3857
5037
 
3858
5038
  const compile$b = (schema) => new RegExp(Schema$g.value(schema), "u");
@@ -3860,8 +5040,8 @@ const interpret$b = (pattern, instance) => !Instance$9.typeOf(instance, "string"
3860
5040
 
3861
5041
  var pattern = { compile: compile$b, interpret: interpret$b };
3862
5042
 
3863
- const { Core: Core$d, Schema: Schema$f, Instance: Instance$8 } = lib$1;
3864
- const Pact$2 = lib$2;
5043
+ const { Core: Core$d, Schema: Schema$f, Instance: Instance$8 } = lib$2;
5044
+ const Pact$2 = lib$1;
3865
5045
 
3866
5046
 
3867
5047
  const compile$a = (schema, ast) => Pact$2.pipeline([
@@ -3898,8 +5078,8 @@ const splitUrl$1 = (url) => {
3898
5078
 
3899
5079
  var common = { isObject, escapeRegExp: escapeRegExp$1, splitUrl: splitUrl$1 };
3900
5080
 
3901
- const { Core: Core$c, Schema: Schema$e, Instance: Instance$7 } = lib$1;
3902
- const Pact$1 = lib$2;
5081
+ const { Core: Core$c, Schema: Schema$e, Instance: Instance$7 } = lib$2;
5082
+ const Pact$1 = lib$1;
3903
5083
  const { escapeRegExp } = common;
3904
5084
 
3905
5085
 
@@ -3924,7 +5104,7 @@ const collectEvaluatedProperties$3 = (properties, instance, ast, dynamicAnchors)
3924
5104
 
3925
5105
  var properties = { compile: compile$9, interpret: interpret$9, collectEvaluatedProperties: collectEvaluatedProperties$3 };
3926
5106
 
3927
- const { Core: Core$b, Instance: Instance$6 } = lib$1;
5107
+ const { Core: Core$b, Instance: Instance$6 } = lib$2;
3928
5108
 
3929
5109
 
3930
5110
  const compile$8 = (schema, ast) => Core$b.compileSchema(schema, ast);
@@ -3936,7 +5116,7 @@ const interpret$8 = (propertyNames, instance, ast, dynamicAnchors) => {
3936
5116
 
3937
5117
  var propertyNames = { compile: compile$8, interpret: interpret$8 };
3938
5118
 
3939
- const { Core: Core$a, Schema: Schema$d } = lib$1;
5119
+ const { Core: Core$a, Schema: Schema$d } = lib$2;
3940
5120
  const { splitUrl } = common;
3941
5121
 
3942
5122
 
@@ -3961,7 +5141,7 @@ const collectEvaluatedItems$3 = Core$a.collectEvaluatedItems;
3961
5141
 
3962
5142
  var dynamicRef = { compile: compile$7, interpret: interpret$7, collectEvaluatedProperties: collectEvaluatedProperties$2, collectEvaluatedItems: collectEvaluatedItems$3 };
3963
5143
 
3964
- const { Core: Core$9, Schema: Schema$c } = lib$1;
5144
+ const { Core: Core$9, Schema: Schema$c } = lib$2;
3965
5145
 
3966
5146
 
3967
5147
  const compile$6 = async (ref, ast) => {
@@ -3975,7 +5155,7 @@ const collectEvaluatedItems$2 = Core$9.collectEvaluatedItems;
3975
5155
 
3976
5156
  var ref = { compile: compile$6, interpret: interpret$6, collectEvaluatedProperties: collectEvaluatedProperties$1, collectEvaluatedItems: collectEvaluatedItems$2 };
3977
5157
 
3978
- const { Schema: Schema$b, Instance: Instance$5 } = lib$1;
5158
+ const { Schema: Schema$b, Instance: Instance$5 } = lib$2;
3979
5159
 
3980
5160
 
3981
5161
  const compile$5 = (schema) => Schema$b.value(schema);
@@ -3986,8 +5166,8 @@ const interpret$5 = (required, instance) => {
3986
5166
 
3987
5167
  var required = { compile: compile$5, interpret: interpret$5 };
3988
5168
 
3989
- const { Core: Core$8, Schema: Schema$a, Instance: Instance$4 } = lib$1;
3990
- const Pact = lib$2;
5169
+ const { Core: Core$8, Schema: Schema$a, Instance: Instance$4 } = lib$2;
5170
+ const Pact = lib$1;
3991
5171
 
3992
5172
 
3993
5173
  const compile$4 = (schema, ast) => {
@@ -4011,7 +5191,7 @@ const collectEvaluatedItems$1 = (items, instance, ast, dynamicAnchors) => {
4011
5191
 
4012
5192
  var tupleItems = { compile: compile$4, interpret: interpret$4, collectEvaluatedItems: collectEvaluatedItems$1 };
4013
5193
 
4014
- const { Schema: Schema$9, Instance: Instance$3 } = lib$1;
5194
+ const { Schema: Schema$9, Instance: Instance$3 } = lib$2;
4015
5195
 
4016
5196
 
4017
5197
  const compile$3 = (schema) => Schema$9.value(schema);
@@ -4019,7 +5199,7 @@ const interpret$3 = (type, instance) => typeof type === "string" ? Instance$3.ty
4019
5199
 
4020
5200
  var type = { compile: compile$3, interpret: interpret$3 };
4021
5201
 
4022
- const { Core: Core$7, Schema: Schema$8, Instance: Instance$2 } = lib$1;
5202
+ const { Core: Core$7, Schema: Schema$8, Instance: Instance$2 } = lib$2;
4023
5203
 
4024
5204
 
4025
5205
  const compile$2 = async (schema, ast, parentSchema) => {
@@ -4043,7 +5223,7 @@ const collectEvaluatedItems = (keywordValue, instance, ast, dynamicAnchors) => {
4043
5223
 
4044
5224
  var unevaluatedItems = { compile: compile$2, interpret: interpret$2, collectEvaluatedItems };
4045
5225
 
4046
- const { Core: Core$6, Schema: Schema$7, Instance: Instance$1 } = lib$1;
5226
+ const { Core: Core$6, Schema: Schema$7, Instance: Instance$1 } = lib$2;
4047
5227
 
4048
5228
 
4049
5229
  const compile$1 = async (schema, ast, parentSchema) => {
@@ -4068,7 +5248,7 @@ const collectEvaluatedProperties = (keywordValue, instance, ast, dynamicAnchors)
4068
5248
 
4069
5249
  var unevaluatedProperties = { compile: compile$1, interpret: interpret$1, collectEvaluatedProperties };
4070
5250
 
4071
- const { Schema: Schema$6, Instance } = lib$1;
5251
+ const { Schema: Schema$6, Instance } = lib$2;
4072
5252
  const jsonStringify = fastestStableStringify;
4073
5253
 
4074
5254
 
@@ -4085,7 +5265,7 @@ const interpret = (uniqueItems, instance) => {
4085
5265
 
4086
5266
  var uniqueItems = { compile, interpret };
4087
5267
 
4088
- const { Keywords: Keywords$1 } = lib$1;
5268
+ const { Keywords: Keywords$1 } = lib$2;
4089
5269
 
4090
5270
 
4091
5271
  var keywords$5 = {
@@ -4291,7 +5471,7 @@ var schema$4 = `{
4291
5471
  "default": {}
4292
5472
  }`;
4293
5473
 
4294
- const { Core: Core$5, Schema: Schema$5 } = lib$1;
5474
+ const { Core: Core$5, Schema: Schema$5 } = lib$2;
4295
5475
  const keywords$4 = keywords$5;
4296
5476
  const metaSchema$4 = schema$4;
4297
5477
 
@@ -4493,7 +5673,7 @@ var schema$3 = `{
4493
5673
  "default": {}
4494
5674
  }`;
4495
5675
 
4496
- const { Core: Core$4, Schema: Schema$4 } = lib$1;
5676
+ const { Core: Core$4, Schema: Schema$4 } = lib$2;
4497
5677
  const keywords$3 = keywords$5;
4498
5678
  const metaSchema$3 = schema$3;
4499
5679
 
@@ -4718,7 +5898,7 @@ var schema$2 = `{
4718
5898
  "default": true
4719
5899
  }`;
4720
5900
 
4721
- const { Core: Core$3, Schema: Schema$3 } = lib$1;
5901
+ const { Core: Core$3, Schema: Schema$3 } = lib$2;
4722
5902
  const keywords$2 = keywords$5;
4723
5903
  const metaSchema$2 = schema$2;
4724
5904
 
@@ -5101,7 +6281,7 @@ var content$1 = `{
5101
6281
  }
5102
6282
  }`;
5103
6283
 
5104
- const { Core: Core$2, Schema: Schema$2 } = lib$1;
6284
+ const { Core: Core$2, Schema: Schema$2 } = lib$2;
5105
6285
  const keywords$1 = keywords$5;
5106
6286
  const metaSchema$1 = schema$1;
5107
6287
  const coreMetaSchema$1 = core$1;
@@ -5548,7 +6728,7 @@ var unevaluated = `{
5548
6728
  }
5549
6729
  }`;
5550
6730
 
5551
- const { Core: Core$1, Schema: Schema$1 } = lib$1;
6731
+ const { Core: Core$1, Schema: Schema$1 } = lib$2;
5552
6732
  const keywords = keywords$5;
5553
6733
  const metaSchema = schema;
5554
6734
  const coreMetaSchema = core;
@@ -5652,7 +6832,7 @@ Core$1.defineVocabulary("https://json-schema.org/draft/2020-12/vocab/unevaluated
5652
6832
  "unevaluatedProperties": keywords.unevaluatedProperties
5653
6833
  });
5654
6834
 
5655
- const { Core, Schema, InvalidSchemaError } = lib$1;
6835
+ const { Core, Schema, InvalidSchemaError } = lib$2;
5656
6836
  const Keywords = keywords$5;
5657
6837
 
5658
6838