| 1 |  |  | <?php | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2 |  |  | /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 3 |  |  |  * Box packing (3D bin packing, knapsack problem). | 
            
                                                                                                            
                            
            
                                    
            
            
                | 4 |  |  |  * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 5 |  |  |  * @author Doug Wright | 
            
                                                                                                            
                            
            
                                    
            
            
                | 6 |  |  |  */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 7 |  |  | declare(strict_types=1); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 8 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 9 |  |  | namespace DVDoug\BoxPacker; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 10 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 11 |  |  | use function array_key_last; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 12 |  |  | use function array_pop; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 13 |  |  | use function array_reverse; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 14 |  |  | use function array_slice; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 15 |  |  | use ArrayIterator; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 16 |  |  | use function count; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 17 |  |  | use Countable; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 18 |  |  | use function end; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 19 |  |  | use IteratorAggregate; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 20 |  |  | use Traversable; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 21 |  |  | use function usort; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 22 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 23 |  |  | /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 24 |  |  |  * List of items to be packed, ordered by volume. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 25 |  |  |  * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 26 |  |  |  * @author Doug Wright | 
            
                                                                                                            
                            
            
                                    
            
            
                | 27 |  |  |  */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 28 |  |  | class ItemList implements Countable, IteratorAggregate | 
            
                                                                                                            
                            
            
                                    
            
            
                | 29 |  |  | { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 30 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 31 |  |  |      * List containing items. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 32 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 33 |  |  |      * @var Item[] | 
            
                                                                                                            
                            
            
                                    
            
            
                | 34 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 35 |  |  |     private $list = []; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 36 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 37 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 38 |  |  |      * Has this list already been sorted? | 
            
                                                                                                            
                            
            
                                    
            
            
                | 39 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 40 |  |  |      * @var bool | 
            
                                                                                                            
                            
            
                                    
            
            
                | 41 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 42 |  |  |     private $isSorted = false; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 43 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 44 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 45 |  |  |      * Does this list contain constrained items? | 
            
                                                                                                            
                            
            
                                    
            
            
                | 46 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 47 |  |  |      * @var bool | 
            
                                                                                                            
                            
            
                                    
            
            
                | 48 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 49 |  |  |     private $hasConstrainedItems; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 50 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 51 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 52 |  |  |      * Does this list contain items which cannot be rotated? | 
            
                                                                                                            
                            
            
                                    
            
            
                | 53 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 54 |  |  |      * @var bool | 
            
                                                                                                            
                            
            
                                    
            
            
                | 55 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 56 |  |  |     private $hasNoRotationItems; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 57 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 58 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 59 |  |  |      * Do a bulk create. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 60 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 61 |  |  |      * @param  Item[]   $items | 
            
                                                                                                            
                            
            
                                    
            
            
                | 62 |  |  |      * @return ItemList | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 63 |  |  |      */ | 
            
                                                                        
                            
            
                                    
            
            
                | 64 | 41 |  |     public static function fromArray(array $items, bool $preSorted = false): self | 
            
                                                                        
                            
            
                                    
            
            
                | 65 |  |  |     { | 
            
                                                                        
                            
            
                                    
            
            
                | 66 | 41 |  |         $list = new static(); | 
            
                                                                        
                            
            
                                    
            
            
                | 67 | 41 |  |         $list->list = array_reverse($items); // internal sort is largest at the end | 
            
                                                                        
                            
            
                                    
            
            
                | 68 | 41 |  |         $list->isSorted = $preSorted; | 
            
                                                                        
                            
            
                                    
            
            
                | 69 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 70 | 41 |  |         return $list; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 71 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 72 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 73 | 42 |  |     public function insert(Item $item): void | 
            
                                                                                                            
                            
            
                                    
            
            
                | 74 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 75 | 42 |  |         $this->list[] = $item; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 76 | 42 |  |         $this->isSorted = false; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 77 | 42 |  |         $this->hasConstrainedItems = $this->hasConstrainedItems || $item instanceof ConstrainedPlacementItem; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 78 | 42 |  |         $this->hasNoRotationItems = $this->hasNoRotationItems || $item->getAllowedRotations() === Item::ROTATION_NEVER; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 79 | 42 |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 80 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 81 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 82 |  |  |      * Remove item from list. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 83 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 84 | 2 |  |     public function remove(Item $item): void | 
            
                                                                                                            
                            
            
                                    
            
            
                | 85 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 86 | 2 |  |         if (!$this->isSorted) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 87 | 2 |  |             usort($this->list, [$this, 'compare']); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 88 | 2 |  |             $this->isSorted = true; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 89 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 90 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 91 | 2 |  |         end($this->list); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 92 |  |  |         do { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 93 | 2 |  |             if (current($this->list) === $item) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 94 | 2 |  |                 unset($this->list[key($this->list)]); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 95 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 96 | 2 |  |                 return; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 97 |  |  |             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 98 |  |  |         } while (prev($this->list) !== false); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 99 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 100 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 101 | 23 |  |     public function removePackedItems(PackedItemList $packedItemList): void | 
            
                                                                                                            
                            
            
                                    
            
            
                | 102 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 103 | 23 |  |         foreach ($packedItemList as $packedItem) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 104 | 18 |  |             end($this->list); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 105 |  |  |             do { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 106 | 18 |  |                 if (current($this->list) === $packedItem->getItem()) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 107 | 18 |  |                     unset($this->list[key($this->list)]); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 108 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 109 | 18 |  |                     break; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 110 |  |  |                 } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 111 | 1 |  |             } while (prev($this->list) !== false); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 112 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 113 | 23 |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 114 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 115 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 116 |  |  |      * @internal | 
            
                                                                                                            
                            
            
                                    
            
            
                | 117 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 118 | 41 |  |     public function extract(): Item | 
            
                                                                                                            
                            
            
                                    
            
            
                | 119 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 120 | 41 |  |         if (!$this->isSorted) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 121 | 30 |  |             usort($this->list, [$this, 'compare']); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 122 | 30 |  |             $this->isSorted = true; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 123 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 124 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 125 | 41 |  |         return array_pop($this->list); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 126 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 127 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 128 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 129 |  |  |      * @internal | 
            
                                                                                                            
                            
            
                                    
            
            
                | 130 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 131 | 35 |  |     public function top(): Item | 
            
                                                                                                            
                            
            
                                    
            
            
                | 132 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 133 | 35 |  |         if (!$this->isSorted) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 134 |  |  |             usort($this->list, [$this, 'compare']); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 135 |  |  |             $this->isSorted = true; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 136 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 137 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 138 | 35 |  |         return $this->list[array_key_last($this->list)]; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 139 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 140 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 141 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 142 |  |  |      * @internal | 
            
                                                                                                            
                            
            
                                    
            
            
                | 143 |  |  |      * @return ItemList | 
            
                                                                                                            
                            
            
                                    
            
            
                | 144 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 145 | 33 |  |     public function topN(int $n): self | 
            
                                                                                                            
                            
            
                                    
            
            
                | 146 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 147 | 33 |  |         if (!$this->isSorted) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 148 |  |  |             usort($this->list, [$this, 'compare']); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 149 |  |  |             $this->isSorted = true; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 150 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 151 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 152 | 33 |  |         $topNList = new self(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 153 | 33 |  |         $topNList->list = array_slice($this->list, -$n, $n); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 154 | 33 |  |         $topNList->isSorted = true; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 155 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 156 | 33 |  |         return $topNList; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 157 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 158 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 159 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 160 |  |  |      * @return Traversable|Item[] | 
            
                                                                                                            
                            
            
                                    
            
            
                | 161 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 162 | 42 |  |     public function getIterator(): Traversable | 
            
                                                                                                            
                            
            
                                    
            
            
                | 163 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 164 | 42 |  |         if (!$this->isSorted) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 165 | 12 |  |             usort($this->list, [$this, 'compare']); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 166 | 12 |  |             $this->isSorted = true; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 167 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 168 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 169 | 42 |  |         return new ArrayIterator(array_reverse($this->list)); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 170 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 171 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 172 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 173 |  |  |      * Number of items in list. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 174 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 175 | 42 |  |     public function count(): int | 
            
                                                                                                            
                            
            
                                    
            
            
                | 176 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 177 | 42 |  |         return count($this->list); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 178 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 179 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 180 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 181 |  |  |      * Does this list contain items with constrained placement criteria. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 182 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 183 | 41 |  |     public function hasConstrainedItems(): bool | 
            
                                                                                                            
                            
            
                                    
            
            
                | 184 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 185 | 41 |  |         if (!isset($this->hasConstrainedItems)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 186 | 17 |  |             $this->hasConstrainedItems = false; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 187 | 17 |  |             foreach ($this->list as $item) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 188 | 17 |  |                 if ($item instanceof ConstrainedPlacementItem) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 189 |  |  |                     $this->hasConstrainedItems = true; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 190 |  |  |                     break; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 191 |  |  |                 } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 192 |  |  |             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 193 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 194 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 195 | 41 |  |         return $this->hasConstrainedItems; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 196 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 197 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 198 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 199 |  |  |      * Does this list contain items which cannot be rotated. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 200 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 201 | 41 |  |     public function hasNoRotationItems(): bool | 
            
                                                                                                            
                            
            
                                    
            
            
                | 202 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 203 | 41 |  |         if (!isset($this->hasNoRotationItems)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 204 | 17 |  |             $this->hasNoRotationItems = false; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 205 | 17 |  |             foreach ($this->list as $item) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 206 | 17 |  |                 if ($item->getAllowedRotations() === Item::ROTATION_NEVER) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 207 |  |  |                     $this->hasNoRotationItems = true; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 208 |  |  |                     break; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 209 |  |  |                 } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 210 |  |  |             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 211 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 212 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 213 | 41 |  |         return $this->hasNoRotationItems; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 214 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 215 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 216 | 40 |  |     private static function compare(Item $itemA, Item $itemB): int | 
            
                                                                                                            
                            
            
                                    
            
            
                | 217 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 218 | 40 |  |         $volumeDecider = $itemA->getWidth() * $itemA->getLength() * $itemA->getDepth() <=> $itemB->getWidth() * $itemB->getLength() * $itemB->getDepth(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 219 | 40 |  |         if ($volumeDecider !== 0) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 220 | 23 |  |             return $volumeDecider; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 221 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 222 | 36 |  |         $weightDecider = $itemA->getWeight() - $itemB->getWeight(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 223 | 36 |  |         if ($weightDecider !== 0) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 224 | 4 |  |             return $weightDecider; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 225 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 226 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 227 | 32 |  |         return $itemB->getDescription() <=> $itemA->getDescription(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 228 |  |  |     } | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 229 |  |  | } | 
            
                                                        
            
                                    
            
            
                | 230 |  |  |  |