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