New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@rest-hooks/normalizr

Package Overview
Dependencies
Maintainers
2
Versions
126
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@rest-hooks/normalizr - npm Package Compare versions

Comparing version 6.0.3 to 6.0.4

9

CHANGELOG.md

@@ -6,2 +6,11 @@ # Change Log

### [6.0.4](https://github.com/coinbase/rest-hooks/compare/@rest-hooks/normalizr@6.0.3...@rest-hooks/normalizr@6.0.4) (2021-03-03)
### 🐛 Bug Fix
* Handle nulls when schema expects something ([#615](https://github.com/coinbase/rest-hooks/issues/615)) ([0afd813](https://github.com/coinbase/rest-hooks/commit/0afd813a5aa71683590fbbc97bbbc96c9c2bdf12))
### [6.0.3](https://github.com/coinbase/rest-hooks/compare/@rest-hooks/normalizr@6.0.2...@rest-hooks/normalizr@6.0.3) (2021-03-01)

@@ -8,0 +17,0 @@

8

dist/normalizr.amd.js

@@ -1015,5 +1015,7 @@ define(['exports'], function (exports) { 'use strict';

globalKey.push(input);
var ret = unvisit(input, schema);
if (typeof input !== 'object') return ret;
var ret = unvisit(input, schema); // in the case where WeakMap cannot be used
// this test ensures null is properly excluded from WeakMap
if (Object(input) !== input) return ret;
if (!resultCache.has(globalKey)) {

@@ -1079,3 +1081,3 @@ resultCache.set(globalKey, ret[0]);

/* istanbul ignore else */
if (typeof ret[0] === 'object') {
if (Object(ret[0]) === ret[0]) {
globalKey.push(ret[0]);

@@ -1082,0 +1084,0 @@ } else if (process.env.NODE_ENV !== 'production') {

@@ -1,1 +0,1 @@

define(["exports"],(function(e){"use strict";function t(e){return!(!e||"function"!=typeof e.hasOwnProperty||!(Object.hasOwnProperty.call(e,"__ownerID")||e._map&&Object.hasOwnProperty.call(e._map,"__ownerID")))}function n(e,t,n){var r=!0,i=!1;return[Object.keys(e).reduce((function(t,o){var a=""+o,s=n(t.get(a),e[a]),u=s[0],c=s[1],f=s[2];return c||(r=!1),f&&(i=!0),t.has(a)?t.set(a,u):t}),t),r,i]}function r(e,t){return(r=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function i(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,r(e,t)}function o(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function a(e,t,n){return t&&o(e.prototype,t),n&&o(e,n),e}var s=function(){function e(e,t){t&&(this._schemaAttribute="string"==typeof t?function(e){return e[t]}:t),this.define(e)}var n=e.prototype;return n.define=function(e){this.schema=e},n.getSchemaAttribute=function(e,t,n){return!this.isSingleSchema&&this._schemaAttribute(e,t,n)},n.inferSchema=function(e,t,n){if(this.isSingleSchema)return this.schema;var r=this.getSchemaAttribute(e,t,n);return this.schema[r]},n.normalizeValue=function(e,t,n,r,i,o){var a=this.inferSchema(e,t,n);if(!a)return e;var s=r(e,t,n,a,i,o);return this.isSingleSchema||null==s?s:{id:s,schema:this.getSchemaAttribute(e,t,n)}},n.denormalizeValue=function(e,n){var r=t(e)?e.get("schema"):e.schema;return this.isSingleSchema||r?n((this.isSingleSchema?void 0:t(e)?e.get("id"):e.id)||e,this.isSingleSchema?this.schema:this.schema[r]):[e,!0,!0]},a(e,[{key:"isSingleSchema",get:function(){return!this._schemaAttribute}}]),e}(),u=function(e){if(Array.isArray(e)&&e.length>1)throw new Error("Expected schema definition to be a single schema, but found "+e.length+".");return e[0]},c=function(e){return Array.isArray(e)?e:Object.keys(e).map((function(t){return e[t]}))},f=function(e){var t=e[1],n=e[2];return t&&!n},l=function(e,t,n,r,i,o,a){return e=u(e),c(t).map((function(t,s){return i(t,n,r,e,o,a)}))},h=function(e,t,n){e=u(e);var r=!1,i=!0;if(void 0===t&&e){var o=n(void 0,e);i=o[1],r=o[2]}return[t&&t.map?t.map((function(t){return n(t,e)})).filter(f).map((function(e){return e[0]})):t,i,r]},p=function(e){function t(){return e.apply(this,arguments)||this}i(t,e);var n=t.prototype;return n.normalize=function(e,t,n,r,i,o){var a=this;return c(e).map((function(e,s){return a.normalizeValue(e,t,n,r,i,o)})).filter((function(e){return null!=e}))},n.denormalize=function(e,t){var n=this,r=!1,i=!0;if(void 0===e&&this.schema){var o=t(void 0,this.schema);i=o[1],r=o[2]}return[e&&e.map?e.map((function(e){return n.denormalizeValue(e,t)})).filter(f).map((function(e){return e[0]})):e,i,r]},t}(s),d=function(e,t,n,r,i,o,a){var s=Object.assign({},t);return Object.keys(e).forEach((function(n){var r=e[n],u=i(t[n],t,n,r,o,a);null==u?delete s[n]:s[n]=u})),s},m=function(e,r,i){if(t(r))return n(e,r,i);var o=Object.assign({},r),a=!0,s=!1;return Object.keys(e).forEach((function(t){var n=i(o[t],e[t]),r=n[0],u=n[1],c=n[2];void 0!==o[t]&&(o[t]=r),c&&(s=!0),u||(a=!1)})),[o,a,s]},y=function(){function e(e){this.define(e)}var t=e.prototype;return t.define=function(e){this.schema=Object.keys(e).reduce((function(t,n){var r,i=e[n];return Object.assign({},t,((r={})[n]=i,r))}),this.schema||{})},t.normalize=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return d.apply(void 0,[this.schema].concat(t))},t.denormalize=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return m.apply(void 0,[this.schema].concat(t))},e}();function v(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function g(e,t){var n;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return v(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?v(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return(n=e[Symbol.iterator]()).next.bind(n)}var b=Symbol("Defined Members"),O=Symbol("unq"),k=function(){function e(){}return e.prototype.toString=function(){return this[O]},e.toJSON=function(){return{name:this.name,schema:this.schema}},e.fromJS=function(t,n,r){void 0===t&&(t={});var i=new this(t);return t instanceof e&&(t=t.constructor.toObjectDefined(t)),Object.assign(i,t),Object.defineProperty(i,b,{value:Object.keys(t),writable:!1}),Object.defineProperty(i,O,{value:""+Math.random(),writable:!1}),i},e.merge=function(e,t){var n=Object.assign(this.toObjectDefined(e),this.toObjectDefined(t));return this.fromJS(n)},e.hasDefined=function(e,t){return e[b].includes(t)},e.toObjectDefined=function(e){for(var t,n={},r=g(e[b]);!(t=r()).done;){var i=t.value;n[i]=e[i]}return n},e.keysDefined=function(e){return e[b]},e.normalize=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return d.apply(void 0,[this.schema].concat(t))},e.denormalize=function(e,t){var n=this,r=new this,i=Object.assign({},e),o=!1,a=!0;return Object.keys(this.schema).forEach((function(e){var s=t(i[e],n.schema[e]),u=s[0],c=s[1],f=s[2];void 0!==i[e]&&(i[e]=u),c||e in r&&!r[e]||(a=!1),!f||e in r&&!r[e]||(o=!0)})),[this.fromJS(i),a,o]},e.asSchema=function(){return"development"===process.env.NODE_ENV&&console.error("asSchema() is deprecated - use Entity directly instead."),this},e}();k.schema={};var w=function(e){function r(){return e.apply(this,arguments)||this}return i(r,e),r.toJSON=function(){return Object.assign({},e.toJSON.call(this),{key:this.key})},r.pk=function(e,t,n){return this.prototype.pk.call(e,t,n)||n},r.normalize=function(e,t,n,r,i,o){var a=this;if("string"==typeof e)return e;var s=this.fromJS(e,t,n);if("production"!==process.env.NODE_ENV&&"silent"!==this.automaticValidation){for(var u,c=new this,f=new Set(Object.keys(c)),l=this.keysDefined(s),h=[[],[],[]],p=h[0],d=h[1],m=h[2],y=g(l);!(u=y()).done;){var v=u.value;f.has(v)?p.push(v):m.push(v)}for(var b,O=g(f);!(b=O()).done;){var k=b.value;p.includes(k)||d.push(k)}if(f.size){if(Array.isArray(e)&&m.length){var w="Attempted to initialize "+this.name+" with an array, but named members were expected\n\nThis is likely due to a malformed response.\nTry inspecting the network response or fetch() return value.\nOr use debugging tools: https://resthooks.io/docs/guides/debugging\nLearn more about schemas: https://resthooks.io/docs/api/schema\nIf this is a mistake, you can disable this check by setting static automaticValidation = 'silent'\n\nMissing: "+d+"\nFirst three members: "+JSON.stringify(e.slice(0,3),null,2);if("warn"!==this.automaticValidation){var E=new Error(w);throw E.status=400,E}console.warn(w)}var S=Math.max(l.length/2,1)<=m.length&&f.size>Math.max(m.length,2)&&Math.pow(p.length,1.5)/2<=m.length,j=p.length<Math.min(1,f.size/2);if(S||j){var z="",_="substantially different than expected keys";j&&(z+="\n Missing: "+d,_="no matching keys found"),S&&(z+="\n Unexpected keys: "+m,_="a large number of unexpected keys found");var N="Attempted to initialize "+this.name+" with "+_+"\n\n This is likely due to a malformed response.\n Try inspecting the network response or fetch() return value.\n Or use debugging tools: https://resthooks.io/docs/guides/debugging\n Learn more about schemas: https://resthooks.io/docs/api/schema\n If this is a mistake, you can disable this check by setting static automaticValidation = 'silent'\n\n Expected keys:\n Found: "+p+z+"\n Value: "+JSON.stringify(this.toObjectDefined(s),null,2);if(!(p.length>=4&&S||"warn"===this.automaticValidation)){var A=new Error(N);throw A.status=400,A}console.warn(N)}}}var D=s.pk(t,n);if(void 0!==D&&""!==D){var x=this.key;return x in o||(o[x]={}),D in o[x]||(o[x][D]=[]),o[x][D].some((function(t){return t===e}))?D:(o[x][D].push(e),Object.keys(this.schema).forEach((function(e){if(Object.hasOwnProperty.call(s,e)){var t=a.schema[e];s[e]=r(s[e],s,e,t,i,o)}else if("production"!==process.env.NODE_ENV){var n=new Error("Schema key is missing in Entity\n\n Be sure all schema members are also part of the entity\n Or use debugging tools: https://resthooks.io/docs/guides/debugging\n Learn more about nesting schemas: https://resthooks.io/docs/guides/nested-response\n\n Entity keys: "+Object.keys(s)+"\n Schema key(missing): "+e+"\n ");throw n.status=400,n}})),i(this,s,s,t,n),D)}if("production"!==process.env.NODE_ENV){var V=new Error("Missing usable resource key when normalizing response.\n\n This is likely due to a malformed response.\n Try inspecting the network response or fetch() return value.\n Or use debugging tools: https://resthooks.io/docs/guides/debugging\n Learn more about schemas: https://resthooks.io/docs/api/schema\n\n Entity: "+this.name+"\n Value: "+(e&&JSON.stringify(e,null,2))+"\n ");throw V.status=400,V}},r.denormalize=function(e,r){var i=this;if(t(e)){var o=n(this.schema,e,r),a=o[0],s=o[1],u=o[2];return[this.fromJS(a.toObject()),s,u]}var c=new this,f=!1,l=!0,h=e;return Object.keys(this.schema).forEach((function(t){var n=i.schema[t],o=i.hasDefined(e,t)?e[t]:void 0,a=r(o,n),s=a[0],u=a[1],p=a[2];u||t in c&&!c[t]||(l=!1),!p||t in c&&!c[t]||(f=!0),i.hasDefined(e,t)&&h[t]!==s&&(h[t]=s)})),[h,l,f]},a(r,null,[{key:"key",get:function(){if("production"!==process.env.NODE_ENV&&(""===this.name||"Entity"===this.name))throw new Error("Entity classes without a name must define `static get key()`");return this.name}}]),r}(k);function E(e){return null!==e&&void 0!==e.pk}"production"!==process.env.NODE_ENV&&(w.fromJS=function(e){if(void 0===this.prototype.pk)throw new Error("cannot construct on abstract types");return k.fromJS.call(this,e)});var S=Symbol("ENTITY WAS DELETED");function j(e){return(j=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function z(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function _(e,t,n){return(_=z()?Reflect.construct:function(e,t,n){var i=[null];i.push.apply(i,t);var o=new(Function.bind.apply(e,i));return n&&r(o,n.prototype),o}).apply(null,arguments)}function N(e){var t="function"==typeof Map?new Map:void 0;return(N=function(e){if(null===e||(n=e,-1===Function.toString.call(n).indexOf("[native code]")))return e;var n;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,i)}function i(){return _(e,arguments,j(this).constructor)}return i.prototype=Object.create(e.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),r(i,e)})(e)}var A=function(){this.children=new WeakMap},D=function(e){function t(){for(var t,n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return(t=e.call.apply(e,[this].concat(r))||this).message="Keys must include at least one member",t}return i(t,e),t}(N(Error)),x=function(){function e(){this.first=new WeakMap}var t=e.prototype;return t.delete=function(e){var t=this.traverse(e);return null==t||delete t.value,!!t},t.get=function(e){var t=this.traverse(e);return null==t?void 0:t.value},t.has=function(e){var t=this.traverse(e);return!!t&&Object.prototype.hasOwnProperty.call(t,"value")},t.set=function(e,t){if(e.length<1)throw new D;for(var n,r=this.first,i=0;i<e.length;i++)r.has(e[i])?n=r.get(e[i]):(n=new A,r.set(e[i],n)),r=n.children,i===e.length-1&&(n.value=t);return this},t.traverse=function(e){for(var t,n=this.first,r=0;r<e.length;r++){if(!(t=n.get(e[r])))return;n=t.children}return t},e}(),V=function(e,n,r,i){var o=J(e);function a(e,r){if(!r)return[e,!0,!1];if(!r.denormalize||"function"!=typeof r.denormalize){if("function"==typeof r)return e instanceof r?[e,!0,!1]:[new r(e),!0,!1];if("object"==typeof r)return(Array.isArray(r)?h:m)(r,e,u)}return null===e?[e,!0,!1]:E(r)?void 0===e?[e,!1,!1]:function(e,n,r,i,o,a){var s=i(e,n);if(s===S)return[void 0,!0,!0];if("object"!=typeof s||null===s)return[s,!1,!1];void 0===o[n.key]&&(o[n.key]={});var u=!0,c=!1;if(!o[n.key][e]){var f=[s],l=M(r,f);a[n.key]||(a[n.key]={}),a[n.key][e]||(a[n.key][e]=new x);var h=a[n.key][e],p=t(s)?s:n.fromJS(s);o[n.key][e]=p;var d=n.denormalize(p,l);o[n.key][e]=d[0],u=d[1],c=d[2],h.has(f)?o[n.key][e]=h.get(f):h.set(f,o[n.key][e])}return[o[n.key][e],u,c]}(e,r,u,o,i,n):"function"==typeof r.denormalize?r.denormalize(e,u):[e,!0,!1]}var s=[],u=M(a,s);return function(e,t){s.push(e);var n=a(e,t);return"object"!=typeof e?n:r.has(s)?[r.get(s),n[1],n[2]]:(r.set(s,n[0]),n)}},J=function(e){var n=t(e);return function(t,r){var i=r.key;return"object"==typeof t?t:n?e.getIn([i,t]):e[i]&&e[i][t]}};function M(e,t){var n=e.og||e,r=function(e,r){var i=n(e,r);if(i[0]&&r&&E(r))if("object"==typeof i[0])t.push(i[0]);else if("production"!==process.env.NODE_ENV)throw new Error("Unexpected primitive found during denormalization\nFound: "+i[0]+"\nExpected entity: "+r);return i};return r.og=e,r}var P=function e(t,n,r,i,o,a){return t&&i&&["function","object"].includes(typeof i)?i.normalize&&"function"==typeof i.normalize?i.normalize(t,n,r,e,o,a):"function"==typeof i?new i(t):(Array.isArray(i)?l:d)(i,t,n,r,e,o,a):t};var I=function(e){function t(t,n){if(!n)throw new Error('Expected option "schemaAttribute" not found on UnionSchema.');return e.call(this,t,n)||this}i(t,e);var n=t.prototype;return n.normalize=function(e,t,n,r,i,o){return this.normalizeValue(e,t,n,r,i,o)},n.denormalize=function(e,t){return this.denormalizeValue(e,t)},t}(s),T=function(e){function t(){return e.apply(this,arguments)||this}i(t,e);var n=t.prototype;return n.normalize=function(e,t,n,r,i,o){var a=this;return Object.keys(e).reduce((function(t,n,s){var u,c=e[n];return null!=c?Object.assign({},t,((u={})[n]=a.normalizeValue(c,e,n,r,i,o),u)):t}),{})},n.denormalize=function(e,t){var n=this,r=!0,i=!1;return[Object.keys(e).reduce((function(o,a){var s,u=e[a],c=n.denormalizeValue(u,t),f=c[0],l=c[1],h=c[2];return l||(r=!1),h&&(i=!0),!l||h?o:Object.assign({},o,((s={})[a]=f,s))}),{}),r,i]},t}(s),L=function(){function e(e){if("production"!==process.env.NODE_ENV&&!e)throw new Error('Expected option "entity" not found on DeleteSchema.');this._entity=e}var t=e.prototype;return t.normalize=function(e,t,n,r,i,o){if("string"==typeof e)return e;var a=this._entity.fromJS(e,t,n),s=a.pk(t,n);return i(this._entity,S,a,t,n),s},t.denormalize=function(e,t){return t(e,this._entity)},t._denormalizeNullable=function(){return[]},t._normalizeNullable=function(){return[]},t.merge=function(e,t){return t},e}(),U=Object.freeze({__proto__:null,Union:I,Values:T,Array:p,Object:y,Delete:L}),F=function(e){function t(){return e.apply(this,arguments)||this}return i(t,e),t.denormalize=function(e,t){return[e,!0,!1]},t}(w);e.DELETED=S,e.Entity=w,e.FlatEntity=F,e.SimpleRecord=k,e.WeakListMap=x,e.denormalize=function(e,t,n,r,i){if(void 0===r&&(r={}),void 0===i&&(i=new x),void 0===t)return[e,!0,!1,{}];if(void 0===e)return[void 0,!1,!1,{}];var o={},a=V(n,r,i,o);return[].concat(a(e,t),[o])},e.isEntity=E,e.normalize=function(e,t,n,r){if(void 0===n&&(n={}),void 0===r&&(r={}),void 0===t)return{entities:n,indexes:r,result:e};var i=function(e){return["object","function"].includes(typeof e)?"object":typeof e}(t);if(null===e||typeof e!==i){if("production"!==process.env.NODE_ENV){throw"string"==typeof e&&function(e){try{return"string"!=typeof JSON.parse(e)}catch(e){return!1}}(e)?new Error('Normalizing a string, but this does match schema.\n\nParsing this input string as JSON worked. This likely indicates fetch function did not parse\nthe JSON. By default, this only happens if "content-type" header includes "json".\nSee https://resthooks.io/docs/guides/custom-networking for more information\n\n Schema: '+JSON.stringify(t,void 0,2)+'\n Input: "'+e+'"'):new Error('Unexpected input given to normalize. Expected type to be "'+i+'", found "'+(null===e?"null":typeof e)+'".\n\n Schema: '+JSON.stringify(t,void 0,2)+'\n Input: "'+e+'"')}throw new Error('Unexpected input given to normalize. Expected type to be "'+i+'", found "'+(null===e?"null":typeof e)+'".')}var o={},a={},s=function(e,t,n,r){return function(r,i,o,a,s){var u=r.key,c=r.pk(o,a,s);u in e||(e[u]={});var f=e[u][c];if(e[u][c]=f?r.merge(f,i):i,Array.isArray(r.indexes)){var l=e[u][c];u in t||(t[u]={});for(var h,p=g(r.indexes);!(h=p()).done;){var d=h.value;d in t[u]||(t[u][d]={});var m=t[u][d];f&&delete m[f[d]],n[u]&&n[u][c]&&n[u][c][d]!==l[d]&&(m[n[u][c][d]]=S),d in l?m[l[d]]=c:"production"!==process.env.NODE_ENV&&console.warn("Index not found in entity. Indexes must be top-level members of your entity.\nIndex: "+d+"\nEntity: "+JSON.stringify(l,void 0,2))}}}}(o,a,n);return{entities:o,indexes:a,result:P(e,e,void 0,t,s,{})}},e.schema=U,Object.defineProperty(e,"__esModule",{value:!0})}));
define(["exports"],(function(e){"use strict";function t(e){return!(!e||"function"!=typeof e.hasOwnProperty||!(Object.hasOwnProperty.call(e,"__ownerID")||e._map&&Object.hasOwnProperty.call(e._map,"__ownerID")))}function n(e,t,n){var r=!0,i=!1;return[Object.keys(e).reduce((function(t,o){var a=""+o,s=n(t.get(a),e[a]),u=s[0],c=s[1],f=s[2];return c||(r=!1),f&&(i=!0),t.has(a)?t.set(a,u):t}),t),r,i]}function r(e,t){return(r=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function i(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,r(e,t)}function o(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function a(e,t,n){return t&&o(e.prototype,t),n&&o(e,n),e}var s=function(){function e(e,t){t&&(this._schemaAttribute="string"==typeof t?function(e){return e[t]}:t),this.define(e)}var n=e.prototype;return n.define=function(e){this.schema=e},n.getSchemaAttribute=function(e,t,n){return!this.isSingleSchema&&this._schemaAttribute(e,t,n)},n.inferSchema=function(e,t,n){if(this.isSingleSchema)return this.schema;var r=this.getSchemaAttribute(e,t,n);return this.schema[r]},n.normalizeValue=function(e,t,n,r,i,o){var a=this.inferSchema(e,t,n);if(!a)return e;var s=r(e,t,n,a,i,o);return this.isSingleSchema||null==s?s:{id:s,schema:this.getSchemaAttribute(e,t,n)}},n.denormalizeValue=function(e,n){var r=t(e)?e.get("schema"):e.schema;return this.isSingleSchema||r?n((this.isSingleSchema?void 0:t(e)?e.get("id"):e.id)||e,this.isSingleSchema?this.schema:this.schema[r]):[e,!0,!0]},a(e,[{key:"isSingleSchema",get:function(){return!this._schemaAttribute}}]),e}(),u=function(e){if(Array.isArray(e)&&e.length>1)throw new Error("Expected schema definition to be a single schema, but found "+e.length+".");return e[0]},c=function(e){return Array.isArray(e)?e:Object.keys(e).map((function(t){return e[t]}))},f=function(e){var t=e[1],n=e[2];return t&&!n},l=function(e,t,n,r,i,o,a){return e=u(e),c(t).map((function(t,s){return i(t,n,r,e,o,a)}))},h=function(e,t,n){e=u(e);var r=!1,i=!0;if(void 0===t&&e){var o=n(void 0,e);i=o[1],r=o[2]}return[t&&t.map?t.map((function(t){return n(t,e)})).filter(f).map((function(e){return e[0]})):t,i,r]},p=function(e){function t(){return e.apply(this,arguments)||this}i(t,e);var n=t.prototype;return n.normalize=function(e,t,n,r,i,o){var a=this;return c(e).map((function(e,s){return a.normalizeValue(e,t,n,r,i,o)})).filter((function(e){return null!=e}))},n.denormalize=function(e,t){var n=this,r=!1,i=!0;if(void 0===e&&this.schema){var o=t(void 0,this.schema);i=o[1],r=o[2]}return[e&&e.map?e.map((function(e){return n.denormalizeValue(e,t)})).filter(f).map((function(e){return e[0]})):e,i,r]},t}(s),d=function(e,t,n,r,i,o,a){var s=Object.assign({},t);return Object.keys(e).forEach((function(n){var r=e[n],u=i(t[n],t,n,r,o,a);null==u?delete s[n]:s[n]=u})),s},m=function(e,r,i){if(t(r))return n(e,r,i);var o=Object.assign({},r),a=!0,s=!1;return Object.keys(e).forEach((function(t){var n=i(o[t],e[t]),r=n[0],u=n[1],c=n[2];void 0!==o[t]&&(o[t]=r),c&&(s=!0),u||(a=!1)})),[o,a,s]},y=function(){function e(e){this.define(e)}var t=e.prototype;return t.define=function(e){this.schema=Object.keys(e).reduce((function(t,n){var r,i=e[n];return Object.assign({},t,((r={})[n]=i,r))}),this.schema||{})},t.normalize=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return d.apply(void 0,[this.schema].concat(t))},t.denormalize=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return m.apply(void 0,[this.schema].concat(t))},e}();function v(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function g(e,t){var n;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return v(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?v(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return(n=e[Symbol.iterator]()).next.bind(n)}var b=Symbol("Defined Members"),O=Symbol("unq"),k=function(){function e(){}return e.prototype.toString=function(){return this[O]},e.toJSON=function(){return{name:this.name,schema:this.schema}},e.fromJS=function(t,n,r){void 0===t&&(t={});var i=new this(t);return t instanceof e&&(t=t.constructor.toObjectDefined(t)),Object.assign(i,t),Object.defineProperty(i,b,{value:Object.keys(t),writable:!1}),Object.defineProperty(i,O,{value:""+Math.random(),writable:!1}),i},e.merge=function(e,t){var n=Object.assign(this.toObjectDefined(e),this.toObjectDefined(t));return this.fromJS(n)},e.hasDefined=function(e,t){return e[b].includes(t)},e.toObjectDefined=function(e){for(var t,n={},r=g(e[b]);!(t=r()).done;){var i=t.value;n[i]=e[i]}return n},e.keysDefined=function(e){return e[b]},e.normalize=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return d.apply(void 0,[this.schema].concat(t))},e.denormalize=function(e,t){var n=this,r=new this,i=Object.assign({},e),o=!1,a=!0;return Object.keys(this.schema).forEach((function(e){var s=t(i[e],n.schema[e]),u=s[0],c=s[1],f=s[2];void 0!==i[e]&&(i[e]=u),c||e in r&&!r[e]||(a=!1),!f||e in r&&!r[e]||(o=!0)})),[this.fromJS(i),a,o]},e.asSchema=function(){return"development"===process.env.NODE_ENV&&console.error("asSchema() is deprecated - use Entity directly instead."),this},e}();k.schema={};var w=function(e){function r(){return e.apply(this,arguments)||this}return i(r,e),r.toJSON=function(){return Object.assign({},e.toJSON.call(this),{key:this.key})},r.pk=function(e,t,n){return this.prototype.pk.call(e,t,n)||n},r.normalize=function(e,t,n,r,i,o){var a=this;if("string"==typeof e)return e;var s=this.fromJS(e,t,n);if("production"!==process.env.NODE_ENV&&"silent"!==this.automaticValidation){for(var u,c=new this,f=new Set(Object.keys(c)),l=this.keysDefined(s),h=[[],[],[]],p=h[0],d=h[1],m=h[2],y=g(l);!(u=y()).done;){var v=u.value;f.has(v)?p.push(v):m.push(v)}for(var b,O=g(f);!(b=O()).done;){var k=b.value;p.includes(k)||d.push(k)}if(f.size){if(Array.isArray(e)&&m.length){var w="Attempted to initialize "+this.name+" with an array, but named members were expected\n\nThis is likely due to a malformed response.\nTry inspecting the network response or fetch() return value.\nOr use debugging tools: https://resthooks.io/docs/guides/debugging\nLearn more about schemas: https://resthooks.io/docs/api/schema\nIf this is a mistake, you can disable this check by setting static automaticValidation = 'silent'\n\nMissing: "+d+"\nFirst three members: "+JSON.stringify(e.slice(0,3),null,2);if("warn"!==this.automaticValidation){var E=new Error(w);throw E.status=400,E}console.warn(w)}var S=Math.max(l.length/2,1)<=m.length&&f.size>Math.max(m.length,2)&&Math.pow(p.length,1.5)/2<=m.length,j=p.length<Math.min(1,f.size/2);if(S||j){var z="",_="substantially different than expected keys";j&&(z+="\n Missing: "+d,_="no matching keys found"),S&&(z+="\n Unexpected keys: "+m,_="a large number of unexpected keys found");var N="Attempted to initialize "+this.name+" with "+_+"\n\n This is likely due to a malformed response.\n Try inspecting the network response or fetch() return value.\n Or use debugging tools: https://resthooks.io/docs/guides/debugging\n Learn more about schemas: https://resthooks.io/docs/api/schema\n If this is a mistake, you can disable this check by setting static automaticValidation = 'silent'\n\n Expected keys:\n Found: "+p+z+"\n Value: "+JSON.stringify(this.toObjectDefined(s),null,2);if(!(p.length>=4&&S||"warn"===this.automaticValidation)){var A=new Error(N);throw A.status=400,A}console.warn(N)}}}var D=s.pk(t,n);if(void 0!==D&&""!==D){var x=this.key;return x in o||(o[x]={}),D in o[x]||(o[x][D]=[]),o[x][D].some((function(t){return t===e}))?D:(o[x][D].push(e),Object.keys(this.schema).forEach((function(e){if(Object.hasOwnProperty.call(s,e)){var t=a.schema[e];s[e]=r(s[e],s,e,t,i,o)}else if("production"!==process.env.NODE_ENV){var n=new Error("Schema key is missing in Entity\n\n Be sure all schema members are also part of the entity\n Or use debugging tools: https://resthooks.io/docs/guides/debugging\n Learn more about nesting schemas: https://resthooks.io/docs/guides/nested-response\n\n Entity keys: "+Object.keys(s)+"\n Schema key(missing): "+e+"\n ");throw n.status=400,n}})),i(this,s,s,t,n),D)}if("production"!==process.env.NODE_ENV){var V=new Error("Missing usable resource key when normalizing response.\n\n This is likely due to a malformed response.\n Try inspecting the network response or fetch() return value.\n Or use debugging tools: https://resthooks.io/docs/guides/debugging\n Learn more about schemas: https://resthooks.io/docs/api/schema\n\n Entity: "+this.name+"\n Value: "+(e&&JSON.stringify(e,null,2))+"\n ");throw V.status=400,V}},r.denormalize=function(e,r){var i=this;if(t(e)){var o=n(this.schema,e,r),a=o[0],s=o[1],u=o[2];return[this.fromJS(a.toObject()),s,u]}var c=new this,f=!1,l=!0,h=e;return Object.keys(this.schema).forEach((function(t){var n=i.schema[t],o=i.hasDefined(e,t)?e[t]:void 0,a=r(o,n),s=a[0],u=a[1],p=a[2];u||t in c&&!c[t]||(l=!1),!p||t in c&&!c[t]||(f=!0),i.hasDefined(e,t)&&h[t]!==s&&(h[t]=s)})),[h,l,f]},a(r,null,[{key:"key",get:function(){if("production"!==process.env.NODE_ENV&&(""===this.name||"Entity"===this.name))throw new Error("Entity classes without a name must define `static get key()`");return this.name}}]),r}(k);function E(e){return null!==e&&void 0!==e.pk}"production"!==process.env.NODE_ENV&&(w.fromJS=function(e){if(void 0===this.prototype.pk)throw new Error("cannot construct on abstract types");return k.fromJS.call(this,e)});var S=Symbol("ENTITY WAS DELETED");function j(e){return(j=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function z(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function _(e,t,n){return(_=z()?Reflect.construct:function(e,t,n){var i=[null];i.push.apply(i,t);var o=new(Function.bind.apply(e,i));return n&&r(o,n.prototype),o}).apply(null,arguments)}function N(e){var t="function"==typeof Map?new Map:void 0;return(N=function(e){if(null===e||(n=e,-1===Function.toString.call(n).indexOf("[native code]")))return e;var n;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,i)}function i(){return _(e,arguments,j(this).constructor)}return i.prototype=Object.create(e.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),r(i,e)})(e)}var A=function(){this.children=new WeakMap},D=function(e){function t(){for(var t,n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return(t=e.call.apply(e,[this].concat(r))||this).message="Keys must include at least one member",t}return i(t,e),t}(N(Error)),x=function(){function e(){this.first=new WeakMap}var t=e.prototype;return t.delete=function(e){var t=this.traverse(e);return null==t||delete t.value,!!t},t.get=function(e){var t=this.traverse(e);return null==t?void 0:t.value},t.has=function(e){var t=this.traverse(e);return!!t&&Object.prototype.hasOwnProperty.call(t,"value")},t.set=function(e,t){if(e.length<1)throw new D;for(var n,r=this.first,i=0;i<e.length;i++)r.has(e[i])?n=r.get(e[i]):(n=new A,r.set(e[i],n)),r=n.children,i===e.length-1&&(n.value=t);return this},t.traverse=function(e){for(var t,n=this.first,r=0;r<e.length;r++){if(!(t=n.get(e[r])))return;n=t.children}return t},e}(),V=function(e,n,r,i){var o=J(e);function a(e,r){if(!r)return[e,!0,!1];if(!r.denormalize||"function"!=typeof r.denormalize){if("function"==typeof r)return e instanceof r?[e,!0,!1]:[new r(e),!0,!1];if("object"==typeof r)return(Array.isArray(r)?h:m)(r,e,u)}return null===e?[e,!0,!1]:E(r)?void 0===e?[e,!1,!1]:function(e,n,r,i,o,a){var s=i(e,n);if(s===S)return[void 0,!0,!0];if("object"!=typeof s||null===s)return[s,!1,!1];void 0===o[n.key]&&(o[n.key]={});var u=!0,c=!1;if(!o[n.key][e]){var f=[s],l=M(r,f);a[n.key]||(a[n.key]={}),a[n.key][e]||(a[n.key][e]=new x);var h=a[n.key][e],p=t(s)?s:n.fromJS(s);o[n.key][e]=p;var d=n.denormalize(p,l);o[n.key][e]=d[0],u=d[1],c=d[2],h.has(f)?o[n.key][e]=h.get(f):h.set(f,o[n.key][e])}return[o[n.key][e],u,c]}(e,r,u,o,i,n):"function"==typeof r.denormalize?r.denormalize(e,u):[e,!0,!1]}var s=[],u=M(a,s);return function(e,t){s.push(e);var n=a(e,t);return Object(e)!==e?n:r.has(s)?[r.get(s),n[1],n[2]]:(r.set(s,n[0]),n)}},J=function(e){var n=t(e);return function(t,r){var i=r.key;return"object"==typeof t?t:n?e.getIn([i,t]):e[i]&&e[i][t]}};function M(e,t){var n=e.og||e,r=function(e,r){var i=n(e,r);if(i[0]&&r&&E(r))if(Object(i[0])===i[0])t.push(i[0]);else if("production"!==process.env.NODE_ENV)throw new Error("Unexpected primitive found during denormalization\nFound: "+i[0]+"\nExpected entity: "+r);return i};return r.og=e,r}var P=function e(t,n,r,i,o,a){return t&&i&&["function","object"].includes(typeof i)?i.normalize&&"function"==typeof i.normalize?i.normalize(t,n,r,e,o,a):"function"==typeof i?new i(t):(Array.isArray(i)?l:d)(i,t,n,r,e,o,a):t};var I=function(e){function t(t,n){if(!n)throw new Error('Expected option "schemaAttribute" not found on UnionSchema.');return e.call(this,t,n)||this}i(t,e);var n=t.prototype;return n.normalize=function(e,t,n,r,i,o){return this.normalizeValue(e,t,n,r,i,o)},n.denormalize=function(e,t){return this.denormalizeValue(e,t)},t}(s),T=function(e){function t(){return e.apply(this,arguments)||this}i(t,e);var n=t.prototype;return n.normalize=function(e,t,n,r,i,o){var a=this;return Object.keys(e).reduce((function(t,n,s){var u,c=e[n];return null!=c?Object.assign({},t,((u={})[n]=a.normalizeValue(c,e,n,r,i,o),u)):t}),{})},n.denormalize=function(e,t){var n=this,r=!0,i=!1;return[Object.keys(e).reduce((function(o,a){var s,u=e[a],c=n.denormalizeValue(u,t),f=c[0],l=c[1],h=c[2];return l||(r=!1),h&&(i=!0),!l||h?o:Object.assign({},o,((s={})[a]=f,s))}),{}),r,i]},t}(s),L=function(){function e(e){if("production"!==process.env.NODE_ENV&&!e)throw new Error('Expected option "entity" not found on DeleteSchema.');this._entity=e}var t=e.prototype;return t.normalize=function(e,t,n,r,i,o){if("string"==typeof e)return e;var a=this._entity.fromJS(e,t,n),s=a.pk(t,n);return i(this._entity,S,a,t,n),s},t.denormalize=function(e,t){return t(e,this._entity)},t._denormalizeNullable=function(){return[]},t._normalizeNullable=function(){return[]},t.merge=function(e,t){return t},e}(),U=Object.freeze({__proto__:null,Union:I,Values:T,Array:p,Object:y,Delete:L}),F=function(e){function t(){return e.apply(this,arguments)||this}return i(t,e),t.denormalize=function(e,t){return[e,!0,!1]},t}(w);e.DELETED=S,e.Entity=w,e.FlatEntity=F,e.SimpleRecord=k,e.WeakListMap=x,e.denormalize=function(e,t,n,r,i){if(void 0===r&&(r={}),void 0===i&&(i=new x),void 0===t)return[e,!0,!1,{}];if(void 0===e)return[void 0,!1,!1,{}];var o={},a=V(n,r,i,o);return[].concat(a(e,t),[o])},e.isEntity=E,e.normalize=function(e,t,n,r){if(void 0===n&&(n={}),void 0===r&&(r={}),void 0===t)return{entities:n,indexes:r,result:e};var i=function(e){return["object","function"].includes(typeof e)?"object":typeof e}(t);if(null===e||typeof e!==i){if("production"!==process.env.NODE_ENV){throw"string"==typeof e&&function(e){try{return"string"!=typeof JSON.parse(e)}catch(e){return!1}}(e)?new Error('Normalizing a string, but this does match schema.\n\nParsing this input string as JSON worked. This likely indicates fetch function did not parse\nthe JSON. By default, this only happens if "content-type" header includes "json".\nSee https://resthooks.io/docs/guides/custom-networking for more information\n\n Schema: '+JSON.stringify(t,void 0,2)+'\n Input: "'+e+'"'):new Error('Unexpected input given to normalize. Expected type to be "'+i+'", found "'+(null===e?"null":typeof e)+'".\n\n Schema: '+JSON.stringify(t,void 0,2)+'\n Input: "'+e+'"')}throw new Error('Unexpected input given to normalize. Expected type to be "'+i+'", found "'+(null===e?"null":typeof e)+'".')}var o={},a={},s=function(e,t,n,r){return function(r,i,o,a,s){var u=r.key,c=r.pk(o,a,s);u in e||(e[u]={});var f=e[u][c];if(e[u][c]=f?r.merge(f,i):i,Array.isArray(r.indexes)){var l=e[u][c];u in t||(t[u]={});for(var h,p=g(r.indexes);!(h=p()).done;){var d=h.value;d in t[u]||(t[u][d]={});var m=t[u][d];f&&delete m[f[d]],n[u]&&n[u][c]&&n[u][c][d]!==l[d]&&(m[n[u][c][d]]=S),d in l?m[l[d]]=c:"production"!==process.env.NODE_ENV&&console.warn("Index not found in entity. Indexes must be top-level members of your entity.\nIndex: "+d+"\nEntity: "+JSON.stringify(l,void 0,2))}}}}(o,a,n);return{entities:o,indexes:a,result:P(e,e,void 0,t,s,{})}},e.schema=U,Object.defineProperty(e,"__esModule",{value:!0})}));

@@ -1016,5 +1016,7 @@ var rest_hooks_normalizr = (function (exports) {

globalKey.push(input);
var ret = unvisit(input, schema);
if (typeof input !== 'object') return ret;
var ret = unvisit(input, schema); // in the case where WeakMap cannot be used
// this test ensures null is properly excluded from WeakMap
if (Object(input) !== input) return ret;
if (!resultCache.has(globalKey)) {

@@ -1080,3 +1082,3 @@ resultCache.set(globalKey, ret[0]);

/* istanbul ignore else */
if (typeof ret[0] === 'object') {
if (Object(ret[0]) === ret[0]) {
globalKey.push(ret[0]);

@@ -1083,0 +1085,0 @@ } else if (process.env.NODE_ENV !== 'production') {

@@ -1,1 +0,1 @@

var rest_hooks_normalizr=function(e){"use strict";function t(e){return!(!e||"function"!=typeof e.hasOwnProperty||!(Object.hasOwnProperty.call(e,"__ownerID")||e._map&&Object.hasOwnProperty.call(e._map,"__ownerID")))}function n(e,t,n){var r=!0,i=!1;return[Object.keys(e).reduce((function(t,o){var a=""+o,s=n(t.get(a),e[a]),u=s[0],c=s[1],f=s[2];return c||(r=!1),f&&(i=!0),t.has(a)?t.set(a,u):t}),t),r,i]}function r(e,t){return(r=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function i(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,r(e,t)}function o(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function a(e,t,n){return t&&o(e.prototype,t),n&&o(e,n),e}var s=function(){function e(e,t){t&&(this._schemaAttribute="string"==typeof t?function(e){return e[t]}:t),this.define(e)}var n=e.prototype;return n.define=function(e){this.schema=e},n.getSchemaAttribute=function(e,t,n){return!this.isSingleSchema&&this._schemaAttribute(e,t,n)},n.inferSchema=function(e,t,n){if(this.isSingleSchema)return this.schema;var r=this.getSchemaAttribute(e,t,n);return this.schema[r]},n.normalizeValue=function(e,t,n,r,i,o){var a=this.inferSchema(e,t,n);if(!a)return e;var s=r(e,t,n,a,i,o);return this.isSingleSchema||null==s?s:{id:s,schema:this.getSchemaAttribute(e,t,n)}},n.denormalizeValue=function(e,n){var r=t(e)?e.get("schema"):e.schema;return this.isSingleSchema||r?n((this.isSingleSchema?void 0:t(e)?e.get("id"):e.id)||e,this.isSingleSchema?this.schema:this.schema[r]):[e,!0,!0]},a(e,[{key:"isSingleSchema",get:function(){return!this._schemaAttribute}}]),e}(),u=function(e){if(Array.isArray(e)&&e.length>1)throw new Error("Expected schema definition to be a single schema, but found "+e.length+".");return e[0]},c=function(e){return Array.isArray(e)?e:Object.keys(e).map((function(t){return e[t]}))},f=function(e){var t=e[1],n=e[2];return t&&!n},l=function(e,t,n,r,i,o,a){return e=u(e),c(t).map((function(t,s){return i(t,n,r,e,o,a)}))},h=function(e,t,n){e=u(e);var r=!1,i=!0;if(void 0===t&&e){var o=n(void 0,e);i=o[1],r=o[2]}return[t&&t.map?t.map((function(t){return n(t,e)})).filter(f).map((function(e){return e[0]})):t,i,r]},p=function(e){function t(){return e.apply(this,arguments)||this}i(t,e);var n=t.prototype;return n.normalize=function(e,t,n,r,i,o){var a=this;return c(e).map((function(e,s){return a.normalizeValue(e,t,n,r,i,o)})).filter((function(e){return null!=e}))},n.denormalize=function(e,t){var n=this,r=!1,i=!0;if(void 0===e&&this.schema){var o=t(void 0,this.schema);i=o[1],r=o[2]}return[e&&e.map?e.map((function(e){return n.denormalizeValue(e,t)})).filter(f).map((function(e){return e[0]})):e,i,r]},t}(s),d=function(e,t,n,r,i,o,a){var s=Object.assign({},t);return Object.keys(e).forEach((function(n){var r=e[n],u=i(t[n],t,n,r,o,a);null==u?delete s[n]:s[n]=u})),s},m=function(e,r,i){if(t(r))return n(e,r,i);var o=Object.assign({},r),a=!0,s=!1;return Object.keys(e).forEach((function(t){var n=i(o[t],e[t]),r=n[0],u=n[1],c=n[2];void 0!==o[t]&&(o[t]=r),c&&(s=!0),u||(a=!1)})),[o,a,s]},y=function(){function e(e){this.define(e)}var t=e.prototype;return t.define=function(e){this.schema=Object.keys(e).reduce((function(t,n){var r,i=e[n];return Object.assign({},t,((r={})[n]=i,r))}),this.schema||{})},t.normalize=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return d.apply(void 0,[this.schema].concat(t))},t.denormalize=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return m.apply(void 0,[this.schema].concat(t))},e}();function v(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function g(e,t){var n;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return v(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?v(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return(n=e[Symbol.iterator]()).next.bind(n)}var b=Symbol("Defined Members"),O=Symbol("unq"),k=function(){function e(){}return e.prototype.toString=function(){return this[O]},e.toJSON=function(){return{name:this.name,schema:this.schema}},e.fromJS=function(t,n,r){void 0===t&&(t={});var i=new this(t);return t instanceof e&&(t=t.constructor.toObjectDefined(t)),Object.assign(i,t),Object.defineProperty(i,b,{value:Object.keys(t),writable:!1}),Object.defineProperty(i,O,{value:""+Math.random(),writable:!1}),i},e.merge=function(e,t){var n=Object.assign(this.toObjectDefined(e),this.toObjectDefined(t));return this.fromJS(n)},e.hasDefined=function(e,t){return e[b].includes(t)},e.toObjectDefined=function(e){for(var t,n={},r=g(e[b]);!(t=r()).done;){var i=t.value;n[i]=e[i]}return n},e.keysDefined=function(e){return e[b]},e.normalize=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return d.apply(void 0,[this.schema].concat(t))},e.denormalize=function(e,t){var n=this,r=new this,i=Object.assign({},e),o=!1,a=!0;return Object.keys(this.schema).forEach((function(e){var s=t(i[e],n.schema[e]),u=s[0],c=s[1],f=s[2];void 0!==i[e]&&(i[e]=u),c||e in r&&!r[e]||(a=!1),!f||e in r&&!r[e]||(o=!0)})),[this.fromJS(i),a,o]},e.asSchema=function(){return"development"===process.env.NODE_ENV&&console.error("asSchema() is deprecated - use Entity directly instead."),this},e}();k.schema={};var w=function(e){function r(){return e.apply(this,arguments)||this}return i(r,e),r.toJSON=function(){return Object.assign({},e.toJSON.call(this),{key:this.key})},r.pk=function(e,t,n){return this.prototype.pk.call(e,t,n)||n},r.normalize=function(e,t,n,r,i,o){var a=this;if("string"==typeof e)return e;var s=this.fromJS(e,t,n);if("production"!==process.env.NODE_ENV&&"silent"!==this.automaticValidation){for(var u,c=new this,f=new Set(Object.keys(c)),l=this.keysDefined(s),h=[[],[],[]],p=h[0],d=h[1],m=h[2],y=g(l);!(u=y()).done;){var v=u.value;f.has(v)?p.push(v):m.push(v)}for(var b,O=g(f);!(b=O()).done;){var k=b.value;p.includes(k)||d.push(k)}if(f.size){if(Array.isArray(e)&&m.length){var w="Attempted to initialize "+this.name+" with an array, but named members were expected\n\nThis is likely due to a malformed response.\nTry inspecting the network response or fetch() return value.\nOr use debugging tools: https://resthooks.io/docs/guides/debugging\nLearn more about schemas: https://resthooks.io/docs/api/schema\nIf this is a mistake, you can disable this check by setting static automaticValidation = 'silent'\n\nMissing: "+d+"\nFirst three members: "+JSON.stringify(e.slice(0,3),null,2);if("warn"!==this.automaticValidation){var E=new Error(w);throw E.status=400,E}console.warn(w)}var S=Math.max(l.length/2,1)<=m.length&&f.size>Math.max(m.length,2)&&Math.pow(p.length,1.5)/2<=m.length,j=p.length<Math.min(1,f.size/2);if(S||j){var z="",_="substantially different than expected keys";j&&(z+="\n Missing: "+d,_="no matching keys found"),S&&(z+="\n Unexpected keys: "+m,_="a large number of unexpected keys found");var N="Attempted to initialize "+this.name+" with "+_+"\n\n This is likely due to a malformed response.\n Try inspecting the network response or fetch() return value.\n Or use debugging tools: https://resthooks.io/docs/guides/debugging\n Learn more about schemas: https://resthooks.io/docs/api/schema\n If this is a mistake, you can disable this check by setting static automaticValidation = 'silent'\n\n Expected keys:\n Found: "+p+z+"\n Value: "+JSON.stringify(this.toObjectDefined(s),null,2);if(!(p.length>=4&&S||"warn"===this.automaticValidation)){var A=new Error(N);throw A.status=400,A}console.warn(N)}}}var D=s.pk(t,n);if(void 0!==D&&""!==D){var x=this.key;return x in o||(o[x]={}),D in o[x]||(o[x][D]=[]),o[x][D].some((function(t){return t===e}))?D:(o[x][D].push(e),Object.keys(this.schema).forEach((function(e){if(Object.hasOwnProperty.call(s,e)){var t=a.schema[e];s[e]=r(s[e],s,e,t,i,o)}else if("production"!==process.env.NODE_ENV){var n=new Error("Schema key is missing in Entity\n\n Be sure all schema members are also part of the entity\n Or use debugging tools: https://resthooks.io/docs/guides/debugging\n Learn more about nesting schemas: https://resthooks.io/docs/guides/nested-response\n\n Entity keys: "+Object.keys(s)+"\n Schema key(missing): "+e+"\n ");throw n.status=400,n}})),i(this,s,s,t,n),D)}if("production"!==process.env.NODE_ENV){var V=new Error("Missing usable resource key when normalizing response.\n\n This is likely due to a malformed response.\n Try inspecting the network response or fetch() return value.\n Or use debugging tools: https://resthooks.io/docs/guides/debugging\n Learn more about schemas: https://resthooks.io/docs/api/schema\n\n Entity: "+this.name+"\n Value: "+(e&&JSON.stringify(e,null,2))+"\n ");throw V.status=400,V}},r.denormalize=function(e,r){var i=this;if(t(e)){var o=n(this.schema,e,r),a=o[0],s=o[1],u=o[2];return[this.fromJS(a.toObject()),s,u]}var c=new this,f=!1,l=!0,h=e;return Object.keys(this.schema).forEach((function(t){var n=i.schema[t],o=i.hasDefined(e,t)?e[t]:void 0,a=r(o,n),s=a[0],u=a[1],p=a[2];u||t in c&&!c[t]||(l=!1),!p||t in c&&!c[t]||(f=!0),i.hasDefined(e,t)&&h[t]!==s&&(h[t]=s)})),[h,l,f]},a(r,null,[{key:"key",get:function(){if("production"!==process.env.NODE_ENV&&(""===this.name||"Entity"===this.name))throw new Error("Entity classes without a name must define `static get key()`");return this.name}}]),r}(k);function E(e){return null!==e&&void 0!==e.pk}"production"!==process.env.NODE_ENV&&(w.fromJS=function(e){if(void 0===this.prototype.pk)throw new Error("cannot construct on abstract types");return k.fromJS.call(this,e)});var S=Symbol("ENTITY WAS DELETED");function j(e){return(j=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function z(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function _(e,t,n){return(_=z()?Reflect.construct:function(e,t,n){var i=[null];i.push.apply(i,t);var o=new(Function.bind.apply(e,i));return n&&r(o,n.prototype),o}).apply(null,arguments)}function N(e){var t="function"==typeof Map?new Map:void 0;return(N=function(e){if(null===e||(n=e,-1===Function.toString.call(n).indexOf("[native code]")))return e;var n;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,i)}function i(){return _(e,arguments,j(this).constructor)}return i.prototype=Object.create(e.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),r(i,e)})(e)}var A=function(){this.children=new WeakMap},D=function(e){function t(){for(var t,n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return(t=e.call.apply(e,[this].concat(r))||this).message="Keys must include at least one member",t}return i(t,e),t}(N(Error)),x=function(){function e(){this.first=new WeakMap}var t=e.prototype;return t.delete=function(e){var t=this.traverse(e);return null==t||delete t.value,!!t},t.get=function(e){var t=this.traverse(e);return null==t?void 0:t.value},t.has=function(e){var t=this.traverse(e);return!!t&&Object.prototype.hasOwnProperty.call(t,"value")},t.set=function(e,t){if(e.length<1)throw new D;for(var n,r=this.first,i=0;i<e.length;i++)r.has(e[i])?n=r.get(e[i]):(n=new A,r.set(e[i],n)),r=n.children,i===e.length-1&&(n.value=t);return this},t.traverse=function(e){for(var t,n=this.first,r=0;r<e.length;r++){if(!(t=n.get(e[r])))return;n=t.children}return t},e}(),V=function(e,n,r,i){var o=J(e);function a(e,r){if(!r)return[e,!0,!1];if(!r.denormalize||"function"!=typeof r.denormalize){if("function"==typeof r)return e instanceof r?[e,!0,!1]:[new r(e),!0,!1];if("object"==typeof r)return(Array.isArray(r)?h:m)(r,e,u)}return null===e?[e,!0,!1]:E(r)?void 0===e?[e,!1,!1]:function(e,n,r,i,o,a){var s=i(e,n);if(s===S)return[void 0,!0,!0];if("object"!=typeof s||null===s)return[s,!1,!1];void 0===o[n.key]&&(o[n.key]={});var u=!0,c=!1;if(!o[n.key][e]){var f=[s],l=M(r,f);a[n.key]||(a[n.key]={}),a[n.key][e]||(a[n.key][e]=new x);var h=a[n.key][e],p=t(s)?s:n.fromJS(s);o[n.key][e]=p;var d=n.denormalize(p,l);o[n.key][e]=d[0],u=d[1],c=d[2],h.has(f)?o[n.key][e]=h.get(f):h.set(f,o[n.key][e])}return[o[n.key][e],u,c]}(e,r,u,o,i,n):"function"==typeof r.denormalize?r.denormalize(e,u):[e,!0,!1]}var s=[],u=M(a,s);return function(e,t){s.push(e);var n=a(e,t);return"object"!=typeof e?n:r.has(s)?[r.get(s),n[1],n[2]]:(r.set(s,n[0]),n)}},J=function(e){var n=t(e);return function(t,r){var i=r.key;return"object"==typeof t?t:n?e.getIn([i,t]):e[i]&&e[i][t]}};function M(e,t){var n=e.og||e,r=function(e,r){var i=n(e,r);if(i[0]&&r&&E(r))if("object"==typeof i[0])t.push(i[0]);else if("production"!==process.env.NODE_ENV)throw new Error("Unexpected primitive found during denormalization\nFound: "+i[0]+"\nExpected entity: "+r);return i};return r.og=e,r}var P=function e(t,n,r,i,o,a){return t&&i&&["function","object"].includes(typeof i)?i.normalize&&"function"==typeof i.normalize?i.normalize(t,n,r,e,o,a):"function"==typeof i?new i(t):(Array.isArray(i)?l:d)(i,t,n,r,e,o,a):t};var I=function(e){function t(t,n){if(!n)throw new Error('Expected option "schemaAttribute" not found on UnionSchema.');return e.call(this,t,n)||this}i(t,e);var n=t.prototype;return n.normalize=function(e,t,n,r,i,o){return this.normalizeValue(e,t,n,r,i,o)},n.denormalize=function(e,t){return this.denormalizeValue(e,t)},t}(s),T=function(e){function t(){return e.apply(this,arguments)||this}i(t,e);var n=t.prototype;return n.normalize=function(e,t,n,r,i,o){var a=this;return Object.keys(e).reduce((function(t,n,s){var u,c=e[n];return null!=c?Object.assign({},t,((u={})[n]=a.normalizeValue(c,e,n,r,i,o),u)):t}),{})},n.denormalize=function(e,t){var n=this,r=!0,i=!1;return[Object.keys(e).reduce((function(o,a){var s,u=e[a],c=n.denormalizeValue(u,t),f=c[0],l=c[1],h=c[2];return l||(r=!1),h&&(i=!0),!l||h?o:Object.assign({},o,((s={})[a]=f,s))}),{}),r,i]},t}(s),L=function(){function e(e){if("production"!==process.env.NODE_ENV&&!e)throw new Error('Expected option "entity" not found on DeleteSchema.');this._entity=e}var t=e.prototype;return t.normalize=function(e,t,n,r,i,o){if("string"==typeof e)return e;var a=this._entity.fromJS(e,t,n),s=a.pk(t,n);return i(this._entity,S,a,t,n),s},t.denormalize=function(e,t){return t(e,this._entity)},t._denormalizeNullable=function(){return[]},t._normalizeNullable=function(){return[]},t.merge=function(e,t){return t},e}(),U=Object.freeze({__proto__:null,Union:I,Values:T,Array:p,Object:y,Delete:L}),F=function(e){function t(){return e.apply(this,arguments)||this}return i(t,e),t.denormalize=function(e,t){return[e,!0,!1]},t}(w);return e.DELETED=S,e.Entity=w,e.FlatEntity=F,e.SimpleRecord=k,e.WeakListMap=x,e.denormalize=function(e,t,n,r,i){if(void 0===r&&(r={}),void 0===i&&(i=new x),void 0===t)return[e,!0,!1,{}];if(void 0===e)return[void 0,!1,!1,{}];var o={},a=V(n,r,i,o);return[].concat(a(e,t),[o])},e.isEntity=E,e.normalize=function(e,t,n,r){if(void 0===n&&(n={}),void 0===r&&(r={}),void 0===t)return{entities:n,indexes:r,result:e};var i=function(e){return["object","function"].includes(typeof e)?"object":typeof e}(t);if(null===e||typeof e!==i){if("production"!==process.env.NODE_ENV){throw"string"==typeof e&&function(e){try{return"string"!=typeof JSON.parse(e)}catch(e){return!1}}(e)?new Error('Normalizing a string, but this does match schema.\n\nParsing this input string as JSON worked. This likely indicates fetch function did not parse\nthe JSON. By default, this only happens if "content-type" header includes "json".\nSee https://resthooks.io/docs/guides/custom-networking for more information\n\n Schema: '+JSON.stringify(t,void 0,2)+'\n Input: "'+e+'"'):new Error('Unexpected input given to normalize. Expected type to be "'+i+'", found "'+(null===e?"null":typeof e)+'".\n\n Schema: '+JSON.stringify(t,void 0,2)+'\n Input: "'+e+'"')}throw new Error('Unexpected input given to normalize. Expected type to be "'+i+'", found "'+(null===e?"null":typeof e)+'".')}var o={},a={},s=function(e,t,n,r){return function(r,i,o,a,s){var u=r.key,c=r.pk(o,a,s);u in e||(e[u]={});var f=e[u][c];if(e[u][c]=f?r.merge(f,i):i,Array.isArray(r.indexes)){var l=e[u][c];u in t||(t[u]={});for(var h,p=g(r.indexes);!(h=p()).done;){var d=h.value;d in t[u]||(t[u][d]={});var m=t[u][d];f&&delete m[f[d]],n[u]&&n[u][c]&&n[u][c][d]!==l[d]&&(m[n[u][c][d]]=S),d in l?m[l[d]]=c:"production"!==process.env.NODE_ENV&&console.warn("Index not found in entity. Indexes must be top-level members of your entity.\nIndex: "+d+"\nEntity: "+JSON.stringify(l,void 0,2))}}}}(o,a,n);return{entities:o,indexes:a,result:P(e,e,void 0,t,s,{})}},e.schema=U,Object.defineProperty(e,"__esModule",{value:!0}),e}({});
var rest_hooks_normalizr=function(e){"use strict";function t(e){return!(!e||"function"!=typeof e.hasOwnProperty||!(Object.hasOwnProperty.call(e,"__ownerID")||e._map&&Object.hasOwnProperty.call(e._map,"__ownerID")))}function n(e,t,n){var r=!0,i=!1;return[Object.keys(e).reduce((function(t,o){var a=""+o,s=n(t.get(a),e[a]),u=s[0],c=s[1],f=s[2];return c||(r=!1),f&&(i=!0),t.has(a)?t.set(a,u):t}),t),r,i]}function r(e,t){return(r=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function i(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,r(e,t)}function o(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function a(e,t,n){return t&&o(e.prototype,t),n&&o(e,n),e}var s=function(){function e(e,t){t&&(this._schemaAttribute="string"==typeof t?function(e){return e[t]}:t),this.define(e)}var n=e.prototype;return n.define=function(e){this.schema=e},n.getSchemaAttribute=function(e,t,n){return!this.isSingleSchema&&this._schemaAttribute(e,t,n)},n.inferSchema=function(e,t,n){if(this.isSingleSchema)return this.schema;var r=this.getSchemaAttribute(e,t,n);return this.schema[r]},n.normalizeValue=function(e,t,n,r,i,o){var a=this.inferSchema(e,t,n);if(!a)return e;var s=r(e,t,n,a,i,o);return this.isSingleSchema||null==s?s:{id:s,schema:this.getSchemaAttribute(e,t,n)}},n.denormalizeValue=function(e,n){var r=t(e)?e.get("schema"):e.schema;return this.isSingleSchema||r?n((this.isSingleSchema?void 0:t(e)?e.get("id"):e.id)||e,this.isSingleSchema?this.schema:this.schema[r]):[e,!0,!0]},a(e,[{key:"isSingleSchema",get:function(){return!this._schemaAttribute}}]),e}(),u=function(e){if(Array.isArray(e)&&e.length>1)throw new Error("Expected schema definition to be a single schema, but found "+e.length+".");return e[0]},c=function(e){return Array.isArray(e)?e:Object.keys(e).map((function(t){return e[t]}))},f=function(e){var t=e[1],n=e[2];return t&&!n},l=function(e,t,n,r,i,o,a){return e=u(e),c(t).map((function(t,s){return i(t,n,r,e,o,a)}))},h=function(e,t,n){e=u(e);var r=!1,i=!0;if(void 0===t&&e){var o=n(void 0,e);i=o[1],r=o[2]}return[t&&t.map?t.map((function(t){return n(t,e)})).filter(f).map((function(e){return e[0]})):t,i,r]},p=function(e){function t(){return e.apply(this,arguments)||this}i(t,e);var n=t.prototype;return n.normalize=function(e,t,n,r,i,o){var a=this;return c(e).map((function(e,s){return a.normalizeValue(e,t,n,r,i,o)})).filter((function(e){return null!=e}))},n.denormalize=function(e,t){var n=this,r=!1,i=!0;if(void 0===e&&this.schema){var o=t(void 0,this.schema);i=o[1],r=o[2]}return[e&&e.map?e.map((function(e){return n.denormalizeValue(e,t)})).filter(f).map((function(e){return e[0]})):e,i,r]},t}(s),d=function(e,t,n,r,i,o,a){var s=Object.assign({},t);return Object.keys(e).forEach((function(n){var r=e[n],u=i(t[n],t,n,r,o,a);null==u?delete s[n]:s[n]=u})),s},m=function(e,r,i){if(t(r))return n(e,r,i);var o=Object.assign({},r),a=!0,s=!1;return Object.keys(e).forEach((function(t){var n=i(o[t],e[t]),r=n[0],u=n[1],c=n[2];void 0!==o[t]&&(o[t]=r),c&&(s=!0),u||(a=!1)})),[o,a,s]},y=function(){function e(e){this.define(e)}var t=e.prototype;return t.define=function(e){this.schema=Object.keys(e).reduce((function(t,n){var r,i=e[n];return Object.assign({},t,((r={})[n]=i,r))}),this.schema||{})},t.normalize=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return d.apply(void 0,[this.schema].concat(t))},t.denormalize=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return m.apply(void 0,[this.schema].concat(t))},e}();function v(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function g(e,t){var n;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return v(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?v(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return(n=e[Symbol.iterator]()).next.bind(n)}var b=Symbol("Defined Members"),O=Symbol("unq"),k=function(){function e(){}return e.prototype.toString=function(){return this[O]},e.toJSON=function(){return{name:this.name,schema:this.schema}},e.fromJS=function(t,n,r){void 0===t&&(t={});var i=new this(t);return t instanceof e&&(t=t.constructor.toObjectDefined(t)),Object.assign(i,t),Object.defineProperty(i,b,{value:Object.keys(t),writable:!1}),Object.defineProperty(i,O,{value:""+Math.random(),writable:!1}),i},e.merge=function(e,t){var n=Object.assign(this.toObjectDefined(e),this.toObjectDefined(t));return this.fromJS(n)},e.hasDefined=function(e,t){return e[b].includes(t)},e.toObjectDefined=function(e){for(var t,n={},r=g(e[b]);!(t=r()).done;){var i=t.value;n[i]=e[i]}return n},e.keysDefined=function(e){return e[b]},e.normalize=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return d.apply(void 0,[this.schema].concat(t))},e.denormalize=function(e,t){var n=this,r=new this,i=Object.assign({},e),o=!1,a=!0;return Object.keys(this.schema).forEach((function(e){var s=t(i[e],n.schema[e]),u=s[0],c=s[1],f=s[2];void 0!==i[e]&&(i[e]=u),c||e in r&&!r[e]||(a=!1),!f||e in r&&!r[e]||(o=!0)})),[this.fromJS(i),a,o]},e.asSchema=function(){return"development"===process.env.NODE_ENV&&console.error("asSchema() is deprecated - use Entity directly instead."),this},e}();k.schema={};var w=function(e){function r(){return e.apply(this,arguments)||this}return i(r,e),r.toJSON=function(){return Object.assign({},e.toJSON.call(this),{key:this.key})},r.pk=function(e,t,n){return this.prototype.pk.call(e,t,n)||n},r.normalize=function(e,t,n,r,i,o){var a=this;if("string"==typeof e)return e;var s=this.fromJS(e,t,n);if("production"!==process.env.NODE_ENV&&"silent"!==this.automaticValidation){for(var u,c=new this,f=new Set(Object.keys(c)),l=this.keysDefined(s),h=[[],[],[]],p=h[0],d=h[1],m=h[2],y=g(l);!(u=y()).done;){var v=u.value;f.has(v)?p.push(v):m.push(v)}for(var b,O=g(f);!(b=O()).done;){var k=b.value;p.includes(k)||d.push(k)}if(f.size){if(Array.isArray(e)&&m.length){var w="Attempted to initialize "+this.name+" with an array, but named members were expected\n\nThis is likely due to a malformed response.\nTry inspecting the network response or fetch() return value.\nOr use debugging tools: https://resthooks.io/docs/guides/debugging\nLearn more about schemas: https://resthooks.io/docs/api/schema\nIf this is a mistake, you can disable this check by setting static automaticValidation = 'silent'\n\nMissing: "+d+"\nFirst three members: "+JSON.stringify(e.slice(0,3),null,2);if("warn"!==this.automaticValidation){var E=new Error(w);throw E.status=400,E}console.warn(w)}var S=Math.max(l.length/2,1)<=m.length&&f.size>Math.max(m.length,2)&&Math.pow(p.length,1.5)/2<=m.length,j=p.length<Math.min(1,f.size/2);if(S||j){var z="",_="substantially different than expected keys";j&&(z+="\n Missing: "+d,_="no matching keys found"),S&&(z+="\n Unexpected keys: "+m,_="a large number of unexpected keys found");var N="Attempted to initialize "+this.name+" with "+_+"\n\n This is likely due to a malformed response.\n Try inspecting the network response or fetch() return value.\n Or use debugging tools: https://resthooks.io/docs/guides/debugging\n Learn more about schemas: https://resthooks.io/docs/api/schema\n If this is a mistake, you can disable this check by setting static automaticValidation = 'silent'\n\n Expected keys:\n Found: "+p+z+"\n Value: "+JSON.stringify(this.toObjectDefined(s),null,2);if(!(p.length>=4&&S||"warn"===this.automaticValidation)){var A=new Error(N);throw A.status=400,A}console.warn(N)}}}var D=s.pk(t,n);if(void 0!==D&&""!==D){var x=this.key;return x in o||(o[x]={}),D in o[x]||(o[x][D]=[]),o[x][D].some((function(t){return t===e}))?D:(o[x][D].push(e),Object.keys(this.schema).forEach((function(e){if(Object.hasOwnProperty.call(s,e)){var t=a.schema[e];s[e]=r(s[e],s,e,t,i,o)}else if("production"!==process.env.NODE_ENV){var n=new Error("Schema key is missing in Entity\n\n Be sure all schema members are also part of the entity\n Or use debugging tools: https://resthooks.io/docs/guides/debugging\n Learn more about nesting schemas: https://resthooks.io/docs/guides/nested-response\n\n Entity keys: "+Object.keys(s)+"\n Schema key(missing): "+e+"\n ");throw n.status=400,n}})),i(this,s,s,t,n),D)}if("production"!==process.env.NODE_ENV){var V=new Error("Missing usable resource key when normalizing response.\n\n This is likely due to a malformed response.\n Try inspecting the network response or fetch() return value.\n Or use debugging tools: https://resthooks.io/docs/guides/debugging\n Learn more about schemas: https://resthooks.io/docs/api/schema\n\n Entity: "+this.name+"\n Value: "+(e&&JSON.stringify(e,null,2))+"\n ");throw V.status=400,V}},r.denormalize=function(e,r){var i=this;if(t(e)){var o=n(this.schema,e,r),a=o[0],s=o[1],u=o[2];return[this.fromJS(a.toObject()),s,u]}var c=new this,f=!1,l=!0,h=e;return Object.keys(this.schema).forEach((function(t){var n=i.schema[t],o=i.hasDefined(e,t)?e[t]:void 0,a=r(o,n),s=a[0],u=a[1],p=a[2];u||t in c&&!c[t]||(l=!1),!p||t in c&&!c[t]||(f=!0),i.hasDefined(e,t)&&h[t]!==s&&(h[t]=s)})),[h,l,f]},a(r,null,[{key:"key",get:function(){if("production"!==process.env.NODE_ENV&&(""===this.name||"Entity"===this.name))throw new Error("Entity classes without a name must define `static get key()`");return this.name}}]),r}(k);function E(e){return null!==e&&void 0!==e.pk}"production"!==process.env.NODE_ENV&&(w.fromJS=function(e){if(void 0===this.prototype.pk)throw new Error("cannot construct on abstract types");return k.fromJS.call(this,e)});var S=Symbol("ENTITY WAS DELETED");function j(e){return(j=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function z(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function _(e,t,n){return(_=z()?Reflect.construct:function(e,t,n){var i=[null];i.push.apply(i,t);var o=new(Function.bind.apply(e,i));return n&&r(o,n.prototype),o}).apply(null,arguments)}function N(e){var t="function"==typeof Map?new Map:void 0;return(N=function(e){if(null===e||(n=e,-1===Function.toString.call(n).indexOf("[native code]")))return e;var n;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,i)}function i(){return _(e,arguments,j(this).constructor)}return i.prototype=Object.create(e.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),r(i,e)})(e)}var A=function(){this.children=new WeakMap},D=function(e){function t(){for(var t,n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return(t=e.call.apply(e,[this].concat(r))||this).message="Keys must include at least one member",t}return i(t,e),t}(N(Error)),x=function(){function e(){this.first=new WeakMap}var t=e.prototype;return t.delete=function(e){var t=this.traverse(e);return null==t||delete t.value,!!t},t.get=function(e){var t=this.traverse(e);return null==t?void 0:t.value},t.has=function(e){var t=this.traverse(e);return!!t&&Object.prototype.hasOwnProperty.call(t,"value")},t.set=function(e,t){if(e.length<1)throw new D;for(var n,r=this.first,i=0;i<e.length;i++)r.has(e[i])?n=r.get(e[i]):(n=new A,r.set(e[i],n)),r=n.children,i===e.length-1&&(n.value=t);return this},t.traverse=function(e){for(var t,n=this.first,r=0;r<e.length;r++){if(!(t=n.get(e[r])))return;n=t.children}return t},e}(),V=function(e,n,r,i){var o=J(e);function a(e,r){if(!r)return[e,!0,!1];if(!r.denormalize||"function"!=typeof r.denormalize){if("function"==typeof r)return e instanceof r?[e,!0,!1]:[new r(e),!0,!1];if("object"==typeof r)return(Array.isArray(r)?h:m)(r,e,u)}return null===e?[e,!0,!1]:E(r)?void 0===e?[e,!1,!1]:function(e,n,r,i,o,a){var s=i(e,n);if(s===S)return[void 0,!0,!0];if("object"!=typeof s||null===s)return[s,!1,!1];void 0===o[n.key]&&(o[n.key]={});var u=!0,c=!1;if(!o[n.key][e]){var f=[s],l=M(r,f);a[n.key]||(a[n.key]={}),a[n.key][e]||(a[n.key][e]=new x);var h=a[n.key][e],p=t(s)?s:n.fromJS(s);o[n.key][e]=p;var d=n.denormalize(p,l);o[n.key][e]=d[0],u=d[1],c=d[2],h.has(f)?o[n.key][e]=h.get(f):h.set(f,o[n.key][e])}return[o[n.key][e],u,c]}(e,r,u,o,i,n):"function"==typeof r.denormalize?r.denormalize(e,u):[e,!0,!1]}var s=[],u=M(a,s);return function(e,t){s.push(e);var n=a(e,t);return Object(e)!==e?n:r.has(s)?[r.get(s),n[1],n[2]]:(r.set(s,n[0]),n)}},J=function(e){var n=t(e);return function(t,r){var i=r.key;return"object"==typeof t?t:n?e.getIn([i,t]):e[i]&&e[i][t]}};function M(e,t){var n=e.og||e,r=function(e,r){var i=n(e,r);if(i[0]&&r&&E(r))if(Object(i[0])===i[0])t.push(i[0]);else if("production"!==process.env.NODE_ENV)throw new Error("Unexpected primitive found during denormalization\nFound: "+i[0]+"\nExpected entity: "+r);return i};return r.og=e,r}var P=function e(t,n,r,i,o,a){return t&&i&&["function","object"].includes(typeof i)?i.normalize&&"function"==typeof i.normalize?i.normalize(t,n,r,e,o,a):"function"==typeof i?new i(t):(Array.isArray(i)?l:d)(i,t,n,r,e,o,a):t};var I=function(e){function t(t,n){if(!n)throw new Error('Expected option "schemaAttribute" not found on UnionSchema.');return e.call(this,t,n)||this}i(t,e);var n=t.prototype;return n.normalize=function(e,t,n,r,i,o){return this.normalizeValue(e,t,n,r,i,o)},n.denormalize=function(e,t){return this.denormalizeValue(e,t)},t}(s),T=function(e){function t(){return e.apply(this,arguments)||this}i(t,e);var n=t.prototype;return n.normalize=function(e,t,n,r,i,o){var a=this;return Object.keys(e).reduce((function(t,n,s){var u,c=e[n];return null!=c?Object.assign({},t,((u={})[n]=a.normalizeValue(c,e,n,r,i,o),u)):t}),{})},n.denormalize=function(e,t){var n=this,r=!0,i=!1;return[Object.keys(e).reduce((function(o,a){var s,u=e[a],c=n.denormalizeValue(u,t),f=c[0],l=c[1],h=c[2];return l||(r=!1),h&&(i=!0),!l||h?o:Object.assign({},o,((s={})[a]=f,s))}),{}),r,i]},t}(s),L=function(){function e(e){if("production"!==process.env.NODE_ENV&&!e)throw new Error('Expected option "entity" not found on DeleteSchema.');this._entity=e}var t=e.prototype;return t.normalize=function(e,t,n,r,i,o){if("string"==typeof e)return e;var a=this._entity.fromJS(e,t,n),s=a.pk(t,n);return i(this._entity,S,a,t,n),s},t.denormalize=function(e,t){return t(e,this._entity)},t._denormalizeNullable=function(){return[]},t._normalizeNullable=function(){return[]},t.merge=function(e,t){return t},e}(),U=Object.freeze({__proto__:null,Union:I,Values:T,Array:p,Object:y,Delete:L}),F=function(e){function t(){return e.apply(this,arguments)||this}return i(t,e),t.denormalize=function(e,t){return[e,!0,!1]},t}(w);return e.DELETED=S,e.Entity=w,e.FlatEntity=F,e.SimpleRecord=k,e.WeakListMap=x,e.denormalize=function(e,t,n,r,i){if(void 0===r&&(r={}),void 0===i&&(i=new x),void 0===t)return[e,!0,!1,{}];if(void 0===e)return[void 0,!1,!1,{}];var o={},a=V(n,r,i,o);return[].concat(a(e,t),[o])},e.isEntity=E,e.normalize=function(e,t,n,r){if(void 0===n&&(n={}),void 0===r&&(r={}),void 0===t)return{entities:n,indexes:r,result:e};var i=function(e){return["object","function"].includes(typeof e)?"object":typeof e}(t);if(null===e||typeof e!==i){if("production"!==process.env.NODE_ENV){throw"string"==typeof e&&function(e){try{return"string"!=typeof JSON.parse(e)}catch(e){return!1}}(e)?new Error('Normalizing a string, but this does match schema.\n\nParsing this input string as JSON worked. This likely indicates fetch function did not parse\nthe JSON. By default, this only happens if "content-type" header includes "json".\nSee https://resthooks.io/docs/guides/custom-networking for more information\n\n Schema: '+JSON.stringify(t,void 0,2)+'\n Input: "'+e+'"'):new Error('Unexpected input given to normalize. Expected type to be "'+i+'", found "'+(null===e?"null":typeof e)+'".\n\n Schema: '+JSON.stringify(t,void 0,2)+'\n Input: "'+e+'"')}throw new Error('Unexpected input given to normalize. Expected type to be "'+i+'", found "'+(null===e?"null":typeof e)+'".')}var o={},a={},s=function(e,t,n,r){return function(r,i,o,a,s){var u=r.key,c=r.pk(o,a,s);u in e||(e[u]={});var f=e[u][c];if(e[u][c]=f?r.merge(f,i):i,Array.isArray(r.indexes)){var l=e[u][c];u in t||(t[u]={});for(var h,p=g(r.indexes);!(h=p()).done;){var d=h.value;d in t[u]||(t[u][d]={});var m=t[u][d];f&&delete m[f[d]],n[u]&&n[u][c]&&n[u][c][d]!==l[d]&&(m[n[u][c][d]]=S),d in l?m[l[d]]=c:"production"!==process.env.NODE_ENV&&console.warn("Index not found in entity. Indexes must be top-level members of your entity.\nIndex: "+d+"\nEntity: "+JSON.stringify(l,void 0,2))}}}}(o,a,n);return{entities:o,indexes:a,result:P(e,e,void 0,t,s,{})}},e.schema=U,Object.defineProperty(e,"__esModule",{value:!0}),e}({});

@@ -1017,5 +1017,7 @@ 'use strict';

globalKey.push(input);
var ret = unvisit(input, schema);
if (typeof input !== 'object') return ret;
var ret = unvisit(input, schema); // in the case where WeakMap cannot be used
// this test ensures null is properly excluded from WeakMap
if (Object(input) !== input) return ret;
if (!resultCache.has(globalKey)) {

@@ -1081,3 +1083,3 @@ resultCache.set(globalKey, ret[0]);

/* istanbul ignore else */
if (typeof ret[0] === 'object') {
if (Object(ret[0]) === ret[0]) {
globalKey.push(ret[0]);

@@ -1084,0 +1086,0 @@ } else if (process.env.NODE_ENV !== 'production') {

@@ -1,1 +0,1 @@

"use strict";function e(e){return!(!e||"function"!=typeof e.hasOwnProperty||!(Object.hasOwnProperty.call(e,"__ownerID")||e._map&&Object.hasOwnProperty.call(e._map,"__ownerID")))}function t(e,t,n){var r=!0,i=!1;return[Object.keys(e).reduce((function(t,o){var a=""+o,s=n(t.get(a),e[a]),u=s[0],c=s[1],f=s[2];return c||(r=!1),f&&(i=!0),t.has(a)?t.set(a,u):t}),t),r,i]}function n(e,t){return(n=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function r(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,n(e,t)}function i(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function o(e,t,n){return t&&i(e.prototype,t),n&&i(e,n),e}Object.defineProperty(exports,"__esModule",{value:!0});var a=function(){function t(e,t){t&&(this._schemaAttribute="string"==typeof t?function(e){return e[t]}:t),this.define(e)}var n=t.prototype;return n.define=function(e){this.schema=e},n.getSchemaAttribute=function(e,t,n){return!this.isSingleSchema&&this._schemaAttribute(e,t,n)},n.inferSchema=function(e,t,n){if(this.isSingleSchema)return this.schema;var r=this.getSchemaAttribute(e,t,n);return this.schema[r]},n.normalizeValue=function(e,t,n,r,i,o){var a=this.inferSchema(e,t,n);if(!a)return e;var s=r(e,t,n,a,i,o);return this.isSingleSchema||null==s?s:{id:s,schema:this.getSchemaAttribute(e,t,n)}},n.denormalizeValue=function(t,n){var r=e(t)?t.get("schema"):t.schema;return this.isSingleSchema||r?n((this.isSingleSchema?void 0:e(t)?t.get("id"):t.id)||t,this.isSingleSchema?this.schema:this.schema[r]):[t,!0,!0]},o(t,[{key:"isSingleSchema",get:function(){return!this._schemaAttribute}}]),t}(),s=function(e){if(Array.isArray(e)&&e.length>1)throw new Error("Expected schema definition to be a single schema, but found "+e.length+".");return e[0]},u=function(e){return Array.isArray(e)?e:Object.keys(e).map((function(t){return e[t]}))},c=function(e){var t=e[1],n=e[2];return t&&!n},f=function(e,t,n,r,i,o,a){return e=s(e),u(t).map((function(t,s){return i(t,n,r,e,o,a)}))},l=function(e,t,n){e=s(e);var r=!1,i=!0;if(void 0===t&&e){var o=n(void 0,e);i=o[1],r=o[2]}return[t&&t.map?t.map((function(t){return n(t,e)})).filter(c).map((function(e){return e[0]})):t,i,r]},h=function(e){function t(){return e.apply(this,arguments)||this}r(t,e);var n=t.prototype;return n.normalize=function(e,t,n,r,i,o){var a=this;return u(e).map((function(e,s){return a.normalizeValue(e,t,n,r,i,o)})).filter((function(e){return null!=e}))},n.denormalize=function(e,t){var n=this,r=!1,i=!0;if(void 0===e&&this.schema){var o=t(void 0,this.schema);i=o[1],r=o[2]}return[e&&e.map?e.map((function(e){return n.denormalizeValue(e,t)})).filter(c).map((function(e){return e[0]})):e,i,r]},t}(a),p=function(e,t,n,r,i,o,a){var s=Object.assign({},t);return Object.keys(e).forEach((function(n){var r=e[n],u=i(t[n],t,n,r,o,a);null==u?delete s[n]:s[n]=u})),s},d=function(n,r,i){if(e(r))return t(n,r,i);var o=Object.assign({},r),a=!0,s=!1;return Object.keys(n).forEach((function(e){var t=i(o[e],n[e]),r=t[0],u=t[1],c=t[2];void 0!==o[e]&&(o[e]=r),c&&(s=!0),u||(a=!1)})),[o,a,s]},m=function(){function e(e){this.define(e)}var t=e.prototype;return t.define=function(e){this.schema=Object.keys(e).reduce((function(t,n){var r,i=e[n];return Object.assign({},t,((r={})[n]=i,r))}),this.schema||{})},t.normalize=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return p.apply(void 0,[this.schema].concat(t))},t.denormalize=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return d.apply(void 0,[this.schema].concat(t))},e}();function y(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function v(e,t){var n;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return y(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?y(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return(n=e[Symbol.iterator]()).next.bind(n)}var g=Symbol("Defined Members"),b=Symbol("unq"),O=function(){function e(){}return e.prototype.toString=function(){return this[b]},e.toJSON=function(){return{name:this.name,schema:this.schema}},e.fromJS=function(t,n,r){void 0===t&&(t={});var i=new this(t);return t instanceof e&&(t=t.constructor.toObjectDefined(t)),Object.assign(i,t),Object.defineProperty(i,g,{value:Object.keys(t),writable:!1}),Object.defineProperty(i,b,{value:""+Math.random(),writable:!1}),i},e.merge=function(e,t){var n=Object.assign(this.toObjectDefined(e),this.toObjectDefined(t));return this.fromJS(n)},e.hasDefined=function(e,t){return e[g].includes(t)},e.toObjectDefined=function(e){for(var t,n={},r=v(e[g]);!(t=r()).done;){var i=t.value;n[i]=e[i]}return n},e.keysDefined=function(e){return e[g]},e.normalize=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return p.apply(void 0,[this.schema].concat(t))},e.denormalize=function(e,t){var n=this,r=new this,i=Object.assign({},e),o=!1,a=!0;return Object.keys(this.schema).forEach((function(e){var s=t(i[e],n.schema[e]),u=s[0],c=s[1],f=s[2];void 0!==i[e]&&(i[e]=u),c||e in r&&!r[e]||(a=!1),!f||e in r&&!r[e]||(o=!0)})),[this.fromJS(i),a,o]},e.asSchema=function(){return"development"===process.env.NODE_ENV&&console.error("asSchema() is deprecated - use Entity directly instead."),this},e}();O.schema={};var k=function(n){function i(){return n.apply(this,arguments)||this}return r(i,n),i.toJSON=function(){return Object.assign({},n.toJSON.call(this),{key:this.key})},i.pk=function(e,t,n){return this.prototype.pk.call(e,t,n)||n},i.normalize=function(e,t,n,r,i,o){var a=this;if("string"==typeof e)return e;var s=this.fromJS(e,t,n);if("production"!==process.env.NODE_ENV&&"silent"!==this.automaticValidation){for(var u,c=new this,f=new Set(Object.keys(c)),l=this.keysDefined(s),h=[[],[],[]],p=h[0],d=h[1],m=h[2],y=v(l);!(u=y()).done;){var g=u.value;f.has(g)?p.push(g):m.push(g)}for(var b,O=v(f);!(b=O()).done;){var k=b.value;p.includes(k)||d.push(k)}if(f.size){if(Array.isArray(e)&&m.length){var w="Attempted to initialize "+this.name+" with an array, but named members were expected\n\nThis is likely due to a malformed response.\nTry inspecting the network response or fetch() return value.\nOr use debugging tools: https://resthooks.io/docs/guides/debugging\nLearn more about schemas: https://resthooks.io/docs/api/schema\nIf this is a mistake, you can disable this check by setting static automaticValidation = 'silent'\n\nMissing: "+d+"\nFirst three members: "+JSON.stringify(e.slice(0,3),null,2);if("warn"!==this.automaticValidation){var E=new Error(w);throw E.status=400,E}console.warn(w)}var S=Math.max(l.length/2,1)<=m.length&&f.size>Math.max(m.length,2)&&Math.pow(p.length,1.5)/2<=m.length,j=p.length<Math.min(1,f.size/2);if(S||j){var z="",_="substantially different than expected keys";j&&(z+="\n Missing: "+d,_="no matching keys found"),S&&(z+="\n Unexpected keys: "+m,_="a large number of unexpected keys found");var x="Attempted to initialize "+this.name+" with "+_+"\n\n This is likely due to a malformed response.\n Try inspecting the network response or fetch() return value.\n Or use debugging tools: https://resthooks.io/docs/guides/debugging\n Learn more about schemas: https://resthooks.io/docs/api/schema\n If this is a mistake, you can disable this check by setting static automaticValidation = 'silent'\n\n Expected keys:\n Found: "+p+z+"\n Value: "+JSON.stringify(this.toObjectDefined(s),null,2);if(!(p.length>=4&&S||"warn"===this.automaticValidation)){var N=new Error(x);throw N.status=400,N}console.warn(x)}}}var A=s.pk(t,n);if(void 0!==A&&""!==A){var D=this.key;return D in o||(o[D]={}),A in o[D]||(o[D][A]=[]),o[D][A].some((function(t){return t===e}))?A:(o[D][A].push(e),Object.keys(this.schema).forEach((function(e){if(Object.hasOwnProperty.call(s,e)){var t=a.schema[e];s[e]=r(s[e],s,e,t,i,o)}else if("production"!==process.env.NODE_ENV){var n=new Error("Schema key is missing in Entity\n\n Be sure all schema members are also part of the entity\n Or use debugging tools: https://resthooks.io/docs/guides/debugging\n Learn more about nesting schemas: https://resthooks.io/docs/guides/nested-response\n\n Entity keys: "+Object.keys(s)+"\n Schema key(missing): "+e+"\n ");throw n.status=400,n}})),i(this,s,s,t,n),A)}if("production"!==process.env.NODE_ENV){var V=new Error("Missing usable resource key when normalizing response.\n\n This is likely due to a malformed response.\n Try inspecting the network response or fetch() return value.\n Or use debugging tools: https://resthooks.io/docs/guides/debugging\n Learn more about schemas: https://resthooks.io/docs/api/schema\n\n Entity: "+this.name+"\n Value: "+(e&&JSON.stringify(e,null,2))+"\n ");throw V.status=400,V}},i.denormalize=function(n,r){var i=this;if(e(n)){var o=t(this.schema,n,r),a=o[0],s=o[1],u=o[2];return[this.fromJS(a.toObject()),s,u]}var c=new this,f=!1,l=!0,h=n;return Object.keys(this.schema).forEach((function(e){var t=i.schema[e],o=i.hasDefined(n,e)?n[e]:void 0,a=r(o,t),s=a[0],u=a[1],p=a[2];u||e in c&&!c[e]||(l=!1),!p||e in c&&!c[e]||(f=!0),i.hasDefined(n,e)&&h[e]!==s&&(h[e]=s)})),[h,l,f]},o(i,null,[{key:"key",get:function(){if("production"!==process.env.NODE_ENV&&(""===this.name||"Entity"===this.name))throw new Error("Entity classes without a name must define `static get key()`");return this.name}}]),i}(O);function w(e){return null!==e&&void 0!==e.pk}"production"!==process.env.NODE_ENV&&(k.fromJS=function(e){if(void 0===this.prototype.pk)throw new Error("cannot construct on abstract types");return O.fromJS.call(this,e)});var E=Symbol("ENTITY WAS DELETED");function S(e){return(S=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function j(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function z(e,t,r){return(z=j()?Reflect.construct:function(e,t,r){var i=[null];i.push.apply(i,t);var o=new(Function.bind.apply(e,i));return r&&n(o,r.prototype),o}).apply(null,arguments)}function _(e){var t="function"==typeof Map?new Map:void 0;return(_=function(e){if(null===e||(r=e,-1===Function.toString.call(r).indexOf("[native code]")))return e;var r;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,i)}function i(){return z(e,arguments,S(this).constructor)}return i.prototype=Object.create(e.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),n(i,e)})(e)}var x=function(){this.children=new WeakMap},N=function(e){function t(){for(var t,n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return(t=e.call.apply(e,[this].concat(r))||this).message="Keys must include at least one member",t}return r(t,e),t}(_(Error)),A=function(){function e(){this.first=new WeakMap}var t=e.prototype;return t.delete=function(e){var t=this.traverse(e);return null==t||delete t.value,!!t},t.get=function(e){var t=this.traverse(e);return null==t?void 0:t.value},t.has=function(e){var t=this.traverse(e);return!!t&&Object.prototype.hasOwnProperty.call(t,"value")},t.set=function(e,t){if(e.length<1)throw new N;for(var n,r=this.first,i=0;i<e.length;i++)r.has(e[i])?n=r.get(e[i]):(n=new x,r.set(e[i],n)),r=n.children,i===e.length-1&&(n.value=t);return this},t.traverse=function(e){for(var t,n=this.first,r=0;r<e.length;r++){if(!(t=n.get(e[r])))return;n=t.children}return t},e}(),D=function(t,n,r,i){var o=V(t);function a(t,r){if(!r)return[t,!0,!1];if(!r.denormalize||"function"!=typeof r.denormalize){if("function"==typeof r)return t instanceof r?[t,!0,!1]:[new r(t),!0,!1];if("object"==typeof r)return(Array.isArray(r)?l:d)(r,t,u)}return null===t?[t,!0,!1]:w(r)?void 0===t?[t,!1,!1]:function(t,n,r,i,o,a){var s=i(t,n);if(s===E)return[void 0,!0,!0];if("object"!=typeof s||null===s)return[s,!1,!1];void 0===o[n.key]&&(o[n.key]={});var u=!0,c=!1;if(!o[n.key][t]){var f=[s],l=J(r,f);a[n.key]||(a[n.key]={}),a[n.key][t]||(a[n.key][t]=new A);var h=a[n.key][t],p=e(s)?s:n.fromJS(s);o[n.key][t]=p;var d=n.denormalize(p,l);o[n.key][t]=d[0],u=d[1],c=d[2],h.has(f)?o[n.key][t]=h.get(f):h.set(f,o[n.key][t])}return[o[n.key][t],u,c]}(t,r,u,o,i,n):"function"==typeof r.denormalize?r.denormalize(t,u):[t,!0,!1]}var s=[],u=J(a,s);return function(e,t){s.push(e);var n=a(e,t);return"object"!=typeof e?n:r.has(s)?[r.get(s),n[1],n[2]]:(r.set(s,n[0]),n)}},V=function(t){var n=e(t);return function(e,r){var i=r.key;return"object"==typeof e?e:n?t.getIn([i,e]):t[i]&&t[i][e]}};function J(e,t){var n=e.og||e,r=function(e,r){var i=n(e,r);if(i[0]&&r&&w(r))if("object"==typeof i[0])t.push(i[0]);else if("production"!==process.env.NODE_ENV)throw new Error("Unexpected primitive found during denormalization\nFound: "+i[0]+"\nExpected entity: "+r);return i};return r.og=e,r}var M=function e(t,n,r,i,o,a){return t&&i&&["function","object"].includes(typeof i)?i.normalize&&"function"==typeof i.normalize?i.normalize(t,n,r,e,o,a):"function"==typeof i?new i(t):(Array.isArray(i)?f:p)(i,t,n,r,e,o,a):t};var P=function(e){function t(t,n){if(!n)throw new Error('Expected option "schemaAttribute" not found on UnionSchema.');return e.call(this,t,n)||this}r(t,e);var n=t.prototype;return n.normalize=function(e,t,n,r,i,o){return this.normalizeValue(e,t,n,r,i,o)},n.denormalize=function(e,t){return this.denormalizeValue(e,t)},t}(a),I=function(e){function t(){return e.apply(this,arguments)||this}r(t,e);var n=t.prototype;return n.normalize=function(e,t,n,r,i,o){var a=this;return Object.keys(e).reduce((function(t,n,s){var u,c=e[n];return null!=c?Object.assign({},t,((u={})[n]=a.normalizeValue(c,e,n,r,i,o),u)):t}),{})},n.denormalize=function(e,t){var n=this,r=!0,i=!1;return[Object.keys(e).reduce((function(o,a){var s,u=e[a],c=n.denormalizeValue(u,t),f=c[0],l=c[1],h=c[2];return l||(r=!1),h&&(i=!0),!l||h?o:Object.assign({},o,((s={})[a]=f,s))}),{}),r,i]},t}(a),T=function(){function e(e){if("production"!==process.env.NODE_ENV&&!e)throw new Error('Expected option "entity" not found on DeleteSchema.');this._entity=e}var t=e.prototype;return t.normalize=function(e,t,n,r,i,o){if("string"==typeof e)return e;var a=this._entity.fromJS(e,t,n),s=a.pk(t,n);return i(this._entity,E,a,t,n),s},t.denormalize=function(e,t){return t(e,this._entity)},t._denormalizeNullable=function(){return[]},t._normalizeNullable=function(){return[]},t.merge=function(e,t){return t},e}(),L=Object.freeze({__proto__:null,Union:P,Values:I,Array:h,Object:m,Delete:T}),U=function(e){function t(){return e.apply(this,arguments)||this}return r(t,e),t.denormalize=function(e,t){return[e,!0,!1]},t}(k);exports.DELETED=E,exports.Entity=k,exports.FlatEntity=U,exports.SimpleRecord=O,exports.WeakListMap=A,exports.denormalize=function(e,t,n,r,i){if(void 0===r&&(r={}),void 0===i&&(i=new A),void 0===t)return[e,!0,!1,{}];if(void 0===e)return[void 0,!1,!1,{}];var o={},a=D(n,r,i,o);return[].concat(a(e,t),[o])},exports.isEntity=w,exports.normalize=function(e,t,n,r){if(void 0===n&&(n={}),void 0===r&&(r={}),void 0===t)return{entities:n,indexes:r,result:e};var i=function(e){return["object","function"].includes(typeof e)?"object":typeof e}(t);if(null===e||typeof e!==i){if("production"!==process.env.NODE_ENV){throw"string"==typeof e&&function(e){try{return"string"!=typeof JSON.parse(e)}catch(e){return!1}}(e)?new Error('Normalizing a string, but this does match schema.\n\nParsing this input string as JSON worked. This likely indicates fetch function did not parse\nthe JSON. By default, this only happens if "content-type" header includes "json".\nSee https://resthooks.io/docs/guides/custom-networking for more information\n\n Schema: '+JSON.stringify(t,void 0,2)+'\n Input: "'+e+'"'):new Error('Unexpected input given to normalize. Expected type to be "'+i+'", found "'+(null===e?"null":typeof e)+'".\n\n Schema: '+JSON.stringify(t,void 0,2)+'\n Input: "'+e+'"')}throw new Error('Unexpected input given to normalize. Expected type to be "'+i+'", found "'+(null===e?"null":typeof e)+'".')}var o={},a={},s=function(e,t,n,r){return function(r,i,o,a,s){var u=r.key,c=r.pk(o,a,s);u in e||(e[u]={});var f=e[u][c];if(e[u][c]=f?r.merge(f,i):i,Array.isArray(r.indexes)){var l=e[u][c];u in t||(t[u]={});for(var h,p=v(r.indexes);!(h=p()).done;){var d=h.value;d in t[u]||(t[u][d]={});var m=t[u][d];f&&delete m[f[d]],n[u]&&n[u][c]&&n[u][c][d]!==l[d]&&(m[n[u][c][d]]=E),d in l?m[l[d]]=c:"production"!==process.env.NODE_ENV&&console.warn("Index not found in entity. Indexes must be top-level members of your entity.\nIndex: "+d+"\nEntity: "+JSON.stringify(l,void 0,2))}}}}(o,a,n);return{entities:o,indexes:a,result:M(e,e,void 0,t,s,{})}},exports.schema=L;
"use strict";function e(e){return!(!e||"function"!=typeof e.hasOwnProperty||!(Object.hasOwnProperty.call(e,"__ownerID")||e._map&&Object.hasOwnProperty.call(e._map,"__ownerID")))}function t(e,t,n){var r=!0,i=!1;return[Object.keys(e).reduce((function(t,o){var a=""+o,s=n(t.get(a),e[a]),u=s[0],c=s[1],f=s[2];return c||(r=!1),f&&(i=!0),t.has(a)?t.set(a,u):t}),t),r,i]}function n(e,t){return(n=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function r(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,n(e,t)}function i(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function o(e,t,n){return t&&i(e.prototype,t),n&&i(e,n),e}Object.defineProperty(exports,"__esModule",{value:!0});var a=function(){function t(e,t){t&&(this._schemaAttribute="string"==typeof t?function(e){return e[t]}:t),this.define(e)}var n=t.prototype;return n.define=function(e){this.schema=e},n.getSchemaAttribute=function(e,t,n){return!this.isSingleSchema&&this._schemaAttribute(e,t,n)},n.inferSchema=function(e,t,n){if(this.isSingleSchema)return this.schema;var r=this.getSchemaAttribute(e,t,n);return this.schema[r]},n.normalizeValue=function(e,t,n,r,i,o){var a=this.inferSchema(e,t,n);if(!a)return e;var s=r(e,t,n,a,i,o);return this.isSingleSchema||null==s?s:{id:s,schema:this.getSchemaAttribute(e,t,n)}},n.denormalizeValue=function(t,n){var r=e(t)?t.get("schema"):t.schema;return this.isSingleSchema||r?n((this.isSingleSchema?void 0:e(t)?t.get("id"):t.id)||t,this.isSingleSchema?this.schema:this.schema[r]):[t,!0,!0]},o(t,[{key:"isSingleSchema",get:function(){return!this._schemaAttribute}}]),t}(),s=function(e){if(Array.isArray(e)&&e.length>1)throw new Error("Expected schema definition to be a single schema, but found "+e.length+".");return e[0]},u=function(e){return Array.isArray(e)?e:Object.keys(e).map((function(t){return e[t]}))},c=function(e){var t=e[1],n=e[2];return t&&!n},f=function(e,t,n,r,i,o,a){return e=s(e),u(t).map((function(t,s){return i(t,n,r,e,o,a)}))},l=function(e,t,n){e=s(e);var r=!1,i=!0;if(void 0===t&&e){var o=n(void 0,e);i=o[1],r=o[2]}return[t&&t.map?t.map((function(t){return n(t,e)})).filter(c).map((function(e){return e[0]})):t,i,r]},h=function(e){function t(){return e.apply(this,arguments)||this}r(t,e);var n=t.prototype;return n.normalize=function(e,t,n,r,i,o){var a=this;return u(e).map((function(e,s){return a.normalizeValue(e,t,n,r,i,o)})).filter((function(e){return null!=e}))},n.denormalize=function(e,t){var n=this,r=!1,i=!0;if(void 0===e&&this.schema){var o=t(void 0,this.schema);i=o[1],r=o[2]}return[e&&e.map?e.map((function(e){return n.denormalizeValue(e,t)})).filter(c).map((function(e){return e[0]})):e,i,r]},t}(a),p=function(e,t,n,r,i,o,a){var s=Object.assign({},t);return Object.keys(e).forEach((function(n){var r=e[n],u=i(t[n],t,n,r,o,a);null==u?delete s[n]:s[n]=u})),s},d=function(n,r,i){if(e(r))return t(n,r,i);var o=Object.assign({},r),a=!0,s=!1;return Object.keys(n).forEach((function(e){var t=i(o[e],n[e]),r=t[0],u=t[1],c=t[2];void 0!==o[e]&&(o[e]=r),c&&(s=!0),u||(a=!1)})),[o,a,s]},m=function(){function e(e){this.define(e)}var t=e.prototype;return t.define=function(e){this.schema=Object.keys(e).reduce((function(t,n){var r,i=e[n];return Object.assign({},t,((r={})[n]=i,r))}),this.schema||{})},t.normalize=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return p.apply(void 0,[this.schema].concat(t))},t.denormalize=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return d.apply(void 0,[this.schema].concat(t))},e}();function y(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function v(e,t){var n;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return y(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?y(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return(n=e[Symbol.iterator]()).next.bind(n)}var g=Symbol("Defined Members"),b=Symbol("unq"),O=function(){function e(){}return e.prototype.toString=function(){return this[b]},e.toJSON=function(){return{name:this.name,schema:this.schema}},e.fromJS=function(t,n,r){void 0===t&&(t={});var i=new this(t);return t instanceof e&&(t=t.constructor.toObjectDefined(t)),Object.assign(i,t),Object.defineProperty(i,g,{value:Object.keys(t),writable:!1}),Object.defineProperty(i,b,{value:""+Math.random(),writable:!1}),i},e.merge=function(e,t){var n=Object.assign(this.toObjectDefined(e),this.toObjectDefined(t));return this.fromJS(n)},e.hasDefined=function(e,t){return e[g].includes(t)},e.toObjectDefined=function(e){for(var t,n={},r=v(e[g]);!(t=r()).done;){var i=t.value;n[i]=e[i]}return n},e.keysDefined=function(e){return e[g]},e.normalize=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return p.apply(void 0,[this.schema].concat(t))},e.denormalize=function(e,t){var n=this,r=new this,i=Object.assign({},e),o=!1,a=!0;return Object.keys(this.schema).forEach((function(e){var s=t(i[e],n.schema[e]),u=s[0],c=s[1],f=s[2];void 0!==i[e]&&(i[e]=u),c||e in r&&!r[e]||(a=!1),!f||e in r&&!r[e]||(o=!0)})),[this.fromJS(i),a,o]},e.asSchema=function(){return"development"===process.env.NODE_ENV&&console.error("asSchema() is deprecated - use Entity directly instead."),this},e}();O.schema={};var k=function(n){function i(){return n.apply(this,arguments)||this}return r(i,n),i.toJSON=function(){return Object.assign({},n.toJSON.call(this),{key:this.key})},i.pk=function(e,t,n){return this.prototype.pk.call(e,t,n)||n},i.normalize=function(e,t,n,r,i,o){var a=this;if("string"==typeof e)return e;var s=this.fromJS(e,t,n);if("production"!==process.env.NODE_ENV&&"silent"!==this.automaticValidation){for(var u,c=new this,f=new Set(Object.keys(c)),l=this.keysDefined(s),h=[[],[],[]],p=h[0],d=h[1],m=h[2],y=v(l);!(u=y()).done;){var g=u.value;f.has(g)?p.push(g):m.push(g)}for(var b,O=v(f);!(b=O()).done;){var k=b.value;p.includes(k)||d.push(k)}if(f.size){if(Array.isArray(e)&&m.length){var w="Attempted to initialize "+this.name+" with an array, but named members were expected\n\nThis is likely due to a malformed response.\nTry inspecting the network response or fetch() return value.\nOr use debugging tools: https://resthooks.io/docs/guides/debugging\nLearn more about schemas: https://resthooks.io/docs/api/schema\nIf this is a mistake, you can disable this check by setting static automaticValidation = 'silent'\n\nMissing: "+d+"\nFirst three members: "+JSON.stringify(e.slice(0,3),null,2);if("warn"!==this.automaticValidation){var E=new Error(w);throw E.status=400,E}console.warn(w)}var S=Math.max(l.length/2,1)<=m.length&&f.size>Math.max(m.length,2)&&Math.pow(p.length,1.5)/2<=m.length,j=p.length<Math.min(1,f.size/2);if(S||j){var z="",_="substantially different than expected keys";j&&(z+="\n Missing: "+d,_="no matching keys found"),S&&(z+="\n Unexpected keys: "+m,_="a large number of unexpected keys found");var x="Attempted to initialize "+this.name+" with "+_+"\n\n This is likely due to a malformed response.\n Try inspecting the network response or fetch() return value.\n Or use debugging tools: https://resthooks.io/docs/guides/debugging\n Learn more about schemas: https://resthooks.io/docs/api/schema\n If this is a mistake, you can disable this check by setting static automaticValidation = 'silent'\n\n Expected keys:\n Found: "+p+z+"\n Value: "+JSON.stringify(this.toObjectDefined(s),null,2);if(!(p.length>=4&&S||"warn"===this.automaticValidation)){var N=new Error(x);throw N.status=400,N}console.warn(x)}}}var A=s.pk(t,n);if(void 0!==A&&""!==A){var D=this.key;return D in o||(o[D]={}),A in o[D]||(o[D][A]=[]),o[D][A].some((function(t){return t===e}))?A:(o[D][A].push(e),Object.keys(this.schema).forEach((function(e){if(Object.hasOwnProperty.call(s,e)){var t=a.schema[e];s[e]=r(s[e],s,e,t,i,o)}else if("production"!==process.env.NODE_ENV){var n=new Error("Schema key is missing in Entity\n\n Be sure all schema members are also part of the entity\n Or use debugging tools: https://resthooks.io/docs/guides/debugging\n Learn more about nesting schemas: https://resthooks.io/docs/guides/nested-response\n\n Entity keys: "+Object.keys(s)+"\n Schema key(missing): "+e+"\n ");throw n.status=400,n}})),i(this,s,s,t,n),A)}if("production"!==process.env.NODE_ENV){var V=new Error("Missing usable resource key when normalizing response.\n\n This is likely due to a malformed response.\n Try inspecting the network response or fetch() return value.\n Or use debugging tools: https://resthooks.io/docs/guides/debugging\n Learn more about schemas: https://resthooks.io/docs/api/schema\n\n Entity: "+this.name+"\n Value: "+(e&&JSON.stringify(e,null,2))+"\n ");throw V.status=400,V}},i.denormalize=function(n,r){var i=this;if(e(n)){var o=t(this.schema,n,r),a=o[0],s=o[1],u=o[2];return[this.fromJS(a.toObject()),s,u]}var c=new this,f=!1,l=!0,h=n;return Object.keys(this.schema).forEach((function(e){var t=i.schema[e],o=i.hasDefined(n,e)?n[e]:void 0,a=r(o,t),s=a[0],u=a[1],p=a[2];u||e in c&&!c[e]||(l=!1),!p||e in c&&!c[e]||(f=!0),i.hasDefined(n,e)&&h[e]!==s&&(h[e]=s)})),[h,l,f]},o(i,null,[{key:"key",get:function(){if("production"!==process.env.NODE_ENV&&(""===this.name||"Entity"===this.name))throw new Error("Entity classes without a name must define `static get key()`");return this.name}}]),i}(O);function w(e){return null!==e&&void 0!==e.pk}"production"!==process.env.NODE_ENV&&(k.fromJS=function(e){if(void 0===this.prototype.pk)throw new Error("cannot construct on abstract types");return O.fromJS.call(this,e)});var E=Symbol("ENTITY WAS DELETED");function S(e){return(S=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function j(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function z(e,t,r){return(z=j()?Reflect.construct:function(e,t,r){var i=[null];i.push.apply(i,t);var o=new(Function.bind.apply(e,i));return r&&n(o,r.prototype),o}).apply(null,arguments)}function _(e){var t="function"==typeof Map?new Map:void 0;return(_=function(e){if(null===e||(r=e,-1===Function.toString.call(r).indexOf("[native code]")))return e;var r;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,i)}function i(){return z(e,arguments,S(this).constructor)}return i.prototype=Object.create(e.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),n(i,e)})(e)}var x=function(){this.children=new WeakMap},N=function(e){function t(){for(var t,n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return(t=e.call.apply(e,[this].concat(r))||this).message="Keys must include at least one member",t}return r(t,e),t}(_(Error)),A=function(){function e(){this.first=new WeakMap}var t=e.prototype;return t.delete=function(e){var t=this.traverse(e);return null==t||delete t.value,!!t},t.get=function(e){var t=this.traverse(e);return null==t?void 0:t.value},t.has=function(e){var t=this.traverse(e);return!!t&&Object.prototype.hasOwnProperty.call(t,"value")},t.set=function(e,t){if(e.length<1)throw new N;for(var n,r=this.first,i=0;i<e.length;i++)r.has(e[i])?n=r.get(e[i]):(n=new x,r.set(e[i],n)),r=n.children,i===e.length-1&&(n.value=t);return this},t.traverse=function(e){for(var t,n=this.first,r=0;r<e.length;r++){if(!(t=n.get(e[r])))return;n=t.children}return t},e}(),D=function(t,n,r,i){var o=V(t);function a(t,r){if(!r)return[t,!0,!1];if(!r.denormalize||"function"!=typeof r.denormalize){if("function"==typeof r)return t instanceof r?[t,!0,!1]:[new r(t),!0,!1];if("object"==typeof r)return(Array.isArray(r)?l:d)(r,t,u)}return null===t?[t,!0,!1]:w(r)?void 0===t?[t,!1,!1]:function(t,n,r,i,o,a){var s=i(t,n);if(s===E)return[void 0,!0,!0];if("object"!=typeof s||null===s)return[s,!1,!1];void 0===o[n.key]&&(o[n.key]={});var u=!0,c=!1;if(!o[n.key][t]){var f=[s],l=J(r,f);a[n.key]||(a[n.key]={}),a[n.key][t]||(a[n.key][t]=new A);var h=a[n.key][t],p=e(s)?s:n.fromJS(s);o[n.key][t]=p;var d=n.denormalize(p,l);o[n.key][t]=d[0],u=d[1],c=d[2],h.has(f)?o[n.key][t]=h.get(f):h.set(f,o[n.key][t])}return[o[n.key][t],u,c]}(t,r,u,o,i,n):"function"==typeof r.denormalize?r.denormalize(t,u):[t,!0,!1]}var s=[],u=J(a,s);return function(e,t){s.push(e);var n=a(e,t);return Object(e)!==e?n:r.has(s)?[r.get(s),n[1],n[2]]:(r.set(s,n[0]),n)}},V=function(t){var n=e(t);return function(e,r){var i=r.key;return"object"==typeof e?e:n?t.getIn([i,e]):t[i]&&t[i][e]}};function J(e,t){var n=e.og||e,r=function(e,r){var i=n(e,r);if(i[0]&&r&&w(r))if(Object(i[0])===i[0])t.push(i[0]);else if("production"!==process.env.NODE_ENV)throw new Error("Unexpected primitive found during denormalization\nFound: "+i[0]+"\nExpected entity: "+r);return i};return r.og=e,r}var M=function e(t,n,r,i,o,a){return t&&i&&["function","object"].includes(typeof i)?i.normalize&&"function"==typeof i.normalize?i.normalize(t,n,r,e,o,a):"function"==typeof i?new i(t):(Array.isArray(i)?f:p)(i,t,n,r,e,o,a):t};var P=function(e){function t(t,n){if(!n)throw new Error('Expected option "schemaAttribute" not found on UnionSchema.');return e.call(this,t,n)||this}r(t,e);var n=t.prototype;return n.normalize=function(e,t,n,r,i,o){return this.normalizeValue(e,t,n,r,i,o)},n.denormalize=function(e,t){return this.denormalizeValue(e,t)},t}(a),I=function(e){function t(){return e.apply(this,arguments)||this}r(t,e);var n=t.prototype;return n.normalize=function(e,t,n,r,i,o){var a=this;return Object.keys(e).reduce((function(t,n,s){var u,c=e[n];return null!=c?Object.assign({},t,((u={})[n]=a.normalizeValue(c,e,n,r,i,o),u)):t}),{})},n.denormalize=function(e,t){var n=this,r=!0,i=!1;return[Object.keys(e).reduce((function(o,a){var s,u=e[a],c=n.denormalizeValue(u,t),f=c[0],l=c[1],h=c[2];return l||(r=!1),h&&(i=!0),!l||h?o:Object.assign({},o,((s={})[a]=f,s))}),{}),r,i]},t}(a),T=function(){function e(e){if("production"!==process.env.NODE_ENV&&!e)throw new Error('Expected option "entity" not found on DeleteSchema.');this._entity=e}var t=e.prototype;return t.normalize=function(e,t,n,r,i,o){if("string"==typeof e)return e;var a=this._entity.fromJS(e,t,n),s=a.pk(t,n);return i(this._entity,E,a,t,n),s},t.denormalize=function(e,t){return t(e,this._entity)},t._denormalizeNullable=function(){return[]},t._normalizeNullable=function(){return[]},t.merge=function(e,t){return t},e}(),L=Object.freeze({__proto__:null,Union:P,Values:I,Array:h,Object:m,Delete:T}),U=function(e){function t(){return e.apply(this,arguments)||this}return r(t,e),t.denormalize=function(e,t){return[e,!0,!1]},t}(k);exports.DELETED=E,exports.Entity=k,exports.FlatEntity=U,exports.SimpleRecord=O,exports.WeakListMap=A,exports.denormalize=function(e,t,n,r,i){if(void 0===r&&(r={}),void 0===i&&(i=new A),void 0===t)return[e,!0,!1,{}];if(void 0===e)return[void 0,!1,!1,{}];var o={},a=D(n,r,i,o);return[].concat(a(e,t),[o])},exports.isEntity=w,exports.normalize=function(e,t,n,r){if(void 0===n&&(n={}),void 0===r&&(r={}),void 0===t)return{entities:n,indexes:r,result:e};var i=function(e){return["object","function"].includes(typeof e)?"object":typeof e}(t);if(null===e||typeof e!==i){if("production"!==process.env.NODE_ENV){throw"string"==typeof e&&function(e){try{return"string"!=typeof JSON.parse(e)}catch(e){return!1}}(e)?new Error('Normalizing a string, but this does match schema.\n\nParsing this input string as JSON worked. This likely indicates fetch function did not parse\nthe JSON. By default, this only happens if "content-type" header includes "json".\nSee https://resthooks.io/docs/guides/custom-networking for more information\n\n Schema: '+JSON.stringify(t,void 0,2)+'\n Input: "'+e+'"'):new Error('Unexpected input given to normalize. Expected type to be "'+i+'", found "'+(null===e?"null":typeof e)+'".\n\n Schema: '+JSON.stringify(t,void 0,2)+'\n Input: "'+e+'"')}throw new Error('Unexpected input given to normalize. Expected type to be "'+i+'", found "'+(null===e?"null":typeof e)+'".')}var o={},a={},s=function(e,t,n,r){return function(r,i,o,a,s){var u=r.key,c=r.pk(o,a,s);u in e||(e[u]={});var f=e[u][c];if(e[u][c]=f?r.merge(f,i):i,Array.isArray(r.indexes)){var l=e[u][c];u in t||(t[u]={});for(var h,p=v(r.indexes);!(h=p()).done;){var d=h.value;d in t[u]||(t[u][d]={});var m=t[u][d];f&&delete m[f[d]],n[u]&&n[u][c]&&n[u][c][d]!==l[d]&&(m[n[u][c][d]]=E),d in l?m[l[d]]=c:"production"!==process.env.NODE_ENV&&console.warn("Index not found in entity. Indexes must be top-level members of your entity.\nIndex: "+d+"\nEntity: "+JSON.stringify(l,void 0,2))}}}}(o,a,n);return{entities:o,indexes:a,result:M(e,e,void 0,t,s,{})}},exports.schema=L;

@@ -1019,5 +1019,7 @@ (function (global, factory) {

globalKey.push(input);
var ret = unvisit(input, schema);
if (typeof input !== 'object') return ret;
var ret = unvisit(input, schema); // in the case where WeakMap cannot be used
// this test ensures null is properly excluded from WeakMap
if (Object(input) !== input) return ret;
if (!resultCache.has(globalKey)) {

@@ -1083,3 +1085,3 @@ resultCache.set(globalKey, ret[0]);

/* istanbul ignore else */
if (typeof ret[0] === 'object') {
if (Object(ret[0]) === ret[0]) {
globalKey.push(ret[0]);

@@ -1086,0 +1088,0 @@ } else if (process.env.NODE_ENV !== 'production') {

@@ -1,1 +0,1 @@

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).rest_hooks_normalizr={})}(this,(function(e){"use strict";function t(e){return!(!e||"function"!=typeof e.hasOwnProperty||!(Object.hasOwnProperty.call(e,"__ownerID")||e._map&&Object.hasOwnProperty.call(e._map,"__ownerID")))}function n(e,t,n){var r=!0,i=!1;return[Object.keys(e).reduce((function(t,o){var a=""+o,s=n(t.get(a),e[a]),u=s[0],c=s[1],f=s[2];return c||(r=!1),f&&(i=!0),t.has(a)?t.set(a,u):t}),t),r,i]}function r(e,t){return(r=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function i(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,r(e,t)}function o(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function a(e,t,n){return t&&o(e.prototype,t),n&&o(e,n),e}var s=function(){function e(e,t){t&&(this._schemaAttribute="string"==typeof t?function(e){return e[t]}:t),this.define(e)}var n=e.prototype;return n.define=function(e){this.schema=e},n.getSchemaAttribute=function(e,t,n){return!this.isSingleSchema&&this._schemaAttribute(e,t,n)},n.inferSchema=function(e,t,n){if(this.isSingleSchema)return this.schema;var r=this.getSchemaAttribute(e,t,n);return this.schema[r]},n.normalizeValue=function(e,t,n,r,i,o){var a=this.inferSchema(e,t,n);if(!a)return e;var s=r(e,t,n,a,i,o);return this.isSingleSchema||null==s?s:{id:s,schema:this.getSchemaAttribute(e,t,n)}},n.denormalizeValue=function(e,n){var r=t(e)?e.get("schema"):e.schema;return this.isSingleSchema||r?n((this.isSingleSchema?void 0:t(e)?e.get("id"):e.id)||e,this.isSingleSchema?this.schema:this.schema[r]):[e,!0,!0]},a(e,[{key:"isSingleSchema",get:function(){return!this._schemaAttribute}}]),e}(),u=function(e){if(Array.isArray(e)&&e.length>1)throw new Error("Expected schema definition to be a single schema, but found "+e.length+".");return e[0]},c=function(e){return Array.isArray(e)?e:Object.keys(e).map((function(t){return e[t]}))},f=function(e){var t=e[1],n=e[2];return t&&!n},l=function(e,t,n,r,i,o,a){return e=u(e),c(t).map((function(t,s){return i(t,n,r,e,o,a)}))},h=function(e,t,n){e=u(e);var r=!1,i=!0;if(void 0===t&&e){var o=n(void 0,e);i=o[1],r=o[2]}return[t&&t.map?t.map((function(t){return n(t,e)})).filter(f).map((function(e){return e[0]})):t,i,r]},p=function(e){function t(){return e.apply(this,arguments)||this}i(t,e);var n=t.prototype;return n.normalize=function(e,t,n,r,i,o){var a=this;return c(e).map((function(e,s){return a.normalizeValue(e,t,n,r,i,o)})).filter((function(e){return null!=e}))},n.denormalize=function(e,t){var n=this,r=!1,i=!0;if(void 0===e&&this.schema){var o=t(void 0,this.schema);i=o[1],r=o[2]}return[e&&e.map?e.map((function(e){return n.denormalizeValue(e,t)})).filter(f).map((function(e){return e[0]})):e,i,r]},t}(s),d=function(e,t,n,r,i,o,a){var s=Object.assign({},t);return Object.keys(e).forEach((function(n){var r=e[n],u=i(t[n],t,n,r,o,a);null==u?delete s[n]:s[n]=u})),s},m=function(e,r,i){if(t(r))return n(e,r,i);var o=Object.assign({},r),a=!0,s=!1;return Object.keys(e).forEach((function(t){var n=i(o[t],e[t]),r=n[0],u=n[1],c=n[2];void 0!==o[t]&&(o[t]=r),c&&(s=!0),u||(a=!1)})),[o,a,s]},y=function(){function e(e){this.define(e)}var t=e.prototype;return t.define=function(e){this.schema=Object.keys(e).reduce((function(t,n){var r,i=e[n];return Object.assign({},t,((r={})[n]=i,r))}),this.schema||{})},t.normalize=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return d.apply(void 0,[this.schema].concat(t))},t.denormalize=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return m.apply(void 0,[this.schema].concat(t))},e}();function v(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function g(e,t){var n;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return v(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?v(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return(n=e[Symbol.iterator]()).next.bind(n)}var b=Symbol("Defined Members"),O=Symbol("unq"),k=function(){function e(){}return e.prototype.toString=function(){return this[O]},e.toJSON=function(){return{name:this.name,schema:this.schema}},e.fromJS=function(t,n,r){void 0===t&&(t={});var i=new this(t);return t instanceof e&&(t=t.constructor.toObjectDefined(t)),Object.assign(i,t),Object.defineProperty(i,b,{value:Object.keys(t),writable:!1}),Object.defineProperty(i,O,{value:""+Math.random(),writable:!1}),i},e.merge=function(e,t){var n=Object.assign(this.toObjectDefined(e),this.toObjectDefined(t));return this.fromJS(n)},e.hasDefined=function(e,t){return e[b].includes(t)},e.toObjectDefined=function(e){for(var t,n={},r=g(e[b]);!(t=r()).done;){var i=t.value;n[i]=e[i]}return n},e.keysDefined=function(e){return e[b]},e.normalize=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return d.apply(void 0,[this.schema].concat(t))},e.denormalize=function(e,t){var n=this,r=new this,i=Object.assign({},e),o=!1,a=!0;return Object.keys(this.schema).forEach((function(e){var s=t(i[e],n.schema[e]),u=s[0],c=s[1],f=s[2];void 0!==i[e]&&(i[e]=u),c||e in r&&!r[e]||(a=!1),!f||e in r&&!r[e]||(o=!0)})),[this.fromJS(i),a,o]},e.asSchema=function(){return"development"===process.env.NODE_ENV&&console.error("asSchema() is deprecated - use Entity directly instead."),this},e}();k.schema={};var w=function(e){function r(){return e.apply(this,arguments)||this}return i(r,e),r.toJSON=function(){return Object.assign({},e.toJSON.call(this),{key:this.key})},r.pk=function(e,t,n){return this.prototype.pk.call(e,t,n)||n},r.normalize=function(e,t,n,r,i,o){var a=this;if("string"==typeof e)return e;var s=this.fromJS(e,t,n);if("production"!==process.env.NODE_ENV&&"silent"!==this.automaticValidation){for(var u,c=new this,f=new Set(Object.keys(c)),l=this.keysDefined(s),h=[[],[],[]],p=h[0],d=h[1],m=h[2],y=g(l);!(u=y()).done;){var v=u.value;f.has(v)?p.push(v):m.push(v)}for(var b,O=g(f);!(b=O()).done;){var k=b.value;p.includes(k)||d.push(k)}if(f.size){if(Array.isArray(e)&&m.length){var w="Attempted to initialize "+this.name+" with an array, but named members were expected\n\nThis is likely due to a malformed response.\nTry inspecting the network response or fetch() return value.\nOr use debugging tools: https://resthooks.io/docs/guides/debugging\nLearn more about schemas: https://resthooks.io/docs/api/schema\nIf this is a mistake, you can disable this check by setting static automaticValidation = 'silent'\n\nMissing: "+d+"\nFirst three members: "+JSON.stringify(e.slice(0,3),null,2);if("warn"!==this.automaticValidation){var E=new Error(w);throw E.status=400,E}console.warn(w)}var S=Math.max(l.length/2,1)<=m.length&&f.size>Math.max(m.length,2)&&Math.pow(p.length,1.5)/2<=m.length,j=p.length<Math.min(1,f.size/2);if(S||j){var z="",_="substantially different than expected keys";j&&(z+="\n Missing: "+d,_="no matching keys found"),S&&(z+="\n Unexpected keys: "+m,_="a large number of unexpected keys found");var N="Attempted to initialize "+this.name+" with "+_+"\n\n This is likely due to a malformed response.\n Try inspecting the network response or fetch() return value.\n Or use debugging tools: https://resthooks.io/docs/guides/debugging\n Learn more about schemas: https://resthooks.io/docs/api/schema\n If this is a mistake, you can disable this check by setting static automaticValidation = 'silent'\n\n Expected keys:\n Found: "+p+z+"\n Value: "+JSON.stringify(this.toObjectDefined(s),null,2);if(!(p.length>=4&&S||"warn"===this.automaticValidation)){var A=new Error(N);throw A.status=400,A}console.warn(N)}}}var x=s.pk(t,n);if(void 0!==x&&""!==x){var D=this.key;return D in o||(o[D]={}),x in o[D]||(o[D][x]=[]),o[D][x].some((function(t){return t===e}))?x:(o[D][x].push(e),Object.keys(this.schema).forEach((function(e){if(Object.hasOwnProperty.call(s,e)){var t=a.schema[e];s[e]=r(s[e],s,e,t,i,o)}else if("production"!==process.env.NODE_ENV){var n=new Error("Schema key is missing in Entity\n\n Be sure all schema members are also part of the entity\n Or use debugging tools: https://resthooks.io/docs/guides/debugging\n Learn more about nesting schemas: https://resthooks.io/docs/guides/nested-response\n\n Entity keys: "+Object.keys(s)+"\n Schema key(missing): "+e+"\n ");throw n.status=400,n}})),i(this,s,s,t,n),x)}if("production"!==process.env.NODE_ENV){var V=new Error("Missing usable resource key when normalizing response.\n\n This is likely due to a malformed response.\n Try inspecting the network response or fetch() return value.\n Or use debugging tools: https://resthooks.io/docs/guides/debugging\n Learn more about schemas: https://resthooks.io/docs/api/schema\n\n Entity: "+this.name+"\n Value: "+(e&&JSON.stringify(e,null,2))+"\n ");throw V.status=400,V}},r.denormalize=function(e,r){var i=this;if(t(e)){var o=n(this.schema,e,r),a=o[0],s=o[1],u=o[2];return[this.fromJS(a.toObject()),s,u]}var c=new this,f=!1,l=!0,h=e;return Object.keys(this.schema).forEach((function(t){var n=i.schema[t],o=i.hasDefined(e,t)?e[t]:void 0,a=r(o,n),s=a[0],u=a[1],p=a[2];u||t in c&&!c[t]||(l=!1),!p||t in c&&!c[t]||(f=!0),i.hasDefined(e,t)&&h[t]!==s&&(h[t]=s)})),[h,l,f]},a(r,null,[{key:"key",get:function(){if("production"!==process.env.NODE_ENV&&(""===this.name||"Entity"===this.name))throw new Error("Entity classes without a name must define `static get key()`");return this.name}}]),r}(k);function E(e){return null!==e&&void 0!==e.pk}"production"!==process.env.NODE_ENV&&(w.fromJS=function(e){if(void 0===this.prototype.pk)throw new Error("cannot construct on abstract types");return k.fromJS.call(this,e)});var S=Symbol("ENTITY WAS DELETED");function j(e){return(j=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function z(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function _(e,t,n){return(_=z()?Reflect.construct:function(e,t,n){var i=[null];i.push.apply(i,t);var o=new(Function.bind.apply(e,i));return n&&r(o,n.prototype),o}).apply(null,arguments)}function N(e){var t="function"==typeof Map?new Map:void 0;return(N=function(e){if(null===e||(n=e,-1===Function.toString.call(n).indexOf("[native code]")))return e;var n;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,i)}function i(){return _(e,arguments,j(this).constructor)}return i.prototype=Object.create(e.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),r(i,e)})(e)}var A=function(){this.children=new WeakMap},x=function(e){function t(){for(var t,n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return(t=e.call.apply(e,[this].concat(r))||this).message="Keys must include at least one member",t}return i(t,e),t}(N(Error)),D=function(){function e(){this.first=new WeakMap}var t=e.prototype;return t.delete=function(e){var t=this.traverse(e);return null==t||delete t.value,!!t},t.get=function(e){var t=this.traverse(e);return null==t?void 0:t.value},t.has=function(e){var t=this.traverse(e);return!!t&&Object.prototype.hasOwnProperty.call(t,"value")},t.set=function(e,t){if(e.length<1)throw new x;for(var n,r=this.first,i=0;i<e.length;i++)r.has(e[i])?n=r.get(e[i]):(n=new A,r.set(e[i],n)),r=n.children,i===e.length-1&&(n.value=t);return this},t.traverse=function(e){for(var t,n=this.first,r=0;r<e.length;r++){if(!(t=n.get(e[r])))return;n=t.children}return t},e}(),V=function(e,n,r,i){var o=J(e);function a(e,r){if(!r)return[e,!0,!1];if(!r.denormalize||"function"!=typeof r.denormalize){if("function"==typeof r)return e instanceof r?[e,!0,!1]:[new r(e),!0,!1];if("object"==typeof r)return(Array.isArray(r)?h:m)(r,e,u)}return null===e?[e,!0,!1]:E(r)?void 0===e?[e,!1,!1]:function(e,n,r,i,o,a){var s=i(e,n);if(s===S)return[void 0,!0,!0];if("object"!=typeof s||null===s)return[s,!1,!1];void 0===o[n.key]&&(o[n.key]={});var u=!0,c=!1;if(!o[n.key][e]){var f=[s],l=M(r,f);a[n.key]||(a[n.key]={}),a[n.key][e]||(a[n.key][e]=new D);var h=a[n.key][e],p=t(s)?s:n.fromJS(s);o[n.key][e]=p;var d=n.denormalize(p,l);o[n.key][e]=d[0],u=d[1],c=d[2],h.has(f)?o[n.key][e]=h.get(f):h.set(f,o[n.key][e])}return[o[n.key][e],u,c]}(e,r,u,o,i,n):"function"==typeof r.denormalize?r.denormalize(e,u):[e,!0,!1]}var s=[],u=M(a,s);return function(e,t){s.push(e);var n=a(e,t);return"object"!=typeof e?n:r.has(s)?[r.get(s),n[1],n[2]]:(r.set(s,n[0]),n)}},J=function(e){var n=t(e);return function(t,r){var i=r.key;return"object"==typeof t?t:n?e.getIn([i,t]):e[i]&&e[i][t]}};function M(e,t){var n=e.og||e,r=function(e,r){var i=n(e,r);if(i[0]&&r&&E(r))if("object"==typeof i[0])t.push(i[0]);else if("production"!==process.env.NODE_ENV)throw new Error("Unexpected primitive found during denormalization\nFound: "+i[0]+"\nExpected entity: "+r);return i};return r.og=e,r}var P=function e(t,n,r,i,o,a){return t&&i&&["function","object"].includes(typeof i)?i.normalize&&"function"==typeof i.normalize?i.normalize(t,n,r,e,o,a):"function"==typeof i?new i(t):(Array.isArray(i)?l:d)(i,t,n,r,e,o,a):t};var T=function(e){function t(t,n){if(!n)throw new Error('Expected option "schemaAttribute" not found on UnionSchema.');return e.call(this,t,n)||this}i(t,e);var n=t.prototype;return n.normalize=function(e,t,n,r,i,o){return this.normalizeValue(e,t,n,r,i,o)},n.denormalize=function(e,t){return this.denormalizeValue(e,t)},t}(s),I=function(e){function t(){return e.apply(this,arguments)||this}i(t,e);var n=t.prototype;return n.normalize=function(e,t,n,r,i,o){var a=this;return Object.keys(e).reduce((function(t,n,s){var u,c=e[n];return null!=c?Object.assign({},t,((u={})[n]=a.normalizeValue(c,e,n,r,i,o),u)):t}),{})},n.denormalize=function(e,t){var n=this,r=!0,i=!1;return[Object.keys(e).reduce((function(o,a){var s,u=e[a],c=n.denormalizeValue(u,t),f=c[0],l=c[1],h=c[2];return l||(r=!1),h&&(i=!0),!l||h?o:Object.assign({},o,((s={})[a]=f,s))}),{}),r,i]},t}(s),L=function(){function e(e){if("production"!==process.env.NODE_ENV&&!e)throw new Error('Expected option "entity" not found on DeleteSchema.');this._entity=e}var t=e.prototype;return t.normalize=function(e,t,n,r,i,o){if("string"==typeof e)return e;var a=this._entity.fromJS(e,t,n),s=a.pk(t,n);return i(this._entity,S,a,t,n),s},t.denormalize=function(e,t){return t(e,this._entity)},t._denormalizeNullable=function(){return[]},t._normalizeNullable=function(){return[]},t.merge=function(e,t){return t},e}(),U=Object.freeze({__proto__:null,Union:T,Values:I,Array:p,Object:y,Delete:L}),F=function(e){function t(){return e.apply(this,arguments)||this}return i(t,e),t.denormalize=function(e,t){return[e,!0,!1]},t}(w);e.DELETED=S,e.Entity=w,e.FlatEntity=F,e.SimpleRecord=k,e.WeakListMap=D,e.denormalize=function(e,t,n,r,i){if(void 0===r&&(r={}),void 0===i&&(i=new D),void 0===t)return[e,!0,!1,{}];if(void 0===e)return[void 0,!1,!1,{}];var o={},a=V(n,r,i,o);return[].concat(a(e,t),[o])},e.isEntity=E,e.normalize=function(e,t,n,r){if(void 0===n&&(n={}),void 0===r&&(r={}),void 0===t)return{entities:n,indexes:r,result:e};var i=function(e){return["object","function"].includes(typeof e)?"object":typeof e}(t);if(null===e||typeof e!==i){if("production"!==process.env.NODE_ENV){throw"string"==typeof e&&function(e){try{return"string"!=typeof JSON.parse(e)}catch(e){return!1}}(e)?new Error('Normalizing a string, but this does match schema.\n\nParsing this input string as JSON worked. This likely indicates fetch function did not parse\nthe JSON. By default, this only happens if "content-type" header includes "json".\nSee https://resthooks.io/docs/guides/custom-networking for more information\n\n Schema: '+JSON.stringify(t,void 0,2)+'\n Input: "'+e+'"'):new Error('Unexpected input given to normalize. Expected type to be "'+i+'", found "'+(null===e?"null":typeof e)+'".\n\n Schema: '+JSON.stringify(t,void 0,2)+'\n Input: "'+e+'"')}throw new Error('Unexpected input given to normalize. Expected type to be "'+i+'", found "'+(null===e?"null":typeof e)+'".')}var o={},a={},s=function(e,t,n,r){return function(r,i,o,a,s){var u=r.key,c=r.pk(o,a,s);u in e||(e[u]={});var f=e[u][c];if(e[u][c]=f?r.merge(f,i):i,Array.isArray(r.indexes)){var l=e[u][c];u in t||(t[u]={});for(var h,p=g(r.indexes);!(h=p()).done;){var d=h.value;d in t[u]||(t[u][d]={});var m=t[u][d];f&&delete m[f[d]],n[u]&&n[u][c]&&n[u][c][d]!==l[d]&&(m[n[u][c][d]]=S),d in l?m[l[d]]=c:"production"!==process.env.NODE_ENV&&console.warn("Index not found in entity. Indexes must be top-level members of your entity.\nIndex: "+d+"\nEntity: "+JSON.stringify(l,void 0,2))}}}}(o,a,n);return{entities:o,indexes:a,result:P(e,e,void 0,t,s,{})}},e.schema=U,Object.defineProperty(e,"__esModule",{value:!0})}));
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).rest_hooks_normalizr={})}(this,(function(e){"use strict";function t(e){return!(!e||"function"!=typeof e.hasOwnProperty||!(Object.hasOwnProperty.call(e,"__ownerID")||e._map&&Object.hasOwnProperty.call(e._map,"__ownerID")))}function n(e,t,n){var r=!0,i=!1;return[Object.keys(e).reduce((function(t,o){var a=""+o,s=n(t.get(a),e[a]),u=s[0],c=s[1],f=s[2];return c||(r=!1),f&&(i=!0),t.has(a)?t.set(a,u):t}),t),r,i]}function r(e,t){return(r=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function i(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,r(e,t)}function o(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function a(e,t,n){return t&&o(e.prototype,t),n&&o(e,n),e}var s=function(){function e(e,t){t&&(this._schemaAttribute="string"==typeof t?function(e){return e[t]}:t),this.define(e)}var n=e.prototype;return n.define=function(e){this.schema=e},n.getSchemaAttribute=function(e,t,n){return!this.isSingleSchema&&this._schemaAttribute(e,t,n)},n.inferSchema=function(e,t,n){if(this.isSingleSchema)return this.schema;var r=this.getSchemaAttribute(e,t,n);return this.schema[r]},n.normalizeValue=function(e,t,n,r,i,o){var a=this.inferSchema(e,t,n);if(!a)return e;var s=r(e,t,n,a,i,o);return this.isSingleSchema||null==s?s:{id:s,schema:this.getSchemaAttribute(e,t,n)}},n.denormalizeValue=function(e,n){var r=t(e)?e.get("schema"):e.schema;return this.isSingleSchema||r?n((this.isSingleSchema?void 0:t(e)?e.get("id"):e.id)||e,this.isSingleSchema?this.schema:this.schema[r]):[e,!0,!0]},a(e,[{key:"isSingleSchema",get:function(){return!this._schemaAttribute}}]),e}(),u=function(e){if(Array.isArray(e)&&e.length>1)throw new Error("Expected schema definition to be a single schema, but found "+e.length+".");return e[0]},c=function(e){return Array.isArray(e)?e:Object.keys(e).map((function(t){return e[t]}))},f=function(e){var t=e[1],n=e[2];return t&&!n},l=function(e,t,n,r,i,o,a){return e=u(e),c(t).map((function(t,s){return i(t,n,r,e,o,a)}))},h=function(e,t,n){e=u(e);var r=!1,i=!0;if(void 0===t&&e){var o=n(void 0,e);i=o[1],r=o[2]}return[t&&t.map?t.map((function(t){return n(t,e)})).filter(f).map((function(e){return e[0]})):t,i,r]},p=function(e){function t(){return e.apply(this,arguments)||this}i(t,e);var n=t.prototype;return n.normalize=function(e,t,n,r,i,o){var a=this;return c(e).map((function(e,s){return a.normalizeValue(e,t,n,r,i,o)})).filter((function(e){return null!=e}))},n.denormalize=function(e,t){var n=this,r=!1,i=!0;if(void 0===e&&this.schema){var o=t(void 0,this.schema);i=o[1],r=o[2]}return[e&&e.map?e.map((function(e){return n.denormalizeValue(e,t)})).filter(f).map((function(e){return e[0]})):e,i,r]},t}(s),d=function(e,t,n,r,i,o,a){var s=Object.assign({},t);return Object.keys(e).forEach((function(n){var r=e[n],u=i(t[n],t,n,r,o,a);null==u?delete s[n]:s[n]=u})),s},m=function(e,r,i){if(t(r))return n(e,r,i);var o=Object.assign({},r),a=!0,s=!1;return Object.keys(e).forEach((function(t){var n=i(o[t],e[t]),r=n[0],u=n[1],c=n[2];void 0!==o[t]&&(o[t]=r),c&&(s=!0),u||(a=!1)})),[o,a,s]},y=function(){function e(e){this.define(e)}var t=e.prototype;return t.define=function(e){this.schema=Object.keys(e).reduce((function(t,n){var r,i=e[n];return Object.assign({},t,((r={})[n]=i,r))}),this.schema||{})},t.normalize=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return d.apply(void 0,[this.schema].concat(t))},t.denormalize=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return m.apply(void 0,[this.schema].concat(t))},e}();function v(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function g(e,t){var n;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return v(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?v(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return(n=e[Symbol.iterator]()).next.bind(n)}var b=Symbol("Defined Members"),O=Symbol("unq"),k=function(){function e(){}return e.prototype.toString=function(){return this[O]},e.toJSON=function(){return{name:this.name,schema:this.schema}},e.fromJS=function(t,n,r){void 0===t&&(t={});var i=new this(t);return t instanceof e&&(t=t.constructor.toObjectDefined(t)),Object.assign(i,t),Object.defineProperty(i,b,{value:Object.keys(t),writable:!1}),Object.defineProperty(i,O,{value:""+Math.random(),writable:!1}),i},e.merge=function(e,t){var n=Object.assign(this.toObjectDefined(e),this.toObjectDefined(t));return this.fromJS(n)},e.hasDefined=function(e,t){return e[b].includes(t)},e.toObjectDefined=function(e){for(var t,n={},r=g(e[b]);!(t=r()).done;){var i=t.value;n[i]=e[i]}return n},e.keysDefined=function(e){return e[b]},e.normalize=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return d.apply(void 0,[this.schema].concat(t))},e.denormalize=function(e,t){var n=this,r=new this,i=Object.assign({},e),o=!1,a=!0;return Object.keys(this.schema).forEach((function(e){var s=t(i[e],n.schema[e]),u=s[0],c=s[1],f=s[2];void 0!==i[e]&&(i[e]=u),c||e in r&&!r[e]||(a=!1),!f||e in r&&!r[e]||(o=!0)})),[this.fromJS(i),a,o]},e.asSchema=function(){return"development"===process.env.NODE_ENV&&console.error("asSchema() is deprecated - use Entity directly instead."),this},e}();k.schema={};var w=function(e){function r(){return e.apply(this,arguments)||this}return i(r,e),r.toJSON=function(){return Object.assign({},e.toJSON.call(this),{key:this.key})},r.pk=function(e,t,n){return this.prototype.pk.call(e,t,n)||n},r.normalize=function(e,t,n,r,i,o){var a=this;if("string"==typeof e)return e;var s=this.fromJS(e,t,n);if("production"!==process.env.NODE_ENV&&"silent"!==this.automaticValidation){for(var u,c=new this,f=new Set(Object.keys(c)),l=this.keysDefined(s),h=[[],[],[]],p=h[0],d=h[1],m=h[2],y=g(l);!(u=y()).done;){var v=u.value;f.has(v)?p.push(v):m.push(v)}for(var b,O=g(f);!(b=O()).done;){var k=b.value;p.includes(k)||d.push(k)}if(f.size){if(Array.isArray(e)&&m.length){var w="Attempted to initialize "+this.name+" with an array, but named members were expected\n\nThis is likely due to a malformed response.\nTry inspecting the network response or fetch() return value.\nOr use debugging tools: https://resthooks.io/docs/guides/debugging\nLearn more about schemas: https://resthooks.io/docs/api/schema\nIf this is a mistake, you can disable this check by setting static automaticValidation = 'silent'\n\nMissing: "+d+"\nFirst three members: "+JSON.stringify(e.slice(0,3),null,2);if("warn"!==this.automaticValidation){var E=new Error(w);throw E.status=400,E}console.warn(w)}var S=Math.max(l.length/2,1)<=m.length&&f.size>Math.max(m.length,2)&&Math.pow(p.length,1.5)/2<=m.length,j=p.length<Math.min(1,f.size/2);if(S||j){var z="",_="substantially different than expected keys";j&&(z+="\n Missing: "+d,_="no matching keys found"),S&&(z+="\n Unexpected keys: "+m,_="a large number of unexpected keys found");var N="Attempted to initialize "+this.name+" with "+_+"\n\n This is likely due to a malformed response.\n Try inspecting the network response or fetch() return value.\n Or use debugging tools: https://resthooks.io/docs/guides/debugging\n Learn more about schemas: https://resthooks.io/docs/api/schema\n If this is a mistake, you can disable this check by setting static automaticValidation = 'silent'\n\n Expected keys:\n Found: "+p+z+"\n Value: "+JSON.stringify(this.toObjectDefined(s),null,2);if(!(p.length>=4&&S||"warn"===this.automaticValidation)){var A=new Error(N);throw A.status=400,A}console.warn(N)}}}var x=s.pk(t,n);if(void 0!==x&&""!==x){var D=this.key;return D in o||(o[D]={}),x in o[D]||(o[D][x]=[]),o[D][x].some((function(t){return t===e}))?x:(o[D][x].push(e),Object.keys(this.schema).forEach((function(e){if(Object.hasOwnProperty.call(s,e)){var t=a.schema[e];s[e]=r(s[e],s,e,t,i,o)}else if("production"!==process.env.NODE_ENV){var n=new Error("Schema key is missing in Entity\n\n Be sure all schema members are also part of the entity\n Or use debugging tools: https://resthooks.io/docs/guides/debugging\n Learn more about nesting schemas: https://resthooks.io/docs/guides/nested-response\n\n Entity keys: "+Object.keys(s)+"\n Schema key(missing): "+e+"\n ");throw n.status=400,n}})),i(this,s,s,t,n),x)}if("production"!==process.env.NODE_ENV){var V=new Error("Missing usable resource key when normalizing response.\n\n This is likely due to a malformed response.\n Try inspecting the network response or fetch() return value.\n Or use debugging tools: https://resthooks.io/docs/guides/debugging\n Learn more about schemas: https://resthooks.io/docs/api/schema\n\n Entity: "+this.name+"\n Value: "+(e&&JSON.stringify(e,null,2))+"\n ");throw V.status=400,V}},r.denormalize=function(e,r){var i=this;if(t(e)){var o=n(this.schema,e,r),a=o[0],s=o[1],u=o[2];return[this.fromJS(a.toObject()),s,u]}var c=new this,f=!1,l=!0,h=e;return Object.keys(this.schema).forEach((function(t){var n=i.schema[t],o=i.hasDefined(e,t)?e[t]:void 0,a=r(o,n),s=a[0],u=a[1],p=a[2];u||t in c&&!c[t]||(l=!1),!p||t in c&&!c[t]||(f=!0),i.hasDefined(e,t)&&h[t]!==s&&(h[t]=s)})),[h,l,f]},a(r,null,[{key:"key",get:function(){if("production"!==process.env.NODE_ENV&&(""===this.name||"Entity"===this.name))throw new Error("Entity classes without a name must define `static get key()`");return this.name}}]),r}(k);function E(e){return null!==e&&void 0!==e.pk}"production"!==process.env.NODE_ENV&&(w.fromJS=function(e){if(void 0===this.prototype.pk)throw new Error("cannot construct on abstract types");return k.fromJS.call(this,e)});var S=Symbol("ENTITY WAS DELETED");function j(e){return(j=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function z(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function _(e,t,n){return(_=z()?Reflect.construct:function(e,t,n){var i=[null];i.push.apply(i,t);var o=new(Function.bind.apply(e,i));return n&&r(o,n.prototype),o}).apply(null,arguments)}function N(e){var t="function"==typeof Map?new Map:void 0;return(N=function(e){if(null===e||(n=e,-1===Function.toString.call(n).indexOf("[native code]")))return e;var n;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,i)}function i(){return _(e,arguments,j(this).constructor)}return i.prototype=Object.create(e.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),r(i,e)})(e)}var A=function(){this.children=new WeakMap},x=function(e){function t(){for(var t,n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return(t=e.call.apply(e,[this].concat(r))||this).message="Keys must include at least one member",t}return i(t,e),t}(N(Error)),D=function(){function e(){this.first=new WeakMap}var t=e.prototype;return t.delete=function(e){var t=this.traverse(e);return null==t||delete t.value,!!t},t.get=function(e){var t=this.traverse(e);return null==t?void 0:t.value},t.has=function(e){var t=this.traverse(e);return!!t&&Object.prototype.hasOwnProperty.call(t,"value")},t.set=function(e,t){if(e.length<1)throw new x;for(var n,r=this.first,i=0;i<e.length;i++)r.has(e[i])?n=r.get(e[i]):(n=new A,r.set(e[i],n)),r=n.children,i===e.length-1&&(n.value=t);return this},t.traverse=function(e){for(var t,n=this.first,r=0;r<e.length;r++){if(!(t=n.get(e[r])))return;n=t.children}return t},e}(),V=function(e,n,r,i){var o=J(e);function a(e,r){if(!r)return[e,!0,!1];if(!r.denormalize||"function"!=typeof r.denormalize){if("function"==typeof r)return e instanceof r?[e,!0,!1]:[new r(e),!0,!1];if("object"==typeof r)return(Array.isArray(r)?h:m)(r,e,u)}return null===e?[e,!0,!1]:E(r)?void 0===e?[e,!1,!1]:function(e,n,r,i,o,a){var s=i(e,n);if(s===S)return[void 0,!0,!0];if("object"!=typeof s||null===s)return[s,!1,!1];void 0===o[n.key]&&(o[n.key]={});var u=!0,c=!1;if(!o[n.key][e]){var f=[s],l=M(r,f);a[n.key]||(a[n.key]={}),a[n.key][e]||(a[n.key][e]=new D);var h=a[n.key][e],p=t(s)?s:n.fromJS(s);o[n.key][e]=p;var d=n.denormalize(p,l);o[n.key][e]=d[0],u=d[1],c=d[2],h.has(f)?o[n.key][e]=h.get(f):h.set(f,o[n.key][e])}return[o[n.key][e],u,c]}(e,r,u,o,i,n):"function"==typeof r.denormalize?r.denormalize(e,u):[e,!0,!1]}var s=[],u=M(a,s);return function(e,t){s.push(e);var n=a(e,t);return Object(e)!==e?n:r.has(s)?[r.get(s),n[1],n[2]]:(r.set(s,n[0]),n)}},J=function(e){var n=t(e);return function(t,r){var i=r.key;return"object"==typeof t?t:n?e.getIn([i,t]):e[i]&&e[i][t]}};function M(e,t){var n=e.og||e,r=function(e,r){var i=n(e,r);if(i[0]&&r&&E(r))if(Object(i[0])===i[0])t.push(i[0]);else if("production"!==process.env.NODE_ENV)throw new Error("Unexpected primitive found during denormalization\nFound: "+i[0]+"\nExpected entity: "+r);return i};return r.og=e,r}var P=function e(t,n,r,i,o,a){return t&&i&&["function","object"].includes(typeof i)?i.normalize&&"function"==typeof i.normalize?i.normalize(t,n,r,e,o,a):"function"==typeof i?new i(t):(Array.isArray(i)?l:d)(i,t,n,r,e,o,a):t};var T=function(e){function t(t,n){if(!n)throw new Error('Expected option "schemaAttribute" not found on UnionSchema.');return e.call(this,t,n)||this}i(t,e);var n=t.prototype;return n.normalize=function(e,t,n,r,i,o){return this.normalizeValue(e,t,n,r,i,o)},n.denormalize=function(e,t){return this.denormalizeValue(e,t)},t}(s),I=function(e){function t(){return e.apply(this,arguments)||this}i(t,e);var n=t.prototype;return n.normalize=function(e,t,n,r,i,o){var a=this;return Object.keys(e).reduce((function(t,n,s){var u,c=e[n];return null!=c?Object.assign({},t,((u={})[n]=a.normalizeValue(c,e,n,r,i,o),u)):t}),{})},n.denormalize=function(e,t){var n=this,r=!0,i=!1;return[Object.keys(e).reduce((function(o,a){var s,u=e[a],c=n.denormalizeValue(u,t),f=c[0],l=c[1],h=c[2];return l||(r=!1),h&&(i=!0),!l||h?o:Object.assign({},o,((s={})[a]=f,s))}),{}),r,i]},t}(s),L=function(){function e(e){if("production"!==process.env.NODE_ENV&&!e)throw new Error('Expected option "entity" not found on DeleteSchema.');this._entity=e}var t=e.prototype;return t.normalize=function(e,t,n,r,i,o){if("string"==typeof e)return e;var a=this._entity.fromJS(e,t,n),s=a.pk(t,n);return i(this._entity,S,a,t,n),s},t.denormalize=function(e,t){return t(e,this._entity)},t._denormalizeNullable=function(){return[]},t._normalizeNullable=function(){return[]},t.merge=function(e,t){return t},e}(),U=Object.freeze({__proto__:null,Union:T,Values:I,Array:p,Object:y,Delete:L}),F=function(e){function t(){return e.apply(this,arguments)||this}return i(t,e),t.denormalize=function(e,t){return[e,!0,!1]},t}(w);e.DELETED=S,e.Entity=w,e.FlatEntity=F,e.SimpleRecord=k,e.WeakListMap=D,e.denormalize=function(e,t,n,r,i){if(void 0===r&&(r={}),void 0===i&&(i=new D),void 0===t)return[e,!0,!1,{}];if(void 0===e)return[void 0,!1,!1,{}];var o={},a=V(n,r,i,o);return[].concat(a(e,t),[o])},e.isEntity=E,e.normalize=function(e,t,n,r){if(void 0===n&&(n={}),void 0===r&&(r={}),void 0===t)return{entities:n,indexes:r,result:e};var i=function(e){return["object","function"].includes(typeof e)?"object":typeof e}(t);if(null===e||typeof e!==i){if("production"!==process.env.NODE_ENV){throw"string"==typeof e&&function(e){try{return"string"!=typeof JSON.parse(e)}catch(e){return!1}}(e)?new Error('Normalizing a string, but this does match schema.\n\nParsing this input string as JSON worked. This likely indicates fetch function did not parse\nthe JSON. By default, this only happens if "content-type" header includes "json".\nSee https://resthooks.io/docs/guides/custom-networking for more information\n\n Schema: '+JSON.stringify(t,void 0,2)+'\n Input: "'+e+'"'):new Error('Unexpected input given to normalize. Expected type to be "'+i+'", found "'+(null===e?"null":typeof e)+'".\n\n Schema: '+JSON.stringify(t,void 0,2)+'\n Input: "'+e+'"')}throw new Error('Unexpected input given to normalize. Expected type to be "'+i+'", found "'+(null===e?"null":typeof e)+'".')}var o={},a={},s=function(e,t,n,r){return function(r,i,o,a,s){var u=r.key,c=r.pk(o,a,s);u in e||(e[u]={});var f=e[u][c];if(e[u][c]=f?r.merge(f,i):i,Array.isArray(r.indexes)){var l=e[u][c];u in t||(t[u]={});for(var h,p=g(r.indexes);!(h=p()).done;){var d=h.value;d in t[u]||(t[u][d]={});var m=t[u][d];f&&delete m[f[d]],n[u]&&n[u][c]&&n[u][c][d]!==l[d]&&(m[n[u][c][d]]=S),d in l?m[l[d]]=c:"production"!==process.env.NODE_ENV&&console.warn("Index not found in entity. Indexes must be top-level members of your entity.\nIndex: "+d+"\nEntity: "+JSON.stringify(l,void 0,2))}}}}(o,a,n);return{entities:o,indexes:a,result:P(e,e,void 0,t,s,{})}},e.schema=U,Object.defineProperty(e,"__esModule",{value:!0})}));

@@ -92,5 +92,7 @@ import { isImmutable } from './schemas/ImmutableUtils';

globalKey.push(input);
const ret = unvisit(input, schema);
if (typeof input !== 'object') return ret;
const ret = unvisit(input, schema); // in the case where WeakMap cannot be used
// this test ensures null is properly excluded from WeakMap
if (Object(input) !== input) return ret;
if (!resultCache.has(globalKey)) {

@@ -149,3 +151,3 @@ resultCache.set(globalKey, ret[0]);

/* istanbul ignore else */
if (typeof ret[0] === 'object') {
if (Object(ret[0]) === ret[0]) {
globalKey.push(ret[0]);

@@ -163,2 +165,2 @@ } else if (process.env.NODE_ENV !== 'production') {

}
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9kZW5vcm1hbGl6ZS50cyJdLCJuYW1lcyI6WyJpc0ltbXV0YWJsZSIsImRlbm9ybWFsaXplIiwiYXJyYXlEZW5vcm1hbGl6ZSIsIm9iamVjdERlbm9ybWFsaXplIiwiaXNFbnRpdHkiLCJERUxFVEVEIiwiV2Vha0xpc3RNYXAiLCJ1bnZpc2l0RW50aXR5IiwiaWQiLCJzY2hlbWEiLCJ1bnZpc2l0IiwiZ2V0RW50aXR5IiwibG9jYWxDYWNoZSIsImVudGl0eUNhY2hlIiwiZW50aXR5IiwidW5kZWZpbmVkIiwia2V5IiwiZm91bmQiLCJkZWxldGVkIiwiZ2xvYmFsS2V5Iiwid3JhcHBlZFVudmlzaXQiLCJ3aXRoVHJhY2tlZEVudGl0aWVzIiwiZ2xvYmFsQ2FjaGVFbnRyeSIsImVudGl0eUNvcHkiLCJmcm9tSlMiLCJoYXMiLCJzZXQiLCJnZXQiLCJnZXRVbnZpc2l0IiwiZW50aXRpZXMiLCJyZXN1bHRDYWNoZSIsImdldEVudGl0aWVzIiwiaW5wdXQiLCJtZXRob2QiLCJBcnJheSIsImlzQXJyYXkiLCJwdXNoIiwicmV0IiwiZW50aXR5SXNJbW11dGFibGUiLCJlbnRpdHlPcklkIiwic2NoZW1hS2V5IiwiZ2V0SW4i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W1hKTtcbiAgICAvLyBwYXNzIG92ZXIgdW5kZWZpbmVkIGluIGtleVxuICAgIGlmIChyZXRbMF0gJiYgc2NoZW1hICYmIGlzRW50aXR5KHNjaGVtYSkpIHtcbiAgICAgIC8qIGlzdGFuYnVsIGlnbm9yZSBlbHNlICovXG4gICAgICBpZiAoT2JqZWN0KHJldFswXSkgPT09IHJldFswXSkge1xuICAgICAgICBnbG9iYWxLZXkucHVzaChyZXRbMF0pO1xuICAgICAgfSBlbHNlIGlmIChwcm9jZXNzLmVudi5OT0RFX0VOViAhPT0gJ3Byb2R1Y3Rpb24nKSB7XG4gICAgICAgIHRocm93IG5ldyBFcnJvcihcbiAgICAgICAgICBgVW5leHBlY3RlZCBwcmltaXRpdmUgZm91bmQgZHVyaW5nIGRlbm9ybWFsaXphdGlvblxcbkZvdW5kOiAke3JldFswXX1cXG5FeHBlY3RlZCBlbnRpdHk6ICR7c2NoZW1hfWAsXG4gICAgICAgICk7XG4gICAgICB9XG4gICAgfVxuXG4gICAgcmV0dXJuIHJldDtcbiAgfTtcbiAgd3JhcHBlZFVudmlzaXQub2cgPSB1bnZpc2l0O1xuICByZXR1cm4gd3JhcHBlZFVudmlzaXQ7XG59XG4iXX0=
{
"name": "@rest-hooks/normalizr",
"version": "6.0.3",
"version": "6.0.4",
"description": "Normalizes and denormalizes JSON according to schema for Redux and Flux applications",

@@ -67,3 +67,3 @@ "homepage": "https://github.com/coinbase/rest-hooks/tree/master/packages/normalizr#readme",

},
"gitHead": "c63ceaf1b405ce1bda5c41af68980873afd238d3"
"gitHead": "372d3bcbbc471201b9e3ead7ae4c9bfe22fab29d"
}

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc