@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.
@@ -6,7 +6,7 @@
6
6
 
7
7
  var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
8
8
 
9
- var justCurryIt = curry$a;
9
+ var justCurryIt$2 = curry$j;
10
10
 
11
11
  /*
12
12
  function add(a, b, c) {
@@ -31,7 +31,7 @@
31
31
  milesToKm(10); // 16.2
32
32
  */
33
33
 
34
- function curry$a(fn, arity) {
34
+ function curry$j(fn, arity) {
35
35
  return function curried() {
36
36
  if (arity == null) {
37
37
  arity = fn.length;
@@ -1902,84 +1902,84 @@
1902
1902
 
1903
1903
  var common$1 = { jsonTypeOf: jsonTypeOf$2, resolveUrl: resolveUrl$3, urlFragment: urlFragment$1, pathRelative: pathRelative$1 };
1904
1904
 
1905
- const curry$9 = justCurryIt;
1905
+ const curry$i = justCurryIt$2;
1906
1906
 
1907
1907
 
1908
- const nil$2 = "";
1908
+ const nil$3 = "";
1909
1909
 
1910
- const compile$P = (pointer) => {
1910
+ const compile$Q = (pointer) => {
1911
1911
  if (pointer.length > 0 && pointer[0] !== "/") {
1912
1912
  throw Error("Invalid JSON Pointer");
1913
1913
  }
1914
1914
 
1915
- return pointer.split("/").slice(1).map(unescape);
1915
+ return pointer.split("/").slice(1).map(unescape$1);
1916
1916
  };
1917
1917
 
1918
- const get$1 = (pointer, value = undefined) => {
1919
- const ptr = compile$P(pointer);
1918
+ const get$3 = (pointer, value = undefined) => {
1919
+ const ptr = compile$Q(pointer);
1920
1920
 
1921
1921
  const fn = (value) => ptr.reduce(([value, pointer], segment) => {
1922
- return [applySegment(value, segment, pointer), append(segment, pointer)];
1922
+ return [applySegment$1(value, segment, pointer), append$1(segment, pointer)];
1923
1923
  }, [value, ""])[0];
1924
1924
 
1925
1925
  return value === undefined ? fn : fn(value);
1926
1926
  };
1927
1927
 
1928
- const set = (pointer, subject = undefined, value = undefined) => {
1929
- const ptr = compile$P(pointer);
1930
- const fn = curry$9((subject, value) => _set(ptr, subject, value, nil$2));
1928
+ const set$1 = (pointer, subject = undefined, value = undefined) => {
1929
+ const ptr = compile$Q(pointer);
1930
+ const fn = curry$i((subject, value) => _set$1(ptr, subject, value, nil$3));
1931
1931
  return subject === undefined ? fn : fn(subject, value);
1932
1932
  };
1933
1933
 
1934
- const _set = (pointer, subject, value, cursor) => {
1934
+ const _set$1 = (pointer, subject, value, cursor) => {
1935
1935
  if (pointer.length === 0) {
1936
1936
  return value;
1937
1937
  } else if (pointer.length > 1) {
1938
1938
  const segment = pointer.shift();
1939
- return { ...subject, [segment]: _set(pointer, applySegment(subject, segment, cursor), value, append(segment, cursor)) };
1939
+ return { ...subject, [segment]: _set$1(pointer, applySegment$1(subject, segment, cursor), value, append$1(segment, cursor)) };
1940
1940
  } else if (Array.isArray(subject)) {
1941
1941
  const clonedSubject = [...subject];
1942
- const segment = computeSegment(subject, pointer[0]);
1942
+ const segment = computeSegment$1(subject, pointer[0]);
1943
1943
  clonedSubject[segment] = value;
1944
1944
  return clonedSubject;
1945
1945
  } else if (typeof subject === "object" && subject !== null) {
1946
1946
  return { ...subject, [pointer[0]]: value };
1947
1947
  } else {
1948
- return applySegment(subject, pointer[0], cursor);
1948
+ return applySegment$1(subject, pointer[0], cursor);
1949
1949
  }
1950
1950
  };
1951
1951
 
1952
- const assign = (pointer, subject = undefined, value = undefined) => {
1953
- const ptr = compile$P(pointer);
1954
- const fn = curry$9((subject, value) => _assign(ptr, subject, value, nil$2));
1952
+ const assign$1 = (pointer, subject = undefined, value = undefined) => {
1953
+ const ptr = compile$Q(pointer);
1954
+ const fn = curry$i((subject, value) => _assign$1(ptr, subject, value, nil$3));
1955
1955
  return subject === undefined ? fn : fn(subject, value);
1956
1956
  };
1957
1957
 
1958
- const _assign = (pointer, subject, value, cursor) => {
1958
+ const _assign$1 = (pointer, subject, value, cursor) => {
1959
1959
  if (pointer.length === 0) {
1960
1960
  return;
1961
- } else if (pointer.length === 1 && !isScalar(subject)) {
1962
- const segment = computeSegment(subject, pointer[0]);
1961
+ } else if (pointer.length === 1 && !isScalar$1(subject)) {
1962
+ const segment = computeSegment$1(subject, pointer[0]);
1963
1963
  subject[segment] = value;
1964
1964
  } else {
1965
1965
  const segment = pointer.shift();
1966
- _assign(pointer, applySegment(subject, segment, cursor), value, append(segment, cursor));
1966
+ _assign$1(pointer, applySegment$1(subject, segment, cursor), value, append$1(segment, cursor));
1967
1967
  }
1968
1968
  };
1969
1969
 
1970
- const unset = (pointer, subject = undefined) => {
1971
- const ptr = compile$P(pointer);
1972
- const fn = (subject) => _unset(ptr, subject, nil$2);
1970
+ const unset$1 = (pointer, subject = undefined) => {
1971
+ const ptr = compile$Q(pointer);
1972
+ const fn = (subject) => _unset$1(ptr, subject, nil$3);
1973
1973
  return subject === undefined ? fn : fn(subject);
1974
1974
  };
1975
1975
 
1976
- const _unset = (pointer, subject, cursor) => {
1976
+ const _unset$1 = (pointer, subject, cursor) => {
1977
1977
  if (pointer.length == 0) {
1978
1978
  return undefined;
1979
1979
  } else if (pointer.length > 1) {
1980
1980
  const segment = pointer.shift();
1981
- const value = applySegment(subject, segment, cursor);
1982
- return { ...subject, [segment]: _unset(pointer, value, append(segment, cursor)) };
1981
+ const value = applySegment$1(subject, segment, cursor);
1982
+ return { ...subject, [segment]: _unset$1(pointer, value, append$1(segment, cursor)) };
1983
1983
  } else if (Array.isArray(subject)) {
1984
1984
  return subject.filter((_, ndx) => ndx != pointer[0]);
1985
1985
  } else if (typeof subject === "object" && subject !== null) {
@@ -1987,54 +1987,54 @@
1987
1987
  const { [pointer[0]]: _, ...result } = subject;
1988
1988
  return result;
1989
1989
  } else {
1990
- return applySegment(subject, pointer[0], cursor);
1990
+ return applySegment$1(subject, pointer[0], cursor);
1991
1991
  }
1992
1992
  };
1993
1993
 
1994
- const remove = (pointer, subject = undefined) => {
1995
- const ptr = compile$P(pointer);
1996
- const fn = (subject) => _remove(ptr, subject, nil$2);
1994
+ const remove$1 = (pointer, subject = undefined) => {
1995
+ const ptr = compile$Q(pointer);
1996
+ const fn = (subject) => _remove$1(ptr, subject, nil$3);
1997
1997
  return subject === undefined ? fn : fn(subject);
1998
1998
  };
1999
1999
 
2000
- const _remove = (pointer, subject, cursor) => {
2000
+ const _remove$1 = (pointer, subject, cursor) => {
2001
2001
  if (pointer.length === 0) {
2002
2002
  return;
2003
2003
  } else if (pointer.length > 1) {
2004
2004
  const segment = pointer.shift();
2005
- const value = applySegment(subject, segment, cursor);
2006
- _remove(pointer, value, append(segment, cursor));
2005
+ const value = applySegment$1(subject, segment, cursor);
2006
+ _remove$1(pointer, value, append$1(segment, cursor));
2007
2007
  } else if (Array.isArray(subject)) {
2008
2008
  subject.splice(pointer[0], 1);
2009
2009
  } else if (typeof subject === "object" && subject !== null) {
2010
2010
  delete subject[pointer[0]];
2011
2011
  } else {
2012
- applySegment(subject, pointer[0], cursor);
2012
+ applySegment$1(subject, pointer[0], cursor);
2013
2013
  }
2014
2014
  };
2015
2015
 
2016
- const append = curry$9((segment, pointer) => pointer + "/" + escape(segment));
2016
+ const append$1 = curry$i((segment, pointer) => pointer + "/" + escape$2(segment));
2017
2017
 
2018
- const escape = (segment) => segment.toString().replace(/~/g, "~0").replace(/\//g, "~1");
2019
- const unescape = (segment) => segment.toString().replace(/~1/g, "/").replace(/~0/g, "~");
2020
- const computeSegment = (value, segment) => Array.isArray(value) && segment === "-" ? value.length : segment;
2018
+ const escape$2 = (segment) => segment.toString().replace(/~/g, "~0").replace(/\//g, "~1");
2019
+ const unescape$1 = (segment) => segment.toString().replace(/~1/g, "/").replace(/~0/g, "~");
2020
+ const computeSegment$1 = (value, segment) => Array.isArray(value) && segment === "-" ? value.length : segment;
2021
2021
 
2022
- const applySegment = (value, segment, cursor = "") => {
2022
+ const applySegment$1 = (value, segment, cursor = "") => {
2023
2023
  if (value === undefined) {
2024
2024
  throw TypeError(`Value at '${cursor}' is undefined and does not have property '${segment}'`);
2025
2025
  } else if (value === null) {
2026
2026
  throw TypeError(`Value at '${cursor}' is null and does not have property '${segment}'`);
2027
- } else if (isScalar(value)) {
2027
+ } else if (isScalar$1(value)) {
2028
2028
  throw TypeError(`Value at '${cursor}' is a ${typeof value} and does not have property '${segment}'`);
2029
2029
  } else {
2030
- const computedSegment = computeSegment(value, segment);
2030
+ const computedSegment = computeSegment$1(value, segment);
2031
2031
  return value[computedSegment];
2032
2032
  }
2033
2033
  };
2034
2034
 
2035
- const isScalar = (value) => value === null || typeof value !== "object";
2035
+ const isScalar$1 = (value) => value === null || typeof value !== "object";
2036
2036
 
2037
- var lib$3 = { nil: nil$2, append, get: get$1, set, assign, unset, remove };
2037
+ var lib$6 = { nil: nil$3, append: append$1, get: get$3, set: set$1, assign: assign$1, unset: unset$1, remove: remove$1 };
2038
2038
 
2039
2039
  const $__value = Symbol("$__value");
2040
2040
  const $__href = Symbol("$__href");
@@ -2050,261 +2050,1299 @@
2050
2050
 
2051
2051
  var reference = { cons: cons$1, isReference, href, value: value$2 };
2052
2052
 
2053
- const JsonPointer$1 = lib$3;
2054
- const curry$8 = justCurryIt;
2053
+ const JsonPointer$3 = lib$6;
2054
+ const curry$h = justCurryIt$2;
2055
2055
  const { resolveUrl: resolveUrl$2, jsonTypeOf: jsonTypeOf$1 } = common$1;
2056
2056
  const Reference$2 = reference;
2057
2057
 
2058
2058
 
2059
- const nil$1 = Object.freeze({ id: "", pointer: "", instance: undefined, value: undefined });
2060
- const cons = (instance, id = "") => Object.freeze({ ...nil$1, id: resolveUrl$2(id, ""), instance, value: instance });
2059
+ const nil$2 = Object.freeze({ id: "", pointer: "", instance: undefined, value: undefined });
2060
+ const cons = (instance, id = "") => Object.freeze({ ...nil$2, id: resolveUrl$2(id, ""), instance, value: instance });
2061
+
2062
+ const get$2 = (url, instance = nil$2) => {
2063
+ if (!url.startsWith("#")) {
2064
+ throw Error(`No JSON document found at '${url.split("#")[0]}'`);
2065
+ }
2066
+
2067
+ return Object.freeze({ ...instance, pointer: url.substr(1) });
2068
+ };
2069
+
2061
2070
  const uri$1 = (doc) => `${doc.id}#${encodeURI(doc.pointer)}`;
2062
2071
  const value$1 = (doc) => Reference$2.isReference(doc.value) ? Reference$2.value(doc.value) : doc.value;
2063
2072
  const has$1 = (key, doc) => key in value$1(doc);
2064
- const typeOf$1 = curry$8((doc, type) => jsonTypeOf$1(value$1(doc), type));
2073
+ const typeOf$1 = curry$h((doc, type) => jsonTypeOf$1(value$1(doc), type));
2065
2074
 
2066
2075
  const step$1 = (key, doc) => Object.freeze({
2067
2076
  ...doc,
2068
- pointer: JsonPointer$1.append(key, doc.pointer),
2077
+ pointer: JsonPointer$3.append(key, doc.pointer),
2069
2078
  value: value$1(doc)[key]
2070
2079
  });
2071
2080
 
2072
- const entries$3 = (doc) => Object.keys(value$1(doc))
2081
+ const entries$5 = (doc) => Object.keys(value$1(doc))
2073
2082
  .map((key) => [key, step$1(key, doc)]);
2074
2083
 
2075
2084
  const keys$1 = (doc) => Object.keys(value$1(doc));
2076
2085
 
2077
- const map$4 = curry$8((fn, doc) => value$1(doc)
2086
+ const map$7 = curry$h((fn, doc) => value$1(doc)
2078
2087
  .map((item, ndx, array, thisArg) => fn(step$1(ndx, doc), ndx, array, thisArg)));
2079
2088
 
2080
- const filter$1 = curry$8((fn, doc) => value$1(doc)
2089
+ const forEach = curry$h((fn, doc) => value$1(doc)
2090
+ .forEach((item, ndx, array, thisArg) => fn(step$1(ndx, doc), ndx, array, thisArg)));
2091
+
2092
+ const filter$2 = curry$h((fn, doc) => value$1(doc)
2081
2093
  .map((item, ndx, array, thisArg) => step$1(ndx, doc))
2082
2094
  .filter((item, ndx, array, thisArg) => fn(item, ndx, array, thisArg)));
2083
2095
 
2084
- const reduce$3 = curry$8((fn, acc, doc) => value$1(doc)
2096
+ const reduce$6 = curry$h((fn, acc, doc) => value$1(doc)
2085
2097
  .reduce((acc, item, ndx) => fn(acc, step$1(ndx, doc), ndx), acc));
2086
2098
 
2087
- const every$1 = curry$8((fn, doc) => value$1(doc)
2099
+ const every$2 = curry$h((fn, doc) => value$1(doc)
2088
2100
  .every((item, ndx, array, thisArg) => fn(step$1(ndx, doc), ndx, array, thisArg)));
2089
2101
 
2090
- const some$1 = curry$8((fn, doc) => value$1(doc)
2102
+ const some$2 = curry$h((fn, doc) => value$1(doc)
2091
2103
  .some((item, ndx, array, thisArg) => fn(step$1(ndx, doc), ndx, array, thisArg)));
2092
2104
 
2093
2105
  const length$1 = (doc) => value$1(doc).length;
2094
2106
 
2095
- 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 };
2107
+ var instance = {
2108
+ nil: nil$2, cons, get: get$2, uri: uri$1, value: value$1, has: has$1, typeOf: typeOf$1, length: length$1,
2109
+ 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
2110
+ };
2096
2111
 
2097
- var entries$2 = async (doc) => Object.entries(await doc);
2112
+ var entries$4 = async (doc) => Object.entries(await doc);
2098
2113
 
2099
- const curry$7 = justCurryIt;
2114
+ const curry$g = justCurryIt$2;
2100
2115
 
2101
2116
 
2102
- var map$3 = curry$7(async (fn, doc) => (await doc).map(fn));
2117
+ var map$6 = curry$g(async (fn, doc) => (await doc).map(fn));
2103
2118
 
2104
- const curry$6 = justCurryIt;
2119
+ const curry$f = justCurryIt$2;
2105
2120
 
2106
2121
 
2107
- var reduce$2 = curry$6(async (fn, acc, doc) => {
2122
+ var reduce$5 = curry$f(async (fn, acc, doc) => {
2108
2123
  return (await doc).reduce(async (acc, item) => fn(await acc, item), acc);
2109
2124
  });
2110
2125
 
2111
- const curry$5 = justCurryIt;
2112
- const reduce$1 = reduce$2;
2126
+ const curry$e = justCurryIt$2;
2127
+ const reduce$4 = reduce$5;
2113
2128
 
2114
2129
 
2115
- var filter = curry$5(async (fn, doc, options = {}) => {
2116
- return reduce$1(async (acc, item) => {
2130
+ var filter$1 = curry$e(async (fn, doc, options = {}) => {
2131
+ return reduce$4(async (acc, item) => {
2117
2132
  return (await fn(item)) ? acc.concat([item]) : acc;
2118
2133
  }, [], doc, options);
2119
2134
  });
2120
2135
 
2121
- const curry$4 = justCurryIt;
2122
- const map$2 = map$3;
2136
+ const curry$d = justCurryIt$2;
2137
+ const map$5 = map$6;
2123
2138
 
2124
2139
 
2125
- var some = curry$4(async (fn, doc) => {
2126
- const results = await map$2(fn, doc);
2140
+ var some$1 = curry$d(async (fn, doc) => {
2141
+ const results = await map$5(fn, doc);
2127
2142
  return (await Promise.all(results))
2128
2143
  .some((a) => a);
2129
2144
  });
2130
2145
 
2131
- const curry$3 = justCurryIt;
2132
- const map$1 = map$3;
2146
+ const curry$c = justCurryIt$2;
2147
+ const map$4 = map$6;
2133
2148
 
2134
2149
 
2135
- var every = curry$3(async (fn, doc) => {
2136
- const results = await map$1(fn, doc);
2150
+ var every$1 = curry$c(async (fn, doc) => {
2151
+ const results = await map$4(fn, doc);
2137
2152
  return (await Promise.all(results))
2138
2153
  .every((a) => a);
2139
2154
  });
2140
2155
 
2141
- const curry$2 = justCurryIt;
2156
+ const curry$b = justCurryIt$2;
2142
2157
 
2143
2158
 
2144
- var pipeline$1 = curry$2((fns, doc) => {
2159
+ var pipeline$3 = curry$b((fns, doc) => {
2145
2160
  return fns.reduce(async (acc, fn) => fn(await acc), doc);
2146
2161
  });
2147
2162
 
2148
- var all = (doc) => Promise.all(doc);
2163
+ var all$1 = (doc) => Promise.all(doc);
2149
2164
 
2150
- const pipeline = pipeline$1;
2151
- const entries$1 = entries$2;
2152
- const reduce = reduce$2;
2165
+ const pipeline$2 = pipeline$3;
2166
+ const entries$3 = entries$4;
2167
+ const reduce$3 = reduce$5;
2153
2168
 
2154
2169
 
2155
- var allValues = (doc) => {
2156
- return pipeline([
2157
- entries$1,
2158
- reduce(async (acc, [propertyName, propertyValue]) => {
2170
+ var allValues$1 = (doc) => {
2171
+ return pipeline$2([
2172
+ entries$3,
2173
+ reduce$3(async (acc, [propertyName, propertyValue]) => {
2159
2174
  acc[propertyName] = await propertyValue;
2160
2175
  return acc;
2161
2176
  }, {})
2162
2177
  ], doc);
2163
2178
  };
2164
2179
 
2165
- var lib$2 = {
2166
- entries: entries$2,
2167
- map: map$3,
2168
- filter: filter,
2169
- reduce: reduce$2,
2170
- some: some,
2171
- every: every,
2172
- pipeline: pipeline$1,
2173
- all: all,
2174
- allValues: allValues
2180
+ var lib$5 = {
2181
+ entries: entries$4,
2182
+ map: map$6,
2183
+ filter: filter$1,
2184
+ reduce: reduce$5,
2185
+ some: some$1,
2186
+ every: every$1,
2187
+ pipeline: pipeline$3,
2188
+ all: all$1,
2189
+ allValues: allValues$1
2175
2190
  };
2176
2191
 
2177
- var fetch_browser = fetch;
2178
-
2179
- var contentType = {};
2180
-
2181
- /*!
2182
- * content-type
2183
- * Copyright(c) 2015 Douglas Christopher Wilson
2184
- * MIT Licensed
2185
- */
2186
-
2187
- /**
2188
- * RegExp to match *( ";" parameter ) in RFC 7231 sec 3.1.1.1
2189
- *
2190
- * parameter = token "=" ( token / quoted-string )
2191
- * token = 1*tchar
2192
- * tchar = "!" / "#" / "$" / "%" / "&" / "'" / "*"
2193
- * / "+" / "-" / "." / "^" / "_" / "`" / "|" / "~"
2194
- * / DIGIT / ALPHA
2195
- * ; any VCHAR, except delimiters
2196
- * quoted-string = DQUOTE *( qdtext / quoted-pair ) DQUOTE
2197
- * qdtext = HTAB / SP / %x21 / %x23-5B / %x5D-7E / obs-text
2198
- * obs-text = %x80-FF
2199
- * quoted-pair = "\" ( HTAB / SP / VCHAR / obs-text )
2200
- */
2201
- var PARAM_REGEXP = /; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g;
2202
- var TEXT_REGEXP = /^[\u000b\u0020-\u007e\u0080-\u00ff]+$/;
2203
- var TOKEN_REGEXP = /^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;
2204
-
2205
- /**
2206
- * RegExp to match quoted-pair in RFC 7230 sec 3.2.6
2207
- *
2208
- * quoted-pair = "\" ( HTAB / SP / VCHAR / obs-text )
2209
- * obs-text = %x80-FF
2210
- */
2211
- var QESC_REGEXP = /\\([\u000b\u0020-\u00ff])/g;
2212
-
2213
- /**
2214
- * RegExp to match chars that must be quoted-pair in RFC 7230 sec 3.2.6
2215
- */
2216
- var QUOTE_REGEXP = /([\\"])/g;
2217
-
2218
- /**
2219
- * RegExp to match type in RFC 7231 sec 3.1.1.1
2220
- *
2221
- * media-type = type "/" subtype
2222
- * type = token
2223
- * subtype = token
2224
- */
2225
- var TYPE_REGEXP = /^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;
2226
-
2227
- /**
2228
- * Module exports.
2229
- * @public
2230
- */
2231
-
2232
- contentType.format = format$1;
2233
- contentType.parse = parse$1;
2234
-
2235
- /**
2236
- * Format object to media type.
2237
- *
2238
- * @param {object} obj
2239
- * @return {string}
2240
- * @public
2241
- */
2192
+ var justCurryIt$1 = curry$a;
2242
2193
 
2243
- function format$1 (obj) {
2244
- if (!obj || typeof obj !== 'object') {
2245
- throw new TypeError('argument obj is required')
2194
+ /*
2195
+ function add(a, b, c) {
2196
+ return a + b + c;
2246
2197
  }
2198
+ curry(add)(1)(2)(3); // 6
2199
+ curry(add)(1)(2)(2); // 5
2200
+ curry(add)(2)(4, 3); // 9
2247
2201
 
2248
- var parameters = obj.parameters;
2249
- var type = obj.type;
2202
+ function add(...args) {
2203
+ return args.reduce((sum, n) => sum + n, 0)
2204
+ }
2205
+ var curryAdd4 = curry(add, 4)
2206
+ curryAdd4(1)(2, 3)(4); // 10
2250
2207
 
2251
- if (!type || !TYPE_REGEXP.test(type)) {
2252
- throw new TypeError('invalid type')
2208
+ function converter(ratio, input) {
2209
+ return (input*ratio).toFixed(1);
2253
2210
  }
2211
+ const curriedConverter = curry(converter)
2212
+ const milesToKm = curriedConverter(1.62);
2213
+ milesToKm(35); // 56.7
2214
+ milesToKm(10); // 16.2
2215
+ */
2254
2216
 
2255
- var string = type;
2217
+ function curry$a(fn, arity) {
2218
+ return function curried() {
2219
+ if (arity == null) {
2220
+ arity = fn.length;
2221
+ }
2222
+ var args = [].slice.call(arguments);
2223
+ if (args.length >= arity) {
2224
+ return fn.apply(this, args);
2225
+ } else {
2226
+ return function() {
2227
+ return curried.apply(this, args.concat([].slice.call(arguments)));
2228
+ };
2229
+ }
2230
+ };
2231
+ }
2256
2232
 
2257
- // append parameters
2258
- if (parameters && typeof parameters === 'object') {
2259
- var param;
2260
- var params = Object.keys(parameters).sort();
2233
+ const curry$9 = justCurryIt$1;
2261
2234
 
2262
- for (var i = 0; i < params.length; i++) {
2263
- param = params[i];
2264
2235
 
2265
- if (!TOKEN_REGEXP.test(param)) {
2266
- throw new TypeError('invalid parameter name')
2267
- }
2236
+ const nil$1 = "";
2268
2237
 
2269
- string += '; ' + param + '=' + qstring(parameters[param]);
2270
- }
2238
+ const compile$P = (pointer) => {
2239
+ if (pointer.length > 0 && pointer[0] !== "/") {
2240
+ throw Error("Invalid JSON Pointer");
2271
2241
  }
2272
2242
 
2273
- return string
2274
- }
2243
+ return pointer.split("/").slice(1).map(unescape);
2244
+ };
2275
2245
 
2276
- /**
2277
- * Parse media type to object.
2278
- *
2279
- * @param {string|object} string
2280
- * @return {Object}
2281
- * @public
2282
- */
2246
+ const get$1 = (pointer, value = undefined) => {
2247
+ const ptr = compile$P(pointer);
2283
2248
 
2284
- function parse$1 (string) {
2285
- if (!string) {
2286
- throw new TypeError('argument string is required')
2287
- }
2249
+ const fn = (value) => ptr.reduce(([value, pointer], segment) => {
2250
+ return [applySegment(value, segment, pointer), append(segment, pointer)];
2251
+ }, [value, ""])[0];
2288
2252
 
2289
- // support req/res-like objects as argument
2290
- var header = typeof string === 'object'
2291
- ? getcontenttype(string)
2292
- : string;
2253
+ return value === undefined ? fn : fn(value);
2254
+ };
2293
2255
 
2294
- if (typeof header !== 'string') {
2295
- throw new TypeError('argument string is required to be a string')
2256
+ const set = (pointer, subject = undefined, value = undefined) => {
2257
+ const ptr = compile$P(pointer);
2258
+ const fn = curry$9((subject, value) => _set(ptr, subject, value, nil$1));
2259
+ return subject === undefined ? fn : fn(subject, value);
2260
+ };
2261
+
2262
+ const _set = (pointer, subject, value, cursor) => {
2263
+ if (pointer.length === 0) {
2264
+ return value;
2265
+ } else if (pointer.length > 1) {
2266
+ if (Array.isArray(subject)) {
2267
+ const index = pointer.shift();
2268
+ const clonedSubject = [...subject];
2269
+ clonedSubject[index] = _set(pointer, applySegment(subject, index, cursor), value, append(index, cursor));
2270
+ return clonedSubject;
2271
+ } else {
2272
+ const segment = pointer.shift();
2273
+ return { ...subject, [segment]: _set(pointer, applySegment(subject, segment, cursor), value, append(segment, cursor)) };
2274
+ }
2275
+ } else if (Array.isArray(subject)) {
2276
+ const clonedSubject = [...subject];
2277
+ const segment = computeSegment(subject, pointer[0]);
2278
+ clonedSubject[segment] = value;
2279
+ return clonedSubject;
2280
+ } else if (typeof subject === "object" && subject !== null) {
2281
+ return { ...subject, [pointer[0]]: value };
2282
+ } else {
2283
+ return applySegment(subject, pointer[0], cursor);
2296
2284
  }
2285
+ };
2297
2286
 
2298
- var index = header.indexOf(';');
2299
- var type = index !== -1
2300
- ? header.substr(0, index).trim()
2301
- : header.trim();
2287
+ const assign = (pointer, subject = undefined, value = undefined) => {
2288
+ const ptr = compile$P(pointer);
2289
+ const fn = curry$9((subject, value) => _assign(ptr, subject, value, nil$1));
2290
+ return subject === undefined ? fn : fn(subject, value);
2291
+ };
2302
2292
 
2303
- if (!TYPE_REGEXP.test(type)) {
2304
- throw new TypeError('invalid media type')
2293
+ const _assign = (pointer, subject, value, cursor) => {
2294
+ if (pointer.length === 0) {
2295
+ return;
2296
+ } else if (pointer.length === 1 && !isScalar(subject)) {
2297
+ const segment = computeSegment(subject, pointer[0]);
2298
+ subject[segment] = value;
2299
+ } else {
2300
+ const segment = pointer.shift();
2301
+ _assign(pointer, applySegment(subject, segment, cursor), value, append(segment, cursor));
2305
2302
  }
2303
+ };
2306
2304
 
2307
- var obj = new ContentType(type.toLowerCase());
2305
+ const unset = (pointer, subject = undefined) => {
2306
+ const ptr = compile$P(pointer);
2307
+ const fn = (subject) => _unset(ptr, subject, nil$1);
2308
+ return subject === undefined ? fn : fn(subject);
2309
+ };
2310
+
2311
+ const _unset = (pointer, subject, cursor) => {
2312
+ if (pointer.length == 0) {
2313
+ return undefined;
2314
+ } else if (pointer.length > 1) {
2315
+ const segment = pointer.shift();
2316
+ const value = applySegment(subject, segment, cursor);
2317
+ return { ...subject, [segment]: _unset(pointer, value, append(segment, cursor)) };
2318
+ } else if (Array.isArray(subject)) {
2319
+ return subject.filter((_, ndx) => ndx != pointer[0]);
2320
+ } else if (typeof subject === "object" && subject !== null) {
2321
+ // eslint-disable-next-line no-unused-vars
2322
+ const { [pointer[0]]: _, ...result } = subject;
2323
+ return result;
2324
+ } else {
2325
+ return applySegment(subject, pointer[0], cursor);
2326
+ }
2327
+ };
2328
+
2329
+ const remove = (pointer, subject = undefined) => {
2330
+ const ptr = compile$P(pointer);
2331
+ const fn = (subject) => _remove(ptr, subject, nil$1);
2332
+ return subject === undefined ? fn : fn(subject);
2333
+ };
2334
+
2335
+ const _remove = (pointer, subject, cursor) => {
2336
+ if (pointer.length === 0) {
2337
+ return;
2338
+ } else if (pointer.length > 1) {
2339
+ const segment = pointer.shift();
2340
+ const value = applySegment(subject, segment, cursor);
2341
+ _remove(pointer, value, append(segment, cursor));
2342
+ } else if (Array.isArray(subject)) {
2343
+ subject.splice(pointer[0], 1);
2344
+ } else if (typeof subject === "object" && subject !== null) {
2345
+ delete subject[pointer[0]];
2346
+ } else {
2347
+ applySegment(subject, pointer[0], cursor);
2348
+ }
2349
+ };
2350
+
2351
+ const append = curry$9((segment, pointer) => pointer + "/" + escape$1(segment));
2352
+
2353
+ const escape$1 = (segment) => segment.toString().replace(/~/g, "~0").replace(/\//g, "~1");
2354
+ const unescape = (segment) => segment.toString().replace(/~1/g, "/").replace(/~0/g, "~");
2355
+ const computeSegment = (value, segment) => Array.isArray(value) && segment === "-" ? value.length : segment;
2356
+
2357
+ const applySegment = (value, segment, cursor = "") => {
2358
+ if (value === undefined) {
2359
+ throw TypeError(`Value at '${cursor}' is undefined and does not have property '${segment}'`);
2360
+ } else if (value === null) {
2361
+ throw TypeError(`Value at '${cursor}' is null and does not have property '${segment}'`);
2362
+ } else if (isScalar(value)) {
2363
+ throw TypeError(`Value at '${cursor}' is a ${typeof value} and does not have property '${segment}'`);
2364
+ } else {
2365
+ const computedSegment = computeSegment(value, segment);
2366
+ return value[computedSegment];
2367
+ }
2368
+ };
2369
+
2370
+ const isScalar = (value) => value === null || typeof value !== "object";
2371
+
2372
+ var lib$4 = { nil: nil$1, append, get: get$1, set, assign, unset, remove };
2373
+
2374
+ var moo$1 = {exports: {}};
2375
+
2376
+ (function (module) {
2377
+ (function(root, factory) {
2378
+ if (module.exports) {
2379
+ module.exports = factory();
2380
+ } else {
2381
+ root.moo = factory();
2382
+ }
2383
+ }(commonjsGlobal, function() {
2384
+
2385
+ var hasOwnProperty = Object.prototype.hasOwnProperty;
2386
+ var toString = Object.prototype.toString;
2387
+ var hasSticky = typeof new RegExp().sticky === 'boolean';
2388
+
2389
+ /***************************************************************************/
2390
+
2391
+ function isRegExp(o) { return o && toString.call(o) === '[object RegExp]' }
2392
+ function isObject(o) { return o && typeof o === 'object' && !isRegExp(o) && !Array.isArray(o) }
2393
+
2394
+ function reEscape(s) {
2395
+ return s.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&')
2396
+ }
2397
+ function reGroups(s) {
2398
+ var re = new RegExp('|' + s);
2399
+ return re.exec('').length - 1
2400
+ }
2401
+ function reCapture(s) {
2402
+ return '(' + s + ')'
2403
+ }
2404
+ function reUnion(regexps) {
2405
+ if (!regexps.length) return '(?!)'
2406
+ var source = regexps.map(function(s) {
2407
+ return "(?:" + s + ")"
2408
+ }).join('|');
2409
+ return "(?:" + source + ")"
2410
+ }
2411
+
2412
+ function regexpOrLiteral(obj) {
2413
+ if (typeof obj === 'string') {
2414
+ return '(?:' + reEscape(obj) + ')'
2415
+
2416
+ } else if (isRegExp(obj)) {
2417
+ // TODO: consider /u support
2418
+ if (obj.ignoreCase) throw new Error('RegExp /i flag not allowed')
2419
+ if (obj.global) throw new Error('RegExp /g flag is implied')
2420
+ if (obj.sticky) throw new Error('RegExp /y flag is implied')
2421
+ if (obj.multiline) throw new Error('RegExp /m flag is implied')
2422
+ return obj.source
2423
+
2424
+ } else {
2425
+ throw new Error('Not a pattern: ' + obj)
2426
+ }
2427
+ }
2428
+
2429
+ function objectToRules(object) {
2430
+ var keys = Object.getOwnPropertyNames(object);
2431
+ var result = [];
2432
+ for (var i = 0; i < keys.length; i++) {
2433
+ var key = keys[i];
2434
+ var thing = object[key];
2435
+ var rules = [].concat(thing);
2436
+ if (key === 'include') {
2437
+ for (var j = 0; j < rules.length; j++) {
2438
+ result.push({include: rules[j]});
2439
+ }
2440
+ continue
2441
+ }
2442
+ var match = [];
2443
+ rules.forEach(function(rule) {
2444
+ if (isObject(rule)) {
2445
+ if (match.length) result.push(ruleOptions(key, match));
2446
+ result.push(ruleOptions(key, rule));
2447
+ match = [];
2448
+ } else {
2449
+ match.push(rule);
2450
+ }
2451
+ });
2452
+ if (match.length) result.push(ruleOptions(key, match));
2453
+ }
2454
+ return result
2455
+ }
2456
+
2457
+ function arrayToRules(array) {
2458
+ var result = [];
2459
+ for (var i = 0; i < array.length; i++) {
2460
+ var obj = array[i];
2461
+ if (obj.include) {
2462
+ var include = [].concat(obj.include);
2463
+ for (var j = 0; j < include.length; j++) {
2464
+ result.push({include: include[j]});
2465
+ }
2466
+ continue
2467
+ }
2468
+ if (!obj.type) {
2469
+ throw new Error('Rule has no type: ' + JSON.stringify(obj))
2470
+ }
2471
+ result.push(ruleOptions(obj.type, obj));
2472
+ }
2473
+ return result
2474
+ }
2475
+
2476
+ function ruleOptions(type, obj) {
2477
+ if (!isObject(obj)) {
2478
+ obj = { match: obj };
2479
+ }
2480
+ if (obj.include) {
2481
+ throw new Error('Matching rules cannot also include states')
2482
+ }
2483
+
2484
+ // nb. error and fallback imply lineBreaks
2485
+ var options = {
2486
+ defaultType: type,
2487
+ lineBreaks: !!obj.error || !!obj.fallback,
2488
+ pop: false,
2489
+ next: null,
2490
+ push: null,
2491
+ error: false,
2492
+ fallback: false,
2493
+ value: null,
2494
+ type: null,
2495
+ shouldThrow: false,
2496
+ };
2497
+
2498
+ // Avoid Object.assign(), so we support IE9+
2499
+ for (var key in obj) {
2500
+ if (hasOwnProperty.call(obj, key)) {
2501
+ options[key] = obj[key];
2502
+ }
2503
+ }
2504
+
2505
+ // type transform cannot be a string
2506
+ if (typeof options.type === 'string' && type !== options.type) {
2507
+ throw new Error("Type transform cannot be a string (type '" + options.type + "' for token '" + type + "')")
2508
+ }
2509
+
2510
+ // convert to array
2511
+ var match = options.match;
2512
+ options.match = Array.isArray(match) ? match : match ? [match] : [];
2513
+ options.match.sort(function(a, b) {
2514
+ return isRegExp(a) && isRegExp(b) ? 0
2515
+ : isRegExp(b) ? -1 : isRegExp(a) ? +1 : b.length - a.length
2516
+ });
2517
+ return options
2518
+ }
2519
+
2520
+ function toRules(spec) {
2521
+ return Array.isArray(spec) ? arrayToRules(spec) : objectToRules(spec)
2522
+ }
2523
+
2524
+ var defaultErrorRule = ruleOptions('error', {lineBreaks: true, shouldThrow: true});
2525
+ function compileRules(rules, hasStates) {
2526
+ var errorRule = null;
2527
+ var fast = Object.create(null);
2528
+ var fastAllowed = true;
2529
+ var unicodeFlag = null;
2530
+ var groups = [];
2531
+ var parts = [];
2532
+
2533
+ // If there is a fallback rule, then disable fast matching
2534
+ for (var i = 0; i < rules.length; i++) {
2535
+ if (rules[i].fallback) {
2536
+ fastAllowed = false;
2537
+ }
2538
+ }
2539
+
2540
+ for (var i = 0; i < rules.length; i++) {
2541
+ var options = rules[i];
2542
+
2543
+ if (options.include) {
2544
+ // all valid inclusions are removed by states() preprocessor
2545
+ throw new Error('Inheritance is not allowed in stateless lexers')
2546
+ }
2547
+
2548
+ if (options.error || options.fallback) {
2549
+ // errorRule can only be set once
2550
+ if (errorRule) {
2551
+ if (!options.fallback === !errorRule.fallback) {
2552
+ throw new Error("Multiple " + (options.fallback ? "fallback" : "error") + " rules not allowed (for token '" + options.defaultType + "')")
2553
+ } else {
2554
+ throw new Error("fallback and error are mutually exclusive (for token '" + options.defaultType + "')")
2555
+ }
2556
+ }
2557
+ errorRule = options;
2558
+ }
2559
+
2560
+ var match = options.match.slice();
2561
+ if (fastAllowed) {
2562
+ while (match.length && typeof match[0] === 'string' && match[0].length === 1) {
2563
+ var word = match.shift();
2564
+ fast[word.charCodeAt(0)] = options;
2565
+ }
2566
+ }
2567
+
2568
+ // Warn about inappropriate state-switching options
2569
+ if (options.pop || options.push || options.next) {
2570
+ if (!hasStates) {
2571
+ throw new Error("State-switching options are not allowed in stateless lexers (for token '" + options.defaultType + "')")
2572
+ }
2573
+ if (options.fallback) {
2574
+ throw new Error("State-switching options are not allowed on fallback tokens (for token '" + options.defaultType + "')")
2575
+ }
2576
+ }
2577
+
2578
+ // Only rules with a .match are included in the RegExp
2579
+ if (match.length === 0) {
2580
+ continue
2581
+ }
2582
+ fastAllowed = false;
2583
+
2584
+ groups.push(options);
2585
+
2586
+ // Check unicode flag is used everywhere or nowhere
2587
+ for (var j = 0; j < match.length; j++) {
2588
+ var obj = match[j];
2589
+ if (!isRegExp(obj)) {
2590
+ continue
2591
+ }
2592
+
2593
+ if (unicodeFlag === null) {
2594
+ unicodeFlag = obj.unicode;
2595
+ } else if (unicodeFlag !== obj.unicode && options.fallback === false) {
2596
+ throw new Error('If one rule is /u then all must be')
2597
+ }
2598
+ }
2599
+
2600
+ // convert to RegExp
2601
+ var pat = reUnion(match.map(regexpOrLiteral));
2602
+
2603
+ // validate
2604
+ var regexp = new RegExp(pat);
2605
+ if (regexp.test("")) {
2606
+ throw new Error("RegExp matches empty string: " + regexp)
2607
+ }
2608
+ var groupCount = reGroups(pat);
2609
+ if (groupCount > 0) {
2610
+ throw new Error("RegExp has capture groups: " + regexp + "\nUse (?: … ) instead")
2611
+ }
2612
+
2613
+ // try and detect rules matching newlines
2614
+ if (!options.lineBreaks && regexp.test('\n')) {
2615
+ throw new Error('Rule should declare lineBreaks: ' + regexp)
2616
+ }
2617
+
2618
+ // store regex
2619
+ parts.push(reCapture(pat));
2620
+ }
2621
+
2622
+
2623
+ // If there's no fallback rule, use the sticky flag so we only look for
2624
+ // matches at the current index.
2625
+ //
2626
+ // If we don't support the sticky flag, then fake it using an irrefutable
2627
+ // match (i.e. an empty pattern).
2628
+ var fallbackRule = errorRule && errorRule.fallback;
2629
+ var flags = hasSticky && !fallbackRule ? 'ym' : 'gm';
2630
+ var suffix = hasSticky || fallbackRule ? '' : '|';
2631
+
2632
+ if (unicodeFlag === true) flags += "u";
2633
+ var combined = new RegExp(reUnion(parts) + suffix, flags);
2634
+ return {regexp: combined, groups: groups, fast: fast, error: errorRule || defaultErrorRule}
2635
+ }
2636
+
2637
+ function compile(rules) {
2638
+ var result = compileRules(toRules(rules));
2639
+ return new Lexer({start: result}, 'start')
2640
+ }
2641
+
2642
+ function checkStateGroup(g, name, map) {
2643
+ var state = g && (g.push || g.next);
2644
+ if (state && !map[state]) {
2645
+ throw new Error("Missing state '" + state + "' (in token '" + g.defaultType + "' of state '" + name + "')")
2646
+ }
2647
+ if (g && g.pop && +g.pop !== 1) {
2648
+ throw new Error("pop must be 1 (in token '" + g.defaultType + "' of state '" + name + "')")
2649
+ }
2650
+ }
2651
+ function compileStates(states, start) {
2652
+ var all = states.$all ? toRules(states.$all) : [];
2653
+ delete states.$all;
2654
+
2655
+ var keys = Object.getOwnPropertyNames(states);
2656
+ if (!start) start = keys[0];
2657
+
2658
+ var ruleMap = Object.create(null);
2659
+ for (var i = 0; i < keys.length; i++) {
2660
+ var key = keys[i];
2661
+ ruleMap[key] = toRules(states[key]).concat(all);
2662
+ }
2663
+ for (var i = 0; i < keys.length; i++) {
2664
+ var key = keys[i];
2665
+ var rules = ruleMap[key];
2666
+ var included = Object.create(null);
2667
+ for (var j = 0; j < rules.length; j++) {
2668
+ var rule = rules[j];
2669
+ if (!rule.include) continue
2670
+ var splice = [j, 1];
2671
+ if (rule.include !== key && !included[rule.include]) {
2672
+ included[rule.include] = true;
2673
+ var newRules = ruleMap[rule.include];
2674
+ if (!newRules) {
2675
+ throw new Error("Cannot include nonexistent state '" + rule.include + "' (in state '" + key + "')")
2676
+ }
2677
+ for (var k = 0; k < newRules.length; k++) {
2678
+ var newRule = newRules[k];
2679
+ if (rules.indexOf(newRule) !== -1) continue
2680
+ splice.push(newRule);
2681
+ }
2682
+ }
2683
+ rules.splice.apply(rules, splice);
2684
+ j--;
2685
+ }
2686
+ }
2687
+
2688
+ var map = Object.create(null);
2689
+ for (var i = 0; i < keys.length; i++) {
2690
+ var key = keys[i];
2691
+ map[key] = compileRules(ruleMap[key], true);
2692
+ }
2693
+
2694
+ for (var i = 0; i < keys.length; i++) {
2695
+ var name = keys[i];
2696
+ var state = map[name];
2697
+ var groups = state.groups;
2698
+ for (var j = 0; j < groups.length; j++) {
2699
+ checkStateGroup(groups[j], name, map);
2700
+ }
2701
+ var fastKeys = Object.getOwnPropertyNames(state.fast);
2702
+ for (var j = 0; j < fastKeys.length; j++) {
2703
+ checkStateGroup(state.fast[fastKeys[j]], name, map);
2704
+ }
2705
+ }
2706
+
2707
+ return new Lexer(map, start)
2708
+ }
2709
+
2710
+ function keywordTransform(map) {
2711
+ var reverseMap = Object.create(null);
2712
+ var byLength = Object.create(null);
2713
+ var types = Object.getOwnPropertyNames(map);
2714
+ for (var i = 0; i < types.length; i++) {
2715
+ var tokenType = types[i];
2716
+ var item = map[tokenType];
2717
+ var keywordList = Array.isArray(item) ? item : [item];
2718
+ keywordList.forEach(function(keyword) {
2719
+ (byLength[keyword.length] = byLength[keyword.length] || []).push(keyword);
2720
+ if (typeof keyword !== 'string') {
2721
+ throw new Error("keyword must be string (in keyword '" + tokenType + "')")
2722
+ }
2723
+ reverseMap[keyword] = tokenType;
2724
+ });
2725
+ }
2726
+
2727
+ // fast string lookup
2728
+ // https://jsperf.com/string-lookups
2729
+ function str(x) { return JSON.stringify(x) }
2730
+ var source = '';
2731
+ source += 'switch (value.length) {\n';
2732
+ for (var length in byLength) {
2733
+ var keywords = byLength[length];
2734
+ source += 'case ' + length + ':\n';
2735
+ source += 'switch (value) {\n';
2736
+ keywords.forEach(function(keyword) {
2737
+ var tokenType = reverseMap[keyword];
2738
+ source += 'case ' + str(keyword) + ': return ' + str(tokenType) + '\n';
2739
+ });
2740
+ source += '}\n';
2741
+ }
2742
+ source += '}\n';
2743
+ return Function('value', source) // type
2744
+ }
2745
+
2746
+ /***************************************************************************/
2747
+
2748
+ var Lexer = function(states, state) {
2749
+ this.startState = state;
2750
+ this.states = states;
2751
+ this.buffer = '';
2752
+ this.stack = [];
2753
+ this.reset();
2754
+ };
2755
+
2756
+ Lexer.prototype.reset = function(data, info) {
2757
+ this.buffer = data || '';
2758
+ this.index = 0;
2759
+ this.line = info ? info.line : 1;
2760
+ this.col = info ? info.col : 1;
2761
+ this.queuedToken = info ? info.queuedToken : null;
2762
+ this.queuedThrow = info ? info.queuedThrow : null;
2763
+ this.setState(info ? info.state : this.startState);
2764
+ this.stack = info && info.stack ? info.stack.slice() : [];
2765
+ return this
2766
+ };
2767
+
2768
+ Lexer.prototype.save = function() {
2769
+ return {
2770
+ line: this.line,
2771
+ col: this.col,
2772
+ state: this.state,
2773
+ stack: this.stack.slice(),
2774
+ queuedToken: this.queuedToken,
2775
+ queuedThrow: this.queuedThrow,
2776
+ }
2777
+ };
2778
+
2779
+ Lexer.prototype.setState = function(state) {
2780
+ if (!state || this.state === state) return
2781
+ this.state = state;
2782
+ var info = this.states[state];
2783
+ this.groups = info.groups;
2784
+ this.error = info.error;
2785
+ this.re = info.regexp;
2786
+ this.fast = info.fast;
2787
+ };
2788
+
2789
+ Lexer.prototype.popState = function() {
2790
+ this.setState(this.stack.pop());
2791
+ };
2792
+
2793
+ Lexer.prototype.pushState = function(state) {
2794
+ this.stack.push(this.state);
2795
+ this.setState(state);
2796
+ };
2797
+
2798
+ var eat = hasSticky ? function(re, buffer) { // assume re is /y
2799
+ return re.exec(buffer)
2800
+ } : function(re, buffer) { // assume re is /g
2801
+ var match = re.exec(buffer);
2802
+ // will always match, since we used the |(?:) trick
2803
+ if (match[0].length === 0) {
2804
+ return null
2805
+ }
2806
+ return match
2807
+ };
2808
+
2809
+ Lexer.prototype._getGroup = function(match) {
2810
+ var groupCount = this.groups.length;
2811
+ for (var i = 0; i < groupCount; i++) {
2812
+ if (match[i + 1] !== undefined) {
2813
+ return this.groups[i]
2814
+ }
2815
+ }
2816
+ throw new Error('Cannot find token type for matched text')
2817
+ };
2818
+
2819
+ function tokenToString() {
2820
+ return this.value
2821
+ }
2822
+
2823
+ Lexer.prototype.next = function() {
2824
+ var index = this.index;
2825
+
2826
+ // If a fallback token matched, we don't need to re-run the RegExp
2827
+ if (this.queuedGroup) {
2828
+ var token = this._token(this.queuedGroup, this.queuedText, index);
2829
+ this.queuedGroup = null;
2830
+ this.queuedText = "";
2831
+ return token
2832
+ }
2833
+
2834
+ var buffer = this.buffer;
2835
+ if (index === buffer.length) {
2836
+ return // EOF
2837
+ }
2838
+
2839
+ // Fast matching for single characters
2840
+ var group = this.fast[buffer.charCodeAt(index)];
2841
+ if (group) {
2842
+ return this._token(group, buffer.charAt(index), index)
2843
+ }
2844
+
2845
+ // Execute RegExp
2846
+ var re = this.re;
2847
+ re.lastIndex = index;
2848
+ var match = eat(re, buffer);
2849
+
2850
+ // Error tokens match the remaining buffer
2851
+ var error = this.error;
2852
+ if (match == null) {
2853
+ return this._token(error, buffer.slice(index, buffer.length), index)
2854
+ }
2855
+
2856
+ var group = this._getGroup(match);
2857
+ var text = match[0];
2858
+
2859
+ if (error.fallback && match.index !== index) {
2860
+ this.queuedGroup = group;
2861
+ this.queuedText = text;
2862
+
2863
+ // Fallback tokens contain the unmatched portion of the buffer
2864
+ return this._token(error, buffer.slice(index, match.index), index)
2865
+ }
2866
+
2867
+ return this._token(group, text, index)
2868
+ };
2869
+
2870
+ Lexer.prototype._token = function(group, text, offset) {
2871
+ // count line breaks
2872
+ var lineBreaks = 0;
2873
+ if (group.lineBreaks) {
2874
+ var matchNL = /\n/g;
2875
+ var nl = 1;
2876
+ if (text === '\n') {
2877
+ lineBreaks = 1;
2878
+ } else {
2879
+ while (matchNL.exec(text)) { lineBreaks++; nl = matchNL.lastIndex; }
2880
+ }
2881
+ }
2882
+
2883
+ var token = {
2884
+ type: (typeof group.type === 'function' && group.type(text)) || group.defaultType,
2885
+ value: typeof group.value === 'function' ? group.value(text) : text,
2886
+ text: text,
2887
+ toString: tokenToString,
2888
+ offset: offset,
2889
+ lineBreaks: lineBreaks,
2890
+ line: this.line,
2891
+ col: this.col,
2892
+ };
2893
+ // nb. adding more props to token object will make V8 sad!
2894
+
2895
+ var size = text.length;
2896
+ this.index += size;
2897
+ this.line += lineBreaks;
2898
+ if (lineBreaks !== 0) {
2899
+ this.col = size - nl + 1;
2900
+ } else {
2901
+ this.col += size;
2902
+ }
2903
+
2904
+ // throw, if no rule with {error: true}
2905
+ if (group.shouldThrow) {
2906
+ throw new Error(this.formatError(token, "invalid syntax"))
2907
+ }
2908
+
2909
+ if (group.pop) this.popState();
2910
+ else if (group.push) this.pushState(group.push);
2911
+ else if (group.next) this.setState(group.next);
2912
+
2913
+ return token
2914
+ };
2915
+
2916
+ if (typeof Symbol !== 'undefined' && Symbol.iterator) {
2917
+ var LexerIterator = function(lexer) {
2918
+ this.lexer = lexer;
2919
+ };
2920
+
2921
+ LexerIterator.prototype.next = function() {
2922
+ var token = this.lexer.next();
2923
+ return {value: token, done: !token}
2924
+ };
2925
+
2926
+ LexerIterator.prototype[Symbol.iterator] = function() {
2927
+ return this
2928
+ };
2929
+
2930
+ Lexer.prototype[Symbol.iterator] = function() {
2931
+ return new LexerIterator(this)
2932
+ };
2933
+ }
2934
+
2935
+ Lexer.prototype.formatError = function(token, message) {
2936
+ if (token == null) {
2937
+ // An undefined token indicates EOF
2938
+ var text = this.buffer.slice(this.index);
2939
+ var token = {
2940
+ text: text,
2941
+ offset: this.index,
2942
+ lineBreaks: text.indexOf('\n') === -1 ? 0 : 1,
2943
+ line: this.line,
2944
+ col: this.col,
2945
+ };
2946
+ }
2947
+ var start = Math.max(0, token.offset - token.col + 1);
2948
+ var eol = token.lineBreaks ? token.text.indexOf('\n') : token.text.length;
2949
+ var firstLine = this.buffer.substring(start, token.offset + eol);
2950
+ message += " at line " + token.line + " col " + token.col + ":\n\n";
2951
+ message += " " + firstLine + "\n";
2952
+ message += " " + Array(token.col).join(" ") + "^";
2953
+ return message
2954
+ };
2955
+
2956
+ Lexer.prototype.clone = function() {
2957
+ return new Lexer(this.states, this.state)
2958
+ };
2959
+
2960
+ Lexer.prototype.has = function(tokenType) {
2961
+ return true
2962
+ };
2963
+
2964
+
2965
+ return {
2966
+ compile: compile,
2967
+ states: compileStates,
2968
+ error: Object.freeze({error: true}),
2969
+ fallback: Object.freeze({fallback: true}),
2970
+ keywords: keywordTransform,
2971
+ }
2972
+
2973
+ }));
2974
+ } (moo$1));
2975
+
2976
+ const moo = moo$1.exports;
2977
+
2978
+
2979
+ const digit = `[0-9]`;
2980
+ const digit19 = `[1-9]`;
2981
+ const hexdig = `[0-9a-fA-F]`;
2982
+
2983
+ // String
2984
+ const unescaped = `[\\x20-\\x21\\x23-\\x5b\\x5d-\\u{10ffff}]`;
2985
+ const escape = `\\\\`;
2986
+ const escaped = `${escape}(?:["\\/\\\\brfnt]|u${hexdig}{4})`;
2987
+ const char = `(?:${unescaped}|${escaped})`;
2988
+ const string = `"${char}*"`;
2989
+
2990
+ // Number
2991
+ const int = `(?:0|${digit19}${digit}*)`;
2992
+ const frac = `\\.${digit}+`;
2993
+ const e = `[eE]`;
2994
+ const exp = `${e}[-+]?${digit}+`;
2995
+ const number = `-?${int}(?:${frac})?(?:${exp})?`;
2996
+
2997
+ // Whitespace
2998
+ const whitespace = `(?:(?:\\r?\\n)|[ \\t])+`;
2999
+
3000
+ var lexer = (json) => {
3001
+ const lexer = moo.states({
3002
+ main: {
3003
+ WS: { match: new RegExp(whitespace, "u"), lineBreaks: true },
3004
+ true: { match: "true", value: () => true },
3005
+ false: { match: "false", value: () => false },
3006
+ null: { match: "null", value: () => null },
3007
+ number: { match: new RegExp(number, "u"), value: parseFloat },
3008
+ string: { match: new RegExp(string, "u"), value: JSON.parse },
3009
+ "{": "{",
3010
+ "}": "}",
3011
+ "[": "[",
3012
+ "]": "]",
3013
+ ":": ":",
3014
+ ",": ",",
3015
+ error: moo.error
3016
+ }
3017
+ });
3018
+ lexer.reset(json);
3019
+
3020
+ const _next = () => {
3021
+ let token;
3022
+ do {
3023
+ token = lexer.next();
3024
+ if (token?.type === "error") {
3025
+ throw SyntaxError(lexer.formatError(token, "Unrecognized token"));
3026
+ }
3027
+ } while (token?.type === "WS");
3028
+
3029
+ return token;
3030
+ };
3031
+
3032
+ let previous;
3033
+ let nextToken = _next();
3034
+
3035
+ const next = (expectedType = undefined) => {
3036
+ previous = nextToken;
3037
+ nextToken = _next();
3038
+ if (expectedType && previous?.type !== expectedType) {
3039
+ throw SyntaxError(lexer.formatError(previous, `Expected a '${expectedType}'`));
3040
+ }
3041
+ return previous;
3042
+ };
3043
+
3044
+ const peek = () => nextToken;
3045
+
3046
+ const defaultErrorToken = { offset: 0, line: 1, col: 0, text: "" };
3047
+ const syntaxError = (message) => {
3048
+ const referenceToken = previous || defaultErrorToken;
3049
+ const errorToken = {
3050
+ ...referenceToken,
3051
+ offset: referenceToken.offset + referenceToken.text.length,
3052
+ col: referenceToken.col + referenceToken.text.length
3053
+ };
3054
+ throw new SyntaxError(lexer.formatError(errorToken, message));
3055
+ };
3056
+
3057
+ return { next, peek, syntaxError };
3058
+ };
3059
+
3060
+ const JsonPointer$2 = lib$4;
3061
+ const jsonLexer = lexer;
3062
+
3063
+
3064
+ const defaultReviver = (key, value) => value;
3065
+ const parse$3 = (json, reviver = defaultReviver) => {
3066
+ const lexer = jsonLexer(json);
3067
+ const value = parseValue(lexer, "", JsonPointer$2.nil, reviver);
3068
+
3069
+ const token = lexer.peek();
3070
+ if (token) {
3071
+ lexer.syntaxError("A value has been parsed, but more tokens were found");
3072
+ }
3073
+ return value;
3074
+ };
3075
+
3076
+ const parseValue = (lexer, key, pointer, reviver) => {
3077
+ let value;
3078
+ const token = lexer.next();
3079
+ switch (token?.type) {
3080
+ case "true":
3081
+ case "false":
3082
+ case "null":
3083
+ case "number":
3084
+ case "string":
3085
+ value = token.value;
3086
+ break;
3087
+ case "{":
3088
+ value = parseObject(lexer, key, pointer, reviver);
3089
+ break;
3090
+ case "[":
3091
+ value = parseArray(lexer, key, pointer, reviver);
3092
+ break;
3093
+ default:
3094
+ lexer.syntaxError("Expected a JSON value");
3095
+ }
3096
+
3097
+ return reviver(key, value, pointer);
3098
+ };
3099
+
3100
+ const parseObject = (lexer, key, pointer, reviver) => {
3101
+ const value = {};
3102
+
3103
+ if (lexer.peek()?.type !== "}") {
3104
+ parseProperties(lexer, key, pointer, reviver, value);
3105
+ }
3106
+
3107
+ lexer.next("}");
3108
+
3109
+ return value;
3110
+ };
3111
+
3112
+ const parseProperties = (lexer, key, pointer, reviver, value) => {
3113
+ const propertyName = lexer.next("string").value;
3114
+ lexer.next(":");
3115
+ if (!isValueToken(lexer.peek())) {
3116
+ lexer.syntaxError("Expected a JSON value");
3117
+ }
3118
+ value[propertyName] = parseValue(lexer, propertyName, JsonPointer$2.append(propertyName, pointer), reviver);
3119
+
3120
+ if (lexer.peek()?.type === ",") {
3121
+ lexer.next(); // burn comma
3122
+ parseProperties(lexer, propertyName, pointer, reviver, value);
3123
+ } else if (isValueToken(lexer.peek())) {
3124
+ lexer.next(",");
3125
+ }
3126
+ };
3127
+
3128
+ const parseArray = (lexer, key, pointer, reviver) => {
3129
+ const value = [];
3130
+
3131
+ if (lexer.peek()?.type !== "]") {
3132
+ parseItems(lexer, 0, pointer, reviver, value);
3133
+ }
3134
+
3135
+ lexer.next("]");
3136
+
3137
+ return value;
3138
+ };
3139
+
3140
+ const parseItems = (lexer, key, pointer, reviver, value) => {
3141
+ if (!isValueToken(lexer.peek())) {
3142
+ lexer.syntaxError("Expected a JSON value");
3143
+ }
3144
+ value[key] = parseValue(lexer, key, JsonPointer$2.append(key, pointer), reviver);
3145
+ if (lexer.peek()?.type === ",") {
3146
+ lexer.next(); // burn comma
3147
+ parseItems(lexer, key + 1, pointer, reviver, value);
3148
+ } else if (isValueToken(lexer.peek())) {
3149
+ lexer.next(",");
3150
+ }
3151
+ };
3152
+
3153
+ const valueType = new Set(["string", "number", "true", "false", "null", "[", "{"]);
3154
+ const isValueToken = (token) => valueType.has(token?.type);
3155
+
3156
+ var parse_1 = parse$3;
3157
+
3158
+ const JsonPointer$1 = lib$4;
3159
+
3160
+
3161
+ const defaultReplacer = (key, value) => value;
3162
+ const stringify$2 = (value, replacer = defaultReplacer, space = "") => {
3163
+ return stringifyValue(value, replacer, space, "", JsonPointer$1.nil, 1);
3164
+ };
3165
+
3166
+ const stringifyValue = (value, replacer, space, key, pointer, depth) => {
3167
+ value = replacer(key, value, pointer);
3168
+ let result;
3169
+ if (Array.isArray(value)) {
3170
+ result = stringifyArray(value, replacer, space, pointer, depth);
3171
+ } else if (typeof value === "object" && value !== null) {
3172
+ result = stringifyObject(value, replacer, space, pointer, depth);
3173
+ } else {
3174
+ result = JSON.stringify(value);
3175
+ }
3176
+
3177
+ return result;
3178
+ };
3179
+
3180
+ const stringifyArray = (value, replacer, space, pointer, depth) => {
3181
+ if (value.length === 0) {
3182
+ space = "";
3183
+ }
3184
+ const padding = space ? `\n${space.repeat(depth - 1)}` : "";
3185
+ return "[" + padding + space + value
3186
+ .map((item, index) => {
3187
+ const indexPointer = JsonPointer$1.append(index, pointer);
3188
+ return stringifyValue(item, replacer, space, index, indexPointer, depth + 1);
3189
+ })
3190
+ .join(`,${padding}${space}`) + padding + "]";
3191
+ };
3192
+
3193
+ const stringifyObject = (value, replacer, space, pointer, depth) => {
3194
+ if (Object.keys(value).length === 0) {
3195
+ space = "";
3196
+ }
3197
+ const padding = space ? `\n${space.repeat(depth - 1)}` : "";
3198
+ const spacing = space ? " " : "";
3199
+ return "{" + padding + space + Object.entries(value)
3200
+ .map(([key, value]) => {
3201
+ const keyPointer = JsonPointer$1.append(key, pointer);
3202
+ return JSON.stringify(key) + ":" + spacing + stringifyValue(value, replacer, space, key, keyPointer, depth + 1);
3203
+ })
3204
+ .join(`,${padding}${space}`) + padding + "}";
3205
+ };
3206
+
3207
+ var stringify_1 = stringify$2;
3208
+
3209
+ const parse$2 = parse_1;
3210
+ const stringify$1 = stringify_1;
3211
+
3212
+
3213
+ var lib$3 = { parse: parse$2, stringify: stringify$1 };
3214
+
3215
+ var fetch_browser = fetch;
3216
+
3217
+ var contentType = {};
3218
+
3219
+ /*!
3220
+ * content-type
3221
+ * Copyright(c) 2015 Douglas Christopher Wilson
3222
+ * MIT Licensed
3223
+ */
3224
+
3225
+ /**
3226
+ * RegExp to match *( ";" parameter ) in RFC 7231 sec 3.1.1.1
3227
+ *
3228
+ * parameter = token "=" ( token / quoted-string )
3229
+ * token = 1*tchar
3230
+ * tchar = "!" / "#" / "$" / "%" / "&" / "'" / "*"
3231
+ * / "+" / "-" / "." / "^" / "_" / "`" / "|" / "~"
3232
+ * / DIGIT / ALPHA
3233
+ * ; any VCHAR, except delimiters
3234
+ * quoted-string = DQUOTE *( qdtext / quoted-pair ) DQUOTE
3235
+ * qdtext = HTAB / SP / %x21 / %x23-5B / %x5D-7E / obs-text
3236
+ * obs-text = %x80-FF
3237
+ * quoted-pair = "\" ( HTAB / SP / VCHAR / obs-text )
3238
+ */
3239
+ var PARAM_REGEXP = /; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g;
3240
+ var TEXT_REGEXP = /^[\u000b\u0020-\u007e\u0080-\u00ff]+$/;
3241
+ var TOKEN_REGEXP = /^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;
3242
+
3243
+ /**
3244
+ * RegExp to match quoted-pair in RFC 7230 sec 3.2.6
3245
+ *
3246
+ * quoted-pair = "\" ( HTAB / SP / VCHAR / obs-text )
3247
+ * obs-text = %x80-FF
3248
+ */
3249
+ var QESC_REGEXP = /\\([\u000b\u0020-\u00ff])/g;
3250
+
3251
+ /**
3252
+ * RegExp to match chars that must be quoted-pair in RFC 7230 sec 3.2.6
3253
+ */
3254
+ var QUOTE_REGEXP = /([\\"])/g;
3255
+
3256
+ /**
3257
+ * RegExp to match type in RFC 7231 sec 3.1.1.1
3258
+ *
3259
+ * media-type = type "/" subtype
3260
+ * type = token
3261
+ * subtype = token
3262
+ */
3263
+ var TYPE_REGEXP = /^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;
3264
+
3265
+ /**
3266
+ * Module exports.
3267
+ * @public
3268
+ */
3269
+
3270
+ contentType.format = format$1;
3271
+ contentType.parse = parse$1;
3272
+
3273
+ /**
3274
+ * Format object to media type.
3275
+ *
3276
+ * @param {object} obj
3277
+ * @return {string}
3278
+ * @public
3279
+ */
3280
+
3281
+ function format$1 (obj) {
3282
+ if (!obj || typeof obj !== 'object') {
3283
+ throw new TypeError('argument obj is required')
3284
+ }
3285
+
3286
+ var parameters = obj.parameters;
3287
+ var type = obj.type;
3288
+
3289
+ if (!type || !TYPE_REGEXP.test(type)) {
3290
+ throw new TypeError('invalid type')
3291
+ }
3292
+
3293
+ var string = type;
3294
+
3295
+ // append parameters
3296
+ if (parameters && typeof parameters === 'object') {
3297
+ var param;
3298
+ var params = Object.keys(parameters).sort();
3299
+
3300
+ for (var i = 0; i < params.length; i++) {
3301
+ param = params[i];
3302
+
3303
+ if (!TOKEN_REGEXP.test(param)) {
3304
+ throw new TypeError('invalid parameter name')
3305
+ }
3306
+
3307
+ string += '; ' + param + '=' + qstring(parameters[param]);
3308
+ }
3309
+ }
3310
+
3311
+ return string
3312
+ }
3313
+
3314
+ /**
3315
+ * Parse media type to object.
3316
+ *
3317
+ * @param {string|object} string
3318
+ * @return {Object}
3319
+ * @public
3320
+ */
3321
+
3322
+ function parse$1 (string) {
3323
+ if (!string) {
3324
+ throw new TypeError('argument string is required')
3325
+ }
3326
+
3327
+ // support req/res-like objects as argument
3328
+ var header = typeof string === 'object'
3329
+ ? getcontenttype(string)
3330
+ : string;
3331
+
3332
+ if (typeof header !== 'string') {
3333
+ throw new TypeError('argument string is required to be a string')
3334
+ }
3335
+
3336
+ var index = header.indexOf(';');
3337
+ var type = index !== -1
3338
+ ? header.substr(0, index).trim()
3339
+ : header.trim();
3340
+
3341
+ if (!TYPE_REGEXP.test(type)) {
3342
+ throw new TypeError('invalid media type')
3343
+ }
3344
+
3345
+ var obj = new ContentType(type.toLowerCase());
2308
3346
 
2309
3347
  // parse parameters
2310
3348
  if (index !== -1) {
@@ -2409,11 +3447,11 @@
2409
3447
  };
2410
3448
 
2411
3449
  const parse = (response) => {
2412
- const contentType = contentTypeParser.parse(response.headers.get("content-type")).type;
2413
- if (!(contentType in mediaTypePlugins)) {
2414
- throw Error(`${response.url} is not a schema. Found a document with media type: ${contentType}`);
3450
+ const contentType = contentTypeParser.parse(response.headers.get("content-type"));
3451
+ if (!(contentType.type in mediaTypePlugins)) {
3452
+ throw Error(`${response.url} is not a schema. Found a document with media type: ${contentType.type}`);
2415
3453
  }
2416
- return mediaTypePlugins[contentType].parse(response);
3454
+ return mediaTypePlugins[contentType.type].parse(response, contentType.parameters);
2417
3455
  };
2418
3456
 
2419
3457
  const getContentType = (path) => {
@@ -2428,9 +3466,10 @@
2428
3466
 
2429
3467
  var mediaTypes = { addPlugin, parse, getContentType };
2430
3468
 
2431
- const curry$1 = justCurryIt;
2432
- const Pact$a = lib$2;
2433
- const JsonPointer = lib$3;
3469
+ const curry$8 = justCurryIt$2;
3470
+ const Pact$a = lib$5;
3471
+ const Json = lib$3;
3472
+ const JsonPointer = lib$6;
2434
3473
  const { jsonTypeOf, resolveUrl: resolveUrl$1, urlFragment, pathRelative } = common$1;
2435
3474
  const fetch$1 = fetch_browser;
2436
3475
  const Reference$1 = reference;
@@ -2445,6 +3484,8 @@
2445
3484
  const dialectJsonSchemaVersion = {};
2446
3485
 
2447
3486
  const setConfig = (jsonSchemaVersion, key, value) => {
3487
+ dialectJsonSchemaVersion[jsonSchemaVersion] = jsonSchemaVersion;
3488
+
2448
3489
  if (!config[jsonSchemaVersion]) {
2449
3490
  config[jsonSchemaVersion] = {};
2450
3491
  }
@@ -2459,62 +3500,61 @@
2459
3500
  // Schema Management
2460
3501
  const schemaStore = {};
2461
3502
  const schemaStoreAlias = {};
3503
+ const add$1 = (schema, retrievalUri = "", defaultDialectId = "") => {
3504
+ const dialectId = getDialectId(schema, retrievalUri, defaultDialectId);
2462
3505
 
2463
- const add$1 = (schema, url = "", defaultSchemaVersion = "") => {
2464
- schema = JSON.parse(JSON.stringify(schema));
2465
- const externalId = resolveUrl$1(url, "");
3506
+ const id = getBaseUri(schema, retrievalUri, dialectJsonSchemaVersion[dialectId]);
2466
3507
 
2467
- // Dialect / JSON Schema Version
2468
- const dialectId = resolveUrl$1(schema["$schema"] || defaultSchemaVersion, "");
2469
- if (!dialectId) {
2470
- throw Error("Couldn't determine schema dialect");
2471
- }
2472
- delete schema["$schema"];
3508
+ // Extract embedded schemas and collect anchors
3509
+ const embeddedToken = getConfig(dialectId, "embeddedToken");
3510
+ const baseToken = getConfig(dialectId, "baseToken");
3511
+ const anchorToken = getConfig(dialectId, "anchorToken");
3512
+ const dynamicAnchorToken = getConfig(dialectId, "dynamicAnchorToken");
3513
+ const jrefToken = getConfig(dialectId, "jrefToken");
2473
3514
 
2474
- // JSON Schema version
2475
- if (!(dialectId in dialectJsonSchemaVersion)) {
2476
- if (schema?.$vocabulary?.[core201909Id] === true && dialectId === getSchemaIdentifier(schema, externalId, core201909Id)[0]) {
2477
- dialectJsonSchemaVersion[dialectId] = core201909Id;
2478
- } else if (schema?.$vocabulary?.[core202012Id] === true && dialectId === getSchemaIdentifier(schema, externalId, core202012Id)[0]) {
2479
- dialectJsonSchemaVersion[dialectId] = core202012Id;
2480
- } else if (dialectId === getSchemaIdentifier(schema, externalId, dialectId)[0]) {
2481
- dialectJsonSchemaVersion[dialectId] = dialectId;
2482
- } else if (!(dialectId in schemaStore)) {
2483
- throw Error(`Couldn't determine JSON Schema version for dialect: '${dialectId}'`);
2484
- } else {
2485
- const metaSchema = schemaStore[dialectId];
2486
- if (metaSchema.vocabulary[core201909Id] === true) {
2487
- dialectJsonSchemaVersion[dialectId] = core201909Id;
2488
- } else if (metaSchema.vocabulary[core202012Id] === true) {
2489
- dialectJsonSchemaVersion[dialectId] = core202012Id;
2490
- } else {
2491
- dialectJsonSchemaVersion[dialectId] = dialectJsonSchemaVersion[metaSchema.dialectId];
3515
+ const dynamicAnchors = {};
3516
+ const anchors = { "": "" };
3517
+
3518
+ schema = Json.parse(JSON.stringify(schema), (key, value, pointer) => {
3519
+ if (jsonTypeOf(value, "object")) {
3520
+ // Embedded Schema
3521
+ const embeddedSchemaDialectId = typeof value.$schema === "string" ? resolveUrl$1(value.$schema, "") : dialectId;
3522
+ const embeddedEmbeddedToken = getConfig(embeddedSchemaDialectId, "embeddedToken");
3523
+ const embeddedAnchorToken = getConfig(embeddedSchemaDialectId, "anchorToken");
3524
+ if (typeof value[embeddedEmbeddedToken] === "string" && (embeddedEmbeddedToken !== embeddedAnchorToken || value[embeddedEmbeddedToken][0] !== "#") && pointer !== "") {
3525
+ const embeddedRetrievalUri = resolveUrl$1(id, value[embeddedEmbeddedToken]);
3526
+ add$1(value, embeddedRetrievalUri, dialectId);
3527
+ return Reference$1.cons(value[embeddedEmbeddedToken], value);
3528
+ }
3529
+
3530
+ if (typeof value[jrefToken] === "string") {
3531
+ return Reference$1.cons(value[jrefToken], value);
3532
+ }
3533
+
3534
+ if (typeof value[anchorToken] === "string" && pointer !== JsonPointer.nil) {
3535
+ const anchor = anchorToken !== embeddedToken ? value[anchorToken] : value[anchorToken].slice(1);
3536
+ anchors[anchor] = pointer;
3537
+ delete value[anchorToken];
3538
+ }
3539
+
3540
+ if (typeof value[dynamicAnchorToken] === "string") {
3541
+ dynamicAnchors[value[dynamicAnchorToken]] = `${id}#${pointer}`;
3542
+ anchors[value[dynamicAnchorToken]] = pointer;
3543
+ delete value[dynamicAnchorToken];
2492
3544
  }
2493
3545
  }
2494
- }
2495
3546
 
2496
- // Internal Identifier
2497
- const [id, fragment] = getSchemaIdentifier(schema, externalId, dialectJsonSchemaVersion[dialectId]);
2498
- if (!id) {
2499
- throw Error("Couldn't determine an identifier for the schema");
2500
- }
2501
- const baseToken = getConfig(dialectId, "baseToken");
2502
- delete schema[baseToken];
2503
- if (externalId) {
2504
- schemaStoreAlias[externalId] = id;
2505
- }
3547
+ return value;
3548
+ });
3549
+ console.log(embeddedIds);
2506
3550
 
2507
- const anchorToken = getConfig(dialectId, "anchorToken");
2508
- if (fragment && baseToken === anchorToken) {
2509
- schema[anchorToken] = anchorToken !== baseToken ? encodeURI(fragment) : `#${encodeURI(fragment)}`;
2510
- }
3551
+ delete schema.$schema;
3552
+ delete schema[baseToken];
2511
3553
 
2512
3554
  // recursiveAnchor
2513
- const dynamicAnchors = {};
2514
3555
  const recursiveAnchorToken = getConfig(dialectId, "recursiveAnchorToken");
2515
3556
  if (schema[recursiveAnchorToken] === true) {
2516
3557
  dynamicAnchors[""] = `${id}#`;
2517
- schema[anchorToken] = "";
2518
3558
  delete schema[recursiveAnchorToken];
2519
3559
  }
2520
3560
 
@@ -2529,69 +3569,66 @@
2529
3569
  }
2530
3570
 
2531
3571
  // Store Schema
2532
- const anchors = { "": "" };
2533
3572
  schemaStore[id] = {
2534
- id: id,
2535
- dialectId: dialectId,
2536
- schema: processSchema(schema, id, dialectId, JsonPointer.nil, anchors, dynamicAnchors),
2537
- anchors: anchors,
2538
- dynamicAnchors: dynamicAnchors,
2539
- vocabulary: vocabulary,
3573
+ id,
3574
+ dialectId,
3575
+ schema,
3576
+ anchors,
3577
+ dynamicAnchors,
3578
+ vocabulary,
2540
3579
  validated: false
2541
3580
  };
3581
+ if (id === "https://example.com/schema/root") {
3582
+ console.log(Object.keys(schemaStore).filter((id) => !/json-schema\.org/.test(id)));
3583
+ }
2542
3584
 
2543
- return id;
3585
+ if (retrievalUri) {
3586
+ schemaStoreAlias[resolveUrl$1(retrievalUri, "")] = id;
3587
+ }
2544
3588
  };
2545
3589
 
2546
- const getSchemaIdentifier = (schema, externalId, jsonSchemaVersion) => {
2547
- const baseToken = config[jsonSchemaVersion]?.["baseToken"];
2548
- const internalUrl = resolveUrl$1(externalId, schema[baseToken] || "");
2549
- return [resolveUrl$1(internalUrl, ""), urlFragment(internalUrl)];
2550
- };
2551
-
2552
- const processSchema = (subject, id, dialectId, pointer, anchors, dynamicAnchors) => {
2553
- if (jsonTypeOf(subject, "object")) {
2554
- const embeddedSchemaDialectId = typeof subject.$schema === "string" ? resolveUrl$1(subject.$schema, "") : dialectId;
2555
- const embeddedEmbeddedToken = getConfig(embeddedSchemaDialectId, "embeddedToken");
2556
- const embeddedAnchorToken = getConfig(embeddedSchemaDialectId, "anchorToken");
2557
- if (typeof subject[embeddedEmbeddedToken] === "string" && (embeddedEmbeddedToken !== embeddedAnchorToken || subject[embeddedEmbeddedToken][0] !== "#")) {
2558
- const ref = resolveUrl$1(id, subject[embeddedEmbeddedToken]);
2559
- const embeddedBaseToken = getConfig(embeddedSchemaDialectId, "baseToken");
2560
- subject[embeddedBaseToken] = ref;
2561
- add$1(subject, ref, dialectId);
2562
- return Reference$1.cons(subject[embeddedEmbeddedToken], subject);
2563
- }
2564
-
2565
- const anchorToken = getConfig(dialectId, "anchorToken");
2566
- const dynamicAnchorToken = getConfig(dialectId, "dynamicAnchorToken");
2567
- if (typeof subject[dynamicAnchorToken] === "string") {
2568
- dynamicAnchors[subject[dynamicAnchorToken]] = `${id}#${encodeURI(pointer)}`;
2569
- anchors[subject[dynamicAnchorToken]] = pointer;
2570
- delete subject[dynamicAnchorToken];
2571
- }
2572
-
2573
- const embeddedToken = getConfig(dialectId, "embeddedToken");
2574
- if (typeof subject[anchorToken] === "string") {
2575
- const anchor = anchorToken !== embeddedToken ? subject[anchorToken] : subject[anchorToken].slice(1);
2576
- anchors[anchor] = pointer;
2577
- delete subject[anchorToken];
2578
- }
3590
+ const getDialectId = (schema, retrievalUri, defaultDialectId) => {
3591
+ const dialectId = resolveUrl$1(schema.$schema || defaultDialectId, "");
3592
+ if (!dialectId) {
3593
+ throw Error("Couldn't determine schema dialect");
3594
+ }
2579
3595
 
2580
- const jrefToken = getConfig(dialectId, "jrefToken");
2581
- if (typeof subject[jrefToken] === "string") {
2582
- return Reference$1.cons(subject[jrefToken], subject);
3596
+ // Determine JSON Schema version
3597
+ if (!(dialectId in dialectJsonSchemaVersion)) {
3598
+ if (schema?.$vocabulary?.[core201909Id] === true && dialectId === getBaseUri(schema, retrievalUri, core201909Id)) {
3599
+ // Self describing 2019-09 meta-schema
3600
+ dialectJsonSchemaVersion[dialectId] = core201909Id;
3601
+ } else if (schema?.$vocabulary?.[core202012Id] === true && dialectId === getBaseUri(schema, retrievalUri, core202012Id)) {
3602
+ // Self describing 2020-12 meta-schema
3603
+ dialectJsonSchemaVersion[dialectId] = core202012Id;
3604
+ } else {
3605
+ // Need to look at meta-schema to determine version
3606
+ const metaSchema = schemaStore[dialectId];
3607
+ if (!metaSchema) {
3608
+ throw Error(`Couldn't determine JSON Schema version for dialect: '${dialectId}'`);
3609
+ } else if (metaSchema.vocabulary[core201909Id] === true) {
3610
+ dialectJsonSchemaVersion[dialectId] = core201909Id;
3611
+ } else if (metaSchema.vocabulary[core202012Id] === true) {
3612
+ dialectJsonSchemaVersion[dialectId] = core202012Id;
3613
+ } else {
3614
+ // Assume the jsonSchemaVersion is the meta-schema's dialectId (non-standard behavior)
3615
+ dialectJsonSchemaVersion[dialectId] = dialectJsonSchemaVersion[metaSchema.dialectId];
3616
+ }
2583
3617
  }
3618
+ }
2584
3619
 
2585
- for (const key in subject) {
2586
- subject[key] = processSchema(subject[key], id, dialectId, JsonPointer.append(key, pointer), anchors, dynamicAnchors);
2587
- }
3620
+ return dialectId;
3621
+ };
2588
3622
 
2589
- return subject;
2590
- } else if (Array.isArray(subject)) {
2591
- return subject.map((item, ndx) => processSchema(item, id, dialectId, JsonPointer.append(ndx, pointer), anchors, dynamicAnchors));
2592
- } else {
2593
- return subject;
3623
+ const getBaseUri = (schema, retrievalUri, jsonSchemaVersion) => {
3624
+ const baseToken = config[jsonSchemaVersion]?.["baseToken"];
3625
+ const relativeBaseUri = typeof schema[baseToken] === "string" ? schema[baseToken] : "";
3626
+ const baseUri = resolveUrl$1(resolveUrl$1(retrievalUri, relativeBaseUri), "");
3627
+ if (!baseUri) {
3628
+ throw Error("Couldn't determine an identifier for the schema");
2594
3629
  }
3630
+
3631
+ return baseUri;
2595
3632
  };
2596
3633
 
2597
3634
  const hasStoredSchema = (id) => id in schemaStore || id in schemaStoreAlias;
@@ -2626,7 +3663,23 @@
2626
3663
  throw Error(`Failed to retrieve schema with id: ${id}`);
2627
3664
  }
2628
3665
 
2629
- add$1(await MediaTypes$1.parse(response), id);
3666
+ const [schema, defaultDialectId] = await MediaTypes$1.parse(response);
3667
+
3668
+ let dialectId;
3669
+ if (schema.$schema) {
3670
+ dialectId = resolveUrl$1(schema.$schema, "");
3671
+ } else if (defaultDialectId) {
3672
+ dialectId = resolveUrl$1(id, defaultDialectId);
3673
+ } else {
3674
+ dialectId = "";
3675
+ }
3676
+
3677
+ // Make sure the meta-schema is loaded if this isn't a known dialect
3678
+ if (dialectId && id !== dialectId && !(dialectId in dialectJsonSchemaVersion)) {
3679
+ await get(dialectId);
3680
+ }
3681
+
3682
+ add$1(schema, id, dialectId);
2630
3683
  }
2631
3684
 
2632
3685
  const storedSchema = getStoredSchema(id);
@@ -2669,14 +3722,14 @@
2669
3722
 
2670
3723
  const keys = (doc) => Object.keys(value(doc));
2671
3724
 
2672
- const entries = (doc) => Pact$a.pipeline([
3725
+ const entries$2 = (doc) => Pact$a.pipeline([
2673
3726
  value,
2674
3727
  Object.keys,
2675
3728
  Pact$a.map(async (key) => [key, await step(key, doc)]),
2676
3729
  Pact$a.all
2677
3730
  ], doc);
2678
3731
 
2679
- const map = curry$1((fn, doc) => Pact$a.pipeline([
3732
+ const map$3 = curry$8((fn, doc) => Pact$a.pipeline([
2680
3733
  value,
2681
3734
  Pact$a.map(async (item, ndx) => fn(await step(ndx, doc), ndx)),
2682
3735
  Pact$a.all
@@ -2692,41 +3745,43 @@
2692
3745
  const toSchema = (schemaDoc, options = {}) => {
2693
3746
  const fullOptions = { ...toSchemaDefaultOptions, ...options };
2694
3747
 
2695
- const schema = JSON.parse(JSON.stringify(schemaDoc.schema, (key, value) => {
2696
- if (!Reference$1.isReference(value)) {
2697
- return value;
3748
+ const anchorToken = getConfig(schemaDoc.dialectId, "anchorToken");
3749
+ const dynamicAnchorToken = getConfig(schemaDoc.dialectId, "dynamicAnchorToken");
3750
+
3751
+ const anchors = {};
3752
+ for (const anchor in schemaDoc.anchors) {
3753
+ if (anchor !== "" && !schemaDoc.dynamicAnchors[anchor]) {
3754
+ anchors[schemaDoc.anchors[anchor]] = anchor;
2698
3755
  }
3756
+ }
3757
+
3758
+ const dynamicAnchors = {};
3759
+ for (const anchor in schemaDoc.dynamicAnchors) {
3760
+ const pointer = urlFragment(schemaDoc.dynamicAnchors[anchor]);
3761
+ dynamicAnchors[pointer] = anchor;
3762
+ }
2699
3763
 
2700
- const refValue = Reference$1.value(value);
2701
- const embeddedDialect = typeof refValue.$schema === "string" ? resolveUrl$1(refValue.$schema, "") : schemaDoc.dialectId;
2702
- const embeddedToken = getConfig(embeddedDialect, "embeddedToken");
2703
- if (!fullOptions.includeEmbedded && embeddedToken in refValue) {
2704
- return;
3764
+ const schema = JSON.parse(Json.stringify(schemaDoc.schema, (key, value, pointer) => {
3765
+ if (Reference$1.isReference(value)) {
3766
+ const refValue = Reference$1.value(value);
3767
+ const embeddedDialect = typeof refValue.$schema === "string" ? resolveUrl$1(refValue.$schema, "") : schemaDoc.dialectId;
3768
+ const embeddedToken = getConfig(embeddedDialect, "embeddedToken");
3769
+ if (!fullOptions.includeEmbedded && embeddedToken in refValue) {
3770
+ return;
3771
+ } else {
3772
+ return Reference$1.value(value);
3773
+ }
2705
3774
  } else {
2706
- return Reference$1.value(value);
3775
+ if (pointer in anchors) {
3776
+ value = { [anchorToken]: anchors[pointer], ...value };
3777
+ }
3778
+ if (pointer in dynamicAnchors) {
3779
+ value = { [dynamicAnchorToken]: dynamicAnchors[pointer], ...value };
3780
+ }
3781
+ return value;
2707
3782
  }
2708
3783
  }));
2709
3784
 
2710
- const dynamicAnchorToken = getConfig(schemaDoc.dialectId, "dynamicAnchorToken");
2711
- Object.entries(schemaDoc.dynamicAnchors)
2712
- .forEach(([anchor, uri]) => {
2713
- const pointer = urlFragment(uri);
2714
- JsonPointer.assign(pointer, schema, {
2715
- [dynamicAnchorToken]: anchor,
2716
- ...JsonPointer.get(pointer, schema)
2717
- });
2718
- });
2719
-
2720
- const anchorToken = getConfig(schemaDoc.dialectId, "anchorToken");
2721
- Object.entries(schemaDoc.anchors)
2722
- .filter(([anchor]) => anchor !== "")
2723
- .forEach(([anchor, pointer]) => {
2724
- JsonPointer.assign(pointer, schema, {
2725
- [anchorToken]: anchor,
2726
- ...JsonPointer.get(pointer, schema)
2727
- });
2728
- });
2729
-
2730
3785
  const baseToken = getConfig(schemaDoc.dialectId, "baseToken");
2731
3786
  const id = relativeUri(fullOptions.parentId, schemaDoc.id);
2732
3787
  const dialect = fullOptions.parentDialect === schemaDoc.dialectId ? "" : schemaDoc.dialectId;
@@ -2749,7 +3804,7 @@
2749
3804
  var schema$5 = {
2750
3805
  setConfig, getConfig,
2751
3806
  add: add$1, get, markValidated,
2752
- uri, value, getAnchorPointer, typeOf, has, step, keys, entries, map, length,
3807
+ uri, value, getAnchorPointer, typeOf, has, step, keys, entries: entries$2, map: map$3, length,
2753
3808
  toSchema
2754
3809
  };
2755
3810
 
@@ -2763,13 +3818,22 @@
2763
3818
 
2764
3819
  var invalidSchemaError = InvalidSchemaError$3;
2765
3820
 
2766
- const curry = justCurryIt;
3821
+ const Schema$R = schema$5;
3822
+
3823
+
3824
+ const compile$O = (schema) => Schema$R.value(schema);
3825
+ const interpret$O = () => true;
3826
+
3827
+ var metaData$4 = { compile: compile$O, interpret: interpret$O };
3828
+
3829
+ const curry$7 = justCurryIt$2;
2767
3830
  const PubSub$1 = pubsub.exports;
2768
3831
  const { resolveUrl } = common$1;
2769
3832
  const Instance$E = instance;
2770
- const Schema$R = schema$5;
3833
+ const Schema$Q = schema$5;
2771
3834
  const InvalidSchemaError$2 = invalidSchemaError;
2772
3835
  const MediaTypes = mediaTypes;
3836
+ const metaData$3 = metaData$4;
2773
3837
 
2774
3838
 
2775
3839
  const FLAG = "FLAG", BASIC = "BASIC", DETAILED = "DETAILED", VERBOSE = "VERBOSE";
@@ -2778,24 +3842,27 @@
2778
3842
  let shouldMetaValidate = true;
2779
3843
 
2780
3844
  MediaTypes.addPlugin("application/schema+json", {
2781
- parse: async (response) => await response.json(),
3845
+ parse: async (response, contentTypeParameters) => [
3846
+ await response.json(),
3847
+ contentTypeParameters.schema || contentTypeParameters.profile
3848
+ ],
2782
3849
  matcher: (path) => path.endsWith(".schema.json")
2783
3850
  });
2784
3851
 
2785
3852
  const validate$2 = async (schema, value = undefined, outputFormat = undefined) => {
2786
- const compiled = await compile$O(schema);
2787
- const interpretAst = (value, outputFormat) => interpret$O(compiled, Instance$E.cons(value), outputFormat);
3853
+ const compiled = await compile$N(schema);
3854
+ const interpretAst = (value, outputFormat) => interpret$N(compiled, Instance$E.cons(value), outputFormat);
2788
3855
 
2789
3856
  return value === undefined ? interpretAst : interpretAst(value, outputFormat);
2790
3857
  };
2791
3858
 
2792
- const compile$O = async (schema) => {
3859
+ const compile$N = async (schema) => {
2793
3860
  const ast = { metaData: {} };
2794
3861
  const schemaUri = await compileSchema(schema, ast);
2795
3862
  return { ast, schemaUri };
2796
3863
  };
2797
3864
 
2798
- const interpret$O = curry(({ ast, schemaUri }, value, outputFormat = FLAG) => {
3865
+ const interpret$N = curry$7(({ ast, schemaUri }, value, outputFormat = FLAG) => {
2799
3866
  if (![FLAG, BASIC, DETAILED, VERBOSE].includes(outputFormat)) {
2800
3867
  throw Error(`The '${outputFormat}' error format is not supported`);
2801
3868
  }
@@ -2849,7 +3916,7 @@
2849
3916
  };
2850
3917
 
2851
3918
  const _keywords = {};
2852
- const getKeyword = (id) => _keywords[id];
3919
+ const getKeyword = (id) => _keywords[id] || metaData$3;
2853
3920
  const hasKeyword = (id) => id in _keywords;
2854
3921
  const addKeyword = (id, keywordHandler) => {
2855
3922
  _keywords[id] = {
@@ -2870,10 +3937,10 @@
2870
3937
 
2871
3938
  // Vocabularies
2872
3939
  if (!hasKeyword(`${schema.dialectId}#validate`)) {
2873
- const metaSchema = await Schema$R.get(schema.dialectId);
3940
+ const metaSchema = await Schema$Q.get(schema.dialectId);
2874
3941
 
2875
3942
  // Check for mandatory vocabularies
2876
- const mandatoryVocabularies = Schema$R.getConfig(metaSchema.id, "mandatoryVocabularies") || [];
3943
+ const mandatoryVocabularies = Schema$Q.getConfig(metaSchema.id, "mandatoryVocabularies") || [];
2877
3944
  mandatoryVocabularies.forEach((vocabularyId) => {
2878
3945
  if (!metaSchema.vocabulary[vocabularyId]) {
2879
3946
  throw Error(`Vocabulary '${vocabularyId}' must be explicitly declared and required`);
@@ -2896,13 +3963,13 @@
2896
3963
 
2897
3964
  // Meta validation
2898
3965
  if (shouldMetaValidate && !schema.validated) {
2899
- Schema$R.markValidated(schema.id);
3966
+ Schema$Q.markValidated(schema.id);
2900
3967
 
2901
3968
  // Compile
2902
3969
  if (!(schema.dialectId in metaValidators)) {
2903
- const metaSchema = await Schema$R.get(schema.dialectId);
2904
- const compiledSchema = await compile$O(metaSchema);
2905
- metaValidators[metaSchema.id] = interpret$O(compiledSchema);
3970
+ const metaSchema = await Schema$Q.get(schema.dialectId);
3971
+ const compiledSchema = await compile$N(metaSchema);
3972
+ metaValidators[metaSchema.id] = interpret$N(compiledSchema);
2906
3973
  }
2907
3974
 
2908
3975
  // Interpret
@@ -2925,7 +3992,7 @@
2925
3992
  };
2926
3993
 
2927
3994
  const followReferences = async (doc) => {
2928
- return Schema$R.typeOf(doc, "string") ? followReferences(await Schema$R.get(Schema$R.value(doc), doc)) : doc;
3995
+ return Schema$Q.typeOf(doc, "string") ? followReferences(await Schema$Q.get(Schema$Q.value(doc), doc)) : doc;
2929
3996
  };
2930
3997
 
2931
3998
  const interpretSchema = (schemaUri, instance, ast, dynamicAnchors) => {
@@ -2953,27 +4020,19 @@
2953
4020
  };
2954
4021
 
2955
4022
  const add = (schema, url = "", defaultSchemaVersion = "") => {
2956
- const id = Schema$R.add(schema, url, defaultSchemaVersion);
4023
+ const id = Schema$Q.add(schema, url, defaultSchemaVersion);
2957
4024
  delete metaValidators[id];
2958
4025
  };
2959
4026
 
2960
4027
  var core$2 = {
2961
- validate: validate$2, compile: compile$O, interpret: interpret$O,
4028
+ validate: validate$2, compile: compile$N, interpret: interpret$N,
2962
4029
  setMetaOutputFormat, setShouldMetaValidate, FLAG, BASIC, DETAILED, VERBOSE,
2963
4030
  add, getKeyword, hasKeyword, defineVocabulary,
2964
4031
  compileSchema, interpretSchema, collectEvaluatedProperties: collectEvaluatedProperties$e, collectEvaluatedItems: collectEvaluatedItems$f,
2965
4032
  addMediaTypePlugin: MediaTypes.addPlugin
2966
4033
  };
2967
4034
 
2968
- const Schema$Q = schema$5;
2969
-
2970
-
2971
- const compile$N = (schema) => Schema$Q.value(schema);
2972
- const interpret$N = () => true;
2973
-
2974
- var metaData$3 = { compile: compile$N, interpret: interpret$N };
2975
-
2976
- const Pact$9 = lib$2;
4035
+ const Pact$9 = lib$5;
2977
4036
  const PubSub = pubsub.exports;
2978
4037
  const Core$x = core$2;
2979
4038
  const Instance$D = instance;
@@ -2996,7 +4055,7 @@
2996
4055
  typeof schemaValue === "boolean" ? schemaValue : await Pact$9.pipeline([
2997
4056
  Schema$P.entries,
2998
4057
  Pact$9.map(([keyword, keywordSchema]) => [`${schema.dialectId}#${keyword}`, keywordSchema]),
2999
- Pact$9.filter(([keywordId]) => Core$x.hasKeyword(keywordId) && keywordId !== `${schema.dialectId}#validate`),
4058
+ Pact$9.filter(([keywordId]) => keywordId !== `${schema.dialectId}#validate`),
3000
4059
  Pact$9.map(async ([keywordId, keywordSchema]) => {
3001
4060
  const keywordAst = await Core$x.getKeyword(keywordId).compile(keywordSchema, ast, schema);
3002
4061
  return [keywordId, Schema$P.uri(keywordSchema), keywordAst];
@@ -3072,7 +4131,7 @@
3072
4131
 
3073
4132
  var validate$1 = { compile: compile$M, interpret: interpret$M, collectEvaluatedProperties: collectEvaluatedProperties$d, collectEvaluatedItems: collectEvaluatedItems$e };
3074
4133
 
3075
- const metaData$2 = metaData$3;
4134
+ const metaData$2 = metaData$4;
3076
4135
  const validate = validate$1;
3077
4136
 
3078
4137
 
@@ -3086,9 +4145,9 @@
3086
4145
  const InvalidSchemaError$1 = invalidSchemaError;
3087
4146
 
3088
4147
 
3089
- var lib$1 = { Core: Core$w, Schema: Schema$O, Instance: Instance$C, Reference, Keywords: Keywords$2, InvalidSchemaError: InvalidSchemaError$1 };
4148
+ var lib$2 = { Core: Core$w, Schema: Schema$O, Instance: Instance$C, Reference, Keywords: Keywords$2, InvalidSchemaError: InvalidSchemaError$1 };
3090
4149
 
3091
- const { Core: Core$v, Schema: Schema$N, Instance: Instance$B } = lib$1;
4150
+ const { Core: Core$v, Schema: Schema$N, Instance: Instance$B } = lib$2;
3092
4151
 
3093
4152
 
3094
4153
  const compile$L = async (schema, ast, parentSchema) => {
@@ -3116,7 +4175,7 @@
3116
4175
 
3117
4176
  var additionalItems = { compile: compile$L, interpret: interpret$L };
3118
4177
 
3119
- const { Core: Core$u, Schema: Schema$M, Instance: Instance$A } = lib$1;
4178
+ const { Core: Core$u, Schema: Schema$M, Instance: Instance$A } = lib$2;
3120
4179
 
3121
4180
 
3122
4181
  const compile$K = async (schema, ast, parentSchema) => {
@@ -3140,7 +4199,7 @@
3140
4199
 
3141
4200
  var additionalItems6 = { compile: compile$K, interpret: interpret$K, collectEvaluatedItems: collectEvaluatedItems$d };
3142
4201
 
3143
- const { Core: Core$t, Schema: Schema$L, Instance: Instance$z } = lib$1;
4202
+ const { Core: Core$t, Schema: Schema$L, Instance: Instance$z } = lib$2;
3144
4203
 
3145
4204
 
3146
4205
  const compile$J = async (schema, ast, parentSchema) => {
@@ -3174,7 +4233,7 @@
3174
4233
 
3175
4234
  var additionalProperties = { compile: compile$J, interpret: interpret$J };
3176
4235
 
3177
- const { Core: Core$s, Schema: Schema$K, Instance: Instance$y } = lib$1;
4236
+ const { Core: Core$s, Schema: Schema$K, Instance: Instance$y } = lib$2;
3178
4237
 
3179
4238
 
3180
4239
  const compile$I = async (schema, ast, parentSchema) => {
@@ -3203,8 +4262,129 @@
3203
4262
 
3204
4263
  var additionalProperties6 = { compile: compile$I, interpret: interpret$I, collectEvaluatedProperties: collectEvaluatedProperties$c };
3205
4264
 
3206
- const { Core: Core$r, Schema: Schema$J } = lib$1;
3207
- const Pact$8 = lib$2;
4265
+ var entries$1 = async (doc) => Object.entries(await doc);
4266
+
4267
+ var justCurryIt = curry$6;
4268
+
4269
+ /*
4270
+ function add(a, b, c) {
4271
+ return a + b + c;
4272
+ }
4273
+ curry(add)(1)(2)(3); // 6
4274
+ curry(add)(1)(2)(2); // 5
4275
+ curry(add)(2)(4, 3); // 9
4276
+
4277
+ function add(...args) {
4278
+ return args.reduce((sum, n) => sum + n, 0)
4279
+ }
4280
+ var curryAdd4 = curry(add, 4)
4281
+ curryAdd4(1)(2, 3)(4); // 10
4282
+
4283
+ function converter(ratio, input) {
4284
+ return (input*ratio).toFixed(1);
4285
+ }
4286
+ const curriedConverter = curry(converter)
4287
+ const milesToKm = curriedConverter(1.62);
4288
+ milesToKm(35); // 56.7
4289
+ milesToKm(10); // 16.2
4290
+ */
4291
+
4292
+ function curry$6(fn, arity) {
4293
+ return function curried() {
4294
+ if (arity == null) {
4295
+ arity = fn.length;
4296
+ }
4297
+ var args = [].slice.call(arguments);
4298
+ if (args.length >= arity) {
4299
+ return fn.apply(this, args);
4300
+ } else {
4301
+ return function() {
4302
+ return curried.apply(this, args.concat([].slice.call(arguments)));
4303
+ };
4304
+ }
4305
+ };
4306
+ }
4307
+
4308
+ const curry$5 = justCurryIt;
4309
+
4310
+
4311
+ var map$2 = curry$5(async (fn, doc) => (await doc).map(fn));
4312
+
4313
+ const curry$4 = justCurryIt;
4314
+
4315
+
4316
+ var reduce$2 = curry$4(async (fn, acc, doc) => {
4317
+ return (await doc).reduce(async (acc, item) => fn(await acc, item), acc);
4318
+ });
4319
+
4320
+ const curry$3 = justCurryIt;
4321
+ const reduce$1 = reduce$2;
4322
+
4323
+
4324
+ var filter = curry$3(async (fn, doc, options = {}) => {
4325
+ return reduce$1(async (acc, item) => {
4326
+ return (await fn(item)) ? acc.concat([item]) : acc;
4327
+ }, [], doc, options);
4328
+ });
4329
+
4330
+ const curry$2 = justCurryIt;
4331
+ const map$1 = map$2;
4332
+
4333
+
4334
+ var some = curry$2(async (fn, doc) => {
4335
+ const results = await map$1(fn, doc);
4336
+ return (await Promise.all(results))
4337
+ .some((a) => a);
4338
+ });
4339
+
4340
+ const curry$1 = justCurryIt;
4341
+ const map = map$2;
4342
+
4343
+
4344
+ var every = curry$1(async (fn, doc) => {
4345
+ const results = await map(fn, doc);
4346
+ return (await Promise.all(results))
4347
+ .every((a) => a);
4348
+ });
4349
+
4350
+ const curry = justCurryIt;
4351
+
4352
+
4353
+ var pipeline$1 = curry((fns, doc) => {
4354
+ return fns.reduce(async (acc, fn) => fn(await acc), doc);
4355
+ });
4356
+
4357
+ var all = (doc) => Promise.all(doc);
4358
+
4359
+ const pipeline = pipeline$1;
4360
+ const entries = entries$1;
4361
+ const reduce = reduce$2;
4362
+
4363
+
4364
+ var allValues = (doc) => {
4365
+ return pipeline([
4366
+ entries,
4367
+ reduce(async (acc, [propertyName, propertyValue]) => {
4368
+ acc[propertyName] = await propertyValue;
4369
+ return acc;
4370
+ }, {})
4371
+ ], doc);
4372
+ };
4373
+
4374
+ var lib$1 = {
4375
+ entries: entries$1,
4376
+ map: map$2,
4377
+ filter: filter,
4378
+ reduce: reduce$2,
4379
+ some: some,
4380
+ every: every,
4381
+ pipeline: pipeline$1,
4382
+ all: all,
4383
+ allValues: allValues
4384
+ };
4385
+
4386
+ const { Core: Core$r, Schema: Schema$J } = lib$2;
4387
+ const Pact$8 = lib$1;
3208
4388
 
3209
4389
 
3210
4390
  const compile$H = (schema, ast) => Pact$8.pipeline([
@@ -3232,8 +4412,8 @@
3232
4412
 
3233
4413
  var allOf = { compile: compile$H, interpret: interpret$H, collectEvaluatedProperties: collectEvaluatedProperties$b, collectEvaluatedItems: collectEvaluatedItems$c };
3234
4414
 
3235
- const { Core: Core$q, Schema: Schema$I } = lib$1;
3236
- const Pact$7 = lib$2;
4415
+ const { Core: Core$q, Schema: Schema$I } = lib$2;
4416
+ const Pact$7 = lib$1;
3237
4417
 
3238
4418
 
3239
4419
  const compile$G = (schema, ast) => Pact$7.pipeline([
@@ -3321,7 +4501,7 @@
3321
4501
 
3322
4502
  var fastestStableStringify = function(obj) { return '' + stringify(obj, false); };
3323
4503
 
3324
- const { Schema: Schema$H, Instance: Instance$x } = lib$1;
4504
+ const { Schema: Schema$H, Instance: Instance$x } = lib$2;
3325
4505
  const jsonStringify$2 = fastestStableStringify;
3326
4506
 
3327
4507
 
@@ -3330,7 +4510,7 @@
3330
4510
 
3331
4511
  var _const = { compile: compile$F, interpret: interpret$F };
3332
4512
 
3333
- const { Core: Core$p, Instance: Instance$w } = lib$1;
4513
+ const { Core: Core$p, Instance: Instance$w } = lib$2;
3334
4514
 
3335
4515
 
3336
4516
  const compile$E = (schema, ast) => Core$p.compileSchema(schema, ast);
@@ -3341,7 +4521,7 @@
3341
4521
 
3342
4522
  var contains = { compile: compile$E, interpret: interpret$E };
3343
4523
 
3344
- const { Core: Core$o, Schema: Schema$G, Instance: Instance$v } = lib$1;
4524
+ const { Core: Core$o, Schema: Schema$G, Instance: Instance$v } = lib$2;
3345
4525
 
3346
4526
 
3347
4527
  const compile$D = async (schema, ast, parentSchema) => {
@@ -3375,8 +4555,8 @@
3375
4555
 
3376
4556
  var containsMinContainsMaxContains = { compile: compile$D, interpret: interpret$D, collectEvaluatedItems: collectEvaluatedItems$a };
3377
4557
 
3378
- const { Core: Core$n, Schema: Schema$F } = lib$1;
3379
- const Pact$6 = lib$2;
4558
+ const { Core: Core$n, Schema: Schema$F } = lib$2;
4559
+ const Pact$6 = lib$1;
3380
4560
 
3381
4561
 
3382
4562
  const compile$C = async (schema, ast) => {
@@ -3391,8 +4571,8 @@
3391
4571
 
3392
4572
  var definitions = { compile: compile$C, interpret: interpret$C };
3393
4573
 
3394
- const { Core: Core$m, Schema: Schema$E, Instance: Instance$u } = lib$1;
3395
- const Pact$5 = lib$2;
4574
+ const { Core: Core$m, Schema: Schema$E, Instance: Instance$u } = lib$2;
4575
+ const Pact$5 = lib$1;
3396
4576
 
3397
4577
 
3398
4578
  const compile$B = (schema, ast) => Pact$5.pipeline([
@@ -3421,8 +4601,8 @@
3421
4601
 
3422
4602
  var dependencies = { compile: compile$B, interpret: interpret$B };
3423
4603
 
3424
- const { Schema: Schema$D, Instance: Instance$t } = lib$1;
3425
- const Pact$4 = lib$2;
4604
+ const { Schema: Schema$D, Instance: Instance$t } = lib$2;
4605
+ const Pact$4 = lib$1;
3426
4606
 
3427
4607
 
3428
4608
  const compile$A = (schema) => Pact$4.pipeline([
@@ -3441,8 +4621,8 @@
3441
4621
 
3442
4622
  var dependentRequired = { compile: compile$A, interpret: interpret$A };
3443
4623
 
3444
- const { Core: Core$l, Schema: Schema$C, Instance: Instance$s } = lib$1;
3445
- const Pact$3 = lib$2;
4624
+ const { Core: Core$l, Schema: Schema$C, Instance: Instance$s } = lib$2;
4625
+ const Pact$3 = lib$1;
3446
4626
 
3447
4627
 
3448
4628
  const compile$z = (schema, ast) => Pact$3.pipeline([
@@ -3472,7 +4652,7 @@
3472
4652
 
3473
4653
  var dependentSchemas = { compile: compile$z, interpret: interpret$z, collectEvaluatedProperties: collectEvaluatedProperties$9 };
3474
4654
 
3475
- const { Schema: Schema$B, Instance: Instance$r } = lib$1;
4655
+ const { Schema: Schema$B, Instance: Instance$r } = lib$2;
3476
4656
  const jsonStringify$1 = fastestStableStringify;
3477
4657
 
3478
4658
 
@@ -3481,7 +4661,7 @@
3481
4661
 
3482
4662
  var _enum = { compile: compile$y, interpret: interpret$y };
3483
4663
 
3484
- const { Schema: Schema$A, Instance: Instance$q } = lib$1;
4664
+ const { Schema: Schema$A, Instance: Instance$q } = lib$2;
3485
4665
 
3486
4666
 
3487
4667
  const compile$x = async (schema) => Schema$A.value(schema);
@@ -3489,7 +4669,7 @@
3489
4669
 
3490
4670
  var exclusiveMaximum = { compile: compile$x, interpret: interpret$x };
3491
4671
 
3492
- const { Schema: Schema$z, Instance: Instance$p } = lib$1;
4672
+ const { Schema: Schema$z, Instance: Instance$p } = lib$2;
3493
4673
 
3494
4674
 
3495
4675
  const compile$w = async (schema) => Schema$z.value(schema);
@@ -3497,7 +4677,7 @@
3497
4677
 
3498
4678
  var exclusiveMinimum = { compile: compile$w, interpret: interpret$w };
3499
4679
 
3500
- const { Core: Core$k } = lib$1;
4680
+ const { Core: Core$k } = lib$2;
3501
4681
 
3502
4682
 
3503
4683
  const compile$v = (schema, ast) => Core$k.compileSchema(schema, ast);
@@ -3517,7 +4697,7 @@
3517
4697
 
3518
4698
  var _if = { compile: compile$v, interpret: interpret$v, collectEvaluatedProperties: collectEvaluatedProperties$8, collectEvaluatedItems: collectEvaluatedItems$9 };
3519
4699
 
3520
- const { Core: Core$j, Schema: Schema$y } = lib$1;
4700
+ const { Core: Core$j, Schema: Schema$y } = lib$2;
3521
4701
 
3522
4702
 
3523
4703
  const compile$u = async (schema, ast, parentSchema) => {
@@ -3561,7 +4741,7 @@
3561
4741
 
3562
4742
  var then = { compile: compile$u, interpret: interpret$u, collectEvaluatedProperties: collectEvaluatedProperties$7, collectEvaluatedItems: collectEvaluatedItems$8 };
3563
4743
 
3564
- const { Core: Core$i, Schema: Schema$x } = lib$1;
4744
+ const { Core: Core$i, Schema: Schema$x } = lib$2;
3565
4745
 
3566
4746
 
3567
4747
  const compile$t = async (schema, ast, parentSchema) => {
@@ -3605,7 +4785,7 @@
3605
4785
 
3606
4786
  var _else = { compile: compile$t, interpret: interpret$t, collectEvaluatedProperties: collectEvaluatedProperties$6, collectEvaluatedItems: collectEvaluatedItems$7 };
3607
4787
 
3608
- const { Core: Core$h, Schema: Schema$w, Instance: Instance$o } = lib$1;
4788
+ const { Core: Core$h, Schema: Schema$w, Instance: Instance$o } = lib$2;
3609
4789
 
3610
4790
 
3611
4791
  const compile$s = async (schema, ast) => {
@@ -3637,7 +4817,7 @@
3637
4817
 
3638
4818
  var items = { compile: compile$s, interpret: interpret$s, collectEvaluatedItems: collectEvaluatedItems$6 };
3639
4819
 
3640
- const { Core: Core$g, Schema: Schema$v, Instance: Instance$n } = lib$1;
4820
+ const { Core: Core$g, Schema: Schema$v, Instance: Instance$n } = lib$2;
3641
4821
 
3642
4822
 
3643
4823
  const compile$r = async (schema, ast, parentSchema) => {
@@ -3661,7 +4841,7 @@
3661
4841
 
3662
4842
  var items202012 = { compile: compile$r, interpret: interpret$r, collectEvaluatedItems: collectEvaluatedItems$5 };
3663
4843
 
3664
- const { Schema: Schema$u, Instance: Instance$m } = lib$1;
4844
+ const { Schema: Schema$u, Instance: Instance$m } = lib$2;
3665
4845
 
3666
4846
 
3667
4847
  const compile$q = (schema) => Schema$u.value(schema);
@@ -3669,7 +4849,7 @@
3669
4849
 
3670
4850
  var maxItems = { compile: compile$q, interpret: interpret$q };
3671
4851
 
3672
- const { Schema: Schema$t, Instance: Instance$l } = lib$1;
4852
+ const { Schema: Schema$t, Instance: Instance$l } = lib$2;
3673
4853
 
3674
4854
 
3675
4855
  const compile$p = (schema) => Schema$t.value(schema);
@@ -3677,7 +4857,7 @@
3677
4857
 
3678
4858
  var maxLength = { compile: compile$p, interpret: interpret$p };
3679
4859
 
3680
- const { Schema: Schema$s, Instance: Instance$k } = lib$1;
4860
+ const { Schema: Schema$s, Instance: Instance$k } = lib$2;
3681
4861
 
3682
4862
 
3683
4863
  const compile$o = (schema) => Schema$s.value(schema);
@@ -3685,7 +4865,7 @@
3685
4865
 
3686
4866
  var maxLength6 = { compile: compile$o, interpret: interpret$o };
3687
4867
 
3688
- const { Schema: Schema$r, Instance: Instance$j } = lib$1;
4868
+ const { Schema: Schema$r, Instance: Instance$j } = lib$2;
3689
4869
 
3690
4870
 
3691
4871
  const compile$n = (schema) => Schema$r.value(schema);
@@ -3693,7 +4873,7 @@
3693
4873
 
3694
4874
  var maxProperties = { compile: compile$n, interpret: interpret$n };
3695
4875
 
3696
- const { Schema: Schema$q, Instance: Instance$i } = lib$1;
4876
+ const { Schema: Schema$q, Instance: Instance$i } = lib$2;
3697
4877
 
3698
4878
 
3699
4879
  const compile$m = async (schema, ast, parentSchema) => {
@@ -3714,7 +4894,7 @@
3714
4894
 
3715
4895
  var maximumExclusiveMaximum = { compile: compile$m, interpret: interpret$m };
3716
4896
 
3717
- const { Schema: Schema$p, Instance: Instance$h } = lib$1;
4897
+ const { Schema: Schema$p, Instance: Instance$h } = lib$2;
3718
4898
 
3719
4899
 
3720
4900
  const compile$l = async (schema) => Schema$p.value(schema);
@@ -3722,7 +4902,7 @@
3722
4902
 
3723
4903
  var maximum = { compile: compile$l, interpret: interpret$l };
3724
4904
 
3725
- const { Schema: Schema$o, Instance: Instance$g } = lib$1;
4905
+ const { Schema: Schema$o, Instance: Instance$g } = lib$2;
3726
4906
 
3727
4907
 
3728
4908
  const compile$k = (schema) => Schema$o.value(schema);
@@ -3730,7 +4910,7 @@
3730
4910
 
3731
4911
  var minItems = { compile: compile$k, interpret: interpret$k };
3732
4912
 
3733
- const { Schema: Schema$n, Instance: Instance$f } = lib$1;
4913
+ const { Schema: Schema$n, Instance: Instance$f } = lib$2;
3734
4914
 
3735
4915
 
3736
4916
  const compile$j = (schema) => Schema$n.value(schema);
@@ -3738,7 +4918,7 @@
3738
4918
 
3739
4919
  var minLength = { compile: compile$j, interpret: interpret$j };
3740
4920
 
3741
- const { Schema: Schema$m, Instance: Instance$e } = lib$1;
4921
+ const { Schema: Schema$m, Instance: Instance$e } = lib$2;
3742
4922
 
3743
4923
 
3744
4924
  const compile$i = (schema) => Schema$m.value(schema);
@@ -3746,7 +4926,7 @@
3746
4926
 
3747
4927
  var minLength6 = { compile: compile$i, interpret: interpret$i };
3748
4928
 
3749
- const { Schema: Schema$l, Instance: Instance$d } = lib$1;
4929
+ const { Schema: Schema$l, Instance: Instance$d } = lib$2;
3750
4930
 
3751
4931
 
3752
4932
  const compile$h = (schema) => Schema$l.value(schema);
@@ -3754,7 +4934,7 @@
3754
4934
 
3755
4935
  var minProperties = { compile: compile$h, interpret: interpret$h };
3756
4936
 
3757
- const { Schema: Schema$k, Instance: Instance$c } = lib$1;
4937
+ const { Schema: Schema$k, Instance: Instance$c } = lib$2;
3758
4938
 
3759
4939
 
3760
4940
  const compile$g = async (schema, ast, parentSchema) => {
@@ -3775,7 +4955,7 @@
3775
4955
 
3776
4956
  var minimumExclusiveMinimum = { compile: compile$g, interpret: interpret$g };
3777
4957
 
3778
- const { Schema: Schema$j, Instance: Instance$b } = lib$1;
4958
+ const { Schema: Schema$j, Instance: Instance$b } = lib$2;
3779
4959
 
3780
4960
 
3781
4961
  const compile$f = async (schema) => Schema$j.value(schema);
@@ -3783,7 +4963,7 @@
3783
4963
 
3784
4964
  var minimum = { compile: compile$f, interpret: interpret$f };
3785
4965
 
3786
- const { Schema: Schema$i, Instance: Instance$a } = lib$1;
4966
+ const { Schema: Schema$i, Instance: Instance$a } = lib$2;
3787
4967
 
3788
4968
 
3789
4969
  const compile$e = (schema) => Schema$i.value(schema);
@@ -3801,7 +4981,7 @@
3801
4981
 
3802
4982
  var multipleOf = { compile: compile$e, interpret: interpret$e };
3803
4983
 
3804
- const { Core: Core$f } = lib$1;
4984
+ const { Core: Core$f } = lib$2;
3805
4985
 
3806
4986
 
3807
4987
  const compile$d = Core$f.compileSchema;
@@ -3809,7 +4989,7 @@
3809
4989
 
3810
4990
  var not = { compile: compile$d, interpret: interpret$d };
3811
4991
 
3812
- const { Core: Core$e, Schema: Schema$h } = lib$1;
4992
+ const { Core: Core$e, Schema: Schema$h } = lib$2;
3813
4993
 
3814
4994
 
3815
4995
  const compile$c = async (schema, ast) => {
@@ -3858,7 +5038,7 @@
3858
5038
 
3859
5039
  var oneOf = { compile: compile$c, interpret: interpret$c, collectEvaluatedProperties: collectEvaluatedProperties$5, collectEvaluatedItems: collectEvaluatedItems$4 };
3860
5040
 
3861
- const { Schema: Schema$g, Instance: Instance$9 } = lib$1;
5041
+ const { Schema: Schema$g, Instance: Instance$9 } = lib$2;
3862
5042
 
3863
5043
 
3864
5044
  const compile$b = (schema) => new RegExp(Schema$g.value(schema), "u");
@@ -3866,8 +5046,8 @@
3866
5046
 
3867
5047
  var pattern = { compile: compile$b, interpret: interpret$b };
3868
5048
 
3869
- const { Core: Core$d, Schema: Schema$f, Instance: Instance$8 } = lib$1;
3870
- const Pact$2 = lib$2;
5049
+ const { Core: Core$d, Schema: Schema$f, Instance: Instance$8 } = lib$2;
5050
+ const Pact$2 = lib$1;
3871
5051
 
3872
5052
 
3873
5053
  const compile$a = (schema, ast) => Pact$2.pipeline([
@@ -3904,8 +5084,8 @@
3904
5084
 
3905
5085
  var common = { isObject, escapeRegExp: escapeRegExp$1, splitUrl: splitUrl$1 };
3906
5086
 
3907
- const { Core: Core$c, Schema: Schema$e, Instance: Instance$7 } = lib$1;
3908
- const Pact$1 = lib$2;
5087
+ const { Core: Core$c, Schema: Schema$e, Instance: Instance$7 } = lib$2;
5088
+ const Pact$1 = lib$1;
3909
5089
  const { escapeRegExp } = common;
3910
5090
 
3911
5091
 
@@ -3930,7 +5110,7 @@
3930
5110
 
3931
5111
  var properties = { compile: compile$9, interpret: interpret$9, collectEvaluatedProperties: collectEvaluatedProperties$3 };
3932
5112
 
3933
- const { Core: Core$b, Instance: Instance$6 } = lib$1;
5113
+ const { Core: Core$b, Instance: Instance$6 } = lib$2;
3934
5114
 
3935
5115
 
3936
5116
  const compile$8 = (schema, ast) => Core$b.compileSchema(schema, ast);
@@ -3942,7 +5122,7 @@
3942
5122
 
3943
5123
  var propertyNames = { compile: compile$8, interpret: interpret$8 };
3944
5124
 
3945
- const { Core: Core$a, Schema: Schema$d } = lib$1;
5125
+ const { Core: Core$a, Schema: Schema$d } = lib$2;
3946
5126
  const { splitUrl } = common;
3947
5127
 
3948
5128
 
@@ -3967,7 +5147,7 @@
3967
5147
 
3968
5148
  var dynamicRef = { compile: compile$7, interpret: interpret$7, collectEvaluatedProperties: collectEvaluatedProperties$2, collectEvaluatedItems: collectEvaluatedItems$3 };
3969
5149
 
3970
- const { Core: Core$9, Schema: Schema$c } = lib$1;
5150
+ const { Core: Core$9, Schema: Schema$c } = lib$2;
3971
5151
 
3972
5152
 
3973
5153
  const compile$6 = async (ref, ast) => {
@@ -3981,7 +5161,7 @@
3981
5161
 
3982
5162
  var ref = { compile: compile$6, interpret: interpret$6, collectEvaluatedProperties: collectEvaluatedProperties$1, collectEvaluatedItems: collectEvaluatedItems$2 };
3983
5163
 
3984
- const { Schema: Schema$b, Instance: Instance$5 } = lib$1;
5164
+ const { Schema: Schema$b, Instance: Instance$5 } = lib$2;
3985
5165
 
3986
5166
 
3987
5167
  const compile$5 = (schema) => Schema$b.value(schema);
@@ -3992,8 +5172,8 @@
3992
5172
 
3993
5173
  var required = { compile: compile$5, interpret: interpret$5 };
3994
5174
 
3995
- const { Core: Core$8, Schema: Schema$a, Instance: Instance$4 } = lib$1;
3996
- const Pact = lib$2;
5175
+ const { Core: Core$8, Schema: Schema$a, Instance: Instance$4 } = lib$2;
5176
+ const Pact = lib$1;
3997
5177
 
3998
5178
 
3999
5179
  const compile$4 = (schema, ast) => {
@@ -4017,7 +5197,7 @@
4017
5197
 
4018
5198
  var tupleItems = { compile: compile$4, interpret: interpret$4, collectEvaluatedItems: collectEvaluatedItems$1 };
4019
5199
 
4020
- const { Schema: Schema$9, Instance: Instance$3 } = lib$1;
5200
+ const { Schema: Schema$9, Instance: Instance$3 } = lib$2;
4021
5201
 
4022
5202
 
4023
5203
  const compile$3 = (schema) => Schema$9.value(schema);
@@ -4025,7 +5205,7 @@
4025
5205
 
4026
5206
  var type = { compile: compile$3, interpret: interpret$3 };
4027
5207
 
4028
- const { Core: Core$7, Schema: Schema$8, Instance: Instance$2 } = lib$1;
5208
+ const { Core: Core$7, Schema: Schema$8, Instance: Instance$2 } = lib$2;
4029
5209
 
4030
5210
 
4031
5211
  const compile$2 = async (schema, ast, parentSchema) => {
@@ -4049,7 +5229,7 @@
4049
5229
 
4050
5230
  var unevaluatedItems = { compile: compile$2, interpret: interpret$2, collectEvaluatedItems };
4051
5231
 
4052
- const { Core: Core$6, Schema: Schema$7, Instance: Instance$1 } = lib$1;
5232
+ const { Core: Core$6, Schema: Schema$7, Instance: Instance$1 } = lib$2;
4053
5233
 
4054
5234
 
4055
5235
  const compile$1 = async (schema, ast, parentSchema) => {
@@ -4074,7 +5254,7 @@
4074
5254
 
4075
5255
  var unevaluatedProperties = { compile: compile$1, interpret: interpret$1, collectEvaluatedProperties };
4076
5256
 
4077
- const { Schema: Schema$6, Instance } = lib$1;
5257
+ const { Schema: Schema$6, Instance } = lib$2;
4078
5258
  const jsonStringify = fastestStableStringify;
4079
5259
 
4080
5260
 
@@ -4091,7 +5271,7 @@
4091
5271
 
4092
5272
  var uniqueItems = { compile, interpret };
4093
5273
 
4094
- const { Keywords: Keywords$1 } = lib$1;
5274
+ const { Keywords: Keywords$1 } = lib$2;
4095
5275
 
4096
5276
 
4097
5277
  var keywords$5 = {
@@ -4297,7 +5477,7 @@
4297
5477
  "default": {}
4298
5478
  }`;
4299
5479
 
4300
- const { Core: Core$5, Schema: Schema$5 } = lib$1;
5480
+ const { Core: Core$5, Schema: Schema$5 } = lib$2;
4301
5481
  const keywords$4 = keywords$5;
4302
5482
  const metaSchema$4 = schema$4;
4303
5483
 
@@ -4499,7 +5679,7 @@
4499
5679
  "default": {}
4500
5680
  }`;
4501
5681
 
4502
- const { Core: Core$4, Schema: Schema$4 } = lib$1;
5682
+ const { Core: Core$4, Schema: Schema$4 } = lib$2;
4503
5683
  const keywords$3 = keywords$5;
4504
5684
  const metaSchema$3 = schema$3;
4505
5685
 
@@ -4724,7 +5904,7 @@
4724
5904
  "default": true
4725
5905
  }`;
4726
5906
 
4727
- const { Core: Core$3, Schema: Schema$3 } = lib$1;
5907
+ const { Core: Core$3, Schema: Schema$3 } = lib$2;
4728
5908
  const keywords$2 = keywords$5;
4729
5909
  const metaSchema$2 = schema$2;
4730
5910
 
@@ -5107,7 +6287,7 @@
5107
6287
  }
5108
6288
  }`;
5109
6289
 
5110
- const { Core: Core$2, Schema: Schema$2 } = lib$1;
6290
+ const { Core: Core$2, Schema: Schema$2 } = lib$2;
5111
6291
  const keywords$1 = keywords$5;
5112
6292
  const metaSchema$1 = schema$1;
5113
6293
  const coreMetaSchema$1 = core$1;
@@ -5554,7 +6734,7 @@
5554
6734
  }
5555
6735
  }`;
5556
6736
 
5557
- const { Core: Core$1, Schema: Schema$1 } = lib$1;
6737
+ const { Core: Core$1, Schema: Schema$1 } = lib$2;
5558
6738
  const keywords = keywords$5;
5559
6739
  const metaSchema = schema;
5560
6740
  const coreMetaSchema = core;
@@ -5658,7 +6838,7 @@
5658
6838
  "unevaluatedProperties": keywords.unevaluatedProperties
5659
6839
  });
5660
6840
 
5661
- const { Core, Schema, InvalidSchemaError } = lib$1;
6841
+ const { Core, Schema, InvalidSchemaError } = lib$2;
5662
6842
  const Keywords = keywords$5;
5663
6843
 
5664
6844