"use strict"; var __defProp = Object.defineProperty; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __getOwnPropNames = Object.getOwnPropertyNames; var __hasOwnProp = Object.prototype.hasOwnProperty; var __export = (target, all) => { for (var name in all) __defProp(target, name, { get: all[name], enumerable: true }); }; var __copyProps = (to, from, except, desc) => { if (from && typeof from === "object" || typeof from === "function") { for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); } return to; }; var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); // src/index.ts var src_exports = {}; __export(src_exports, { curried: () => curried, default: () => src_default, unwind: () => unwind }); module.exports = __toCommonJS(src_exports); var curried = (rank) => (src) => { if (src.length === 0) return [[], []]; const zipped = []; src.forEach((_, i) => { zipped.push([rank[i], i, src[i]]); }); zipped.sort(([a], [b]) => a - b); const dst = []; const derank = []; zipped.forEach(([_, i, o]) => { derank.push(i); dst.push(o); }); return [dst, derank]; }; var unwind = (rank, src) => curried(rank)(src); var src_default = unwind; // Annotate the CommonJS export names for ESM import in node: 0 && (module.exports = { curried, unwind }); //# sourceMappingURL=data:application/json;base64,ewogICJ2ZXJzaW9uIjogMywKICAic291cmNlcyI6IFsiLi4vc3JjL2luZGV4LnRzIl0sCiAgInNvdXJjZXNDb250ZW50IjogWyJleHBvcnQgY29uc3QgY3VycmllZCA9XG4gIChyYW5rOiBudW1iZXJbXSkgPT5cbiAgPFQ+KHNyYzogVFtdKTogW1RbXSwgbnVtYmVyW11dID0+IHtcbiAgICBpZiAoc3JjLmxlbmd0aCA9PT0gMCkgcmV0dXJuIFtbXSwgW11dXG5cbiAgICBjb25zdCB6aXBwZWQ6IFtudW1iZXIsIG51bWJlciwgYW55XVtdID0gW11cbiAgICBzcmMuZm9yRWFjaCgoXywgaSkgPT4ge1xuICAgICAgemlwcGVkLnB1c2goW3JhbmtbaV0sIGksIHNyY1tp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