apollo-client-ws
Version:
GraphQL WebSocket Network Interface for Apollo Client
39 lines (38 loc) • 194 kB
JavaScript
/*
** Apollo-Client-WS -- GraphQL WebSocket Network Link for Apollo Client
** Copyright (c) 2017-2021 Dr. Ralf S. Engelschall <rse@engelschall.com>
**
** Permission is hereby granted, free of charge, to any person obtaining
** a copy of this software and associated documentation files (the
** "Software"), to deal in the Software without restriction, including
** without limitation the rights to use, copy, modify, merge, publish,
** distribute, sublicense, and/or sell copies of the Software, and to
** permit persons to whom the Software is furnished to do so, subject to
** the following conditions:
**
** The above copyright notice and this permission notice shall be included
** in all copies or substantial portions of the Software.
**
** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
** SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.ApolloClientWS = f()}})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(_dereq_,module,exports){
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var _a=Object.prototype,toString=_a.toString,hasOwnProperty=_a.hasOwnProperty,previousComparisons=new Map;function equal(e,r){try{return check(e,r)}finally{previousComparisons.clear()}}function check(e,r){if(e===r)return!0;var t=toString.call(e);if(t!==toString.call(r))return!1;switch(t){case"[object Array]":if(e.length!==r.length)return!1;case"[object Object]":if(previouslyCompared(e,r))return!0;var a=Object.keys(e),n=Object.keys(r),o=a.length;if(o!==n.length)return!1;for(var s=0;s<o;++s)if(!hasOwnProperty.call(r,a[s]))return!1;for(s=0;s<o;++s){var c=a[s];if(!check(e[c],r[c]))return!1}return!0;case"[object Error]":return e.name===r.name&&e.message===r.message;case"[object Number]":if(e!=e)return r!=r;case"[object Boolean]":case"[object Date]":return+e==+r;case"[object RegExp]":case"[object String]":return e==""+r;case"[object Map]":case"[object Set]":if(e.size!==r.size)return!1;if(previouslyCompared(e,r))return!0;for(var i=e.entries(),u="[object Map]"===t;;){var p=i.next();if(p.done)break;var l=p.value,f=l[0],b=l[1];if(!r.has(f))return!1;if(u&&!check(b,r.get(f)))return!1}return!0}return!1}function previouslyCompared(e,r){var t=previousComparisons.get(e);if(t){if(t.has(r))return!0}else previousComparisons.set(e,t=new Set);return t.add(r),!1}exports.default=equal,exports.equal=equal;
},{}],2:[function(_dereq_,module,exports){
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var tslib_1=_dereq_("tslib");tslib_1.__exportStar(_dereq_("./link"),exports);var linkUtils_1=_dereq_("./linkUtils");exports.createOperation=linkUtils_1.createOperation,exports.makePromise=linkUtils_1.makePromise,exports.toPromise=linkUtils_1.toPromise,exports.fromPromise=linkUtils_1.fromPromise,exports.fromError=linkUtils_1.fromError,exports.getOperationName=linkUtils_1.getOperationName;var zen_observable_ts_1=tslib_1.__importDefault(_dereq_("zen-observable-ts"));exports.Observable=zen_observable_ts_1.default;
},{"./link":3,"./linkUtils":4,"tslib":21,"zen-observable-ts":23}],3:[function(_dereq_,module,exports){
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var tslib_1=_dereq_("tslib"),zen_observable_ts_1=tslib_1.__importDefault(_dereq_("zen-observable-ts")),ts_invariant_1=_dereq_("ts-invariant"),linkUtils_1=_dereq_("./linkUtils");function passthrough(e,t){return t?t(e):zen_observable_ts_1.default.of()}function toLink(e){return"function"==typeof e?new ApolloLink(e):e}function empty(){return new ApolloLink(function(){return zen_observable_ts_1.default.of()})}function from(e){return 0===e.length?empty():e.map(toLink).reduce(function(e,t){return e.concat(t)})}function split(e,t,n){var r=toLink(t),o=toLink(n||new ApolloLink(passthrough));return linkUtils_1.isTerminating(r)&&linkUtils_1.isTerminating(o)?new ApolloLink(function(t){return e(t)?r.request(t)||zen_observable_ts_1.default.of():o.request(t)||zen_observable_ts_1.default.of()}):new ApolloLink(function(t,n){return e(t)?r.request(t,n)||zen_observable_ts_1.default.of():o.request(t,n)||zen_observable_ts_1.default.of()})}exports.empty=empty,exports.from=from,exports.split=split,exports.concat=function(e,t){var n=toLink(e);if(linkUtils_1.isTerminating(n))return ts_invariant_1.invariant.warn(new linkUtils_1.LinkError("You are calling concat on a terminating link, which will have no effect",n)),n;var r=toLink(t);return linkUtils_1.isTerminating(r)?new ApolloLink(function(e){return n.request(e,function(e){return r.request(e)||zen_observable_ts_1.default.of()})||zen_observable_ts_1.default.of()}):new ApolloLink(function(e,t){return n.request(e,function(e){return r.request(e,t)||zen_observable_ts_1.default.of()})||zen_observable_ts_1.default.of()})};var ApolloLink=function(){function e(e){e&&(this.request=e)}return e.prototype.split=function(t,n,r){return this.concat(split(t,n,r||new e(passthrough)))},e.prototype.concat=function(e){return exports.concat(this,e)},e.prototype.request=function(e,t){throw new ts_invariant_1.InvariantError("request is not implemented")},e.empty=empty,e.from=from,e.split=split,e.execute=execute,e}();function execute(e,t){return e.request(linkUtils_1.createOperation(t.context,linkUtils_1.transformOperation(linkUtils_1.validateOperation(t))))||zen_observable_ts_1.default.of()}exports.ApolloLink=ApolloLink,exports.execute=execute;
},{"./linkUtils":4,"ts-invariant":20,"tslib":21,"zen-observable-ts":23}],4:[function(_dereq_,module,exports){
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var tslib_1=_dereq_("tslib"),zen_observable_ts_1=tslib_1.__importDefault(_dereq_("zen-observable-ts")),apollo_utilities_1=_dereq_("apollo-utilities");exports.getOperationName=apollo_utilities_1.getOperationName;var ts_invariant_1=_dereq_("ts-invariant");function validateOperation(e){for(var r=["query","operationName","variables","extensions","context"],t=0,n=Object.keys(e);t<n.length;t++){var i=n[t];if(r.indexOf(i)<0)throw new ts_invariant_1.InvariantError("illegal argument: "+i)}return e}exports.validateOperation=validateOperation;var LinkError=function(e){function r(r,t){var n=e.call(this,r)||this;return n.link=t,n}return tslib_1.__extends(r,e),r}(Error);function isTerminating(e){return e.request.length<=1}function toPromise(e){var r=!1;return new Promise(function(t,n){e.subscribe({next:function(e){r?ts_invariant_1.invariant.warn("Promise Wrapper does not support multiple results from Observable"):(r=!0,t(e))},error:n})})}function fromPromise(e){return new zen_observable_ts_1.default(function(r){e.then(function(e){r.next(e),r.complete()}).catch(r.error.bind(r))})}function fromError(e){return new zen_observable_ts_1.default(function(r){r.error(e)})}function transformOperation(e){var r={variables:e.variables||{},extensions:e.extensions||{},operationName:e.operationName,query:e.query};return r.operationName||(r.operationName="string"!=typeof r.query?apollo_utilities_1.getOperationName(r.query):""),r}function createOperation(e,r){var t=tslib_1.__assign({},e);return Object.defineProperty(r,"setContext",{enumerable:!1,value:function(e){t="function"==typeof e?tslib_1.__assign({},t,e(t)):tslib_1.__assign({},t,e)}}),Object.defineProperty(r,"getContext",{enumerable:!1,value:function(){return tslib_1.__assign({},t)}}),Object.defineProperty(r,"toKey",{enumerable:!1,value:function(){return getKey(r)}}),r}function getKey(e){var r=e.query,t=e.variables,n=e.operationName;return JSON.stringify([n,r,t])}exports.LinkError=LinkError,exports.isTerminating=isTerminating,exports.toPromise=toPromise,exports.makePromise=toPromise,exports.fromPromise=fromPromise,exports.fromError=fromError,exports.transformOperation=transformOperation,exports.createOperation=createOperation,exports.getKey=getKey;
},{"apollo-utilities":5,"ts-invariant":20,"tslib":21,"zen-observable-ts":23}],5:[function(_dereq_,module,exports){
(function (process){(function (){
exports.__esModule=!0,exports.addTypenameToDocument=addTypenameToDocument,exports.argumentsObjectFromField=argumentsObjectFromField,exports.assign=assign,exports.buildQueryFromSelectionSet=buildQueryFromSelectionSet,exports.checkDocument=checkDocument,exports.cloneDeep=cloneDeep,exports.createFragmentMap=createFragmentMap,exports.getDefaultValues=getDefaultValues,exports.getDirectiveInfoFromField=getDirectiveInfoFromField,exports.getDirectiveNames=getDirectiveNames,exports.getDirectivesFromDocument=getDirectivesFromDocument,exports.getEnv=getEnv,exports.getFragmentDefinition=getFragmentDefinition,exports.getFragmentDefinitions=getFragmentDefinitions,exports.getFragmentQueryDocument=getFragmentQueryDocument,exports.getInclusionDirectives=getInclusionDirectives,exports.getMainDefinition=getMainDefinition,exports.getMutationDefinition=getMutationDefinition,exports.getOperationDefinition=getOperationDefinition,exports.getOperationDefinitionOrDie=getOperationDefinitionOrDie,exports.getOperationName=getOperationName,exports.getQueryDefinition=getQueryDefinition,exports.getStoreKeyName=getStoreKeyName,exports.graphQLResultHasError=graphQLResultHasError,exports.hasClientExports=hasClientExports,exports.hasDirectives=hasDirectives,exports.isDevelopment=isDevelopment,exports.isEnv=isEnv,exports.isField=isField,exports.isIdValue=isIdValue,exports.isInlineFragment=isInlineFragment,exports.isJsonValue=isJsonValue,exports.isNumberValue=isNumberValue,exports.isProduction=isProduction,exports.isScalarValue=isScalarValue,exports.isTest=isTest,exports.maybeDeepFreeze=maybeDeepFreeze,exports.mergeDeep=mergeDeep,exports.mergeDeepArray=mergeDeepArray,exports.removeArgumentsFromDocument=removeArgumentsFromDocument,exports.removeClientSetsFromDocument=removeClientSetsFromDocument,exports.removeConnectionDirectiveFromDocument=removeConnectionDirectiveFromDocument,exports.removeDirectivesFromDocument=removeDirectivesFromDocument,exports.removeFragmentSpreadFromDocument=removeFragmentSpreadFromDocument,exports.resultKeyNameFromField=resultKeyNameFromField,exports.shouldInclude=shouldInclude,exports.storeKeyNameFromField=storeKeyNameFromField,exports.stripSymbols=stripSymbols,exports.toIdValue=toIdValue,exports.tryFunctionOrLogError=tryFunctionOrLogError,exports.valueFromNode=valueFromNode,exports.valueToObjectRepresentation=valueToObjectRepresentation,exports.variablesInOperation=variablesInOperation,exports.warnOnceInDevelopment=warnOnceInDevelopment,exports.canUseWeakMap=exports.isEqual=void 0;var _visitor=_dereq_("graphql/language/visitor"),_tsInvariant=_dereq_("ts-invariant"),_tslib=_dereq_("tslib"),_fastJsonStableStringify=_interopRequireDefault(_dereq_("fast-json-stable-stringify")),_equality=_dereq_("@wry/equality");function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function isScalarValue(e){return["StringValue","BooleanValue","EnumValue"].indexOf(e.kind)>-1}function isNumberValue(e){return["IntValue","FloatValue"].indexOf(e.kind)>-1}function isStringValue(e){return"StringValue"===e.kind}function isBooleanValue(e){return"BooleanValue"===e.kind}function isIntValue(e){return"IntValue"===e.kind}function isFloatValue(e){return"FloatValue"===e.kind}function isVariable(e){return"Variable"===e.kind}function isObjectValue(e){return"ObjectValue"===e.kind}function isListValue(e){return"ListValue"===e.kind}function isEnumValue(e){return"EnumValue"===e.kind}function isNullValue(e){return"NullValue"===e.kind}function valueToObjectRepresentation(e,n,t,r){if(isIntValue(t)||isFloatValue(t))e[n.value]=Number(t.value);else if(isBooleanValue(t)||isStringValue(t))e[n.value]=t.value;else if(isObjectValue(t)){var i={};t.fields.map(function(e){return valueToObjectRepresentation(i,e.name,e.value,r)}),e[n.value]=i}else if(isVariable(t)){var a=(r||{})[t.name.value];e[n.value]=a}else if(isListValue(t))e[n.value]=t.values.map(function(e){var t={};return valueToObjectRepresentation(t,n,e,r),t[n.value]});else if(isEnumValue(t))e[n.value]=t.value;else{if(!isNullValue(t))throw"production"===process.env.NODE_ENV?new _tsInvariant.InvariantError(17):new _tsInvariant.InvariantError('The inline argument "'+n.value+'" of kind "'+t.kind+'"is not supported. Use variables instead of inline arguments to overcome this limitation.');e[n.value]=null}}function storeKeyNameFromField(e,n){var t=null;e.directives&&(t={},e.directives.forEach(function(e){t[e.name.value]={},e.arguments&&e.arguments.forEach(function(r){var i=r.name,a=r.value;return valueToObjectRepresentation(t[e.name.value],i,a,n)})}));var r=null;return e.arguments&&e.arguments.length&&(r={},e.arguments.forEach(function(e){var t=e.name,i=e.value;return valueToObjectRepresentation(r,t,i,n)})),getStoreKeyName(e.name.value,r,t)}exports.isEqual=_equality.equal;var KNOWN_DIRECTIVES=["connection","include","skip","client","rest","export"];function getStoreKeyName(e,n,t){if(t&&t.connection&&t.connection.key){if(t.connection.filter&&t.connection.filter.length>0){var r=t.connection.filter?t.connection.filter:[];r.sort();var i=n,a={};return r.forEach(function(e){a[e]=i[e]}),t.connection.key+"("+JSON.stringify(a)+")"}return t.connection.key}var o=e;if(n){var u=(0,_fastJsonStableStringify.default)(n);o+="("+u+")"}return t&&Object.keys(t).forEach(function(e){-1===KNOWN_DIRECTIVES.indexOf(e)&&(t[e]&&Object.keys(t[e]).length?o+="@"+e+"("+JSON.stringify(t[e])+")":o+="@"+e)}),o}function argumentsObjectFromField(e,n){if(e.arguments&&e.arguments.length){var t={};return e.arguments.forEach(function(e){var r=e.name,i=e.value;return valueToObjectRepresentation(t,r,i,n)}),t}return null}function resultKeyNameFromField(e){return e.alias?e.alias.value:e.name.value}function isField(e){return"Field"===e.kind}function isInlineFragment(e){return"InlineFragment"===e.kind}function isIdValue(e){return e&&"id"===e.type&&"boolean"==typeof e.generated}function toIdValue(e,n){return void 0===n&&(n=!1),(0,_tslib.__assign)({type:"id",generated:n},"string"==typeof e?{id:e,typename:void 0}:e)}function isJsonValue(e){return null!=e&&"object"==typeof e&&"json"===e.type}function defaultValueFromVariable(e){throw"production"===process.env.NODE_ENV?new _tsInvariant.InvariantError(18):new _tsInvariant.InvariantError("Variable nodes are not supported by valueFromNode")}function valueFromNode(e,n){switch(void 0===n&&(n=defaultValueFromVariable),e.kind){case"Variable":return n(e);case"NullValue":return null;case"IntValue":return parseInt(e.value,10);case"FloatValue":return parseFloat(e.value);case"ListValue":return e.values.map(function(e){return valueFromNode(e,n)});case"ObjectValue":for(var t={},r=0,i=e.fields;r<i.length;r++){var a=i[r];t[a.name.value]=valueFromNode(a.value,n)}return t;default:return e.value}}function getDirectiveInfoFromField(e,n){if(e.directives&&e.directives.length){var t={};return e.directives.forEach(function(e){t[e.name.value]=argumentsObjectFromField(e,n)}),t}return null}function shouldInclude(e,n){return void 0===n&&(n={}),getInclusionDirectives(e.directives).every(function(e){var t=e.directive,r=e.ifArgument,i=!1;return"Variable"===r.value.kind?(i=n[r.value.name.value],"production"===process.env.NODE_ENV?(0,_tsInvariant.invariant)(void 0!==i,13):(0,_tsInvariant.invariant)(void 0!==i,"Invalid variable referenced in @"+t.name.value+" directive.")):i=r.value.value,"skip"===t.name.value?!i:i})}function getDirectiveNames(e){var n=[];return(0,_visitor.visit)(e,{Directive:function(e){n.push(e.name.value)}}),n}function hasDirectives(e,n){return getDirectiveNames(n).some(function(n){return e.indexOf(n)>-1})}function hasClientExports(e){return e&&hasDirectives(["client"],e)&&hasDirectives(["export"],e)}function isInclusionDirective(e){var n=e.name.value;return"skip"===n||"include"===n}function getInclusionDirectives(e){return e?e.filter(isInclusionDirective).map(function(e){var n=e.arguments,t=e.name.value;"production"===process.env.NODE_ENV?(0,_tsInvariant.invariant)(n&&1===n.length,14):(0,_tsInvariant.invariant)(n&&1===n.length,"Incorrect number of arguments for the @"+t+" directive.");var r=n[0];"production"===process.env.NODE_ENV?(0,_tsInvariant.invariant)(r.name&&"if"===r.name.value,15):(0,_tsInvariant.invariant)(r.name&&"if"===r.name.value,"Invalid argument for the @"+t+" directive.");var i=r.value;return"production"===process.env.NODE_ENV?(0,_tsInvariant.invariant)(i&&("Variable"===i.kind||"BooleanValue"===i.kind),16):(0,_tsInvariant.invariant)(i&&("Variable"===i.kind||"BooleanValue"===i.kind),"Argument for the @"+t+" directive must be a variable or a boolean value."),{directive:e,ifArgument:r}}):[]}function getFragmentQueryDocument(e,n){var t=n,r=[];return e.definitions.forEach(function(e){if("OperationDefinition"===e.kind)throw"production"===process.env.NODE_ENV?new _tsInvariant.InvariantError(11):new _tsInvariant.InvariantError("Found a "+e.operation+" operation"+(e.name?" named '"+e.name.value+"'":"")+". No operations are allowed when using a fragment as a query. Only fragments are allowed.");"FragmentDefinition"===e.kind&&r.push(e)}),void 0===t&&("production"===process.env.NODE_ENV?(0,_tsInvariant.invariant)(1===r.length,12):(0,_tsInvariant.invariant)(1===r.length,"Found "+r.length+" fragments. `fragmentName` must be provided when there is not exactly 1 fragment."),t=r[0].name.value),(0,_tslib.__assign)((0,_tslib.__assign)({},e),{definitions:(0,_tslib.__spreadArrays)([{kind:"OperationDefinition",operation:"query",selectionSet:{kind:"SelectionSet",selections:[{kind:"FragmentSpread",name:{kind:"Name",value:t}}]}}],e.definitions)})}function assign(e){for(var n=[],t=1;t<arguments.length;t++)n[t-1]=arguments[t];return n.forEach(function(n){null!=n&&Object.keys(n).forEach(function(t){e[t]=n[t]})}),e}function getMutationDefinition(e){checkDocument(e);var n=e.definitions.filter(function(e){return"OperationDefinition"===e.kind&&"mutation"===e.operation})[0];return"production"===process.env.NODE_ENV?(0,_tsInvariant.invariant)(n,1):(0,_tsInvariant.invariant)(n,"Must contain a mutation definition."),n}function checkDocument(e){"production"===process.env.NODE_ENV?(0,_tsInvariant.invariant)(e&&"Document"===e.kind,2):(0,_tsInvariant.invariant)(e&&"Document"===e.kind,'Expecting a parsed GraphQL document. Perhaps you need to wrap the query string in a "gql" tag? http://docs.apollostack.com/apollo-client/core.html#gql');var n=e.definitions.filter(function(e){return"FragmentDefinition"!==e.kind}).map(function(e){if("OperationDefinition"!==e.kind)throw"production"===process.env.NODE_ENV?new _tsInvariant.InvariantError(3):new _tsInvariant.InvariantError('Schema type definitions not allowed in queries. Found: "'+e.kind+'"');return e});return"production"===process.env.NODE_ENV?(0,_tsInvariant.invariant)(n.length<=1,4):(0,_tsInvariant.invariant)(n.length<=1,"Ambiguous GraphQL document: contains "+n.length+" operations"),e}function getOperationDefinition(e){return checkDocument(e),e.definitions.filter(function(e){return"OperationDefinition"===e.kind})[0]}function getOperationDefinitionOrDie(e){var n=getOperationDefinition(e);return"production"===process.env.NODE_ENV?(0,_tsInvariant.invariant)(n,5):(0,_tsInvariant.invariant)(n,"GraphQL document is missing an operation"),n}function getOperationName(e){return e.definitions.filter(function(e){return"OperationDefinition"===e.kind&&e.name}).map(function(e){return e.name.value})[0]||null}function getFragmentDefinitions(e){return e.definitions.filter(function(e){return"FragmentDefinition"===e.kind})}function getQueryDefinition(e){var n=getOperationDefinition(e);return"production"===process.env.NODE_ENV?(0,_tsInvariant.invariant)(n&&"query"===n.operation,6):(0,_tsInvariant.invariant)(n&&"query"===n.operation,"Must contain a query definition."),n}function getFragmentDefinition(e){"production"===process.env.NODE_ENV?(0,_tsInvariant.invariant)("Document"===e.kind,7):(0,_tsInvariant.invariant)("Document"===e.kind,'Expecting a parsed GraphQL document. Perhaps you need to wrap the query string in a "gql" tag? http://docs.apollostack.com/apollo-client/core.html#gql'),"production"===process.env.NODE_ENV?(0,_tsInvariant.invariant)(e.definitions.length<=1,8):(0,_tsInvariant.invariant)(e.definitions.length<=1,"Fragment must have exactly one definition.");var n=e.definitions[0];return"production"===process.env.NODE_ENV?(0,_tsInvariant.invariant)("FragmentDefinition"===n.kind,9):(0,_tsInvariant.invariant)("FragmentDefinition"===n.kind,"Must be a fragment definition."),n}function getMainDefinition(e){var n;checkDocument(e);for(var t=0,r=e.definitions;t<r.length;t++){var i=r[t];if("OperationDefinition"===i.kind){var a=i.operation;if("query"===a||"mutation"===a||"subscription"===a)return i}"FragmentDefinition"!==i.kind||n||(n=i)}if(n)return n;throw"production"===process.env.NODE_ENV?new _tsInvariant.InvariantError(10):new _tsInvariant.InvariantError("Expected a parsed GraphQL query with a query, mutation, subscription, or a fragment.")}function createFragmentMap(e){void 0===e&&(e=[]);var n={};return e.forEach(function(e){n[e.name.value]=e}),n}function getDefaultValues(e){if(e&&e.variableDefinitions&&e.variableDefinitions.length){var n=e.variableDefinitions.filter(function(e){return e.defaultValue}).map(function(e){var n=e.variable,t=e.defaultValue,r={};return valueToObjectRepresentation(r,n.name,t),r});return assign.apply(void 0,(0,_tslib.__spreadArrays)([{}],n))}return{}}function variablesInOperation(e){var n=new Set;if(e.variableDefinitions)for(var t=0,r=e.variableDefinitions;t<r.length;t++){var i=r[t];n.add(i.variable.name.value)}return n}function filterInPlace(e,n,t){var r=0;return e.forEach(function(t,i){n.call(this,t,i,e)&&(e[r++]=t)},t),e.length=r,e}var TYPENAME_FIELD={kind:"Field",name:{kind:"Name",value:"__typename"}};function isEmpty(e,n){return e.selectionSet.selections.every(function(e){return"FragmentSpread"===e.kind&&isEmpty(n[e.name.value],n)})}function nullIfDocIsEmpty(e){return isEmpty(getOperationDefinition(e)||getFragmentDefinition(e),createFragmentMap(getFragmentDefinitions(e)))?null:e}function getDirectiveMatcher(e){return function(n){return e.some(function(e){return e.name&&e.name===n.name.value||e.test&&e.test(n)})}}function removeDirectivesFromDocument(e,n){var t=Object.create(null),r=[],i=Object.create(null),a=[],o=nullIfDocIsEmpty((0,_visitor.visit)(n,{Variable:{enter:function(e,n,r){"VariableDefinition"!==r.kind&&(t[e.name.value]=!0)}},Field:{enter:function(n){if(e&&n.directives&&(e.some(function(e){return e.remove})&&n.directives&&n.directives.some(getDirectiveMatcher(e))))return n.arguments&&n.arguments.forEach(function(e){"Variable"===e.value.kind&&r.push({name:e.value.name.value})}),n.selectionSet&&getAllFragmentSpreadsFromSelectionSet(n.selectionSet).forEach(function(e){a.push({name:e.name.value})}),null}},FragmentSpread:{enter:function(e){i[e.name.value]=!0}},Directive:{enter:function(n){if(getDirectiveMatcher(e)(n))return null}}}));return o&&filterInPlace(r,function(e){return!t[e.name]}).length&&(o=removeArgumentsFromDocument(r,o)),o&&filterInPlace(a,function(e){return!i[e.name]}).length&&(o=removeFragmentSpreadFromDocument(a,o)),o}function addTypenameToDocument(e){return(0,_visitor.visit)(checkDocument(e),{SelectionSet:{enter:function(e,n,t){if(!t||"OperationDefinition"!==t.kind){var r=e.selections;if(r)if(!r.some(function(e){return isField(e)&&("__typename"===e.name.value||0===e.name.value.lastIndexOf("__",0))})){var i=t;if(!(isField(i)&&i.directives&&i.directives.some(function(e){return"export"===e.name.value})))return(0,_tslib.__assign)((0,_tslib.__assign)({},e),{selections:(0,_tslib.__spreadArrays)(r,[TYPENAME_FIELD])})}}}}})}var connectionRemoveConfig={test:function(e){var n="connection"===e.name.value;return n&&(e.arguments&&e.arguments.some(function(e){return"key"===e.name.value})||"production"===process.env.NODE_ENV||_tsInvariant.invariant.warn("Removing an @connection directive even though it does not have a key. You may want to use the key parameter to specify a store key.")),n}};function removeConnectionDirectiveFromDocument(e){return removeDirectivesFromDocument([connectionRemoveConfig],checkDocument(e))}function hasDirectivesInSelectionSet(e,n,t){return void 0===t&&(t=!0),n&&n.selections&&n.selections.some(function(n){return hasDirectivesInSelection(e,n,t)})}function hasDirectivesInSelection(e,n,t){return void 0===t&&(t=!0),!isField(n)||!!n.directives&&(n.directives.some(getDirectiveMatcher(e))||t&&hasDirectivesInSelectionSet(e,n.selectionSet,t))}function getDirectivesFromDocument(e,n){var t;return checkDocument(n),nullIfDocIsEmpty((0,_visitor.visit)(n,{SelectionSet:{enter:function(n,r,i,a){var o=a.join("-");if(!t||o===t||!o.startsWith(t)){if(n.selections){var u=n.selections.filter(function(n){return hasDirectivesInSelection(e,n)});return hasDirectivesInSelectionSet(e,n,!1)&&(t=o),(0,_tslib.__assign)((0,_tslib.__assign)({},n),{selections:u})}return null}}}}))}function getArgumentMatcher(e){return function(n){return e.some(function(e){return n.value&&"Variable"===n.value.kind&&n.value.name&&(e.name===n.value.name.value||e.test&&e.test(n))})}}function removeArgumentsFromDocument(e,n){var t=getArgumentMatcher(e);return nullIfDocIsEmpty((0,_visitor.visit)(n,{OperationDefinition:{enter:function(n){return(0,_tslib.__assign)((0,_tslib.__assign)({},n),{variableDefinitions:n.variableDefinitions.filter(function(n){return!e.some(function(e){return e.name===n.variable.name.value})})})}},Field:{enter:function(n){if(e.some(function(e){return e.remove})){var r=0;if(n.arguments.forEach(function(e){t(e)&&(r+=1)}),1===r)return null}}},Argument:{enter:function(e){if(t(e))return null}}}))}function removeFragmentSpreadFromDocument(e,n){function t(n){if(e.some(function(e){return e.name===n.name.value}))return null}return nullIfDocIsEmpty((0,_visitor.visit)(n,{FragmentSpread:{enter:t},FragmentDefinition:{enter:t}}))}function getAllFragmentSpreadsFromSelectionSet(e){var n=[];return e.selections.forEach(function(e){(isField(e)||isInlineFragment(e))&&e.selectionSet?getAllFragmentSpreadsFromSelectionSet(e.selectionSet).forEach(function(e){return n.push(e)}):"FragmentSpread"===e.kind&&n.push(e)}),n}function buildQueryFromSelectionSet(e){return"query"===getMainDefinition(e).operation?e:(0,_visitor.visit)(e,{OperationDefinition:{enter:function(e){return(0,_tslib.__assign)((0,_tslib.__assign)({},e),{operation:"query"})}}})}function removeClientSetsFromDocument(e){checkDocument(e);var n=removeDirectivesFromDocument([{test:function(e){return"client"===e.name.value},remove:!0}],e);return n&&(n=(0,_visitor.visit)(n,{FragmentDefinition:{enter:function(e){if(e.selectionSet&&e.selectionSet.selections.every(function(e){return isField(e)&&"__typename"===e.name.value}))return null}}})),n}var canUseWeakMap="function"==typeof WeakMap&&!("object"==typeof navigator&&"ReactNative"===navigator.product);exports.canUseWeakMap=canUseWeakMap;var toString=Object.prototype.toString;function cloneDeep(e){return cloneDeepHelper(e,new Map)}function cloneDeepHelper(e,n){switch(toString.call(e)){case"[object Array]":if(n.has(e))return n.get(e);var t=e.slice(0);return n.set(e,t),t.forEach(function(e,r){t[r]=cloneDeepHelper(e,n)}),t;case"[object Object]":if(n.has(e))return n.get(e);var r=Object.create(Object.getPrototypeOf(e));return n.set(e,r),Object.keys(e).forEach(function(t){r[t]=cloneDeepHelper(e[t],n)}),r;default:return e}}function getEnv(){return"undefined"!=typeof process&&process.env.NODE_ENV?process.env.NODE_ENV:"development"}function isEnv(e){return getEnv()===e}function isProduction(){return!0===isEnv("production")}function isDevelopment(){return!0===isEnv("development")}function isTest(){return!0===isEnv("test")}function tryFunctionOrLogError(e){try{return e()}catch(e){console.error&&console.error(e)}}function graphQLResultHasError(e){return e.errors&&e.errors.length}function deepFreeze(e){return Object.freeze(e),Object.getOwnPropertyNames(e).forEach(function(n){null===e[n]||"object"!=typeof e[n]&&"function"!=typeof e[n]||Object.isFrozen(e[n])||deepFreeze(e[n])}),e}function maybeDeepFreeze(e){if((isDevelopment()||isTest())&&!("function"==typeof Symbol&&"string"==typeof Symbol("")))return deepFreeze(e);return e}var hasOwnProperty=Object.prototype.hasOwnProperty;function mergeDeep(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return mergeDeepArray(e)}function mergeDeepArray(e){var n=e[0]||{},t=e.length;if(t>1){var r=[];n=shallowCopyForMerge(n,r);for(var i=1;i<t;++i)n=mergeHelper(n,e[i],r)}return n}function isObject(e){return null!==e&&"object"==typeof e}function mergeHelper(e,n,t){return isObject(n)&&isObject(e)?(Object.isExtensible&&!Object.isExtensible(e)&&(e=shallowCopyForMerge(e,t)),Object.keys(n).forEach(function(r){var i=n[r];if(hasOwnProperty.call(e,r)){var a=e[r];i!==a&&(e[r]=mergeHelper(shallowCopyForMerge(a,t),i,t))}else e[r]=i}),e):n}function shallowCopyForMerge(e,n){return null!==e&&"object"==typeof e&&n.indexOf(e)<0&&(e=Array.isArray(e)?e.slice(0):(0,_tslib.__assign)({__proto__:Object.getPrototypeOf(e)},e),n.push(e)),e}var haveWarned=Object.create({});function warnOnceInDevelopment(e,n){void 0===n&&(n="warn"),isProduction()||haveWarned[e]||(isTest()||(haveWarned[e]=!0),"error"===n?console.error(e):console.warn(e))}function stripSymbols(e){return JSON.parse(JSON.stringify(e))}
}).call(this)}).call(this,_dereq_('_process'))
},{"@wry/equality":1,"_process":19,"fast-json-stable-stringify":8,"graphql/language/visitor":17,"ts-invariant":20,"tslib":21}],6:[function(_dereq_,module,exports){
(function (global){(function (){
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).Ducky=e()}}(function(){return function(){return function e(t,r,n){function o(i,c){if(!r[i]){if(!t[i]){var s="function"==typeof _dereq_&&_dereq_;if(!c&&s)return s(i,!0);if(a)return a(i,!0);var l=new Error("Cannot find module '"+i+"'");throw l.code="MODULE_NOT_FOUND",l}var u=r[i]={exports:{}};t[i][0].call(u.exports,function(e){return o(t[i][1][e]||e)},u,u.exports,e,t,r,n)}return r[i].exports}for(var a="function"==typeof _dereq_&&_dereq_,i=0;i<n.length;i++)o(n[i]);return o}}()({1:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.version=void 0;r.version={major:2,minor:7,micro:3,date:20210109}},{}],2:[function(e,t,r){"use strict";function n(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}Object.defineProperty(r,"__esModule",{value:!0}),r.Token=void 0;var o=function(){function e(){(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")})(this,e),this.name="",this.text="",this.tokens=[],this.pos=0,this.len=0}return function(e,t,r){t&&n(e.prototype,t),r&&n(e,r)}(e,[{key:"setName",value:function(e){this.name=e}},{key:"setText",value:function(e){this.text=e}},{key:"addToken",value:function(e,t,r,n,o){this.tokens.push({b1:e,b2:t,e2:r,e1:n,symbol:o}),this.len++}},{key:"peek",value:function(e){if(void 0===e&&(e=0),e>=this.len)throw new Error("".concat(this.name,": parse error: not enough tokens"));return this.tokens[this.pos+e].symbol}},{key:"skip",value:function(e){if(void 0===e&&(e=1),e>this.len)throw new Error("".concat(this.name,": parse error: not enough tokens available to skip: ").concat(this.ctx()));this.pos+=e,this.len-=e}},{key:"consume",value:function(e){if(this.len<=0)throw new Error("".concat(this.name,": parse error: no more tokens available to consume: ").concat(this.ctx()));if(this.tokens[this.pos].symbol!==e)throw new Error("".concat(this.name,': parse error: expected token symbol "').concat(e,'": ').concat(this.ctx()));this.pos++,this.len--}},{key:"ctx",value:function(e){void 0===e&&(e=78);var t=this.tokens[this.pos],r="<"+this.text.substr(t.b2,t.e2-t.b2+1)+">";r=this.text.substr(t.b1,t.b2-t.b1)+r;var n=e-(r+=this.text.substr(t.e2+1,t.e1-t.e2)).length;if(n>0){var o,a;if(n=Math.floor(n/2),this.pos>0){var i=0;for(o=this.pos-1;o>=0&&(t=this.tokens[o],!((i+=(a=this.text.substr(t.b1,t.e1-t.b1+1)).length)>n));o--)r=a+r;o>0&&(r="[...]"+r)}if(this.len>1){var c=0;for(o=this.pos+1;o<this.pos+this.len&&(t=this.tokens[o],!((c+=(a=this.text.substr(t.b1,t.e1-t.b1+1)).length)>n));o++)r+=a;o<this.pos+this.len&&(r+="[...]")}}return r.replace(/\r/,"\\r").replace(/\n/,"\\n").replace(/\t/,"\\t")}}]),e}();r.Token=o},{}],3:[function(e,t,r){(function(e){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.registry=void 0;var t={};r.registry=t;for(var n=["Object","Boolean","Number","String","Function","RegExp","Array","Date","Error","Set","Map","WeakMap","Promise","Proxy","Iterator"],o=0;o<n.length;o++)"function"==typeof e[n[o]]&&(t[n[o]]=e[n[o]])}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],4:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.unregister=r.register=r.registered=void 0;var n=e("./ducky-2-registry-1-data.js");r.register=function(e,t){if(2!==arguments.length)throw new Error("register: invalid number of arguments: ".concat(arguments.length," (exactly 2 expected)"));if("string"!=typeof e)throw new Error('register: invalid name argument: "'.concat(e,'" (string expected)'));if("function"!=typeof t)throw new Error('register: invalid type argument: "'.concat(t,'" (function object expected)'));if(void 0!==n.registry[e])throw new Error('register: type already registered under name: "'.concat(e,'"'));n.registry[e]=t};r.unregister=function(e){if(1!==arguments.length)throw new Error("unregister: invalid number of arguments: ".concat(arguments.length," (exactly 1 expected)"));if("string"!=typeof e)throw new Error('unregister: invalid name argument: "'.concat(e,'" (string expected)'));if(void 0===n.registry[e])throw new Error('unregister: no type registered under name: "'.concat(e,'"'));delete n.registry[e]};r.registered=function(e){if(1!==arguments.length)throw new Error("registered: invalid number of arguments: ".concat(arguments.length," (exactly 1 expected)"));if("string"!=typeof e)throw new Error('registered: invalid name argument: "'.concat(e,'" (string expected)'));return n.registry[e]}},{"./ducky-2-registry-1-data.js":3}],5:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.select_compile=void 0;r.select_compile=function(e){for(var t,r=[],n=0,o=e;""!==o;){if(null!==(t=o.match(/^\s*(?:\.)?\s*([a-zA-Z$0-9_][a-zA-Z$0-9_:-]*)/)))r.push(t[1]);else if(null!==(t=o.match(/^\s*\[\s*(\d+|\*{1,2})\s*\]/)))r.push(t[1]);else if(null!==(t=o.match(/^\s*\[\s*"((?:\\"|.)*?)"\s*\]/)))r.push(t[1].replace(/\\"/g,'"'));else{if(null===(t=o.match(/^\s*\[\s*'((?:\\'|.)*?)'\s*\]/))){if(null!==(t=o.match(/^\s+$/)))break;throw new Error("select: parse error: invalid character at: "+e.substr(0,n)+"<"+o.substr(0,1)+">"+o.substr(1))}r.push(t[1].replace(/\\'/g,"'"))}n+=t[0].length,o=o.substr(t[0].length)}return r}},{}],6:[function(e,t,r){"use strict";function n(e){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}Object.defineProperty(r,"__esModule",{value:!0}),r.select_execute=void 0;r.select_execute=function(e,t){if(0===t.length){if(3===arguments.length)throw new Error("select: cannot set value on empty path");return e}for(var r=0;r<t.length-1;){if("object"!==n(e))throw new Error("select: cannot further dereference: no more intermediate objects in path");e=e[t[r++]]}if("object"!==n(e))throw new Error("select: cannot further dereference: no object at end of path");var o=e[t[r]];if(3===arguments.length){var a=arguments[2];void 0===a?e instanceof Array?e.splice(parseInt(t[r],10),1):delete e[t[r]]:e[t[r]]=a}return o}},{}],7:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.select=void 0;var n=e("./ducky-3-select-1-compile.js"),o=e("./ducky-3-select-2-execute.js");function a(e){return(a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var i={},c=function(e,t,r){if(arguments.length<2)throw new Error("select: invalid number of arguments: ".concat(arguments.length," (minimum of 2 expected)"));if(arguments.length>3)throw new Error("select: invalid number of arguments: ".concat(arguments.length," (maximum of 3 expected)"));if("string"!=typeof t)throw new Error('select: invalid specification argument: "'.concat(t,'" (string expected)'));var a=i[t];return void 0===a&&(a=(0,n.select_compile)(t),i[t]=a),2===arguments.length?(0,o.select_execute)(e,a):(0,o.select_execute)(e,a,r)};r.select=c,c.compile=function(e){if(1!==arguments.length)throw new Error("select: invalid number of arguments: ".concat(arguments.length," (exactly 1 expected)"));if("string"!=typeof e)throw new Error('select: invalid specification argument: "'.concat(e,'" (string expected)'));return n.select_compile.apply(void 0,arguments)},c.execute=function(e,t){if(arguments.length<2)throw new Error("select: invalid number of arguments: ".concat(arguments.length," (minimum of 2 expected)"));if(arguments.length>3)throw new Error("select: invalid number of arguments: ".concat(arguments.length," (maximum of 3 expected)"));if(!("object"===a(t)&&t instanceof Array))throw new Error('select: invalid path argument: "'.concat(t,'" (array expected)'));return o.select_execute.apply(void 0,arguments)}},{"./ducky-3-select-1-compile.js":5,"./ducky-3-select-2-execute.js":6}],8:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.validate_tokenize=void 0;var n=e("./ducky-1-util.js");r.validate_tokenize=function(e){var t,r=new n.Token;r.setName("validate"),r.setText(e);for(var o=0;""!==e;){if(null===(t=e.match(/^(\s*)([^\\{}\[\]:,?*+()!|/\s]+|[\\{}\[\]:,?*+()!|/])(\s*)/)))throw new Error('validate: parse error: cannot further canonicalize: "'.concat(e,'"'));r.addToken(o,o+t[1].length,o+t[1].length+t[2].length-1,o+t[0].length-1,t[2]),e=e.substr(t[0].length),o+=t[0].length}return r.addToken(o,o,o,o,null),r}},{"./ducky-1-util.js":2}],9:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.validate_parse=void 0;var n={parse:function(e){if(e.len<=0)return null;var t=this.parse_spec(e);if(null!==e.peek())throw new Error('validate: parse error: unexpected token (expected end-of-string): "'.concat(e.ctx(),'"'));return t},parse_spec:function(e){if(e.len<=0)return null;var t,r=e.peek();if("!"===r)t=this.parse_not(e);else if("("===r)t=this.parse_group(e);else if("{"===r)t=this.parse_hash(e);else if("["===r)t=this.parse_array(e);else if("/"===r)t=this.parse_regexp(e);else if(r.match(/^(?:null|undefined|boolean|number|string|function|object)$/))t=this.parse_primary(e);else if("any"===r)t=this.parse_any(e);else{if(!r.match(/^[_a-zA-Z$][_a-zA-Z$0-9]*(?:\.[_a-zA-Z$][_a-zA-Z$0-9]*)*$/))throw new Error('validate: parse error: invalid token symbol: "'.concat(e.ctx(),'"'));t=this.parse_class(e)}return t},parse_not:function(e){e.consume("!");var t=this.parse_spec(e);return{type:"not",op:t}},parse_group:function(e){e.consume("(");for(var t=this.parse_spec(e);"|"===e.peek();)e.consume("|"),t={type:"or",op1:t,op2:this.parse_spec(e)};return e.consume(")"),t},parse_hash:function(e){e.consume("{");for(var t=[];"}"!==e.peek();){var r=this.parse_key(e),n=this.parse_arity(e,"?");e.consume(":");var o=this.parse_spec(e);if(t.push({type:"element",key:r,arity:n,element:o}),","!==e.peek())break;e.skip()}var a={type:"hash",elements:t};return e.consume("}"),a},parse_array:function(e){e.consume("[");for(var t=[];"]"!==e.peek();){var r=this.parse_spec(e),n=this.parse_arity(e,"?*+");if(t.push({type:"element",element:r,arity:n}),","!==e.peek())break;e.skip()}var o={type:"array",elements:t};return e.consume("]"),o},parse_regexp:function(e){e.consume("/");for(var t,r="";e.len>=1&&"/"!==e.peek(0);)e.len>=2&&"\\"===e.peek(0)&&"/"===e.peek(1)?(r+=e.peek(1),e.skip(2)):(r+=e.peek(0),e.skip(1));e.consume("/");try{t=new RegExp(r)}catch(e){throw new Error('validate: parse error: invalid regular expression "'.concat(r,'": ').concat(e.message))}return{type:"regexp",regexp:t}},parse_primary:function(e){var t=e.peek();if(!t.match(/^(?:null|undefined|boolean|number|string|function|object)$/))throw new Error('validate: parse error: invalid primary type "'.concat(t,'"'));return e.skip(),{type:"primary",name:t}},parse_any:function(e){var t=e.peek();if("any"!==t)throw new Error('validate: parse error: invalid any type "'.concat(t,'"'));return e.skip(),{type:"any"}},parse_class:function(e){var t=e.peek();if(!t.match(/^[_a-zA-Z$][_a-zA-Z$0-9]*(?:\.[_a-zA-Z$][_a-zA-Z$0-9]*)*$/))throw new Error('validate: parse error: invalid class type "'.concat(t,'"'));return e.skip(),{type:"class",name:t}},parse_arity:function(e,t){var r=[1,1];if(e.len>=5&&"{"===e.peek(0)&&e.peek(1).match(/^[0-9]+$/)&&","===e.peek(2)&&e.peek(3).match(/^(?:[0-9]+|oo)$/)&&"}"===e.peek(4))r=[parseInt(e.peek(1),10),"oo"===e.peek(3)?Number.MAX_VALUE:parseInt(e.peek(3),10)],e.skip(5);else if(e.len>=3&&"{"===e.peek(0)&&e.peek(1).match(/^[0-9]+$/)&&"}"===e.peek(2))r=[parseInt(e.peek(1),10),parseInt(e.peek(1),10)],e.skip(3);else if(e.len>=1&&1===e.peek().length&&t.indexOf(e.peek())>=0){switch(e.peek()){case"?":r=[0,1];break;case"*":r=[0,Number.MAX_VALUE];break;case"+":r=[1,Number.MAX_VALUE]}e.skip()}return r},parse_key:function(e){var t=e.peek();if(!t.match(/^(?:[_a-zA-Z$][_a-zA-Z$0-9]*|@)$/))throw new Error('validate: parse error: invalid key "'.concat(t,'"'));return e.skip(),t}};r.validate_parse=n},{}],10:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.validate_execute=void 0;var n=e("./ducky-2-registry-2-api.js");function o(e){return(o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function a(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e)){var r=[],n=!0,o=!1,a=void 0;try{for(var i,c=e[Symbol.iterator]();!(n=(i=c.next()).done)&&(r.push(i.value),!t||r.length!==t);n=!0);}catch(e){o=!0,a=e}finally{try{n||null==c.return||c.return()}finally{if(o)throw a}}return r}}(e,t)||function(e,t){if(e){if("string"==typeof e)return i(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?i(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function i(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var c=function(e,t){return""===e?"mismatch at root-level: ".concat(t):'mismatch at path "'.concat(e,'": ').concat(t)},s={exec_spec:function(e,t,r,n){var o=!1;if(null!==t)switch(t.type){case"not":o=this.exec_not(e,t,r,n);break;case"or":o=this.exec_or(e,t,r,n);break;case"hash":o=this.exec_hash(e,t,r,n);break;case"array":o=this.exec_array(e,t,r,n);break;case"regexp":o=this.exec_regexp(e,t,r,n);break;case"primary":o=this.exec_primary(e,t,r,n);break;case"class":o=this.exec_class(e,t,r,n);break;case"any":o=!0;break;default:throw new Error('validate: invalid validation AST: node has unknown type "'.concat(t.type,'"'))}return o},exec_not:function(e,t,r,n){var o=null!==n?[]:null,a=this.exec_spec(e,t.op,r,o);return(a=!a)||null===n||o.forEach(function(e){return n.push(e)}),a},exec_or:function(e,t,r,n){var o=a(null!==n?[[],[]]:[null,null],2),i=o[0],c=o[1],s=this.exec_spec(e,t.op1,r,i),l=this.exec_spec(e,t.op2,r,c),u=s||l;return u||null===n||(i.forEach(function(e){return n.push(e)}),c.forEach(function(e){return n.push(e)})),u},exec_hash:function(e,t,r,n){var a,i,s,l="object"===o(e)&&null!==e,u={};if(l||null===n){if(l){var p=!1;for(s in e)if(Object.hasOwnProperty.call(e,s)&&Object.propertyIsEnumerable.call(e,s)&&"constructor"!==s&&"prototype"!==s){p=!0;break}for(a=0;a<t.elements.length;a++)if(u[(i=t.elements[a]).key]=i.element,i.arity[0]>0&&("@"===i.key&&!p||"@"!==i.key&&void 0===e[i.key])){if(l=!1,null===n)break;"@"===i.key?n.push(c(r,"mandatory element under arbitrary key not found")):n.push(c(r,'mandatory element under key "'.concat(i.key,'" not found')))}}}else null===e?n.push('mismatch at path "'.concat(r,'": found "null", expected hash')):n.push('mismatch at path "'.concat(r,'": found type "').concat(o(e),'", expected hash'));if(l||null!==n){var f=""!==r?".":"";for(s in e)if(Object.hasOwnProperty.call(e,s)&&Object.propertyIsEnumerable.call(e,s)&&"constructor"!==s&&"prototype"!==s&&(void 0===u[s]&&void 0===u["@"]&&null!==n&&n.push(c(r,'element under key "'.concat(s,'" unexpected'))),!(void 0!==u[s]&&this.exec_spec(e[s],u[s],"".concat(r).concat(f).concat(s),n)||void 0!==u["@"]&&this.exec_spec(e[s],u["@"],"".concat(r).concat(f).concat(s),n)||(l=!1,null!==n))))break}return l},exec_array:function(e,t,r,n){var a,i,s="object"===o(e)&&e instanceof Array;if(s||null===n){if(s){var l=0,u=null;for(a=0;a<t.elements.length;a++){i=t.elements[a];var p=0;for(u=null!==n?[]:null;p<i.arity[1]&&l<e.length&&this.exec_spec(e[l],i.element,"".concat(r,"[").concat(l,"]"),u);)p++,l++;if(p<i.arity[0]){null!==n&&n.push(c("".concat(r,"[").concat(l,"]"),"found only ".concat(p," elements of array element type #").concat(a,", ")+"expected at least ".concat(i.arity[0]," elements"))),s=!1;break}}!s&&null!==u&&u.length>0?null!==n&&u.forEach(function(e){return n.push(e)}):l<e.length&&(null!==n&&n.push(c(r,"matched only ".concat(l," elements, ")+"but ".concat(e.length," elements found"))),s=!1)}}else n.push(c(r,'found type "'.concat(o(e),'", expected array')));return s},exec_regexp:function(e,t,r,n){var o=null!==e&&"function"==typeof e.toString&&t.regexp.test(e.toString());return o||null===n||n.push(c(r,"value failed to match regular expression ".concat(t.regexp.toString()))),o},exec_primary:function(e,t,r,n){var a="null"===t.name&&null===e||o(e)===t.name;return a||null===n||n.push(c(r,'found type "'.concat(o(e),'", expected primary type "').concat(t.name,'"'))),a},exec_class:function(e,t,r,a){var i=(0,n.registered)(t.name),s="object"===o(e)&&(Object.prototype.toString.call(e)==="[object "+t.name+"]"||"function"==typeof i&&e instanceof i);return s||null===a||a.push(c(r,'found type "'.concat(o(e),'", expected class type "').concat(t.name,'"'))),s}};r.validate_execute=s},{"./ducky-2-registry-2-api.js":4}],11:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.validate=void 0;var n=e("./ducky-4-validate-1-tokenize.js"),o=e("./ducky-4-validate-2-parse.js"),a=e("./ducky-4-validate-3-execute.js"),i={},c=function e(t,r,n){if(arguments.length<2)throw new Error("validate: invalid number of arguments: ".concat(arguments.length," (minimum of 2 expected)"));if(arguments.length>3)throw new Error("validate: invalid number of arguments: ".concat(arguments.length," (maximum of 3 expected)"));if("string"!=typeof r)throw new Error('validate: invalid specification argument: "'.concat(r,'" (string expected)'));var o=i[r];return void 0===o&&(o=e.compile(r),i[r]=o),e.execute(t,o,n)};r.validate=c,c.compile=function(e){if(1!==arguments.length)throw new Error("validate: invalid number of arguments: ".concat(arguments.length," (exactly 1 expected)"));if("string"!=typeof e)throw new Error('validate: invalid specification argument: "'.concat(e,'" (string expected)'));var t=(0,n.validate_tokenize)(e);return o.validate_parse.parse(t)},c.execute=function(e,t,r){if(arguments.length<2)throw new Error("validate: invalid number of arguments: ".concat(arguments.length," (minimum of 2 expected)"));if(arguments.length>3)throw new Error("validate: invalid number of arguments: ".concat(arguments.length," (maximum of 3 expected)"));return(arguments.length<3||void 0===r)&&(r=null),a.validate_execute.exec_spec(e,t,"",r)}},{"./ducky-4-validate-1-tokenize.js":8,"./ducky-4-validate-2-parse.js":9,"./ducky-4-validate-3-execute.js":10}],12:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.params=void 0;var n=e("./ducky-4-validate-4-api.js");function o(e){return(o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var a=function(e,t,r,o,a){if(void 0!==o&&!(0,n.validate)(r,o))throw new Error("".concat(e,': parameter "').concat(t,'" has ')+"".concat(a," ").concat(JSON.stringify(r),', which does not validate against "').concat(o,'"'))};r.params=function(e,t,r){var n,i={};for(n in r)Object