Huge News!Announcing our $40M Series B led by Abstract Ventures.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 7.2.0 to 7.3.0

9

CHANGELOG.md

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

## [7.3.0](https://github.com/coinbase/rest-hooks/compare/@rest-hooks/normalizr@7.2.0...@rest-hooks/normalizr@7.3.0) (2021-06-16)
### 🚀 Features
* Add Entity.expiresAt() - entity TTL configuration ([#920](https://github.com/coinbase/rest-hooks/issues/920)) ([e0919c2](https://github.com/coinbase/rest-hooks/commit/e0919c2aa523e0a2fc8c6935dcf38953d723527e))
## [7.2.0](https://github.com/coinbase/rest-hooks/compare/@rest-hooks/normalizr@7.1.0...@rest-hooks/normalizr@7.2.0) (2021-06-13)

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

21

dist/normalizr.amd.js

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

Entity.expiresAt = function expiresAt(_ref2, input) {
var _expiresAt = _ref2.expiresAt;
return _expiresAt;
};
Entity.infer = function infer(args, indexes, _infer) {

@@ -1171,5 +1176,3 @@ if (!args[0]) return undefined;

var addEntities = function addEntities(entities, indexes, existingEntities, existingIndexes, entityMeta, _ref) {
var expiresAt = _ref.expiresAt,
date = _ref.date;
var addEntities = function addEntities(entities, indexes, existingEntities, existingIndexes, entityMeta, meta) {
return function (schema, processedEntity, id) {

@@ -1200,3 +1203,3 @@ var _entityMeta$schemaKey2;

// means we fallback to 'newer' (processedEntity) takes priority
var preferExisting = ((_entityMeta$schemaKey = entityMeta[schemaKey][id]) == null ? void 0 : _entityMeta$schemaKey.date) > date;
var preferExisting = ((_entityMeta$schemaKey = entityMeta[schemaKey][id]) == null ? void 0 : _entityMeta$schemaKey.date) > meta.date;

@@ -1253,6 +1256,8 @@ if (typeof processedEntity !== typeof inStoreEntity) {

existingEntities[schemaKey][id] = entities[schemaKey][id];
entityMeta[schemaKey][id] = ((_entityMeta$schemaKey2 = entityMeta[schemaKey][id]) == null ? void 0 : _entityMeta$schemaKey2.expiresAt) >= expiresAt ? entityMeta[schemaKey][id] : {
expiresAt: expiresAt,
date: date
existingEntities[schemaKey][id] = entities[schemaKey][id]; // TODO: eventually assume this exists and don't check for conditional. probably early 2022
var entityExpiresAt = schema.expiresAt ? schema.expiresAt(meta, processedEntity) : meta.expiresAt;
entityMeta[schemaKey][id] = ((_entityMeta$schemaKey2 = entityMeta[schemaKey][id]) == null ? void 0 : _entityMeta$schemaKey2.expiresAt) >= entityExpiresAt ? entityMeta[schemaKey][id] : {
expiresAt: entityExpiresAt,
date: meta.date
};

@@ -1259,0 +1264,0 @@ };

@@ -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 s=""+o,a=n(t.get(s),e[s]),u=a[0],c=a[1],f=a[2];return c||(r=!1),f&&(i=!0),t.has(s)?t.set(s,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 s(e,t,n){return t&&o(e.prototype,t),n&&o(e,n),e}var a=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 s=this.inferSchema(e,t,n);if(!s){if("production"!==process.env.NODE_ENV){var a=this.getSchemaAttribute(e,t,n);console.warn("Schema attribute "+JSON.stringify(a,void 0,2)+" is not expected.\nExpected one of: "+Object.keys(this.schema).map((function(e){return'"'+e+'"'})).join(", ")+"\n\nValue: "+JSON.stringify(e,void 0,2))}return e}var u=r(e,t,n,s,i,o);return this.isSingleSchema||null==u?u:{id:u,schema:this.getSchemaAttribute(e,t,n)}},n.denormalizeValue=function(e,n){if(void 0===e)return[e,!1,!1];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,!1]},s(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[0],n=e[2];return void 0!==t&&!n},l=function(e,t,n,r,i,o,s){return e=u(e),c(t).map((function(t,a){return i(t,n,r,e,o,s)}))},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]};function p(e,t,n,r){}var d=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 s=this;return c(e).map((function(e,a){return s.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]},n.infer=function(e,t,n){this.schema},t}(a),y=function(e,t,n,r,i,o,s){var a=Object.assign({},t);return Object.keys(e).forEach((function(n){var r=e[n],u=i(t[n],t,n,r,o,s);null==u?delete a[n]:a[n]=u})),a},m=function(e,r,i){if(t(r))return n(e,r,i);var o=Object.assign({},r),s=!0,a=!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&&(a=!0),u||(s=!1)})),[o,s,a]};function v(e,t,n,r){for(var i={},o=0,s=Object.keys(e);o<s.length;o++){var a=s[o];i[a]=r(e[a],t,n)}return i}var g=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 y.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))},t.infer=function(e,t,n){return v(this.schema,e,t,n)},e}();function b(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 O(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return b(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)?b(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.")}var k=Symbol("Defined Members"),w=Symbol("unq"),j=function(){function e(){}return e.prototype.toString=function(){return this[w]},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,k,{value:Object.keys(t),writable:!1}),Object.defineProperty(i,w,{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[k].includes(t)},e.toObjectDefined=function(e){for(var t,n={},r=O(e[k]);!(t=r()).done;){var i=t.value;n[i]=e[i]}return n},e.keysDefined=function(e){return e[k]},e.normalize=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return y.apply(void 0,[this.schema].concat(t))},e.infer=function(e,t,n){return v(this.schema,e,t,n)},e.denormalize=function(e,t){var n=this,r=Object.assign({},e),i=!1,o=!0;return Object.keys(this.schema).forEach((function(e){var s=t(r[e],n.schema[e]),a=s[0],u=s[1],c=s[2];void 0!==r[e]&&(r[e]=a),u||e in n.defaults&&!n.defaults[e]||(o=!1),!c||e in n.defaults&&!n.defaults[e]||(i=!0)})),[this.fromJS(r),o,i]},e.asSchema=function(){return"development"===process.env.NODE_ENV&&console.error("asSchema() is deprecated - use Entity directly instead."),this},s(e,null,[{key:"defaults",get:function(){return Object.prototype.hasOwnProperty.call(this,"__defaults")||(this.__defaults=new this),this.__defaults}}]),e}();j.schema={};var E=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 s=this;if("string"==typeof e)return e;var a=this.fromJS(e,t,n);if("production"!==process.env.NODE_ENV&&"silent"!==this.automaticValidation){for(var u,c=new Set(Object.keys(this.defaults)),f=this.keysDefined(a),l=[[],[],[]],h=l[0],p=l[1],d=l[2],y=O(f);!(u=y()).done;){var m=u.value;c.has(m)?h.push(m):d.push(m)}for(var v,g=O(c);!(v=g()).done;){var b=v.value;h.includes(b)||p.push(b)}if(c.size){if(Array.isArray(e)&&d.length){var k="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: "+p+"\nFirst three members: "+JSON.stringify(e.slice(0,3),null,2);if("warn"!==this.automaticValidation){var w=new Error(k);throw w.status=400,w}console.warn(k)}var j=Math.max(f.length/2,1)<=d.length&&c.size>Math.max(d.length,2)&&Math.pow(h.length,1.5)/2<=d.length,E=h.length<Math.min(1,c.size/2);if(j||E){var S="",_="substantially different than expected keys";E&&(S+="\n Missing: "+p,_="no matching keys found"),j&&(S+="\n Unexpected keys: "+d,_="a large number of unexpected keys found");var z="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: "+h+S+"\n Value: "+JSON.stringify(this.toObjectDefined(a),null,2);if(!(h.length>=4&&j||"warn"===this.automaticValidation)){var N=new Error(z);throw N.status=400,N}console.warn(z)}}}var A=a.pk(t,n);if(void 0!==A&&""!==A){var x=this.key;return x in o||(o[x]={}),A in o[x]||(o[x][A]=[]),o[x][A].some((function(t){return t===e}))?A:(o[x][A].push(e),Object.keys(this.schema).forEach((function(e){if(Object.hasOwnProperty.call(a,e)){var t=s.schema[e];a[e]=r(a[e],a,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(a)+"\n Schema key(missing): "+e+"\n ");throw n.status=400,n}})),i(this,a,A),A)}if("production"!==process.env.NODE_ENV){var D=new Error("Missing usable primary 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 D.status=400,D}},r.infer=function(e,t,n){if(e[0]){var r=this.pk(e[0],void 0,"");if(void 0!==r&&""!==r)return r;var i=function(e,t){return t?t.find((function(t){return Object.prototype.hasOwnProperty.call(e,t)})):void 0}(e[0],this.indexes);return i&&t[this.key]?t[this.key][i][e[0][i]]:void 0}},r.denormalize=function(e,r){var i=this,o=t(e)?e:this.fromJS(e instanceof j?this.toObjectDefined(e):e);if(null==r.setLocal||r.setLocal(o),t(e)){var s=n(this.schema,e,r),a=s[0],u=s[1],c=s[2];return[this.fromJS(a.toObject()),u,c]}var f=!1;return Object.keys(this.schema).forEach((function(t){var n=i.schema[t],s=Object.hasOwnProperty.call(e,t)?e[t]:void 0,a=r(s,n),u=a[0];!a[2]||Object.hasOwnProperty.call(e,t)&&!i.defaults[t]||(f=!0),Object.hasOwnProperty.call(e,t)&&e[t]!==u&&(o[t]=u)})),[o,!0,f]},s(r,null,[{key:"key",get:function(){if("production"!==process.env.NODE_ENV&&(""===this.name||"Entity"===this.name||"_temp"===this.name))throw new Error("Entity classes without a name must define `static get key()`");return this.name}}]),r}(j);function S(e){return null!==e&&void 0!==e.pk}"production"!==process.env.NODE_ENV&&(E.fromJS=function(e){if(void 0===this.prototype.pk)throw new Error("cannot construct on abstract types");return j.fromJS.call(this,e)});var _=Symbol("ENTITY WAS DELETED");function z(e){return(z=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function N(){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 A(e,t,n){return(A=N()?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 x(e){var t="function"==typeof Map?new Map:void 0;return(x=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 A(e,arguments,z(this).constructor)}return i.prototype=Object.create(e.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),r(i,e)})(e)}var D=function(){this.children=new WeakMap},V=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}(x(Error)),J=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 V;for(var n,r=this.first,i=0;i<e.length;i++)r.has(e[i])?n=r.get(e[i]):(n=new D,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}(),P=function(e,t,n,r){var i=M(e);function o(e,n){if(!n)return[e,!0,!1];if(!n.denormalize||"function"!=typeof n.denormalize){if("function"==typeof n)return e instanceof n?[e,!0,!1]:[new n(e),!0,!1];if("object"==typeof n)return(Array.isArray(n)?h:m)(n,e,a)}return null===e?[e,!0,!1]:S(n)?void 0===e?[e,!1,!1]:function(e,t,n,r,i,o){var s=r(e,t);if(s===_)return[void 0,!0,!0];if("object"!=typeof s||null===s)return[s,!1,!1];void 0===i[t.key]&&(i[t.key]={});var a=!0,u=!1;if(!i[t.key][e]){var c=[s],f=T(n,c);f.setLocal=function(n){return i[t.key][e]=n},o[t.key]||(o[t.key]={}),o[t.key][e]||(o[t.key][e]=new J);var l=o[t.key][e],h=t.denormalize(s,f);i[t.key][e]=h[0],a=h[1],u=h[2],l.has(c)?i[t.key][e]=l.get(c):l.set(c,i[t.key][e])}return[i[t.key][e],a,u]}(e,n,a,i,r,t):"function"==typeof n.denormalize?n.denormalize(e,a):[e,!0,!1]}var s=[],a=T(o,s);return function(e,t){s.push(e);var r=o(e,t);return Object(e)!==e?r:n.has(s)?[n.get(s),r[1],r[2]]:(n.set(s,r[0]),r)}},M=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 T(e,t){var n=e.og||e,r=function(e,r){var i=n(e,r);if(i[0]&&r&&S(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 I=function e(t,n,r,i,o,s){return t&&i&&["function","object"].includes(typeof i)?i.normalize&&"function"==typeof i.normalize?i.normalize(t,n,r,e,o,s):"function"==typeof i?new i(t):(Array.isArray(i)?l:y)(i,t,n,r,e,o,s):t};var L=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)},n.infer=function(e,t,n){var r=this.getSchemaAttribute(e[0],void 0,""),i=this.schema[r];if(void 0!==i)return{id:n(i,e,t),schema:r}},t}(a),R=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 s=this;return Object.keys(e).reduce((function(t,n,a){var u,c=e[n];return null!=c?Object.assign({},t,((u={})[n]=s.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,s){var a,u=e[s],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,((a={})[s]=f,a))}),{}),r,i]},n.infer=function(e,t,n){},t}(a),U=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 s=this._entity.fromJS(e,t,n).pk(t,n);if("production"!==process.env.NODE_ENV&&(void 0===s||""===s)){var a,u=new Error("Missing usable primary 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 Delete(Entity): Delete("+(null!=(a=this._entity.name)?a:this._entity)+")\n Value: "+(e&&JSON.stringify(e,null,2))+"\n ");throw u.status=400,u}return i(this,_,s),s},t.infer=function(e,t,n){},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},s(e,[{key:"key",get:function(){return this._entity.key}}]),e}(),F=Object.freeze({__proto__:null,Union:L,Values:R,Array:d,Object:g,Delete:U}),B=function(e){function t(){return e.apply(this,arguments)||this}return i(t,e),t.denormalize=function(e,t){return[e,!0,!1]},t}(E);e.DELETED=_,e.Entity=E,e.FlatEntity=B,e.SimpleRecord=j,e.WeakListMap=J,e.denormalize=function(e,t,n,r,i){if(void 0===r&&(r={}),void 0===i&&(i=new J),void 0===t)return[e,!0,!1,{}];if(void 0===e)return[void 0,!1,!1,{}];var o={},s=P(n,r,i,o);return[].concat(s(e,t),[o])},e.inferResults=function e(t,n,r){return function(e){return!!e&&"function"==typeof e.infer}(t)?t.infer(n,r,e):"object"==typeof t&&t?(Array.isArray(t)?p:v)(t,n,r,e):t},e.isEntity=S,e.normalize=function(e,t,n,r,i,o){if(void 0===n&&(n={}),void 0===r&&(r={}),void 0===i&&(i={}),void 0===o&&(o={date:Date.now(),expiresAt:1/0}),void 0===t)return{entities:n,indexes:r,result:e,entityMeta:i};var s=function(e){return["object","function"].includes(typeof e)?"object":typeof e}(t);if(null===e||typeof e!==s){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 "'+s+'", 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 "'+s+'", found "'+(null===e?"null":typeof e)+'".')}var a=Object.assign({},n),u=Object.assign({},r),c=Object.assign({},i),f=function(e,t,n,r,i,o){var s=o.expiresAt,a=o.date;return function(o,u,c){var f,l=o.key;l in e||(e[l]={},n[l]=Object.assign({},n[l]),i[l]=Object.assign({},i[l]));var h=e[l][c];if(h)e[l][c]=o.merge(h,u);else{var p=n[l][c];if(p){var d,y=(null==(d=i[l][c])?void 0:d.date)>a;e[l][c]=typeof u!=typeof p?y?p:u:y?o.merge(u,p):o.merge(p,u)}else e[l][c]=u}if(Array.isArray(o.indexes)){var m=e[l][c];l in t||(t[l]={},r[l]=Object.assign({},r[l]));for(var v,g=O(o.indexes);!(v=g()).done;){var b=v.value;b in t[l]||(r[l][b]=t[l][b]={});var k=t[l][b];h&&delete k[h[b]],n[l]&&n[l][c]&&n[l][c][b]!==m[b]&&(k[n[l][c][b]]=_),b in m?k[m[b]]=c:"production"!==process.env.NODE_ENV&&console.warn("Index not found in entity. Indexes must be top-level members of your entity.\nIndex: "+b+"\nEntity: "+JSON.stringify(m,void 0,2))}}n[l][c]=e[l][c],i[l][c]=(null==(f=i[l][c])?void 0:f.expiresAt)>=s?i[l][c]:{expiresAt:s,date:a}}}({},{},a,u,c,o);return{entities:a,indexes:u,result:I(e,e,void 0,t,f,{}),entityMeta:c}},e.schema=F,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 s=""+o,a=n(t.get(s),e[s]),u=a[0],c=a[1],f=a[2];return c||(r=!1),f&&(i=!0),t.has(s)?t.set(s,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 s(e,t,n){return t&&o(e.prototype,t),n&&o(e,n),e}var a=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 s=this.inferSchema(e,t,n);if(!s){if("production"!==process.env.NODE_ENV){var a=this.getSchemaAttribute(e,t,n);console.warn("Schema attribute "+JSON.stringify(a,void 0,2)+" is not expected.\nExpected one of: "+Object.keys(this.schema).map((function(e){return'"'+e+'"'})).join(", ")+"\n\nValue: "+JSON.stringify(e,void 0,2))}return e}var u=r(e,t,n,s,i,o);return this.isSingleSchema||null==u?u:{id:u,schema:this.getSchemaAttribute(e,t,n)}},n.denormalizeValue=function(e,n){if(void 0===e)return[e,!1,!1];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,!1]},s(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[0],n=e[2];return void 0!==t&&!n},l=function(e,t,n,r,i,o,s){return e=u(e),c(t).map((function(t,a){return i(t,n,r,e,o,s)}))},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]};function p(e,t,n,r){}var d=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 s=this;return c(e).map((function(e,a){return s.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]},n.infer=function(e,t,n){this.schema},t}(a),y=function(e,t,n,r,i,o,s){var a=Object.assign({},t);return Object.keys(e).forEach((function(n){var r=e[n],u=i(t[n],t,n,r,o,s);null==u?delete a[n]:a[n]=u})),a},m=function(e,r,i){if(t(r))return n(e,r,i);var o=Object.assign({},r),s=!0,a=!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&&(a=!0),u||(s=!1)})),[o,s,a]};function v(e,t,n,r){for(var i={},o=0,s=Object.keys(e);o<s.length;o++){var a=s[o];i[a]=r(e[a],t,n)}return i}var g=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 y.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))},t.infer=function(e,t,n){return v(this.schema,e,t,n)},e}();function b(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 O(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return b(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)?b(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.")}var k=Symbol("Defined Members"),w=Symbol("unq"),j=function(){function e(){}return e.prototype.toString=function(){return this[w]},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,k,{value:Object.keys(t),writable:!1}),Object.defineProperty(i,w,{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[k].includes(t)},e.toObjectDefined=function(e){for(var t,n={},r=O(e[k]);!(t=r()).done;){var i=t.value;n[i]=e[i]}return n},e.keysDefined=function(e){return e[k]},e.normalize=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return y.apply(void 0,[this.schema].concat(t))},e.infer=function(e,t,n){return v(this.schema,e,t,n)},e.denormalize=function(e,t){var n=this,r=Object.assign({},e),i=!1,o=!0;return Object.keys(this.schema).forEach((function(e){var s=t(r[e],n.schema[e]),a=s[0],u=s[1],c=s[2];void 0!==r[e]&&(r[e]=a),u||e in n.defaults&&!n.defaults[e]||(o=!1),!c||e in n.defaults&&!n.defaults[e]||(i=!0)})),[this.fromJS(r),o,i]},e.asSchema=function(){return"development"===process.env.NODE_ENV&&console.error("asSchema() is deprecated - use Entity directly instead."),this},s(e,null,[{key:"defaults",get:function(){return Object.prototype.hasOwnProperty.call(this,"__defaults")||(this.__defaults=new this),this.__defaults}}]),e}();j.schema={};var E=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 s=this;if("string"==typeof e)return e;var a=this.fromJS(e,t,n);if("production"!==process.env.NODE_ENV&&"silent"!==this.automaticValidation){for(var u,c=new Set(Object.keys(this.defaults)),f=this.keysDefined(a),l=[[],[],[]],h=l[0],p=l[1],d=l[2],y=O(f);!(u=y()).done;){var m=u.value;c.has(m)?h.push(m):d.push(m)}for(var v,g=O(c);!(v=g()).done;){var b=v.value;h.includes(b)||p.push(b)}if(c.size){if(Array.isArray(e)&&d.length){var k="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: "+p+"\nFirst three members: "+JSON.stringify(e.slice(0,3),null,2);if("warn"!==this.automaticValidation){var w=new Error(k);throw w.status=400,w}console.warn(k)}var j=Math.max(f.length/2,1)<=d.length&&c.size>Math.max(d.length,2)&&Math.pow(h.length,1.5)/2<=d.length,E=h.length<Math.min(1,c.size/2);if(j||E){var S="",_="substantially different than expected keys";E&&(S+="\n Missing: "+p,_="no matching keys found"),j&&(S+="\n Unexpected keys: "+d,_="a large number of unexpected keys found");var z="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: "+h+S+"\n Value: "+JSON.stringify(this.toObjectDefined(a),null,2);if(!(h.length>=4&&j||"warn"===this.automaticValidation)){var A=new Error(z);throw A.status=400,A}console.warn(z)}}}var N=a.pk(t,n);if(void 0!==N&&""!==N){var x=this.key;return x in o||(o[x]={}),N in o[x]||(o[x][N]=[]),o[x][N].some((function(t){return t===e}))?N:(o[x][N].push(e),Object.keys(this.schema).forEach((function(e){if(Object.hasOwnProperty.call(a,e)){var t=s.schema[e];a[e]=r(a[e],a,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(a)+"\n Schema key(missing): "+e+"\n ");throw n.status=400,n}})),i(this,a,N),N)}if("production"!==process.env.NODE_ENV){var D=new Error("Missing usable primary 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 D.status=400,D}},r.expiresAt=function(e,t){return e.expiresAt},r.infer=function(e,t,n){if(e[0]){var r=this.pk(e[0],void 0,"");if(void 0!==r&&""!==r)return r;var i=function(e,t){return t?t.find((function(t){return Object.prototype.hasOwnProperty.call(e,t)})):void 0}(e[0],this.indexes);return i&&t[this.key]?t[this.key][i][e[0][i]]:void 0}},r.denormalize=function(e,r){var i=this,o=t(e)?e:this.fromJS(e instanceof j?this.toObjectDefined(e):e);if(null==r.setLocal||r.setLocal(o),t(e)){var s=n(this.schema,e,r),a=s[0],u=s[1],c=s[2];return[this.fromJS(a.toObject()),u,c]}var f=!1;return Object.keys(this.schema).forEach((function(t){var n=i.schema[t],s=Object.hasOwnProperty.call(e,t)?e[t]:void 0,a=r(s,n),u=a[0];!a[2]||Object.hasOwnProperty.call(e,t)&&!i.defaults[t]||(f=!0),Object.hasOwnProperty.call(e,t)&&e[t]!==u&&(o[t]=u)})),[o,!0,f]},s(r,null,[{key:"key",get:function(){if("production"!==process.env.NODE_ENV&&(""===this.name||"Entity"===this.name||"_temp"===this.name))throw new Error("Entity classes without a name must define `static get key()`");return this.name}}]),r}(j);function S(e){return null!==e&&void 0!==e.pk}"production"!==process.env.NODE_ENV&&(E.fromJS=function(e){if(void 0===this.prototype.pk)throw new Error("cannot construct on abstract types");return j.fromJS.call(this,e)});var _=Symbol("ENTITY WAS DELETED");function z(e){return(z=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function A(){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 N(e,t,n){return(N=A()?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 x(e){var t="function"==typeof Map?new Map:void 0;return(x=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 N(e,arguments,z(this).constructor)}return i.prototype=Object.create(e.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),r(i,e)})(e)}var D=function(){this.children=new WeakMap},V=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}(x(Error)),J=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 V;for(var n,r=this.first,i=0;i<e.length;i++)r.has(e[i])?n=r.get(e[i]):(n=new D,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}(),P=function(e,t,n,r){var i=M(e);function o(e,n){if(!n)return[e,!0,!1];if(!n.denormalize||"function"!=typeof n.denormalize){if("function"==typeof n)return e instanceof n?[e,!0,!1]:[new n(e),!0,!1];if("object"==typeof n)return(Array.isArray(n)?h:m)(n,e,a)}return null===e?[e,!0,!1]:S(n)?void 0===e?[e,!1,!1]:function(e,t,n,r,i,o){var s=r(e,t);if(s===_)return[void 0,!0,!0];if("object"!=typeof s||null===s)return[s,!1,!1];void 0===i[t.key]&&(i[t.key]={});var a=!0,u=!1;if(!i[t.key][e]){var c=[s],f=T(n,c);f.setLocal=function(n){return i[t.key][e]=n},o[t.key]||(o[t.key]={}),o[t.key][e]||(o[t.key][e]=new J);var l=o[t.key][e],h=t.denormalize(s,f);i[t.key][e]=h[0],a=h[1],u=h[2],l.has(c)?i[t.key][e]=l.get(c):l.set(c,i[t.key][e])}return[i[t.key][e],a,u]}(e,n,a,i,r,t):"function"==typeof n.denormalize?n.denormalize(e,a):[e,!0,!1]}var s=[],a=T(o,s);return function(e,t){s.push(e);var r=o(e,t);return Object(e)!==e?r:n.has(s)?[n.get(s),r[1],r[2]]:(n.set(s,r[0]),r)}},M=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 T(e,t){var n=e.og||e,r=function(e,r){var i=n(e,r);if(i[0]&&r&&S(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 I=function e(t,n,r,i,o,s){return t&&i&&["function","object"].includes(typeof i)?i.normalize&&"function"==typeof i.normalize?i.normalize(t,n,r,e,o,s):"function"==typeof i?new i(t):(Array.isArray(i)?l:y)(i,t,n,r,e,o,s):t};var L=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)},n.infer=function(e,t,n){var r=this.getSchemaAttribute(e[0],void 0,""),i=this.schema[r];if(void 0!==i)return{id:n(i,e,t),schema:r}},t}(a),R=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 s=this;return Object.keys(e).reduce((function(t,n,a){var u,c=e[n];return null!=c?Object.assign({},t,((u={})[n]=s.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,s){var a,u=e[s],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,((a={})[s]=f,a))}),{}),r,i]},n.infer=function(e,t,n){},t}(a),U=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 s=this._entity.fromJS(e,t,n).pk(t,n);if("production"!==process.env.NODE_ENV&&(void 0===s||""===s)){var a,u=new Error("Missing usable primary 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 Delete(Entity): Delete("+(null!=(a=this._entity.name)?a:this._entity)+")\n Value: "+(e&&JSON.stringify(e,null,2))+"\n ");throw u.status=400,u}return i(this,_,s),s},t.infer=function(e,t,n){},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},s(e,[{key:"key",get:function(){return this._entity.key}}]),e}(),F=Object.freeze({__proto__:null,Union:L,Values:R,Array:d,Object:g,Delete:U}),B=function(e){function t(){return e.apply(this,arguments)||this}return i(t,e),t.denormalize=function(e,t){return[e,!0,!1]},t}(E);e.DELETED=_,e.Entity=E,e.FlatEntity=B,e.SimpleRecord=j,e.WeakListMap=J,e.denormalize=function(e,t,n,r,i){if(void 0===r&&(r={}),void 0===i&&(i=new J),void 0===t)return[e,!0,!1,{}];if(void 0===e)return[void 0,!1,!1,{}];var o={},s=P(n,r,i,o);return[].concat(s(e,t),[o])},e.inferResults=function e(t,n,r){return function(e){return!!e&&"function"==typeof e.infer}(t)?t.infer(n,r,e):"object"==typeof t&&t?(Array.isArray(t)?p:v)(t,n,r,e):t},e.isEntity=S,e.normalize=function(e,t,n,r,i,o){if(void 0===n&&(n={}),void 0===r&&(r={}),void 0===i&&(i={}),void 0===o&&(o={date:Date.now(),expiresAt:1/0}),void 0===t)return{entities:n,indexes:r,result:e,entityMeta:i};var s=function(e){return["object","function"].includes(typeof e)?"object":typeof e}(t);if(null===e||typeof e!==s){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 "'+s+'", 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 "'+s+'", found "'+(null===e?"null":typeof e)+'".')}var a=Object.assign({},n),u=Object.assign({},r),c=Object.assign({},i),f=function(e,t,n,r,i,o){return function(s,a,u){var c,f=s.key;f in e||(e[f]={},n[f]=Object.assign({},n[f]),i[f]=Object.assign({},i[f]));var l=e[f][u];if(l)e[f][u]=s.merge(l,a);else{var h=n[f][u];if(h){var p,d=(null==(p=i[f][u])?void 0:p.date)>o.date;e[f][u]=typeof a!=typeof h?d?h:a:d?s.merge(a,h):s.merge(h,a)}else e[f][u]=a}if(Array.isArray(s.indexes)){var y=e[f][u];f in t||(t[f]={},r[f]=Object.assign({},r[f]));for(var m,v=O(s.indexes);!(m=v()).done;){var g=m.value;g in t[f]||(r[f][g]=t[f][g]={});var b=t[f][g];l&&delete b[l[g]],n[f]&&n[f][u]&&n[f][u][g]!==y[g]&&(b[n[f][u][g]]=_),g in y?b[y[g]]=u:"production"!==process.env.NODE_ENV&&console.warn("Index not found in entity. Indexes must be top-level members of your entity.\nIndex: "+g+"\nEntity: "+JSON.stringify(y,void 0,2))}}n[f][u]=e[f][u];var k=s.expiresAt?s.expiresAt(o,a):o.expiresAt;i[f][u]=(null==(c=i[f][u])?void 0:c.expiresAt)>=k?i[f][u]:{expiresAt:k,date:o.date}}}({},{},a,u,c,o);return{entities:a,indexes:u,result:I(e,e,void 0,t,f,{}),entityMeta:c}},e.schema=F,Object.defineProperty(e,"__esModule",{value:!0})}));

@@ -724,2 +724,7 @@ var rest_hooks_normalizr = (function (exports) {

Entity.expiresAt = function expiresAt(_ref2, input) {
var _expiresAt = _ref2.expiresAt;
return _expiresAt;
};
Entity.infer = function infer(args, indexes, _infer) {

@@ -1172,5 +1177,3 @@ if (!args[0]) return undefined;

var addEntities = function addEntities(entities, indexes, existingEntities, existingIndexes, entityMeta, _ref) {
var expiresAt = _ref.expiresAt,
date = _ref.date;
var addEntities = function addEntities(entities, indexes, existingEntities, existingIndexes, entityMeta, meta) {
return function (schema, processedEntity, id) {

@@ -1201,3 +1204,3 @@ var _entityMeta$schemaKey2;

// means we fallback to 'newer' (processedEntity) takes priority
var preferExisting = ((_entityMeta$schemaKey = entityMeta[schemaKey][id]) == null ? void 0 : _entityMeta$schemaKey.date) > date;
var preferExisting = ((_entityMeta$schemaKey = entityMeta[schemaKey][id]) == null ? void 0 : _entityMeta$schemaKey.date) > meta.date;

@@ -1254,6 +1257,8 @@ if (typeof processedEntity !== typeof inStoreEntity) {

existingEntities[schemaKey][id] = entities[schemaKey][id];
entityMeta[schemaKey][id] = ((_entityMeta$schemaKey2 = entityMeta[schemaKey][id]) == null ? void 0 : _entityMeta$schemaKey2.expiresAt) >= expiresAt ? entityMeta[schemaKey][id] : {
expiresAt: expiresAt,
date: date
existingEntities[schemaKey][id] = entities[schemaKey][id]; // TODO: eventually assume this exists and don't check for conditional. probably early 2022
var entityExpiresAt = schema.expiresAt ? schema.expiresAt(meta, processedEntity) : meta.expiresAt;
entityMeta[schemaKey][id] = ((_entityMeta$schemaKey2 = entityMeta[schemaKey][id]) == null ? void 0 : _entityMeta$schemaKey2.expiresAt) >= entityExpiresAt ? entityMeta[schemaKey][id] : {
expiresAt: entityExpiresAt,
date: meta.date
};

@@ -1260,0 +1265,0 @@ };

@@ -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 s=""+o,a=n(t.get(s),e[s]),u=a[0],c=a[1],f=a[2];return c||(r=!1),f&&(i=!0),t.has(s)?t.set(s,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 s(e,t,n){return t&&o(e.prototype,t),n&&o(e,n),e}var a=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 s=this.inferSchema(e,t,n);if(!s){if("production"!==process.env.NODE_ENV){var a=this.getSchemaAttribute(e,t,n);console.warn("Schema attribute "+JSON.stringify(a,void 0,2)+" is not expected.\nExpected one of: "+Object.keys(this.schema).map((function(e){return'"'+e+'"'})).join(", ")+"\n\nValue: "+JSON.stringify(e,void 0,2))}return e}var u=r(e,t,n,s,i,o);return this.isSingleSchema||null==u?u:{id:u,schema:this.getSchemaAttribute(e,t,n)}},n.denormalizeValue=function(e,n){if(void 0===e)return[e,!1,!1];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,!1]},s(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[0],n=e[2];return void 0!==t&&!n},l=function(e,t,n,r,i,o,s){return e=u(e),c(t).map((function(t,a){return i(t,n,r,e,o,s)}))},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]};function p(e,t,n,r){}var d=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 s=this;return c(e).map((function(e,a){return s.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]},n.infer=function(e,t,n){this.schema},t}(a),y=function(e,t,n,r,i,o,s){var a=Object.assign({},t);return Object.keys(e).forEach((function(n){var r=e[n],u=i(t[n],t,n,r,o,s);null==u?delete a[n]:a[n]=u})),a},m=function(e,r,i){if(t(r))return n(e,r,i);var o=Object.assign({},r),s=!0,a=!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&&(a=!0),u||(s=!1)})),[o,s,a]};function v(e,t,n,r){for(var i={},o=0,s=Object.keys(e);o<s.length;o++){var a=s[o];i[a]=r(e[a],t,n)}return i}var g=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 y.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))},t.infer=function(e,t,n){return v(this.schema,e,t,n)},e}();function b(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 O(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return b(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)?b(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.")}var k=Symbol("Defined Members"),w=Symbol("unq"),j=function(){function e(){}return e.prototype.toString=function(){return this[w]},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,k,{value:Object.keys(t),writable:!1}),Object.defineProperty(i,w,{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[k].includes(t)},e.toObjectDefined=function(e){for(var t,n={},r=O(e[k]);!(t=r()).done;){var i=t.value;n[i]=e[i]}return n},e.keysDefined=function(e){return e[k]},e.normalize=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return y.apply(void 0,[this.schema].concat(t))},e.infer=function(e,t,n){return v(this.schema,e,t,n)},e.denormalize=function(e,t){var n=this,r=Object.assign({},e),i=!1,o=!0;return Object.keys(this.schema).forEach((function(e){var s=t(r[e],n.schema[e]),a=s[0],u=s[1],c=s[2];void 0!==r[e]&&(r[e]=a),u||e in n.defaults&&!n.defaults[e]||(o=!1),!c||e in n.defaults&&!n.defaults[e]||(i=!0)})),[this.fromJS(r),o,i]},e.asSchema=function(){return"development"===process.env.NODE_ENV&&console.error("asSchema() is deprecated - use Entity directly instead."),this},s(e,null,[{key:"defaults",get:function(){return Object.prototype.hasOwnProperty.call(this,"__defaults")||(this.__defaults=new this),this.__defaults}}]),e}();j.schema={};var E=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 s=this;if("string"==typeof e)return e;var a=this.fromJS(e,t,n);if("production"!==process.env.NODE_ENV&&"silent"!==this.automaticValidation){for(var u,c=new Set(Object.keys(this.defaults)),f=this.keysDefined(a),l=[[],[],[]],h=l[0],p=l[1],d=l[2],y=O(f);!(u=y()).done;){var m=u.value;c.has(m)?h.push(m):d.push(m)}for(var v,g=O(c);!(v=g()).done;){var b=v.value;h.includes(b)||p.push(b)}if(c.size){if(Array.isArray(e)&&d.length){var k="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: "+p+"\nFirst three members: "+JSON.stringify(e.slice(0,3),null,2);if("warn"!==this.automaticValidation){var w=new Error(k);throw w.status=400,w}console.warn(k)}var j=Math.max(f.length/2,1)<=d.length&&c.size>Math.max(d.length,2)&&Math.pow(h.length,1.5)/2<=d.length,E=h.length<Math.min(1,c.size/2);if(j||E){var S="",_="substantially different than expected keys";E&&(S+="\n Missing: "+p,_="no matching keys found"),j&&(S+="\n Unexpected keys: "+d,_="a large number of unexpected keys found");var z="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: "+h+S+"\n Value: "+JSON.stringify(this.toObjectDefined(a),null,2);if(!(h.length>=4&&j||"warn"===this.automaticValidation)){var N=new Error(z);throw N.status=400,N}console.warn(z)}}}var A=a.pk(t,n);if(void 0!==A&&""!==A){var x=this.key;return x in o||(o[x]={}),A in o[x]||(o[x][A]=[]),o[x][A].some((function(t){return t===e}))?A:(o[x][A].push(e),Object.keys(this.schema).forEach((function(e){if(Object.hasOwnProperty.call(a,e)){var t=s.schema[e];a[e]=r(a[e],a,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(a)+"\n Schema key(missing): "+e+"\n ");throw n.status=400,n}})),i(this,a,A),A)}if("production"!==process.env.NODE_ENV){var D=new Error("Missing usable primary 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 D.status=400,D}},r.infer=function(e,t,n){if(e[0]){var r=this.pk(e[0],void 0,"");if(void 0!==r&&""!==r)return r;var i=function(e,t){return t?t.find((function(t){return Object.prototype.hasOwnProperty.call(e,t)})):void 0}(e[0],this.indexes);return i&&t[this.key]?t[this.key][i][e[0][i]]:void 0}},r.denormalize=function(e,r){var i=this,o=t(e)?e:this.fromJS(e instanceof j?this.toObjectDefined(e):e);if(null==r.setLocal||r.setLocal(o),t(e)){var s=n(this.schema,e,r),a=s[0],u=s[1],c=s[2];return[this.fromJS(a.toObject()),u,c]}var f=!1;return Object.keys(this.schema).forEach((function(t){var n=i.schema[t],s=Object.hasOwnProperty.call(e,t)?e[t]:void 0,a=r(s,n),u=a[0];!a[2]||Object.hasOwnProperty.call(e,t)&&!i.defaults[t]||(f=!0),Object.hasOwnProperty.call(e,t)&&e[t]!==u&&(o[t]=u)})),[o,!0,f]},s(r,null,[{key:"key",get:function(){if("production"!==process.env.NODE_ENV&&(""===this.name||"Entity"===this.name||"_temp"===this.name))throw new Error("Entity classes without a name must define `static get key()`");return this.name}}]),r}(j);function S(e){return null!==e&&void 0!==e.pk}"production"!==process.env.NODE_ENV&&(E.fromJS=function(e){if(void 0===this.prototype.pk)throw new Error("cannot construct on abstract types");return j.fromJS.call(this,e)});var _=Symbol("ENTITY WAS DELETED");function z(e){return(z=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function N(){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 A(e,t,n){return(A=N()?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 x(e){var t="function"==typeof Map?new Map:void 0;return(x=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 A(e,arguments,z(this).constructor)}return i.prototype=Object.create(e.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),r(i,e)})(e)}var D=function(){this.children=new WeakMap},V=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}(x(Error)),J=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 V;for(var n,r=this.first,i=0;i<e.length;i++)r.has(e[i])?n=r.get(e[i]):(n=new D,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}(),P=function(e,t,n,r){var i=M(e);function o(e,n){if(!n)return[e,!0,!1];if(!n.denormalize||"function"!=typeof n.denormalize){if("function"==typeof n)return e instanceof n?[e,!0,!1]:[new n(e),!0,!1];if("object"==typeof n)return(Array.isArray(n)?h:m)(n,e,a)}return null===e?[e,!0,!1]:S(n)?void 0===e?[e,!1,!1]:function(e,t,n,r,i,o){var s=r(e,t);if(s===_)return[void 0,!0,!0];if("object"!=typeof s||null===s)return[s,!1,!1];void 0===i[t.key]&&(i[t.key]={});var a=!0,u=!1;if(!i[t.key][e]){var c=[s],f=T(n,c);f.setLocal=function(n){return i[t.key][e]=n},o[t.key]||(o[t.key]={}),o[t.key][e]||(o[t.key][e]=new J);var l=o[t.key][e],h=t.denormalize(s,f);i[t.key][e]=h[0],a=h[1],u=h[2],l.has(c)?i[t.key][e]=l.get(c):l.set(c,i[t.key][e])}return[i[t.key][e],a,u]}(e,n,a,i,r,t):"function"==typeof n.denormalize?n.denormalize(e,a):[e,!0,!1]}var s=[],a=T(o,s);return function(e,t){s.push(e);var r=o(e,t);return Object(e)!==e?r:n.has(s)?[n.get(s),r[1],r[2]]:(n.set(s,r[0]),r)}},M=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 T(e,t){var n=e.og||e,r=function(e,r){var i=n(e,r);if(i[0]&&r&&S(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 I=function e(t,n,r,i,o,s){return t&&i&&["function","object"].includes(typeof i)?i.normalize&&"function"==typeof i.normalize?i.normalize(t,n,r,e,o,s):"function"==typeof i?new i(t):(Array.isArray(i)?l:y)(i,t,n,r,e,o,s):t};var L=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)},n.infer=function(e,t,n){var r=this.getSchemaAttribute(e[0],void 0,""),i=this.schema[r];if(void 0!==i)return{id:n(i,e,t),schema:r}},t}(a),R=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 s=this;return Object.keys(e).reduce((function(t,n,a){var u,c=e[n];return null!=c?Object.assign({},t,((u={})[n]=s.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,s){var a,u=e[s],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,((a={})[s]=f,a))}),{}),r,i]},n.infer=function(e,t,n){},t}(a),U=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 s=this._entity.fromJS(e,t,n).pk(t,n);if("production"!==process.env.NODE_ENV&&(void 0===s||""===s)){var a,u=new Error("Missing usable primary 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 Delete(Entity): Delete("+(null!=(a=this._entity.name)?a:this._entity)+")\n Value: "+(e&&JSON.stringify(e,null,2))+"\n ");throw u.status=400,u}return i(this,_,s),s},t.infer=function(e,t,n){},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},s(e,[{key:"key",get:function(){return this._entity.key}}]),e}(),F=Object.freeze({__proto__:null,Union:L,Values:R,Array:d,Object:g,Delete:U}),B=function(e){function t(){return e.apply(this,arguments)||this}return i(t,e),t.denormalize=function(e,t){return[e,!0,!1]},t}(E);return e.DELETED=_,e.Entity=E,e.FlatEntity=B,e.SimpleRecord=j,e.WeakListMap=J,e.denormalize=function(e,t,n,r,i){if(void 0===r&&(r={}),void 0===i&&(i=new J),void 0===t)return[e,!0,!1,{}];if(void 0===e)return[void 0,!1,!1,{}];var o={},s=P(n,r,i,o);return[].concat(s(e,t),[o])},e.inferResults=function e(t,n,r){return function(e){return!!e&&"function"==typeof e.infer}(t)?t.infer(n,r,e):"object"==typeof t&&t?(Array.isArray(t)?p:v)(t,n,r,e):t},e.isEntity=S,e.normalize=function(e,t,n,r,i,o){if(void 0===n&&(n={}),void 0===r&&(r={}),void 0===i&&(i={}),void 0===o&&(o={date:Date.now(),expiresAt:1/0}),void 0===t)return{entities:n,indexes:r,result:e,entityMeta:i};var s=function(e){return["object","function"].includes(typeof e)?"object":typeof e}(t);if(null===e||typeof e!==s){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 "'+s+'", 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 "'+s+'", found "'+(null===e?"null":typeof e)+'".')}var a=Object.assign({},n),u=Object.assign({},r),c=Object.assign({},i),f=function(e,t,n,r,i,o){var s=o.expiresAt,a=o.date;return function(o,u,c){var f,l=o.key;l in e||(e[l]={},n[l]=Object.assign({},n[l]),i[l]=Object.assign({},i[l]));var h=e[l][c];if(h)e[l][c]=o.merge(h,u);else{var p=n[l][c];if(p){var d,y=(null==(d=i[l][c])?void 0:d.date)>a;e[l][c]=typeof u!=typeof p?y?p:u:y?o.merge(u,p):o.merge(p,u)}else e[l][c]=u}if(Array.isArray(o.indexes)){var m=e[l][c];l in t||(t[l]={},r[l]=Object.assign({},r[l]));for(var v,g=O(o.indexes);!(v=g()).done;){var b=v.value;b in t[l]||(r[l][b]=t[l][b]={});var k=t[l][b];h&&delete k[h[b]],n[l]&&n[l][c]&&n[l][c][b]!==m[b]&&(k[n[l][c][b]]=_),b in m?k[m[b]]=c:"production"!==process.env.NODE_ENV&&console.warn("Index not found in entity. Indexes must be top-level members of your entity.\nIndex: "+b+"\nEntity: "+JSON.stringify(m,void 0,2))}}n[l][c]=e[l][c],i[l][c]=(null==(f=i[l][c])?void 0:f.expiresAt)>=s?i[l][c]:{expiresAt:s,date:a}}}({},{},a,u,c,o);return{entities:a,indexes:u,result:I(e,e,void 0,t,f,{}),entityMeta:c}},e.schema=F,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 s=""+o,a=n(t.get(s),e[s]),u=a[0],c=a[1],f=a[2];return c||(r=!1),f&&(i=!0),t.has(s)?t.set(s,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 s(e,t,n){return t&&o(e.prototype,t),n&&o(e,n),e}var a=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 s=this.inferSchema(e,t,n);if(!s){if("production"!==process.env.NODE_ENV){var a=this.getSchemaAttribute(e,t,n);console.warn("Schema attribute "+JSON.stringify(a,void 0,2)+" is not expected.\nExpected one of: "+Object.keys(this.schema).map((function(e){return'"'+e+'"'})).join(", ")+"\n\nValue: "+JSON.stringify(e,void 0,2))}return e}var u=r(e,t,n,s,i,o);return this.isSingleSchema||null==u?u:{id:u,schema:this.getSchemaAttribute(e,t,n)}},n.denormalizeValue=function(e,n){if(void 0===e)return[e,!1,!1];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,!1]},s(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[0],n=e[2];return void 0!==t&&!n},l=function(e,t,n,r,i,o,s){return e=u(e),c(t).map((function(t,a){return i(t,n,r,e,o,s)}))},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]};function p(e,t,n,r){}var d=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 s=this;return c(e).map((function(e,a){return s.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]},n.infer=function(e,t,n){this.schema},t}(a),y=function(e,t,n,r,i,o,s){var a=Object.assign({},t);return Object.keys(e).forEach((function(n){var r=e[n],u=i(t[n],t,n,r,o,s);null==u?delete a[n]:a[n]=u})),a},m=function(e,r,i){if(t(r))return n(e,r,i);var o=Object.assign({},r),s=!0,a=!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&&(a=!0),u||(s=!1)})),[o,s,a]};function v(e,t,n,r){for(var i={},o=0,s=Object.keys(e);o<s.length;o++){var a=s[o];i[a]=r(e[a],t,n)}return i}var g=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 y.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))},t.infer=function(e,t,n){return v(this.schema,e,t,n)},e}();function b(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 O(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return b(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)?b(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.")}var k=Symbol("Defined Members"),w=Symbol("unq"),j=function(){function e(){}return e.prototype.toString=function(){return this[w]},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,k,{value:Object.keys(t),writable:!1}),Object.defineProperty(i,w,{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[k].includes(t)},e.toObjectDefined=function(e){for(var t,n={},r=O(e[k]);!(t=r()).done;){var i=t.value;n[i]=e[i]}return n},e.keysDefined=function(e){return e[k]},e.normalize=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return y.apply(void 0,[this.schema].concat(t))},e.infer=function(e,t,n){return v(this.schema,e,t,n)},e.denormalize=function(e,t){var n=this,r=Object.assign({},e),i=!1,o=!0;return Object.keys(this.schema).forEach((function(e){var s=t(r[e],n.schema[e]),a=s[0],u=s[1],c=s[2];void 0!==r[e]&&(r[e]=a),u||e in n.defaults&&!n.defaults[e]||(o=!1),!c||e in n.defaults&&!n.defaults[e]||(i=!0)})),[this.fromJS(r),o,i]},e.asSchema=function(){return"development"===process.env.NODE_ENV&&console.error("asSchema() is deprecated - use Entity directly instead."),this},s(e,null,[{key:"defaults",get:function(){return Object.prototype.hasOwnProperty.call(this,"__defaults")||(this.__defaults=new this),this.__defaults}}]),e}();j.schema={};var E=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 s=this;if("string"==typeof e)return e;var a=this.fromJS(e,t,n);if("production"!==process.env.NODE_ENV&&"silent"!==this.automaticValidation){for(var u,c=new Set(Object.keys(this.defaults)),f=this.keysDefined(a),l=[[],[],[]],h=l[0],p=l[1],d=l[2],y=O(f);!(u=y()).done;){var m=u.value;c.has(m)?h.push(m):d.push(m)}for(var v,g=O(c);!(v=g()).done;){var b=v.value;h.includes(b)||p.push(b)}if(c.size){if(Array.isArray(e)&&d.length){var k="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: "+p+"\nFirst three members: "+JSON.stringify(e.slice(0,3),null,2);if("warn"!==this.automaticValidation){var w=new Error(k);throw w.status=400,w}console.warn(k)}var j=Math.max(f.length/2,1)<=d.length&&c.size>Math.max(d.length,2)&&Math.pow(h.length,1.5)/2<=d.length,E=h.length<Math.min(1,c.size/2);if(j||E){var S="",_="substantially different than expected keys";E&&(S+="\n Missing: "+p,_="no matching keys found"),j&&(S+="\n Unexpected keys: "+d,_="a large number of unexpected keys found");var z="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: "+h+S+"\n Value: "+JSON.stringify(this.toObjectDefined(a),null,2);if(!(h.length>=4&&j||"warn"===this.automaticValidation)){var A=new Error(z);throw A.status=400,A}console.warn(z)}}}var N=a.pk(t,n);if(void 0!==N&&""!==N){var x=this.key;return x in o||(o[x]={}),N in o[x]||(o[x][N]=[]),o[x][N].some((function(t){return t===e}))?N:(o[x][N].push(e),Object.keys(this.schema).forEach((function(e){if(Object.hasOwnProperty.call(a,e)){var t=s.schema[e];a[e]=r(a[e],a,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(a)+"\n Schema key(missing): "+e+"\n ");throw n.status=400,n}})),i(this,a,N),N)}if("production"!==process.env.NODE_ENV){var D=new Error("Missing usable primary 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 D.status=400,D}},r.expiresAt=function(e,t){return e.expiresAt},r.infer=function(e,t,n){if(e[0]){var r=this.pk(e[0],void 0,"");if(void 0!==r&&""!==r)return r;var i=function(e,t){return t?t.find((function(t){return Object.prototype.hasOwnProperty.call(e,t)})):void 0}(e[0],this.indexes);return i&&t[this.key]?t[this.key][i][e[0][i]]:void 0}},r.denormalize=function(e,r){var i=this,o=t(e)?e:this.fromJS(e instanceof j?this.toObjectDefined(e):e);if(null==r.setLocal||r.setLocal(o),t(e)){var s=n(this.schema,e,r),a=s[0],u=s[1],c=s[2];return[this.fromJS(a.toObject()),u,c]}var f=!1;return Object.keys(this.schema).forEach((function(t){var n=i.schema[t],s=Object.hasOwnProperty.call(e,t)?e[t]:void 0,a=r(s,n),u=a[0];!a[2]||Object.hasOwnProperty.call(e,t)&&!i.defaults[t]||(f=!0),Object.hasOwnProperty.call(e,t)&&e[t]!==u&&(o[t]=u)})),[o,!0,f]},s(r,null,[{key:"key",get:function(){if("production"!==process.env.NODE_ENV&&(""===this.name||"Entity"===this.name||"_temp"===this.name))throw new Error("Entity classes without a name must define `static get key()`");return this.name}}]),r}(j);function S(e){return null!==e&&void 0!==e.pk}"production"!==process.env.NODE_ENV&&(E.fromJS=function(e){if(void 0===this.prototype.pk)throw new Error("cannot construct on abstract types");return j.fromJS.call(this,e)});var _=Symbol("ENTITY WAS DELETED");function z(e){return(z=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function A(){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 N(e,t,n){return(N=A()?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 x(e){var t="function"==typeof Map?new Map:void 0;return(x=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 N(e,arguments,z(this).constructor)}return i.prototype=Object.create(e.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),r(i,e)})(e)}var D=function(){this.children=new WeakMap},V=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}(x(Error)),J=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 V;for(var n,r=this.first,i=0;i<e.length;i++)r.has(e[i])?n=r.get(e[i]):(n=new D,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}(),P=function(e,t,n,r){var i=M(e);function o(e,n){if(!n)return[e,!0,!1];if(!n.denormalize||"function"!=typeof n.denormalize){if("function"==typeof n)return e instanceof n?[e,!0,!1]:[new n(e),!0,!1];if("object"==typeof n)return(Array.isArray(n)?h:m)(n,e,a)}return null===e?[e,!0,!1]:S(n)?void 0===e?[e,!1,!1]:function(e,t,n,r,i,o){var s=r(e,t);if(s===_)return[void 0,!0,!0];if("object"!=typeof s||null===s)return[s,!1,!1];void 0===i[t.key]&&(i[t.key]={});var a=!0,u=!1;if(!i[t.key][e]){var c=[s],f=T(n,c);f.setLocal=function(n){return i[t.key][e]=n},o[t.key]||(o[t.key]={}),o[t.key][e]||(o[t.key][e]=new J);var l=o[t.key][e],h=t.denormalize(s,f);i[t.key][e]=h[0],a=h[1],u=h[2],l.has(c)?i[t.key][e]=l.get(c):l.set(c,i[t.key][e])}return[i[t.key][e],a,u]}(e,n,a,i,r,t):"function"==typeof n.denormalize?n.denormalize(e,a):[e,!0,!1]}var s=[],a=T(o,s);return function(e,t){s.push(e);var r=o(e,t);return Object(e)!==e?r:n.has(s)?[n.get(s),r[1],r[2]]:(n.set(s,r[0]),r)}},M=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 T(e,t){var n=e.og||e,r=function(e,r){var i=n(e,r);if(i[0]&&r&&S(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 I=function e(t,n,r,i,o,s){return t&&i&&["function","object"].includes(typeof i)?i.normalize&&"function"==typeof i.normalize?i.normalize(t,n,r,e,o,s):"function"==typeof i?new i(t):(Array.isArray(i)?l:y)(i,t,n,r,e,o,s):t};var L=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)},n.infer=function(e,t,n){var r=this.getSchemaAttribute(e[0],void 0,""),i=this.schema[r];if(void 0!==i)return{id:n(i,e,t),schema:r}},t}(a),R=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 s=this;return Object.keys(e).reduce((function(t,n,a){var u,c=e[n];return null!=c?Object.assign({},t,((u={})[n]=s.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,s){var a,u=e[s],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,((a={})[s]=f,a))}),{}),r,i]},n.infer=function(e,t,n){},t}(a),U=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 s=this._entity.fromJS(e,t,n).pk(t,n);if("production"!==process.env.NODE_ENV&&(void 0===s||""===s)){var a,u=new Error("Missing usable primary 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 Delete(Entity): Delete("+(null!=(a=this._entity.name)?a:this._entity)+")\n Value: "+(e&&JSON.stringify(e,null,2))+"\n ");throw u.status=400,u}return i(this,_,s),s},t.infer=function(e,t,n){},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},s(e,[{key:"key",get:function(){return this._entity.key}}]),e}(),F=Object.freeze({__proto__:null,Union:L,Values:R,Array:d,Object:g,Delete:U}),B=function(e){function t(){return e.apply(this,arguments)||this}return i(t,e),t.denormalize=function(e,t){return[e,!0,!1]},t}(E);return e.DELETED=_,e.Entity=E,e.FlatEntity=B,e.SimpleRecord=j,e.WeakListMap=J,e.denormalize=function(e,t,n,r,i){if(void 0===r&&(r={}),void 0===i&&(i=new J),void 0===t)return[e,!0,!1,{}];if(void 0===e)return[void 0,!1,!1,{}];var o={},s=P(n,r,i,o);return[].concat(s(e,t),[o])},e.inferResults=function e(t,n,r){return function(e){return!!e&&"function"==typeof e.infer}(t)?t.infer(n,r,e):"object"==typeof t&&t?(Array.isArray(t)?p:v)(t,n,r,e):t},e.isEntity=S,e.normalize=function(e,t,n,r,i,o){if(void 0===n&&(n={}),void 0===r&&(r={}),void 0===i&&(i={}),void 0===o&&(o={date:Date.now(),expiresAt:1/0}),void 0===t)return{entities:n,indexes:r,result:e,entityMeta:i};var s=function(e){return["object","function"].includes(typeof e)?"object":typeof e}(t);if(null===e||typeof e!==s){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 "'+s+'", 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 "'+s+'", found "'+(null===e?"null":typeof e)+'".')}var a=Object.assign({},n),u=Object.assign({},r),c=Object.assign({},i),f=function(e,t,n,r,i,o){return function(s,a,u){var c,f=s.key;f in e||(e[f]={},n[f]=Object.assign({},n[f]),i[f]=Object.assign({},i[f]));var l=e[f][u];if(l)e[f][u]=s.merge(l,a);else{var h=n[f][u];if(h){var p,d=(null==(p=i[f][u])?void 0:p.date)>o.date;e[f][u]=typeof a!=typeof h?d?h:a:d?s.merge(a,h):s.merge(h,a)}else e[f][u]=a}if(Array.isArray(s.indexes)){var y=e[f][u];f in t||(t[f]={},r[f]=Object.assign({},r[f]));for(var m,v=O(s.indexes);!(m=v()).done;){var g=m.value;g in t[f]||(r[f][g]=t[f][g]={});var b=t[f][g];l&&delete b[l[g]],n[f]&&n[f][u]&&n[f][u][g]!==y[g]&&(b[n[f][u][g]]=_),g in y?b[y[g]]=u:"production"!==process.env.NODE_ENV&&console.warn("Index not found in entity. Indexes must be top-level members of your entity.\nIndex: "+g+"\nEntity: "+JSON.stringify(y,void 0,2))}}n[f][u]=e[f][u];var k=s.expiresAt?s.expiresAt(o,a):o.expiresAt;i[f][u]=(null==(c=i[f][u])?void 0:c.expiresAt)>=k?i[f][u]:{expiresAt:k,date:o.date}}}({},{},a,u,c,o);return{entities:a,indexes:u,result:I(e,e,void 0,t,f,{}),entityMeta:c}},e.schema=F,Object.defineProperty(e,"__esModule",{value:!0}),e}({});

@@ -725,2 +725,7 @@ 'use strict';

Entity.expiresAt = function expiresAt(_ref2, input) {
var _expiresAt = _ref2.expiresAt;
return _expiresAt;
};
Entity.infer = function infer(args, indexes, _infer) {

@@ -1173,5 +1178,3 @@ if (!args[0]) return undefined;

var addEntities = function addEntities(entities, indexes, existingEntities, existingIndexes, entityMeta, _ref) {
var expiresAt = _ref.expiresAt,
date = _ref.date;
var addEntities = function addEntities(entities, indexes, existingEntities, existingIndexes, entityMeta, meta) {
return function (schema, processedEntity, id) {

@@ -1202,3 +1205,3 @@ var _entityMeta$schemaKey2;

// means we fallback to 'newer' (processedEntity) takes priority
var preferExisting = ((_entityMeta$schemaKey = entityMeta[schemaKey][id]) == null ? void 0 : _entityMeta$schemaKey.date) > date;
var preferExisting = ((_entityMeta$schemaKey = entityMeta[schemaKey][id]) == null ? void 0 : _entityMeta$schemaKey.date) > meta.date;

@@ -1255,6 +1258,8 @@ if (typeof processedEntity !== typeof inStoreEntity) {

existingEntities[schemaKey][id] = entities[schemaKey][id];
entityMeta[schemaKey][id] = ((_entityMeta$schemaKey2 = entityMeta[schemaKey][id]) == null ? void 0 : _entityMeta$schemaKey2.expiresAt) >= expiresAt ? entityMeta[schemaKey][id] : {
expiresAt: expiresAt,
date: date
existingEntities[schemaKey][id] = entities[schemaKey][id]; // TODO: eventually assume this exists and don't check for conditional. probably early 2022
var entityExpiresAt = schema.expiresAt ? schema.expiresAt(meta, processedEntity) : meta.expiresAt;
entityMeta[schemaKey][id] = ((_entityMeta$schemaKey2 = entityMeta[schemaKey][id]) == null ? void 0 : _entityMeta$schemaKey2.expiresAt) >= entityExpiresAt ? entityMeta[schemaKey][id] : {
expiresAt: entityExpiresAt,
date: meta.date
};

@@ -1261,0 +1266,0 @@ };

@@ -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 s=""+o,a=n(t.get(s),e[s]),u=a[0],c=a[1],f=a[2];return c||(r=!1),f&&(i=!0),t.has(s)?t.set(s,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 s=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 s=this.inferSchema(e,t,n);if(!s){if("production"!==process.env.NODE_ENV){var a=this.getSchemaAttribute(e,t,n);console.warn("Schema attribute "+JSON.stringify(a,void 0,2)+" is not expected.\nExpected one of: "+Object.keys(this.schema).map((function(e){return'"'+e+'"'})).join(", ")+"\n\nValue: "+JSON.stringify(e,void 0,2))}return e}var u=r(e,t,n,s,i,o);return this.isSingleSchema||null==u?u:{id:u,schema:this.getSchemaAttribute(e,t,n)}},n.denormalizeValue=function(t,n){if(void 0===t)return[t,!1,!1];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,!1]},o(t,[{key:"isSingleSchema",get:function(){return!this._schemaAttribute}}]),t}(),a=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[0],n=e[2];return void 0!==t&&!n},f=function(e,t,n,r,i,o,s){return e=a(e),u(t).map((function(t,a){return i(t,n,r,e,o,s)}))},l=function(e,t,n){e=a(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]};function h(e,t,n,r){}var p=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 s=this;return u(e).map((function(e,a){return s.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]},n.infer=function(e,t,n){this.schema},t}(s),d=function(e,t,n,r,i,o,s){var a=Object.assign({},t);return Object.keys(e).forEach((function(n){var r=e[n],u=i(t[n],t,n,r,o,s);null==u?delete a[n]:a[n]=u})),a},y=function(n,r,i){if(e(r))return t(n,r,i);var o=Object.assign({},r),s=!0,a=!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&&(a=!0),u||(s=!1)})),[o,s,a]};function m(e,t,n,r){for(var i={},o=0,s=Object.keys(e);o<s.length;o++){var a=s[o];i[a]=r(e[a],t,n)}return i}var v=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 y.apply(void 0,[this.schema].concat(t))},t.infer=function(e,t,n){return m(this.schema,e,t,n)},e}();function g(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 b(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return g(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)?g(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.")}var O=Symbol("Defined Members"),k=Symbol("unq"),w=function(){function e(){}return e.prototype.toString=function(){return this[k]},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,O,{value:Object.keys(t),writable:!1}),Object.defineProperty(i,k,{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[O].includes(t)},e.toObjectDefined=function(e){for(var t,n={},r=b(e[O]);!(t=r()).done;){var i=t.value;n[i]=e[i]}return n},e.keysDefined=function(e){return e[O]},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.infer=function(e,t,n){return m(this.schema,e,t,n)},e.denormalize=function(e,t){var n=this,r=Object.assign({},e),i=!1,o=!0;return Object.keys(this.schema).forEach((function(e){var s=t(r[e],n.schema[e]),a=s[0],u=s[1],c=s[2];void 0!==r[e]&&(r[e]=a),u||e in n.defaults&&!n.defaults[e]||(o=!1),!c||e in n.defaults&&!n.defaults[e]||(i=!0)})),[this.fromJS(r),o,i]},e.asSchema=function(){return"development"===process.env.NODE_ENV&&console.error("asSchema() is deprecated - use Entity directly instead."),this},o(e,null,[{key:"defaults",get:function(){return Object.prototype.hasOwnProperty.call(this,"__defaults")||(this.__defaults=new this),this.__defaults}}]),e}();w.schema={};var j=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 s=this;if("string"==typeof e)return e;var a=this.fromJS(e,t,n);if("production"!==process.env.NODE_ENV&&"silent"!==this.automaticValidation){for(var u,c=new Set(Object.keys(this.defaults)),f=this.keysDefined(a),l=[[],[],[]],h=l[0],p=l[1],d=l[2],y=b(f);!(u=y()).done;){var m=u.value;c.has(m)?h.push(m):d.push(m)}for(var v,g=b(c);!(v=g()).done;){var O=v.value;h.includes(O)||p.push(O)}if(c.size){if(Array.isArray(e)&&d.length){var k="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: "+p+"\nFirst three members: "+JSON.stringify(e.slice(0,3),null,2);if("warn"!==this.automaticValidation){var w=new Error(k);throw w.status=400,w}console.warn(k)}var j=Math.max(f.length/2,1)<=d.length&&c.size>Math.max(d.length,2)&&Math.pow(h.length,1.5)/2<=d.length,E=h.length<Math.min(1,c.size/2);if(j||E){var S="",_="substantially different than expected keys";E&&(S+="\n Missing: "+p,_="no matching keys found"),j&&(S+="\n Unexpected keys: "+d,_="a large number of unexpected keys found");var z="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: "+h+S+"\n Value: "+JSON.stringify(this.toObjectDefined(a),null,2);if(!(h.length>=4&&j||"warn"===this.automaticValidation)){var x=new Error(z);throw x.status=400,x}console.warn(z)}}}var N=a.pk(t,n);if(void 0!==N&&""!==N){var A=this.key;return A in o||(o[A]={}),N in o[A]||(o[A][N]=[]),o[A][N].some((function(t){return t===e}))?N:(o[A][N].push(e),Object.keys(this.schema).forEach((function(e){if(Object.hasOwnProperty.call(a,e)){var t=s.schema[e];a[e]=r(a[e],a,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(a)+"\n Schema key(missing): "+e+"\n ");throw n.status=400,n}})),i(this,a,N),N)}if("production"!==process.env.NODE_ENV){var D=new Error("Missing usable primary 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 D.status=400,D}},i.infer=function(e,t,n){if(e[0]){var r=this.pk(e[0],void 0,"");if(void 0!==r&&""!==r)return r;var i=function(e,t){return t?t.find((function(t){return Object.prototype.hasOwnProperty.call(e,t)})):void 0}(e[0],this.indexes);return i&&t[this.key]?t[this.key][i][e[0][i]]:void 0}},i.denormalize=function(n,r){var i=this,o=e(n)?n:this.fromJS(n instanceof w?this.toObjectDefined(n):n);if(null==r.setLocal||r.setLocal(o),e(n)){var s=t(this.schema,n,r),a=s[0],u=s[1],c=s[2];return[this.fromJS(a.toObject()),u,c]}var f=!1;return Object.keys(this.schema).forEach((function(e){var t=i.schema[e],s=Object.hasOwnProperty.call(n,e)?n[e]:void 0,a=r(s,t),u=a[0];!a[2]||Object.hasOwnProperty.call(n,e)&&!i.defaults[e]||(f=!0),Object.hasOwnProperty.call(n,e)&&n[e]!==u&&(o[e]=u)})),[o,!0,f]},o(i,null,[{key:"key",get:function(){if("production"!==process.env.NODE_ENV&&(""===this.name||"Entity"===this.name||"_temp"===this.name))throw new Error("Entity classes without a name must define `static get key()`");return this.name}}]),i}(w);function E(e){return null!==e&&void 0!==e.pk}"production"!==process.env.NODE_ENV&&(j.fromJS=function(e){if(void 0===this.prototype.pk)throw new Error("cannot construct on abstract types");return w.fromJS.call(this,e)});var S=Symbol("ENTITY WAS DELETED");function _(e){return(_=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 x(e,t,r){return(x=z()?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 N(e){var t="function"==typeof Map?new Map:void 0;return(N=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 x(e,arguments,_(this).constructor)}return i.prototype=Object.create(e.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),n(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 r(t,e),t}(N(Error)),V=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}(),J=function(e,t,n,r){var i=P(e);function o(e,n){if(!n)return[e,!0,!1];if(!n.denormalize||"function"!=typeof n.denormalize){if("function"==typeof n)return e instanceof n?[e,!0,!1]:[new n(e),!0,!1];if("object"==typeof n)return(Array.isArray(n)?l:y)(n,e,a)}return null===e?[e,!0,!1]:E(n)?void 0===e?[e,!1,!1]:function(e,t,n,r,i,o){var s=r(e,t);if(s===S)return[void 0,!0,!0];if("object"!=typeof s||null===s)return[s,!1,!1];void 0===i[t.key]&&(i[t.key]={});var a=!0,u=!1;if(!i[t.key][e]){var c=[s],f=M(n,c);f.setLocal=function(n){return i[t.key][e]=n},o[t.key]||(o[t.key]={}),o[t.key][e]||(o[t.key][e]=new V);var l=o[t.key][e],h=t.denormalize(s,f);i[t.key][e]=h[0],a=h[1],u=h[2],l.has(c)?i[t.key][e]=l.get(c):l.set(c,i[t.key][e])}return[i[t.key][e],a,u]}(e,n,a,i,r,t):"function"==typeof n.denormalize?n.denormalize(e,a):[e,!0,!1]}var s=[],a=M(o,s);return function(e,t){s.push(e);var r=o(e,t);return Object(e)!==e?r:n.has(s)?[n.get(s),r[1],r[2]]:(n.set(s,r[0]),r)}},P=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 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 T=function e(t,n,r,i,o,s){return t&&i&&["function","object"].includes(typeof i)?i.normalize&&"function"==typeof i.normalize?i.normalize(t,n,r,e,o,s):"function"==typeof i?new i(t):(Array.isArray(i)?f:d)(i,t,n,r,e,o,s):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}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)},n.infer=function(e,t,n){var r=this.getSchemaAttribute(e[0],void 0,""),i=this.schema[r];if(void 0!==i)return{id:n(i,e,t),schema:r}},t}(s),L=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 s=this;return Object.keys(e).reduce((function(t,n,a){var u,c=e[n];return null!=c?Object.assign({},t,((u={})[n]=s.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,s){var a,u=e[s],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,((a={})[s]=f,a))}),{}),r,i]},n.infer=function(e,t,n){},t}(s),R=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 s=this._entity.fromJS(e,t,n).pk(t,n);if("production"!==process.env.NODE_ENV&&(void 0===s||""===s)){var a,u=new Error("Missing usable primary 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 Delete(Entity): Delete("+(null!=(a=this._entity.name)?a:this._entity)+")\n Value: "+(e&&JSON.stringify(e,null,2))+"\n ");throw u.status=400,u}return i(this,S,s),s},t.infer=function(e,t,n){},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},o(e,[{key:"key",get:function(){return this._entity.key}}]),e}(),U=Object.freeze({__proto__:null,Union:I,Values:L,Array:p,Object:v,Delete:R}),F=function(e){function t(){return e.apply(this,arguments)||this}return r(t,e),t.denormalize=function(e,t){return[e,!0,!1]},t}(j);exports.DELETED=S,exports.Entity=j,exports.FlatEntity=F,exports.SimpleRecord=w,exports.WeakListMap=V,exports.denormalize=function(e,t,n,r,i){if(void 0===r&&(r={}),void 0===i&&(i=new V),void 0===t)return[e,!0,!1,{}];if(void 0===e)return[void 0,!1,!1,{}];var o={},s=J(n,r,i,o);return[].concat(s(e,t),[o])},exports.inferResults=function e(t,n,r){return function(e){return!!e&&"function"==typeof e.infer}(t)?t.infer(n,r,e):"object"==typeof t&&t?(Array.isArray(t)?h:m)(t,n,r,e):t},exports.isEntity=E,exports.normalize=function(e,t,n,r,i,o){if(void 0===n&&(n={}),void 0===r&&(r={}),void 0===i&&(i={}),void 0===o&&(o={date:Date.now(),expiresAt:1/0}),void 0===t)return{entities:n,indexes:r,result:e,entityMeta:i};var s=function(e){return["object","function"].includes(typeof e)?"object":typeof e}(t);if(null===e||typeof e!==s){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 "'+s+'", 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 "'+s+'", found "'+(null===e?"null":typeof e)+'".')}var a=Object.assign({},n),u=Object.assign({},r),c=Object.assign({},i),f=function(e,t,n,r,i,o){var s=o.expiresAt,a=o.date;return function(o,u,c){var f,l=o.key;l in e||(e[l]={},n[l]=Object.assign({},n[l]),i[l]=Object.assign({},i[l]));var h=e[l][c];if(h)e[l][c]=o.merge(h,u);else{var p=n[l][c];if(p){var d,y=(null==(d=i[l][c])?void 0:d.date)>a;e[l][c]=typeof u!=typeof p?y?p:u:y?o.merge(u,p):o.merge(p,u)}else e[l][c]=u}if(Array.isArray(o.indexes)){var m=e[l][c];l in t||(t[l]={},r[l]=Object.assign({},r[l]));for(var v,g=b(o.indexes);!(v=g()).done;){var O=v.value;O in t[l]||(r[l][O]=t[l][O]={});var k=t[l][O];h&&delete k[h[O]],n[l]&&n[l][c]&&n[l][c][O]!==m[O]&&(k[n[l][c][O]]=S),O in m?k[m[O]]=c:"production"!==process.env.NODE_ENV&&console.warn("Index not found in entity. Indexes must be top-level members of your entity.\nIndex: "+O+"\nEntity: "+JSON.stringify(m,void 0,2))}}n[l][c]=e[l][c],i[l][c]=(null==(f=i[l][c])?void 0:f.expiresAt)>=s?i[l][c]:{expiresAt:s,date:a}}}({},{},a,u,c,o);return{entities:a,indexes:u,result:T(e,e,void 0,t,f,{}),entityMeta:c}},exports.schema=U;
"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 s=""+o,a=n(t.get(s),e[s]),u=a[0],c=a[1],f=a[2];return c||(r=!1),f&&(i=!0),t.has(s)?t.set(s,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 s=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 s=this.inferSchema(e,t,n);if(!s){if("production"!==process.env.NODE_ENV){var a=this.getSchemaAttribute(e,t,n);console.warn("Schema attribute "+JSON.stringify(a,void 0,2)+" is not expected.\nExpected one of: "+Object.keys(this.schema).map((function(e){return'"'+e+'"'})).join(", ")+"\n\nValue: "+JSON.stringify(e,void 0,2))}return e}var u=r(e,t,n,s,i,o);return this.isSingleSchema||null==u?u:{id:u,schema:this.getSchemaAttribute(e,t,n)}},n.denormalizeValue=function(t,n){if(void 0===t)return[t,!1,!1];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,!1]},o(t,[{key:"isSingleSchema",get:function(){return!this._schemaAttribute}}]),t}(),a=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[0],n=e[2];return void 0!==t&&!n},f=function(e,t,n,r,i,o,s){return e=a(e),u(t).map((function(t,a){return i(t,n,r,e,o,s)}))},l=function(e,t,n){e=a(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]};function h(e,t,n,r){}var p=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 s=this;return u(e).map((function(e,a){return s.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]},n.infer=function(e,t,n){this.schema},t}(s),d=function(e,t,n,r,i,o,s){var a=Object.assign({},t);return Object.keys(e).forEach((function(n){var r=e[n],u=i(t[n],t,n,r,o,s);null==u?delete a[n]:a[n]=u})),a},y=function(n,r,i){if(e(r))return t(n,r,i);var o=Object.assign({},r),s=!0,a=!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&&(a=!0),u||(s=!1)})),[o,s,a]};function m(e,t,n,r){for(var i={},o=0,s=Object.keys(e);o<s.length;o++){var a=s[o];i[a]=r(e[a],t,n)}return i}var v=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 y.apply(void 0,[this.schema].concat(t))},t.infer=function(e,t,n){return m(this.schema,e,t,n)},e}();function g(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 b(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return g(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)?g(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.")}var O=Symbol("Defined Members"),k=Symbol("unq"),w=function(){function e(){}return e.prototype.toString=function(){return this[k]},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,O,{value:Object.keys(t),writable:!1}),Object.defineProperty(i,k,{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[O].includes(t)},e.toObjectDefined=function(e){for(var t,n={},r=b(e[O]);!(t=r()).done;){var i=t.value;n[i]=e[i]}return n},e.keysDefined=function(e){return e[O]},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.infer=function(e,t,n){return m(this.schema,e,t,n)},e.denormalize=function(e,t){var n=this,r=Object.assign({},e),i=!1,o=!0;return Object.keys(this.schema).forEach((function(e){var s=t(r[e],n.schema[e]),a=s[0],u=s[1],c=s[2];void 0!==r[e]&&(r[e]=a),u||e in n.defaults&&!n.defaults[e]||(o=!1),!c||e in n.defaults&&!n.defaults[e]||(i=!0)})),[this.fromJS(r),o,i]},e.asSchema=function(){return"development"===process.env.NODE_ENV&&console.error("asSchema() is deprecated - use Entity directly instead."),this},o(e,null,[{key:"defaults",get:function(){return Object.prototype.hasOwnProperty.call(this,"__defaults")||(this.__defaults=new this),this.__defaults}}]),e}();w.schema={};var j=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 s=this;if("string"==typeof e)return e;var a=this.fromJS(e,t,n);if("production"!==process.env.NODE_ENV&&"silent"!==this.automaticValidation){for(var u,c=new Set(Object.keys(this.defaults)),f=this.keysDefined(a),l=[[],[],[]],h=l[0],p=l[1],d=l[2],y=b(f);!(u=y()).done;){var m=u.value;c.has(m)?h.push(m):d.push(m)}for(var v,g=b(c);!(v=g()).done;){var O=v.value;h.includes(O)||p.push(O)}if(c.size){if(Array.isArray(e)&&d.length){var k="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: "+p+"\nFirst three members: "+JSON.stringify(e.slice(0,3),null,2);if("warn"!==this.automaticValidation){var w=new Error(k);throw w.status=400,w}console.warn(k)}var j=Math.max(f.length/2,1)<=d.length&&c.size>Math.max(d.length,2)&&Math.pow(h.length,1.5)/2<=d.length,E=h.length<Math.min(1,c.size/2);if(j||E){var S="",_="substantially different than expected keys";E&&(S+="\n Missing: "+p,_="no matching keys found"),j&&(S+="\n Unexpected keys: "+d,_="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: "+h+S+"\n Value: "+JSON.stringify(this.toObjectDefined(a),null,2);if(!(h.length>=4&&j||"warn"===this.automaticValidation)){var z=new Error(x);throw z.status=400,z}console.warn(x)}}}var A=a.pk(t,n);if(void 0!==A&&""!==A){var N=this.key;return N in o||(o[N]={}),A in o[N]||(o[N][A]=[]),o[N][A].some((function(t){return t===e}))?A:(o[N][A].push(e),Object.keys(this.schema).forEach((function(e){if(Object.hasOwnProperty.call(a,e)){var t=s.schema[e];a[e]=r(a[e],a,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(a)+"\n Schema key(missing): "+e+"\n ");throw n.status=400,n}})),i(this,a,A),A)}if("production"!==process.env.NODE_ENV){var D=new Error("Missing usable primary 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 D.status=400,D}},i.expiresAt=function(e,t){return e.expiresAt},i.infer=function(e,t,n){if(e[0]){var r=this.pk(e[0],void 0,"");if(void 0!==r&&""!==r)return r;var i=function(e,t){return t?t.find((function(t){return Object.prototype.hasOwnProperty.call(e,t)})):void 0}(e[0],this.indexes);return i&&t[this.key]?t[this.key][i][e[0][i]]:void 0}},i.denormalize=function(n,r){var i=this,o=e(n)?n:this.fromJS(n instanceof w?this.toObjectDefined(n):n);if(null==r.setLocal||r.setLocal(o),e(n)){var s=t(this.schema,n,r),a=s[0],u=s[1],c=s[2];return[this.fromJS(a.toObject()),u,c]}var f=!1;return Object.keys(this.schema).forEach((function(e){var t=i.schema[e],s=Object.hasOwnProperty.call(n,e)?n[e]:void 0,a=r(s,t),u=a[0];!a[2]||Object.hasOwnProperty.call(n,e)&&!i.defaults[e]||(f=!0),Object.hasOwnProperty.call(n,e)&&n[e]!==u&&(o[e]=u)})),[o,!0,f]},o(i,null,[{key:"key",get:function(){if("production"!==process.env.NODE_ENV&&(""===this.name||"Entity"===this.name||"_temp"===this.name))throw new Error("Entity classes without a name must define `static get key()`");return this.name}}]),i}(w);function E(e){return null!==e&&void 0!==e.pk}"production"!==process.env.NODE_ENV&&(j.fromJS=function(e){if(void 0===this.prototype.pk)throw new Error("cannot construct on abstract types");return w.fromJS.call(this,e)});var S=Symbol("ENTITY WAS DELETED");function _(e){return(_=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function x(){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=x()?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 A(e){var t="function"==typeof Map?new Map:void 0;return(A=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,_(this).constructor)}return i.prototype=Object.create(e.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),n(i,e)})(e)}var N=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 r(t,e),t}(A(Error)),V=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 N,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}(),J=function(e,t,n,r){var i=P(e);function o(e,n){if(!n)return[e,!0,!1];if(!n.denormalize||"function"!=typeof n.denormalize){if("function"==typeof n)return e instanceof n?[e,!0,!1]:[new n(e),!0,!1];if("object"==typeof n)return(Array.isArray(n)?l:y)(n,e,a)}return null===e?[e,!0,!1]:E(n)?void 0===e?[e,!1,!1]:function(e,t,n,r,i,o){var s=r(e,t);if(s===S)return[void 0,!0,!0];if("object"!=typeof s||null===s)return[s,!1,!1];void 0===i[t.key]&&(i[t.key]={});var a=!0,u=!1;if(!i[t.key][e]){var c=[s],f=M(n,c);f.setLocal=function(n){return i[t.key][e]=n},o[t.key]||(o[t.key]={}),o[t.key][e]||(o[t.key][e]=new V);var l=o[t.key][e],h=t.denormalize(s,f);i[t.key][e]=h[0],a=h[1],u=h[2],l.has(c)?i[t.key][e]=l.get(c):l.set(c,i[t.key][e])}return[i[t.key][e],a,u]}(e,n,a,i,r,t):"function"==typeof n.denormalize?n.denormalize(e,a):[e,!0,!1]}var s=[],a=M(o,s);return function(e,t){s.push(e);var r=o(e,t);return Object(e)!==e?r:n.has(s)?[n.get(s),r[1],r[2]]:(n.set(s,r[0]),r)}},P=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 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 T=function e(t,n,r,i,o,s){return t&&i&&["function","object"].includes(typeof i)?i.normalize&&"function"==typeof i.normalize?i.normalize(t,n,r,e,o,s):"function"==typeof i?new i(t):(Array.isArray(i)?f:d)(i,t,n,r,e,o,s):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}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)},n.infer=function(e,t,n){var r=this.getSchemaAttribute(e[0],void 0,""),i=this.schema[r];if(void 0!==i)return{id:n(i,e,t),schema:r}},t}(s),L=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 s=this;return Object.keys(e).reduce((function(t,n,a){var u,c=e[n];return null!=c?Object.assign({},t,((u={})[n]=s.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,s){var a,u=e[s],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,((a={})[s]=f,a))}),{}),r,i]},n.infer=function(e,t,n){},t}(s),R=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 s=this._entity.fromJS(e,t,n).pk(t,n);if("production"!==process.env.NODE_ENV&&(void 0===s||""===s)){var a,u=new Error("Missing usable primary 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 Delete(Entity): Delete("+(null!=(a=this._entity.name)?a:this._entity)+")\n Value: "+(e&&JSON.stringify(e,null,2))+"\n ");throw u.status=400,u}return i(this,S,s),s},t.infer=function(e,t,n){},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},o(e,[{key:"key",get:function(){return this._entity.key}}]),e}(),U=Object.freeze({__proto__:null,Union:I,Values:L,Array:p,Object:v,Delete:R}),F=function(e){function t(){return e.apply(this,arguments)||this}return r(t,e),t.denormalize=function(e,t){return[e,!0,!1]},t}(j);exports.DELETED=S,exports.Entity=j,exports.FlatEntity=F,exports.SimpleRecord=w,exports.WeakListMap=V,exports.denormalize=function(e,t,n,r,i){if(void 0===r&&(r={}),void 0===i&&(i=new V),void 0===t)return[e,!0,!1,{}];if(void 0===e)return[void 0,!1,!1,{}];var o={},s=J(n,r,i,o);return[].concat(s(e,t),[o])},exports.inferResults=function e(t,n,r){return function(e){return!!e&&"function"==typeof e.infer}(t)?t.infer(n,r,e):"object"==typeof t&&t?(Array.isArray(t)?h:m)(t,n,r,e):t},exports.isEntity=E,exports.normalize=function(e,t,n,r,i,o){if(void 0===n&&(n={}),void 0===r&&(r={}),void 0===i&&(i={}),void 0===o&&(o={date:Date.now(),expiresAt:1/0}),void 0===t)return{entities:n,indexes:r,result:e,entityMeta:i};var s=function(e){return["object","function"].includes(typeof e)?"object":typeof e}(t);if(null===e||typeof e!==s){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 "'+s+'", 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 "'+s+'", found "'+(null===e?"null":typeof e)+'".')}var a=Object.assign({},n),u=Object.assign({},r),c=Object.assign({},i),f=function(e,t,n,r,i,o){return function(s,a,u){var c,f=s.key;f in e||(e[f]={},n[f]=Object.assign({},n[f]),i[f]=Object.assign({},i[f]));var l=e[f][u];if(l)e[f][u]=s.merge(l,a);else{var h=n[f][u];if(h){var p,d=(null==(p=i[f][u])?void 0:p.date)>o.date;e[f][u]=typeof a!=typeof h?d?h:a:d?s.merge(a,h):s.merge(h,a)}else e[f][u]=a}if(Array.isArray(s.indexes)){var y=e[f][u];f in t||(t[f]={},r[f]=Object.assign({},r[f]));for(var m,v=b(s.indexes);!(m=v()).done;){var g=m.value;g in t[f]||(r[f][g]=t[f][g]={});var O=t[f][g];l&&delete O[l[g]],n[f]&&n[f][u]&&n[f][u][g]!==y[g]&&(O[n[f][u][g]]=S),g in y?O[y[g]]=u:"production"!==process.env.NODE_ENV&&console.warn("Index not found in entity. Indexes must be top-level members of your entity.\nIndex: "+g+"\nEntity: "+JSON.stringify(y,void 0,2))}}n[f][u]=e[f][u];var k=s.expiresAt?s.expiresAt(o,a):o.expiresAt;i[f][u]=(null==(c=i[f][u])?void 0:c.expiresAt)>=k?i[f][u]:{expiresAt:k,date:o.date}}}({},{},a,u,c,o);return{entities:a,indexes:u,result:T(e,e,void 0,t,f,{}),entityMeta:c}},exports.schema=U;

@@ -727,2 +727,7 @@ (function (global, factory) {

Entity.expiresAt = function expiresAt(_ref2, input) {
var _expiresAt = _ref2.expiresAt;
return _expiresAt;
};
Entity.infer = function infer(args, indexes, _infer) {

@@ -1175,5 +1180,3 @@ if (!args[0]) return undefined;

var addEntities = function addEntities(entities, indexes, existingEntities, existingIndexes, entityMeta, _ref) {
var expiresAt = _ref.expiresAt,
date = _ref.date;
var addEntities = function addEntities(entities, indexes, existingEntities, existingIndexes, entityMeta, meta) {
return function (schema, processedEntity, id) {

@@ -1204,3 +1207,3 @@ var _entityMeta$schemaKey2;

// means we fallback to 'newer' (processedEntity) takes priority
var preferExisting = ((_entityMeta$schemaKey = entityMeta[schemaKey][id]) == null ? void 0 : _entityMeta$schemaKey.date) > date;
var preferExisting = ((_entityMeta$schemaKey = entityMeta[schemaKey][id]) == null ? void 0 : _entityMeta$schemaKey.date) > meta.date;

@@ -1257,6 +1260,8 @@ if (typeof processedEntity !== typeof inStoreEntity) {

existingEntities[schemaKey][id] = entities[schemaKey][id];
entityMeta[schemaKey][id] = ((_entityMeta$schemaKey2 = entityMeta[schemaKey][id]) == null ? void 0 : _entityMeta$schemaKey2.expiresAt) >= expiresAt ? entityMeta[schemaKey][id] : {
expiresAt: expiresAt,
date: date
existingEntities[schemaKey][id] = entities[schemaKey][id]; // TODO: eventually assume this exists and don't check for conditional. probably early 2022
var entityExpiresAt = schema.expiresAt ? schema.expiresAt(meta, processedEntity) : meta.expiresAt;
entityMeta[schemaKey][id] = ((_entityMeta$schemaKey2 = entityMeta[schemaKey][id]) == null ? void 0 : _entityMeta$schemaKey2.expiresAt) >= entityExpiresAt ? entityMeta[schemaKey][id] : {
expiresAt: entityExpiresAt,
date: meta.date
};

@@ -1263,0 +1268,0 @@ };

@@ -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 s=""+o,a=n(t.get(s),e[s]),u=a[0],c=a[1],f=a[2];return c||(r=!1),f&&(i=!0),t.has(s)?t.set(s,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 s(e,t,n){return t&&o(e.prototype,t),n&&o(e,n),e}var a=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 s=this.inferSchema(e,t,n);if(!s){if("production"!==process.env.NODE_ENV){var a=this.getSchemaAttribute(e,t,n);console.warn("Schema attribute "+JSON.stringify(a,void 0,2)+" is not expected.\nExpected one of: "+Object.keys(this.schema).map((function(e){return'"'+e+'"'})).join(", ")+"\n\nValue: "+JSON.stringify(e,void 0,2))}return e}var u=r(e,t,n,s,i,o);return this.isSingleSchema||null==u?u:{id:u,schema:this.getSchemaAttribute(e,t,n)}},n.denormalizeValue=function(e,n){if(void 0===e)return[e,!1,!1];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,!1]},s(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[0],n=e[2];return void 0!==t&&!n},l=function(e,t,n,r,i,o,s){return e=u(e),c(t).map((function(t,a){return i(t,n,r,e,o,s)}))},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]};function p(e,t,n,r){}var d=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 s=this;return c(e).map((function(e,a){return s.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]},n.infer=function(e,t,n){this.schema},t}(a),y=function(e,t,n,r,i,o,s){var a=Object.assign({},t);return Object.keys(e).forEach((function(n){var r=e[n],u=i(t[n],t,n,r,o,s);null==u?delete a[n]:a[n]=u})),a},m=function(e,r,i){if(t(r))return n(e,r,i);var o=Object.assign({},r),s=!0,a=!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&&(a=!0),u||(s=!1)})),[o,s,a]};function v(e,t,n,r){for(var i={},o=0,s=Object.keys(e);o<s.length;o++){var a=s[o];i[a]=r(e[a],t,n)}return i}var g=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 y.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))},t.infer=function(e,t,n){return v(this.schema,e,t,n)},e}();function b(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 O(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return b(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)?b(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.")}var k=Symbol("Defined Members"),w=Symbol("unq"),j=function(){function e(){}return e.prototype.toString=function(){return this[w]},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,k,{value:Object.keys(t),writable:!1}),Object.defineProperty(i,w,{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[k].includes(t)},e.toObjectDefined=function(e){for(var t,n={},r=O(e[k]);!(t=r()).done;){var i=t.value;n[i]=e[i]}return n},e.keysDefined=function(e){return e[k]},e.normalize=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return y.apply(void 0,[this.schema].concat(t))},e.infer=function(e,t,n){return v(this.schema,e,t,n)},e.denormalize=function(e,t){var n=this,r=Object.assign({},e),i=!1,o=!0;return Object.keys(this.schema).forEach((function(e){var s=t(r[e],n.schema[e]),a=s[0],u=s[1],c=s[2];void 0!==r[e]&&(r[e]=a),u||e in n.defaults&&!n.defaults[e]||(o=!1),!c||e in n.defaults&&!n.defaults[e]||(i=!0)})),[this.fromJS(r),o,i]},e.asSchema=function(){return"development"===process.env.NODE_ENV&&console.error("asSchema() is deprecated - use Entity directly instead."),this},s(e,null,[{key:"defaults",get:function(){return Object.prototype.hasOwnProperty.call(this,"__defaults")||(this.__defaults=new this),this.__defaults}}]),e}();j.schema={};var E=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 s=this;if("string"==typeof e)return e;var a=this.fromJS(e,t,n);if("production"!==process.env.NODE_ENV&&"silent"!==this.automaticValidation){for(var u,c=new Set(Object.keys(this.defaults)),f=this.keysDefined(a),l=[[],[],[]],h=l[0],p=l[1],d=l[2],y=O(f);!(u=y()).done;){var m=u.value;c.has(m)?h.push(m):d.push(m)}for(var v,g=O(c);!(v=g()).done;){var b=v.value;h.includes(b)||p.push(b)}if(c.size){if(Array.isArray(e)&&d.length){var k="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: "+p+"\nFirst three members: "+JSON.stringify(e.slice(0,3),null,2);if("warn"!==this.automaticValidation){var w=new Error(k);throw w.status=400,w}console.warn(k)}var j=Math.max(f.length/2,1)<=d.length&&c.size>Math.max(d.length,2)&&Math.pow(h.length,1.5)/2<=d.length,E=h.length<Math.min(1,c.size/2);if(j||E){var S="",_="substantially different than expected keys";E&&(S+="\n Missing: "+p,_="no matching keys found"),j&&(S+="\n Unexpected keys: "+d,_="a large number of unexpected keys found");var z="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: "+h+S+"\n Value: "+JSON.stringify(this.toObjectDefined(a),null,2);if(!(h.length>=4&&j||"warn"===this.automaticValidation)){var N=new Error(z);throw N.status=400,N}console.warn(z)}}}var A=a.pk(t,n);if(void 0!==A&&""!==A){var x=this.key;return x in o||(o[x]={}),A in o[x]||(o[x][A]=[]),o[x][A].some((function(t){return t===e}))?A:(o[x][A].push(e),Object.keys(this.schema).forEach((function(e){if(Object.hasOwnProperty.call(a,e)){var t=s.schema[e];a[e]=r(a[e],a,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(a)+"\n Schema key(missing): "+e+"\n ");throw n.status=400,n}})),i(this,a,A),A)}if("production"!==process.env.NODE_ENV){var D=new Error("Missing usable primary 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 D.status=400,D}},r.infer=function(e,t,n){if(e[0]){var r=this.pk(e[0],void 0,"");if(void 0!==r&&""!==r)return r;var i=function(e,t){return t?t.find((function(t){return Object.prototype.hasOwnProperty.call(e,t)})):void 0}(e[0],this.indexes);return i&&t[this.key]?t[this.key][i][e[0][i]]:void 0}},r.denormalize=function(e,r){var i=this,o=t(e)?e:this.fromJS(e instanceof j?this.toObjectDefined(e):e);if(null==r.setLocal||r.setLocal(o),t(e)){var s=n(this.schema,e,r),a=s[0],u=s[1],c=s[2];return[this.fromJS(a.toObject()),u,c]}var f=!1;return Object.keys(this.schema).forEach((function(t){var n=i.schema[t],s=Object.hasOwnProperty.call(e,t)?e[t]:void 0,a=r(s,n),u=a[0];!a[2]||Object.hasOwnProperty.call(e,t)&&!i.defaults[t]||(f=!0),Object.hasOwnProperty.call(e,t)&&e[t]!==u&&(o[t]=u)})),[o,!0,f]},s(r,null,[{key:"key",get:function(){if("production"!==process.env.NODE_ENV&&(""===this.name||"Entity"===this.name||"_temp"===this.name))throw new Error("Entity classes without a name must define `static get key()`");return this.name}}]),r}(j);function S(e){return null!==e&&void 0!==e.pk}"production"!==process.env.NODE_ENV&&(E.fromJS=function(e){if(void 0===this.prototype.pk)throw new Error("cannot construct on abstract types");return j.fromJS.call(this,e)});var _=Symbol("ENTITY WAS DELETED");function z(e){return(z=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function N(){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 A(e,t,n){return(A=N()?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 x(e){var t="function"==typeof Map?new Map:void 0;return(x=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 A(e,arguments,z(this).constructor)}return i.prototype=Object.create(e.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),r(i,e)})(e)}var D=function(){this.children=new WeakMap},V=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}(x(Error)),J=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 V;for(var n,r=this.first,i=0;i<e.length;i++)r.has(e[i])?n=r.get(e[i]):(n=new D,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}(),P=function(e,t,n,r){var i=M(e);function o(e,n){if(!n)return[e,!0,!1];if(!n.denormalize||"function"!=typeof n.denormalize){if("function"==typeof n)return e instanceof n?[e,!0,!1]:[new n(e),!0,!1];if("object"==typeof n)return(Array.isArray(n)?h:m)(n,e,a)}return null===e?[e,!0,!1]:S(n)?void 0===e?[e,!1,!1]:function(e,t,n,r,i,o){var s=r(e,t);if(s===_)return[void 0,!0,!0];if("object"!=typeof s||null===s)return[s,!1,!1];void 0===i[t.key]&&(i[t.key]={});var a=!0,u=!1;if(!i[t.key][e]){var c=[s],f=T(n,c);f.setLocal=function(n){return i[t.key][e]=n},o[t.key]||(o[t.key]={}),o[t.key][e]||(o[t.key][e]=new J);var l=o[t.key][e],h=t.denormalize(s,f);i[t.key][e]=h[0],a=h[1],u=h[2],l.has(c)?i[t.key][e]=l.get(c):l.set(c,i[t.key][e])}return[i[t.key][e],a,u]}(e,n,a,i,r,t):"function"==typeof n.denormalize?n.denormalize(e,a):[e,!0,!1]}var s=[],a=T(o,s);return function(e,t){s.push(e);var r=o(e,t);return Object(e)!==e?r:n.has(s)?[n.get(s),r[1],r[2]]:(n.set(s,r[0]),r)}},M=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 T(e,t){var n=e.og||e,r=function(e,r){var i=n(e,r);if(i[0]&&r&&S(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 I=function e(t,n,r,i,o,s){return t&&i&&["function","object"].includes(typeof i)?i.normalize&&"function"==typeof i.normalize?i.normalize(t,n,r,e,o,s):"function"==typeof i?new i(t):(Array.isArray(i)?l:y)(i,t,n,r,e,o,s):t};var L=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)},n.infer=function(e,t,n){var r=this.getSchemaAttribute(e[0],void 0,""),i=this.schema[r];if(void 0!==i)return{id:n(i,e,t),schema:r}},t}(a),R=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 s=this;return Object.keys(e).reduce((function(t,n,a){var u,c=e[n];return null!=c?Object.assign({},t,((u={})[n]=s.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,s){var a,u=e[s],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,((a={})[s]=f,a))}),{}),r,i]},n.infer=function(e,t,n){},t}(a),U=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 s=this._entity.fromJS(e,t,n).pk(t,n);if("production"!==process.env.NODE_ENV&&(void 0===s||""===s)){var a,u=new Error("Missing usable primary 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 Delete(Entity): Delete("+(null!=(a=this._entity.name)?a:this._entity)+")\n Value: "+(e&&JSON.stringify(e,null,2))+"\n ");throw u.status=400,u}return i(this,_,s),s},t.infer=function(e,t,n){},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},s(e,[{key:"key",get:function(){return this._entity.key}}]),e}(),F=Object.freeze({__proto__:null,Union:L,Values:R,Array:d,Object:g,Delete:U}),B=function(e){function t(){return e.apply(this,arguments)||this}return i(t,e),t.denormalize=function(e,t){return[e,!0,!1]},t}(E);e.DELETED=_,e.Entity=E,e.FlatEntity=B,e.SimpleRecord=j,e.WeakListMap=J,e.denormalize=function(e,t,n,r,i){if(void 0===r&&(r={}),void 0===i&&(i=new J),void 0===t)return[e,!0,!1,{}];if(void 0===e)return[void 0,!1,!1,{}];var o={},s=P(n,r,i,o);return[].concat(s(e,t),[o])},e.inferResults=function e(t,n,r){return function(e){return!!e&&"function"==typeof e.infer}(t)?t.infer(n,r,e):"object"==typeof t&&t?(Array.isArray(t)?p:v)(t,n,r,e):t},e.isEntity=S,e.normalize=function(e,t,n,r,i,o){if(void 0===n&&(n={}),void 0===r&&(r={}),void 0===i&&(i={}),void 0===o&&(o={date:Date.now(),expiresAt:1/0}),void 0===t)return{entities:n,indexes:r,result:e,entityMeta:i};var s=function(e){return["object","function"].includes(typeof e)?"object":typeof e}(t);if(null===e||typeof e!==s){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 "'+s+'", 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 "'+s+'", found "'+(null===e?"null":typeof e)+'".')}var a=Object.assign({},n),u=Object.assign({},r),c=Object.assign({},i),f=function(e,t,n,r,i,o){var s=o.expiresAt,a=o.date;return function(o,u,c){var f,l=o.key;l in e||(e[l]={},n[l]=Object.assign({},n[l]),i[l]=Object.assign({},i[l]));var h=e[l][c];if(h)e[l][c]=o.merge(h,u);else{var p=n[l][c];if(p){var d,y=(null==(d=i[l][c])?void 0:d.date)>a;e[l][c]=typeof u!=typeof p?y?p:u:y?o.merge(u,p):o.merge(p,u)}else e[l][c]=u}if(Array.isArray(o.indexes)){var m=e[l][c];l in t||(t[l]={},r[l]=Object.assign({},r[l]));for(var v,g=O(o.indexes);!(v=g()).done;){var b=v.value;b in t[l]||(r[l][b]=t[l][b]={});var k=t[l][b];h&&delete k[h[b]],n[l]&&n[l][c]&&n[l][c][b]!==m[b]&&(k[n[l][c][b]]=_),b in m?k[m[b]]=c:"production"!==process.env.NODE_ENV&&console.warn("Index not found in entity. Indexes must be top-level members of your entity.\nIndex: "+b+"\nEntity: "+JSON.stringify(m,void 0,2))}}n[l][c]=e[l][c],i[l][c]=(null==(f=i[l][c])?void 0:f.expiresAt)>=s?i[l][c]:{expiresAt:s,date:a}}}({},{},a,u,c,o);return{entities:a,indexes:u,result:I(e,e,void 0,t,f,{}),entityMeta:c}},e.schema=F,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 s=""+o,a=n(t.get(s),e[s]),u=a[0],c=a[1],f=a[2];return c||(r=!1),f&&(i=!0),t.has(s)?t.set(s,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 s(e,t,n){return t&&o(e.prototype,t),n&&o(e,n),e}var a=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 s=this.inferSchema(e,t,n);if(!s){if("production"!==process.env.NODE_ENV){var a=this.getSchemaAttribute(e,t,n);console.warn("Schema attribute "+JSON.stringify(a,void 0,2)+" is not expected.\nExpected one of: "+Object.keys(this.schema).map((function(e){return'"'+e+'"'})).join(", ")+"\n\nValue: "+JSON.stringify(e,void 0,2))}return e}var u=r(e,t,n,s,i,o);return this.isSingleSchema||null==u?u:{id:u,schema:this.getSchemaAttribute(e,t,n)}},n.denormalizeValue=function(e,n){if(void 0===e)return[e,!1,!1];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,!1]},s(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[0],n=e[2];return void 0!==t&&!n},l=function(e,t,n,r,i,o,s){return e=u(e),c(t).map((function(t,a){return i(t,n,r,e,o,s)}))},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]};function p(e,t,n,r){}var d=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 s=this;return c(e).map((function(e,a){return s.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]},n.infer=function(e,t,n){this.schema},t}(a),y=function(e,t,n,r,i,o,s){var a=Object.assign({},t);return Object.keys(e).forEach((function(n){var r=e[n],u=i(t[n],t,n,r,o,s);null==u?delete a[n]:a[n]=u})),a},m=function(e,r,i){if(t(r))return n(e,r,i);var o=Object.assign({},r),s=!0,a=!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&&(a=!0),u||(s=!1)})),[o,s,a]};function v(e,t,n,r){for(var i={},o=0,s=Object.keys(e);o<s.length;o++){var a=s[o];i[a]=r(e[a],t,n)}return i}var g=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 y.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))},t.infer=function(e,t,n){return v(this.schema,e,t,n)},e}();function b(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 O(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return b(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)?b(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.")}var k=Symbol("Defined Members"),w=Symbol("unq"),j=function(){function e(){}return e.prototype.toString=function(){return this[w]},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,k,{value:Object.keys(t),writable:!1}),Object.defineProperty(i,w,{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[k].includes(t)},e.toObjectDefined=function(e){for(var t,n={},r=O(e[k]);!(t=r()).done;){var i=t.value;n[i]=e[i]}return n},e.keysDefined=function(e){return e[k]},e.normalize=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return y.apply(void 0,[this.schema].concat(t))},e.infer=function(e,t,n){return v(this.schema,e,t,n)},e.denormalize=function(e,t){var n=this,r=Object.assign({},e),i=!1,o=!0;return Object.keys(this.schema).forEach((function(e){var s=t(r[e],n.schema[e]),a=s[0],u=s[1],c=s[2];void 0!==r[e]&&(r[e]=a),u||e in n.defaults&&!n.defaults[e]||(o=!1),!c||e in n.defaults&&!n.defaults[e]||(i=!0)})),[this.fromJS(r),o,i]},e.asSchema=function(){return"development"===process.env.NODE_ENV&&console.error("asSchema() is deprecated - use Entity directly instead."),this},s(e,null,[{key:"defaults",get:function(){return Object.prototype.hasOwnProperty.call(this,"__defaults")||(this.__defaults=new this),this.__defaults}}]),e}();j.schema={};var E=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 s=this;if("string"==typeof e)return e;var a=this.fromJS(e,t,n);if("production"!==process.env.NODE_ENV&&"silent"!==this.automaticValidation){for(var u,c=new Set(Object.keys(this.defaults)),f=this.keysDefined(a),l=[[],[],[]],h=l[0],p=l[1],d=l[2],y=O(f);!(u=y()).done;){var m=u.value;c.has(m)?h.push(m):d.push(m)}for(var v,g=O(c);!(v=g()).done;){var b=v.value;h.includes(b)||p.push(b)}if(c.size){if(Array.isArray(e)&&d.length){var k="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: "+p+"\nFirst three members: "+JSON.stringify(e.slice(0,3),null,2);if("warn"!==this.automaticValidation){var w=new Error(k);throw w.status=400,w}console.warn(k)}var j=Math.max(f.length/2,1)<=d.length&&c.size>Math.max(d.length,2)&&Math.pow(h.length,1.5)/2<=d.length,E=h.length<Math.min(1,c.size/2);if(j||E){var S="",_="substantially different than expected keys";E&&(S+="\n Missing: "+p,_="no matching keys found"),j&&(S+="\n Unexpected keys: "+d,_="a large number of unexpected keys found");var z="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: "+h+S+"\n Value: "+JSON.stringify(this.toObjectDefined(a),null,2);if(!(h.length>=4&&j||"warn"===this.automaticValidation)){var A=new Error(z);throw A.status=400,A}console.warn(z)}}}var N=a.pk(t,n);if(void 0!==N&&""!==N){var x=this.key;return x in o||(o[x]={}),N in o[x]||(o[x][N]=[]),o[x][N].some((function(t){return t===e}))?N:(o[x][N].push(e),Object.keys(this.schema).forEach((function(e){if(Object.hasOwnProperty.call(a,e)){var t=s.schema[e];a[e]=r(a[e],a,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(a)+"\n Schema key(missing): "+e+"\n ");throw n.status=400,n}})),i(this,a,N),N)}if("production"!==process.env.NODE_ENV){var D=new Error("Missing usable primary 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 D.status=400,D}},r.expiresAt=function(e,t){return e.expiresAt},r.infer=function(e,t,n){if(e[0]){var r=this.pk(e[0],void 0,"");if(void 0!==r&&""!==r)return r;var i=function(e,t){return t?t.find((function(t){return Object.prototype.hasOwnProperty.call(e,t)})):void 0}(e[0],this.indexes);return i&&t[this.key]?t[this.key][i][e[0][i]]:void 0}},r.denormalize=function(e,r){var i=this,o=t(e)?e:this.fromJS(e instanceof j?this.toObjectDefined(e):e);if(null==r.setLocal||r.setLocal(o),t(e)){var s=n(this.schema,e,r),a=s[0],u=s[1],c=s[2];return[this.fromJS(a.toObject()),u,c]}var f=!1;return Object.keys(this.schema).forEach((function(t){var n=i.schema[t],s=Object.hasOwnProperty.call(e,t)?e[t]:void 0,a=r(s,n),u=a[0];!a[2]||Object.hasOwnProperty.call(e,t)&&!i.defaults[t]||(f=!0),Object.hasOwnProperty.call(e,t)&&e[t]!==u&&(o[t]=u)})),[o,!0,f]},s(r,null,[{key:"key",get:function(){if("production"!==process.env.NODE_ENV&&(""===this.name||"Entity"===this.name||"_temp"===this.name))throw new Error("Entity classes without a name must define `static get key()`");return this.name}}]),r}(j);function S(e){return null!==e&&void 0!==e.pk}"production"!==process.env.NODE_ENV&&(E.fromJS=function(e){if(void 0===this.prototype.pk)throw new Error("cannot construct on abstract types");return j.fromJS.call(this,e)});var _=Symbol("ENTITY WAS DELETED");function z(e){return(z=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function A(){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 N(e,t,n){return(N=A()?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 x(e){var t="function"==typeof Map?new Map:void 0;return(x=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 N(e,arguments,z(this).constructor)}return i.prototype=Object.create(e.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),r(i,e)})(e)}var D=function(){this.children=new WeakMap},V=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}(x(Error)),J=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 V;for(var n,r=this.first,i=0;i<e.length;i++)r.has(e[i])?n=r.get(e[i]):(n=new D,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}(),P=function(e,t,n,r){var i=M(e);function o(e,n){if(!n)return[e,!0,!1];if(!n.denormalize||"function"!=typeof n.denormalize){if("function"==typeof n)return e instanceof n?[e,!0,!1]:[new n(e),!0,!1];if("object"==typeof n)return(Array.isArray(n)?h:m)(n,e,a)}return null===e?[e,!0,!1]:S(n)?void 0===e?[e,!1,!1]:function(e,t,n,r,i,o){var s=r(e,t);if(s===_)return[void 0,!0,!0];if("object"!=typeof s||null===s)return[s,!1,!1];void 0===i[t.key]&&(i[t.key]={});var a=!0,u=!1;if(!i[t.key][e]){var c=[s],f=T(n,c);f.setLocal=function(n){return i[t.key][e]=n},o[t.key]||(o[t.key]={}),o[t.key][e]||(o[t.key][e]=new J);var l=o[t.key][e],h=t.denormalize(s,f);i[t.key][e]=h[0],a=h[1],u=h[2],l.has(c)?i[t.key][e]=l.get(c):l.set(c,i[t.key][e])}return[i[t.key][e],a,u]}(e,n,a,i,r,t):"function"==typeof n.denormalize?n.denormalize(e,a):[e,!0,!1]}var s=[],a=T(o,s);return function(e,t){s.push(e);var r=o(e,t);return Object(e)!==e?r:n.has(s)?[n.get(s),r[1],r[2]]:(n.set(s,r[0]),r)}},M=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 T(e,t){var n=e.og||e,r=function(e,r){var i=n(e,r);if(i[0]&&r&&S(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 I=function e(t,n,r,i,o,s){return t&&i&&["function","object"].includes(typeof i)?i.normalize&&"function"==typeof i.normalize?i.normalize(t,n,r,e,o,s):"function"==typeof i?new i(t):(Array.isArray(i)?l:y)(i,t,n,r,e,o,s):t};var L=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)},n.infer=function(e,t,n){var r=this.getSchemaAttribute(e[0],void 0,""),i=this.schema[r];if(void 0!==i)return{id:n(i,e,t),schema:r}},t}(a),R=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 s=this;return Object.keys(e).reduce((function(t,n,a){var u,c=e[n];return null!=c?Object.assign({},t,((u={})[n]=s.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,s){var a,u=e[s],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,((a={})[s]=f,a))}),{}),r,i]},n.infer=function(e,t,n){},t}(a),U=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 s=this._entity.fromJS(e,t,n).pk(t,n);if("production"!==process.env.NODE_ENV&&(void 0===s||""===s)){var a,u=new Error("Missing usable primary 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 Delete(Entity): Delete("+(null!=(a=this._entity.name)?a:this._entity)+")\n Value: "+(e&&JSON.stringify(e,null,2))+"\n ");throw u.status=400,u}return i(this,_,s),s},t.infer=function(e,t,n){},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},s(e,[{key:"key",get:function(){return this._entity.key}}]),e}(),F=Object.freeze({__proto__:null,Union:L,Values:R,Array:d,Object:g,Delete:U}),B=function(e){function t(){return e.apply(this,arguments)||this}return i(t,e),t.denormalize=function(e,t){return[e,!0,!1]},t}(E);e.DELETED=_,e.Entity=E,e.FlatEntity=B,e.SimpleRecord=j,e.WeakListMap=J,e.denormalize=function(e,t,n,r,i){if(void 0===r&&(r={}),void 0===i&&(i=new J),void 0===t)return[e,!0,!1,{}];if(void 0===e)return[void 0,!1,!1,{}];var o={},s=P(n,r,i,o);return[].concat(s(e,t),[o])},e.inferResults=function e(t,n,r){return function(e){return!!e&&"function"==typeof e.infer}(t)?t.infer(n,r,e):"object"==typeof t&&t?(Array.isArray(t)?p:v)(t,n,r,e):t},e.isEntity=S,e.normalize=function(e,t,n,r,i,o){if(void 0===n&&(n={}),void 0===r&&(r={}),void 0===i&&(i={}),void 0===o&&(o={date:Date.now(),expiresAt:1/0}),void 0===t)return{entities:n,indexes:r,result:e,entityMeta:i};var s=function(e){return["object","function"].includes(typeof e)?"object":typeof e}(t);if(null===e||typeof e!==s){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 "'+s+'", 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 "'+s+'", found "'+(null===e?"null":typeof e)+'".')}var a=Object.assign({},n),u=Object.assign({},r),c=Object.assign({},i),f=function(e,t,n,r,i,o){return function(s,a,u){var c,f=s.key;f in e||(e[f]={},n[f]=Object.assign({},n[f]),i[f]=Object.assign({},i[f]));var l=e[f][u];if(l)e[f][u]=s.merge(l,a);else{var h=n[f][u];if(h){var p,d=(null==(p=i[f][u])?void 0:p.date)>o.date;e[f][u]=typeof a!=typeof h?d?h:a:d?s.merge(a,h):s.merge(h,a)}else e[f][u]=a}if(Array.isArray(s.indexes)){var y=e[f][u];f in t||(t[f]={},r[f]=Object.assign({},r[f]));for(var m,v=O(s.indexes);!(m=v()).done;){var g=m.value;g in t[f]||(r[f][g]=t[f][g]={});var b=t[f][g];l&&delete b[l[g]],n[f]&&n[f][u]&&n[f][u][g]!==y[g]&&(b[n[f][u][g]]=_),g in y?b[y[g]]=u:"production"!==process.env.NODE_ENV&&console.warn("Index not found in entity. Indexes must be top-level members of your entity.\nIndex: "+g+"\nEntity: "+JSON.stringify(y,void 0,2))}}n[f][u]=e[f][u];var k=s.expiresAt?s.expiresAt(o,a):o.expiresAt;i[f][u]=(null==(c=i[f][u])?void 0:c.expiresAt)>=k?i[f][u]:{expiresAt:k,date:o.date}}}({},{},a,u,c,o);return{entities:a,indexes:u,result:I(e,e,void 0,t,f,{}),entityMeta:c}},e.schema=F,Object.defineProperty(e,"__esModule",{value:!0})}));

@@ -42,2 +42,6 @@ import SimpleRecord from './SimpleRecord';

static normalize(input: any, parent: any, key: string | undefined, visit: (...args: any) => any, addEntity: (...args: any) => any, visitedEntities: Record<string, any>): any;
static expiresAt({ expiresAt }: {
expiresAt: number;
date: number;
}, input: any): number;
static infer(args: any, indexes: any, infer: any): any;

@@ -44,0 +48,0 @@ static denormalize<T extends typeof SimpleRecord>(this: T, input: Readonly<Partial<AbstractInstanceType<T>>>, unvisit: schema.UnvisitFunction): [AbstractInstanceType<T>, boolean, boolean];

@@ -192,2 +192,8 @@ /* eslint-disable @typescript-eslint/explicit-module-boundary-types */

static expiresAt({
expiresAt
}, input) {
return expiresAt;
}
static infer(args, indexes, infer) {

@@ -259,2 +265,2 @@ if (!args[0]) return undefined;

}
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9lbnRpdGllcy9FbnRpdHkudHMiXSwibmFtZXMiOlsiU2ltcGxlUmVjb3JkIiwiaXNJbW11dGFibGUiLCJkZW5vcm1hbGl6ZUltbXV0YWJsZSIsIkVudGl0eSIsInRvSlNPTiIsImtleSIsInByb2Nlc3MiLCJlbnYiLCJOT0RFX0VOViIsIm5hbWUiLCJFcnJvciIsInBrIiwidmFsdWUiLCJwYXJlbnQiLCJwcm90b3R5cGUiLCJjYWxsIiwibm9ybWFsaXplIiwiaW5wdXQiLCJ2aXNpdCIsImFkZEVudGl0eSIsInZpc2l0ZWRFbnRpdGllcyIsInByb2Nlc3NlZEVudGl0eSIsImZyb21KUyIsImF1dG9tYXRpY1ZhbGlkYXRpb24iLCJrZXlzT2ZS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B0aHJvdyBuZXcgRXJyb3IoJ2Nhbm5vdCBjb25zdHJ1Y3Qgb24gYWJzdHJhY3QgdHlwZXMnKTtcbiAgICByZXR1cm4gU2ltcGxlUmVjb3JkLmZyb21KUy5jYWxsKHRoaXMsIHByb3BzKSBhcyBhbnk7XG4gIH07XG59XG5cbmV4cG9ydCBmdW5jdGlvbiBpc0VudGl0eShzY2hlbWE6IFNjaGVtYSk6IHNjaGVtYSBpcyB0eXBlb2YgRW50aXR5IHtcbiAgcmV0dXJuIHNjaGVtYSAhPT0gbnVsbCAmJiAoc2NoZW1hIGFzIGFueSkucGsgIT09IHVuZGVmaW5lZDtcbn1cblxuZnVuY3Rpb24gaW5kZXhGcm9tUGFyYW1zPEkgZXh0ZW5kcyBzdHJpbmc+KFxuICBwYXJhbXM6IFJlYWRvbmx5PG9iamVjdD4sXG4gIGluZGV4ZXM/OiBSZWFkb25seTxJW10+LFxuKSB7XG4gIGlmICghaW5kZXhlcykgcmV0dXJuIHVuZGVmaW5lZDtcbiAgcmV0dXJuIGluZGV4ZXMuZmluZChpbmRleCA9PlxuICAgIE9iamVjdC5wcm90b3R5cGUuaGFzT3duUHJvcGVydHkuY2FsbChwYXJhbXMsIGluZGV4KSxcbiAgKTtcbn1cbiJdfQ==

@@ -23,6 +23,3 @@ import { normalize as arrayNormalize } from './schemas/Array';

const addEntities = (entities, indexes, existingEntities, existingIndexes, entityMeta, {
expiresAt,
date
}) => (schema, processedEntity, id) => {
const addEntities = (entities, indexes, existingEntities, existingIndexes, entityMeta, meta) => (schema, processedEntity, id) => {
var _entityMeta$schemaKey2;

@@ -54,3 +51,3 @@

// means we fallback to 'newer' (processedEntity) takes priority
const preferExisting = ((_entityMeta$schemaKey = entityMeta[schemaKey][id]) == null ? void 0 : _entityMeta$schemaKey.date) > date;
const preferExisting = ((_entityMeta$schemaKey = entityMeta[schemaKey][id]) == null ? void 0 : _entityMeta$schemaKey.date) > meta.date;

@@ -108,6 +105,8 @@ if (typeof processedEntity !== typeof inStoreEntity) {

existingEntities[schemaKey][id] = entities[schemaKey][id];
entityMeta[schemaKey][id] = ((_entityMeta$schemaKey2 = entityMeta[schemaKey][id]) == null ? void 0 : _entityMeta$schemaKey2.expiresAt) >= expiresAt ? entityMeta[schemaKey][id] : {
expiresAt,
date
existingEntities[schemaKey][id] = entities[schemaKey][id]; // TODO: eventually assume this exists and don't check for conditional. probably early 2022
const entityExpiresAt = schema.expiresAt ? schema.expiresAt(meta, processedEntity) : meta.expiresAt;
entityMeta[schemaKey][id] = ((_entityMeta$schemaKey2 = entityMeta[schemaKey][id]) == null ? void 0 : _entityMeta$schemaKey2.expiresAt) >= entityExpiresAt ? entityMeta[schemaKey][id] : {
expiresAt: entityExpiresAt,
date: meta.date
};

@@ -183,2 +182,2 @@ };

};
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9ub3JtYWxpemUudHMiXSwibmFtZXMiOlsibm9ybWFsaXplIiwiYXJyYXlOb3JtYWxpemUiLCJvYmplY3ROb3JtYWxpemUiLCJERUxFVEVEIiwidmlzaXQiLCJ2YWx1ZSIsInBhcmVudCIsImtleSIsInNjaGVtYSIsImFkZEVudGl0eSIsInZpc2l0ZWRFbnRpdGllcyIsImluY2x1ZGVzIiwibWV0aG9kIiwiQXJyYXkiLCJpc0FycmF5IiwiYWRkRW50aXRpZXMiLCJlbnRpdGllcyIsImluZGV4ZXMiLCJleGlzdGluZ0VudGl0aWVzIiwiZXhpc3RpbmdJbmRleGVzIiwiZW50aXR5TWV0YSIsImV4cGlyZXNBdCIsImRhdGUiLCJwcm9jZXNzZWRFbnRpdHkiLCJpZCIsInNjaGVtYUtleSIsImV4aXN0aW5nRW50aXR5IiwibWVyZ2UiLCJpblN0b3JlRW50aXR5IiwicHJlZmVyRXhpc3RpbmciLCJlbnRpdHkiLCJpbmRleCIsImluZGV4TWFwIiwicHJvY2VzcyIsImVudiIsIk5PREVfRU5WIiwiY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CBcIiR7XG4gICAgICAgICAgaW5wdXQgPT09IG51bGwgPyAnbnVsbCcgOiB0eXBlb2YgaW5wdXRcbiAgICAgICAgfVwiLmAsXG4gICAgICApO1xuICAgIH1cbiAgfVxuXG4gIGNvbnN0IG5ld0VudGl0aWVzOiBFID0ge30gYXMgYW55O1xuICBjb25zdCBuZXdJbmRleGVzOiBOb3JtYWxpemVkSW5kZXggPSB7fSBhcyBhbnk7XG4gIGNvbnN0IGVudGl0aWVzOiBFID0geyAuLi5leGlzdGluZ0VudGl0aWVzIH0gYXMgYW55O1xuICBjb25zdCBpbmRleGVzOiBOb3JtYWxpemVkSW5kZXggPSB7IC4uLmV4aXN0aW5nSW5kZXhlcyB9O1xuICBjb25zdCBlbnRpdHlNZXRhOiBhbnkgPSB7IC4uLmV4aXN0aW5nRW50aXR5TWV0YSB9O1xuICBjb25zdCBhZGRFbnRpdHkgPSBhZGRFbnRpdGllcyhcbiAgICBuZXdFbnRpdGllcyxcbiAgICBuZXdJbmRleGVzLFxuICAgIGVudGl0aWVzLFxuICAgIGluZGV4ZXMsXG4gICAgZW50aXR5TWV0YSxcbiAgICBtZXRhLFxuICApO1xuICBjb25zdCB2aXNpdGVkRW50aXRpZXMgPSB7fTtcblxuICBjb25zdCByZXN1bHQgPSB2aXNpdChcbiAgICBpbnB1dCxcbiAgICBpbnB1dCxcbiAgICB1bmRlZmluZWQsXG4gICAgc2NoZW1hLFxuICAgIGFkZEVudGl0eSxcbiAgICB2aXNpdGVkRW50aXRpZXMsXG4gICk7XG4gIHJldHVybiB7IGVudGl0aWVzLCBpbmRleGVzLCByZXN1bHQsIGVudGl0eU1ldGEgfTtcbn07XG4iXX0=
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9ub3JtYWxpemUudHMiXSwibmFtZXMiOlsibm9ybWFsaXplIiwiYXJyYXlOb3JtYWxpemUiLCJvYmplY3ROb3JtYWxpemUiLCJERU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gICAgaWYgKHR5cGVvZiBzY2hlbWEgPT09ICdmdW5jdGlvbicpIHtcbiAgICAgIHJldHVybiBuZXcgc2NoZW1hKHZhbHVlKTtcbiAgICB9XG4gICAgY29uc3QgbWV0aG9kID0gQXJyYXkuaXNBcnJheShzY2hlbWEpID8gYXJyYXlOb3JtYWxpemUgOiBvYmplY3ROb3JtYWxpemU7XG4gICAgcmV0dXJuIG1ldGhvZChcbiAgICAgIHNjaGVtYSxcbiAgICAgIHZhbHVlLFxuICAgICAgcGFyZW50LFxuICAgICAga2V5LFxuICAgICAgdmlzaXQsXG4gICAgICBhZGRFbnRpdHksXG4gICAgICB2aXNpdGVkRW50aXRpZXMsXG4gICAgKTtcbiAgfVxuXG4gIHJldHVybiBzY2hlbWEubm9ybWFsaXplKFxuICAgIHZhbHVlLFxuICAgIHBhcmVudCxcbiAgICBrZXksXG4gICAgdmlzaXQsXG4gICAgYWRkRW50aXR5LFxuICAgIHZpc2l0ZWRFbnRpdGllcyxcbiAgKTtcbn07XG5cbmNvbnN0IGFkZEVudGl0aWVzID1cbiAgKFxuICAgIGVudGl0aWVzOiBSZWNvcmQ8c3RyaW5nLCBhbnk+LFxuICAgIGluZGV4ZXM6IFJlY29yZDxzdHJpbmcsIGFueT4sXG4gICAgZXhpc3RpbmdFbnRpdGllczogUmVjb3JkPHN0cmluZywgYW55PixcbiAgICBleGlzdGluZ0luZGV4ZXM6IFJlY29yZDxzdHJpbmcsIGFueT4sXG4gICAgZW50aXR5TWV0YToge1xuICAgICAgW2VudGl0eUtleTogc3RyaW5nXToge1xuICAgICAgICBbcGs6IHN0cmluZ106IHtcbiAgICAgICAgICBkYXRlOiBudW1iZXI7XG4gICAgICAgICAgZXhwaXJlc0F0OiBudW1iZXI7XG4gICAgICAgIH07XG4gICAgICB9O1xuICAgIH0sXG4gICAgbWV0YTogeyBleHBpcmVzQXQ6IG51bWJlcjsgZGF0ZTogbnVtYmVyIH0sXG4gICkgPT5cbiAgKHNjaGVtYTogYW55LC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A6IHR5cGVvZiBpbnB1dFxuICAgICAgICB9XCIuYCxcbiAgICAgICk7XG4gICAgfVxuICB9XG5cbiAgY29uc3QgbmV3RW50aXRpZXM6IEUgPSB7fSBhcyBhbnk7XG4gIGNvbnN0IG5ld0luZGV4ZXM6IE5vcm1hbGl6ZWRJbmRleCA9IHt9IGFzIGFueTtcbiAgY29uc3QgZW50aXRpZXM6IEUgPSB7IC4uLmV4aXN0aW5nRW50aXRpZXMgfSBhcyBhbnk7XG4gIGNvbnN0IGluZGV4ZXM6IE5vcm1hbGl6ZWRJbmRleCA9IHsgLi4uZXhpc3RpbmdJbmRleGVzIH07XG4gIGNvbnN0IGVudGl0eU1ldGE6IGFueSA9IHsgLi4uZXhpc3RpbmdFbnRpdHlNZXRhIH07XG4gIGNvbnN0IGFkZEVudGl0eSA9IGFkZEVudGl0aWVzKFxuICAgIG5ld0VudGl0aWVzLFxuICAgIG5ld0luZGV4ZXMsXG4gICAgZW50aXRpZXMsXG4gICAgaW5kZXhlcyxcbiAgICBlbnRpdHlNZXRhLFxuICAgIG1ldGEsXG4gICk7XG4gIGNvbnN0IHZpc2l0ZWRFbnRpdGllcyA9IHt9O1xuXG4gIGNvbnN0IHJlc3VsdCA9IHZpc2l0KFxuICAgIGlucHV0LFxuICAgIGlucHV0LFxuICAgIHVuZGVmaW5lZCxcbiAgICBzY2hlbWEsXG4gICAgYWRkRW50aXR5LFxuICAgIHZpc2l0ZWRFbnRpdGllcyxcbiAgKTtcbiAgcmV0dXJuIHsgZW50aXRpZXMsIGluZGV4ZXMsIHJlc3VsdCwgZW50aXR5TWV0YSB9O1xufTtcbiJdfQ==
{
"name": "@rest-hooks/normalizr",
"version": "7.2.0",
"version": "7.3.0",
"description": "Normalizes and denormalizes JSON according to schema for Redux and Flux applications",

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

},
"gitHead": "18225300621058e9e692c480e31b7da7423ea8e5"
"gitHead": "ed74cd84ffa8883cc87230da2f6a7afb6875115d"
}

@@ -42,2 +42,6 @@ import SimpleRecord from './SimpleRecord';

static normalize(input: any, parent: any, key: string | undefined, visit: (...args: any) => any, addEntity: (...args: any) => any, visitedEntities: Record<string, any>): any;
static expiresAt({ expiresAt }: {
expiresAt: number;
date: number;
}, input: any): number;
static infer(args: any, indexes: any, infer: any): any;

@@ -44,0 +48,0 @@ static denormalize<T extends typeof SimpleRecord>(this: T, input: Readonly<Partial<AbstractInstanceType<T>>>, unvisit: schema.UnvisitFunction): [

Sorry, the diff of this file is not supported yet

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