@mark1russell7/packing 0.2.4 → 0.2.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -46,6 +46,30 @@ pack(rects, outer, { strategy: "shelf", fit: "best" });
46
46
  - `fit: "best"`: each rectangle goes on the shelf with the least height left over above it.
47
47
  - With a `fit`, the shelves open only in the free spans of each container shape. `docs/PACKER.md` tells the rules.
48
48
 
49
+ Since 0.2.5, `packMaxRects` and the strategy `maxrects` pack with a list of maximal free rectangles. `MAXRECTS_RULES` lists the rules of the option `rule`.
50
+
51
+ ```ts
52
+ pack(rects, outer, { strategy: "maxrects", rule: "cp" });
53
+ ```
54
+
55
+ - `rule: "bssf"` (the default): the free rectangle with the smallest leftover short side. Its move is `move.bssf`.
56
+ - `rule: "blsf"`: the free rectangle with the smallest leftover long side. Its move is `move.blsf`.
57
+ - `rule: "baf"`: the free rectangle with the smallest leftover area. Its move is `move.baf`.
58
+ - `rule: "bl"`: the highest place, then the leftmost place. Its move is `move.split`, a box that cuts 2 free rectangles or more.
59
+ - `rule: "cp"`: the place that touches the most length of edges. Its move is `move.cp`.
60
+ - The move of each rule other than `bl` counts a box when the rule chooses a place that `bl` does not choose.
61
+ - A shape that is not a rectangle gets bands. The option `bandHeight` sets their largest height. The default is the height divided by `MAXRECTS_BANDS`.
62
+
63
+ Since 0.2.6, `packPortfolio` packs an input with each member and keeps the best output. It is opt-in, and no default uses it.
64
+
65
+ ```ts
66
+ const { output, winner } = packPortfolio(["skyline", "shelf"]).pick(input);
67
+ ```
68
+
69
+ - The pick is `selectBest` of `@mark1russell7/layout-contract` on `PORTFOLIO_LEVELS`: the hard breaks, then `pack.overflow.excessArea`, then `pack.fill`.
70
+ - The trace of the output gets the stage `portfolio` with the measure `move.pick`.
71
+ - `outputHash` gives the hash of the placements of an output, as the bench records have it.
72
+
49
73
  Both functions also work alone, in an outer rectangle with a width that you set. They do not change the width.
50
74
 
51
75
  A `locked` rectangle keeps its position. `packSkyline` and `packShelf` put the other rectangles around it. `packRows` only keeps its position.
@@ -112,10 +136,11 @@ output.size; // the size of the container
112
136
  checkHard(input, output); // { "no-overlap": 0, "in-container": 0, "locked-kept": 0, complete: 0 }
113
137
  ```
114
138
 
115
- - The registry `strategies` has `rows`, `skyline`, `shelf` and `push`. `strategy(id)` gives one, and `packWith(id, input, options, seed)` packs with it.
139
+ - The registry `strategies` has `rows`, `skyline`, `shelf`, `push` and `maxrects`. `strategy(id)` gives one, and `packWith(id, input, options, seed)` packs with it.
116
140
  - `fixed` is `size`, `width`, `height` or `none`. A fixed height turns the axes. The value `none` uses the size search `logSweep`, which wraps `packFree`.
117
141
  - Each strategy declares its cells in `supports`. `cellOf(input)` gives the cell of an input. A strategy throws `UnsupportedCell` for an input outside its cells.
118
- - The strategies of this version do not turn items, read groups or pack shapes. A turnable item, a group or a shape gives `UnsupportedCell`.
142
+ - Only `maxrects` accepts a turnable item, and it turns items only with `rotate: true`. The other strategies give `UnsupportedCell` for a turnable item.
143
+ - No strategy reads groups or packs shapes. A group or a shape gives `UnsupportedCell`.
119
144
  - `checkHard` counts the breaks of the hard rules: `no-overlap`, `in-container`, `locked-kept` and `complete`. It reads the true shape of each obstacle, as `packHard` of `@mark1russell7/layout-contract` does.
120
145
  - `fromRects` and `toRects` connect the interface to the `Rect` objects.
121
146
 
package/build/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { ContainerTest, ContainerTest as ContainerTest$1, DEFAULT_TOLERANCE, Direction, Direction as Direction$1, EPS, Item, Item as Item$1, LayoutContainer, LayoutContainer as LayoutContainer$1, LayoutEdge, LayoutEdge as LayoutEdge$1, LayoutGenerator, LayoutInput, LayoutInput as LayoutInput$1, Margin, MeasureSpec as MeasureSpec$1, Obstacle, PackHard, PackHard as PackHard$1, PackInput, PackOutput, Placement, Port, RECORD_EPS, Region, Side, Sides, Sides as Sides$1, StageTrace, Tolerance, checkInput, turnPoint, turnPort, turnRegion } from "@mark1russell7/layout-contract";
1
+ import { ContainerTest, ContainerTest as ContainerTest$1, DEFAULT_TOLERANCE, Direction, Direction as Direction$1, EPS, Item, Item as Item$1, LayoutContainer, LayoutContainer as LayoutContainer$1, LayoutEdge, LayoutEdge as LayoutEdge$1, LayoutGenerator, LayoutInput, LayoutInput as LayoutInput$1, Margin, MeasureSpec as MeasureSpec$1, MemberTrace, Obstacle, PackHard, PackHard as PackHard$1, PackInput, PackOutput, Placement, Port, Portfolio, Portfolio as Portfolio$1, PortfolioPick, PortfolioTrace, RECORD_EPS, Region, SelectLevel, SelectLevel as SelectLevel$1, Side, Sides, Sides as Sides$1, StageTrace, Tolerance, checkInput, turnPoint, turnPort, turnRegion } from "@mark1russell7/layout-contract";
2
2
  /** A mutable two-dimensional vector. */
3
3
  export declare class Vector {
4
4
  #private;
@@ -142,6 +142,58 @@ interface FreeSpace {
142
142
  * frame is the corner of the container, moved in by the inset and out by half the gap. `FreeSpace` tells the methods.
143
143
  */
144
144
  export declare function freeSpace(input: PackInput): FreeSpace;
145
+ /**
146
+ * The rules of `maxrects` to choose a free rectangle for a box.
147
+ *
148
+ * - `bssf`: the best short side fit. The smaller leftover side is the smallest.
149
+ * - `blsf`: the best long side fit. The larger leftover side is the smallest.
150
+ * - `baf`: the best area fit. The leftover area is the smallest.
151
+ * - `bl`: the bottom-left rule. The bottom edge of the box is the highest, then the left edge is the leftmost.
152
+ * - `cp`: the contact point rule. The box touches the most length of the edges of the frame, the boxes and the obstacles.
153
+ */
154
+ export declare const MAXRECTS_RULES: readonly ["bssf", "blsf", "baf", "bl", "cp"];
155
+ /** A rule of `maxrects`: `bssf`, `blsf`, `baf`, `bl` or `cp`. `MAXRECTS_RULES` tells each rule. */
156
+ type MaxRectsRule = (typeof MAXRECTS_RULES)[number];
157
+ /** The number of bands that the default band height gives. The default band height is the height to cut divided by this number. */
158
+ export declare const MAXRECTS_BANDS = 128;
159
+ /** The options of `packMaxRects` */
160
+ interface MaxRectsOptions {
161
+ /** The order of the rectangles before the packing. The default is `height-desc`. */
162
+ sortOrder?: SortOrder;
163
+ /**
164
+ * The free space of the container: `freeSpace` of the input. Without it, or when it is plain, the free rectangles are
165
+ * exact: the outer rectangle less the locked rectangles. Another space gives an inner approximation with bands.
166
+ */
167
+ space?: FreeSpace;
168
+ /** The rule to choose a free rectangle. The default is `bssf`. */
169
+ rule?: MaxRectsRule;
170
+ /**
171
+ * The largest height of a band of the approximation of a space that is not plain. The bands have equal heights. The
172
+ * default is the height to cut divided by `MAXRECTS_BANDS`. A fixed height cuts the height. A free height cuts to the
173
+ * lowest edge of the obstacles that are not rectangles.
174
+ */
175
+ bandHeight?: number;
176
+ /** The rectangles that can turn by 90 degrees. Without it, no rectangle turns. A locked rectangle does not turn. */
177
+ turnable?: ReadonlySet<unknown>;
178
+ /**
179
+ * The rectangles that the packing turned. Each call turns back the rectangles of this set first, and then it clears the
180
+ * set. Thus a size search can pack the same rectangles many times.
181
+ */
182
+ turned?: Set<unknown>;
183
+ }
184
+ /**
185
+ * This function packs rectangles into an outer rectangle with MaxRects of Jylänki (2010). It keeps the list of the maximal
186
+ * free rectangles, and it does not change the width of the outer rectangle.
187
+ *
188
+ * - Each box goes to the top-left corner of the free rectangle that `options.rule` chooses. `MAXRECTS_RULES` tells the rules.
189
+ * - A tie goes to the higher place, then to the place on the left, then to the first free rectangle of the list.
190
+ * - A `locked` rectangle keeps its position, and the free rectangles go around it.
191
+ * - With a space that is not plain, the free rectangles start from bands of the outline. `MaxRectsOptions` tells the bands.
192
+ * - Without `fixedSize`, the height of the outer rectangle grows to the content. With `fixedSize`, a box that does not fit
193
+ * is not packed: its `wasPacked` stays `false`.
194
+ * - The default sort order is `height-desc`. The order of the array of the caller stays.
195
+ */
196
+ export declare function packMaxRects<T>(rects: Rect<T>[], outer: Rect<T>, options?: MaxRectsOptions): Rect<T>;
145
197
  /**
146
198
  * The rule of a shelf packing to choose the shelf of a rectangle. `packShelf` tells each rule.
147
199
  *
@@ -195,12 +247,20 @@ interface PackOptions {
195
247
  /** The options of `pack` */
196
248
  interface PackLayoutOptions extends PackOptions {
197
249
  /**
198
- * The packing: `rows` (the default), `skyline` or `shelf`. `skyline` and `shelf` pack around locked rectangles.
199
- * Use `shelf` with the sort order `input` to keep the order of the array around locked rectangles.
250
+ * The packing: `rows` (the default), `skyline`, `shelf` or `maxrects`. `skyline`, `shelf` and `maxrects` pack around
251
+ * locked rectangles. Use `shelf` with the sort order `input` to keep the order of the array around locked rectangles.
200
252
  */
201
- strategy?: "rows" | "skyline" | "shelf";
253
+ strategy?: "rows" | "skyline" | "shelf" | "maxrects";
202
254
  /** The rule of `shelf` to choose a shelf. Only `shelf` reads it. `ShelfOptions` tells it. Without it, `shelf` packs as in 0.2.3. */
203
255
  fit?: ShelfFit;
256
+ /** The rule of `maxrects` to choose a free rectangle. Only `maxrects` reads it. The default is `bssf`. */
257
+ rule?: MaxRectsRule;
258
+ /** The largest height of a band of `maxrects` in a space that is not plain. Only `maxrects` reads it. `MaxRectsOptions` tells it. */
259
+ bandHeight?: number;
260
+ /** The rectangles that `maxrects` can turn by 90 degrees. Only `maxrects` reads it. */
261
+ turnable?: ReadonlySet<unknown>;
262
+ /** The rectangles that `maxrects` turned. Only `maxrects` reads it. `MaxRectsOptions` tells it. */
263
+ turned?: Set<unknown>;
204
264
  }
205
265
  /**
206
266
  * This function packs rectangles into an outer rectangle of a given width with a guillotine row packing. It does
@@ -219,7 +279,7 @@ export declare function packRows<T>(rects: Rect<T>[], outer: Rect<T>, options?:
219
279
  * This width is not less than the width of the widest rectangle. The height grows until all rectangles fit.
220
280
  * - With `fixedWidth`, the width stays. A rectangle wider than that width goes on its own row and overflows.
221
281
  * - With `fixedSize`, a rectangle that does not fit is not packed: its `wasPacked` stays `false`.
222
- * - `options.strategy` selects `packRows` (the default), `packSkyline` or `packShelf` after the width is set.
282
+ * - `options.strategy` selects `packRows` (the default), `packSkyline`, `packShelf` or `packMaxRects` after the width is set.
223
283
  */
224
284
  export declare function pack<T>(rects: Rect<T>[], outer?: Rect<T>, options?: PackLayoutOptions): Rect<T>;
225
285
  /**
@@ -621,6 +681,18 @@ interface LayoutStrategyOptions {
621
681
  */
622
682
  fit?: ShelfFit;
623
683
  }
684
+ /** The options of the strategy `maxrects`. The strategy does not read `fit`. */
685
+ interface MaxRectsStrategyOptions extends LayoutStrategyOptions {
686
+ /** The rule to choose a free rectangle: `bssf` (the default), `blsf`, `baf`, `bl` or `cp`. `MAXRECTS_RULES` tells each rule. */
687
+ rule: MaxRectsRule;
688
+ /** The value `true` lets each turnable item that is not locked turn by 90 degrees. The default is `false`. */
689
+ rotate: boolean;
690
+ /**
691
+ * The largest height of a band of the approximation of a container that is not a plain rectangle. `MaxRectsOptions`
692
+ * tells the default.
693
+ */
694
+ bandHeight?: number;
695
+ }
624
696
  /** The options of the strategy `push`. */
625
697
  interface PushStrategyOptions {
626
698
  /** The order of the items that the cascade does not place. */
@@ -645,9 +717,18 @@ export declare const skyline: Strategy<LayoutStrategyOptions>;
645
717
  * The option `fit` selects a shelf rule of roadmap item k21: `next`, `first` or `best`. The default has no `fit`.
646
718
  */
647
719
  export declare const shelf: Strategy<LayoutStrategyOptions>;
720
+ /**
721
+ * The strategy `maxrects` uses `packMaxRects`: the MaxRects packer of roadmap item k24. It keeps the list of the maximal
722
+ * free rectangles, and the option `rule` chooses the free rectangle for each item. The default rule is `bssf`.
723
+ *
724
+ * - The free rectangles go around the locked items and the fixed obstacles. A plain rectangle container gives exact free
725
+ * rectangles. Another shape gives an inner approximation with horizontal bands.
726
+ * - With `rotate`, each turnable item that is not locked can turn by 90 degrees. Groups and item shapes throw `UnsupportedCell`.
727
+ */
728
+ export declare const maxrects: Strategy<MaxRectsStrategyOptions>;
648
729
  /**
649
730
  * The size search `log-sweep` uses `packFree` of 0.1.2: widths on a log scale, then the widths near the best width. It
650
- * wraps `rows`, `skyline` and `shelf`. The objective is the area of the frame times `1 + aspectWeight * aspectError`.
731
+ * wraps `rows`, `skyline`, `shelf` and `maxrects`. The objective is the area of the frame times `1 + aspectWeight * aspectError`.
651
732
  */
652
733
  export declare const logSweep: SizeSearch;
653
734
  /**
@@ -678,6 +759,50 @@ export declare function strategy(id: string): Strategy;
678
759
  * context gets `mulberry32` with the seed. The default seed is 0.
679
760
  */
680
761
  export declare function packWith(id: string, input: PackInput, options?: unknown, seed?: number): PackOutput;
762
+ /** A member of `packPortfolio`: a strategy of the registry with some options. The id names the member in the trace. */
763
+ interface PortfolioEntry {
764
+ id: string;
765
+ /** The id of a strategy of the registry */
766
+ strategy: string;
767
+ /** The options of the member over the defaults of the strategy */
768
+ options?: unknown;
769
+ }
770
+ /** The options of `packPortfolio`. The time limit and the member limit are those of `portfolio` of the contract. */
771
+ interface PackPortfolioOptions {
772
+ /** The id of the portfolio. The default is `portfolio`. */
773
+ id?: string;
774
+ /** The seed of each member. The default is 0, as for `packWith`. */
775
+ seed?: number;
776
+ /** The time limit in milliseconds. Without it, each member runs. A cut member makes the pick not deterministic. */
777
+ budgetMs?: number;
778
+ /** The largest count of members that run */
779
+ maxMembers?: number;
780
+ /** The clock in milliseconds. The default is `performance.now`. */
781
+ now?: () => number;
782
+ }
783
+ /** The id of the trace stage of `packPortfolio`. Its measure `move.pick` is 1 when the pick is not member 0. */
784
+ export declare const PORTFOLIO_STAGE = "portfolio";
785
+ /**
786
+ * The levels of the pick of `packPortfolio` and of the portfolio report of the benchmark, in order. Level 0 is `hard`.
787
+ *
788
+ * - `hard`: the count of hard breaks of `checkHard` with `exactContainer`. Lower is better, with the minimum effect 0.
789
+ * - `pack.overflow.excessArea`: the overflow area above its bound. Lower is better.
790
+ * - `pack.fill`: the fill of the hull. Higher is better.
791
+ */
792
+ export declare const PORTFOLIO_LEVELS: readonly SelectLevel$1[];
793
+ /** This function gives the count of the hard breaks of an output: the sum of `checkHard` with `exactContainer`. */
794
+ export declare function hardBreaks(input: PackInput, output: PackOutput): number;
795
+ /**
796
+ * This function makes an opt-in portfolio of strategies of the registry with `portfolio` of the contract.
797
+ * Its `pick(input)` packs the input with each member and gives the output of the winner, its id and the trace.
798
+ *
799
+ * - A member is a strategy id, or a `PortfolioEntry` with options. The members run in the given order.
800
+ * - The key is the hard breaks, then `pack.overflow.excessArea`, then `pack.fill`. `PORTFOLIO_LEVELS` gives the specs.
801
+ * - The hash of the key is `outputHash`. `selectBest` of the contract picks the winner.
802
+ * - The output of the winner gets the trace stage `portfolio` with `move.pick` of `pickMoves`.
803
+ * - The function throws a `RangeError` for an unknown strategy, an empty list and two members with the same id.
804
+ */
805
+ export declare function packPortfolio(members: readonly (string | PortfolioEntry)[], options?: PackPortfolioOptions): Portfolio$1<PackInput, PackOutput>;
681
806
  /**
682
807
  * This function counts the breaks of the 4 hard rules of the packer for an output.
683
808
  *
@@ -752,6 +877,12 @@ export declare function round3(x: number): number;
752
877
  export declare function canonicalJson(value: unknown): string;
753
878
  /** This function gives the hash of an input file: the first 16 hex characters of the SHA-256 of its canonical form without `hash`. */
754
879
  export declare function hashInput(file: LayoutInput$1): string;
880
+ /**
881
+ * This function gives the `outputHash` of an output. It is the first 16 hex characters of the SHA-256 of the canonical form of
882
+ * its placements, sorted by id. The canonical form rounds each number with `round3`. Thus the order of the list does not count.
883
+ * The records of the benchmark and the key of `packPortfolio` use it. It is not `outputHash` of the contract, which uses a grid.
884
+ */
885
+ export declare function outputHash(output: Pick<PackOutput, "placements">): string;
755
886
  /** This function gives the scale of a count: the nearest of 1, 10, 100, 1000 and 10000 on a log scale. The count 0 gives `1`. */
756
887
  export declare function countCell(count: number): CountScale;
757
888
  /**
@@ -871,5 +1002,5 @@ interface Corpus {
871
1002
  * `RangeError` for an unknown generator, a different version or 2 inputs with the same id.
872
1003
  */
873
1004
  export declare function corpus(name: string, specs: readonly CorpusSpec[]): Corpus;
874
- export { type Cell, type ChangeMeasures, type ContainerTest, type Corpus, type CorpusCell, type CorpusEntry, type CorpusGenerator, type CorpusManifest, type CorpusSpec, type CountScale, DEFAULT_TOLERANCE, type Dimension, type DimensionValue, type Direction, EPS, type EdgeCase, type EdgeCaseParams, type FreeSpace, type FreeSpan, type FreeWidthOptions, type FreeWidthResult, type FreeWidthTry, type GeneratedInput, type GeneratorParams, type GeneratorStamp, type Item, type LayoutContainer, type LayoutEdge, type LayoutInput, type LayoutMeasures, type LayoutStrategyOptions, type Margin, type MeasureFamily, type MeasureId, type MeasureOptions, type MeasureSpec, type MetricsOptions, type Obstacle, type ObstacleLayout, type PackContext, type PackHard, type PackInput, type PackLayoutOptions, type PackOptions, type PackOutput, type PackingMetrics, type Placement, type Port, type PushOptions, type PushStrategyOptions, RECORD_EPS, type RectGridParams, type RectScatteredParams, type Region, type ShelfFit, type ShelfOptions, type Side, type Sides, type SizeDistribution, type SizeSearch, type SkylineOptions, type SortOrder, type SpaceRect, type StageTrace, type Strategy, type Supports, type Tolerance, type UiParams, checkInput, turnPoint, turnPort, turnRegion };
1005
+ export { type Cell, type ChangeMeasures, type ContainerTest, type Corpus, type CorpusCell, type CorpusEntry, type CorpusGenerator, type CorpusManifest, type CorpusSpec, type CountScale, DEFAULT_TOLERANCE, type Dimension, type DimensionValue, type Direction, EPS, type EdgeCase, type EdgeCaseParams, type FreeSpace, type FreeSpan, type FreeWidthOptions, type FreeWidthResult, type FreeWidthTry, type GeneratedInput, type GeneratorParams, type GeneratorStamp, type Item, type LayoutContainer, type LayoutEdge, type LayoutInput, type LayoutMeasures, type LayoutStrategyOptions, type Margin, type MaxRectsOptions, type MaxRectsRule, type MaxRectsStrategyOptions, type MeasureFamily, type MeasureId, type MeasureOptions, type MeasureSpec, type MemberTrace, type MetricsOptions, type Obstacle, type ObstacleLayout, type PackContext, type PackHard, type PackInput, type PackLayoutOptions, type PackOptions, type PackOutput, type PackPortfolioOptions, type PackingMetrics, type Placement, type Port, type Portfolio, type PortfolioEntry, type PortfolioPick, type PortfolioTrace, type PushOptions, type PushStrategyOptions, RECORD_EPS, type RectGridParams, type RectScatteredParams, type Region, type SelectLevel, type ShelfFit, type ShelfOptions, type Side, type Sides, type SizeDistribution, type SizeSearch, type SkylineOptions, type SortOrder, type SpaceRect, type StageTrace, type Strategy, type Supports, type Tolerance, type UiParams, checkInput, turnPoint, turnPort, turnRegion };
875
1006
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","names":["Item","Sides","ContractMeasureSpec","Direction","ContainerTest","PackHard","LayoutContainer","LayoutEdge","LayoutInput"],"sources":["../src/vector.ts","../src/rect.ts","../src/order.ts","../src/contract.ts","../src/space.ts","../src/shelf.ts","../src/pack.ts","../src/skyline.ts","../src/free.ts","../src/push.ts","../src/metrics.ts","../src/measures.ts","../src/strategy.ts","../src/adapters.ts","../src/convert.ts","../src/registry.ts","../src/check.ts","../src/layout-input.ts","../src/generators.ts","../src/corpus.ts"],"mappings":";;qBACa;;EAIX,YAAY,YAAO;;MAMf;MACA,EAAE;;MAEF;MACA,EAAE;;EAGN,IAAI,WAAW;;EAMf,MAAM,GAAG;;EAMT,IAAI,OAAO,SAAS;;EAKpB;;EAKA,SAAS;;EAKT,MAAM,KAAK,QAAQ,KAAK,SAAS;;SAQ1B,GAAG,iBAAiB;;SAKpB,IAAI,SAAS,WAAW;;SASxB,IAAI,SAAS,WAAW;;aASpB,YAAY;;;qBCxEZ,KAAK;;;EAKhB,KAAK;;EAEL;;EAEA;;EAEA;;;;;EAKA;;MAGI,YAAY;;MAEZ,QAAQ;;EAGZ;;EAEA;;EAGA,WAAW;;EAOX,YAAY,QAAQ;;EAMpB;;SAGO,OAAO,GAAG,OAAO,KAAK,OAAO,KAAK;;SAKlC,SAAS,GAAG,OAAO,KAAK,OAAO,KAAK;;SAKpC,YAAY,GAAG,OAAO,KAAK;;SAK3B,SAAS,GAAG,OAAO,KAAK;;SAKxB,UAAU,GAAG,OAAO,KAAK;;;;;;KC/DtB;;qBAGC,sBAAsB;;wBAGnB,aAAa,OAAO,aAAa,GAAG,GAAG,KAAK,IAAI,GAAG,KAAK;;wBCiBxD,SAAS,MAAM,KAAKA,oBAAkBC;;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;wBAIc,QAAQ;;wBAOR,OAAO;;;;;wBASP,cAAc;;wBAYd,UAAU,MAAMC;;wBAMhB,UAAU,gBAAgB;;;;;wBAY1B,YAAY,MAAM,KAAKA,8DAA4D;;UCnFlF,gBAAgB,UAAU,kBAAkB;;WAElD;;WAEA;;WAEA;;WAEA,UAAU,SAAS;;WAEnB,oBAAoB,WAAW,cAAc,EAAE;;EAExD,aAAa,SAAS,QAAQ,KAAK;;EAEnC,KAAK,SAAS,QAAQ,KAAK;;EAE3B,SAAS,cAAc,SAAS,QAAQ,IAAI,eAAe;;;KAgJjD;EAAwB;;;qBAGvB,eAAe,gBAAgB;;KA8QhC;EACV,eAAe;EACf,gBAAgB;EAChB,WAAW;EACX,OAAO;EACP;;;;;;qBAOW,UAAU,gBAAgB;;KA2B3B;EACV,eAAe;EACf;;;qBA0BW,SAAS,gBAAgB;;qBAWzB,WAAW,gBAAgB;;qBAS3B,OAAO,gBAAgB;;qBAUvB,WAAW,gBAAgB;;KAY5B;;KAGA;EAAmB,MAAM;EAAU;;;;;;;;;;;qBAoBlC,WAAW,gBAAgB;;qBAwF3B,qBAAqB;;wBAGlB,UAAU,eAAe;;UChqBxB;;EAEf;;EAEA;;EAEA,SAAS;EACT;;;UAIe;EACf;EACA;EACA,MAAM;;;UAIS;EACf;;EAEA;;EAEA;IAAS;IAAmB;IAAiB,QAAQ;IAAiB;;EACtE,QAAQ;;;UAIO;EACf,UAAU;EACV,QAAQ;;;;;;wBAOM,OAAO,cAAc,gBAAgB,eAAe"}
1
+ {"version":3,"file":"index.d.ts","names":["Item","Sides","ContractMeasureSpec","Direction","SelectLevel","Portfolio","ContainerTest","PackHard","LayoutContainer","LayoutEdge","LayoutInput"],"sources":["../src/vector.ts","../src/rect.ts","../src/order.ts","../src/contract.ts","../src/space.ts","../src/maxrects.ts","../src/shelf.ts","../src/pack.ts","../src/skyline.ts","../src/free.ts","../src/push.ts","../src/metrics.ts","../src/measures.ts","../src/strategy.ts","../src/adapters.ts","../src/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