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