// Version 1.3.1 index-array-by - https://github.com/vasturiano/index-array-by !function(t,r){"object"==typeof exports&&"undefined"!=typeof module?module.exports=r():"function"==typeof define&&define.amd?define(r):(t="undefined"!=typeof globalThis?globalThis:t||self).indexBy=r()}(this,(function(){"use strict";function t(t,r){if(null==t)return{};var n,e,o=function(t,r){if(null==t)return{};var n,e,o={},i=Object.keys(t);for(e=0;e=0||(o[n]=t[n]);return o}(t,r);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(e=0;e=0||Object.prototype.propertyIsEnumerable.call(t,n)&&(o[n]=t[n])}return o}function r(t,r){return function(t){if(Array.isArray(t))return t}(t)||function(t,r){var n=t&&("undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"]);if(null==n)return;var e,o,i=[],u=!0,a=!1;try{for(n=n.call(t);!(u=(e=n.next()).done)&&(i.push(e.value),!r||i.length!==r);u=!0);}catch(t){a=!0,o=t}finally{try{u||null==n.return||n.return()}finally{if(a)throw o}}return i}(t,r)||e(t,r)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function n(t){return function(t){if(Array.isArray(t))return o(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||e(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function e(t,r){if(t){if("string"==typeof t)return o(t,r);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?o(t,r):void 0}}function o(t,r){(null==r||r>t.length)&&(r=t.length);for(var n=0,e=new Array(r);n0&&void 0!==arguments[0]?arguments[0]:[],o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],u=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],a=arguments.length>3&&void 0!==arguments[3]&&arguments[3],l=(o instanceof Array?o.length?o:[void 0]:[o]).map((function(t){return{keyAccessor:t,isProp:!(t instanceof Function)}})),f=e.reduce((function(r,n){var e=r,o=n;return l.forEach((function(r,n){var a,f=r.keyAccessor;if(r.isProp){var c=o,s=c[f],y=t(c,[f].map(i));a=s,o=y}else a=f(o,n);n+11&&void 0!==arguments[1]?arguments[1]:1;n===l.length?Object.keys(r).forEach((function(t){return r[t]=u(r[t])})):Object.values(r).forEach((function(r){return t(r,n+1)}))}(f);var c=f;return a&&(c=[],function t(e){var o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];o.length===l.length?c.push({keys:o,vals:e}):Object.entries(e).forEach((function(e){var i=r(e,2),u=i[0],a=i[1];return t(a,[].concat(n(o),[u]))}))}(f),o instanceof Array&&0===o.length&&1===c.length&&(c[0].keys=[])),c}}));