Changeset 3190768
- Timestamp:
- 11/17/2024 07:42:19 PM (17 months ago)
- Location:
- user-post-collections
- Files:
-
- 34 added
- 64 edited
- 1 copied
-
tags/0.9.0 (copied) (copied from user-post-collections/trunk)
-
tags/0.9.0/alt-models/mg-list-items-model.php (modified) (3 diffs)
-
tags/0.9.0/alt-models/mg-list-model.php (modified) (18 diffs)
-
tags/0.9.0/alt-models/mg-list-votes-model.php (modified) (9 diffs)
-
tags/0.9.0/classes/mg-list-page-alt-settings.php (added)
-
tags/0.9.0/classes/mg-upc-database.php (modified) (12 diffs)
-
tags/0.9.0/classes/mg-upc-list-types-register.php (modified) (1 diff)
-
tags/0.9.0/classes/mg-upc-query.php (added)
-
tags/0.9.0/classes/mg-upc-settings.php (modified) (4 diffs)
-
tags/0.9.0/classes/user-post-collections.php (modified) (2 diffs)
-
tags/0.9.0/controllers/mg-list-page-alt.php (modified) (25 diffs)
-
tags/0.9.0/controllers/mg-upc-list-controller.php (modified) (10 diffs)
-
tags/0.9.0/controllers/mg-upc-rest-list-controller.php (modified) (8 diffs)
-
tags/0.9.0/controllers/mg-upc-rest-list-items-controller.php (modified) (4 diffs)
-
tags/0.9.0/controllers/mg-upc-woocommerce.php (modified) (5 diffs)
-
tags/0.9.0/includes/list-types.php (modified) (2 diffs)
-
tags/0.9.0/includes/mg-upc-helper.php (modified) (2 diffs)
-
tags/0.9.0/includes/mg-upc-list-type.php (modified) (4 diffs)
-
tags/0.9.0/includes/mg-upc-list.php (added)
-
tags/0.9.0/includes/mg-upc-settings-api.php (modified) (24 diffs)
-
tags/0.9.0/includes/mg-upc-shortcode.php (added)
-
tags/0.9.0/includes/template-functions.php (modified) (3 diffs)
-
tags/0.9.0/includes/template-hooks.php (modified) (2 diffs)
-
tags/0.9.0/includes/themes-helper.php (modified) (2 diffs)
-
tags/0.9.0/includes/utils.php (modified) (4 diffs)
-
tags/0.9.0/javascript/mg-upc-client/dist/admin.js (modified) (1 diff)
-
tags/0.9.0/javascript/mg-upc-client/dist/css/styles.css (modified) (1 diff)
-
tags/0.9.0/javascript/mg-upc-client/dist/main.js (modified) (1 diff)
-
tags/0.9.0/readme.txt (modified) (4 diffs)
-
tags/0.9.0/templates/archive-404.php (added)
-
tags/0.9.0/templates/archive-mg-upc.php (added)
-
tags/0.9.0/templates/content-archive-mg-upc.php (added)
-
tags/0.9.0/templates/content-single-mg-upc.php (modified) (2 diffs)
-
tags/0.9.0/templates/loop (added)
-
tags/0.9.0/templates/loop/empty.php (added)
-
tags/0.9.0/templates/loop/list (added)
-
tags/0.9.0/templates/loop/list/author.php (added)
-
tags/0.9.0/templates/loop/list/description.php (added)
-
tags/0.9.0/templates/loop/list/items.php (added)
-
tags/0.9.0/templates/loop/list/meta.php (added)
-
tags/0.9.0/templates/loop/list/title.php (added)
-
tags/0.9.0/templates/loop/pagination.php (added)
-
tags/0.9.0/templates/mg-upc-wc/single-all-cart-buttons.php (modified) (1 diff)
-
tags/0.9.0/templates/single-mg-upc/description.php (modified) (1 diff)
-
tags/0.9.0/templates/single-mg-upc/empty-items.php (added)
-
tags/0.9.0/templates/single-mg-upc/items.php (modified) (1 diff)
-
tags/0.9.0/templates/single-mg-upc/pagination.php (modified) (2 diffs)
-
tags/0.9.0/templates/single-mg-upc/title.php (modified) (1 diff)
-
tags/0.9.0/uninstall.php (modified) (1 diff)
-
tags/0.9.0/user-post-collections.php (modified) (6 diffs)
-
trunk/alt-models/mg-list-items-model.php (modified) (3 diffs)
-
trunk/alt-models/mg-list-model.php (modified) (18 diffs)
-
trunk/alt-models/mg-list-votes-model.php (modified) (9 diffs)
-
trunk/classes/mg-list-page-alt-settings.php (added)
-
trunk/classes/mg-upc-database.php (modified) (12 diffs)
-
trunk/classes/mg-upc-list-types-register.php (modified) (1 diff)
-
trunk/classes/mg-upc-query.php (added)
-
trunk/classes/mg-upc-settings.php (modified) (4 diffs)
-
trunk/classes/user-post-collections.php (modified) (2 diffs)
-
trunk/controllers/mg-list-page-alt.php (modified) (25 diffs)
-
trunk/controllers/mg-upc-list-controller.php (modified) (10 diffs)
-
trunk/controllers/mg-upc-rest-list-controller.php (modified) (8 diffs)
-
trunk/controllers/mg-upc-rest-list-items-controller.php (modified) (4 diffs)
-
trunk/controllers/mg-upc-woocommerce.php (modified) (5 diffs)
-
trunk/includes/list-types.php (modified) (2 diffs)
-
trunk/includes/mg-upc-helper.php (modified) (2 diffs)
-
trunk/includes/mg-upc-list-type.php (modified) (4 diffs)
-
trunk/includes/mg-upc-list.php (added)
-
trunk/includes/mg-upc-settings-api.php (modified) (24 diffs)
-
trunk/includes/mg-upc-shortcode.php (added)
-
trunk/includes/template-functions.php (modified) (3 diffs)
-
trunk/includes/template-hooks.php (modified) (2 diffs)
-
trunk/includes/themes-helper.php (modified) (2 diffs)
-
trunk/includes/utils.php (modified) (4 diffs)
-
trunk/javascript/mg-upc-client/dist/admin.js (modified) (1 diff)
-
trunk/javascript/mg-upc-client/dist/css/styles.css (modified) (1 diff)
-
trunk/javascript/mg-upc-client/dist/main.js (modified) (1 diff)
-
trunk/readme.txt (modified) (4 diffs)
-
trunk/templates/archive-404.php (added)
-
trunk/templates/archive-mg-upc.php (added)
-
trunk/templates/content-archive-mg-upc.php (added)
-
trunk/templates/content-single-mg-upc.php (modified) (2 diffs)
-
trunk/templates/loop (added)
-
trunk/templates/loop/empty.php (added)
-
trunk/templates/loop/list (added)
-
trunk/templates/loop/list/author.php (added)
-
trunk/templates/loop/list/description.php (added)
-
trunk/templates/loop/list/items.php (added)
-
trunk/templates/loop/list/meta.php (added)
-
trunk/templates/loop/list/title.php (added)
-
trunk/templates/loop/pagination.php (added)
-
trunk/templates/mg-upc-wc/single-all-cart-buttons.php (modified) (1 diff)
-
trunk/templates/single-mg-upc/description.php (modified) (1 diff)
-
trunk/templates/single-mg-upc/empty-items.php (added)
-
trunk/templates/single-mg-upc/items.php (modified) (1 diff)
-
trunk/templates/single-mg-upc/pagination.php (modified) (2 diffs)
-
trunk/templates/single-mg-upc/title.php (modified) (1 diff)
-
trunk/uninstall.php (modified) (1 diff)
-
trunk/user-post-collections.php (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
user-post-collections/tags/0.9.0/alt-models/mg-list-items-model.php
r2768965 r3190768 99 99 100 100 /** 101 * List list items101 * List the list items 102 102 * 103 103 * @param array $args Array with filters and configuration … … 182 182 $sql .= ' LIMIT %d, %d'; 183 183 $prepare[] = (int) $offset; 184 $prepare[] = (int) $args['items_per_page'];185 184 } else { 186 $sql .= ' LIMIT %d'; 187 $prepare[] = (int) $args['items_per_page']; 185 $sql .= ' LIMIT %d'; 188 186 } 187 $prepare[] = (int) $args['items_per_page']; 189 188 } 190 189 … … 388 387 389 388 /** 390 * Get an listitem389 * Get item 391 390 * 392 391 * @param int $list_id -
user-post-collections/tags/0.9.0/alt-models/mg-list-model.php
r2768965 r3190768 139 139 140 140 $defaults = array( 141 'limit' => 20, 142 'page' => 1, 141 'limit' => 20, 142 'page' => 1, 143 'fields' => array(), 143 144 ); 144 145 $args = array_merge( $defaults, $args ); … … 152 153 $where = array(); 153 154 $prepare = array(); 155 156 $select_valid = array( 157 'ID', 158 'slug', 159 'title', 160 'content', 161 'author', 162 'type', 163 'status', 164 'count', 165 'views', 166 'vote_counter', 167 'created', 168 'modified', 169 ); 154 170 155 171 //compare only support with array=false … … 159 175 'array' => true, 160 176 ), 177 'not_ID' => array( 178 'type' => 'int', 179 'array' => true, 180 'db_column' => 'ID', 181 'compare' => 'NOT IN', 182 ), 161 183 'slug' => array( 162 184 'type' => 'string', 163 185 'array' => true, 164 186 ), 187 'not_slug' => array( 188 'type' => 'string', 189 'array' => true, 190 'db_column' => 'slug', 191 'compare' => 'NOT IN', 192 ), 165 193 'author' => array( 166 194 'type' => 'int', 167 195 'array' => true, 196 ), 197 'not_author' => array( 198 'type' => 'int', 199 'array' => true, 200 'db_column' => 'author', 201 'compare' => 'NOT IN', 168 202 ), 169 203 'type' => array( … … 173 207 'any' => 'any', 174 208 ), 209 'not_type' => array( 210 'type' => 'string', 211 'array' => true, 212 'db_column' => 'type', 213 'valid' => $this->valid_types( true ), 214 'compare' => 'NOT IN', 215 ), 175 216 'status' => array( 176 217 'type' => 'string', … … 203 244 'db_column' => 'modified', 204 245 ), 246 'year' => array( 247 'type' => 'date_function', 248 'db_func' => 'YEAR', 249 'array' => true, 250 'db_column' => 'created', 251 ), 252 'day' => array( 253 'type' => 'date_function', 254 'db_func' => 'DAYOFMONTH', 255 'array' => true, 256 'db_column' => 'created', 257 'valid' => range( 1, 31 ), 258 ), 259 'hour' => array( 260 'type' => 'date_function', 261 'db_func' => 'HOUR', 262 'array' => true, 263 'db_column' => 'created', 264 'valid' => range( 0, 23 ), 265 ), 266 'minute' => array( 267 'type' => 'date_function', 268 'db_func' => 'MINUTE', 269 'array' => true, 270 'db_column' => 'created', 271 'valid' => range( 0, 59 ), 272 ), 273 'second' => array( 274 'type' => 'date_function', 275 'db_func' => 'SECOND', 276 'array' => true, 277 'db_column' => 'created', 278 'valid' => range( 0, 59 ), 279 ), 280 'weekday' => array( 281 'type' => 'date_function', 282 'db_func' => 'WEEKDAY', 283 'array' => true, 284 'db_column' => 'created', 285 'valid' => range( 0, 6 ), 286 ), 287 'weekofyear' => array( 288 'type' => 'date_function', 289 'db_func' => 'WEEKOFYEAR', 290 'array' => true, 291 'db_column' => 'created', 292 'valid' => range( 0, 53 ), 293 ), 294 'month' => array( 295 'type' => 'date_function', 296 'db_func' => 'MONTH', 297 'array' => true, 298 'db_column' => 'created', 299 'valid' => range( 1, 12 ), 300 ), 205 301 ); 206 302 … … 209 305 210 306 if ( ! empty( $args[ $prop ] ) ) { 211 $db_column = isset( $filter['db_column'] ) ? $filter['db_column'] :$prop;212 $compare = isset( $filter['compare'] ) ? $filter['compare'] :'=';307 $db_column = $filter['db_column'] ?? $prop; 308 $compare = $filter['compare'] ?? '='; 213 309 $single_value = null; 214 310 … … 240 336 $where_values = array(); 241 337 foreach ( $args[ $prop ] as $value ) { 242 if ( 'int' === $filter['type'] ) { 243 if ( ! empty( $filter['valid'] ) && ! in_array( (int) $value, $filter['valid'], true ) ) { 338 if ( 'int' === $filter['type'] || 'date_function' === $filter['type'] ) { 339 if ( 340 ! empty( $filter['valid'] ) && 341 ! in_array( (int) $value, $filter['valid'], true ) 342 ) { 244 343 throw new MG_UPC_Invalid_Field_Exception( 245 344 'Invalid field ' . $prop . '.', … … 277 376 } 278 377 279 $where[] = '( `' . $db_column . '` IN (' . implode( ',', $where_values ) . '))'; 378 if ( ! in_array( $compare, array( 'IN', 'NOT IN' ), true ) ) { 379 $compare = 'IN'; 380 } 381 382 if ( ! empty( $filter['db_func'] ) ) { 383 $where[] = '( ' . $filter['db_func'] . '(`' . $db_column . '`) IN ' . 384 ' (' . implode( ',', $where_values ) . '))'; 385 } else { 386 $where[] = '( `' . $db_column . '` ' . $compare . ' (' . implode( ',', $where_values ) . '))'; 387 } 280 388 281 389 continue; //end count( $args[ $prop ] ) > 1 … … 291 399 //single value 292 400 if ( isset( $single_value ) ) { 293 if ( 'int' === $filter['type'] ) { 294 $where[] = '`' . $db_column . '` ' . $compare . ' %d'; 295 $prepare[] = (int) $single_value; 401 if ( 'IN' === $compare ) { 402 $compare = '='; 403 } elseif ( 'NOT IN' === $compare ) { 404 $compare = '!='; 405 } 406 $where_value = '%s'; 407 if ( 'int' === $filter['type'] || 'date_function' === $filter['type'] ) { 408 $where_value = '%d'; 409 $prepare[] = (int) $single_value; 296 410 } elseif ( 'string' === $filter['type'] ) { 297 $where[] = '`' . $db_column . '` ' . $compare . ' %s';298 411 $prepare[] = $single_value; 299 412 } elseif ( 'datetime' === $filter['type'] ) { … … 307 420 ); 308 421 } 309 $where[] = '`' . $db_column . '` ' . $compare . ' %s';310 422 $prepare[] = gmdate( 'Y-m-d H:i:s', $datetime ); 423 } 424 if ( ! empty( $filter['db_func'] ) ) { 425 $where[] = $filter['db_func'] . '(`' . $db_column . '`) ' . $compare . ' ' . $where_value; 426 } else { 427 $where[] = '`' . $db_column . '` ' . $compare . ' ' . $where_value; 311 428 } 312 429 } … … 322 439 323 440 $select_count = 'SELECT COUNT(*) FROM `' . $this->get_table_list() . '` '; 324 $select = 'SELECT * FROM `' . $this->get_table_list() . '` '; 325 $sql = ''; 441 442 $select_fields = array_intersect( $select_valid, $args['fields'] ); 443 if ( empty( $select_fields ) ) { 444 $select = 'SELECT * FROM `' . $this->get_table_list() . '` '; 445 } else { 446 $select = 'SELECT ' . implode( ',', $select_fields ) . ' FROM `' . $this->get_table_list() . '` '; 447 } 448 449 $sql = ''; 326 450 327 451 if ( ! empty( $where ) ) { … … 331 455 $args['page'] = max( intval( $args['page'] ), 1 ); 332 456 333 if ( $args['limit'] > 1 ) { //for find one not run count query and not set order 457 if ( $args['limit'] > 1 ) { //for find one not run count query and not set order. What?? FIXME 334 458 $sql_pin_query = ''; 335 459 if ( false !== $args['pined'] ) { … … 347 471 'created', 348 472 'modified', 473 'title', 349 474 ), 350 475 true … … 353 478 $sql_pin_query = $sql_pin_query ? $sql_pin_query . ', ' : ''; 354 479 $sql .= ' ORDER BY ' . $sql_pin_query . $args['orderby']; 355 if ( isset( $args['order'] ) && 'desc' === $args['order']) {480 if ( isset( $args['order'] ) && 'desc' === strtolower( $args['order'] ) ) { 356 481 $sql .= ' DESC'; 357 482 } else { 358 483 $sql .= ' ASC'; 359 484 } 360 } elseif ( false !== $sql_pin_query) {485 } elseif ( ! empty( $sql_pin_query ) ) { 361 486 $sql .= ' ORDER BY ' . $sql_pin_query; 362 487 } … … 375 500 $sql .= ' LIMIT %d, %d'; 376 501 $prepare[] = max( 0, (int) $args['offset'] ); 377 $prepare[] = $args['limit'];378 502 } elseif ( $args['page'] > 1 ) { 379 503 $offset = $args['limit'] * ( $args['page'] - 1 ); … … 381 505 $sql .= ' LIMIT %d, %d'; 382 506 $prepare[] = $offset; 383 $prepare[] = $args['limit'];384 507 } else { 385 $sql .= ' LIMIT %d'; 386 $prepare[] = $args['limit']; 508 $sql .= ' LIMIT %d'; 387 509 } 510 $prepare[] = $args['limit']; 388 511 } 389 512 $results = $wpdb->get_results( … … 463 586 } 464 587 $user = get_user_by( 'id', $args['author'] ); 465 if ( false === $user ->ID) {588 if ( false === $user ) { 466 589 throw new MG_UPC_Invalid_Field_Exception( 'Invalid author.', 0, null, 'author' ); 467 590 } … … 575 698 if ( ! empty( $args['author'] ) ) { 576 699 $user = get_user_by( 'id', $args['author'] ); 577 if ( false === $user ->ID) {700 if ( false === $user ) { 578 701 throw new MG_UPC_Invalid_Field_Exception( 'Invalid author.', 0, null, 'author' ); 579 702 } -
user-post-collections/tags/0.9.0/alt-models/mg-list-votes-model.php
r2768965 r3190768 25 25 function( $list_id, $post_id ) { 26 26 $user_id = get_current_user_id(); 27 $this->add_vote( $list_id, $post_id, $user_id ); 27 try { 28 $this->add_vote( $list_id, $post_id, $user_id ); 29 } catch ( MG_UPC_Invalid_Field_Exception $e ) { 30 mg_upc_error_log( 'Error, inavlid field: ' . $e->getMessage() ); 31 } catch ( MG_UPC_Item_Not_Found_Exception $e ) { 32 mg_upc_error_log( 'Error, item not found: ' . $e->getMessage() ); 33 } 28 34 }, 29 35 10, … … 114 120 * List User Votes 115 121 * 116 * @param bool $filters117 * @param int $page Set to 0 for only run count query118 * @param int $votes_per_page119 * @param string $orderby120 * @param string $order122 * @param bool|array $filters 123 * @param int $page Set to 0 for only run count query 124 * @param int $votes_per_page 125 * @param string $orderby 126 * @param string $order 121 127 * 122 128 * @return array … … 138 144 $order = strtolower( $order ); 139 145 140 $int_filters = array( 'list_id', 'post_id', 'user_id' ); 141 foreach ( $int_filters as $prop ) { 142 if ( ! empty( $filters[ $prop ] ) ) { 143 $filters[ $prop ] = (int) $filters[ $prop ]; 144 if ( ! $filters[ $prop ] ) { 145 throw new MG_UPC_Invalid_Field_Exception( 'Invalid filter value.' ); 146 if ( false !== $filters ) { 147 $int_filters = array( 'list_id', 'post_id', 'user_id' ); 148 foreach ( $int_filters as $prop ) { 149 if ( ! empty( $filters[ $prop ] ) ) { 150 $filters[ $prop ] = (int) $filters[ $prop ]; 151 if ( ! $filters[ $prop ] ) { 152 throw new MG_UPC_Invalid_Field_Exception( 'Invalid filter value.' ); 153 } 146 154 } 147 155 } … … 163 171 $prepare = array(); 164 172 165 foreach ( $int_filters as $prop ) { 166 if ( ! empty( $filters[ $prop ] ) ) { 167 $where[] = '`' . $prop . '` = %d'; 168 $prepare[] = $filters[ $prop ]; 169 } 170 } 171 172 if ( ! empty( $filters['ip'] ) ) { 173 $where[] = '`ip` = %s'; 174 $prepare[] = $filters['ip']; 173 if ( false !== $filters ) { 174 foreach ( $int_filters as $prop ) { 175 if ( ! empty( $filters[ $prop ] ) ) { 176 $where[] = '`' . $prop . '` = %d'; 177 $prepare[] = $filters[ $prop ]; 178 } 179 } 180 181 if ( ! empty( $filters['ip'] ) ) { 182 $where[] = '`ip` = %s'; 183 $prepare[] = $filters['ip']; 184 } 175 185 } 176 186 … … 191 201 'votes' => array(), 192 202 'total' => $total, 193 'total_pages' => $votes_per_page > 0 ? ceil( $total / $votes_per_page ) : 1,203 'total_pages' => ceil( $total / $votes_per_page ), 194 204 'current' => 0, 195 205 ); … … 199 209 if ( ! empty( $orderby ) ) { 200 210 $sql .= ' ORDER BY ' . $orderby; 201 if ( isset( $order ) &&'desc' === $order ) {211 if ( 'desc' === $order ) { 202 212 $sql .= ' DESC'; 203 213 } else { … … 213 223 $sql .= ' LIMIT %d, %d'; 214 224 $prepare[] = (int) $offset; 215 $prepare[] = (int) $votes_per_page;216 225 } else { 217 $sql .= ' LIMIT %d';218 $prepare[] = (int) $votes_per_page;219 }226 $sql .= ' LIMIT %d'; 227 } 228 $prepare[] = (int) $votes_per_page; 220 229 } 221 230 … … 292 301 293 302 /** 294 * Get the vote of a nuser for a list303 * Get the vote of a user for a list 295 304 * 296 305 * @param int $list_id … … 323 332 324 333 /** 325 * Count votes of a nuser for a list334 * Count votes of a user for a list 326 335 * 327 336 * @param int $list_id The list ID -
user-post-collections/tags/0.9.0/classes/mg-upc-database.php
r2770005 r3190768 48 48 /** @global MG_UPC_List_Type[] $mg_upc_list_types Global array with list types. */ 49 49 global $mg_upc_list_types; 50 $list_types_to_delete = array(); 50 51 if ( null === $reassign ) { 51 $list_types_to_delete = array();52 52 foreach ( $mg_upc_list_types as $list_type ) { 53 53 if ( $list_type->delete_with_user() ) { 54 54 $list_types_to_delete[] = $list_type->name; 55 } else {56 $list_types_to_delete[] = $list_type->name;57 55 } 58 56 } 59 $mg_upc->model->deleted_all_from_user( $id, $list_types_to_delete );60 57 } else { 61 58 //search for reassign or delete list ( always_exists list types that already has the reassign user) 62 $list_types_to_delete = array();63 59 $list_types_to_reassign = array(); 64 60 foreach ( $mg_upc_list_types as $list_type ) { … … 71 67 } 72 68 } catch ( MG_UPC_Invalid_Field_Exception $e ) { 73 error_log( 'MG_UPC: Error on delete list of removed user.' );69 mg_upc_error_log( 'MG_UPC: Error on delete list of removed user.' ); 74 70 } 75 71 } else { … … 78 74 } 79 75 $mg_upc->model->reassign_all_from_user( $id, $reassign, $list_types_to_reassign ); 80 $mg_upc->model->deleted_all_from_user( $id, $list_types_to_delete );81 }76 } 77 $mg_upc->model->deleted_all_from_user( $id, $list_types_to_delete ); 82 78 } 83 79 … … 113 109 114 110 if ( ! empty( $wpdb->charset ) ) { 115 $charset_collate = "DEFAULT CHARACTER SET {$wpdb->charset}";111 $charset_collate = "DEFAULT CHARACTER SET $wpdb->charset "; 116 112 } 117 113 118 114 if ( ! empty( $wpdb->collate ) ) { 119 $charset_collate .= "COLLATE {$wpdb->collate}";115 $charset_collate .= "COLLATE $wpdb->collate"; 120 116 } 121 117 … … 124 120 125 121 $sql = " 126 CREATE TABLE {$table_lists}(122 CREATE TABLE $table_lists ( 127 123 ID bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, 128 124 author bigint(20) DEFAULT NULL, … … 141 137 KEY type_status_created (type,status,created,ID), 142 138 KEY author_type (author,type) 143 ) {$charset_collate}ENGINE=InnoDB;";139 ) $charset_collate ENGINE=InnoDB;"; 144 140 145 141 require_once ABSPATH . 'wp-admin/includes/upgrade.php'; 146 142 dbDelta( $sql ); 147 143 148 $sql = "CREATE TABLE {$table_items}(144 $sql = "CREATE TABLE $table_items ( 149 145 list_id bigint(20) UNSIGNED NOT NULL, 150 146 post_id bigint(20) UNSIGNED NOT NULL, … … 157 153 KEY list_position (list_id,position), 158 154 KEY list_votes (list_id,votes) 159 ) {$charset_collate}ENGINE=InnoDB;";155 ) $charset_collate ENGINE=InnoDB;"; 160 156 161 157 dbDelta( $sql ); … … 175 171 176 172 if ( ! empty( $wpdb->charset ) ) { 177 $charset_collate = "DEFAULT CHARACTER SET {$wpdb->charset}";173 $charset_collate = "DEFAULT CHARACTER SET $wpdb->charset "; 178 174 } 179 175 180 176 if ( ! empty( $wpdb->collate ) ) { 181 $charset_collate .= "COLLATE {$wpdb->collate}";177 $charset_collate .= "COLLATE $wpdb->collate"; 182 178 } 183 179 … … 185 181 186 182 $sql = " 187 CREATE TABLE {$table_votes}(183 CREATE TABLE $table_votes ( 188 184 list_id bigint(20) UNSIGNED NOT NULL, 189 185 post_id bigint(20) UNSIGNED NOT NULL, … … 195 191 KEY post_id (post_id), 196 192 KEY list_post (list_id, post_id) 197 ) {$charset_collate}ENGINE=InnoDB;";193 ) $charset_collate ENGINE=InnoDB;"; 198 194 199 195 require_once ABSPATH . 'wp-admin/includes/upgrade.php'; … … 208 204 $table_items = $mg_upc->model->items->get_table_list_items(); 209 205 //phpcs:ignore 210 $wpdb->query( "ALTER TABLE {$table_items}ADD `quantity` int(11) UNSIGNED NOT NULL DEFAULT 0 AFTER `votes`;" );206 $wpdb->query( "ALTER TABLE $table_items ADD `quantity` int(11) UNSIGNED NOT NULL DEFAULT 0 AFTER `votes`;" ); 211 207 } 212 208 … … 218 214 $table_items = $mg_upc->model->items->get_table_list_items(); 219 215 //phpcs:ignore 220 $wpdb->query( "ALTER TABLE {$table_items}ADD `addon_json` longtext DEFAULT NULL AFTER `description`;" );216 $wpdb->query( "ALTER TABLE $table_items ADD `addon_json` longtext DEFAULT NULL AFTER `description`;" ); 221 217 } 222 218 } -
user-post-collections/tags/0.9.0/classes/mg-upc-list-types-register.php
r2768965 r3190768 105 105 'show_in_settings', 106 106 ), 107 ' default_supports'=> array(107 'supports' => array( 108 108 'editable_item_description', 109 109 'show_in_my_lists', 110 'always_exists', //this create an end point with bookmarks instead the ID110 'always_exists', 111 111 'show_in_settings', 112 112 ), -
user-post-collections/tags/0.9.0/classes/mg-upc-settings.php
r2856776 r3190768 297 297 // translators: not change %title%, %author%, %sitename% 298 298 'desc' => __( 'You can use %title%, %author%, %sitename%.', 'user-post-collections' ), 299 'default' => '%title% by %author% | User List | %sitename%',299 'default' => '%title% by %author% | User Lists | %sitename%', 300 300 'type' => 'text', 301 301 ); … … 308 308 'type' => 'radio', 309 309 'options' => array( 310 'off' => __( 'Non store', 'user-post-collections' ),311 'on' => __( 'Store IP', 'user-post-collections' ),310 'off' => __( 'Non store', 'user-post-collections' ), 311 'on' => __( 'Store IP', 'user-post-collections' ), 312 312 ), 313 313 ); … … 616 616 'mg_up_roles', 617 617 'mg_up_roles' . $list_type->name . '_err', 618 "Invalid role {$role_slug}"618 "Invalid role $role_slug" 619 619 ); 620 620 continue; … … 998 998 * Sanitize number option 999 999 * 1000 * @param $value1001 * @param $option1002 * @param $original_value1003 * @param $config1000 * @param mixed $value 1001 * @param string $option 1002 * @param int|float $original_value 1003 * @param array $config 1004 1004 * 1005 1005 * @return int|float -
user-post-collections/tags/0.9.0/classes/user-post-collections.php
r2856778 r3190768 35 35 'MG_UPC_List_Controller' => MG_UPC_List_Controller::get_instance(), 36 36 'MG_UPC_List_Page' => MG_UPC_List_Page::get_instance(), 37 'MG_UPC_List_Page_Settings' => MG_UPC_List_Page_Settings::get_instance(), 37 38 'MG_UPC_Database' => MG_UPC_Database::get_instance(), 38 39 'MG_UPC_Rest_API' => MG_UPC_Rest_API::get_instance(), 39 40 'MG_UPC_Buttons' => MG_UPC_Buttons::get_instance(), 40 41 'MG_UPC_Woocommerce' => MG_UPC_Woocommerce::get_instance(), 42 'MG_UPC_Shortcode' => MG_UPC_Shortcode::get_instance(), 41 43 ); 42 44 … … 251 253 $module->init(); 252 254 } 255 if ( get_option( 'mg_upc_flush_rewrite', '0' ) === '1' ) { 256 update_option( 'mg_upc_flush_rewrite', '0' ); 257 flush_rewrite_rules(); 258 } 253 259 } 254 260 -
user-post-collections/tags/0.9.0/controllers/mg-list-page-alt.php
r2770186 r3190768 8 8 private static $page_id = 0; 9 9 10 public function __construct() { } 10 private static $doing_shortcodes = false; 11 12 public function __construct() { 13 // Add base url hook 14 add_filter( 'mg_upc_base_url', array( 'MG_UPC_List_Page', 'base_url_filter' ), 10, 1 ); 15 } 11 16 12 17 public function init() { 13 18 14 //Search page saved as collection single page (Created on the activate )19 //Search page saved as collection single page (Created on the activated) 15 20 self::$page_id = self::get_page_id(); 16 21 17 22 if ( self::$page_id > 0 ) { 18 // Add query vars for collection page : list and list-page (for pagination)23 // Add query vars for collection page. Example: list and list-page (for pagination) 19 24 add_filter( 'query_vars', array( $this, 'add_list_query_var' ) ); 20 25 // Add the rewrite rule using slug from $page_id 21 $this->add_rewrite(); 22 if ( get_option( 'mg_upc_flush_rewrite', '0' ) === '1' ) { 23 update_option( 'mg_upc_flush_rewrite', '0' ); 24 flush_rewrite_rules(); 25 } 26 } 27 28 if ( is_admin() ) { 29 add_filter( 'mg_upc_settings_fields', array( $this, 'add_settings_fields' ) ); 30 add_action( 'save_post_page', array( $this, 'save_post_page' ), 10, 1 ); 26 self::add_rewrite(); 31 27 } 32 28 … … 45 41 add_filter( 'wpseo_opengraph_url', array( $this, 'list_canonical' ), 10, 2 ); 46 42 add_filter( 'prepare_list_data_for_response', array( $this, 'add_link_to_list_response' ) ); 43 add_filter( 'mg_upc_get_the_permalink', array( $this, 'filter_get_the_permalink' ), 10, 2 ); 44 add_filter( 'mg_upc_list_url', array( $this, 'mg_upc_list_url' ), 10, 2 ); 47 45 48 46 /* Image Hook*/ … … 50 48 51 49 /* Shortcode */ 52 add_shortcode( 'user_post_collection', array( $this, ' list_shortcode' ) );50 add_shortcode( 'user_post_collection', array( $this, 'page_shortcode' ) ); 53 51 54 52 /* Templates hook */ … … 58 56 59 57 /* Set global $mg_upc_list if query a collection*/ 60 add_action( 'parse_request', array( $this, 'parse_request' ), 10, 1 );58 add_action( 'parse_request', array( $this, 'parse_request' ), 90, 1 ); 61 59 62 60 /* Remove page links from head */ 63 61 add_action( 'template_redirect', array( $this, 'remove_links' ) ); 64 65 // Add a post display state for special page. 66 add_filter( 'display_post_states', array( $this, 'add_display_post_states' ), 10, 2 ); 67 68 } 69 70 public function save_post_page( $post_id ) { 71 if ( $post_id === self::$page_id ) { 72 $this->add_rewrite(); 73 flush_rewrite_rules(); 74 } 75 } 76 77 /** 78 * Add a post display state for special page in the page list table. 79 * 80 * @param array $post_states An array of post display states. 81 * @param WP_Post $post The current post object. 82 * 83 * @return array 84 */ 85 public function add_display_post_states( $post_states, $post ) { 86 if ( self::$page_id === $post->ID ) { 87 $post_states['mg_upc_page_for_list'] = __( 'User Post Collection Page', 'user-post-collections' ); 88 } 89 90 return $post_states; 91 } 92 93 /** 94 * If a list is requested load global $mg_upc_list 62 } 63 64 /** 65 * If list page is requested set variables 95 66 * 96 67 * @param $query … … 99 70 */ 100 71 public function parse_request( $query ) { 72 global $mg_upc_the_query; 73 if ( ! empty( $query->query_vars['pagename'] ) ) { 74 $page = WP_Post::get_instance( self::$page_id ); 75 if ( $page && $page->post_name === $query->query_vars['pagename'] ) { 76 $query->query_vars['page_id'] = self::$page_id; 77 } 78 } 79 101 80 if ( 102 81 isset( $query->query_vars['page_id'] ) && 103 (int) self::$page_id === (int) $query->query_vars['page_id'] && 104 isset( $query->query_vars['list'] ) 82 (int) self::$page_id === (int) $query->query_vars['page_id'] 105 83 ) { 106 $this->get_list_requested( false ); 107 remove_filter( 'the_content', array( 'MG_UPC_Buttons', 'the_content' ) ); 108 } 109 84 $atts = array(); 85 if ( isset( $query->query_vars['list'] ) ) { 86 if ( is_int( $query->query_vars['list'] ) ) { 87 $atts['ID'] = $query->query_vars['list']; 88 } elseif ( is_string( $query->query_vars['list'] ) ) { 89 $atts['name'] = $query->query_vars['list']; 90 } 91 $atts['lists_per_page'] = 1; 92 } elseif ( 'on' === get_option( 'mg_upc_archive_enable', 'on' ) ) { 93 if ( 'on' === get_option( 'mg_upc_archive_filter_author', 'on' ) ) { 94 $atts['author'] = $query->query_vars['list-author'] ?? ''; 95 $atts['author_name'] = $query->query_vars['list-author-name'] ?? ''; 96 } 97 if ( 'on' === get_option( 'mg_upc_archive_filter_type', 'on' ) ) { 98 $atts['list_type'] = $query->query_vars['list-type'] ?? ''; 99 } 100 $atts['paged'] = $query->query_vars['lists-page'] ?? 1; 101 $atts['orderby'] = $query->query_vars['lists-orderby'] ?? ''; 102 $atts['order'] = $query->query_vars['lists-order'] ?? ''; 103 $atts['lists_per_page'] = get_option( 'mg_upc_archive_item_per_page', 12 ); 104 } else { 105 return $query; 106 } 107 $mg_upc_the_query = new MG_UPC_Query( $atts ); 108 109 if ( $mg_upc_the_query->is_single() ) { 110 remove_filter( 'the_content', array( 'MG_UPC_Buttons', 'the_content' ) ); 111 } 112 } 110 113 return $query; 111 114 } … … 114 117 * Set the collection "single" url 115 118 */ 116 public function add_rewrite() { 117 if ( self::$page_id > 0 ) { 118 $list_page_link = get_page_link( self::$page_id ); 119 if ( ! empty( $list_page_link ) ) { 120 $reg = '^' . trim( wp_make_link_relative( $list_page_link ), '/' ) . '/([A-Za-z0-9\._\-@ ]+)/?$'; 121 add_rewrite_rule( 122 $reg, 123 'index.php?page_id=' . self::$page_id . '&post_type=page&list=$matches[1]', 124 'top' 125 ); 126 } 119 public static function add_rewrite() { 120 $base_url = self::get_base_url( true ); 121 if ( ! empty( $base_url ) && self::$page_id > 0 ) { 122 $reg = '^' . trim( $base_url, '/' ) . '/([A-Za-z0-9\._\-@ ]+)/?$'; 123 add_rewrite_rule( 124 $reg, 125 'index.php?page_id=' . self::$page_id . '&post_type=page&list=$matches[1]', 126 'top' 127 ); 127 128 } 128 129 } … … 165 166 $template = locate_template( $search_files ); 166 167 if ( ! $template ) { 167 $template = mg_upc_get_templates_path() . '/' . $default_file; 168 $template = trailingslashit( mg_upc_get_templates_path() ) . $default_file; 169 } 170 171 // Set global query 172 global $mg_upc_the_query, $mg_upc_query; 173 if ( ! empty( $mg_upc_the_query ) ) { 174 $mg_upc_query = $mg_upc_the_query; 168 175 } 169 176 } … … 178 185 */ 179 186 private static function get_template_loader_default_file() { 180 181 187 $default_file = ''; 182 188 if ( is_singular( 'page' ) ) { 183 189 if ( self::is_requesting_list_page() ) { 184 if ( false === self::get_list_requested() ) { 190 if ( 191 empty( get_query_var( 'list', false ) ) && 192 'on' === get_option( 'mg_upc_archive_enable', 'on' ) 193 ) { 194 $default_file = 'archive-mg-upc.php'; 195 } elseif ( false === self::get_list_requested() ) { 185 196 $default_file = '404.php'; 186 197 } else { … … 232 243 $vars[] = 'list'; 233 244 $vars[] = 'list-page'; 245 $vars[] = 'list-type'; 246 $vars[] = 'list-author'; 247 $vars[] = 'list-author-name'; 248 $vars[] = 'lists-page'; 249 $vars[] = 'lists-orderby'; 250 $vars[] = 'lists-order'; 234 251 235 252 return $vars; … … 250 267 251 268 return $list; 269 } 270 271 /** 272 * Set the list link 273 * 274 * @param string|null $url 275 * @param MG_UPC_List $list 276 * 277 * @return null|string 278 */ 279 public function mg_upc_list_url( $url, $list ) { 280 281 if ( mg_upc_is_list_publicly_viewable( $url ) ) { 282 return $this->get_list_url( $list ); 283 } 284 285 return $url; 286 } 287 288 /** 289 * Set the list link 290 * 291 * @param $permalink 292 * @param $list 293 * 294 * @return string 295 */ 296 public function filter_get_the_permalink( $permalink, $list ) { 297 $link = $this->get_list_url( $list ); 298 299 return empty( $link ) ? $permalink : $link; 252 300 } 253 301 … … 274 322 * @param bool $check_list_req 275 323 * 276 * @return array|bool324 * @return MG_UPC_List|bool 277 325 */ 278 326 public static function get_list_requested( $check_list_req = true ) { 327 /** @global MG_UPC_Query $mg_upc_query */ 328 global $mg_upc_the_query; 329 if ( ! $mg_upc_the_query || ! $mg_upc_the_query->is_single() ) { 330 return false; 331 } 279 332 280 333 if ( isset( $GLOBALS['mg_upc_list'] ) ) { … … 286 339 } 287 340 288 if ( ! empty( get_query_var( 'list', false ) ) ) { 289 return self::set_global_list( get_query_var( 'list', false ) ); 341 if ( $mg_upc_the_query && $mg_upc_the_query->is_single() && $mg_upc_the_query->have_lists() ) { 342 $mg_upc_the_query->the_list(); 343 return $GLOBALS['mg_upc_list']; 290 344 } 291 345 … … 298 352 * @param $list 299 353 * 300 * @return array|bool|object|WP_Error354 * @return bool|MG_UPC_List|object 301 355 */ 302 356 private static function set_global_list( $list ) { … … 306 360 307 361 if ( $list && mg_upc_is_list_publicly_viewable( $list ) ) { 308 $GLOBALS['mg_upc_list'] = MG_UPC_List_Controller::get_instance()->get_list_for_response( 309 array( 310 'id' => (int) $list->ID, 311 'items_per_page' => (int) get_option( 'mg_upc_item_per_page', 50 ), 312 'items_page' => get_query_var( 'list-page', 1 ), 313 ) 314 ); 315 316 if ( is_wp_error( $GLOBALS['mg_upc_list'] ) ) { 362 $GLOBALS['mg_upc_list'] = MG_UPC_List::get_instance( $list ); 363 if ( ! empty( $GLOBALS['mg_upc_list']->errors ) ) { 317 364 $GLOBALS['mg_upc_list'] = false; 318 365 } … … 333 380 */ 334 381 public function list_title( $old_title, $presentation = false ) { 382 global $mg_upc_the_query; 383 384 $new_title = false; 385 335 386 $list = self::get_list_requested(); 336 if ( ! empty( $list )) {387 if ( $list instanceof MG_UPC_List && $list->ID > 0 ) { 337 388 $parts = array( 338 389 '%title%' => $list['title'], … … 340 391 '%sitename%' => get_bloginfo( 'name' ), 341 392 ); 342 $template = get_option( 'mg_upc_single_title', '%title% by %author% | User List | %sitename%' );393 $template = get_option( 'mg_upc_single_title', '%title% by %author% | User Lists | %sitename%' ); 343 394 $new_title = str_replace( array_keys( $parts ), array_values( $parts ), $template ); 395 } else { 396 if ( $mg_upc_the_query ) { 397 if ( $mg_upc_the_query->is_author() ) { 398 $new_title = $this->get_author_title( $mg_upc_the_query->is_type(), true ); 399 } elseif ( $mg_upc_the_query->is_type() ) { 400 $new_title = $this->get_type_title( true ); 401 } elseif ( self::is_requesting_list_page() ) { 402 $new_title = $this->get_archive_title( 403 'mg_upc_archive_title', 404 array(), 405 true, 406 'User Lists' 407 ); 408 } 409 } 410 } 411 if ( false !== $new_title ) { 344 412 return apply_filters( 'mg_upc_list_doc_title_replace', $new_title, $old_title, $presentation ); 345 413 } … … 359 427 remove_filter( 'the_title', array( $this, 'the_title' ), 10 ); 360 428 $list = self::get_list_requested(); 361 if ( ! empty( $list )) {429 if ( $list instanceof MG_UPC_List && $list->ID > 0 ) { 362 430 $title = $list['title']; 431 } else { 432 /** @global $mg_upc_the_query MG_UPC_Query */ 433 global $mg_upc_the_query; 434 if ( $mg_upc_the_query ) { 435 if ( $mg_upc_the_query->is_author() ) { 436 $title = $this->get_author_title( $mg_upc_the_query->is_type(), false ); 437 } elseif ( $mg_upc_the_query->is_type() ) { 438 $title = $this->get_type_title( false ); 439 } elseif ( self::is_requesting_list_page() ) { 440 $title = $this->get_archive_title( 441 'mg_upc_archive_title', 442 array(), 443 false, 444 'User Lists' 445 ); 446 } 447 } 363 448 } 364 449 add_filter( 'the_title', array( $this, 'the_title' ), 10, 2 ); 365 450 } 366 451 return $title; 452 } 453 454 /** 455 * Get the title for list types archive lists 456 * 457 * @return string 458 */ 459 private function get_type_title( $document_title ) { 460 return $this->get_archive_title( 461 'mg_upc_archive_title_type', 462 array( '%type%' => self::get_query_type() ), 463 $document_title, 464 'User Lists | %type%' 465 ); 466 } 467 468 /** 469 * Get the title for an author archive lists 470 * 471 * @return string 472 */ 473 private function get_author_title( $with_type, $document_title ) { 474 $author = self::get_query_login(); 475 476 if ( empty( $author ) ) { 477 $new_title = __( 'User not found', 'user-post-collections' ); 478 } else { 479 $option = 'mg_upc_archive_title_author'; 480 $default = __( 'Lists created by %author%', 'user-post-collections' ); 481 $parts = array( '%author%' => $author ); 482 if ( $with_type ) { 483 $parts['%type%'] = self::get_query_type(); 484 $option = 'mg_upc_archive_title_author_type'; 485 $default = __( 'Lists created by %author% | %type%', 'user-post-collections' ); 486 } 487 $new_title = $this->get_archive_title( $option, $parts, $document_title, $default ); 488 } 489 return $new_title; 490 } 491 492 private function get_archive_title( $template_option, $parts, $document_title, $default_template ) { 493 $parts['%sitename%'] = get_bloginfo( 'name' ); 494 495 $template = get_option( $template_option, $default_template ); 496 $new_title = str_replace( array_keys( $parts ), array_values( $parts ), $template ); 497 498 if ( $document_title ) { 499 $template = get_option( 'mg_upc_archive_document_title', '%upctitle% | %sitename%' ); 500 $parts = array( 501 '%sitename%' => get_bloginfo( 'name' ), 502 '%upctitle%' => $new_title, 503 ); 504 505 $new_title = str_replace( array_keys( $parts ), array_values( $parts ), $template ); 506 } 507 return $new_title; 508 } 509 510 public static function get_query_type( $query = null ) { 511 if ( ! $query ) { 512 global $mg_upc_query, $mg_upc_the_query; 513 if ( ! empty( $mg_upc_query ) ) { 514 $query = $mg_upc_query; 515 } elseif ( ! empty( $mg_upc_the_query ) ) { 516 $query = $mg_upc_the_query; 517 } else { 518 return ''; 519 } 520 } 521 $type_labels = array(); 522 if ( $query->get( 'list_type', true ) ) { 523 $types = $query->get( 'list_type', true ); 524 foreach ( $types as $type ) { 525 $list_type = MG_UPC_Helper::get_instance()->get_list_type( $type, true ); 526 if ( $list_type ) { 527 $type_labels[] = $list_type['plural_label']; 528 } 529 } 530 } 531 532 return implode( ', ', $type_labels ); 533 } 534 public static function get_query_login( $query = null ) { 535 if ( ! $query ) { 536 global $mg_upc_query, $mg_upc_the_query; 537 if ( ! empty( $mg_upc_query ) ) { 538 $query = $mg_upc_query; 539 } elseif ( ! empty( $mg_upc_the_query ) ) { 540 $query = $mg_upc_the_query; 541 } else { 542 return ''; 543 } 544 } 545 $author_login = ''; 546 if ( $query->get( 'author', false ) ) { 547 $author_login = MG_UPC_Helper::get_instance()->get_user_login( (int) $query->get( 'author', false ) ); 548 } 549 if ( $query->get( 'author_name', false ) ) { 550 $author_name = mg_upc_sanitize_username( $query->get( 'author_name', false ) ); 551 $author = get_user_by( 'slug', $author_name ); 552 if ( $author ) { 553 $author_login = $author->user_login; 554 } 555 } 556 557 return $author_login; 367 558 } 368 559 … … 373 564 * @param bool|object $presentation 374 565 * 375 * @return mixed566 * @return string 376 567 * 377 568 * @noinspection PhpUnusedParameterInspection … … 379 570 public function list_desc( $desc, $presentation = false ) { 380 571 $list = self::get_list_requested(); 381 if ( ! empty( $list )) {572 if ( $list instanceof MG_UPC_List && $list->ID > 0 ) { 382 573 return wp_strip_all_tags( $list['content'] ); 383 574 } … … 392 583 * @param bool|object $presentation 393 584 * 394 * @return mixed585 * @return string|null 395 586 * 396 587 * @noinspection PhpUnusedParameterInspection … … 398 589 public function list_canonical( $link, $presentation = false ) { 399 590 $list = self::get_list_requested(); 400 if ( ! empty( $list )) {591 if ( $list instanceof MG_UPC_List && $list->ID > 0 ) { 401 592 return $this->get_list_url( $list ); 402 593 } … … 414 605 public function list_opengraph_image( $image_container ) { 415 606 $list = self::get_list_requested(); 416 if ( ! empty( $list )) {607 if ( $list instanceof MG_UPC_List && $list->ID > 0 ) { 417 608 $items = $list['items']; 418 609 … … 436 627 437 628 /** 629 * Shortcode on the reserved page ( legacy ) 630 * 631 * @param array $atts Array or empty string 632 * 633 * @return false|string 634 * 635 * @deprecated since 0.9.0 636 */ 637 public function list_shortcode( $atts = array() ) { 638 return $this->page_shortcode( $atts ); 639 } 640 641 /** 438 642 * Shortcode on the reserved page 439 643 * 440 * @param array $atts 644 * @param array $atts Array or empty string 441 645 * 442 646 * @return false|string 443 647 */ 444 public function list_shortcode( $atts = array() ) { 648 public function page_shortcode( $atts = array() ) { 649 global $mg_upc_the_query, $mg_upc_query; 650 if ( self::$doing_shortcodes ) { 651 return ''; 652 } 653 self::$doing_shortcodes = true; 654 ob_start(); 655 if ( ! is_array( $atts ) ) { 656 $atts = array(); 657 } 658 // Using page template title: 659 remove_action( 'mg_upc_single_list_content', 'mg_upc_template_single_title', 5 ); 660 445 661 if ( isset( $atts['id'] ) ) { 446 662 self::set_global_list( (int) $atts['id'] ); 447 } 448 449 // Using page template title: 450 remove_action( 'mg_upc_single_list_content', 'mg_upc_template_single_title', 5 ); 451 452 ob_start(); 453 if ( ! isset( $GLOBALS['mg_upc_list'] ) || false === $GLOBALS['mg_upc_list'] ) { 663 if ( empty( $GLOBALS['mg_upc_list'] ) ) { 664 mg_upc_get_template( 'shortcode-404.php' ); 665 } else { 666 mg_upc_get_template( 'content-single-mg-upc.php' ); 667 } 668 return ob_get_clean(); 669 } 670 if ( ! empty( $mg_upc_the_query ) ) { 671 mg_upc_reset_query(); 672 } 673 if ( ! isset( $mg_upc_query ) ) { 674 self::$doing_shortcodes = false; 675 return ''; 676 } 677 if ( $mg_upc_query->is_single() ) { 678 if ( empty( $GLOBALS['mg_upc_list'] ) ) { 679 mg_upc_get_template( 'shortcode-404.php' ); 680 } else { 681 mg_upc_get_template( 'content-single-mg-upc.php' ); 682 } 683 } elseif ( 'on' === get_option( 'mg_upc_archive_enable', 'on' ) ) { 684 $atts = array( 685 'pagination' => 1, 686 'tpl-desc' => get_option( 'mg_upc_archive_item_template_desc', 'off' ), 687 'tpl-thumbs' => '2x2', 688 'tpl-user' => get_option( 'mg_upc_archive_item_template_user', 'on' ), 689 'tpl-meta' => get_option( 'mg_upc_archive_item_template_meta', 'on' ), 690 'tpl-items' => get_option( 'mg_upc_archive_item_template', 'list' ), 691 'tpl-cols-xxl' => get_option( 'mg_upc_archive_item_template_cols_xxl', '4' ), 692 'tpl-cols-xl' => get_option( 'mg_upc_archive_item_template_cols_xl', '4' ), 693 'tpl-cols-lg' => get_option( 'mg_upc_archive_item_template_cols_lg', '4' ), 694 'tpl-cols-md' => get_option( 'mg_upc_archive_item_template_cols_md', '3' ), 695 'tpl-cols-sm' => get_option( 'mg_upc_archive_item_template_cols_sm', '2' ), 696 'tpl-cols-xs' => get_option( 'mg_upc_archive_item_template_cols_xs', '1' ), 697 'tpl-thumbs-xxl' => get_option( 'mg_upc_archive_item_template_thumbs_xxl', '2x2' ), 698 'tpl-thumbs-xl' => get_option( 'mg_upc_archive_item_template_thumbs_xl', '2x2' ), 699 'tpl-thumbs-lg' => get_option( 'mg_upc_archive_item_template_thumbs_lg', '2x2' ), 700 'tpl-thumbs-md' => get_option( 'mg_upc_archive_item_template_thumbs_md', '2x2' ), 701 'tpl-thumbs-sm' => get_option( 'mg_upc_archive_item_template_thumbs_sm', '2x2' ), 702 'tpl-thumbs-xs' => get_option( 'mg_upc_archive_item_template_thumbs_xs', '4x1' ), 703 ); 704 mg_upc_template_loop( $atts ); 705 } else { 454 706 mg_upc_get_template( 'shortcode-404.php' ); 455 } else {456 mg_upc_get_template( 'content-single-mg-upc.php' ); 457 }707 } 708 709 self::$doing_shortcodes = false; 458 710 return ob_get_clean(); 459 711 } 460 712 461 713 /** 462 * Get the li nt url714 * Get the list url 463 715 * 464 716 * @param array|object $list 465 717 * 466 * @return string |void718 * @return string 467 719 */ 468 720 public function get_list_url( $list ) { … … 474 726 } 475 727 if ( ! empty( $slug ) ) { 476 if ( self::$page_id > 0 ) { 477 $val = get_page_link( self::$page_id ); 478 if ( ! empty( $val ) ) { 479 $val = wp_make_link_relative( $val ); 480 if ( false === strpos( $val, '?' ) ) { 481 return home_url( '/' . trim( $val, '/' ) . '/' . rawurlencode( $slug ) ); 482 } 483 return home_url( '/' . add_query_arg( array( 'list' => rawurlencode( $slug ) ), $val ) ); 484 } 728 $val = self::get_base_url( true ); 729 if ( ! empty( $val ) ) { 730 if ( false === strpos( $val, '?' ) ) { 731 return home_url( '/' . trim( $val, '/' ) . '/' . rawurlencode( $slug ) ); 732 } 733 return home_url( '/' . add_query_arg( array( 'list' => rawurlencode( $slug ) ), $val ) ); 485 734 } 486 735 } … … 488 737 } 489 738 490 /** 491 * On plugin activated 492 * 493 * @param bool $network_wide 494 */ 495 public function activate( $network_wide ) { 496 497 update_option( 'mg_upc_flush_rewrite', '1' ); 498 499 self::$page_id = self::get_page_id(); 739 public static function base_url_filter( $url ) { 740 if ( 0 === self::$page_id ) { 741 self::$page_id = self::get_page_id(); 742 } 500 743 if ( self::$page_id > 0 ) { 501 $status = get_post_status( self::$page_id ); 502 if ( is_string( $status ) ) { 503 if ( 'trash' === $status ) { 504 wp_untrash_post( self::$page_id ); 505 wp_publish_post( self::$page_id ); 506 } 507 $list_page_link = get_page_link( self::$page_id ); 508 if ( ! empty( $list_page_link ) ) { 509 return; 510 } 511 } 512 } 513 514 //Create a page reserved for collection single 515 $post = array( 516 'post_title' => 'User Post Collection', 517 'post_content' => "<!-- wp:shortcode -->\n[user_post_collection]\n<!-- /wp:shortcode -->", 518 'post_type' => 'page', 519 'post_status' => 'publish', 520 ); 521 522 $post_id = wp_insert_post( $post ); 523 update_option( 'mg_upc_single_page', $post_id ); 524 525 $this->add_rewrite(); 526 } 527 528 /** 529 * Add settings filed for manage page 530 * 531 * @param $settings_fields 532 * 533 * @return mixed 534 */ 535 public function add_settings_fields( $settings_fields ) { 536 $new = array( 537 array( 538 'name' => 'mg_upc_single_page', 539 'label' => __( 'Collection Page', 'user-post-collections' ), 540 'desc' => __( 'make sure the shortcode [user_post_collection] is present on the selected page', 'user-post-collections' ), 541 'default' => self::get_page_id(), 542 'type' => 'pages', 543 'sanitize_callback_params' => 3, 544 'sanitize_callback' => function ( $value, $option, $original_value ) { 545 if ( ! is_numeric( $value ) ) { 546 return $original_value; 547 } 548 549 if ( $value !== $original_value ) { 550 update_option( 'mg_upc_flush_rewrite', '1' ); 551 } 552 553 return $value; 554 }, 555 ), 556 array( 557 'name' => 'mg_upc_single_page_mode', 558 'label' => __( 'Collection Page Template', 'user-post-collections' ), 559 'desc' => __( 'Try change this if the single list page not show as you like.', 'user-post-collections' ), 560 'default' => 'template_page', 561 'type' => 'radio', 562 'options' => array( 563 'template_upc' => __( 'Load UPC template', 'user-post-collections' ), 564 'template_page' => __( 'Load inside the default selected page template', 'user-post-collections' ), 565 ), 566 ), 567 ); 568 $settings_fields['mg_upc_general'] = array_merge( 569 $new, 570 $settings_fields['mg_upc_general'] 571 ); 572 573 return $settings_fields; 574 } 575 576 public function deactivate() { 577 self::$page_id = self::get_page_id(); 578 if ( self::$page_id > 0 ) { 579 $status = get_post_status( self::$page_id ); 580 if ( is_string( $status ) ) { 581 wp_trash_post( self::$page_id ); 582 } 583 } 744 $url = get_page_link( self::$page_id ); 745 } 746 return $url; 747 } 748 749 public static function get_base_url( $relative = false ) { 750 $url = apply_filters( 'mg_upc_base_url', '' ); 751 if ( $relative ) { 752 return wp_make_link_relative( $url ); 753 } 754 return $url; 584 755 } 585 756 586 757 public function register_hook_callbacks() { } 587 758 588 public function upgrade( $db_version = 0 ) { 589 if ( version_compare( $db_version, '0.7.1', '<' ) ) { 590 update_option( 'mg_upc_flush_rewrite', '0' );591 } 592 }759 public function upgrade( $db_version = 0 ) { } 760 761 public function activate( $network_wide ) { } 762 763 public function deactivate() { } 593 764 } -
user-post-collections/tags/0.9.0/controllers/mg-upc-list-controller.php
r2768965 r3190768 73 73 //check user can edit list types 74 74 $unable_to_edit = array(); 75 foreach ( $my_list_types as $ k => $name_type ) {75 foreach ( $my_list_types as $name_type ) { 76 76 $_type = $helper->get_list_type( $name_type ); 77 77 if ( ! current_user_can( $_type->get_cap()->edit_posts ) ) { … … 169 169 * 170 170 * @param int|WP_REST_Request|array $config_or_request If is int type, then use as list_id 171 * If array, used keys: 'id'(required), 'exclude_not_found_error'171 * If is array, used keys: 'id'(required), 'exclude_not_found_error' 172 172 * If is WP_REST_Request, then params equivalents to as array 173 173 * … … 209 209 * 210 210 * @param int|WP_REST_Request|array $config_or_request If is int type, then use as list_id 211 * If array, used keys: 'id'(required), 'context', 'items_page', 'items_per_page'211 * If is array, used keys: 'id'(required), 'context', 'items_page', 'items_per_page' 212 212 * If is WP_REST_Request, then params equivalents to as array 213 213 * … … 235 235 * 236 236 * @param array|int|WP_REST_Request $config_or_request If is int type, then use as list_id 237 * If array, used keys: 'id'(required), 'page', 'per_page', 'orderby', 'order'237 * If is array, used keys: 'id'(required), 'page', 'per_page', 'orderby', 'order' 238 238 * If is WP_REST_Request, then params equivalents to as array 239 239 * … … 372 372 373 373 if ( ! empty( $list_data['created'] ) ) { 374 $list_data['created'] = gmdate( D ATE_ISO8601, strtotime( $list_data['created'] ) );374 $list_data['created'] = gmdate( DateTime::ATOM, strtotime( $list_data['created'] ) ); 375 375 } 376 376 377 377 if ( ! empty( $list_data['modified'] ) ) { 378 $list_data['modified'] = gmdate( DATE_ISO8601, strtotime( $list_data['modified'] ) ); 379 } 380 381 $list_data = apply_filters( 'prepare_list_data_for_response', $list_data, $list, $config ); 382 383 return $list_data; 378 $list_data['modified'] = gmdate( DateTime::ATOM, strtotime( $list_data['modified'] ) ); 379 } 380 381 return apply_filters( 'prepare_list_data_for_response', $list_data, $list, $config ); 384 382 } 385 383 … … 434 432 435 433 $excerpt = apply_filters( 'get_the_excerpt', $post->post_excerpt, $post ); 436 /** This filter is documented in wp-includes/post-template.php */ 437 $excerpt = apply_filters( 'the_excerpt', $excerpt ); 434 435 // Infinite loop protection 436 global $wp_current_filter; 437 $counts = array_count_values( $wp_current_filter ); 438 if ( isset( $counts['the_excerpt'] ) && $counts['the_excerpt'] < 2 ) { 439 /** This filter is documented in wp-includes/post-template.php */ 440 $excerpt = apply_filters( 'the_excerpt', $excerpt ); 441 } 438 442 $data['excerpt'] = post_password_required( $post ) ? '' : $excerpt; 439 443 440 $data['featured_media'] = '' . get_post_thumbnail_id( $post->ID ); //to string for max int on other plat aforms444 $data['featured_media'] = '' . get_post_thumbnail_id( $post->ID ); //to string for max int on other platforms 441 445 $data['image'] = get_the_post_thumbnail_url( $post->ID ); // or add size , 'medium' 442 446 … … 616 620 617 621 /** 618 * Check if the user can read a nspecified list622 * Check if the user can read a specified list 619 623 * 620 624 * @param int $list_id … … 634 638 635 639 /** 636 * Check if the user can read private a nspecified list type640 * Check if the user can read private a specified list type 637 641 * 638 642 * @param string $list_type … … 652 656 653 657 /** 654 * Check if the user can edit a nspecified list658 * Check if the user can edit a specified list 655 659 * 656 660 * @param int $list_id … … 669 673 670 674 /** 671 * Check if the user can delete a nspecified list675 * Check if the user can delete a specified list 672 676 * 673 677 * @param int $list_id -
user-post-collections/tags/0.9.0/controllers/mg-upc-rest-list-controller.php
r2768965 r3190768 486 486 487 487 $response = $this->prepare_list_for_response( $list, $request ); 488 $response = rest_ensure_response( $response ); 489 490 return $response; 488 489 return rest_ensure_response( $response ); 491 490 } 492 491 … … 670 669 public function get_lists( $request ) { 671 670 671 if ( isset( $request['status'] ) && ! is_array( $request['status'] ) ) { 672 $request['status'] = array( $request['status'] ); 673 } 674 if ( isset( $request['types'] ) && ! is_array( $request['types'] ) ) { 675 $request['types'] = array( $request['types'] ); 676 } 677 672 678 $args = array( 673 679 'limit' => $request['per_page'], … … 697 703 } 698 704 699 if ( isset( $request['status'] ) && ! is_array( $request['status'] ) ) { 700 $request['status'] = array( $request['status'] ); 701 } 702 if ( isset( $request['type'] ) && ! is_array( $request['type'] ) ) { 703 $request['type'] = array( $request['type'] ); 704 } 705 706 //limit to searcheable list types and statuses 705 //limit to searchable list types and statuses 707 706 if ( ! empty( $args['search'] ) ) { 708 707 $searchable_list_type = MG_UPC_Helper::get_instance()->get_searchable_list_types(); … … 713 712 $request['status'] = $searchable_list_status; 714 713 } 715 if ( isset( $request['type'] ) && ! in_array( 'any', $request['type'], true ) ) { 716 $request['type'] = array_intersect( $request['type'], $searchable_list_type ); 714 //TODO: not filter for admin? 715 if ( isset( $request['types'] ) && ! in_array( 'any', $request['types'], true ) ) { 716 $args['type'] = array_intersect( $request['types'], $searchable_list_type ); 717 717 } else { 718 $ request['type'] = $searchable_list_type;718 $args['type'] = $searchable_list_type; 719 719 } 720 720 } … … 728 728 ) { 729 729 if ( empty( $args['author'] ) || get_current_user_id() !== $args['author'] ) { 730 if ( 731 ! empty( $args['type'] ) && 732 ! in_array( 'any', $args['type'], true ) 733 ) { 734 $list_types_to_access = $args['type']; 730 $only_public_status = false; 731 //valid list types with the private statuses filter 732 $list_types_filter = MG_UPC_Helper::get_instance()->get_list_types_can_private_read( $args['type'] ); 733 /* 734 * This disables listing mixed list types <-> private and public read status 735 * Example: 736 * If the current user has permissions to view public and private bookmarks, 737 * but only has permissions to view favorites with public status. 738 * A query with: 739 * - status=published,private and 740 * - list_type=bookmark,favorites 741 * Will be processed as: 742 * - status=published,private and 743 * - list_type=bookmark 744 * In the future it should be processed like: 745 * (type=bookmark AND status IN (published, private)) OR 746 * (type=favorite AND status = published ) 747 * 748 * (*) If current user only can read public lists for both types, will be processed as: 749 * - status=published 750 * - list_type=bookmark,favorites 751 **/ 752 //TODO: mixed query 753 if ( ! empty( $list_types_filter ) ) { 754 $args['type'] = $list_types_filter; // Only types that user can read with private status 735 755 } else { 736 $ list_types_to_access = array_keys( MG_UPC_Helper::get_instance()->get_list_types() );756 $only_public_status = true; // Don't find private statuses 737 757 } 738 $ok_access_list_types = array(); //list type with permission ok 739 foreach ( $list_types_to_access as $list_type ) { 740 if ( MG_UPC_List_Controller::get_instance()->can_read_private_type( $list_type ) ) { 741 $ok_access_list_types[] = $list_type; 742 } 743 } 744 if ( ! empty( $ok_access_list_types ) ) { 745 $args['type'] = $ok_access_list_types; 746 } else { 758 if ( $only_public_status ) { 747 759 //only public access 748 760 $request['status'] = MG_UPC_Helper::get_instance()->get_public_list_statuses(); … … 756 768 $args['status'] = $request['status']; 757 769 } 770 758 771 return $this->process_lists( $args, $request ); 759 772 } … … 921 934 922 935 /** 923 * Get a nspecified collection936 * Get a specified collection 924 937 * 925 938 * @param int $id List id … … 1013 1026 * This is copied from WP_REST_Controller class in the WP REST API v2 plugin. 1014 1027 * 1015 * @param array|WP_REST_Response $response Response object, i sis array this not change.1028 * @param array|WP_REST_Response $response Response object, if is array this not change. 1016 1029 * 1017 1030 * @return array Response data, ready for insertion into collection data. -
user-post-collections/tags/0.9.0/controllers/mg-upc-rest-list-items-controller.php
r2856776 r3190768 596 596 'post_id' => $post_id, 597 597 ); 598 $response = array( 'data' => array() ); 598 $response = array( 599 'data' => array( 600 'status' => 201, 601 ), 602 'added' => true, 603 ); 599 604 if ( 600 605 is_string( $request['description'] ) && … … 608 613 ); 609 614 $response['data']['status'] = 409; 610 $response['added'] = true;611 615 } else { 612 $to_save['description'] = $request['description']; 613 $response['data']['status'] = 201; 614 $response['added'] = true; 615 } 616 } else { 617 $response['data']['status'] = 201; 618 $response['added'] = true; 616 $to_save['description'] = $request['description']; 617 } 619 618 } 620 619 if ( … … 624 623 if ( $list_type_obj->support( 'quantity' ) && 0 <= (int) $request['quantity'] ) { 625 624 $to_save['quantity'] = $request['quantity']; 626 if ( ! isset( $response['code'] ) ) {627 $response['data']['status'] = 201;628 $response['added'] = true;629 }630 625 } 631 626 } 632 627 633 628 if ( isset( $request['context'] ) && 'check' === $request['context'] ) { 634 if ( ! empty( $response['added'] ) ) { 635 $response['check'] = 'OK'; 636 } else { 637 $response['check'] = 'ERR'; 638 } 629 $response['check'] = ! empty( $response['added'] ) ? 'OK' : 'ERR'; 639 630 } 640 631 … … 653 644 $to_save['list_id'], 654 645 $to_save['post_id'], 655 isset( $to_save['description'] ) ? $to_save['description'] :'',656 isset( $to_save['quantity'] ) ? $to_save['quantity'] :0646 $to_save['description'] ?? '', 647 $to_save['quantity'] ?? 0 657 648 ); 658 649 -
user-post-collections/tags/0.9.0/controllers/mg-upc-woocommerce.php
r2768965 r3190768 5 5 6 6 public function __construct() { 7 //before added list types on init with priority 10.. and WooCommerce already defined7 //before added list types on init with priority 10... and WooCommerce already defined 8 8 add_action( 'init', array( $this, 'pre_init' ), 5 ); 9 9 … … 98 98 99 99 /** 100 * Before added list types on init with priority 10.. and WooCommerce already defined100 * Before added list types on init with priority 10... and WooCommerce already defined 101 101 */ 102 102 public function pre_init() { … … 484 484 } 485 485 486 $item = $this->add_product_properties( $item, wc_get_product( $item['post_id'] ) ); 487 488 return $item; 486 return $this->add_product_properties( $item, wc_get_product( $item['post_id'] ) ); 489 487 } 490 488 … … 893 891 global $mg_upc_item; 894 892 895 if ( ! function_exists( 'wc_get_product' ) || false === $mg_upc_item['is_in_stock']) {893 if ( ! function_exists( 'wc_get_product' ) || empty( $mg_upc_item['is_in_stock'] ) ) { 896 894 return; 897 895 } … … 979 977 ); 980 978 981 //This not managed with version! Woo can install after that UPC.. 979 //This not managed with version! Woo can install after that UPC... 982 980 $activated = get_option( 'mg_upc_woo_activated', array() ); 983 981 if ( ! in_array( 'cart_type', $activated, true ) ) { -
user-post-collections/tags/0.9.0/includes/list-types.php
r2768965 r3190768 211 211 function mg_upc_is_list_status_viewable( $list_status ) { 212 212 if ( is_scalar( $list_status ) ) { 213 $list_status = get_post_status_object( $list_status );213 $list_status = MG_UPC_Helper::get_instance()->get_list_status( $list_status ); 214 214 if ( ! $list_status ) { 215 215 return false; … … 244 244 * are viewable. 245 245 * 246 * @param array|stdClass| null $list Optional. Post ID or post object. Defaults to global $post.246 * @param array|stdClass|MG_UPC_List|null $list Optional. Post ID or post object. Defaults to global $post. 247 247 * @return bool Whether the post is publicly viewable. 248 248 */ -
user-post-collections/tags/0.9.0/includes/mg-upc-helper.php
r2768965 r3190768 27 27 public function get_list_type( $type_name, $include_disabled = false ) { 28 28 $types = $this->get_list_types( $include_disabled ); 29 return array_key_exists( $type_name, $types ) ? $types[ $type_name ] : false;29 return is_string( $type_name ) && array_key_exists( $type_name, $types ) ? $types[ $type_name ] : false; 30 30 } 31 31 … … 363 363 364 364 /** 365 * Get list types that the user can read privates 366 * 367 * @param array $list_types List type 368 * 369 * @return string[] The private list types that user can read 370 */ 371 public function get_list_types_can_private_read( $list_types ) { 372 if ( 373 ! empty( $list_types ) && 374 ! in_array( 'any', $list_types, true ) 375 ) { 376 $list_types_to_access = $list_types; 377 } else { 378 $list_types_to_access = array_keys( $this->get_list_types() ); 379 } 380 $ok_access_list_types = array(); //list type with permission ok 381 foreach ( $list_types_to_access as $list_type ) { 382 if ( MG_UPC_List_Controller::get_instance()->can_read_private_type( $list_type ) ) { 383 $ok_access_list_types[] = $list_type; 384 } 385 } 386 387 return $ok_access_list_types; 388 } 389 390 /** 365 391 * Check if user can add the post type to any type of enabled list type. 366 392 * Use: Show the "add to list" button? -
user-post-collections/tags/0.9.0/includes/mg-upc-list-type.php
r2768965 r3190768 97 97 98 98 /** 99 * The features that can be enable /disableby user.99 * The features that can be enabled/disabled by user. 100 100 * 101 101 * @var array|bool $supports … … 264 264 265 265 foreach ( $args as $property_name => $property_value ) { 266 if ( ! property_exists( $this, $property_name ) ) { 267 _doing_it_wrong( 268 'MG_UPC_List_Type->set_props', 269 'Property not found: ' . esc_html( $property_name ), 270 '1.0' 271 ); 272 } 266 273 $this->$property_name = $property_value; 267 274 } … … 506 513 507 514 508 public function offsetSet( $offset, $valor ) { 515 #[ReturnTypeWillChange] 516 public function offsetSet( $offset, $value ) { 509 517 //No set as array... 510 518 } 511 519 520 #[ReturnTypeWillChange] 512 521 public function offsetExists( $offset ) { 513 522 return isset( $this->$offset ); 514 523 } 515 524 525 #[ReturnTypeWillChange] 516 526 public function offsetUnset( $offset ) { 517 527 unset( $this->$offset ); 518 528 } 519 529 530 #[ReturnTypeWillChange] 520 531 public function offsetGet( $offset ) { 521 532 … … 537 548 } 538 549 539 return isset( $this->$offset ) ? $this->$offset :null;550 return $this->$offset ?? null; 540 551 } 541 552 -
user-post-collections/tags/0.9.0/includes/mg-upc-settings-api.php
r2768965 r3190768 173 173 $this->settings_fields = $fields; 174 174 175 foreach ( $this->settings_fields as $ section => $field ) {175 foreach ( $this->settings_fields as $field ) { 176 176 foreach ( $field as $option ) { 177 177 $this->set_flags_from_field( $option ); … … 223 223 public function admin_init() { 224 224 //register settings sections 225 foreach ( $this->settings_sections as $section _id => $section) {225 foreach ( $this->settings_sections as $section ) { 226 226 // For save as array of sections (field as key) 227 227 if ( true === $section['as_array'] ) { … … 278 278 279 279 $name = $option['name']; 280 $type = isset( $option['type'] ) ? $option['type'] :'text';281 $label = isset( $option['label'] ) ? $option['label'] :'';282 $callback = isset( $option['callback'] ) ? $option['callback'] :array( $this, 'callback_' . $type );280 $type = $option['type'] ?? 'text'; 281 $label = $option['label'] ?? ''; 282 $callback = $option['callback'] ?? array( $this, 'callback_' . $type ); 283 283 $option_name = $name; 284 284 … … 331 331 332 332 if ( false === $label ) { 333 $label = isset( $option['label'] ) ? $option['label'] :'';333 $label = $option['label'] ?? ''; 334 334 } 335 335 if ( false === $type ) { 336 $type = isset( $option['type'] ) ? $option['type'] :'text';336 $type = $option['type'] ?? 'text'; 337 337 } 338 338 339 339 $args = array( 340 340 'id' => $option_id, 341 'class' => isset( $option['class'] ) ? $option['class'] :'',341 'class' => $option['class'] ?? '', 342 342 'label_for' => $option_input_name, 343 'desc' => isset( $option['desc'] ) ? $option['desc'] :'',343 'desc' => $option['desc'] ?? '', 344 344 'name' => $label, 345 345 'section' => $section_id, 346 'size' => isset( $option['size'] ) ? $option['size'] :null,347 'options' => isset( $option['options'] ) ? $option['options'] :'',348 'std' => isset( $option['default'] ) ? $option['default'] :'',349 'sanitize_callback' => isset( $option['sanitize_callback'] ) ? $option['sanitize_callback'] :'',346 'size' => $option['size'] ?? null, 347 'options' => $option['options'] ?? '', 348 'std' => $option['default'] ?? '', 349 'sanitize_callback' => $option['sanitize_callback'] ?? '', 350 350 'type' => $type, 351 'placeholder' => isset( $option['placeholder'] ) ? $option['placeholder'] :'',352 'min' => isset( $option['min'] ) ? $option['min'] :'',353 'max' => isset( $option['max'] ) ? $option['max'] :'',354 'step' => isset( $option['step'] ) ? $option['step'] :'',351 'placeholder' => $option['placeholder'] ?? '', 352 'min' => $option['min'] ?? '', 353 'max' => $option['max'] ?? '', 354 'step' => $option['step'] ?? '', 355 355 'option_name' => $option_input_name, 356 'readonly' => isset( $option['can_edit'] ) ? ! $option['can_edit'] : false, //only supports for text, number and checkbox356 'readonly' => isset( $option['can_edit'] ) && ! $option['can_edit'], //only supports for text, number and checkbox 357 357 ); 358 358 … … 525 525 ); 526 526 527 $type = isset( $item_option['type'] ) ? $item_option['type'] :'text';528 $callback_render = isset( $item_option['callback'] ) ? $item_option['callback'] :array(527 $type = $item_option['type'] ?? 'text'; 528 $callback_render = $item_option['callback'] ?? array( 529 529 $this, 530 530 'callback_' . $type, … … 600 600 $item_option_args['readonly'] = false; 601 601 602 $type = isset( $item_option['type'] ) ? $item_option['type'] :'text';603 $callback_render = isset( $item_option['callback'] ) ? $item_option['callback'] :array(602 $type = $item_option['type'] ?? 'text'; 603 $callback_render = $item_option['callback'] ?? array( 604 604 $this, 605 605 'callback_' . $type, … … 624 624 */ 625 625 public function callback_text( $args ) { 626 $args['value'] = isset( $args['value'] ) ? $args['value'] :$this->get_option( $args['id'], $args['section'], $args['std'] );626 $args['value'] = $args['value'] ?? $this->get_option( $args['id'], $args['section'], $args['std'] ); 627 627 $args['size'] = isset( $args['size'] ) && is_scalar( $args['size'] ) ? $args['size'] : 'regular'; 628 $args['type'] = isset( $args['type'] ) ? $args['type'] :'text';628 $args['type'] = $args['type'] ?? 'text'; 629 629 630 630 printf( … … 661 661 */ 662 662 public function callback_number( $args ) { 663 $value = isset( $args['value'] ) ? $args['value'] :$this->get_option( $args['id'], $args['section'], $args['std'] );663 $value = $args['value'] ?? $this->get_option( $args['id'], $args['section'], $args['std'] ); 664 664 $size = isset( $args['size'] ) && is_scalar( $args['size'] ) ? $args['size'] : 'regular'; 665 $type = isset( $args['type'] ) ? $args['type'] :'number';665 $type = $args['type'] ?? 'number'; 666 666 667 667 printf( … … 698 698 public function callback_checkbox( $args ) { 699 699 700 $value = isset( $args['value'] ) ? $args['value'] :$this->get_option( $args['id'], $args['section'], $args['std'] );700 $value = $args['value'] ?? $this->get_option( $args['id'], $args['section'], $args['std'] ); 701 701 702 702 echo '<fieldset>'; … … 730 730 */ 731 731 public function callback_multicheck( $args ) { 732 $value = isset( $args['value'] ) ? $args['value'] :$this->get_option( $args['id'], $args['section'], $args['std'] );732 $value = $args['value'] ?? $this->get_option( $args['id'], $args['section'], $args['std'] ); 733 733 echo '<fieldset>'; 734 734 printf( … … 760 760 public function callback_radio( $args ) { 761 761 762 $value = isset( $args['value'] ) ? $args['value'] :$this->get_option( $args['id'], $args['section'], $args['std'] );762 $value = $args['value'] ?? $this->get_option( $args['id'], $args['section'], $args['std'] ); 763 763 echo '<fieldset>'; 764 764 … … 785 785 */ 786 786 public function callback_select( $args ) { 787 $value = isset( $args['value'] ) ? $args['value'] :$this->get_option( $args['id'], $args['section'], $args['std'] );787 $value = $args['value'] ?? $this->get_option( $args['id'], $args['section'], $args['std'] ); 788 788 $size = isset( $args['size'] ) && is_scalar( $args['size'] ) ? $args['size'] : 'regular'; 789 789 … … 813 813 */ 814 814 public function callback_textarea( $args ) { 815 $value = isset( $args['value'] ) ? $args['value'] :$this->get_option( $args['id'], $args['section'], $args['std'] );815 $value = $args['value'] ?? $this->get_option( $args['id'], $args['section'], $args['std'] ); 816 816 $size = isset( $args['size'] ) && is_scalar( $args['size'] ) ? $args['size'] : 'regular'; 817 817 … … 849 849 public function callback_wysiwyg( $args ) { 850 850 851 $value = isset( $args['value'] ) ? $args['value'] :$this->get_option( $args['id'], $args['section'], $args['std'] );851 $value = $args['value'] ?? $this->get_option( $args['id'], $args['section'], $args['std'] ); 852 852 $size = isset( $args['size'] ) && is_scalar( $args['size'] ) ? $args['size'] : '500px'; 853 853 … … 877 877 */ 878 878 public function callback_file( $args ) { 879 $value = isset( $args['value'] ) ? $args['value'] :$this->get_option( $args['id'], $args['section'], $args['std'] );879 $value = $args['value'] ?? $this->get_option( $args['id'], $args['section'], $args['std'] ); 880 880 $size = isset( $args['size'] ) && is_scalar( $args['size'] ) ? $args['size'] : 'regular'; 881 $label = isset( $args['options']['button_label'] ) ? $args['options']['button_label'] :__( 'Choose File' );881 $label = $args['options']['button_label'] ?? __( 'Choose File' ); 882 882 883 883 printf( … … 904 904 public function callback_password( $args ) { 905 905 906 $value = isset( $args['value'] ) ? $args['value'] :$this->get_option( $args['id'], $args['section'], $args['std'] );906 $value = $args['value'] ?? $this->get_option( $args['id'], $args['section'], $args['std'] ); 907 907 $size = isset( $args['size'] ) && is_scalar( $args['size'] ) ? $args['size'] : 'regular'; 908 908 … … 928 928 public function callback_color( $args ) { 929 929 930 $value = isset( $args['value'] ) ? $args['value'] :$this->get_option( $args['id'], $args['section'], $args['std'] );930 $value = $args['value'] ?? $this->get_option( $args['id'], $args['section'], $args['std'] ); 931 931 $size = isset( $args['size'] ) && is_scalar( $args['size'] ) ? $args['size'] : 'regular'; 932 932 … … 953 953 public function callback_date( $args ) { 954 954 955 $value = isset( $args['value'] ) ? $args['value'] :$this->get_option( $args['id'], $args['section'], $args['std'] );955 $value = $args['value'] ?? $this->get_option( $args['id'], $args['section'], $args['std'] ); 956 956 $size = isset( $args['size'] ) && is_scalar( $args['size'] ) ? $args['size'] : 'regular'; 957 957 … … 984 984 */ 985 985 public function callback_datetime( $args ) { 986 $value = isset( $args['value'] ) ? $args['value'] :$this->get_option( $args['id'], $args['section'], $args['std'] );986 $value = $args['value'] ?? $this->get_option( $args['id'], $args['section'], $args['std'] ); 987 987 $size = isset( $args['size'] ) && is_scalar( $args['size'] ) ? $args['size'] : 'regular'; 988 988 … … 1019 1019 1020 1020 $dropdown_args = array( 1021 'selected' => isset( $args['value'] ) ? $args['value'] :$this->get_option( $args['id'], $args['section'], $args['std'] ),1021 'selected' => $args['value'] ?? $this->get_option( $args['id'], $args['section'], $args['std'] ), 1022 1022 'name' => $args['option_name'], 1023 1023 'id' => $args['option_name'], … … 1046 1046 $sanitize_callback = $this->get_sanitize_callback( $wp_option, $option_slug ); 1047 1047 if ( $sanitize_callback ) { 1048 $wp_value[ $option_slug ] = call_user_func( $sanitize_callback, $ wp_value[ $option_slug ]);1048 $wp_value[ $option_slug ] = call_user_func( $sanitize_callback, $option_value ); 1049 1049 } 1050 1050 } … … 1171 1171 if ( isset( $field['unique'] ) && $field['unique'] ) { 1172 1172 $no_repeat = array(); 1173 foreach ( $wp_value as $ index_arr => $option_value ) {1173 foreach ( $wp_value as $option_value ) { 1174 1174 if ( in_array( $option_value[ $field['name'] ], $no_repeat, true ) ) { 1175 1175 add_settings_error( … … 1266 1266 $option_value, 1267 1267 $option_array['name'] . '[' . $array_idx . '][' . $item_option_slug . ']', 1268 isset( $old_value[ $item_option_slug ] ) ? $old_value[ $item_option_slug ] :'',1268 $old_value[ $item_option_slug ] ?? '', 1269 1269 $sub_option, 1270 1270 ); … … 1429 1429 * Show the section settings forms 1430 1430 * 1431 * This function displays every section sin a different form1431 * This function displays every section in a different form 1432 1432 */ 1433 1433 public function show_forms() { -
user-post-collections/tags/0.9.0/includes/template-functions.php
r2768965 r3190768 49 49 function mg_upc_template_single_items() { 50 50 mg_upc_get_template( 'single-mg-upc/items.php' ); 51 } 52 } 53 54 if ( ! function_exists( 'mg_upc_template_no_items_found' ) ) { 55 56 /** 57 * Empty list collections 58 */ 59 function mg_upc_template_no_items_found() { 60 mg_upc_get_template( 'single-mg-upc/empty-items.php' ); 51 61 } 52 62 } … … 198 208 /** 199 209 * Show item quantity. 200 *201 * @return string202 210 */ 203 211 function mg_upc_show_item_quantity() { … … 208 216 } 209 217 } 218 219 220 221 /**************************************************************** 222 * ARCHIVE 223 ****************************************************************/ 224 225 if ( ! function_exists( 'mg_upc_template_loop_single_info_start' ) ) { 226 227 /** 228 * Start infodiv 229 */ 230 function mg_upc_template_loop_single_info_start() { 231 echo '<div class="mg-upc-loop-list-info">'; 232 } 233 } 234 if ( ! function_exists( 'mg_upc_template_loop_single_info_end' ) ) { 235 236 /** 237 * Close info div 238 */ 239 function mg_upc_template_loop_single_info_end() { 240 echo '</div>'; 241 } 242 } 243 244 if ( ! function_exists( 'mg_upc_template_loop_single_title' ) ) { 245 246 /** 247 * Output the list title. 248 */ 249 function mg_upc_template_loop_single_title() { 250 mg_upc_get_template( 'loop/list/title.php' ); 251 } 252 } 253 254 if ( ! function_exists( 'mg_upc_template_loop_single_author' ) ) { 255 256 /** 257 * Output the list author. 258 */ 259 function mg_upc_template_loop_single_author() { 260 mg_upc_get_template( 'loop/list/author.php' ); 261 } 262 } 263 264 if ( ! function_exists( 'mg_upc_template_loop_single_meta' ) ) { 265 266 /** 267 * Output the list meta. 268 */ 269 function mg_upc_template_loop_single_meta() { 270 mg_upc_get_template( 'loop/list/meta.php' ); 271 } 272 } 273 274 if ( ! function_exists( 'mg_upc_template_loop_single_description' ) ) { 275 276 /** 277 * Output list description. 278 */ 279 function mg_upc_template_loop_single_description() { 280 mg_upc_get_template( 'loop/list/description.php' ); 281 } 282 } 283 284 285 if ( ! function_exists( 'mg_upc_template_loop_single_thumbs' ) ) { 286 287 /** 288 * Output the list items. 289 */ 290 function mg_upc_template_loop_single_thumbs() { 291 mg_upc_get_template( 'loop/list/items.php' ); 292 } 293 } 294 295 296 297 if ( ! function_exists( 'mg_upc_template_archive_pagination' ) ) { 298 299 /** 300 * Output the archive pagination. 301 */ 302 function mg_upc_template_archive_pagination() { 303 global $mg_upc_query; 304 305 $args = array( 306 'total' => $mg_upc_query->max_num_pages, 307 'current' => $mg_upc_query->query_vars['paged'], 308 'base' => esc_url_raw( add_query_arg( 'lists-page', '%#%', false ) ), 309 'format' => '?lists-page=%#%', 310 ); 311 312 mg_upc_get_template( 'loop/pagination.php', $args ); 313 } 314 } 315 316 317 318 if ( ! function_exists( 'mg_upc_template_loop_empty' ) ) { 319 320 /** 321 * Empty list collections 322 */ 323 function mg_upc_template_loop_empty() { 324 mg_upc_get_template( 'loop/empty.php' ); 325 } 326 } 327 328 329 330 331 332 /** 333 * Show UPC Loop 334 * 335 * Options: 336 * pagination Show pagination. Set to "1", it will use the main lists-page variable to show pagination (this should be used with a single page widget, otherwise all widgets/archives will be paginated together) 337 * tpl-items (card|list) List type 338 * tpl-cols Number of columns, comma separated: xxl,xl,lg,md,sm,xs (for card list type) Default: 4,4,4,3,2,1 339 * tpl-cols-[xs|sm|md|lg|xl|xxl] (1|2|3|4|5) Number of columns (for card list type). Override "tpl-cols". 340 * tpl-thumbs Default thumbnails layout. Set to "off" to not show 341 * tpl-thumbs-[xs|sm|md|lg|xl|xxl] (0|2x2|2x3|3x2|4x1|[1-4]x[1-4]) Thumbnails layout 342 * tpl-desc (on|off) Show description. Set to "off" to hide description 343 * tpl-user (on|off) Show author. Set to "off" to hide user 344 * tpl-meta (on|off) Show meta. Set to "off" to hide meta 345 * 346 * @param array $original_atts Array or empty string 347 * 348 */ 349 function mg_upc_template_loop( $original_atts = array() ) { 350 if ( ! is_array( $original_atts ) ) { 351 $original_atts = array(); 352 } 353 354 $defaults_atts = array( 355 'pagination' => null, 356 'tpl-desc' => 'on', 357 'tpl-thumbs' => 'on', 358 'tpl-user' => 'on', 359 'tpl-meta' => 'on', 360 'tpl-items' => 'list', 361 'tpl-cols' => '4,4,4,3,2,1', 362 'tpl-cols-xxl' => false, 363 'tpl-cols-xl' => false, 364 'tpl-cols-lg' => false, 365 'tpl-cols-md' => false, 366 'tpl-cols-sm' => false, 367 'tpl-cols-xs' => false, 368 'tpl-thumbs-xxl' => false, 369 'tpl-thumbs-xl' => false, 370 'tpl-thumbs-lg' => false, 371 'tpl-thumbs-md' => false, 372 'tpl-thumbs-sm' => false, 373 'tpl-thumbs-xs' => '4x1', 374 ); 375 $atts = array_merge( $defaults_atts, $original_atts ); 376 377 remove_action( 'mg_upc_single_list_content', 'mg_upc_template_single_title', 5 ); 378 /** @global MG_UPC_Query $mg_upc_query */ 379 global $mg_upc_query; 380 $breakpoints = array( 'xxl', 'xl', 'lg', 'md', 'sm', 'xs' ); 381 382 $tpl_cols = explode( ',', $atts['tpl-cols'] ); 383 foreach ( $breakpoints as $key => $breakpoint ) { 384 if ( isset( $tpl_cols[ $key ] ) ) { 385 $atts[ 'tpl-cols-' . $breakpoint ] = $tpl_cols[ $key ]; 386 } elseif ( $key >= 1 && isset( $atts[ 'tpl-cols-' . $breakpoints[ $key - 1 ] ] ) ) { 387 $atts[ 'tpl-cols-' . $breakpoint ] = $atts[ 'tpl-cols-' . $breakpoints[ $key - 1 ] ] - 1; 388 $atts[ 'tpl-cols-' . $breakpoint ] = max( $atts[ 'tpl-cols-' . $breakpoint ], 1 ); 389 } elseif ( isset( $breakpoints[ $key + 1 ] ) && isset( $atts[ 'tpl-cols-' . $breakpoints[ $key + 1 ] ] ) ) { 390 $atts[ 'tpl-cols-' . $breakpoint ] = $atts[ 'tpl-cols-' . $breakpoints[ $key + 1 ] ]; 391 } 392 if ( ! empty( $original_atts[ 'tpl-cols-' . $breakpoint ] ) ) { 393 $atts[ 'tpl-cols-' . $breakpoint ] = $original_atts[ 'tpl-cols-' . $breakpoint ]; 394 } 395 } 396 397 $map_class_tpl_args = array( 398 'cols' => array( 399 'prefix' => 'mg-upc-list-cols-', 400 'default' => 1, 401 'breakpoints' => $breakpoints, 402 ), 403 'thumbs' => array( 404 'prefix' => 'mg-upc-thumbs-', 405 'default' => $atts['tpl-thumbs'], 406 'breakpoints' => $breakpoints, 407 ), 408 'items' => array( 409 'prefix' => 'mg-upc-list-', 410 'default' => 'list', 411 ), 412 ); 413 414 $classes = array(); 415 foreach ( $map_class_tpl_args as $key => $map_class_tpl_arg ) { 416 if ( ! empty( $atts[ 'tpl-' . $key ] ) && '0' !== $atts[ 'tpl-' . $key ] ) { 417 $classes[] = $map_class_tpl_arg['prefix'] . $atts[ 'tpl-' . $key ]; 418 } elseif ( ! empty( $map_class_tpl_arg['default'] ) && '0' !== $map_class_tpl_arg['default'] ) { 419 $classes[] = $map_class_tpl_arg['prefix'] . $map_class_tpl_arg['default']; 420 } 421 if ( ! empty( $map_class_tpl_arg['breakpoints'] ) ) { 422 foreach ( $map_class_tpl_arg['breakpoints'] as $breakpoint ) { 423 $option_key = 'tpl-' . $key . '-' . $breakpoint; 424 if ( ! empty( $atts[ $option_key ] ) && '0' !== $atts[ $option_key ] ) { 425 $classes[] = $map_class_tpl_arg['prefix'] . $breakpoint . '-' . $atts[ $option_key ]; 426 } elseif ( ! empty( $map_class_tpl_arg['default'] ) && '0' !== $map_class_tpl_arg['default'] ) { 427 $classes[] = $map_class_tpl_arg['prefix'] . $breakpoint . '-' . $map_class_tpl_arg['default']; 428 } 429 } 430 } 431 } 432 433 $max_items = 0; 434 if ( 'off' !== $atts['tpl-thumbs'] ) { 435 if ( ! empty( $map_class_tpl_args['thumbs']['breakpoints'] ) ) { 436 foreach ( $map_class_tpl_args['thumbs']['breakpoints'] as $breakpoint ) { 437 if ( isset( $atts[ 'tpl-thumbs-' . $breakpoint ] ) ) { 438 $lines = explode( 'x', $atts[ 'tpl-thumbs-' . $breakpoint ] ); 439 $max_items = max( $max_items, (int) $lines[0] * (int) ( $lines[1] ?? 0 ) ); 440 } 441 } 442 } 443 if ( ! empty( $atts['tpl-thumbs'] ) ) { 444 $lines = explode( 'x', $atts['tpl-thumbs'] ); 445 $max_items = max( $max_items, (int) $lines[0] * (int) ( $lines[1] ?? 0 ) ); 446 } 447 } 448 449 // Set posts to get on query 450 $mg_upc_query->set_items_limit( $max_items ); 451 452 $template_args = array( 453 'mg_classes' => implode( ' ', $classes ), 454 ); 455 if ( $mg_upc_query->is_404 ) { 456 mg_upc_get_template( 'archive-404.php', $template_args ); 457 } else { 458 $hooks_to_remove = array(); 459 if ( isset( $atts['tpl-thumbs'] ) && 'off' === $atts['tpl-thumbs'] ) { 460 $hooks_to_remove[] = array( 461 'hook' => 'mg_upc_loop_single_list_content', 462 'callback' => 'mg_upc_template_loop_single_thumbs', 463 ); 464 } 465 if ( 'off' === $atts['tpl-desc'] ) { 466 $hooks_to_remove[] = array( 467 'hook' => 'mg_upc_loop_single_list_content', 468 'callback' => 'mg_upc_template_loop_single_description', 469 ); 470 } 471 if ( 'off' === $atts['tpl-user'] ) { 472 $hooks_to_remove[] = array( 473 'hook' => 'mg_upc_loop_single_list_content', 474 'callback' => 'mg_upc_template_loop_single_author', 475 ); 476 } 477 if ( 'off' === $atts['tpl-meta'] ) { 478 $hooks_to_remove[] = array( 479 'hook' => 'mg_upc_loop_single_list_content', 480 'callback' => 'mg_upc_template_loop_single_meta', 481 ); 482 } 483 if ( 1 !== (int) $atts['pagination'] ) { 484 $hooks_to_remove[] = array( 485 'hook' => 'mg_upc_after_archive_content', 486 'callback' => 'mg_upc_template_archive_pagination', 487 ); 488 } 489 foreach ( $hooks_to_remove as $k => $hook ) { 490 $priority = has_action( $hook['hook'], $hook['callback'] ); 491 if ( false !== $priority ) { 492 remove_action( $hook['hook'], $hook['callback'], $priority ); 493 $hooks_to_remove[ $k ]['priority'] = $priority; 494 $hooks_to_remove[ $k ]['removed'] = true; 495 } 496 } 497 498 mg_upc_get_template( 'content-archive-mg-upc.php', $template_args ); 499 500 foreach ( $hooks_to_remove as $hook ) { 501 if ( ! empty( $hook['removed'] ) ) { 502 add_action( $hook['hook'], $hook['callback'], $hook['priority'] ); 503 } 504 } 505 } 506 } -
user-post-collections/tags/0.9.0/includes/template-hooks.php
r2768965 r3190768 40 40 add_action( 'mg_upc_loop_product_buttons', 'mg_upc_loop_product_button', 10 ); 41 41 42 /** 43 * Empty Collection 44 * 45 * @see mg_upc_template_no_items_found() 46 */ 47 add_action( 'mg_upc_no_items_found', 'mg_upc_template_no_items_found', 10 ); 42 48 43 49 /** … … 49 55 add_action( 'mg_upc_before_main_content', 'mg_upc_output_content_wrapper', 10 ); 50 56 add_action( 'mg_upc_after_main_content', 'mg_upc_output_content_wrapper_end', 10 ); 57 58 59 /** 60 * List content. 61 * 62 * @see mg_upc_template_loop_single_thumbs() 63 * @see mg_upc_template_loop_single_info_start() 64 * @see mg_upc_template_loop_single_title() 65 * @see mg_upc_template_loop_single_author() 66 * @see mg_upc_template_loop_single_meta() 67 * @see mg_upc_template_loop_single_description() 68 * @see mg_upc_template_loop_single_info_end() 69 */ 70 add_action( 'mg_upc_loop_single_list_content', 'mg_upc_template_loop_single_thumbs', 10 ); 71 add_action( 'mg_upc_loop_single_list_content', 'mg_upc_template_loop_single_info_start', 15 ); 72 add_action( 'mg_upc_loop_single_list_content', 'mg_upc_template_loop_single_title', 20 ); 73 add_action( 'mg_upc_loop_single_list_content', 'mg_upc_template_loop_single_author', 30 ); 74 add_action( 'mg_upc_loop_single_list_content', 'mg_upc_template_loop_single_meta', 40 ); 75 add_action( 'mg_upc_loop_single_list_content', 'mg_upc_template_loop_single_description', 50 ); 76 add_action( 'mg_upc_loop_single_list_content', 'mg_upc_template_loop_single_info_end', 60 ); 77 add_action( 'mg_upc_after_archive_content', 'mg_upc_template_archive_pagination', 10 ); 78 79 /** 80 * Empty List Collections 81 * 82 * @see mg_upc_template_loop_empty() 83 */ 84 add_action( 'mg_upc_loop_empty', 'mg_upc_template_loop_empty', 10 ); -
user-post-collections/tags/0.9.0/includes/themes-helper.php
r2783097 r3190768 8 8 * 9 9 * @return false|int The collection ID or false 10 * @throws MG_UPC_Invalid_Field_Exception 10 11 */ 11 12 function mg_upc_post_in_collection( $post_id, $collection ) { 13 global $mg_upc; 12 14 if ( is_string( $collection ) ) { 13 global $mg_upc;14 15 $list = $mg_upc->model->find_always_exist( $collection, get_current_user_id() ); 15 16 … … 26 27 27 28 29 /** 30 * Display the ID of the current list in the Loop. 31 * 32 */ 33 function mg_upc_the_ID() { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.FunctionNameInvalid 34 echo (int) mg_upc_get_the_ID(); 35 } 36 37 /** 38 * Retrieve the ID of the current list in the Loop. 39 * 40 * @return int|false The ID of the current item in the Loop. False if $mg_upc_list is not set. 41 */ 42 function mg_upc_get_the_ID() { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.FunctionNameInvalid 43 $collection = mg_upc_get_list(); 44 return ! empty( $collection ) ? $collection->ID : false; 45 } 46 47 /** 48 * Retrieve a list 49 * 50 * This function attempts to fetch a list based on the provided `$collection` parameter. 51 * If `$collection` is not specified, it tries to use a global list variable. The function 52 * can return the list as an object or as an associative array depending on the `$output` parameter. 53 * 54 * @param mixed $collection Optional. The identifier for the collection to retrieve. This can be null, 55 * a list ID, a list object, or an array. If null, the function attempts 56 * to use a global list variable. Default null. 57 * @param string $output Optional. The desired format of the returned list. Accepts OBJECT for a standard 58 * object or ARRAY_A for an associative array. Default OBJECT. 59 * 60 * @return MG_UPC_List|array|null An instance of the list as an object or associative array based on `$output`, or 61 * null if the list cannot be found or `$collection` is invalid. 62 */ 63 function mg_upc_get_list( $collection = null, $output = OBJECT ) { 64 if ( empty( $collection ) && isset( $GLOBALS['mg_upc_list'] ) ) { 65 $collection = $GLOBALS['mg_upc_list']; 66 } 67 68 if ( $collection instanceof MG_UPC_List ) { 69 $_collection = $collection; 70 } else { 71 $_collection = MG_UPC_List::get_instance( $collection ); 72 } 73 74 if ( ! $_collection ) { 75 return null; 76 } 77 78 if ( ARRAY_A === $output ) { 79 return $_collection->to_array(); 80 } 81 82 return $_collection; 83 } 84 85 86 /** 87 * Get/print UPC Title 88 * 89 * @param string $before_escaped Optional. Code before. 90 * @param string $after_escaped Optional. Code after. 91 * @param bool $echo Optional. Print? (on false return code) 92 * 93 * @return string|void 94 */ 95 function mg_upc_the_title( $before_escaped = '', $after_escaped = '', $echo = true ) { 96 $title = mg_upc_get_the_title(); 97 98 if ( strlen( $title ) === 0 ) { 99 return ''; 100 } 101 102 if ( $echo ) { 103 // phpcs:ignore 104 echo $before_escaped . esc_html( $title ) . $after_escaped; 105 } 106 107 return $before_escaped . esc_html( $title ) . $after_escaped; 108 } 109 110 /** 111 * Retrieve list title. 112 * 113 * @param int|MG_UPC_List $list Optional. List ID or MG_UPC_List object. Default is global $post. 114 * 115 * @return string 116 */ 117 function mg_upc_get_the_title( $list = 0 ) { 118 119 $list = mg_upc_get_list( $list ); 120 121 $title = $list->title ?? ''; 122 $id = $list->ID ?? 0; 123 124 return apply_filters( 'mg_upc_the_title', $title, $id ); 125 } 126 127 128 129 /** 130 * Display the list content. 131 */ 132 function mg_upc_the_content() { 133 $content = mg_upc_get_the_content(); 134 135 /** 136 * Filters the list content. 137 * 138 * @param string $content Content of the current content. 139 */ 140 $content = apply_filters( 'mg_upc_the_content', $content ); 141 142 if ( strpos( $content, '<' ) !== false ) { 143 $content = force_balance_tags( $content ); 144 } 145 146 echo wp_kses( nl2br( $content ), MG_UPC_List_Controller::get_instance()->list_allowed_tags() ); 147 } 148 149 /** 150 * Retrieve the list content. 151 * 152 * @return string 153 */ 154 function mg_upc_get_the_content( $list = 0 ) { 155 $list = mg_upc_get_list( $list ); 156 157 return $list->content; 158 } 159 160 /** 161 * Displays the permalink for the current list. 162 * 163 * @param int|array|object $list Optional. List ID or list object. Default is the global `$mg_upc_list`. 164 */ 165 function mg_upc_the_permalink( $list = 0 ) { 166 echo esc_url( apply_filters( 'mg_upc_the_permalink', mg_upc_get_the_permalink( $list ), $list ) ); 167 } 168 169 /** 170 * Retrieve list title. 171 * 172 * @param int|array|object $list Optional. List ID or list object. Default is global $mg_upc_list. 173 * @return string 174 */ 175 function mg_upc_get_the_permalink( $list = 0 ) { 176 $list = mg_upc_get_list( $list ); 177 178 // Set by Page Controller 179 return apply_filters( 'mg_upc_get_the_permalink', '', $list ); 180 } 181 182 /** 183 * Check if the actual query is the main query. 184 * 185 * @global MG_UPC_Query $mg_upc_query 186 */ 187 function mg_upc_is_main_query() { 188 global $mg_upc_query; 189 return $mg_upc_query->is_main_query(); 190 } 191 192 /** 193 * Destroys the previous query and sets up a new query. 194 * 195 * @global MG_UPC_Query $mg_upc_query 196 * @global MG_UPC_Query $mg_upc_the_query 197 */ 198 function mg_upc_reset_query() { 199 $GLOBALS['mg_upc_query'] = $GLOBALS['mg_upc_the_query']; 200 mg_upc_reset_listdata(); 201 } 202 203 /** 204 * After looping through a separate query, this function restores 205 * the $mg_upc_item global to the current post in the main query. 206 * 207 * @global MG_UPC_Query $mg_upc_the_query MG_UPC_Query Query object. 208 */ 209 function mg_upc_reset_listdata() { 210 /** @global MG_UPC_Query $mg_upc_the_query MG_UPC_Query Query object. */ 211 global $mg_upc_the_query; 212 213 if ( isset( $mg_upc_the_query ) ) { 214 $mg_upc_the_query->reset_listdata(); 215 } 216 } -
user-post-collections/tags/0.9.0/includes/utils.php
r2768965 r3190768 98 98 if ( $filter_template !== $template ) { 99 99 if ( ! file_exists( $filter_template ) ) { 100 error_log(100 mg_upc_error_log( 101 101 sprintf( 102 102 /* translators: %s template */ … … 119 119 if ( ! empty( $args ) && is_array( $args ) ) { 120 120 if ( isset( $args['action_args'] ) ) { 121 error_log(121 mg_upc_error_log( 122 122 __( 'action_args should not be overwritten when calling wc_get_template.', 'user-post-collections' ) 123 123 ); … … 135 135 ); 136 136 137 /** @noinspection PhpIncludeInspection */138 137 include $action_args['located']; 139 138 … … 199 198 * Display the classes for the product div. 200 199 * 201 * @param string|array $class One or more classes to add to the class list.202 * @param array $list list.200 * @param string|array $class One or more classes to add to the class list. 201 * @param array|MG_UPC_List $list list. 203 202 */ 204 203 function mg_upc_class( $class = '', $list = null ) { 205 204 $list_class = array( $class ); 206 if ( is_array( $list ) && isset( $list['type'] ) && 'vote' === $list['type'] ) { 207 $list_class[] = 'mg-upc-vote'; 205 $list = mg_upc_get_list( $list ); 206 207 if ( 208 null !== $list && 209 isset( $list['type'] ) && 210 in_array( $list['type'], array_keys( MG_UPC_Helper::get_instance()->get_list_types() ), true ) 211 ) { 212 $list_class[] = 'mg-upc-' . $list['type']; 208 213 } 209 214 echo 'class="' . esc_attr( implode( ' ', $list_class ) ) . '"'; 210 215 } 216 217 218 /** 219 * Sanitize username for query 220 * 221 * @param $username 222 * 223 * @return string 224 */ 225 function mg_upc_sanitize_username( $username ) { 226 if ( strpos( $username, '/' ) !== false ) { 227 $username = explode( '/', $username ); 228 if ( $username[ count( $username ) - 1 ] ) { 229 $username = $username[ count( $username ) - 1 ]; // No trailing slash. 230 } else { 231 $username = $username[ count( $username ) - 2 ]; // There was a trailing slash. 232 } 233 } 234 235 return sanitize_title_for_query( $username ); 236 } 237 238 239 /** 240 * Custom error logging function. 241 * 242 * This function checks if WP_DEBUG is defined and true, and if so, logs the provided message 243 * using PHP's error_log function. 244 * 245 * @param string $message The message to log. 246 */ 247 function mg_upc_error_log( $message ) { 248 if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) { 249 error_log( $message ); 250 } 251 } -
user-post-collections/tags/0.9.0/javascript/mg-upc-client/dist/admin.js
r2856776 r3190768 1 (()=>{"use strict";var t,e,n,i,s,o,a ={},l=[],r=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i;function c(t,e){for(var n in e)t[n]=e[n];return t}function u(t){var e=t.parentNode;e&&e.removeChild(t)}function d(e,n,i){var s,o,a,l={};for(a in n)"key"==a?s=n[a]:"ref"==a?o=n[a]:l[a]=n[a];if(arguments.length>2&&(l.children=arguments.length>3?t.call(arguments,2):i),"function"==typeof e&&null!=e.defaultProps)for(a in e.defaultProps)void 0===l[a]&&(l[a]=e.defaultProps[a]);return p(e,l,s,o,null)}function p(t,i,s,o,a){var l={type:t,props:i,key:s,ref:o,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,__h:null,constructor:void 0,__v:null==a?++n:a};return null==a&&null!=e.vnode&&e.vnode(l),l}function _(t){return t.children}function m(t,e){this.props=t,this.context=e}function f(t,e){if(null==e)return t.__?f(t.__,t.__.__k.indexOf(t)+1):null;for(var n;e<t.__k.length;e++)if(null!=(n=t.__k[e])&&null!=n.__e)return n.__e;return"function"==typeof t.type?f(t):null}function g(t){var e,n;if(null!=(t=t.__)&&null!=t.__c){for(t.__e=t.__c.base=null,e=0;e<t.__k.length;e++)if(null!=(n=t.__k[e])&&null!=n.__e){t.__e=t.__c.base=n.__e;break}return g(t)}}function h(t){(!t.__d&&(t.__d=!0)&&i.push(t)&&!v.__r++||s!==e.debounceRendering)&&((s=e.debounceRendering)||setTimeout)(v)}function v(){for(var t;v.__r=i.length;)t=i.sort((function(t,e){return t.__v.__b-e.__v.__b})),i=[],t.some((function(t){var e,n,i,s,o,a;t.__d&&(o=(s=(e=t).__v).__e,(a=e.__P)&&(n=[],(i=c({},s)).__v=s.__v+1,I(a,s,i,e.__n,void 0!==a.ownerSVGElement,null!=s.__h?[o]:null,n,null==o?f(s):o,s.__h),S(n,s),s.__e!=o&&g(s)))}))}function y(t,e,n,i,s,o,r,c,u,d){var m,g,h,v,y,P,w,k=i&&i.__k||l,C=k.length;for(n.__k=[],m=0;m<e.length;m++)if(null!=(v=n.__k[m]=null==(v=e[m])||"boolean"==typeof v?null:"string"==typeof v||"number"==typeof v||"bigint"==typeof v?p(null,v,null,null,v):Array.isArray(v)?p(_,{children:v},null,null,null):v.__b>0?p(v.type,v.props,v.key,null,v.__v):v)){if(v.__=n,v.__b=n.__b+1,null===(h=k[m])||h&&v.key==h.key&&v.type===h.type)k[m]=void 0;else for(g=0;g<C;g++){if((h=k[g])&&v.key==h.key&&v.type===h.type){k[g]=void 0;break}h=null}I(t,v,h=h||a,s,o,r,c,u,d),y=v.__e,(g=v.ref)&&h.ref!=g&&(w||(w=[]),h.ref&&w.push(h.ref,null,v),w.push(g,v.__c||y,v)),null!=y?(null==P&&(P=y),"function"==typeof v.type&&v.__k===h.__k?v.__d=u=b(v,u,t):u=N(t,v,h,k,y,u),"function"==typeof n.type&&(n.__d=u)):u&&h.__e==u&&u.parentNode!=t&&(u=f(h))}for(n.__e=P,m=C;m--;)null!=k[m]&&("function"==typeof n.type&&null!=k[m].__e&&k[m].__e==n.__d&&(n.__d=f(i,m+1)),E(k[m],k[m]));if(w)for(m=0;m<w.length;m++)A(w[m],w[++m],w[++m])}function b(t,e,n){for(var i,s=t.__k,o=0;s&&o<s.length;o++)(i=s[o])&&(i.__=t,e="function"==typeof i.type?b(i,e,n):N(n,i,i,s,i.__e,e));return e}function P(t,e){return e=e||[],null==t||"boolean"==typeof t||(Array.isArray(t)?t.some((function(t){P(t,e)})):e.push(t)),e}function N(t,e,n,i,s,o){var a,l,r;if(void 0!==e.__d)a=e.__d,e.__d=void 0;else if(null==n||s!=o||null==s.parentNode)t:if(null==o||o.parentNode!==t)t.appendChild(s),a=null;else{for(l=o,r=0;(l=l.nextSibling)&&r<i.length;r+=2)if(l==s)break t;t.insertBefore(s,o),a=o}return void 0!==a?a:s.nextSibling}function w(t,e,n){"-"===e[0]?t.setProperty(e,n):t[e]=null==n?"":"number"!=typeof n||r.test(e)?n:n+"px"}function k(t,e,n,i,s){var o;t:if("style"===e)if("string"==typeof n)t.style.cssText=n;else{if("string"==typeof i&&(t.style.cssText=i=""),i)for(e in i)n&&e in n||w(t.style,e,"");if(n)for(e in n)i&&n[e]===i[e]||w(t.style,e,n[e])}else if("o"===e[0]&&"n"===e[1])o=e!==(e=e.replace(/Capture$/,"")),e=e.toLowerCase()in t?e.toLowerCase().slice(2):e.slice(2),t.l||(t.l={}),t.l[e+o]=n,n?i||t.addEventListener(e,o?x:C,o):t.removeEventListener(e,o?x:C,o);else if("dangerouslySetInnerHTML"!==e){if(s)e=e.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if("href"!==e&&"list"!==e&&"form"!==e&&"tabIndex"!==e&&"download"!==e&&e in t)try{t[e]=null==n?"":n;break t}catch(t){}"function"==typeof n||(null!=n&&(!1!==n||"a"===e[0]&&"r"===e[1])?t.setAttribute(e,n):t.removeAttribute(e))}}function C(t){this.l[t.type+!1](e.event?e.event(t):t)}function x(t){this.l[t.type+!0](e.event?e.event(t):t)}function I(t,n,i,s,o,a,l,r,u){var d,p,f,g,h,v,b,P,N,w,k,C,x,I=n.type;if(void 0!==n.constructor)return null;null!=i.__h&&(u=i.__h,r=n.__e=i.__e,n.__h=null,a=[r]),(d=e.__b)&&d(n);try{t:if("function"==typeof I){if(P=n.props,N=(d=I.contextType)&&s[d.__c],w=d?N?N.props.value:d.__:s,i.__c?b=(p=n.__c=i.__c).__=p.__E:("prototype"in I&&I.prototype.render?n.__c=p=new I(P,w):(n.__c=p=new m(P,w),p.constructor=I,p.render=L),N&&N.sub(p),p.props=P,p.state||(p.state={}),p.context=w,p.__n=s,f=p.__d=!0,p.__h=[]),null==p.__s&&(p.__s=p.state),null!=I.getDerivedStateFromProps&&(p.__s==p.state&&(p.__s=c({},p.__s)),c(p.__s,I.getDerivedStateFromProps(P,p.__s))),g=p.props,h=p.state,f)null==I.getDerivedStateFromProps&&null!=p.componentWillMount&&p.componentWillMount(),null!=p.componentDidMount&&p.__h.push(p.componentDidMount);else{if(null==I.getDerivedStateFromProps&&P!==g&&null!=p.componentWillReceiveProps&&p.componentWillReceiveProps(P,w),!p.__e&&null!=p.shouldComponentUpdate&&!1===p.shouldComponentUpdate(P,p.__s,w)||n.__v===i.__v){p.props=P,p.state=p.__s,n.__v!==i.__v&&(p.__d=!1),p.__v=n,n.__e=i.__e,n.__k=i.__k,n.__k.forEach((function(t){t&&(t.__=n)})),p.__h.length&&l.push(p);break t}null!=p.componentWillUpdate&&p.componentWillUpdate(P,p.__s,w),null!=p.componentDidUpdate&&p.__h.push((function(){p.componentDidUpdate(g,h,v)}))}if(p.context=w,p.props=P,p.__v=n,p.__P=t,k=e.__r,C=0,"prototype"in I&&I.prototype.render)p.state=p.__s,p.__d=!1,k&&k(n),d=p.render(p.props,p.state,p.context);else do{p.__d=!1,k&&k(n),d=p.render(p.props,p.state,p.context),p.state=p.__s}while(p.__d&&++C<25);p.state=p.__s,null!=p.getChildContext&&(s=c(c({},s),p.getChildContext())),f||null==p.getSnapshotBeforeUpdate||(v=p.getSnapshotBeforeUpdate(g,h)),x=null!=d&&d.type===_&&null==d.key?d.props.children:d,y(t,Array.isArray(x)?x:[x],n,i,s,o,a,l,r,u),p.base=n.__e,n.__h=null,p.__h.length&&l.push(p),b&&(p.__E=p.__=null),p.__e=!1}else null==a&&n.__v===i.__v?(n.__k=i.__k,n.__e=i.__e):n.__e=T(i.__e,n,i,s,o,a,l,u);(d=e.diffed)&&d(n)}catch(t){n.__v=null,(u||null!=a)&&(n.__e=r,n.__h=!!u,a[a.indexOf(r)]=null),e.__e(t,n,i)}}function S(t,n){e.__c&&e.__c(n,t),t.some((function(n){try{t=n.__h,n.__h=[],t.some((function(t){t.call(n)}))}catch(t){e.__e(t,n.__v)}}))}function T(e,n,i,s,o,l,r,c){var d,p,_,m=i.props,g=n.props,h=n.type,v=0;if("svg"===h&&(o=!0),null!=l)for(;v<l.length;v++)if((d=l[v])&&"setAttribute"in d==!!h&&(h?d.localName===h:3===d.nodeType)){e=d,l[v]=null;break}if(null==e){if(null===h)return document.createTextNode(g);e=o?document.createElementNS("http://www.w3.org/2000/svg",h):document.createElement(h,g.is&&g),l=null,c=!1}if(null===h)m===g||c&&e.data===g||(e.data=g);else{if(l=l&&t.call(e.childNodes),p=(m=i.props||a).dangerouslySetInnerHTML,_=g.dangerouslySetInnerHTML,!c){if(null!=l)for(m={},v=0;v<e.attributes.length;v++)m[e.attributes[v].name]=e.attributes[v].value;(_||p)&&(_&&(p&&_.__html==p.__html||_.__html===e.innerHTML)||(e.innerHTML=_&&_.__html||""))}if(function(t,e,n,i,s){var o;for(o in n)"children"===o||"key"===o||o in e||k(t,o,null,n[o],i);for(o in e)s&&"function"!=typeof e[o]||"children"===o||"key"===o||"value"===o||"checked"===o||n[o]===e[o]||k(t,o,e[o],n[o],i)}(e,g,m,o,c),_)n.__k=[];else if(v=n.props.children,y(e,Array.isArray(v)?v:[v],n,i,s,o&&"foreignObject"!==h,l,r,l?l[0]:i.__k&&f(i,0),c),null!=l)for(v=l.length;v--;)null!=l[v]&&u(l[v]);c||("value"in g&&void 0!==(v=g.value)&&(v!==e.value||"progress"===h&&!v||"option"===h&&v!==m.value)&&k(e,"value",v,m.value,!1),"checked"in g&&void 0!==(v=g.checked)&&v!==e.checked&&k(e,"checked",v,m.checked,!1))}return e}function A(t,n,i){try{"function"==typeof t?t(n):t.current=n}catch(t){e.__e(t,i)}}function E(t,n,i){var s,o;if(e.unmount&&e.unmount(t),(s=t.ref)&&(s.current&&s.current!==t.__e||A(s,null,n)),null!=(s=t.__c)){if(s.componentWillUnmount)try{s.componentWillUnmount()}catch(t){e.__e(t,n)}s.base=s.__P=null}if(s=t.__k)for(o=0;o<s.length;o++)s[o]&&E(s[o],n,"function"!=typeof t.type);i||null==t.__e||u(t.__e),t.__e=t.__d=void 0}function L(t,e,n){return this.constructor(t,n)}function D(n,i,s){var o,l,r;e.__&&e.__(n,i),l=(o="function"==typeof s)?null:s&&s.__k||i.__k,r=[],I(i,n=(!o&&s||i).__k=d(_,null,[n]),l||a,a,void 0!==i.ownerSVGElement,!o&&s?[s]:l?null:i.firstChild?t.call(i.childNodes):null,r,!o&&s?s:l?l.__e:i.firstChild,o),S(r,n)}t=l.slice,e={__e:function(t,e,n,i){for(var s,o,a;e=e.__;)if((s=e.__c)&&!s.__)try{if((o=s.constructor)&&null!=o.getDerivedStateFromError&&(s.setState(o.getDerivedStateFromError(t)),a=s.__d),null!=s.componentDidCatch&&(s.componentDidCatch(t,i||{}),a=s.__d),a)return s.__E=s}catch(e){t=e}throw t}},n=0,m.prototype.setState=function(t,e){var n;n=null!=this.__s&&this.__s!==this.state?this.__s:this.__s=c({},this.state),"function"==typeof t&&(t=t(c({},n),this.props)),t&&c(n,t),null!=t&&this.__v&&(e&&this.__h.push(e),h(this))},m.prototype.forceUpdate=function(t){this.__v&&(this.__e=!0,t&&this.__h.push(t),h(this))},m.prototype.render=_,i=[],v.__r=0,o=0;var O,U,R,W,$=0,H=[],M=[],j=e.__b,B=e.__r,F=e.diffed,V=e.__c,q=e.unmount;function X(t,n){e.__h&&e.__h(U,t,$||n),$=0;var i=U.__H||(U.__H={__:[],__h:[]});return t>=i.__.length&&i.__.push({__V:M}),i.__[t]}function K(t){return $=1,Q(ot,t)}function Q(t,e,n){var i=X(O++,2);if(i.t=t,!i.__c&&(i.__=[n?n(e):ot(void 0,e),function(t){var e=i.__N?i.__N[0]:i.__[0],n=i.t(e,t);e!==n&&(i.__N=[n,i.__[1]],i.__c.setState({}))}],i.__c=U,!i.__c.u)){i.__c.__H.u=!0;var s=i.__c.shouldComponentUpdate;i.__c.shouldComponentUpdate=function(t,e,n){if(!i.__c.__H)return!0;var o=i.__c.__H.__.filter((function(t){return t.__c}));return(o.every((function(t){return!t.__N}))||!o.every((function(t){if(!t.__N)return!0;var e=t.__[0];return t.__=t.__N,t.__N=void 0,e===t.__[0]})))&&(!s||s(t,e,n))}}return i.__N||i.__}function G(t,n){var i=X(O++,3);!e.__s&&st(i.__H,n)&&(i.__=t,i.i=n,U.__H.__h.push(i))}function z(t){return $=5,J((function(){return{current:t}}),[])}function J(t,e){var n=X(O++,7);return st(n.__H,e)?(n.__V=t(),n.i=e,n.__h=t,n.__V):n.__}function Y(t,e){return $=8,J((function(){return t}),e)}function Z(t){var e=U.context[t.__c],n=X(O++,9);return n.c=t,e?(null==n.__&&(n.__=!0,e.sub(U)),e.props.value):t.__}function tt(){for(var t;t=H.shift();)if(t.__P&&t.__H)try{t.__H.__h.forEach(nt),t.__H.__h.forEach(it),t.__H.__h=[]}catch(n){t.__H.__h=[],e.__e(n,t.__v)}}e.__b=function(t){U=null,j&&j(t)},e.__r=function(t){B&&B(t),O=0;var e=(U=t.__c).__H;e&&(R===U?(e.__h=[],U.__h=[],e.__.forEach((function(t){t.__N&&(t.__=t.__N),t.__V=M,t.__N=t.i=void 0}))):(e.__h.forEach(nt),e.__h.forEach(it),e.__h=[])),R=U},e.diffed=function(t){F&&F(t);var n=t.__c;n&&n.__H&&(n.__H.__h.length&&(1!==H.push(n)&&W===e.requestAnimationFrame||((W=e.requestAnimationFrame)||function(t){var e,n=function(){clearTimeout(i),et&&cancelAnimationFrame(e),setTimeout(t)},i=setTimeout(n,100);et&&(e=requestAnimationFrame(n))})(tt)),n.__H.__.forEach((function(t){t.i&&(t.__H=t.i),t.__V!==M&&(t.__=t.__V),t.i=void 0,t.__V=M}))),R=U=null},e.__c=function(t,n){n.some((function(t){try{t.__h.forEach(nt),t.__h=t.__h.filter((function(t){return!t.__||it(t)}))}catch(i){n.some((function(t){t.__h&&(t.__h=[])})),n=[],e.__e(i,t.__v)}})),V&&V(t,n)},e.unmount=function(t){q&&q(t);var n,i=t.__c;i&&i.__H&&(i.__H.__.forEach((function(t){try{nt(t)}catch(t){n=t}})),n&&e.__e(n,i.__v))};var et="function"==typeof requestAnimationFrame;function nt(t){var e=U,n=t.__c;"function"==typeof n&&(t.__c=void 0,n()),U=e}function it(t){var e=U;t.__c=t.__(),U=e}function st(t,e){return!t||t.length!==e.length||e.some((function(e,n){return e!==t[n]}))}function ot(t,e){return"function"==typeof e?e(t):e}const at=function(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return MgUpcTexts&&MgUpcTexts[t]?e?e.reduce((function(t,e){return t.replace(/%s/,e)}),MgUpcTexts[t]):MgUpcTexts[t]:t},lt="ui/reset",rt="ui/error",ct="ui/editing",ut="ui/mode",dt="listOfLists/set",pt="listOfLists/remove",_t="listOfLists/create",mt="listOfList/addingPost",ft="listOfList/setPage",gt="listOfList/setTotalPages",ht="list/set",vt="list/update",yt="list/setPage",bt="list/setTotalPages",Pt="list/setItems",Nt="list/removeItem",wt="list/addItem",kt="list/updateItem",Ct="list/moveItem",xt="list/cart",It=async function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"mg-upc/v1/lists";if(void 0===Dt().nonce){const t=new FormData;t.append("action","mg_upc_user");const e={method:"POST",credentials:"same-origin",referrerPolicy:"no-referrer",body:t},n=await fetch(Dt().ajaxUrl,e),i=await n.json();i.nonce&&(Dt().nonce=i.nonce),i.user_id&&(Dt().user_id=i.user_id)}const s={method:t,credentials:"same-origin",headers:{"Content-Type":"application/json","X-WP-Nonce":Dt().nonce},referrerPolicy:"no-referrer"};"GET"!==t&&n&&(s.body=JSON.stringify(n));const o=await fetch(Dt().root+i+e,s);o.headers.get("x-wp-nonce")&&(Dt().nonce=o.headers.get("x-wp-nonce"));const a=await o.json();return{data:a,headers:o.headers,status:o.status}};function St(t){const e=Object.entries(t).filter((t=>{let[,e]=t;return null!=e})).map((t=>{let[e,n]=t;return`${encodeURIComponent(e)}=${encodeURIComponent(String(n))}`})),n=-1!==Dt().root.indexOf("?")?"&":"?";return e.length>0?`${n}${e.join("&")}`:""}class Tt extends Error{constructor(t,e){var n;super(t),this.name="MgApiError",this.code=null==e||null===(n=e.data)||void 0===n?void 0:n.code,this.response=e}}function At(t){var e,n;let i=null==t||null===(e=t.data)||void 0===e||null===(n=e.data)||void 0===n?void 0:n.status;var s;if(!i&&t.status&&(i=t.status),400===i||401===i||403===i||404===i||409===i||500===i)throw new Tt(null==t||null===(s=t.data)||void 0===s?void 0:s.message,t)}let Et={my:function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return It("GET","/My"+St(t),{}).then((function(t){return At(t),t}))},discover:function(t){return It("GET","/"+St(t),{}).then((function(t){return At(t),t}))},get:function(t){return It("GET","/"+t,{}).then((function(t){return At(t),t}))},cart:function(t){return It("POST","/cart",{list:t},"mg-upc/v1").then((function(t){return At(t),t}))},items:function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return It("GET","/"+t+"/items"+St(e),{}).then((function(t){return At(t),t}))},delete:function(t){return It("DELETE","/"+t,{}).then((function(t){return At(t),t}))},create:function(t){return It("POST","",t).then((function(t){return At(t),t}))},update:function(t){let e=t.id;return delete t.id,It("PATCH","/"+e,t).then((function(t){return At(t),t}))},add:function(t,e){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return"object"!=typeof e&&(e={post_id:e}),It("POST","/"+t+"/items"+St(n),e).then((function(t){return At(t),t}))},quit:function(t,e){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return It("DELETE","/"+t+"/items/"+e+St(n),{}).then((function(t){return At(t),t}))},updateItem:function(t,e,n){return It("PATCH","/"+t+"/items/"+e,n).then((function(t){return At(t),t}))},vote:function(t,e){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return It("POST","/"+t+"/items/"+e+"/vote",n).then((function(t){return At(t),t}))},move:function(t,e,n){return It("PATCH","/"+t+"/items/"+e,{position:n}).then((function(t){return At(t),t}))}};const Lt=Et;function Dt(){return MgUserPostCollections}function Ot(){var t;return null===(t=Dt())||void 0===t?void 0:t.sortable}function Ut(t){var e;const n=null===(e=Dt())||void 0===e?void 0:e.types;return!(!n||!n[t])&&n[t]}function Rt(){var t;return Object.values(null===(t=Dt())||void 0===t?void 0:t.statuses)}function Wt(t){var e;const n=null===(e=Dt())||void 0===e?void 0:e.statuses;return!(!n||!n[t])&&n[t]}function $t(t,e){return!!t.type&&Mt(t.type,e)}function Ht(t){var e;const n=[],i=null===(e=Dt())||void 0===e?void 0:e.types;for(const e in i)i.hasOwnProperty(e)&&(Mt(e,"always_exists")||(null!=t&&t.type?i[e].available_post_types.includes(t.type)&&n.push(i[e]):n.push(i[e])));return n}function Mt(t,e){const n=Ut(t);return!(!n||!n.supports)&&n.supports.includes(e)}const jt="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVQYV2NgYAAAAAMAAWgmWQ0AAAAASUVORK5CYII=";function Bt(t){return JSON.parse(JSON.stringify(t))}function Ft(t){return t.stopImmediatePropagation&&t.stopImmediatePropagation(),t.stopPropagation&&t.stopPropagation(),t.preventDefault(),!1}function Vt(t,e){const{type:n,payload:i}=e;let s=!1;const o=t=>(s=a({status:"failed"}),t.error&&(s.error=t.error.message?t.error.message:"",s.errorCode=t.error.code?t.error.code:""),s),a=function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(s||(s=Bt(t)),e)for(const t in e)e.hasOwnProperty(t)&&(s[t]=e[t]);return s};let l=function(t,e){const{type:n,payload:i}=e;let s,o;const a=function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(o||(o=!1===t?{}:Bt(t)),e)for(const t in e)o[t]=e[t];return o};switch(n){case ht:return!0===i?{ID:-1,title:"",content:"",status:"",type:""}:i;case vt:return i.items=Bt(t.items),i;case _t:return i;case Pt:return a({items:i});case"list/addItem/failed":case wt:return null!=i&&i.list?a(i.list):t;case kt:const e=!!i.item&&i.item;return s=a().items.map((t=>t.post_id===i.post_id?e||Object.assign({},t,i):{...t})),a({items:s});case Nt:if(!t.items||1===t.items.length||!1===i)return t;if(o=a(),s=o.items.filter((t=>t.post_id!==i)),Mt(t.type,"sortable")){const e=parseInt(t.items[0].position,10);s.forEach(((t,n)=>{s[n].position=e+n}))}if(Mt(t.type,"vote")){const e=t.items.find((t=>t.post_id==i));e&&(o.vote_counter=o.vote_counter-e.votes)}return{...o,items:s};case Ct:const n=parseInt(t.items[0].position,10);s=a().items.slice();const l=a().items[i.oldIndex];return s.splice(i.oldIndex,1),s.splice(i.newIndex,0,l),isNaN(n)?(alert("positions error!"),t):(s.forEach(((t,e)=>{s[e].position=n+e})),a({items:s}));default:return t}}(t.list,e),r=function(t,e){const{type:n,payload:i}=e;switch(n){case dt:return i;case wt:case ht:return!1;case pt:return!1===i?t:Bt(t.filter((t=>t.ID!=i)));default:return t}}(t.listOfList,e);switch(t.list===l&&r===t.listOfList||(s=a({listOfList:r,list:l}),t.addingPost||(s.title=s.list?s.list.title:Qt.title)),n){case ut:return a({mode:i});case lt:return{...Qt,mode:t.mode};case rt:return a(!1===i?{error:!1,errorCode:!1}:{error:i});case"ui/message":return a(!1===i?{message:!1,errorCode:!1}:{message:i});case xt:const n=a();return i.msg&&(n.message=i.msg),i.err&&(n.error=i.err),n;case ct:return a({editing:i});case mt:return s=a(),s.addingPost=i,i&&(s.title=at("Add to...")),s;case _t:s=a(),s.title=i.title?i.title:Qt.title,s.listTotalPages=1,s.listPage=1,s.addingPost=!1;break;case wt:if(s=a(),null!=i&&i.list){const t=i.list;s.title=t.title?t.title:Qt.title;const e=null==t?void 0:t.items_page;e&&(s.listTotalPages=e["X-WP-TotalPages"]?e["X-WP-TotalPages"]:1,s.listPage=e["X-WP-Page"]?e["X-WP-Page"]:1)}i.message&&(s.error=i.message,s.status="failed"),s.addingPost=!1;break;case ft:return a({page:i});case gt:return a({totalPages:i});case yt:return a({listPage:i});case bt:return a({listTotalPages:i});case"list/set/loading":return s=a(),s.status="loading",s.listOfList=!1,"object"==typeof i?(s.list=i,i.title&&(s.title=i.title)):s.list={ID:i},s;case"list/removeItem/loading":return s=a({status:"loading"}),"object"==typeof i&&i.list_id&&(s.list={ID:i.list_id}),s;case"listOfLists/set/loading":case"list/setItems/loading":case"list/updateItem/loading":case"list/addItem/loading":case"list/moveItemNext/loading":case"list/moveItemPrev/loading":case"list/update/loading":case _t+"/loading":case"list/cart/loading":return a({status:"loading"});case"list/addItem/succeeded":return s=a(),s.addingPost=!1,s.status="succeeded",s.error=!1,s.errorCode=!1,s.title=s.list?s.list.title:Qt.title,s;case"list/cart/succeeded":return a({status:"succeeded",errorCode:!1});case"list/set/succeeded":if(!1===t.list)break;return a({status:"succeeded",error:!1,errorCode:!1});case"listOfLists/set/succeeded":case"list/setItems/succeeded":case"list/updateItem/succeeded":case"list/removeItem/succeeded":case"list/moveItem/succeeded":case"list/moveItemNext/succeeded":case"list/moveItemPrev/succeeded":case"list/update/succeeded":case _t+"/succeeded":return a({status:"succeeded",error:!1,errorCode:!1});case _t+"/failed":return s=a({status:"failed"}),e.error&&e.error.message&&(s.error=e.error.message),s;case"list/addItem/failed":if(s=a(),s.addingPost=!1,s.title=s.list?s.list.title:Qt.title,null!=i&&i.list){const t=i.list;s.title=t.title?t.title:Qt.title;const e=null==t?void 0:t.items_page;e&&(s.listTotalPages=e["X-WP-TotalPages"]?e["X-WP-TotalPages"]:1,s.listPage=e["X-WP-Page"]?e["X-WP-Page"]:1)}return i.message&&(s.error=i.message,s.status="failed"),o(e);case"listOfLists/set/failed":case"list/setItems/failed":case"list/updateItem/failed":case"list/removeItem/failed":case"list/moveItem/failed":case"list/moveItemNext/failed":case"list/moveItemPrev/failed":case"list/update/failed":case"list/set/failed":case"list/cart/failed":return o(e)}return!1!==s?s:t}const qt=(t,e)=>function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;for(var i=arguments.length,s=new Array(i>1?i-1:0),o=1;o<i;o++)s[o-1]=arguments[o];return{asyncThunk:!0,payload:e,type:t,arg:n,extra:s}};class Xt extends Error{constructor(t,e){super(t),this.name="MgUpcRejectWithValue",this.value=e}}const Kt=(t,e)=>n=>{let i;if((s=n)&&"object"==typeof s&&!0===s.asyncThunk){let s={dispatch:Kt(t,e),getState:e,extra:n.extra,rejectWithValue:t=>new Xt(n.type+": rejectWithValue",t)};t({type:n.type+"/loading",payload:n.arg}),i=n.payload(n.arg,s)}else{if(!(t=>!!t&&("object"==typeof t||"function"==typeof t)&&"function"==typeof t.then)(n.payload))return void t(n);t({type:n.type+"/loading"}),i=n.payload}var s;i.then((e=>{e instanceof Xt?t({type:n.type+"/failed",payload:e.value}):(t({type:n.type,payload:e}),t({type:n.type+"/succeeded"}))})).catch((e=>{t(e instanceof Xt?{type:n.type+"/failed",payload:e.value}:{type:n.type+"/failed",error:e})}))},Qt={list:!1,listOfList:!1,addingPost:null,status:"idle",error:null,message:null,errorCode:null,editing:!1,title:at("My Lists"),actualAction:"init",page:1,totalPages:1,listPage:1,listTotalPages:1,mode:"my"},Gt=function(t,e){var n={__c:e="__cC"+o++,__:t,Consumer:function(t,e){return t.children(e)},Provider:function(t){var n,i;return this.getChildContext||(n=[],(i={})[e]=this,this.getChildContext=function(){return i},this.shouldComponentUpdate=function(t){this.props.value!==t.value&&n.some(h)},this.sub=function(t){n.push(t);var e=t.componentWillUnmount;t.componentWillUnmount=function(){n.splice(n.indexOf(t),1),e&&e.call(t)}}),t.children}};return n.Provider.__=n.Consumer.contextType=n}({});function zt(t){return new Date(t).toLocaleDateString()}const Jt=function(t){const{state:e,dispatch:n}=Z(Gt);return d("li",{className:"mg-upc-dg-item-list",onClick:t.onClick,onKeyPress:e=>{13===e.keyCode&&t.onClick(e)},tabIndex:"0"},d("i",{className:"mg-upc-icon mg-upc-dg-item-type mg-upc-dg-item-type-"+t.list.type}),d("div",{className:"mg-upc-dg-item-title"},d("span",null,t.list.title),"my"!==e.mode&&d(_,null,d("span",null,d("a",{href:"#",onClick:function(e){Ft(e),function(t,e){const n=new URLSearchParams(document.location.hash.substring(1));n.set("author",e);let i=n.toString();""!==i&&(i="#"+i),window.location.hash=i}(0,t.list.author)}},t.list.user_login),d("span",{className:"mg-upc-list-dates"},d("i",null," ",d("b",null,"Created:")," ",zt(t.list.created)),d("i",null," ",d("b",null,"Modified:")," ",zt(t.list.modified)))))),d("span",{className:"mg-upc-dg-item-count"},t.list.count),d("span",{className:"mg-upc-dg-item-actions"},t.onRemove&&d("button",{"aria-label":at("Remove List"),onClick:e=>{e.stopPropagation(),t.onRemove(t.list)}},d("span",{className:"mg-upc-icon upc-font-trash"}))))};class Yt extends m{render(){const t=[];for(let e=0;e<this.props.count;e++){let n=this.props.styles?this.props.styles:{};null!=this.props.width&&(n.width=this.props.width),null!=this.props.height&&(n.height=this.props.height),null!==this.props.width&&null!==this.props.height&&this.props.circle&&(n.borderRadius="50%"),t.push(d("span",{key:e,className:"mg-upc-dg-loading-skeleton",style:n},""))}const e=this.props.wrapper;return d("span",null,e?t.map(((t,n)=>d(e,{key:n},t,""))):t)}}var Zt,te,ee;ee={count:1,duration:1.2,width:null,wrapper:null,height:null,circle:!1},(te="defaultProps")in(Zt=Yt)?Object.defineProperty(Zt,te,{value:ee,enumerable:!0,configurable:!0,writable:!0}):Zt[te]=ee;const ne=function(t){return d("div",{className:"mg-upc-dg-pagination-div"},d("button",{className:1===t.page?"mg-upc-dg-hidden mg-upc-dg-pagination":"mg-upc-dg-pagination",ref:t.prevRef,disabled:1===t.page,"aria-label":at("Previous page"),title:at("Previous page"),onClick:t.onPreview},d("span",{className:"mg-upc-icon upc-font-arrow_left"})),d("span",{className:t.totalPages>1?"mg-upc-dg-pagination-current":"mg-upc-dg-hidden mg-upc-dg-pagination-current"},t.page),d("button",{className:t.page>=t.totalPages?"mg-upc-dg-hidden mg-upc-dg-pagination":"mg-upc-dg-pagination",ref:t.nextRef,disabled:t.page>=t.totalPages,"aria-label":at("Next page"),title:at("Next page"),onClick:t.onNext},d("span",{className:"mg-upc-icon upc-font-arrow_right"})))},ie=()=>({type:lt,payload:null}),se=t=>({type:mt,payload:t}),oe=t=>({type:ct,payload:t}),ae=qt(xt,(async function(t,e){return await function(t){return Lt.cart(t).then((t=>(jQuery&&t.data.fragments&&t.data.cart_hash&&jQuery(document.body).trigger("added_to_cart",[t.data.fragments,t.data.cart_hash]),t.data)))}(t)})),le=qt(dt,(async function(t,e){var n;const i=null===(n=t)||void 0===n?void 0:n.addingPost;return null===t&&(t={}),t.addingPost?t.adding=t.addingPost:(t.adding="",delete t.adding),await Lt.my(t).then((t=>ce(t,e,i)))})),re=qt(dt,(async function(t,e){return null===t&&(t={}),await Lt.discover(t).then((t=>ce(t,e,!1)))}));function ce(t,e,n){if(t.headers.get("x-wp-page")&&(e.dispatch(de(parseInt(t.headers.get("x-wp-page"),10))),e.dispatch(pe(parseInt(t.headers.get("X-WP-TotalPages"),10)))),n&&t.headers.get("X-WP-Post-Type")){const i={post_id:n},s={"X-WP-Post-Type":"type","X-WP-Post-Title":"title","X-WP-Post-Image":"image"};for(const e in s){const n=t.headers.get(e);n&&(i[s[e]]=decodeURIComponent(n))}e.dispatch(se(i))}return t.data}const ue=qt(pt,(async function(t,e){return await Lt.delete(t).then((n=>{if(1===e.getState().listOfList.length){const n=e.getState().page,i=e.getState().totalPages;if(n<i)e.dispatch(le({page:n}));else{if(!(n>1&&n===i))return t;e.dispatch(le({page:n-1}))}return!1}return t}))})),de=t=>({type:ft,payload:t}),pe=t=>({type:gt,payload:t}),_e=t=>({type:yt,payload:t}),me=t=>({type:bt,payload:t}),fe=qt(ht,(async function(t,e){return!1===t||!0===t?t:await Lt.get("object"==typeof t?t.ID:t).then((t=>(Ce(t,e.dispatch),t.data)))})),ge=qt(vt,(async function(t,e){return await Lt.update(t).then((t=>(e.dispatch(oe(!1)),Ce(t,e.dispatch),t.data)))})),he=qt(_t,(async function(t,e){return null===t&&(t={}),t.adding&&t.adding!==e.getState().addingPost&&e.dispatch(se({id:t.addingPost})),await Lt.create(t).then((t=>(e.dispatch(oe(!1)),Ce(t,e.dispatch),t.data)))})),ve=qt(Pt,(async function(t,e){return await Lt.items(e.getState().list.ID,t).then((t=>(Ce(t,e.dispatch),t.data)))})),ye=qt(Nt,(async function(t,e){const n=e.getState();var i=e.extra.length>0?e.extra[0]:n.list.ID;const s=e.extra.length>1?e.extra[1]:"view";return await Lt.quit(i,t,{context:s}).then((o=>{if(o.data&&o.data.list_id,n.list&&n.list.ID){if(1===n.list.items.length){if(e.dispatch(ve({page})),n.list&&"view"===s){const t=n.listPage,i=n.listTotalPages;t<i?e.dispatch(ve({page:t})):t===i&&e.dispatch(ve({page:Math.max(1,t-1)}))}return!1}}else e.dispatch(fe({ID:i}));return t}))})),be=qt(wt,(async function(t,e){let n=e.extra[0],i=!1;try{await Lt.add(t,n,{context:e.extra.length>1?e.extra[1]:"view"}).then((t=>{i=t.data}))}catch(t){var s;const n=null==t||null===(s=t.response)||void 0===s?void 0:s.data;i=e.rejectWithValue(n)}return i})),Pe=qt(kt,(async function(t,e){const n=e.extra[0];return await Lt.updateItem(e.getState().list.ID,t,n).then((e=>{var i;return{...n,post_id:t,item:null==e||null===(i=e.data)||void 0===i?void 0:i.item}}))})),Ne=qt(Ct,(async function(t,e){const n=e.extra[0],i=e.extra[1],s=n.items[t],o=s.position-t+i;return await Lt.move(n.ID,s.post_id,o).then((e=>({oldIndex:t,newIndex:i})))})),we=qt("list/moveItemNext",(async function(t,e){const n=e.getState().list,i=parseInt(n.items[n.items.length-1].position,10);if(isNaN(i))throw alert("positions error!"),"positions error!";const s=n.items[t];return await Lt.move(n.ID,s.post_id,i+1),await e.dispatch(ve({page:e.getState().listPage})),t})),ke=qt("list/moveItemPrev",(async function(t,e){const n=e.getState().list,i=parseInt(n.items[0].position,10);if(isNaN(i))throw alert("positions error!"),"positions error!";const s=n.items[t];return await Lt.move(n.ID,s.post_id,i-1),await e.dispatch(ve({page:e.getState().listPage})),t}));function Ce(t,e){!t.data.items_page&&t.headers.get("x-wp-page")?(e(_e(parseInt(t.headers.get("x-wp-page"),10))),e(me(parseInt(t.headers.get("X-WP-TotalPages"),10)))):t.data.items_page&&(e(_e(parseInt(t.data.items_page["X-WP-Page"],10))),e(me(parseInt(t.data.items_page["X-WP-TotalPages"],10))))}const xe=function(t){const{state:e,dispatch:n}=Z(Gt);return d(_,null,d("ul",{className:"mg-upc-dg-list-of-lists-fake mg-upc-dg-on-loading"},[0,1,2].map((t=>d("li",{className:"mg-upc-dg-item-list"},d("div",null,d(Yt,{width:"1.5em",height:"1.5em"})),d("div",{className:"mg-upc-dg-item-title"},d(Yt,null)),d("div",{className:"mg-upc-dg-item-count"},d(Yt,null)))))),d("ul",{className:"mg-upc-dg-list-of-lists"},t.lists&&t.lists.map((e=>d(Jt,{list:e,onClick:()=>t.onSelect(e),onRemove:t.onRemove,key:e.ID})))),e.totalPages>1&&d(ne,{totalPages:e.totalPages,page:e.page,onPreview:t.loadPreview,onNext:t.loadNext}))},Ie=function(t){var e,n,i;const[s,o]=K(!1),[a,l]=K(""),r=z({});G((()=>{l(t.item.description)}),[t.item]),G((()=>{s&&r.current.focus()}),[s]);const c=()=>"string"==typeof a&&a.length>0;return d(_,null,d("span",null,d("br",null),"Adding item:"),d("div",{className:"mg-upc-dg-item mg-upc-dg-item-adding","data-post_id":t.item.post_id},d("span",{className:"mg-upc-icon upc-font-add"}),d("span",null," "),d("img",{className:"mg-upc-dg-item-image",src:t.item.image?t.item.image:jt}),d("div",{className:"mg-upc-dg-item-data"},d("a",{href:null===(e=t.item)||void 0===e?void 0:e.link},null===(n=t.item)||void 0===n?void 0:n.title),!s&&d("p",null,null===(i=t.item)||void 0===i?void 0:i.description),!s&&d("button",{onClick:()=>{o(!0)}},c()&&d("span",null,at("Edit Comment")),!c()&&d("span",null,at("Add Comment"))),d("input",{ref:r,className:s?"mg-upc-dg-btn-item-desc":"mg-upc-dg-dn",type:"text",value:a,onChange:function(t){l(t.target.value)},maxLength:400}),s&&d("button",{className:"mg-upc-dg-btn-item-desc-cancel",onClick:()=>{o(!1),l(t.item.description)}},d("span",{className:"mg-upc-icon upc-font-close"}),d("span",null,at("Cancel"))),s&&d("button",{className:"mg-upc-dg-btn-item-desc-save",onClick:()=>{o(!1),t.onSaveItemDescription(a)}},d("span",{className:"mg-upc-icon upc-font-save"}),d("span",null,at("Save"))))),d("span",null,at("Select where the item will be added:")))};function Se(){return Se=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},Se.apply(this,arguments)}function Te(t,e){for(var n in t)if("__source"!==n&&!(n in e))return!0;for(var i in e)if("__source"!==i&&t[i]!==e[i])return!0;return!1}function Ae(t){this.props=t}(Ae.prototype=new m).isPureReactComponent=!0,Ae.prototype.shouldComponentUpdate=function(t,e){return Te(this.props,t)||Te(this.state,e)};var Ee=e.__b;e.__b=function(t){t.type&&t.type.__f&&t.ref&&(t.props.ref=t.ref,t.ref=null),Ee&&Ee(t)},"undefined"!=typeof Symbol&&Symbol.for&&Symbol.for("react.forward_ref");var Le=e.__e;e.__e=function(t,e,n,i){if(t.then)for(var s,o=e;o=o.__;)if((s=o.__c)&&s.__c)return null==e.__e&&(e.__e=n.__e,e.__k=n.__k),s.__c(t,e);Le(t,e,n,i)};var De=e.unmount;function Oe(){this.__u=0,this.t=null,this.__b=null}function Ue(t){var e=t.__.__c;return e&&e.__a&&e.__a(t)}function Re(){this.u=null,this.o=null}e.unmount=function(t){var e=t.__c;e&&e.__R&&e.__R(),e&&!0===t.__h&&(t.type=null),De&&De(t)},(Oe.prototype=new m).__c=function(t,e){var n=e.__c,i=this;null==i.t&&(i.t=[]),i.t.push(n);var s=Ue(i.__v),o=!1,a=function(){o||(o=!0,n.__R=null,s?s(l):l())};n.__R=a;var l=function(){if(!--i.__u){if(i.state.__a){var t=i.state.__a;i.__v.__k[0]=function t(e,n,i){return e&&(e.__v=null,e.__k=e.__k&&e.__k.map((function(e){return t(e,n,i)})),e.__c&&e.__c.__P===n&&(e.__e&&i.insertBefore(e.__e,e.__d),e.__c.__e=!0,e.__c.__P=i)),e}(t,t.__c.__P,t.__c.__O)}var e;for(i.setState({__a:i.__b=null});e=i.t.pop();)e.forceUpdate()}},r=!0===e.__h;i.__u++||r||i.setState({__a:i.__b=i.__v.__k[0]}),t.then(a,a)},Oe.prototype.componentWillUnmount=function(){this.t=[]},Oe.prototype.render=function(t,e){if(this.__b){if(this.__v.__k){var n=document.createElement("div"),i=this.__v.__k[0].__c;this.__v.__k[0]=function t(e,n,i){return e&&(e.__c&&e.__c.__H&&(e.__c.__H.__.forEach((function(t){"function"==typeof t.__c&&t.__c()})),e.__c.__H=null),null!=(e=function(t,e){for(var n in e)t[n]=e[n];return t}({},e)).__c&&(e.__c.__P===i&&(e.__c.__P=n),e.__c=null),e.__k=e.__k&&e.__k.map((function(e){return t(e,n,i)}))),e}(this.__b,n,i.__O=i.__P)}this.__b=null}var s=e.__a&&d(_,null,t.fallback);return s&&(s.__h=null),[d(_,null,e.__a?null:t.children),s]};var We=function(t,e,n){if(++n[1]===n[0]&&t.o.delete(e),t.props.revealOrder&&("t"!==t.props.revealOrder[0]||!t.o.size))for(n=t.u;n;){for(;n.length>3;)n.pop()();if(n[1]<n[0])break;t.u=n=n[2]}};function $e(t){return this.getChildContext=function(){return t.context},t.children}function He(t){var e=this,n=t.i;e.componentWillUnmount=function(){D(null,e.l),e.l=null,e.i=null},e.i&&e.i!==n&&e.componentWillUnmount(),t.__v?(e.l||(e.i=n,e.l={nodeType:1,parentNode:n,childNodes:[],appendChild:function(t){this.childNodes.push(t),e.i.appendChild(t)},insertBefore:function(t,n){this.childNodes.push(t),e.i.appendChild(t)},removeChild:function(t){this.childNodes.splice(this.childNodes.indexOf(t)>>>1,1),e.i.removeChild(t)}}),D(d($e,{context:e.context},t.__v),e.l)):e.l&&e.componentWillUnmount()}(Re.prototype=new m).__a=function(t){var e=this,n=Ue(e.__v),i=e.o.get(t);return i[0]++,function(s){var o=function(){e.props.revealOrder?(i.push(s),We(e,t,i)):s()};n?n(o):o()}},Re.prototype.render=function(t){this.u=null,this.o=new Map;var e=P(t.children);t.revealOrder&&"b"===t.revealOrder[0]&&e.reverse();for(var n=e.length;n--;)this.o.set(e[n],this.u=[1,0,this.u]);return t.children},Re.prototype.componentDidUpdate=Re.prototype.componentDidMount=function(){var t=this;this.o.forEach((function(e,n){We(t,n,e)}))};var Me="undefined"!=typeof Symbol&&Symbol.for&&Symbol.for("react.element")||60103,je=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image|letter|lighting|marker(?!H|W|U)|overline|paint|pointer|shape|stop|strikethrough|stroke|text(?!L)|transform|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/,Be="undefined"!=typeof document,Fe=function(t){return("undefined"!=typeof Symbol&&"symbol"==typeof Symbol()?/fil|che|rad/i:/fil|che|ra/i).test(t)};m.prototype.isReactComponent={},["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach((function(t){Object.defineProperty(m.prototype,t,{configurable:!0,get:function(){return this["UNSAFE_"+t]},set:function(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:e})}})}));var Ve=e.event;function qe(){}function Xe(){return this.cancelBubble}function Ke(){return this.defaultPrevented}e.event=function(t){return Ve&&(t=Ve(t)),t.persist=qe,t.isPropagationStopped=Xe,t.isDefaultPrevented=Ke,t.nativeEvent=t};var Qe={configurable:!0,get:function(){return this.class}},Ge=e.vnode;e.vnode=function(t){var e=t.type,n=t.props,i=n;if("string"==typeof e){var s=-1===e.indexOf("-");for(var o in i={},n){var a=n[o];Be&&"children"===o&&"noscript"===e||"value"===o&&"defaultValue"in n&&null==a||("defaultValue"===o&&"value"in n&&null==n.value?o="value":"download"===o&&!0===a?a="":/ondoubleclick/i.test(o)?o="ondblclick":/^onchange(textarea|input)/i.test(o+e)&&!Fe(n.type)?o="oninput":/^onfocus$/i.test(o)?o="onfocusin":/^onblur$/i.test(o)?o="onfocusout":/^on(Ani|Tra|Tou|BeforeInp|Compo)/.test(o)?o=o.toLowerCase():s&&je.test(o)?o=o.replace(/[A-Z0-9]/g,"-$&").toLowerCase():null===a&&(a=void 0),/^oninput$/i.test(o)&&(o=o.toLowerCase(),i[o]&&(o="oninputCapture")),i[o]=a)}"select"==e&&i.multiple&&Array.isArray(i.value)&&(i.value=P(n.children).forEach((function(t){t.props.selected=-1!=i.value.indexOf(t.props.value)}))),"select"==e&&null!=i.defaultValue&&(i.value=P(n.children).forEach((function(t){t.props.selected=i.multiple?-1!=i.defaultValue.indexOf(t.props.value):i.defaultValue==t.props.value}))),t.props=i,n.class!=n.className&&(Qe.enumerable="className"in n,null!=n.className&&(i.class=n.className),Object.defineProperty(i,"className",Qe))}t.$$typeof=Me,Ge&&Ge(t)};var ze=e.__r;e.__r=function(t){ze&&ze(t),t.__c};var Je=['a[href]:not([tabindex^="-"])','area[href]:not([tabindex^="-"])','input:not([type="hidden"]):not([type="radio"]):not([disabled]):not([tabindex^="-"])','input[type="radio"]:not([disabled]):not([tabindex^="-"])','select:not([disabled]):not([tabindex^="-"])','textarea:not([disabled]):not([tabindex^="-"])','button:not([disabled]):not([tabindex^="-"])','iframe:not([tabindex^="-"])','audio[controls]:not([tabindex^="-"])','video[controls]:not([tabindex^="-"])','[contenteditable]:not([tabindex^="-"])','[tabindex]:not([tabindex^="-"])'];function Ye(t){this._show=this.show.bind(this),this._hide=this.hide.bind(this),this._maintainFocus=this._maintainFocus.bind(this),this._bindKeypress=this._bindKeypress.bind(this),this.$el=t,this.shown=!1,this._id=this.$el.getAttribute("data-a11y-dialog")||this.$el.id,this._previouslyFocused=null,this._listeners={},this.create()}function Ze(t,e){return n=(e||document).querySelectorAll(t),Array.prototype.slice.call(n);var n}function tn(t){(t.querySelector("[autofocus]")||t).focus()}function en(){Ze("[data-a11y-dialog]").forEach((function(t){new Ye(t)}))}Ye.prototype.create=function(){return this.$el.setAttribute("aria-hidden",!0),this.$el.setAttribute("aria-modal",!0),this.$el.setAttribute("tabindex",-1),this.$el.hasAttribute("role")||this.$el.setAttribute("role","dialog"),this._openers=Ze('[data-a11y-dialog-show="'+this._id+'"]'),this._openers.forEach(function(t){t.addEventListener("click",this._show)}.bind(this)),this._closers=Ze("[data-a11y-dialog-hide]",this.$el).concat(Ze('[data-a11y-dialog-hide="'+this._id+'"]')),this._closers.forEach(function(t){t.addEventListener("click",this._hide)}.bind(this)),this._fire("create"),this},Ye.prototype.show=function(t){return this.shown||(this._previouslyFocused=document.activeElement,this.$el.removeAttribute("aria-hidden"),this.shown=!0,tn(this.$el),document.body.addEventListener("focus",this._maintainFocus,!0),document.addEventListener("keydown",this._bindKeypress),this._fire("show",t)),this},Ye.prototype.hide=function(t){return this.shown?(this.shown=!1,this.$el.setAttribute("aria-hidden","true"),this._previouslyFocused&&this._previouslyFocused.focus&&this._previouslyFocused.focus(),document.body.removeEventListener("focus",this._maintainFocus,!0),document.removeEventListener("keydown",this._bindKeypress),this._fire("hide",t),this):this},Ye.prototype.destroy=function(){return this.hide(),this._openers.forEach(function(t){t.removeEventListener("click",this._show)}.bind(this)),this._closers.forEach(function(t){t.removeEventListener("click",this._hide)}.bind(this)),this._fire("destroy"),this._listeners={},this},Ye.prototype.on=function(t,e){return void 0===this._listeners[t]&&(this._listeners[t]=[]),this._listeners[t].push(e),this},Ye.prototype.off=function(t,e){var n=(this._listeners[t]||[]).indexOf(e);return n>-1&&this._listeners[t].splice(n,1),this},Ye.prototype._fire=function(t,e){var n=this._listeners[t]||[],i=new CustomEvent(t,{detail:e});this.$el.dispatchEvent(i),n.forEach(function(t){t(this.$el,e)}.bind(this))},Ye.prototype._bindKeypress=function(t){this.$el.contains(document.activeElement)&&(this.shown&&"Escape"===t.key&&"alertdialog"!==this.$el.getAttribute("role")&&(t.preventDefault(),this.hide(t)),this.shown&&"Tab"===t.key&&function(t,e){var n=function(t){return Ze(Je.join(","),t).filter((function(t){return!!(t.offsetWidth||t.offsetHeight||t.getClientRects().length)}))}(t),i=n.indexOf(document.activeElement);e.shiftKey&&0===i?(n[n.length-1].focus(),e.preventDefault()):e.shiftKey||i!==n.length-1||(n[0].focus(),e.preventDefault())}(this.$el,t))},Ye.prototype._maintainFocus=function(t){!this.shown||t.target.closest('[aria-modal="true"]')||t.target.closest("[data-a11y-dialog-ignore-focus-trap]")||tn(this.$el)},"undefined"!=typeof document&&("loading"===document.readyState?document.addEventListener("DOMContentLoaded",en):window.requestAnimationFrame?window.requestAnimationFrame(en):window.setTimeout(en,16));(t=>{const e=(()=>{const[t,e]=K(!1);return G((()=>e(!0)),[]),t})(),[n,i]=(t=>{const[e,n]=(()=>{const[t,e]=K(null);return[t,Y((t=>{null!==t&&e(new Ye(t))}),[])]})(),i=Y((()=>e.hide()),[e]),s=t.role||"dialog",o="alertdialog"===s,a=t.titleId||t.id+"-title";return G((()=>()=>{e&&e.destroy()}),[e]),[e,{container:{id:t.id,ref:n,role:s,tabIndex:-1,"aria-modal":!0,"aria-hidden":!0,"aria-labelledby":a},overlay:{onClick:o?void 0:i},dialog:{role:"document"},closeButton:{type:"button",onClick:i},title:{role:"heading","aria-level":1,id:a}}]})(t),{dialogRef:s}=t;if(G((()=>(n&&s(n),()=>s(void 0))),[s,n]),!e)return null;const o=t.dialogRoot?document.querySelector(t.dialogRoot):document.body,a=d("h2",Se({},i.title,{className:t.classNames.title,key:"title"}),t.onBack&&d("a",{"aria-label":t.backButtonLabel,href:"#",onClick:e=>{e.preventDefault(),t.onBack(e)}},"←")," ",t.title),l=d("button",Se({},i.closeButton,{className:t.classNames.closeButton,"aria-label":t.closeButtonLabel,key:"button"}),t.closeButtonContent),r=["first"===t.closeButtonPosition&&l,a,t.children,"last"===t.closeButtonPosition&&l].filter(Boolean);return function(t,e){var n=d(He,{__v:t,i:e});return n.containerInfo=e,n}(d("div",Se({},i.container,{className:t.classNames.container}),d("div",Se({},i.overlay,{className:t.classNames.overlay})),d("div",Se({},i.dialog,{className:t.classNames.dialog}),r)),o)}).defaultProps={role:"dialog",closeButtonLabel:"Close this dialog window",closeButtonContent:"×",closeButtonPosition:"first",classNames:{},backButtonLabel:"Back",dialogRef:()=>{}};const nn=function(t){var e;const[n,i]=K(""),[s,o]=K(""),[a,l]=K(""),[r,c]=K(""),u=J((()=>Ht(t.addingPost)),[t.addingPost]);function p(t){t.default_title&&i(t.default_title),t.default_status&&c(t.default_status),l(t.name)}return""===a&&1===u.length&&p(u[0]),G((()=>{i(t.list.title),o(t.list.content),l(t.list.type),c(t.list.status)}),[t.list]),G((()=>{var t;null!==(t=Ut(a))&&void 0!==t&&t.available_statuses&&-1===Ut(a).available_statuses.indexOf(r)&&c(Ut(a).available_statuses[0])}),[a]),d("div",{className:"mg-list-edit"},-1===t.list.ID&&""===a&&d(_,null,d("label",null,at("Select a list type:")),d("ul",{id:`type-${t.list.ID}`},u.map(((t,e)=>d("li",{className:"mg-upc-dg-item-list-type",key:t.name,onClick:()=>p(t),onKeyPress:e=>{13===e.keyCode&&p(t)},tabIndex:"0"},d("i",{className:"mg-upc-icon mg-upc-dg-item-type mg-upc-dg-item-type-"+t.name}),d("div",{className:"mg-upc-dg-item-title"},d("strong",null,t.label),d("div",{className:"mg-upc-dg-item-desc"},t.description))))))),""!==a&&Mt(a,"editable_title")&&d(_,null,d("label",{htmlFor:`title-${t.list.ID}`},at("Title")),d("input",{id:`title-${t.list.ID}`,type:"text",value:n,onChange:function(t){i(t.target.value)},maxLength:100})),""!==a&&Mt(a,"editable_content")&&d(_,null,d("label",{htmlFor:`content-${t.list.ID}`},at("Description")),d("textarea",{id:`content-${t.list.ID}`,value:s,onChange:function(t){o(t.target.value)},maxLength:500}),d("span",{className:"mg-upc-dg-list-desc-edit-count"},d("i",null,null==s?void 0:s.length),"/500")),""!==a&&!Ut(a)&&d("span",null,at("Unknown List Type...")),""!==a&&(null===(e=Ut(a))||void 0===e?void 0:e.available_statuses)&&Ut(a).available_statuses.length>1&&d(_,null,d("label",{htmlFor:`status-${t.list.ID}`},at("Status")),d("select",{id:`status-${t.list.ID}`,value:r,onChange:function(t){c(t.target.value)}},Ut(a).available_statuses.map(((t,e)=>{if(function(t){const e=Wt(t);return e&&e.show_in_status_list}(t))return d("option",{value:t},function(t){const e=Wt(t);return e?e.label:t}(t))})))),""!==a&&Ut(a)&&d("div",{className:"mg-upc-dg-edit-actions"},d("button",{onClick:()=>t.onSave({title:n,content:s,type:a,status:r})},d("span",{className:"mg-upc-icon upc-font-save"}),d("span",null,at("Save"))),d("button",{onClick:()=>t.onCancel()},d("span",{className:"mg-upc-icon upc-font-close"}),d("span",null,at("Cancel")))))},sn=function(t){var e;const[n,i]=K(!1),[s,o]=K(""),[a,l]=K(null===(e=t.item)||void 0===e?void 0:e.quantity),r=z({});G((()=>{o(t.item.description)}),[t.item]),G((()=>{n&&r.current.focus()}),[n]);const c=z(!1);return G((()=>{t.item.quantity!==a&&(clearTimeout(c.current),c.current=setTimeout((function(){t.onSaveItemQuantity(a)}),600))}),[a]),d("li",{className:"mg-upc-dg-item","data-post_id":t.item.post_id},$t(t.list,"sortable")&&d(_,null,d("span",{className:"mg-upc-dg-item-handle","aria-draggable":!0},"::"),d("span",{className:"mg-upc-dg-item-number"},t.item.position)),$t(t.list,"vote")&&d(_,null,d("span",{className:"mg-upc-dg-item-number"},(()=>{const e=parseInt(t.list.vote_counter,10);return $t(t.list,"vote")&&e>0?Math.round(100*parseInt(t.item.votes,10)/e)+"%":"0%"})())),d("a",{href:t.item.link},d("img",{className:"mg-upc-dg-item-image",src:t.item.image?t.item.image:jt})),d("div",{className:"mg-upc-dg-item-data"},d("a",{href:t.item.link},t.item.title),t.item.price_html&&d("span",{className:"mg-upc-dg-price",dangerouslySetInnerHTML:{__html:t.item.price_html}}),t.item.stock_html&&d("span",{className:"mg-upc-dg-stock",dangerouslySetInnerHTML:{__html:t.item.stock_html}}),t.editable&&!n&&d("p",null,t.item.description),t.editable&&!n&&$t(t.list,"editable_item_description")&&d("button",{onClick:()=>{i(!0)}},d("span",{className:"mg-upc-icon upc-font-edit"}),""===s&&d("span",null,at("Add Comment")),""!==s&&d("span",null,at("Edit Comment"))),d("input",{ref:r,className:n?"mg-upc-dg-btn-item-desc":"mg-upc-dg-dn",type:"text",value:s,onChange:function(t){o(t.target.value)},maxLength:400}),t.editable&&n&&d("button",{className:"mg-upc-dg-btn-item-desc-cancel",onClick:()=>{i(!1),o(t.item.description)}},d("span",{className:"mg-upc-icon upc-font-close"}),d("span",null,at("Cancel"))),t.editable&&n&&d("button",{className:"mg-upc-dg-btn-item-desc-save",onClick:()=>{i(!1),t.onSaveItemDescription(s)}},d("span",{className:"mg-upc-icon upc-font-save"}),d("span",null,at("Save")))),t.editable&&$t(t.list,"quantity")&&d("div",{className:"mg-upc-dg-quantity"},d("small",null,at("Quantity")),d("input",{"aria-label":at("Quantity"),type:"number",value:a,onChange:function(){l(event.target.value)}})),t.editable&&!n&&d("div",null,d("button",{"aria-label":"Remove item",onClick:t.onRemove},d("span",{className:"mg-upc-icon upc-font-trash"}))))},on=function(t){return new Promise((function(e,n){const i=document.createElement("script");let s=!1;i.type="text/javascript",i.src=t,i.async=!0,i.onerror=function(t){n(t,i)},i.onload=i.onreadystatechange=function(){s||this.readyState&&"complete"!=this.readyState||(s=!0,setTimeout((function(){e()}),100))},(document.head||document.body||document.documentElement).appendChild(i)}))},an=function(t){var e,n,i;const s=z(null),o=z((e=>{t.onMove(e)}));return G((()=>{o.current=t.onMove})),G((()=>{let e=!1;if($t(t.list,"sortable")){const t=()=>{e=Sortable.create(s.current,{handle:".mg-upc-dg-item-handle",group:"shared",animation:150,onUpdate:function(t){o.current(t)}})};"undefined"!=typeof Sortable?t():on(Ot()).then((()=>{t()}))}return()=>{e&&e.destroy()}})),d(_,null,d("ul",{className:"mg-upc-dg-list-fake mg-upc-dg-on-loading"},[0,1,2].map((e=>d("li",{className:"mg-upc-dg-item"},$t(t.list,"sortable")&&d(_,null,d("span",{className:"mg-upc-dg-item-handle-skeleton"}," ",d(Yt,{width:"1.5em"})," "),d("span",{className:"mg-upc-dg-item-number-skeleton"}," ",d(Yt,{width:"1em"})," ")),$t(t.list,"vote")&&d(_,null,d("span",{className:"mg-upc-dg-item-number-skeleton"}," ",d(Yt,{width:"1em"})," ")),d("div",{className:"mg-upc-dg-item-skeleton-image"},d(Yt,{width:"5em",height:"5em"})),d("div",{className:"mg-upc-dg-item-data"},d(Yt,{count:2})))))),d("ul",{ref:s,className:"mg-upc-dg-list"},0===(null==t||null===(e=t.items)||void 0===e?void 0:e.length)&&d("span",null,"There are no items in this list"),(null==t||null===(n=t.items)||void 0===n?void 0:n.length)>0&&(null===(i=t.items)||void 0===i?void 0:i.map)&&t.items.map((e=>d(sn,{list:t.list,item:e,editable:t.editable,onRemove:()=>t.onRemove(t.list,e),onSaveItemDescription:n=>t.onSaveItemDescription(t.list,e,n),onSaveItemQuantity:n=>t.onSaveItemQuantity(t.list,e,n),key:e.ID+":"+e.post_id})))),$t(t.list,"vote")&&d("span",{className:"mg-upc-dg-total-votes"}," ",at("Total votes:")," ",d("span",null," ",t.list.vote_counter)))},ln=function(t){const e=z(null),n=z(null),i=at("Copy"),[s,o]=K(i);G((()=>{let t=null;s!==i&&(t=setTimeout((()=>{o(i),clearTimeout(t)}),2e3))}),[s]);const a=encodeURIComponent(t.link),l=encodeURIComponent(t.title);let r=[{name:"Twitter",url:"https://twitter.com/share?url="+a+"&text="+l},{name:"Facebook",url:"https://www.facebook.com/sharer/sharer.php?u="+a+""e="+l},{name:"Pinterest",url:"https://pinterest.com/pin/create/button/?url="+a+"&description="+l},{name:"Whatsapp",url:"whatsapp://send?text="+a},{name:"Telegram",url:"https://t.me/share/url?url="+a+"&text="+l},{name:"LiNE",url:"https://social-plugins.line.me/lineit/share?url="+a+"&text="+l},{slug:"email",name:at("Email"),url:"mailto:?subject="+l+"&body="+a}];return void 0!==Dt().shareButtons&&(r=r.filter((t=>Dt().shareButtons.includes(t.slug||t.name.toLowerCase())))),d("div",{className:"mg-upc-dg-share-link"},d("input",{ref:e,value:t.link,onClick:function(){e.current.setSelectionRange(0,e.current.value.length)},readOnly:!0}),d("button",{ref:n,onClick:function(t){var n;(n=e.current).focus(),n.setSelectionRange(0,n.value.length),document.execCommand&&document.execCommand("copy")?o(at("Copied!")):o("Error!")}},d("span",{className:"mg-upc-icon upc-font-copy"}),d("span",null,s)),r.map((function(t){return(e=t).slug||(e.slug=e.name.toLowerCase()),d("a",{href:e.url,title:"Share with "+e.name,className:"mg-upc-dg-share",target:"_blank",rel:"noopener"},d("div",{className:"mg-upc-share-btn-img mg-upc-share-"+e.slug}," "));var e})))},rn=function(t){var e;const{state:n,dispatch:i}=Z(Gt),[s,o]=K(!1),a=z(!1),l=z(!1);function r(t){t<1||t>n.listTotalPages||"loading"===n.status||i(ve({page:t}))}return G((()=>{const t=n.list;let e=!1,s=!1;if(t&&$t(t,"sortable")){const t=()=>{a.current&&n.listPage<n.listTotalPages&&(e=Sortable.create(a.current,{group:"shared",onAdd:t=>{i(we(t.oldIndex))}})),a.current&&n.listPage>1&&(s=Sortable.create(l.current,{group:"shared",onAdd:t=>{i(ke(t.oldIndex))}}))};"undefined"!=typeof Sortable?t():on(Ot()).then((()=>{t()}))}return()=>{e&&e.destroy(),s&&s.destroy()}}),[n.list,n.listPage,n.listTotalPages]),G((()=>{o(!1)}),[n.editing,n.list,n.addingPost]),d(_,null,n.editing&&d(nn,{list:n.list,addingPost:n.addingPost,onSave:function(t){if(-1===n.list.ID||t.title!==n.list.title||t.content!==n.list.content||t.status!==n.list.status)if(-1===n.list.ID){var e;const s={};s.title=t.title,s.content=t.content,s.type=t.type,s.status=t.status,null!==(e=n.addingPost)&&void 0!==e&&e.post_id&&(s.adding=n.addingPost.post_id),i(he(s))}else{const e={id:n.list.ID};t.status!==n.list.status&&(e.status=t.status),t.title!==n.list.title&&(e.title=t.title),t.content!==n.list.content&&(e.content=t.content),i(ge(e))}},onCancel:function(){i(oe(!1)),-1===n.list.ID&&(i(fe(!1)),i(ie()),i(le()))}}),!n.editing&&d(_,null,d("div",{className:"mg-upc-dg-top-action"},function(t){var e,n;const i=t.type;return Mt(i,"editable_title")||Mt(i,"editable_content")||(null===(e=Ut(i))||void 0===e||null===(n=e.available_statuses)||void 0===n?void 0:n.length)>1}(n.list)&&d("button",{className:"mg-upg-edit",onClick:()=>i(oe(!0))},d("span",{className:"mg-upc-icon upc-font-edit"}),d("span",null,at("Edit"))),n.list.link&&d("button",{className:"mg-upg-share",onClick:()=>o(!s)},d("span",{className:"mg-upc-icon upc-font-share"}),d("span",null,at("Share"))),"cart"===n.list.type&&d("button",{className:"mg-upg-share",onClick:function(){i(ae(n.list.ID))}},d("span",{className:"mg-upc-icon upc-font-cart"}),d("span",null,at("Add all to cart")))),s&&n.list.link&&d(ln,{link:n.list.link,title:n.list.title}),n.list.content&&d("p",{className:"mg-upc-dg-list-desc",dangerouslySetInnerHTML:{__html:(c=n.list.content,"string"!=typeof c?"":c.replace(/([^>\r\n]?)(\r\n|\n\r|\r|\n)/g,"$1<br>$2"))}}),d(Yt,{count:3}),d(an,{list:n.list,items:(null===(e=n.list)||void 0===e?void 0:e.items)||[],onMove:function(t){i(Ne(t.oldIndex,n.list,t.newIndex))},onRemove:function(t,e){i(ye(e.post_id))},onSaveItemDescription:function(t,e,n){i(Pe(e.post_id,{description:n}))},onSaveItemQuantity:function(t,e,n){i(Pe(e.post_id,{quantity:n}))},editable:t.editable})),(!n.editing||!n.list)&&n.listTotalPages>1&&d(ne,{totalPages:n.listTotalPages,page:n.listPage,onPreview:function(){r(n.listPage-1)},onNext:function(){r(n.listPage+1)},prevRef:l,nextRef:a}));var c};D(d((t=>{const[e,n]=Q(Vt,Qt);return d(Gt.Provider,{value:{state:e,dispatch:Kt(n,(()=>e))}},t.children)}),null,d((function(){const{state:t,dispatch:e}=Z(Gt),[n,i]=K("any"),[s,o]=K("any"),[a,l]=K(""),[r,c]=K(null),u=z(!1),p=J((()=>Ht(t.addingPost)),[t.addingPost]),m=J((()=>{return Object.values(null===(t=Dt())||void 0===t?void 0:t.types);var t}),[]);let f="listOfList";if(t.addingPost)f=t.editing?"addingToNew":"adding";else if(t.editing){var g;f=-1!==(null===(g=t.list)||void 0===g?void 0:g.ID)?"edit":"new"}else f=t.list?"list":"listOfList";G((()=>{window.showMainLists=function(){e(ie()),h()},window.addItemToList=function(t){let n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];e(ie()),n||P(t)}}),[e]);const h=()=>{const i={};n&&(i.types=n),s&&(i.status=s),r&&(i.search=r),a&&(i.author=a),t.page>1&&(i.page=t.page),e(re(i))};function v(){t.page>1&&e(de(1))}function y(t){v(),i(t)}function b(t){v(),o(t)}G((()=>{Qt.title="",e({type:ut,payload:"admin"});const t=function(t){const n=parseInt(("author",new URLSearchParams(document.location.hash.substring(1)).get("author")),10);n>0&&n!==a&&(t&&Ft(t),e(de(1)),l(n),location.hash="")};return t(0),window.addEventListener("hashchange",t,!1),()=>{window.removeEventListener("hashchange",t)}}),[]),G((()=>{t.list||h()}),[n,s,a,t.page]),G((()=>{null!=r&&(clearTimeout(u.current),u.current=setTimeout((function(){h()}),300))}),[r]);const P=t=>{e(se({post_id:t})),e(le({addingPost:t}))};function N(n){n<1||n>t.totalPages||"loading"===t.status||e(de(n))}const w=d("h2",{key:"title"},("list"===f||"new"===f||"edit"===f||"addingToNew"===f)&&d("a",{"aria-label":"Back",className:"mg-upc-dg-back",href:"#",onClick:n=>{n.preventDefault(),function(){switch(f){case"list":e(fe(!1)),h();break;case"new":e(fe(!1)),e(oe(!1)),h();break;case"edit":e(oe(!1));break;case"addingToNew":e(fe(!1)),e(oe(!1)),e(le({addingPost:t.addingPost.post_id}));break;default:h()}}()}},"←")," ",t.title);return d(_,null,w,d("div",{className:"mg-upc-dg-content-wrapper mg-upc-dg-status-"+t.status+" mg-upc-dg-view-"+f},d("div",{className:"mg-upc-dg-wait"}),t.error&&d("div",{className:"mg-upc-dg-error"},t.error,d("a",{href:"#",className:"mg-upc-dg-alert-close","aria-label":"Hide alert",onClick:t=>{t.preventDefault(),e({type:rt,payload:null})}},d("span",{className:"mg-upc-icon upc-font-close"}))),d("div",{className:"mg-upc-dg-body"},!t.error&&t.addingPost&&d(Ie,{item:t.addingPost,onSaveItemDescription:function(n){e(se({...t.addingPost,description:n}))}}),("listOfList"===f||"adding"===f)&&d(_,null,d("div",{className:"mg-upc-dg-top-action"},p.length>0&&d("button",{className:"mg-list-new",onClick:function(t){e(oe(!0)),e(fe(!0))}},d("span",{className:"mg-upc-icon upc-font-add"}),d("span",null,at("Create List")))),d("ul",{className:"mg-upc-dg-filter"},d("li",{className:"mg-upc-dg-filter-label"},d("strong",null,at("Types"))),d("li",{className:"any"==n?"mg-upc-dg-item-list-type mg-upc-selected":"mg-upc-dg-item-list-type",onClick:()=>y("any"),onKeyPress:t=>{13===t.keyCode&&y("any")},tabIndex:"0"},d("i",{className:"mg-upc-icon upc-font-close mg-upc-dg-item-type mg-upc-dg-item-type-none"}),d("div",{className:"mg-upc-dg-item-title"},d("strong",null,"All"))),m.map(((t,e)=>d("li",{className:t.name==n?"mg-upc-dg-item-list-type mg-upc-selected":"mg-upc-dg-item-list-type",key:t.name,onClick:()=>y(t.name),onKeyPress:e=>{13===e.keyCode&&y(t.name)},tabIndex:"0"},d("i",{className:"mg-upc-icon mg-upc-dg-item-type mg-upc-dg-item-type-"+t.name}),d("div",{className:"mg-upc-dg-item-title"},d("strong",null,t.label)))))),Rt()&&d("ul",{className:"mg-upc-dg-filter"},d("li",{className:"mg-upc-dg-filter-label"},d("strong",null,at("Status"))),d("li",{className:"any"==s?"mg-upc-selected":"",onClick:()=>b("any"),onKeyPress:t=>{13===t.keyCode&&b("any")},tabIndex:"0"},d("div",{className:"mg-upc-dg-item-title"},d("strong",null,"All"))),Rt().map(((t,e)=>d("li",{className:t.name==s?"mg-upc-selected":"",key:t.name,onClick:()=>b(t.name),onKeyPress:e=>{13===e.keyCode&&b(t.name)},tabIndex:"0"},t.label)))),d("div",{className:"mg-upc-dg-df"},d("ul",{className:"mg-upc-dg-filter"},d("li",{className:"mg-upc-dg-filter-label"},d("strong",null,at("Search"))),d("input",{onChange:function(t){v(),c(t.target.value)},value:r})),d("ul",{className:"mg-upc-dg-filter"},d("li",{className:"mg-upc-dg-filter-label"},d("strong",null,at("Author (ID)"))),d("input",{type:"number",onChange:function(t){v(),l(t.target.value)},value:a}))),d(xe,{lists:t.listOfList,onSelect:function(n){e(oe(!1)),t.addingPost?e(be(n.ID,t.addingPost)):e(fe(n))},onRemove:!t.addingPost&&function(t){e(ue(t.ID))},loadPreview:function(){N(t.page-1)},loadNext:function(){N(t.page+1)}})),t.list&&d(rn,{editable:(t.list,!0)}))))}),null)," "),document.getElementById("mg-upc-admin-app")),setTimeout(window.showMainLists,1e3)})();1 (()=>{"use strict";var t,e,n,i,s,o,a,l,r,c,u,d={},_=[],p=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,m=Array.isArray;function f(t,e){for(var n in e)t[n]=e[n];return t}function g(t){t&&t.parentNode&&t.parentNode.removeChild(t)}function h(e,n,i){var s,o,a,l={};for(a in n)"key"==a?s=n[a]:"ref"==a?o=n[a]:l[a]=n[a];if(arguments.length>2&&(l.children=arguments.length>3?t.call(arguments,2):i),"function"==typeof e&&null!=e.defaultProps)for(a in e.defaultProps)void 0===l[a]&&(l[a]=e.defaultProps[a]);return v(e,l,s,o,null)}function v(t,i,s,o,a){var l={type:t,props:i,key:s,ref:o,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:null==a?++n:a,__i:-1,__u:0};return null==a&&null!=e.vnode&&e.vnode(l),l}function y(t){return t.children}function b(t,e){this.props=t,this.context=e}function P(t,e){if(null==e)return t.__?P(t.__,t.__i+1):null;for(var n;e<t.__k.length;e++)if(null!=(n=t.__k[e])&&null!=n.__e)return n.__e;return"function"==typeof t.type?P(t):null}function w(t){var e,n;if(null!=(t=t.__)&&null!=t.__c){for(t.__e=t.__c.base=null,e=0;e<t.__k.length;e++)if(null!=(n=t.__k[e])&&null!=n.__e){t.__e=t.__c.base=n.__e;break}return w(t)}}function N(t){(!t.__d&&(t.__d=!0)&&i.push(t)&&!k.__r++||s!==e.debounceRendering)&&((s=e.debounceRendering)||o)(k)}function k(){var t,n,s,o,l,r,c,u;for(i.sort(a);t=i.shift();)t.__d&&(n=i.length,o=void 0,r=(l=(s=t).__v).__e,c=[],u=[],s.__P&&((o=f({},l)).__v=l.__v+1,e.vnode&&e.vnode(o),L(s.__P,o,l,s.__n,s.__P.namespaceURI,32&l.__u?[r]:null,c,null==r?P(l):r,!!(32&l.__u),u),o.__v=l.__v,o.__.__k[o.__i]=o,O(c,o,u),o.__e!=r&&w(o)),i.length>n&&i.sort(a));k.__r=0}function C(t,e,n,i,s,o,a,l,r,c,u){var p,m,f,g,h,v=i&&i.__k||_,y=e.length;for(n.__d=r,x(n,e,v),r=n.__d,p=0;p<y;p++)null!=(f=n.__k[p])&&(m=-1===f.__i?d:v[f.__i]||d,f.__i=p,L(t,f,m,s,o,a,l,r,c,u),g=f.__e,f.ref&&m.ref!=f.ref&&(m.ref&&R(m.ref,null,f),u.push(f.ref,f.__c||g,f)),null==h&&null!=g&&(h=g),65536&f.__u||m.__k===f.__k?r=I(f,r,t):"function"==typeof f.type&&void 0!==f.__d?r=f.__d:g&&(r=g.nextSibling),f.__d=void 0,f.__u&=-196609);n.__d=r,n.__e=h}function x(t,e,n){var i,s,o,a,l,r=e.length,c=n.length,u=c,d=0;for(t.__k=[],i=0;i<r;i++)null!=(s=e[i])&&"boolean"!=typeof s&&"function"!=typeof s?(a=i+d,(s=t.__k[i]="string"==typeof s||"number"==typeof s||"bigint"==typeof s||s.constructor==String?v(null,s,null,null,null):m(s)?v(y,{children:s},null,null,null):void 0===s.constructor&&s.__b>0?v(s.type,s.props,s.key,s.ref?s.ref:null,s.__v):s).__=t,s.__b=t.__b+1,o=null,-1!==(l=s.__i=T(s,n,a,u))&&(u--,(o=n[l])&&(o.__u|=131072)),null==o||null===o.__v?(-1==l&&d--,"function"!=typeof s.type&&(s.__u|=65536)):l!==a&&(l==a-1?d--:l==a+1?d++:(l>a?d--:d++,s.__u|=65536))):s=t.__k[i]=null;if(u)for(i=0;i<c;i++)null!=(o=n[i])&&!(131072&o.__u)&&(o.__e==t.__d&&(t.__d=P(o)),W(o,o))}function I(t,e,n){var i,s;if("function"==typeof t.type){for(i=t.__k,s=0;i&&s<i.length;s++)i[s]&&(i[s].__=t,e=I(i[s],e,n));return e}t.__e!=e&&(e&&t.type&&!n.contains(e)&&(e=P(t)),n.insertBefore(t.__e,e||null),e=t.__e);do{e=e&&e.nextSibling}while(null!=e&&8===e.nodeType);return e}function S(t,e){return e=e||[],null==t||"boolean"==typeof t||(m(t)?t.some((function(t){S(t,e)})):e.push(t)),e}function T(t,e,n,i){var s=t.key,o=t.type,a=n-1,l=n+1,r=e[n];if(null===r||r&&s==r.key&&o===r.type&&!(131072&r.__u))return n;if(i>(null==r||131072&r.__u?0:1))for(;a>=0||l<e.length;){if(a>=0){if((r=e[a])&&!(131072&r.__u)&&s==r.key&&o===r.type)return a;a--}if(l<e.length){if((r=e[l])&&!(131072&r.__u)&&s==r.key&&o===r.type)return l;l++}}return-1}function E(t,e,n){"-"===e[0]?t.setProperty(e,null==n?"":n):t[e]=null==n?"":"number"!=typeof n||p.test(e)?n:n+"px"}function A(t,e,n,i,s){var o;t:if("style"===e)if("string"==typeof n)t.style.cssText=n;else{if("string"==typeof i&&(t.style.cssText=i=""),i)for(e in i)n&&e in n||E(t.style,e,"");if(n)for(e in n)i&&n[e]===i[e]||E(t.style,e,n[e])}else if("o"===e[0]&&"n"===e[1])o=e!==(e=e.replace(/(PointerCapture)$|Capture$/i,"$1")),e=e.toLowerCase()in t||"onFocusOut"===e||"onFocusIn"===e?e.toLowerCase().slice(2):e.slice(2),t.l||(t.l={}),t.l[e+o]=n,n?i?n.u=i.u:(n.u=l,t.addEventListener(e,o?c:r,o)):t.removeEventListener(e,o?c:r,o);else{if("http://www.w3.org/2000/svg"==s)e=e.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if("width"!=e&&"height"!=e&&"href"!=e&&"list"!=e&&"form"!=e&&"tabIndex"!=e&&"download"!=e&&"rowSpan"!=e&&"colSpan"!=e&&"role"!=e&&"popover"!=e&&e in t)try{t[e]=null==n?"":n;break t}catch(t){}"function"==typeof n||(null==n||!1===n&&"-"!==e[4]?t.removeAttribute(e):t.setAttribute(e,"popover"==e&&1==n?"":n))}}function D(t){return function(n){if(this.l){var i=this.l[n.type+t];if(null==n.t)n.t=l++;else if(n.t<i.u)return;return i(e.event?e.event(n):n)}}}function L(t,n,i,s,o,a,l,r,c,u){var d,_,p,g,h,v,P,w,N,k,x,I,S,T,E,A,D=n.type;if(void 0!==n.constructor)return null;128&i.__u&&(c=!!(32&i.__u),a=[r=n.__e=i.__e]),(d=e.__b)&&d(n);t:if("function"==typeof D)try{if(w=n.props,N="prototype"in D&&D.prototype.render,k=(d=D.contextType)&&s[d.__c],x=d?k?k.props.value:d.__:s,i.__c?P=(_=n.__c=i.__c).__=_.__E:(N?n.__c=_=new D(w,x):(n.__c=_=new b(w,x),_.constructor=D,_.render=H),k&&k.sub(_),_.props=w,_.state||(_.state={}),_.context=x,_.__n=s,p=_.__d=!0,_.__h=[],_._sb=[]),N&&null==_.__s&&(_.__s=_.state),N&&null!=D.getDerivedStateFromProps&&(_.__s==_.state&&(_.__s=f({},_.__s)),f(_.__s,D.getDerivedStateFromProps(w,_.__s))),g=_.props,h=_.state,_.__v=n,p)N&&null==D.getDerivedStateFromProps&&null!=_.componentWillMount&&_.componentWillMount(),N&&null!=_.componentDidMount&&_.__h.push(_.componentDidMount);else{if(N&&null==D.getDerivedStateFromProps&&w!==g&&null!=_.componentWillReceiveProps&&_.componentWillReceiveProps(w,x),!_.__e&&(null!=_.shouldComponentUpdate&&!1===_.shouldComponentUpdate(w,_.__s,x)||n.__v===i.__v)){for(n.__v!==i.__v&&(_.props=w,_.state=_.__s,_.__d=!1),n.__e=i.__e,n.__k=i.__k,n.__k.some((function(t){t&&(t.__=n)})),I=0;I<_._sb.length;I++)_.__h.push(_._sb[I]);_._sb=[],_.__h.length&&l.push(_);break t}null!=_.componentWillUpdate&&_.componentWillUpdate(w,_.__s,x),N&&null!=_.componentDidUpdate&&_.__h.push((function(){_.componentDidUpdate(g,h,v)}))}if(_.context=x,_.props=w,_.__P=t,_.__e=!1,S=e.__r,T=0,N){for(_.state=_.__s,_.__d=!1,S&&S(n),d=_.render(_.props,_.state,_.context),E=0;E<_._sb.length;E++)_.__h.push(_._sb[E]);_._sb=[]}else do{_.__d=!1,S&&S(n),d=_.render(_.props,_.state,_.context),_.state=_.__s}while(_.__d&&++T<25);_.state=_.__s,null!=_.getChildContext&&(s=f(f({},s),_.getChildContext())),N&&!p&&null!=_.getSnapshotBeforeUpdate&&(v=_.getSnapshotBeforeUpdate(g,h)),C(t,m(A=null!=d&&d.type===y&&null==d.key?d.props.children:d)?A:[A],n,i,s,o,a,l,r,c,u),_.base=n.__e,n.__u&=-161,_.__h.length&&l.push(_),P&&(_.__E=_.__=null)}catch(t){if(n.__v=null,c||null!=a){for(n.__u|=c?160:128;r&&8===r.nodeType&&r.nextSibling;)r=r.nextSibling;a[a.indexOf(r)]=null,n.__e=r}else n.__e=i.__e,n.__k=i.__k;e.__e(t,n,i)}else null==a&&n.__v===i.__v?(n.__k=i.__k,n.__e=i.__e):n.__e=U(i.__e,n,i,s,o,a,l,c,u);(d=e.diffed)&&d(n)}function O(t,n,i){n.__d=void 0;for(var s=0;s<i.length;s++)R(i[s],i[++s],i[++s]);e.__c&&e.__c(n,t),t.some((function(n){try{t=n.__h,n.__h=[],t.some((function(t){t.call(n)}))}catch(t){e.__e(t,n.__v)}}))}function U(n,i,s,o,a,l,r,c,u){var _,p,f,h,v,y,b,w=s.props,N=i.props,k=i.type;if("svg"===k?a="http://www.w3.org/2000/svg":"math"===k?a="http://www.w3.org/1998/Math/MathML":a||(a="http://www.w3.org/1999/xhtml"),null!=l)for(_=0;_<l.length;_++)if((v=l[_])&&"setAttribute"in v==!!k&&(k?v.localName===k:3===v.nodeType)){n=v,l[_]=null;break}if(null==n){if(null===k)return document.createTextNode(N);n=document.createElementNS(a,k,N.is&&N),c&&(e.__m&&e.__m(i,l),c=!1),l=null}if(null===k)w===N||c&&n.data===N||(n.data=N);else{if(l=l&&t.call(n.childNodes),w=s.props||d,!c&&null!=l)for(w={},_=0;_<n.attributes.length;_++)w[(v=n.attributes[_]).name]=v.value;for(_ in w)if(v=w[_],"children"==_);else if("dangerouslySetInnerHTML"==_)f=v;else if(!(_ in N)){if("value"==_&&"defaultValue"in N||"checked"==_&&"defaultChecked"in N)continue;A(n,_,null,v,a)}for(_ in N)v=N[_],"children"==_?h=v:"dangerouslySetInnerHTML"==_?p=v:"value"==_?y=v:"checked"==_?b=v:c&&"function"!=typeof v||w[_]===v||A(n,_,v,w[_],a);if(p)c||f&&(p.__html===f.__html||p.__html===n.innerHTML)||(n.innerHTML=p.__html),i.__k=[];else if(f&&(n.innerHTML=""),C(n,m(h)?h:[h],i,s,o,"foreignObject"===k?"http://www.w3.org/1999/xhtml":a,l,r,l?l[0]:s.__k&&P(s,0),c,u),null!=l)for(_=l.length;_--;)g(l[_]);c||(_="value","progress"===k&&null==y?n.removeAttribute("value"):void 0!==y&&(y!==n[_]||"progress"===k&&!y||"option"===k&&y!==w[_])&&A(n,_,y,w[_],a),_="checked",void 0!==b&&b!==n[_]&&A(n,_,b,w[_],a))}return n}function R(t,n,i){try{if("function"==typeof t){var s="function"==typeof t.__u;s&&t.__u(),s&&null==n||(t.__u=t(n))}else t.current=n}catch(t){e.__e(t,i)}}function W(t,n,i){var s,o;if(e.unmount&&e.unmount(t),(s=t.ref)&&(s.current&&s.current!==t.__e||R(s,null,n)),null!=(s=t.__c)){if(s.componentWillUnmount)try{s.componentWillUnmount()}catch(t){e.__e(t,n)}s.base=s.__P=null}if(s=t.__k)for(o=0;o<s.length;o++)s[o]&&W(s[o],n,i||"function"!=typeof t.type);i||g(t.__e),t.__c=t.__=t.__e=t.__d=void 0}function H(t,e,n){return this.constructor(t,n)}function $(n,i,s){var o,a,l,r;e.__&&e.__(n,i),a=(o="function"==typeof s)?null:s&&s.__k||i.__k,l=[],r=[],L(i,n=(!o&&s||i).__k=h(y,null,[n]),a||d,d,i.namespaceURI,!o&&s?[s]:a?null:i.firstChild?t.call(i.childNodes):null,l,!o&&s?s:a?a.__e:i.firstChild,o,r),O(l,n,r)}t=_.slice,e={__e:function(t,e,n,i){for(var s,o,a;e=e.__;)if((s=e.__c)&&!s.__)try{if((o=s.constructor)&&null!=o.getDerivedStateFromError&&(s.setState(o.getDerivedStateFromError(t)),a=s.__d),null!=s.componentDidCatch&&(s.componentDidCatch(t,i||{}),a=s.__d),a)return s.__E=s}catch(e){t=e}throw t}},n=0,b.prototype.setState=function(t,e){var n;n=null!=this.__s&&this.__s!==this.state?this.__s:this.__s=f({},this.state),"function"==typeof t&&(t=t(f({},n),this.props)),t&&f(n,t),null!=t&&this.__v&&(e&&this._sb.push(e),N(this))},b.prototype.forceUpdate=function(t){this.__v&&(this.__e=!0,t&&this.__h.push(t),N(this))},b.prototype.render=y,i=[],o="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,a=function(t,e){return t.__v.__b-e.__v.__b},k.__r=0,l=0,r=D(!1),c=D(!0),u=0;var M,F,j,B,q=0,K=[],X=e,V=X.__b,Q=X.__r,G=X.diffed,z=X.__c,J=X.unmount,Y=X.__;function Z(t,e){X.__h&&X.__h(F,t,q||e),q=0;var n=F.__H||(F.__H={__:[],__h:[]});return t>=n.__.length&&n.__.push({}),n.__[t]}function tt(t){return q=1,et(pt,t)}function et(t,e,n){var i=Z(M++,2);if(i.t=t,!i.__c&&(i.__=[n?n(e):pt(void 0,e),function(t){var e=i.__N?i.__N[0]:i.__[0],n=i.t(e,t);e!==n&&(i.__N=[n,i.__[1]],i.__c.setState({}))}],i.__c=F,!F.u)){var s=function(t,e,n){if(!i.__c.__H)return!0;var s=i.__c.__H.__.filter((function(t){return!!t.__c}));if(s.every((function(t){return!t.__N})))return!o||o.call(this,t,e,n);var a=!1;return s.forEach((function(t){if(t.__N){var e=t.__[0];t.__=t.__N,t.__N=void 0,e!==t.__[0]&&(a=!0)}})),!(!a&&i.__c.props===t)&&(!o||o.call(this,t,e,n))};F.u=!0;var o=F.shouldComponentUpdate,a=F.componentWillUpdate;F.componentWillUpdate=function(t,e,n){if(this.__e){var i=o;o=void 0,s(t,e,n),o=i}a&&a.call(this,t,e,n)},F.shouldComponentUpdate=s}return i.__N||i.__}function nt(t,e){var n=Z(M++,3);!X.__s&&_t(n.__H,e)&&(n.__=t,n.i=e,F.__H.__h.push(n))}function it(t){return q=5,st((function(){return{current:t}}),[])}function st(t,e){var n=Z(M++,7);return _t(n.__H,e)&&(n.__=t(),n.__H=e,n.__h=t),n.__}function ot(t,e){return q=8,st((function(){return t}),e)}function at(t){var e=F.context[t.__c],n=Z(M++,9);return n.c=t,e?(null==n.__&&(n.__=!0,e.sub(F)),e.props.value):t.__}function lt(){for(var t;t=K.shift();)if(t.__P&&t.__H)try{t.__H.__h.forEach(ut),t.__H.__h.forEach(dt),t.__H.__h=[]}catch(e){t.__H.__h=[],X.__e(e,t.__v)}}X.__b=function(t){F=null,V&&V(t)},X.__=function(t,e){t&&e.__k&&e.__k.__m&&(t.__m=e.__k.__m),Y&&Y(t,e)},X.__r=function(t){Q&&Q(t),M=0;var e=(F=t.__c).__H;e&&(j===F?(e.__h=[],F.__h=[],e.__.forEach((function(t){t.__N&&(t.__=t.__N),t.i=t.__N=void 0}))):(e.__h.forEach(ut),e.__h.forEach(dt),e.__h=[],M=0)),j=F},X.diffed=function(t){G&&G(t);var e=t.__c;e&&e.__H&&(e.__H.__h.length&&(1!==K.push(e)&&B===X.requestAnimationFrame||((B=X.requestAnimationFrame)||ct)(lt)),e.__H.__.forEach((function(t){t.i&&(t.__H=t.i),t.i=void 0}))),j=F=null},X.__c=function(t,e){e.some((function(t){try{t.__h.forEach(ut),t.__h=t.__h.filter((function(t){return!t.__||dt(t)}))}catch(n){e.some((function(t){t.__h&&(t.__h=[])})),e=[],X.__e(n,t.__v)}})),z&&z(t,e)},X.unmount=function(t){J&&J(t);var e,n=t.__c;n&&n.__H&&(n.__H.__.forEach((function(t){try{ut(t)}catch(t){e=t}})),n.__H=void 0,e&&X.__e(e,n.__v))};var rt="function"==typeof requestAnimationFrame;function ct(t){var e,n=function(){clearTimeout(i),rt&&cancelAnimationFrame(e),setTimeout(t)},i=setTimeout(n,100);rt&&(e=requestAnimationFrame(n))}function ut(t){var e=F,n=t.__c;"function"==typeof n&&(t.__c=void 0,n()),F=e}function dt(t){var e=F;t.__c=t.__(),F=e}function _t(t,e){return!t||t.length!==e.length||e.some((function(e,n){return e!==t[n]}))}function pt(t,e){return"function"==typeof e?e(t):e}const mt=function(t,e=!1){return MgUpcTexts&&MgUpcTexts[t]?e?e.reduce((function(t,e){return t.replace(/%s/,e)}),MgUpcTexts[t]):MgUpcTexts[t]:t},ft="ui/reset",gt="ui/error",ht="ui/editing",vt="ui/mode",yt="listOfLists/set",bt="listOfLists/remove",Pt="listOfLists/create",wt="listOfList/addingPost",Nt="listOfList/setPage",kt="listOfList/setTotalPages",Ct="list/set",xt="list/update",It="list/setPage",St="list/setTotalPages",Tt="list/setItems",Et="list/removeItem",At="list/addItem",Dt="list/updateItem",Lt="list/moveItem",Ot="list/moveItemNext",Ut="list/moveItemPrev",Rt="list/cart",Wt=async function(t,e="",n={},i="mg-upc/v1/lists"){if(void 0===Bt().nonce){const t=new FormData;t.append("action","mg_upc_user");const e={method:"POST",credentials:"same-origin",referrerPolicy:"no-referrer",body:t},n=await fetch(Bt().ajaxUrl,e),i=await n.json();i.nonce&&(Bt().nonce=i.nonce),i.user_id&&(Bt().user_id=i.user_id)}const s={method:t,credentials:"same-origin",headers:{"Content-Type":"application/json","X-WP-Nonce":Bt().nonce},referrerPolicy:"no-referrer"};"GET"!==t&&n&&(s.body=JSON.stringify(n));const o=await fetch(Bt().root+i+e,s);return o.headers.get("x-wp-nonce")&&(Bt().nonce=o.headers.get("x-wp-nonce")),{data:await o.json(),headers:o.headers,status:o.status}};function Ht(t){const e=Object.entries(t).filter((([,t])=>null!=t)).map((([t,e])=>`${encodeURIComponent(t)}=${encodeURIComponent(String(e))}`)),n=-1!==Bt().root.indexOf("?")?"&":"?";return e.length>0?`${n}${e.join("&")}`:""}class $t extends Error{constructor(t,e){super(t),this.name="MgApiError",this.code=e?.data?.code,this.response=e}}function Mt(t){let e=t?.data?.data?.status;if(!e&&t.status&&(e=t.status),400===e||401===e||403===e||404===e||409===e||500===e)throw new $t(t?.data?.message,t)}let Ft={my:function(t={}){return Wt("GET","/My"+Ht(t),{}).then((function(t){return Mt(t),t}))},discover:function(t){return Wt("GET","/"+Ht(t),{}).then((function(t){return Mt(t),t}))},get:function(t){return Wt("GET","/"+t,{}).then((function(t){return Mt(t),t}))},cart:function(t){return Wt("POST","/cart",{list:t},"mg-upc/v1").then((function(t){return Mt(t),t}))},items:function(t,e={}){return Wt("GET","/"+t+"/items"+Ht(e),{}).then((function(t){return Mt(t),t}))},delete:function(t){return Wt("DELETE","/"+t,{}).then((function(t){return Mt(t),t}))},create:function(t){return Wt("POST","",t).then((function(t){return Mt(t),t}))},update:function(t){let e=t.id;return delete t.id,Wt("PATCH","/"+e,t).then((function(t){return Mt(t),t}))},add:function(t,e,n={}){return"object"!=typeof e&&(e={post_id:e}),Wt("POST","/"+t+"/items"+Ht(n),e).then((function(t){return Mt(t),t}))},quit:function(t,e,n={}){return Wt("DELETE","/"+t+"/items/"+e+Ht(n),{}).then((function(t){return Mt(t),t}))},updateItem:function(t,e,n){return Wt("PATCH","/"+t+"/items/"+e,n).then((function(t){return Mt(t),t}))},vote:function(t,e,n={}){return Wt("POST","/"+t+"/items/"+e+"/vote",n).then((function(t){return Mt(t),t}))},move:function(t,e,n){return Wt("PATCH","/"+t+"/items/"+e,{position:n}).then((function(t){return Mt(t),t}))}};const jt=Ft;function Bt(){return MgUserPostCollections}function qt(){return Bt()?.sortable}function Kt(t){const e=Bt()?.types;return!(!e||!e[t])&&e[t]}function Xt(){return Object.values(Bt()?.statuses)}function Vt(t){const e=Bt()?.statuses;return!(!e||!e[t])&&e[t]}function Qt(t,e){return!!t.type&&zt(t.type,e)}function Gt(t){const e=[],n=Bt()?.types;for(const i in n)n.hasOwnProperty(i)&&(zt(i,"always_exists")||(t?.type?n[i].available_post_types.includes(t.type)&&e.push(n[i]):e.push(n[i])));return e}function zt(t,e){const n=Kt(t);return!(!n||!n.supports)&&n.supports.includes(e)}const Jt="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVQYV2NgYAAAAAMAAWgmWQ0AAAAASUVORK5CYII=";function Yt(t){return JSON.parse(JSON.stringify(t))}function Zt(t){return t.stopImmediatePropagation&&t.stopImmediatePropagation(),t.stopPropagation&&t.stopPropagation(),t.preventDefault(),!1}function te(t,e){const{type:n,payload:i}=e;let s=!1;const o=t=>(s=a({status:"failed"}),t.error&&(s.error=t.error.message?t.error.message:"",s.errorCode=t.error.code?t.error.code:""),s),a=(e=null)=>{if(s||(s=Yt(t)),e)for(const t in e)e.hasOwnProperty(t)&&(s[t]=e[t]);return s},l=(t,e=0,n="succeeded")=>(0!==e&&(t.loadingCount=t.loadingCount+e),t.loadingCount<1?(t.loadingCount=0,t.status=n):t.status="loading",t);let r=function(t,e){const{type:n,payload:i}=e;let s,o;const a=(e=!1)=>{if(o||(o=!1===t?{}:Yt(t)),e)for(const t in e)o[t]=e[t];return o};switch(n){case Ct:return!0===i?{ID:-1,title:"",content:"",status:"",type:""}:i;case xt:return i.items=Yt(t.items),i;case Pt:return i;case Tt:return a({items:i});case At+"/failed":case At:return i?.list?a(i.list):t;case Dt:const e=!!i.item&&i.item;return s=a().items.map((t=>t.post_id===i.post_id?e||Object.assign({},t,i):{...t})),a({items:s});case Et:if(!t.items||1===t.items.length||!1===i)return t;if(o=a(),s=o.items.filter((t=>t.post_id!==i)),zt(t.type,"sortable")){const e=parseInt(t.items[0].position,10);s.forEach(((t,n)=>{s[n].position=e+n}))}if(o.count=o.count-1,zt(t.type,"vote")){const e=t.items.find((t=>t.post_id==i));e&&(o.vote_counter=o.vote_counter-e.votes)}return{...o,items:s};case Lt:const n=parseInt(t.items[0].position,10);s=a().items.slice();const l=a().items[i.oldIndex];return s.splice(i.oldIndex,1),s.splice(i.newIndex,0,l),isNaN(n)?(alert("positions error!"),t):(s.forEach(((t,e)=>{s[e].position=n+e})),a({items:s}));default:return t}}(t.list,e),c=function(t,e){const{type:n,payload:i}=e;switch(n){case yt:return i;case At:case Ct:return!1;case bt:return!1===i?t:Yt(t.filter((t=>t.ID!=i)));default:return t}}(t.listOfList,e);switch(t.list===r&&c===t.listOfList||(s=a({listOfList:c,list:r}),t.addingPost||(s.title=s.list?s.list.title:se.title)),n){case vt:return a({mode:i});case ft:return{...se,mode:t.mode};case gt:return a(!1===i?{error:!1,errorCode:!1}:{error:i});case"ui/message":return a(!1===i?{message:!1,errorCode:!1}:{message:i});case Rt:const n=a();return i.msg&&(n.message=i.msg),i.err&&(n.error=i.err),n;case ht:return a({editing:i});case wt:return s=a(),s.addingPost=i,i&&(s.title=mt("Add to...")),s;case Pt:s=a(),s.title=i.title?i.title:se.title,s.listTotalPages=1,s.listPage=1,s.addingPost=!1;break;case At:if(s=a(),i?.list){const t=i.list;s.title=t.title?t.title:se.title;const e=t?.items_page;e&&(s.listTotalPages=e["X-WP-TotalPages"]?e["X-WP-TotalPages"]:1,s.listPage=e["X-WP-Page"]?e["X-WP-Page"]:1)}i.message&&(s=l(s,-1,"failed"),s.error=i.message),s.addingPost=!1;break;case Nt:return a({page:i});case kt:return a({totalPages:i});case It:return a({listPage:i});case St:return a({listTotalPages:i});case Ct+"/loading":return s=l(a(),1),s.listOfList=!1,"object"==typeof i?(s.list=i,i.title&&(s.title=i.title)):s.list={ID:i},s;case Et+"/loading":return s=l(a(),1),"object"==typeof i&&i.list_id&&(s.list={ID:i.list_id}),s;case yt+"/loading":case Tt+"/loading":case Dt+"/loading":case At+"/loading":case Ot+"/loading":case Ut+"/loading":case xt+"/loading":case Pt+"/loading":case Rt+"/loading":return l(a(),1);case At+"/succeeded":return s=l(a(),-1),s.addingPost=!1,s.status="succeeded",s.error=!1,s.errorCode=!1,s.title=s.list?s.list.title:se.title,s;case Rt+"/succeeded":return l(a({errorCode:!1}),-1);case Ct+"/succeeded":var u={error:!1,errorCode:!1};return!1===t.list&&(u={}),l(a(u),-1);case yt+"/succeeded":case Tt+"/succeeded":case Dt+"/succeeded":case Et+"/succeeded":case Lt+"/succeeded":case Ot+"/succeeded":case Ut+"/succeeded":case xt+"/succeeded":case Pt+"/succeeded":return l(a({error:!1,errorCode:!1}),-1);case Pt+"/failed":return s=l(a(),-1,"failed"),e.error&&e.error.message&&(s.error=e.error.message),s;case At+"/failed":if(s=l(a(),-1),s.addingPost=!1,s.title=s.list?s.list.title:se.title,i?.list){const t=i.list;s.title=t.title?t.title:se.title;const e=t?.items_page;e&&(s.listTotalPages=e["X-WP-TotalPages"]?e["X-WP-TotalPages"]:1,s.listPage=e["X-WP-Page"]?e["X-WP-Page"]:1)}return i.message&&(s.error=i.message,s.status="failed"),o(e);case yt+"/failed":case Tt+"/failed":case Dt+"/failed":case Et+"/failed":case Lt+"/failed":case Ot+"/failed":case Ut+"/failed":case xt+"/failed":case Ct+"/failed":case Rt+"/failed":return l(o(e),-1)}return!1!==s?s:t}const ee=(t,e)=>function(n=null,...i){return{asyncThunk:!0,payload:e,type:t,arg:n,extra:i}};class ne extends Error{constructor(t,e){super(t),this.name="MgUpcRejectWithValue",this.value=e}}const ie=(t,e)=>n=>{let i;if((s=n)&&"object"==typeof s&&!0===s.asyncThunk){let s={dispatch:ie(t,e),getState:e,extra:n.extra,rejectWithValue:t=>new ne(n.type+": rejectWithValue",t)};t({type:n.type+"/loading",payload:n.arg}),i=n.payload(n.arg,s)}else{if(!(t=>!!t&&("object"==typeof t||"function"==typeof t)&&"function"==typeof t.then)(n.payload))return void t(n);t({type:n.type+"/loading"}),i=n.payload}var s;i.then((e=>{e instanceof ne?t({type:n.type+"/failed",payload:e.value}):(t({type:n.type,payload:e}),t({type:n.type+"/succeeded"}))})).catch((e=>{t(e instanceof ne?{type:n.type+"/failed",payload:e.value}:{type:n.type+"/failed",error:e})}))},se={list:!1,listOfList:!1,addingPost:null,status:"idle",loadingCount:0,error:null,message:null,errorCode:null,editing:!1,title:mt("My Lists"),actualAction:"init",page:1,totalPages:1,listPage:1,listTotalPages:1,mode:"my"},oe=function(t,e){var n={__c:e="__cC"+u++,__:t,Consumer:function(t,e){return t.children(e)},Provider:function(t){var n,i;return this.getChildContext||(n=new Set,(i={})[e]=this,this.getChildContext=function(){return i},this.componentWillUnmount=function(){n=null},this.shouldComponentUpdate=function(t){this.props.value!==t.value&&n.forEach((function(t){t.__e=!0,N(t)}))},this.sub=function(t){n.add(t);var e=t.componentWillUnmount;t.componentWillUnmount=function(){n&&n.delete(t),e&&e.call(t)}}),t.children}};return n.Provider.__=n.Consumer.contextType=n}({});function ae(t){return new Date(t).toLocaleDateString()}const le=function(t){const{state:e,dispatch:n}=at(oe);return h("li",{className:"mg-upc-dg-item-list",onClick:t.onClick,onKeyPress:e=>{13===e.keyCode&&t.onClick(e)},tabIndex:"0"},h("i",{className:"mg-upc-icon mg-upc-dg-item-type mg-upc-dg-item-type-"+t.list.type}),h("div",{className:"mg-upc-dg-item-title"},h("span",null,t.list.title),"my"!==e.mode&&h(y,null,h("span",null,h("a",{href:"#",onClick:function(e){Zt(e),function(t,e){const n=new URLSearchParams(document.location.hash.substring(1));n.set("author",e);let i=n.toString();""!==i&&(i="#"+i),window.location.hash=i}(0,t.list.author)}},t.list.user_login),h("span",{className:"mg-upc-list-dates"},h("i",null," ",h("b",null,"Created:")," ",ae(t.list.created)),h("i",null," ",h("b",null,"Modified:")," ",ae(t.list.modified)))))),h("span",{className:"mg-upc-dg-item-count"},t.list.count),h("span",{className:"mg-upc-dg-item-actions"},t.onRemove&&h("button",{"aria-label":mt("Remove List"),onClick:e=>{e.stopPropagation(),t.onRemove(t.list)}},h("span",{className:"mg-upc-icon upc-font-trash"}))))};class re extends b{static defaultProps={count:1,duration:1.2,width:null,wrapper:null,height:null,circle:!1};render(){const t=[];for(let e=0;e<this.props.count;e++){let n=this.props.styles?this.props.styles:{};null!=this.props.width&&(n.width=this.props.width),null!=this.props.height&&(n.height=this.props.height),null!==this.props.width&&null!==this.props.height&&this.props.circle&&(n.borderRadius="50%"),t.push(h("span",{key:e,className:"mg-upc-dg-loading-skeleton",style:n},""))}const e=this.props.wrapper;return h("span",null,e?t.map(((t,n)=>h(e,{key:n},t,""))):t)}}const ce=function(t){return h("div",{className:"mg-upc-dg-pagination-div"},h("button",{className:1===t.page?"mg-upc-dg-hidden mg-upc-dg-pagination":"mg-upc-dg-pagination",ref:t.prevRef,disabled:1===t.page,"aria-label":mt("Previous page"),title:mt("Previous page"),onClick:t.onPreview},h("span",{className:"mg-upc-icon upc-font-arrow_left"})),h("span",{className:t.totalPages>1?"mg-upc-dg-pagination-current":"mg-upc-dg-hidden mg-upc-dg-pagination-current"},t.page),h("button",{className:t.page>=t.totalPages?"mg-upc-dg-hidden mg-upc-dg-pagination":"mg-upc-dg-pagination",ref:t.nextRef,disabled:t.page>=t.totalPages,"aria-label":mt("Next page"),title:mt("Next page"),onClick:t.onNext},h("span",{className:"mg-upc-icon upc-font-arrow_right"})))},ue=()=>({type:ft,payload:null}),de=t=>({type:wt,payload:t}),_e=t=>({type:ht,payload:t}),pe=ee(Rt,(async function(t,e){return await function(t){return jt.cart(t).then((t=>(jQuery&&t.data.fragments&&t.data.cart_hash&&jQuery(document.body).trigger("added_to_cart",[t.data.fragments,t.data.cart_hash]),t.data)))}(t)})),me=ee(yt,(async function(t,e){const n=t?.addingPost;return null===t&&(t={}),t.addingPost?t.adding=t.addingPost:(t.adding="",delete t.adding),await jt.my(t).then((t=>ge(t,e,n)))})),fe=ee(yt,(async function(t,e){return null===t&&(t={}),await jt.discover(t).then((t=>ge(t,e,!1)))}));function ge(t,e,n){if(t.headers.get("x-wp-page")&&(e.dispatch(ve(parseInt(t.headers.get("x-wp-page"),10))),e.dispatch(ye(parseInt(t.headers.get("X-WP-TotalPages"),10)))),n&&t.headers.get("X-WP-Post-Type")){const i={post_id:n},s={"X-WP-Post-Type":"type","X-WP-Post-Title":"title","X-WP-Post-Image":"image"};for(const e in s){const n=t.headers.get(e);n&&(i[s[e]]=decodeURIComponent(n))}e.dispatch(de(i))}return t.data}const he=ee(bt,(async function(t,e){return await jt.delete(t).then((n=>{if(1===e.getState().listOfList.length){const n=e.getState().page,i=e.getState().totalPages;if(n<i)e.dispatch(me({page:n}));else{if(!(n>1&&n===i))return t;e.dispatch(me({page:n-1}))}return!1}return t}))})),ve=t=>({type:Nt,payload:t}),ye=t=>({type:kt,payload:t}),be=t=>({type:It,payload:t}),Pe=t=>({type:St,payload:t}),we=ee(Ct,(async function(t,e){return!1===t||!0===t?t:await jt.get("object"==typeof t?t.ID:t).then((t=>(De(t,e.dispatch),t.data)))})),Ne=ee(xt,(async function(t,e){return await jt.update(t).then((t=>(e.dispatch(_e(!1)),De(t,e.dispatch),t.data)))})),ke=ee(Pt,(async function(t,e){return null===t&&(t={}),t.adding&&t.adding!==e.getState().addingPost&&e.dispatch(de({id:t.addingPost})),await jt.create(t).then((t=>(e.dispatch(_e(!1)),De(t,e.dispatch),t.data)))})),Ce=ee(Tt,(async function(t,e){return await jt.items(e.getState().list.ID,t).then((t=>(De(t,e.dispatch),t.data)))})),xe=ee(Et,(async function(t,e){const n=e.getState();var i=e.extra.length>0?e.extra[0]:n.list.ID;const s=e.extra.length>1?e.extra[1]:"view";return await jt.quit(i,t,{context:s}).then((o=>{if(o.data&&o.data.list_id&&(i=o.data.list_id),n.list&&n.list.ID)if(1===n.list.items.length){if(n.list&&"view"===s){const t=n.listPage,i=n.listTotalPages;return t<i?e.dispatch(Ce({page:t})):t===i&&e.dispatch(Ce({page:Math.max(1,t-1)})),!1}}else n.list&&"view"===s&&n.listTotalPages===n.listPage+1&&n.list.count%n.list.items.length==1&&e.dispatch(Ce({page:n.listPage}));else e.dispatch(we({ID:i}));return t}))})),Ie=ee(At,(async function(t,e){let n=e.extra[0],i=!1;try{await jt.add(t,n,{context:e.extra.length>1?e.extra[1]:"view"}).then((t=>{i=t.data}))}catch(t){const n=t?.response?.data;i=e.rejectWithValue(n)}return i})),Se=ee(Dt,(async function(t,e){const n=e.extra[0];return await jt.updateItem(e.getState().list.ID,t,n).then((e=>({...n,post_id:t,item:e?.data?.item})))})),Te=ee(Lt,(async function(t,e){const n=e.extra[0],i=e.extra[1],s=n.items[t],o=s.position-t+i;return await jt.move(n.ID,s.post_id,o).then((e=>({oldIndex:t,newIndex:i})))})),Ee=ee(Ot,(async function(t,e){const n=e.getState().list,i=parseInt(n.items[n.items.length-1].position,10);if(isNaN(i))throw alert("positions error!"),"positions error!";const s=n.items[t];return await jt.move(n.ID,s.post_id,i+1),await e.dispatch(Ce({page:e.getState().listPage})),t})),Ae=ee(Ut,(async function(t,e){const n=e.getState().list,i=parseInt(n.items[0].position,10);if(isNaN(i))throw alert("positions error!"),"positions error!";const s=n.items[t];return await jt.move(n.ID,s.post_id,i-1),await e.dispatch(Ce({page:e.getState().listPage})),t}));function De(t,e){!t.data.items_page&&t.headers.get("x-wp-page")?(e(be(parseInt(t.headers.get("x-wp-page"),10))),e(Pe(parseInt(t.headers.get("X-WP-TotalPages"),10)))):t.data.items_page&&(e(be(parseInt(t.data.items_page["X-WP-Page"],10))),e(Pe(parseInt(t.data.items_page["X-WP-TotalPages"],10))))}const Le=function(t){const{state:e,dispatch:n}=at(oe);return h(y,null,h("ul",{className:"mg-upc-dg-list-of-lists-fake mg-upc-dg-on-loading"},[0,1,2].map((t=>h("li",{className:"mg-upc-dg-item-list"},h("div",null,h(re,{width:"1.5em",height:"1.5em"})),h("div",{className:"mg-upc-dg-item-title"},h(re,null)),h("div",{className:"mg-upc-dg-item-count"},h(re,null)))))),h("ul",{className:"mg-upc-dg-list-of-lists"},t.lists&&t.lists.map((e=>h(le,{list:e,onClick:()=>t.onSelect(e),onRemove:t.onRemove,key:e.ID})))),e.totalPages>1&&h(ce,{totalPages:e.totalPages,page:e.page,onPreview:t.loadPreview,onNext:t.loadNext}))},Oe=function(t){const[e,n]=tt(!1),[i,s]=tt(""),o=it({});nt((()=>{s(t.item.description)}),[t.item]),nt((()=>{e&&o.current.focus()}),[e]);const a=()=>"string"==typeof i&&i.length>0;return h(y,null,h("span",null,h("br",null),"Adding item:"),h("div",{className:"mg-upc-dg-item mg-upc-dg-item-adding","data-post_id":t.item.post_id},h("span",{className:"mg-upc-icon upc-font-add"}),h("span",null," "),h("img",{className:"mg-upc-dg-item-image",src:t.item.image?t.item.image:Jt}),h("div",{className:"mg-upc-dg-item-data"},h("a",{href:t.item?.link},t.item?.title),!e&&h("p",null,t.item?.description),!e&&h("button",{onClick:()=>{n(!0)}},a()&&h("span",null,mt("Edit Comment")),!a()&&h("span",null,mt("Add Comment"))),h("input",{ref:o,className:e?"mg-upc-dg-btn-item-desc":"mg-upc-dg-dn",type:"text",value:i,onChange:function(t){s(t.target.value)},onKeyDown:e=>{"Enter"===e.key&&(n(!1),t.onSaveItemDescription(i))},maxLength:400}),e&&h("button",{className:"mg-upc-dg-btn-item-desc-cancel",onClick:()=>{n(!1),s(t.item.description)}},h("span",{className:"mg-upc-icon upc-font-close"}),h("span",null,mt("Cancel"))),e&&h("button",{className:"mg-upc-dg-btn-item-desc-save",onClick:()=>{n(!1),t.onSaveItemDescription(i)}},h("span",{className:"mg-upc-icon upc-font-save"}),h("span",null,mt("Save"))))),h("span",null,mt("Select where the item will be added:")))};function Ue(){return Ue=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)({}).hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},Ue.apply(null,arguments)}function Re(t,e){for(var n in t)if("__source"!==n&&!(n in e))return!0;for(var i in e)if("__source"!==i&&t[i]!==e[i])return!0;return!1}function We(t,e){this.props=t,this.context=e}(We.prototype=new b).isPureReactComponent=!0,We.prototype.shouldComponentUpdate=function(t,e){return Re(this.props,t)||Re(this.state,e)};var He=e.__b;e.__b=function(t){t.type&&t.type.__f&&t.ref&&(t.props.ref=t.ref,t.ref=null),He&&He(t)},"undefined"!=typeof Symbol&&Symbol.for&&Symbol.for("react.forward_ref");var $e=e.__e;e.__e=function(t,e,n,i){if(t.then)for(var s,o=e;o=o.__;)if((s=o.__c)&&s.__c)return null==e.__e&&(e.__e=n.__e,e.__k=n.__k),s.__c(t,e);$e(t,e,n,i)};var Me=e.unmount;function Fe(t,e,n){return t&&(t.__c&&t.__c.__H&&(t.__c.__H.__.forEach((function(t){"function"==typeof t.__c&&t.__c()})),t.__c.__H=null),null!=(t=function(t,e){for(var n in e)t[n]=e[n];return t}({},t)).__c&&(t.__c.__P===n&&(t.__c.__P=e),t.__c=null),t.__k=t.__k&&t.__k.map((function(t){return Fe(t,e,n)}))),t}function je(t,e,n){return t&&n&&(t.__v=null,t.__k=t.__k&&t.__k.map((function(t){return je(t,e,n)})),t.__c&&t.__c.__P===e&&(t.__e&&n.appendChild(t.__e),t.__c.__e=!0,t.__c.__P=n)),t}function Be(){this.__u=0,this.t=null,this.__b=null}function qe(t){var e=t.__.__c;return e&&e.__a&&e.__a(t)}function Ke(){this.u=null,this.o=null}e.unmount=function(t){var e=t.__c;e&&e.__R&&e.__R(),e&&32&t.__u&&(t.type=null),Me&&Me(t)},(Be.prototype=new b).__c=function(t,e){var n=e.__c,i=this;null==i.t&&(i.t=[]),i.t.push(n);var s=qe(i.__v),o=!1,a=function(){o||(o=!0,n.__R=null,s?s(l):l())};n.__R=a;var l=function(){if(! --i.__u){if(i.state.__a){var t=i.state.__a;i.__v.__k[0]=je(t,t.__c.__P,t.__c.__O)}var e;for(i.setState({__a:i.__b=null});e=i.t.pop();)e.forceUpdate()}};i.__u++||32&e.__u||i.setState({__a:i.__b=i.__v.__k[0]}),t.then(a,a)},Be.prototype.componentWillUnmount=function(){this.t=[]},Be.prototype.render=function(t,e){if(this.__b){if(this.__v.__k){var n=document.createElement("div"),i=this.__v.__k[0].__c;this.__v.__k[0]=Fe(this.__b,n,i.__O=i.__P)}this.__b=null}var s=e.__a&&h(y,null,t.fallback);return s&&(s.__u&=-33),[h(y,null,e.__a?null:t.children),s]};var Xe=function(t,e,n){if(++n[1]===n[0]&&t.o.delete(e),t.props.revealOrder&&("t"!==t.props.revealOrder[0]||!t.o.size))for(n=t.u;n;){for(;n.length>3;)n.pop()();if(n[1]<n[0])break;t.u=n=n[2]}};function Ve(t){return this.getChildContext=function(){return t.context},t.children}function Qe(t){var e=this,n=t.i;e.componentWillUnmount=function(){$(null,e.l),e.l=null,e.i=null},e.i&&e.i!==n&&e.componentWillUnmount(),e.l||(e.i=n,e.l={nodeType:1,parentNode:n,childNodes:[],contains:function(){return!0},appendChild:function(t){this.childNodes.push(t),e.i.appendChild(t)},insertBefore:function(t,n){this.childNodes.push(t),e.i.appendChild(t)},removeChild:function(t){this.childNodes.splice(this.childNodes.indexOf(t)>>>1,1),e.i.removeChild(t)}}),$(h(Ve,{context:e.context},t.__v),e.l)}(Ke.prototype=new b).__a=function(t){var e=this,n=qe(e.__v),i=e.o.get(t);return i[0]++,function(s){var o=function(){e.props.revealOrder?(i.push(s),Xe(e,t,i)):s()};n?n(o):o()}},Ke.prototype.render=function(t){this.u=null,this.o=new Map;var e=S(t.children);t.revealOrder&&"b"===t.revealOrder[0]&&e.reverse();for(var n=e.length;n--;)this.o.set(e[n],this.u=[1,0,this.u]);return t.children},Ke.prototype.componentDidUpdate=Ke.prototype.componentDidMount=function(){var t=this;this.o.forEach((function(e,n){Xe(t,n,e)}))};var Ge="undefined"!=typeof Symbol&&Symbol.for&&Symbol.for("react.element")||60103,ze=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image(!S)|letter|lighting|marker(?!H|W|U)|overline|paint|pointer|shape|stop|strikethrough|stroke|text(?!L)|transform|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/,Je=/^on(Ani|Tra|Tou|BeforeInp|Compo)/,Ye=/[A-Z0-9]/g,Ze="undefined"!=typeof document,tn=function(t){return("undefined"!=typeof Symbol&&"symbol"==typeof Symbol()?/fil|che|rad/:/fil|che|ra/).test(t)};b.prototype.isReactComponent={},["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach((function(t){Object.defineProperty(b.prototype,t,{configurable:!0,get:function(){return this["UNSAFE_"+t]},set:function(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:e})}})}));var en=e.event;function nn(){}function sn(){return this.cancelBubble}function on(){return this.defaultPrevented}e.event=function(t){return en&&(t=en(t)),t.persist=nn,t.isPropagationStopped=sn,t.isDefaultPrevented=on,t.nativeEvent=t};var an={enumerable:!1,configurable:!0,get:function(){return this.class}},ln=e.vnode;e.vnode=function(t){"string"==typeof t.type&&function(t){var e=t.props,n=t.type,i={},s=-1===n.indexOf("-");for(var o in e){var a=e[o];if(!("value"===o&&"defaultValue"in e&&null==a||Ze&&"children"===o&&"noscript"===n||"class"===o||"className"===o)){var l=o.toLowerCase();"defaultValue"===o&&"value"in e&&null==e.value?o="value":"download"===o&&!0===a?a="":"translate"===l&&"no"===a?a=!1:"o"===l[0]&&"n"===l[1]?"ondoubleclick"===l?o="ondblclick":"onchange"!==l||"input"!==n&&"textarea"!==n||tn(e.type)?"onfocus"===l?o="onfocusin":"onblur"===l?o="onfocusout":Je.test(o)&&(o=l):l=o="oninput":s&&ze.test(o)?o=o.replace(Ye,"-$&").toLowerCase():null===a&&(a=void 0),"oninput"===l&&i[o=l]&&(o="oninputCapture"),i[o]=a}}"select"==n&&i.multiple&&Array.isArray(i.value)&&(i.value=S(e.children).forEach((function(t){t.props.selected=-1!=i.value.indexOf(t.props.value)}))),"select"==n&&null!=i.defaultValue&&(i.value=S(e.children).forEach((function(t){t.props.selected=i.multiple?-1!=i.defaultValue.indexOf(t.props.value):i.defaultValue==t.props.value}))),e.class&&!e.className?(i.class=e.class,Object.defineProperty(i,"className",an)):(e.className&&!e.class||e.class&&e.className)&&(i.class=i.className=e.className),t.props=i}(t),t.$$typeof=Ge,ln&&ln(t)};var rn=e.__r;e.__r=function(t){rn&&rn(t),t.__c};var cn=e.diffed;e.diffed=function(t){cn&&cn(t);var e=t.props,n=t.__e;null!=n&&"textarea"===t.type&&"value"in e&&e.value!==n.value&&(n.value=null==e.value?"":e.value)};var un=['a[href]:not([tabindex^="-"])','area[href]:not([tabindex^="-"])','input:not([type="hidden"]):not([type="radio"]):not([disabled]):not([tabindex^="-"])','input[type="radio"]:not([disabled]):not([tabindex^="-"])','select:not([disabled]):not([tabindex^="-"])','textarea:not([disabled]):not([tabindex^="-"])','button:not([disabled]):not([tabindex^="-"])','iframe:not([tabindex^="-"])','audio[controls]:not([tabindex^="-"])','video[controls]:not([tabindex^="-"])','[contenteditable]:not([tabindex^="-"])','[tabindex]:not([tabindex^="-"])'];function dn(t){this._show=this.show.bind(this),this._hide=this.hide.bind(this),this._maintainFocus=this._maintainFocus.bind(this),this._bindKeypress=this._bindKeypress.bind(this),this.$el=t,this.shown=!1,this._id=this.$el.getAttribute("data-a11y-dialog")||this.$el.id,this._previouslyFocused=null,this._listeners={},this.create()}function _n(t,e){return n=(e||document).querySelectorAll(t),Array.prototype.slice.call(n);var n}function pn(t){(t.querySelector("[autofocus]")||t).focus()}function mn(){_n("[data-a11y-dialog]").forEach((function(t){new dn(t)}))}dn.prototype.create=function(){this.$el.setAttribute("aria-hidden",!0),this.$el.setAttribute("aria-modal",!0),this.$el.setAttribute("tabindex",-1),this.$el.hasAttribute("role")||this.$el.setAttribute("role","dialog"),this._openers=_n('[data-a11y-dialog-show="'+this._id+'"]'),this._openers.forEach(function(t){t.addEventListener("click",this._show)}.bind(this));const t=this.$el;return this._closers=_n("[data-a11y-dialog-hide]",this.$el).filter((function(e){return e.closest('[aria-modal="true"], [data-a11y-dialog]')===t})).concat(_n('[data-a11y-dialog-hide="'+this._id+'"]')),this._closers.forEach(function(t){t.addEventListener("click",this._hide)}.bind(this)),this._fire("create"),this},dn.prototype.show=function(t){if(this.shown)return this;this._previouslyFocused=document.activeElement;const e=t&&t.target?t.target:null;return e&&Object.is(this._previouslyFocused,document.body)&&(this._previouslyFocused=e),this.$el.removeAttribute("aria-hidden"),this.shown=!0,pn(this.$el),document.body.addEventListener("focus",this._maintainFocus,!0),document.addEventListener("keydown",this._bindKeypress),this._fire("show",t),this},dn.prototype.hide=function(t){return this.shown?(this.shown=!1,this.$el.setAttribute("aria-hidden","true"),this._previouslyFocused&&this._previouslyFocused.focus&&this._previouslyFocused.focus(),document.body.removeEventListener("focus",this._maintainFocus,!0),document.removeEventListener("keydown",this._bindKeypress),this._fire("hide",t),this):this},dn.prototype.destroy=function(){return this.hide(),this._openers.forEach(function(t){t.removeEventListener("click",this._show)}.bind(this)),this._closers.forEach(function(t){t.removeEventListener("click",this._hide)}.bind(this)),this._fire("destroy"),this._listeners={},this},dn.prototype.on=function(t,e){return void 0===this._listeners[t]&&(this._listeners[t]=[]),this._listeners[t].push(e),this},dn.prototype.off=function(t,e){var n=(this._listeners[t]||[]).indexOf(e);return n>-1&&this._listeners[t].splice(n,1),this},dn.prototype._fire=function(t,e){var n=this._listeners[t]||[],i=new CustomEvent(t,{detail:e});this.$el.dispatchEvent(i),n.forEach(function(t){t(this.$el,e)}.bind(this))},dn.prototype._bindKeypress=function(t){const e=document.activeElement;e&&e.closest('[aria-modal="true"]')!==this.$el||(this.shown&&"Escape"===t.key&&"alertdialog"!==this.$el.getAttribute("role")&&(t.preventDefault(),this.hide(t)),this.shown&&"Tab"===t.key&&function(t,e){var n=function(t){return _n(un.join(","),t).filter((function(t){return!!(t.offsetWidth||t.offsetHeight||t.getClientRects().length)}))}(t),i=n.indexOf(document.activeElement);e.shiftKey&&0===i?(n[n.length-1].focus(),e.preventDefault()):e.shiftKey||i!==n.length-1||(n[0].focus(),e.preventDefault())}(this.$el,t))},dn.prototype._maintainFocus=function(t){!this.shown||t.target.closest('[aria-modal="true"]')||t.target.closest("[data-a11y-dialog-ignore-focus-trap]")||pn(this.$el)},"undefined"!=typeof document&&("loading"===document.readyState?document.addEventListener("DOMContentLoaded",mn):window.requestAnimationFrame?window.requestAnimationFrame(mn):window.setTimeout(mn,16));(t=>{const e=(()=>{const[t,e]=tt(!1);return nt((()=>e(!0)),[]),t})(),[n,i]=(t=>{const[e,n]=(()=>{const[t,e]=tt(null);return[t,ot((t=>{null!==t&&e(new dn(t))}),[])]})(),i=ot((()=>e.hide()),[e]),s=t.role||"dialog",o="alertdialog"===s,a=t.titleId||t.id+"-title";return nt((()=>()=>{e&&e.destroy()}),[e]),[e,{container:{id:t.id,ref:n,role:s,tabIndex:-1,"aria-modal":!0,"aria-hidden":!0,"aria-labelledby":a},overlay:{onClick:o?void 0:i},dialog:{role:"document"},closeButton:{type:"button",onClick:i},title:{role:"heading","aria-level":1,id:a}}]})(t),{dialogRef:s}=t;if(nt((()=>(n&&s(n),()=>s(void 0))),[s,n]),!e)return null;const o=t.dialogRoot?document.querySelector(t.dialogRoot):document.body,a=h("h2",Ue({},i.title,{className:t.classNames.title,key:"title"}),t.onBack&&h("a",{"aria-label":t.backButtonLabel,href:"#",onClick:e=>{e.preventDefault(),t.onBack(e)}},"←")," ",t.title),l=h("button",Ue({},i.closeButton,{className:t.classNames.closeButton,"aria-label":t.closeButtonLabel,key:"button"}),t.closeButtonContent),r=["first"===t.closeButtonPosition&&l,a,t.children,"last"===t.closeButtonPosition&&l].filter(Boolean);return function(t,e){var n=h(Qe,{__v:t,i:e});return n.containerInfo=e,n}(h("div",Ue({},i.container,{className:t.classNames.container}),h("div",Ue({},i.overlay,{className:t.classNames.overlay})),h("div",Ue({},i.dialog,{className:t.classNames.dialog}),r)),o)}).defaultProps={role:"dialog",closeButtonLabel:"Close this dialog window",closeButtonContent:"×",closeButtonPosition:"first",classNames:{},backButtonLabel:"Back",dialogRef:()=>{}};const fn=function(t){const[e,n]=tt(""),[i,s]=tt(""),[o,a]=tt(""),[l,r]=tt(""),c=st((()=>Gt(t.addingPost)),[t.addingPost]);function u(t){t.default_title&&n(t.default_title),t.default_status&&r(t.default_status),a(t.name)}return""===o&&1===c.length&&u(c[0]),nt((()=>{n(t.list.title),s(t.list.content),a(t.list.type),r(t.list.status)}),[t.list.title,t.list.content,t.list.type,t.list.type]),nt((()=>{Kt(o)?.available_statuses&&-1===Kt(o).available_statuses.indexOf(l)&&r(Kt(o).available_statuses[0])}),[o]),h("div",{className:"mg-list-edit"},-1===t.list.ID&&""===o&&h(y,null,h("label",null,mt("Select a list type:")),h("ul",{id:`type-${t.list.ID}`},c.map(((t,e)=>h("li",{className:"mg-upc-dg-item-list-type",key:t.name,onClick:()=>u(t),onKeyPress:e=>{13===e.keyCode&&u(t)},tabIndex:"0"},h("i",{className:"mg-upc-icon mg-upc-dg-item-type mg-upc-dg-item-type-"+t.name}),h("div",{className:"mg-upc-dg-item-title"},h("strong",null,t.label),h("div",{className:"mg-upc-dg-item-desc"},t.description))))))),""!==o&&zt(o,"editable_title")&&h(y,null,h("label",{htmlFor:`title-${t.list.ID}`},mt("Title")),h("input",{id:`title-${t.list.ID}`,type:"text",value:e,onChange:function(t){n(t.target.value)},maxLength:100})),""!==o&&zt(o,"editable_content")&&h(y,null,h("label",{htmlFor:`content-${t.list.ID}`},mt("Description")),h("textarea",{id:`content-${t.list.ID}`,value:i,onChange:function(t){s(t.target.value)},maxLength:500}),h("span",{className:"mg-upc-dg-list-desc-edit-count"},h("i",null,i?.length),"/500")),""!==o&&!Kt(o)&&h("span",null,mt("Unknown List Type...")),""!==o&&Kt(o)?.available_statuses&&Kt(o).available_statuses.length>1&&h(y,null,h("label",{htmlFor:`status-${t.list.ID}`},mt("Status")),h("select",{id:`status-${t.list.ID}`,value:l,onChange:function(t){r(t.target.value)}},Kt(o).available_statuses.map(((t,e)=>{if(function(t){const e=Vt(t);return e&&e.show_in_status_list}(t))return h("option",{value:t},function(t){const e=Vt(t);return e?e.label:t}(t))})))),""!==o&&Kt(o)&&h("div",{className:"mg-upc-dg-edit-actions"},h("button",{onClick:()=>t.onSave({title:e,content:i,type:o,status:l})},h("span",{className:"mg-upc-icon upc-font-save"}),h("span",null,mt("Save"))),h("button",{onClick:()=>t.onCancel()},h("span",{className:"mg-upc-icon upc-font-close"}),h("span",null,mt("Cancel")))))},gn=function(t){const[e,n]=tt(!1),[i,s]=tt(""),[o,a]=tt(t.item?.quantity),l=it({});nt((()=>{s(t.item.description)}),[t.item]),nt((()=>{e&&l.current.focus()}),[e]);const r=it(!1);return nt((()=>{t.item.quantity!==o&&(clearTimeout(r.current),r.current=setTimeout((function(){t.onSaveItemQuantity(o)}),600))}),[o]),h("li",{className:"mg-upc-dg-item","data-post_id":t.item.post_id},Qt(t.list,"sortable")&&h(y,null,h("span",{className:"mg-upc-dg-item-handle","aria-draggable":!0},"::"),h("span",{className:"mg-upc-dg-item-number"},t.item.position)),Qt(t.list,"vote")&&h(y,null,h("span",{className:"mg-upc-dg-item-number"},(()=>{const e=parseInt(t.list.vote_counter,10);return Qt(t.list,"vote")&&e>0?Math.round(100*parseInt(t.item.votes,10)/e)+"%":"0%"})())),h("a",{href:t.item.link},h("img",{className:"mg-upc-dg-item-image",src:t.item.image?t.item.image:Jt})),h("div",{className:"mg-upc-dg-item-data"},h("a",{href:t.item.link},t.item.title),t.item.price_html&&h("span",{className:"mg-upc-dg-price",dangerouslySetInnerHTML:{__html:t.item.price_html}}),t.item.stock_html&&h("span",{className:"mg-upc-dg-stock",dangerouslySetInnerHTML:{__html:t.item.stock_html}}),t.editable&&!e&&h("p",null,t.item.description),t.editable&&!e&&Qt(t.list,"editable_item_description")&&h("button",{onClick:()=>{n(!0)}},h("span",{className:"mg-upc-icon upc-font-edit"}),""===i&&h("span",null,mt("Add Comment")),""!==i&&h("span",null,mt("Edit Comment"))),h("input",{ref:l,className:e?"mg-upc-dg-btn-item-desc":"mg-upc-dg-dn",type:"text",value:i,onChange:function(t){s(t.target.value)},onKeyDown:e=>{"Enter"===e.key&&(n(!1),t.onSaveItemDescription(i))},maxLength:400}),t.editable&&e&&h("button",{className:"mg-upc-dg-btn-item-desc-cancel",onClick:()=>{n(!1),s(t.item.description)}},h("span",{className:"mg-upc-icon upc-font-close"}),h("span",null,mt("Cancel"))),t.editable&&e&&h("button",{className:"mg-upc-dg-btn-item-desc-save",onClick:()=>{n(!1),t.onSaveItemDescription(i)}},h("span",{className:"mg-upc-icon upc-font-save"}),h("span",null,mt("Save")))),t.editable&&Qt(t.list,"quantity")&&h("div",{className:"mg-upc-dg-quantity"},h("small",null,mt("Quantity")),h("input",{"aria-label":mt("Quantity"),type:"number",value:o,onChange:function(){a(event.target.value)}})),t.editable&&!e&&h("div",null,h("button",{"aria-label":"Remove item",onClick:t.onRemove},h("span",{className:"mg-upc-icon upc-font-trash"}))))},hn=function(t){return new Promise((function(e,n){const i=document.createElement("script");let s=!1;i.type="text/javascript",i.src=t,i.async=!0,i.onerror=function(t){n(t,i)},i.onload=i.onreadystatechange=function(){s||this.readyState&&"complete"!=this.readyState||(s=!0,setTimeout((function(){e()}),100))},(document.head||document.body||document.documentElement).appendChild(i)}))},vn=function(t){const e=it(null),n=it((e=>{t.onMove(e)}));return nt((()=>{n.current=t.onMove})),nt((()=>{let i=!1;if(Qt(t.list,"sortable")){const t=()=>{i=Sortable.create(e.current,{handle:".mg-upc-dg-item-handle",group:"shared",animation:150,onUpdate:function(t){n.current(t)}})};"undefined"!=typeof Sortable?t():hn(qt()).then((()=>{t()}))}return()=>{i&&i.destroy()}})),h(y,null,h("ul",{className:"mg-upc-dg-list-fake mg-upc-dg-on-loading"},[0,1,2].map((e=>h("li",{className:"mg-upc-dg-item"},Qt(t.list,"sortable")&&h(y,null,h("span",{className:"mg-upc-dg-item-handle-skeleton"}," ",h(re,{width:"1.5em"})," "),h("span",{className:"mg-upc-dg-item-number-skeleton"}," ",h(re,{width:"1em"})," ")),Qt(t.list,"vote")&&h(y,null,h("span",{className:"mg-upc-dg-item-number-skeleton"}," ",h(re,{width:"1em"})," ")),h("div",{className:"mg-upc-dg-item-skeleton-image"},h(re,{width:"5em",height:"5em"})),h("div",{className:"mg-upc-dg-item-data"},h(re,{count:2})))))),h("ul",{ref:e,className:"mg-upc-dg-list"},0===t?.items?.length&&h("span",null,"There are no items in this list"),t?.items?.length>0&&t.items?.map&&t.items.map((e=>h(gn,{list:t.list,item:e,editable:t.editable,onRemove:()=>t.onRemove(t.list,e),onSaveItemDescription:n=>t.onSaveItemDescription(t.list,e,n),onSaveItemQuantity:n=>t.onSaveItemQuantity(t.list,e,n),key:e.ID+":"+e.post_id})))),Qt(t.list,"vote")&&h("span",{className:"mg-upc-dg-total-votes"}," ",mt("Total votes:")," ",h("span",null," ",t.list.vote_counter)))},yn=function(t){const e=it(null),n=it(null),i=mt("Copy"),[s,o]=tt(i);nt((()=>{let t=null;s!==i&&(t=setTimeout((()=>{o(i),clearTimeout(t)}),2e3))}),[s]);const a=encodeURIComponent(t.link),l=encodeURIComponent(t.title);let r=[{name:"Twitter",url:"https://twitter.com/share?url="+a+"&text="+l},{name:"Facebook",url:"https://www.facebook.com/sharer/sharer.php?u="+a+""e="+l},{name:"Pinterest",url:"https://pinterest.com/pin/create/button/?url="+a+"&description="+l},{name:"Whatsapp",url:"whatsapp://send?text="+a},{name:"Telegram",url:"https://t.me/share/url?url="+a+"&text="+l},{name:"LiNE",url:"https://social-plugins.line.me/lineit/share?url="+a+"&text="+l},{slug:"email",name:mt("Email"),url:"mailto:?subject="+l+"&body="+a}];return void 0!==Bt().shareButtons&&(r=r.filter((t=>Bt().shareButtons.includes(t.slug||t.name.toLowerCase())))),h("div",{className:"mg-upc-dg-share-link"},h("input",{ref:e,value:t.link,onClick:function(){e.current.setSelectionRange(0,e.current.value.length)},readOnly:!0}),h("button",{ref:n,onClick:function(t){var n;(n=e.current).focus(),n.setSelectionRange(0,n.value.length),document.execCommand&&document.execCommand("copy")?o(mt("Copied!")):o("Error!")}},h("span",{className:"mg-upc-icon upc-font-copy"}),h("span",null,s)),r.map((function(t){return(e=t).slug||(e.slug=e.name.toLowerCase()),h("a",{href:e.url,title:"Share with "+e.name,className:"mg-upc-dg-share",target:"_blank",rel:"noopener"},h("div",{className:"mg-upc-share-btn-img mg-upc-share-"+e.slug}," "));var e})))},bn=function(t){const{state:e,dispatch:n}=at(oe),[i,s]=tt(!1),o=it(!1),a=it(!1);function l(t){t<1||t>e.listTotalPages||"loading"===e.status||n(Ce({page:t}))}return nt((()=>{const t=e.list;let i=!1,s=!1;if(t&&Qt(t,"sortable")){const t=()=>{o.current&&e.listPage<e.listTotalPages&&(i=Sortable.create(o.current,{group:"shared",onAdd:t=>{n(Ee(t.oldIndex))}})),o.current&&e.listPage>1&&(s=Sortable.create(a.current,{group:"shared",onAdd:t=>{n(Ae(t.oldIndex))}}))};"undefined"!=typeof Sortable?t():hn(qt()).then((()=>{t()}))}return()=>{i&&i.destroy(),s&&s.destroy()}}),[e.list,e.listPage,e.listTotalPages]),nt((()=>{s(!1)}),[e.editing,e.list,e.addingPost]),h(y,null,e.editing&&h(fn,{list:e.list,addingPost:e.addingPost,onSave:function(t){if(-1===e.list.ID||t.title!==e.list.title||t.content!==e.list.content||t.status!==e.list.status)if(-1===e.list.ID){const i={};i.title=t.title,i.content=t.content,i.type=t.type,i.status=t.status,e.addingPost?.post_id&&(i.adding=e.addingPost.post_id,e.addingPost?.description&&(i.description=e.addingPost.description)),n(ke(i))}else{const i={id:e.list.ID};t.status!==e.list.status&&(i.status=t.status),t.title!==e.list.title&&(i.title=t.title),t.content!==e.list.content&&(i.content=t.content),n(Ne(i))}},onCancel:function(){n(_e(!1)),-1===e.list.ID&&(n(we(!1)),n(ue()),n(me()))}}),!e.editing&&h(y,null,h("div",{className:"mg-upc-dg-top-action"},function(t){const e=t.type;return zt(e,"editable_title")||zt(e,"editable_content")||Kt(e)?.available_statuses?.length>1}(e.list)&&h("button",{className:"mg-upg-edit",onClick:()=>n(_e(!0))},h("span",{className:"mg-upc-icon upc-font-edit"}),h("span",null,mt("Edit"))),e.list.link&&h("button",{className:"mg-upg-share",onClick:()=>s(!i)},h("span",{className:"mg-upc-icon upc-font-share"}),h("span",null,mt("Share"))),"cart"===e.list.type&&h("button",{className:"mg-upg-share",onClick:function(){n(pe(e.list.ID))}},h("span",{className:"mg-upc-icon upc-font-cart"}),h("span",null,mt("Add all to cart")))),i&&e.list.link&&h(yn,{link:e.list.link,title:e.list.title}),e.list.content&&h("p",{className:"mg-upc-dg-list-desc",dangerouslySetInnerHTML:{__html:(r=e.list.content,"string"!=typeof r?"":r.replace(/([^>\r\n]?)(\r\n|\n\r|\r|\n)/g,"$1<br>$2"))}}),h(re,{count:3}),h(vn,{list:e.list,items:e.list?.items||[],onMove:function(t){n(Te(t.oldIndex,e.list,t.newIndex))},onRemove:function(t,e){n(xe(e.post_id))},onSaveItemDescription:function(t,e,i){n(Se(e.post_id,{description:i}))},onSaveItemQuantity:function(t,e,i){n(Se(e.post_id,{quantity:i}))},editable:t.editable})),(!e.editing||!e.list)&&e.listTotalPages>1&&h(ce,{totalPages:e.listTotalPages,page:e.listPage,onPreview:function(){l(e.listPage-1)},onNext:function(){l(e.listPage+1)},prevRef:a,nextRef:o}));var r};document.getElementById("mg-upc-admin-app")&&($(h((t=>{const[e,n]=et(te,se);return h(oe.Provider,{value:{state:e,dispatch:ie(n,(()=>e))}},t.children)}),null,h((function(){const{state:t,dispatch:e}=at(oe),[n,i]=tt("any"),[s,o]=tt("any"),[a,l]=tt(""),[r,c]=tt(null),u=it(!1),d=st((()=>Gt(t.addingPost)),[t.addingPost]),_=st((()=>Object.values(Bt()?.types)),[]);let p="listOfList";p=t.addingPost?t.editing?"addingToNew":"adding":t.editing?-1!==t.list?.ID?"edit":"new":t.list?"list":"listOfList",nt((()=>{window.showMainLists=function(){e(ue()),m()},window.addItemToList=function(t,n=!1){e(ue()),n||b(t)}}),[e]);const m=()=>{const i={};n&&(i.types=n),s&&(i.status=s),r&&(i.search=r),a&&(i.author=a),t.page>1&&(i.page=t.page),e(fe(i))};function f(){t.page>1&&e(ve(1))}function g(t){f(),i(t)}function v(t){f(),o(t)}nt((()=>{se.title="",e({type:vt,payload:"admin"});const t=function(t){const n=parseInt(new URLSearchParams(document.location.hash.substring(1)).get("author"),10);n>0&&n!==a&&(t&&Zt(t),e(ve(1)),l(n),location.hash="")};return t(0),window.addEventListener("hashchange",t,!1),()=>{window.removeEventListener("hashchange",t)}}),[]),nt((()=>{t.list||m()}),[n,s,a,t.page]),nt((()=>{null!=r&&(clearTimeout(u.current),u.current=setTimeout((function(){m()}),300))}),[r]);const b=t=>{e(de({post_id:t})),e(me({addingPost:t}))};function P(n){n<1||n>t.totalPages||"loading"===t.status||e(ve(n))}const w=h("h2",{key:"title"},("list"===p||"new"===p||"edit"===p||"addingToNew"===p)&&h("a",{"aria-label":"Back",className:"mg-upc-dg-back",href:"#",onClick:n=>{n.preventDefault(),function(){switch(p){case"list":e(we(!1)),m();break;case"new":e(we(!1)),e(_e(!1)),m();break;case"edit":e(_e(!1));break;case"addingToNew":e(we(!1)),e(_e(!1)),e(me({addingPost:t.addingPost.post_id}));break;default:m()}}()}},"←")," ",t.title);return h(y,null,w,h("div",{className:"mg-upc-dg-content-wrapper mg-upc-dg-status-"+t.status+" mg-upc-dg-view-"+p},h("div",{className:"mg-upc-dg-wait"}),t.error&&h("div",{className:"mg-upc-dg-error"},t.error,h("a",{href:"#",className:"mg-upc-dg-alert-close","aria-label":"Hide alert",onClick:t=>{t.preventDefault(),e({type:gt,payload:null})}},h("span",{className:"mg-upc-icon upc-font-close"}))),h("div",{className:"mg-upc-dg-body"},!t.error&&t.addingPost&&h(Oe,{item:t.addingPost,onSaveItemDescription:function(n){e(de({...t.addingPost,description:n}))}}),("listOfList"===p||"adding"===p)&&h(y,null,h("div",{className:"mg-upc-dg-top-action"},d.length>0&&h("button",{className:"mg-list-new",onClick:function(t){e(_e(!0)),e(we(!0))}},h("span",{className:"mg-upc-icon upc-font-add"}),h("span",null,mt("Create List")))),h("ul",{className:"mg-upc-dg-filter"},h("li",{className:"mg-upc-dg-filter-label"},h("strong",null,mt("Types"))),h("li",{className:"any"==n?"mg-upc-dg-item-list-type mg-upc-selected":"mg-upc-dg-item-list-type",onClick:()=>g("any"),onKeyPress:t=>{13===t.keyCode&&g("any")},tabIndex:"0"},h("i",{className:"mg-upc-icon upc-font-close mg-upc-dg-item-type mg-upc-dg-item-type-none"}),h("div",{className:"mg-upc-dg-item-title"},h("strong",null,"All"))),_.map(((t,e)=>h("li",{className:t.name==n?"mg-upc-dg-item-list-type mg-upc-selected":"mg-upc-dg-item-list-type",key:t.name,onClick:()=>g(t.name),onKeyPress:e=>{13===e.keyCode&&g(t.name)},tabIndex:"0"},h("i",{className:"mg-upc-icon mg-upc-dg-item-type mg-upc-dg-item-type-"+t.name}),h("div",{className:"mg-upc-dg-item-title"},h("strong",null,t.label)))))),Xt()&&h("ul",{className:"mg-upc-dg-filter"},h("li",{className:"mg-upc-dg-filter-label"},h("strong",null,mt("Status"))),h("li",{className:"any"==s?"mg-upc-selected":"",onClick:()=>v("any"),onKeyPress:t=>{13===t.keyCode&&v("any")},tabIndex:"0"},h("div",{className:"mg-upc-dg-item-title"},h("strong",null,"All"))),Xt().map(((t,e)=>h("li",{className:t.name==s?"mg-upc-selected":"",key:t.name,onClick:()=>v(t.name),onKeyPress:e=>{13===e.keyCode&&v(t.name)},tabIndex:"0"},t.label)))),h("div",{className:"mg-upc-dg-df"},h("ul",{className:"mg-upc-dg-filter"},h("li",{className:"mg-upc-dg-filter-label"},h("strong",null,mt("Search"))),h("input",{onChange:function(t){f(),c(t.target.value)},value:r})),h("ul",{className:"mg-upc-dg-filter"},h("li",{className:"mg-upc-dg-filter-label"},h("strong",null,mt("Author (ID)"))),h("input",{type:"number",onChange:function(t){f(),l(t.target.value)},value:a}))),h(Le,{lists:t.listOfList,onSelect:function(n){e(_e(!1)),t.addingPost?e(Ie(n.ID,t.addingPost)):e(we(n))},onRemove:!t.addingPost&&function(t){e(he(t.ID))},loadPreview:function(){P(t.page-1)},loadNext:function(){P(t.page+1)}})),t.list&&h(bn,{editable:(t.list,!0)}))))}),null)," "),document.getElementById("mg-upc-admin-app")),setTimeout(window.showMainLists,1e3))})(); -
user-post-collections/tags/0.9.0/javascript/mg-upc-client/dist/css/styles.css
r2770186 r3190768 1 .mg-upc-single-template .mg-upc-description{margin-top:1em}.mg-upc-single-template .mg-upc-author-box{margin:1em 0}.mg-upc-page-inner{flex-grow:2}.mg-upc-page-inner .mg-upc-author-box{padding:12px 10px 32px 120px;position:relative;min-height:120px}.mg-upc-page-inner .mg-upc-author-box .mg-upc-author-avatar{width:96px;height:96px;object-fit:cover;position:absolute;top:12px;left:0}.mg-upc-page-inner .mg-upc-author-box h4{font-size:21px;margin:12px 0 8px}.mg-upc-items-container{margin-left:0;margin-bottom:0;clear:both}.mg-upc-item{display:flex;flex-direction:row;position:relative;align-items:center;margin:40px 0}.mg-upc-item::after{content:' ';position:absolute;bottom:-20px;left:50%;width:80%;background:rgba(0,0,0,0.15);height:1px;margin-left:-40%}.mg-upc-item:last-child::after{display:none}.mg-upc-item .mg-upc-list-item-price{display:inline-block;margin-right:1em}.mg-upc-item p.stock{margin:0;display:inline-block;float:right}.mg-upc-item-data{flex-grow:1;flex-shrink:2;padding-right:1em;padding-left:1em}.mg-upc-item-data header h2{margin:10px 0 5px;font-size:20px;font-weight:600}.mg-upc-item-data header a{text-decoration:none}@media (max-width: 500px){.mg-upc-item{flex-direction:column;text-align:center;align-items:stretch}.mg-upc-item-actions button,.mg-upc-item-actions>a{width:100%}}.mg-upc-item-img{width:15%;min-width:100px;margin:auto}.mg-upc-item-img figure{margin:0}.mg-upc-item-img img{min-height:130px;width:100%;background:#6f7277;object-fit:cover;object-position:center}.mg-upc-item-desc{margin:0;line-height:1.3;font-weight:300;clear:both}.mg-upc-item-number{font-size:2em;min-width:2em;text-align:center}.mg-upc-item-quantity{margin:0.3em 1em}.mg-upc-item-quantity>*{display:block;text-align:center;padding:0.1em 0.5em}.mg-upc-item-quantity small{opacity:0.5}.mg-upc-item-actions{display:flex;flex-direction:column;row-gap:0.5em;padding:1em 0}.mg-upc-item-actions button,.mg-upc-item-actions>a{min-width:9em;text-align:center;white-space:nowrap}.mg-upc-votes{width:100%;height:45px;position:relative;clear:both}.mg-upc-item-bar{width:100%;height:10px;position:absolute;top:24px}.mg-upc-item-bar-progress,.mg-upc-item-bar-fill{display:block;width:100%;height:100%;background:#ededed;border:solid 1px #ccc;position:absolute;top:0}.mg-upc-item-bar-fill{box-shadow:0 0 3px #aaa}.mg-upc-item-bar-progress{background:#380;border-color:#286103}.mg-upc-item-percent{right:0;position:absolute;line-height:24px;font-size:20px}.mg-upc-item-votes{display:block;font-size:12px;left:0;position:absolute;line-height:25px;top:3px}.mg-upc-items-pagination{padding:1em 0;border:1px solid rgba(0,0,0,0.05);border-width:1px 0;text-align:center;clear:both}.mg-upc-items-pagination ul.page-numbers::after,.mg-upc-items-pagination ul.page-numbers::before{content:'';display:table}.mg-upc-items-pagination ul.page-numbers::after{clear:both}.mg-upc-items-pagination .page-numbers{list-style:none;margin:0}.mg-upc-items-pagination .page-numbers li{display:inline-block}.mg-upc-items-pagination .page-numbers li .page-numbers{border-left-width:0;display:inline-block;padding:.3342343017em .875em;background-color:rgba(0,0,0,0.025);color:#43454b}.mg-upc-items-pagination .page-numbers li .page-numbers.current{background-color:#474747;border-color:#474747;color:#fff}.mg-upc-items-pagination .page-numbers li .page-numbers.dots{background-color:transparent}.mg-upc-items-pagination .page-numbers li .page-numbers.next,.mg-upc-items-pagination .page-numbers li .page-numbers.prev{padding-left:1em;padding-right:1em}.mg-upc-items-pagination .page-numbers li a.page-numbers:hover{background-color:rgba(0,0,0,0.05)}.rtl .mg-upc-items-pagination a.next,.rtl .mg-upc-items-pagination a.prev{-webkit-transform:rotateY(180deg);transform:rotateY(180deg)}@keyframes mg-upc-alert{0%{transform:scaleY(0);margin-bottom:-19px}100%{transform:scaleY(1);margin-bottom:0}}.mg-upc-alert{padding:10px 40px 10px 1em;border:solid 1px #017401;background:rgba(154,240,173,0.8);color:#000;margin:1em 0;animation:mg-upc-alert 0.3s 1 ease-in-out both}.mg-upc-alert p{margin:0}.mg-upc-item .mg-upc-alert{position:absolute;bottom:-19px;left:0;right:0;margin:0}.mg-upc-alert-error{border-color:#d50000;background:rgba(255,121,121,0.8)}.mg-upc-alert-close{position:absolute;top:10px;right:15px;text-decoration:none !important;color:black}.mg-upc-hide{display:none}.mg-upc-product-added{background-color:#a3e8a3;color:#445e18}.mg-upc-product-error{color:#740000;background-color:#f89a9a}@keyframes mg-upc-btn-loading{100%{transform:translateX(100%)}}.mg-upc-btn-loading{background-color:#c7c7c7;position:relative;overflow:hidden;z-index:1;vertical-align:middle}.mg-upc-btn-loading::before,.mg-upc-btn-loading::after{content:' ';display:block !important;position:absolute;top:0;left:0;right:0;height:100%;background-color:#c7c7c7;z-index:2}.mg-upc-btn-loading::after{background-repeat:no-repeat;background-image:linear-gradient(90deg, #c7c7c7, #f5f5f5, #c7c7c7);transform:translateX(-100%);animation-name:mg-upc-btn-loading;animation-duration:0.8s;animation-timing-function:ease-in-out;animation-iteration-count:infinite}.mg-upc-add-product-to-list{margin-bottom:0.236em;margin-top:0.236em}.post-adding{margin:1em;text-align:center}.mg-upc-add-list-to-cart{margin:1em 1em 1em 0}.mg-upc-dg-container,.mg-upc-dg-overlay{position:fixed;top:0;right:0;bottom:0;left:0}.mg-upc-dg-container{z-index:999999;display:flex}.mg-upc-dg-container[aria-hidden='true']{display:none}.mg-upc-dg-overlay{background-color:rgba(43,46,56,0.9);animation:fade-in 200ms both}.mg-upc-dg-content{margin:auto;z-index:2;position:relative;background-color:#fff;color:#333;overflow-y:auto;animation:fade-in 400ms 200ms both, slide-up 400ms 200ms both;padding:1em;max-width:90%;max-height:80%;width:800px;border-radius:2px}.mg-upc-dg-content p{color:#333}.mg-upc-dg-content::after,.mg-list-edit::after{content:'';display:block;clear:both}@media screen and (min-width: 700px){.mg-upc-dg-content{padding:2em 1.5em}}.mg-upc-dg-close{position:absolute;top:0.5em;right:0.5em;border:0;padding:0;background-color:transparent;color:#000;font-weight:bold;font-size:1.25em;line-height:1.25em;min-width:1.2em;min-height:1.2em;text-align:center;cursor:pointer;transition:0.15s}@media screen and (min-width: 700px){.mg-upc-dg-close{top:1em;right:1em}}.mg-upc-dialog-content-wrapper{position:relative}@keyframes fade-in{from{opacity:0}}@keyframes slide-up{from{transform:translateY(10%)}}@font-face{font-family:"mgupc";src:url(../fd323a61b0577418b63a.eot?3p2eq6);src:url(../fd323a61b0577418b63a.eot?3p2eq6#iefix) format("embedded-opentype"),url(../aeaf4155903c2239613b.ttf?3p2eq6) format("truetype"),url(../d90b677af57f791b2998.woff?3p2eq6) format("woff"),url(../2f74331407887267c9f0.svg?3p2eq6#mgupc) format("svg");font-weight:normal;font-style:normal;font-display:block}.mg-upc-icon{font-family:"mgupc" !important;speak:never;font-style:normal;font-weight:normal;font-variant:normal;text-transform:none;line-height:1;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.upc-font-close:before{content:""}.upc-font-copy:before{content:""}.upc-font-first_page:before{content:""}.upc-font-last_page:before{content:""}.upc-font-arrow_left:before{content:""}.upc-font-arrow_right:before{content:""}.upc-font-poll:before{content:""}.upc-font-numbered:before{content:""}.upc-font-cart:before{content:""}.upc-font-bookmark:before{content:""}.upc-font-heart:before{content:""}.upc-font-save:before{content:""}.upc-font-edit:before{content:""}.upc-font-share:before{content:""}.upc-font-list:before{content:""}.upc-font-add:before{content:""}.upc-font-trash:before{content:""}.mg-upc-icon+span{margin-left:0.6em;vertical-align:middle}.mg-upc-icon{vertical-align:middle}.mg-upc-dg-content button{min-height:30px}.mg-upc-dg-msg{display:block;background:rgba(172,205,100,0.75);padding:0.7em;border:solid 1px #7dbf21;border-radius:2px;color:#314f00;margin:1em 0;white-space:pre-line}@media screen and (min-width: 700px){.mg-upc-dg-msg{top:-2em}}.mg-upc-dg-error{display:block;background:rgba(255,48,48,0.75);padding:0.7em;border:solid 1px #bf2121;border-radius:2px;color:#4f0001;margin:1em 0;position:sticky;top:-1em;z-index:5;white-space:pre-line}@media screen and (min-width: 700px){.mg-upc-dg-error{top:-2em}}.mg-upc-dg-alert-close{float:right;color:#fff;text-decoration:none;text-shadow:0 0 2px #ffff}.mg-upc-dg-wait{position:absolute;top:0;left:0;right:0;bottom:0;background:rgba(255,255,255,0.7);z-index:9;display:none}.mg-upc-dg-wait:before{content:'';position:absolute;top:50%;right:50%;margin:-1em 0 0 -1em;width:2em;height:2em;border-radius:50%;border-top:2px solid #5583f8;border-bottom:2px solid #345fc9;border-right:2px solid transparent;animation:loading-spinner .6s linear infinite}.mg-upc-dg-status-loading{max-height:90vh;min-height:50px;overflow:hidden}@keyframes loading-spinner{to{transform:rotate(360deg)}}.mg-upc-dg-dn{display:none !important}.mg-upc-dg-content ul{padding:0;margin:1em 0.3em}.mg-upc-dg-item-list,.mg-upc-dg-item-list-type{display:flex;padding:0.6em;margin:0.2em;justify-content:flex-start;align-content:stretch;align-items:center;border:solid 1px #e5e5e5;cursor:pointer}.mg-upc-dg-item-list:hover,.mg-upc-dg-item-list:focus,.mg-upc-dg-item-list-type:hover,.mg-upc-dg-item-list-type:focus{border:solid 1px #a9a9a9;background:#fafafa}.mg-upc-dg-item-list .mg-upc-dg-item-type,.mg-upc-dg-item-list-type .mg-upc-dg-item-type{width:30px;height:30px;font-size:24px;line-height:30px;text-align:center}.mg-upc-dg-item-list .mg-upc-dg-item-title,.mg-upc-dg-item-list-type .mg-upc-dg-item-title{display:flex;flex-direction:column;color:#333;flex-grow:2;text-align:start;padding:0.1em 1em;word-break:break-word}.mg-upc-dg-item-list .mg-upc-dg-item-title>span:nth-child(2),.mg-upc-dg-item-list-type .mg-upc-dg-item-title>span:nth-child(2){opacity:0.6}.mg-upc-dg-item-list .mg-upc-dg-item-count,.mg-upc-dg-item-list-type .mg-upc-dg-item-count{width:3em;text-align:center;opacity:0.5}@media screen and (max-width: 400px){.mg-upc-dg-item-list,.mg-upc-dg-item-list-type{flex-direction:column}.mg-upc-dg-item-list .mg-upc-dg-item-title,.mg-upc-dg-item-list-type .mg-upc-dg-item-title{text-align:center}}.mg-upc-dg-item-type:before{content:""}.mg-upc-dg-item-type-numbered:before{content:""}.mg-upc-dg-item-type-vote:before{content:""}.mg-upc-dg-item-type-favorites:before{content:""}.mg-upc-dg-item-type-bookmarks:before{content:""}.mg-upc-dg-item-type-cart:before{content:""}.mg-upc-dg-item-type-none:before{content:""}.mg-upg-edit{float:right}ul.mg-upc-dg-list::before{content:'';display:block;clear:both}.mg-upc-dg-title{margin-top:0;word-break:break-word}.mg-upc-dg-title>a{vertical-align:middle;font-size:1em;text-decoration:none}.mg-upc-dg-top-action{margin:1em 0;display:flex;align-items:center;align-content:stretch;flex-direction:row-reverse}.mg-upc-dg-top-action button{margin:0.5em;flex-grow:2}@media (max-width: 550px){.mg-upc-dg-top-action{align-items:stretch;flex-direction:column}}.mg-upc-dg-total-votes{text-align:right;display:block;margin-bottom:2em}.mg-list-edit label{color:#000000;display:block;margin-top:0.5em}.mg-list-edit input[type=text],.mg-list-edit textarea,.mg-list-edit select{width:100%;margin-bottom:0.5em;display:block;min-height:2em}.mg-list-edit textarea{height:8em}.mg-list-edit button{margin:0.7em 0;float:left}.mg-list-edit button:first-of-type{float:right}@media (max-width: 550px){.mg-list-edit button{width:100%}}.mg-upc-dg-list-desc-edit-count{display:block;text-align:right}.mg-upc-dg-item{display:flex;align-items:center;margin:2em 0}.mg-upc-dg-item>*{flex-shrink:0}.mg-upc-dg-item>.mg-upc-dg-item-data{flex-grow:1;flex-shrink:2}.mg-upc-dg-item button{margin:0.3em}@media (max-width: 550px){.mg-upc-dg-item{flex-direction:column;text-align:center}.mg-upc-dg-item .mg-upc-dg-item-number{position:relative;top:0.1em;height:0;font-size:3em;color:#fff;font-weight:700;text-shadow:0 0 4px black}.mg-upc-dg-item .mg-upc-dg-item-image{height:7em;width:7em}.mg-upc-dg-item .mg-upc-dg-stock>*,.mg-upc-dg-item .mg-upc-dg-price{float:none;margin:auto;display:block}}.mg-upc-dg-item-adding{margin:0.5em;opacity:0.7;padding:0.3em 1em;background:#eaeaea}.mg-upc-dg-item-handle{padding:0.5em;white-space:nowrap;cursor:move}.mg-upc-dg-item-number{width:3em;text-align:center;flex-shrink:0}.mg-upc-dg-item-image{height:5em;width:5em;max-width:none;object-fit:cover;background:#d5d5d5}.mg-upc-dg-item-data{padding-right:1em;padding-left:1em}.mg-upc-dg-item-data button{font-size:small}.mg-upc-dg-item-data>p{margin:0}.mg-upc-dg-btn-item-desc{width:100%}.mg-upc-dg-btn-item-desc-cancel,.mg-upc-dg-btn-item-desc-save{width:46%;margin:2%;float:left}.mg-upc-dg-price{float:right;margin-left:1em}.mg-upc-dg-price del{opacity:0.5}.mg-upc-dg-stock>*{margin:0;float:right}.mg-upc-dg-pagination-div{display:flex;align-content:stretch;justify-content:center;align-items:center}.mg-upc-dg-hidden{opacity:0.2}.mg-upc-dg-pagination-div.mg-upc-dg-hidden{display:none}.mg-upc-dg-pagination-div::after{content:'';clear:both;display:block}.mg-upc-dg-pagination,.mg-upc-dg-pagination-current{width:39%;text-align:center;position:relative}.mg-upc-dg-pagination-current{width:10%}.mg-upc-dg-pagination .sortable-chosen{position:absolute;top:0;left:0;bottom:0;right:0;margin:0;overflow:hidden;background:#ececd0}.mg-upc-dg-pagination .sortable-chosen .mg-upc-dg-item-handle,.mg-upc-dg-pagination .sortable-chosen .mg-upc-dg-item-number,.mg-upc-dg-pagination .sortable-chosen button{display:none}@keyframes mg-upc-dg-loading-skeleton{100%{transform:translateX(100%)}}.mg-upc-dg-loading-skeleton{--base-color: #ebebeb;--highlight-color: #f5f5f5;--animation-duration: 1.5s;--animation-direction: normal;--pseudo-element-display: block;background-color:var(--base-color);width:100%;border-radius:0.25rem;display:inline-flex;line-height:1;position:relative;overflow:hidden;z-index:1}.mg-upc-dg-loading-skeleton::after{content:' ';display:var(--pseudo-element-display);position:absolute;top:0;left:0;right:0;height:100%;background-repeat:no-repeat;background-image:linear-gradient(90deg, var(--base-color), var(--highlight-color), var(--base-color));transform:translateX(-100%);animation-name:mg-upc-dg-loading-skeleton;animation-direction:var(--animation-direction);animation-duration:var(--animation-duration);animation-timing-function:ease-in-out;animation-iteration-count:infinite}.mg-upc-dg-loading-skeleton,.mg-upc-dg-on-loading{display:none}.mg-upc-dg-status-loading .mg-upc-dg-list-desc,.mg-upc-dg-status-loading .mg-upc-dg-pagination-div,.mg-upc-dg-status-loading button{display:none}.mg-upc-dg-status-loading .mg-upc-dg-list-of-lists,.mg-upc-dg-status-loading .mg-upc-dg-list{visibility:hidden}.mg-upc-dg-status-loading .mg-upc-dg-on-loading{display:block}.mg-upc-dg-status-loading .mg-upc-dg-loading-skeleton{display:inline-flex}@keyframes share-animate{from{max-height:0;transform:scaleY(0);opacity:0}to{max-height:125px;transform:scaleY(1);opacity:1}}.mg-upc-dg-share-link{margin:1em 0;max-height:none;animation:share-animate .3s linear;text-align:center}.mg-upc-dg-share-link input{width:70%;font-size:16px;height:40px;border:none;background:#e2e2e2;color:#333;margin:0;display:inline-block;vertical-align:bottom;box-sizing:border-box}.mg-upc-dg-share-link button{width:30%;font-size:16px;padding:2px !important;height:40px !important;line-height:36px !important;border:none;display:inline-block;vertical-align:bottom;box-sizing:border-box}.mg-upc-dg-share-link .mg-upc-dg-share{display:inline-block;margin:2% 0}.mg-upc-zero-quantity{opacity:0.3}.mg-upc-dg-quantity{width:4em;display:flex;flex-direction:column;text-align:center;margin:1em}.mg-upc-dg-quantity small{opacity:0.5}.mg-upc-dg-quantity input{text-align:center}.mg-upc-err-required_logged_in .mg-list-new,.mg-upc-err-required_logged_in .mg-upc-dg-alert-close{display:none}.mg-upc-share-btn-img{height:64px;width:64px;display:inline-block;vertical-align:middle;background-size:100%}.mg-upc-share-link{display:block;text-align:right;margin:1em 0}.mg-upc-share-link::after{content:'';display:block;clear:both}.mg-upc-share{text-decoration:none}.mg-upc-dg-share:hover .mg-upc-share-btn-img,.mg-upc-dg-share:focus .mg-upc-share-btn-img,.mg-upc-share:hover .mg-upc-share-btn-img,.mg-upc-share:focus .mg-upc-share-btn-img{transform:scale(1.3);transition:transform 0.3s}.mg-upc-share-facebook{background-image:url("data:image/svg+xml,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 viewBox=%270 0 64 64%27 width=%2764%27 height=%2764%27%3E%3Crect width=%2764%27 height=%2764%27 rx=%270%27 ry=%270%27 fill=%27%233b5998%27%3E%3C/rect%3E%3Cpath d=%27M34.1,47V33.3h4.6l0.7-5.3h-5.3v-3.4c0-1.5,0.4-2.6,2.6-2.6l2.8,0v-4.8c-0.5-0.1-2.2-0.2-4.1-0.2 c-4.1,0-6.9,2.5-6.9,7V28H24v5.3h4.6V47H34.1z%27 fill=%27white%27%3E%3C/path%3E%3C/svg%3E")}.mg-upc-share-twitter{background-image:url("data:image/svg+xml,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 viewBox=%270 0 64 64%27 width=%2764%27 height=%2764%27%3E%3Crect width=%2764%27 height=%2764%27 rx=%270%27 ry=%270%27 fill=%27%2300aced%27%3E%3C/rect%3E%3Cpath d=%27M48,22.1c-1.2,0.5-2.4,0.9-3.8,1c1.4-0.8,2.4-2.1,2.9-3.6c-1.3,0.8-2.7,1.3-4.2,1.6 C41.7,19.8,40,19,38.2,19c-3.6,0-6.6,2.9-6.6,6.6c0,0.5,0.1,1,0.2,1.5c-5.5-0.3-10.3-2.9-13.5-6.9c-0.6,1-0.9,2.1-0.9,3.3 c0,2.3,1.2,4.3,2.9,5.5c-1.1,0-2.1-0.3-3-0.8c0,0,0,0.1,0,0.1c0,3.2,2.3,5.8,5.3,6.4c-0.6,0.1-1.1,0.2-1.7,0.2c-0.4,0-0.8,0-1.2-0.1 c0.8,2.6,3.3,4.5,6.1,4.6c-2.2,1.8-5.1,2.8-8.2,2.8c-0.5,0-1.1,0-1.6-0.1c2.9,1.9,6.4,2.9,10.1,2.9c12.1,0,18.7-10,18.7-18.7 c0-0.3,0-0.6,0-0.8C46,24.5,47.1,23.4,48,22.1z%27 fill=%27white%27%3E%3C/path%3E%3C/svg%3E")}.mg-upc-share-whatsapp{background-image:url("data:image/svg+xml,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 viewBox=%270 0 64 64%27 width=%2764%27 height=%2764%27%3E%3Crect width=%2764%27 height=%2764%27 rx=%270%27 ry=%270%27 fill=%27%2325D366%27%3E%3C/rect%3E%3Cpath d=%27m42.32286,33.93287c-0.5178,-0.2589 -3.04726,-1.49644 -3.52105,-1.66732c-0.4712,-0.17346 -0.81554,-0.2589 -1.15987,0.2589c-0.34175,0.51004 -1.33075,1.66474 -1.63108,2.00648c-0.30032,0.33658 -0.60064,0.36247 -1.11327,0.12945c-0.5178,-0.2589 -2.17994,-0.80259 -4.14759,-2.56312c-1.53269,-1.37217 -2.56312,-3.05503 -2.86603,-3.57283c-0.30033,-0.5178 -0.03366,-0.80259 0.22524,-1.06149c0.23301,-0.23301 0.5178,-0.59547 0.7767,-0.90616c0.25372,-0.31068 0.33657,-0.5178 0.51262,-0.85437c0.17088,-0.36246 0.08544,-0.64725 -0.04402,-0.90615c-0.12945,-0.2589 -1.15987,-2.79613 -1.58964,-3.80584c-0.41424,-1.00971 -0.84142,-0.88027 -1.15987,-0.88027c-0.29773,-0.02588 -0.64208,-0.02588 -0.98382,-0.02588c-0.34693,0 -0.90616,0.12945 -1.37736,0.62136c-0.4712,0.5178 -1.80194,1.76053 -1.80194,4.27186c0,2.51134 1.84596,4.945 2.10227,5.30747c0.2589,0.33657 3.63497,5.51458 8.80262,7.74113c1.23237,0.5178 2.1903,0.82848 2.94111,1.08738c1.23237,0.38836 2.35599,0.33657 3.24402,0.20712c0.99159,-0.15534 3.04985,-1.24272 3.47963,-2.45956c0.44013,-1.21683 0.44013,-2.22654 0.31068,-2.45955c-0.12945,-0.23301 -0.46601,-0.36247 -0.98382,-0.59548m-9.40068,12.84407l-0.02589,0c-3.05503,0 -6.08417,-0.82849 -8.72495,-2.38189l-0.62136,-0.37023l-6.47252,1.68286l1.73463,-6.29129l-0.41424,-0.64725c-1.70875,-2.71846 -2.6149,-5.85116 -2.6149,-9.07706c0,-9.39809 7.68934,-17.06155 17.15993,-17.06155c4.58253,0 8.88029,1.78642 12.11655,5.02268c3.23625,3.21036 5.02267,7.50812 5.02267,12.06476c-0.0078,9.3981 -7.69712,17.06155 -17.14699,17.06155m14.58906,-31.58846c-3.93529,-3.80584 -9.1133,-5.95471 -14.62789,-5.95471c-11.36055,0 -20.60848,9.2065 -20.61625,20.52564c0,3.61684 0.94757,7.14565 2.75211,10.26282l-2.92557,10.63564l10.93337,-2.85309c3.0136,1.63108 6.4052,2.4958 9.85634,2.49839l0.01037,0c11.36574,0 20.61884,-9.2091 20.62403,-20.53082c0,-5.48093 -2.14111,-10.64081 -6.03239,-14.51915%27 fill=%27white%27%3E%3C/path%3E%3C/svg%3E")}.mg-upc-share-telegram{background-image:url("data:image/svg+xml,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 viewBox=%270 0 64 64%27 width=%2764%27 height=%2764%27%3E%3Crect width=%2764%27 height=%2764%27 rx=%270%27 ry=%270%27 fill=%27%2337aee2%27%3E%3C/rect%3E%3Cpath d=%27m45.90873,15.44335c-0.6901,-0.0281 -1.37668,0.14048 -1.96142,0.41265c-0.84989,0.32661 -8.63939,3.33986 -16.5237,6.39174c-3.9685,1.53296 -7.93349,3.06593 -10.98537,4.24067c-3.05012,1.1765 -5.34694,2.05098 -5.4681,2.09312c-0.80775,0.28096 -1.89996,0.63566 -2.82712,1.72788c-0.23354,0.27218 -0.46884,0.62161 -0.58825,1.10275c-0.11941,0.48114 -0.06673,1.09222 0.16682,1.5716c0.46533,0.96052 1.25376,1.35737 2.18443,1.71383c3.09051,0.99037 6.28638,1.93508 8.93263,2.8236c0.97632,3.44171 1.91401,6.89571 2.84116,10.34268c0.30554,0.69185 0.97105,0.94823 1.65764,0.95525l-0.00351,0.03512c0,0 0.53908,0.05268 1.06412,-0.07375c0.52679,-0.12292 1.18879,-0.42846 1.79109,-0.99212c0.662,-0.62161 2.45836,-2.38812 3.47683,-3.38552l7.6736,5.66477l0.06146,0.03512c0,0 0.84989,0.59703 2.09312,0.68132c0.62161,0.04214 1.4399,-0.07726 2.14229,-0.59176c0.70766,-0.51626 1.1765,-1.34683 1.396,-2.29506c0.65673,-2.86224 5.00979,-23.57745 5.75257,-27.00686l-0.02107,0.08077c0.51977,-1.93157 0.32837,-3.70159 -0.87096,-4.74991c-0.60054,-0.52152 -1.2924,-0.7498 -1.98425,-0.77965l0,0.00176zm-0.2072,3.29069c0.04741,0.0439 0.0439,0.0439 0.00351,0.04741c-0.01229,-0.00351 0.14048,0.2072 -0.15804,1.32576l-0.01229,0.04214l-0.00878,0.03863c-0.75858,3.50668 -5.15554,24.40802 -5.74203,26.96472c-0.08077,0.34417 -0.11414,0.31959 -0.09482,0.29852c-0.1756,-0.02634 -0.50045,-0.16506 -0.52679,-0.1756l-13.13468,-9.70175c4.4988,-4.33199 9.09945,-8.25307 13.744,-12.43229c0.8218,-0.41265 0.68483,-1.68573 -0.29852,-1.70681c-1.04305,0.24584 -1.92279,0.99564 -2.8798,1.47502c-5.49971,3.2626 -11.11882,6.13186 -16.55882,9.49279c-2.792,-0.97105 -5.57873,-1.77704 -8.15298,-2.57601c2.2336,-0.89555 4.00889,-1.55579 5.75608,-2.23009c3.05188,-1.1765 7.01687,-2.7042 10.98537,-4.24067c7.94051,-3.06944 15.92667,-6.16346 16.62028,-6.43037l0.05619,-0.02283l0.05268,-0.02283c0.19316,-0.0878 0.30378,-0.09658 0.35471,-0.10009c0,0 -0.01756,-0.05795 -0.00351,-0.04566l-0.00176,0zm-20.91715,22.0638l2.16687,1.60145c-0.93418,0.91311 -1.81743,1.77353 -2.45485,2.38812l0.28798,-3.98957%27 fill=%27white%27%3E%3C/path%3E%3C/svg%3E")}.mg-upc-share-line{background-image:url("data:image/svg+xml,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 viewBox=%270 0 64 64%27 width=%2764%27 height=%2764%27%3E%3Crect width=%2764%27 height=%2764%27 rx=%270%27 ry=%270%27 fill=%27%2300b800%27%3E%3C/rect%3E%3Cpath d=%27M52.62 30.138c0 3.693-1.432 7.019-4.42 10.296h.001c-4.326 4.979-14 11.044-16.201 11.972-2.2.927-1.876-.591-1.786-1.112l.294-1.765c.069-.527.142-1.343-.066-1.865-.232-.574-1.146-.872-1.817-1.016-9.909-1.31-17.245-8.238-17.245-16.51 0-9.226 9.251-16.733 20.62-16.733 11.37 0 20.62 7.507 20.62 16.733zM27.81 25.68h-1.446a.402.402 0 0 0-.402.401v8.985c0 .221.18.4.402.4h1.446a.401.401 0 0 0 .402-.4v-8.985a.402.402 0 0 0-.402-.401zm9.956 0H36.32a.402.402 0 0 0-.402.401v5.338L31.8 25.858a.39.39 0 0 0-.031-.04l-.002-.003-.024-.025-.008-.007a.313.313 0 0 0-.032-.026.255.255 0 0 1-.021-.014l-.012-.007-.021-.012-.013-.006-.023-.01-.013-.005-.024-.008-.014-.003-.023-.005-.017-.002-.021-.003-.021-.002h-1.46a.402.402 0 0 0-.402.401v8.985c0 .221.18.4.402.4h1.446a.401.401 0 0 0 .402-.4v-5.337l4.123 5.568c.028.04.063.072.101.099l.004.003a.236.236 0 0 0 .025.015l.012.006.019.01a.154.154 0 0 1 .019.008l.012.004.028.01.005.001a.442.442 0 0 0 .104.013h1.446a.4.4 0 0 0 .401-.4v-8.985a.402.402 0 0 0-.401-.401zm-13.442 7.537h-3.93v-7.136a.401.401 0 0 0-.401-.401h-1.447a.4.4 0 0 0-.401.401v8.984a.392.392 0 0 0 .123.29c.072.068.17.111.278.111h5.778a.4.4 0 0 0 .401-.401v-1.447a.401.401 0 0 0-.401-.401zm21.429-5.287c.222 0 .401-.18.401-.402v-1.446a.401.401 0 0 0-.401-.402h-5.778a.398.398 0 0 0-.279.113l-.005.004-.006.008a.397.397 0 0 0-.111.276v8.984c0 .108.043.206.112.278l.005.006a.401.401 0 0 0 .284.117h5.778a.4.4 0 0 0 .401-.401v-1.447a.401.401 0 0 0-.401-.401h-3.93v-1.519h3.93c.222 0 .401-.18.401-.402V29.85a.401.401 0 0 0-.401-.402h-3.93V27.93h3.93z%27 fill=%27white%27%3E%3C/path%3E%3C/svg%3E")}.mg-upc-share-email{background-image:url("data:image/svg+xml,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 viewBox=%270 0 64 64%27 width=%2764%27 height=%2764%27%3E%3Crect width=%2764%27 height=%2764%27 rx=%270%27 ry=%270%27 fill=%27%23b2b2b2%27%3E%3C/rect%3E%3Cpath d=%27M17,22v20h30V22H17z M41.1,25L32,32.1L22.9,25H41.1z M20,39V26.6l12,9.3l12-9.3V39H20z%27 fill=%27white%27%3E%3C/path%3E%3C/svg%3E")}.mg-upc-share-pinterest{background-image:url("data:image/svg+xml,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%2764%27 height=%2764%27%3E%3Crect width=%2764%27 height=%2764%27 rx=%270%27 ry=%270%27 fill=%27%23dc0000%27/%3E%3Cpath d=%27M32.9 12.4c-10.4 0-15.6 7.6-15.6 13.7 0 3.7 1.5 7.1 4.5 8.3.6.3 1 0 1.1-.5l.4-1.8c.2-.5.2-.8-.2-1.2-1-1-1.6-2.3-1.6-4.3 0-5.6 4.1-10.5 10.8-10.5 6 0 9.2 3.6 9.2 8.4 0 6.2-2.9 11.6-7 11.6-2.2 0-4-2-3.4-4.3.7-2.7 2-5.7 2-7.7 0-1.8-1-3.3-3-3.3-2.4 0-4.3 2.3-4.3 5.6 0 2 .7 3.4.7 3.4l-2.9 11.9c-.4 1.6-1 8.3-1 9.8.9.4 2.2-1.6 3.5-3.8.7-1.2 1.6-2.8 2-4.4l1.5-6c.7 1.5 3 2.7 5.3 2.7 7 0 11.8-6.4 11.8-15 0-6.5-5.5-12.6-13.8-12.6z%27 fill=%27%23fff%27 paint-order=%27fill markers stroke%27/%3E%3C/svg%3E")} 2 1 .mg-upc-dg-container,.mg-upc-dg-overlay{position:fixed;top:0;right:0;bottom:0;left:0}.mg-upc-dg-container{z-index:999999;display:flex}.mg-upc-dg-container[aria-hidden=true]{display:none}.mg-upc-dg-overlay{background-color:rgba(43,46,56,.9);animation:fade-in 200ms both}.mg-upc-dg-content{margin:auto;z-index:2;position:relative;background-color:#fff;color:#333;overflow-y:auto;animation:fade-in 400ms 200ms both,slide-up 400ms 200ms both;padding:1em;max-width:90%;max-height:80%;width:800px;border-radius:2px}.mg-upc-dg-content p{color:#333}.mg-upc-dg-content::after,.mg-list-edit::after{content:"";display:block;clear:both}@media screen and (min-width: 700px){.mg-upc-dg-content{padding:2em 1.5em}}.mg-upc-dg-close{position:absolute;top:.5em;right:.5em;border:0;padding:0;background-color:rgba(0,0,0,0);color:#000;font-weight:bold;font-size:1.25em;line-height:1.25em;min-width:1.2em;min-height:1.2em;text-align:center;cursor:pointer;transition:.15s}@media screen and (min-width: 700px){.mg-upc-dg-close{top:1em;right:1em}}.mg-upc-dialog-content-wrapper{position:relative}@keyframes fade-in{from{opacity:0}}@keyframes slide-up{from{transform:translateY(10%)}}@font-face{font-family:"mgupc";src:url(../fd323a61b0577418b63a.eot?3p2eq6);src:url(../fd323a61b0577418b63a.eot?3p2eq6#iefix) format("embedded-opentype"),url(../aeaf4155903c2239613b.ttf?3p2eq6) format("truetype"),url(../d90b677af57f791b2998.woff?3p2eq6) format("woff"),url(../2f74331407887267c9f0.svg?3p2eq6#mgupc) format("svg");font-weight:normal;font-style:normal;font-display:block}.mg-upc-icon{font-family:"mgupc" !important;speak:never;font-style:normal;font-weight:normal;font-variant:normal;text-transform:none;line-height:1;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.upc-font-close:before{content:""}.upc-font-copy:before{content:""}.upc-font-first_page:before{content:""}.upc-font-last_page:before{content:""}.upc-font-arrow_left:before{content:""}.upc-font-arrow_right:before{content:""}.upc-font-poll:before{content:""}.upc-font-numbered:before{content:""}.upc-font-cart:before{content:""}.upc-font-bookmark:before{content:""}.upc-font-heart:before{content:""}.upc-font-save:before{content:""}.upc-font-edit:before{content:""}.upc-font-share:before{content:""}.upc-font-list:before{content:""}.upc-font-add:before{content:""}.upc-font-trash:before{content:""}.mg-upc-single-template .mg-upc-description{margin-top:1em}.mg-upc-single-template .mg-upc-author-box{margin:1em 0}.mg-upc-page-inner{flex-grow:2}.mg-upc-page-inner .mg-upc-author-box{padding:12px 10px 32px 120px;position:relative;min-height:120px}.mg-upc-page-inner .mg-upc-author-box .mg-upc-author-avatar{width:96px;height:96px;object-fit:cover;position:absolute;top:12px;left:0}.mg-upc-page-inner .mg-upc-author-box h4{font-size:21px;margin:12px 0 8px}.mg-upc-items-container{margin-left:0;margin-bottom:0;clear:both}.mg-upc-item{display:flex;flex-direction:row;position:relative;align-items:center;margin:40px 0}.mg-upc-item::after{content:" ";position:absolute;bottom:-20px;left:50%;width:80%;background:rgba(0,0,0,.15);height:1px;margin-left:-40%}.mg-upc-item:last-child::after{display:none}.mg-upc-item .mg-upc-list-item-price{display:inline-block;margin-right:1em}.mg-upc-item p.stock{margin:0;display:inline-block;float:right}.mg-upc-item-data{flex-grow:1;flex-shrink:2;padding-right:1em;padding-left:1em}.mg-upc-item-data header h2{margin:10px 0 5px;font-size:20px;font-weight:600}.mg-upc-item-data header a{text-decoration:none}@media(max-width: 500px){.mg-upc-item{flex-direction:column;text-align:center;align-items:stretch}.mg-upc-item-actions button,.mg-upc-item-actions>a{width:100%}}.mg-upc-item-img{width:15%;min-width:100px;margin:auto}.mg-upc-item-img figure{margin:0}.mg-upc-item-img img{min-height:130px;width:100%;background:#6f7277;object-fit:cover;object-position:center}.mg-upc-item-desc{margin:0;line-height:1.3;font-weight:300;clear:both}.mg-upc-item-number{font-size:2em;min-width:2em;text-align:center}.mg-upc-item-quantity{margin:.3em 1em}.mg-upc-item-quantity>*{display:block;text-align:center;padding:.1em .5em}.mg-upc-item-quantity small{opacity:.5}.mg-upc-item-actions{display:flex;flex-direction:column;row-gap:.5em;padding:1em 0}.mg-upc-item-actions button,.mg-upc-item-actions>a{min-width:9em;text-align:center;white-space:nowrap}.mg-upc-votes{width:100%;height:45px;position:relative;clear:both}.mg-upc-item-bar{width:100%;height:10px;position:absolute;top:24px}.mg-upc-item-bar-progress,.mg-upc-item-bar-fill{display:block;width:100%;height:100%;background:#ededed;border:solid 1px #ccc;position:absolute;top:0}.mg-upc-item-bar-fill{box-shadow:0 0 3px #aaa}.mg-upc-item-bar-progress{background:#380;border-color:#286103}.mg-upc-item-percent{right:0;position:absolute;line-height:24px;font-size:20px}.mg-upc-item-votes{display:block;font-size:12px;left:0;position:absolute;line-height:25px;top:3px}.mg-upc-items-pagination{padding:1em 0;border:1px solid rgba(0,0,0,.05);border-width:1px 0;text-align:center;clear:both}.mg-upc-items-pagination ul.page-numbers::after,.mg-upc-items-pagination ul.page-numbers::before{content:"";display:table}.mg-upc-items-pagination ul.page-numbers::after{clear:both}.mg-upc-items-pagination .page-numbers{list-style:none;margin:0}.mg-upc-items-pagination .page-numbers li{display:inline-block}.mg-upc-items-pagination .page-numbers li .page-numbers{border-left-width:0;display:inline-block;padding:0.3342343017em .875em;background-color:rgba(0,0,0,.025);color:#43454b}.mg-upc-items-pagination .page-numbers li .page-numbers.current{background-color:#474747;border-color:#474747;color:#fff}.mg-upc-items-pagination .page-numbers li .page-numbers.dots{background-color:rgba(0,0,0,0)}.mg-upc-items-pagination .page-numbers li .page-numbers.next,.mg-upc-items-pagination .page-numbers li .page-numbers.prev{padding-left:1em;padding-right:1em}.mg-upc-items-pagination .page-numbers li a.page-numbers:hover{background-color:rgba(0,0,0,.05)}.rtl .mg-upc-items-pagination a.next,.rtl .mg-upc-items-pagination a.prev{-webkit-transform:rotateY(180deg);transform:rotateY(180deg)}@keyframes mg-upc-alert{0%{transform:scaleY(0) translateY(-19px);margin-bottom:-19px}100%{transform:scaleY(1) translateY(0)}}.mg-upc-alert{padding:10px 40px 10px 1em;border:solid 1px #017401;background:rgba(154,240,173,.8);color:#000;margin:1em 0;animation:mg-upc-alert .3s 1 ease-in-out both}.mg-upc-alert p{margin:0}.mg-upc-item .mg-upc-alert{position:absolute;bottom:-19px;left:0;right:0;margin:0}.mg-upc-alert-error{border-color:#d50000;background:rgba(255,121,121,.8)}.mg-upc-alert-close{position:absolute;top:10px;right:15px;text-decoration:none !important;color:#000}.mg-upc-hide{display:none}.mg-upc-product-added{background-color:#a3e8a3;color:#445e18}.mg-upc-product-error{color:#740000;background-color:#f89a9a}@keyframes mg-upc-btn-loading{100%{transform:translateX(100%)}}.mg-upc-btn-loading{background-color:#c7c7c7;position:relative;overflow:hidden !important;z-index:1;vertical-align:middle;display:inline-block}.mg-upc-btn-loading::before,.mg-upc-btn-loading::after{content:" ";display:block !important;position:absolute;top:0;left:0;right:0;height:100%;background-color:#c7c7c7;z-index:2}.mg-upc-btn-loading::after{background-repeat:no-repeat;background-image:linear-gradient(90deg, #c7c7c7, #f5f5f5, #c7c7c7);transform:translateX(-100%);animation-name:mg-upc-btn-loading;animation-duration:.8s;animation-timing-function:ease-in-out;animation-iteration-count:infinite}.mg-upc-add-product-to-list{margin-bottom:.236em;margin-top:.236em}.post-adding{margin:1em;text-align:center}.mg-upc-add-list-to-cart{margin:1em 1em 1em 0}.mg-upc-add-list-to-cart+a.added_to_cart.wc-forward{margin:1em}.mg-upc-archive-list{margin-bottom:15px;display:flex}.mg-upc-archive-list .mg-upc-loop-list-title::before{width:1em;height:1em;margin-right:.35em;font-size:.8em;text-align:center;vertical-align:baseline;font-family:"mgupc" !important;speak:never;font-style:normal;font-weight:normal;font-variant:normal;text-transform:none;line-height:1;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;opacity:.5;content:""}.mg-upc-archive-list.mg-upc-vote .mg-upc-loop-list-title::before{content:""}.mg-upc-archive-list.mg-upc-cart .mg-upc-loop-list-title::before{content:""}.mg-upc-archive-list.mg-upc-numbered .mg-upc-loop-list-title::before{content:""}.mg-upc-archive-list.mg-upc-bookmark .mg-upc-loop-list-title::before{content:""}.mg-upc-archive-list.mg-upc-favorite .mg-upc-loop-list-title::before{content:""}h2.mg-upc-loop-list-title{margin:.25em 0 .15em;flex:100% 0 0}.mg-upc-archive-list .mg-upc-loop-list-title a{color:inherit;text-decoration:none}.mg-upc-thumbs-container{width:180px;min-width:50px;height:fit-content;overflow:hidden;font-size:0;line-height:0;display:inline-block;background-color:rgba(175,175,175,.13);background-image:url("data:image/svg+xml,%3Csvg viewBox=%270 0 52.92 52.92%27 xmlns=%27http://www.w3.org/2000/svg%27%3E%3Cpath fill=%27%239d9d9d%27 d=%27M0 0h26.46v26.46H0z%27/%3E%3Cpath fill=%27%23b3b3b3%27 d=%27M26.46 0h26.46v26.46H26.46z%27/%3E%3Cpath fill=%27%23cfcfcf%27 d=%27M0 26.46h26.46v26.46H0z%27/%3E%3Cpath fill=%27%23ebebeb%27 d=%27M26.46 26.46h26.46v26.46H26.46z%27/%3E%3C/svg%3E");background-size:cover;background-position:left bottom}@media(min-width: 576px){.mg-upc-thumbs-container{aspect-ratio:1}}.mg-upc-thumbs-container figure{width:50%;height:0;padding-bottom:50%;display:inline-block;position:relative;margin:0}.mg-upc-thumbs-container figure>img{position:absolute;height:100%;width:100%;object-fit:cover;margin:0;max-width:none;box-shadow:none !important}.mg-upc-loop-list-info{width:70%;width:calc(100% - 180px);display:inline-block;vertical-align:top;padding:1.5% 1% 1.5% 3%;box-sizing:border-box;flex:1 1;display:flex;flex-wrap:wrap;align-content:flex-start;justify-content:flex-start;align-items:center;gap:0 .7em}.mg-upc-loop-author-list,.mg-upc-loop-list-meta{display:inline-block;line-height:2em;vertical-align:middle;text-decoration:none;margin-right:.3em}.mg-upc-loop-list-meta>span{vertical-align:middle}.mg-upc-loop-author-list>.mg-upc-author-avatar{width:1.9em;height:1.9em;object-fit:cover;display:inline-block;vertical-align:middle}.mg-upc-loop-author-list>span{line-height:2em;display:inline-block;vertical-align:middle;margin-left:.5em;font-weight:700}.mg-upc-loop-author-list>span a{text-decoration:none}.mg-upc-loop-list-description{margin-top:20px;flex:100% 0 0}@media(max-width: 768px){.mg-upc-list-list .mg-upc-thumbs-container{width:120px}.mg-upc-list-list h2.mg-upc-loop-list-title{font-size:1.5em;margin-bottom:.2em}.mg-upc-list-list .mg-upc-loop-list-description{display:none}}@media(max-width: 576px){.mg-upc-list-list .mg-upc-thumbs-container{width:100%;height:auto}.mg-upc-list-list .mg-upc-loop-list-info{width:100%;padding:0 0 10px 0}.mg-upc-list-list .mg-upc-thumbs-container{background-size:50%;background-position:bottom}.mg-upc-list-list .mg-upc-thumbs-container figure{width:25%;height:0;padding-bottom:25%}.mg-upc-list-list .mg-upc-archive-list{flex-direction:column;margin-bottom:20px}}.mg-upc-list-card .mg-upc-loop-list-title{font-size:16px}@media(min-width: 600px){.mg-upc-list-card .mg-upc-loop-list-title{font-size:20px}}@media(min-width: 1024px){.mg-upc-list-card .mg-upc-loop-list-title{font-size:22px}}.mg-upc-list-card .mg-upc-archive{display:flex;flex-wrap:wrap}.mg-upc-list-card .mg-upc-archive-list{display:flex;flex-direction:column}.mg-upc-list-card .mg-upc-loop-list-info{width:100%;padding:5px 10px;background:#f9f9f9;flex-grow:2}.mg-upc-list-card .mg-upc-thumbs-container{position:relative;width:100%}.mg-upc-list-card .mg-upc-loop-list-description p{margin-bottom:0}@media(min-width: 0){.mg-upc-list-card.mg-upc-list-cols-xs-1 .mg-upc-archive-list{width:100%}.mg-upc-list-card.mg-upc-list-cols-xs-2 .mg-upc-archive{gap:2%}.mg-upc-list-card.mg-upc-list-cols-xs-2 .mg-upc-archive-list{width:49%}.mg-upc-list-card.mg-upc-list-cols-xs-3 .mg-upc-archive{gap:2%}.mg-upc-list-card.mg-upc-list-cols-xs-3 .mg-upc-archive-list{width:32%}.mg-upc-list-card.mg-upc-list-cols-xs-4 .mg-upc-archive{gap:1.3333333333%}.mg-upc-list-card.mg-upc-list-cols-xs-4 .mg-upc-archive-list{width:24%}.mg-upc-list-card.mg-upc-list-cols-xs-5 .mg-upc-archive{gap:1.25%}.mg-upc-list-card.mg-upc-list-cols-xs-5 .mg-upc-archive-list{width:19%}.mg-upc-list-card.mg-upc-list-cols-xs-6 .mg-upc-archive{gap:.8%}.mg-upc-list-card.mg-upc-list-cols-xs-6 .mg-upc-archive-list{width:16%}}@media(min-width: 576px){.mg-upc-list-card.mg-upc-list-cols-sm-1 .mg-upc-archive-list{width:100%}.mg-upc-list-card.mg-upc-list-cols-sm-2 .mg-upc-archive{gap:2%}.mg-upc-list-card.mg-upc-list-cols-sm-2 .mg-upc-archive-list{width:49%}.mg-upc-list-card.mg-upc-list-cols-sm-3 .mg-upc-archive{gap:2%}.mg-upc-list-card.mg-upc-list-cols-sm-3 .mg-upc-archive-list{width:32%}.mg-upc-list-card.mg-upc-list-cols-sm-4 .mg-upc-archive{gap:1.3333333333%}.mg-upc-list-card.mg-upc-list-cols-sm-4 .mg-upc-archive-list{width:24%}.mg-upc-list-card.mg-upc-list-cols-sm-5 .mg-upc-archive{gap:1.25%}.mg-upc-list-card.mg-upc-list-cols-sm-5 .mg-upc-archive-list{width:19%}.mg-upc-list-card.mg-upc-list-cols-sm-6 .mg-upc-archive{gap:.8%}.mg-upc-list-card.mg-upc-list-cols-sm-6 .mg-upc-archive-list{width:16%}}@media(min-width: 768px){.mg-upc-list-card.mg-upc-list-cols-md-1 .mg-upc-archive-list{width:100%}.mg-upc-list-card.mg-upc-list-cols-md-2 .mg-upc-archive{gap:2%}.mg-upc-list-card.mg-upc-list-cols-md-2 .mg-upc-archive-list{width:49%}.mg-upc-list-card.mg-upc-list-cols-md-3 .mg-upc-archive{gap:2%}.mg-upc-list-card.mg-upc-list-cols-md-3 .mg-upc-archive-list{width:32%}.mg-upc-list-card.mg-upc-list-cols-md-4 .mg-upc-archive{gap:1.3333333333%}.mg-upc-list-card.mg-upc-list-cols-md-4 .mg-upc-archive-list{width:24%}.mg-upc-list-card.mg-upc-list-cols-md-5 .mg-upc-archive{gap:1.25%}.mg-upc-list-card.mg-upc-list-cols-md-5 .mg-upc-archive-list{width:19%}.mg-upc-list-card.mg-upc-list-cols-md-6 .mg-upc-archive{gap:.8%}.mg-upc-list-card.mg-upc-list-cols-md-6 .mg-upc-archive-list{width:16%}}@media(min-width: 992px){.mg-upc-list-card.mg-upc-list-cols-lg-1 .mg-upc-archive-list{width:100%}.mg-upc-list-card.mg-upc-list-cols-lg-2 .mg-upc-archive{gap:2%}.mg-upc-list-card.mg-upc-list-cols-lg-2 .mg-upc-archive-list{width:49%}.mg-upc-list-card.mg-upc-list-cols-lg-3 .mg-upc-archive{gap:2%}.mg-upc-list-card.mg-upc-list-cols-lg-3 .mg-upc-archive-list{width:32%}.mg-upc-list-card.mg-upc-list-cols-lg-4 .mg-upc-archive{gap:1.3333333333%}.mg-upc-list-card.mg-upc-list-cols-lg-4 .mg-upc-archive-list{width:24%}.mg-upc-list-card.mg-upc-list-cols-lg-5 .mg-upc-archive{gap:1.25%}.mg-upc-list-card.mg-upc-list-cols-lg-5 .mg-upc-archive-list{width:19%}.mg-upc-list-card.mg-upc-list-cols-lg-6 .mg-upc-archive{gap:.8%}.mg-upc-list-card.mg-upc-list-cols-lg-6 .mg-upc-archive-list{width:16%}}@media(min-width: 1200px){.mg-upc-list-card.mg-upc-list-cols-xl-1 .mg-upc-archive-list{width:100%}.mg-upc-list-card.mg-upc-list-cols-xl-2 .mg-upc-archive{gap:2%}.mg-upc-list-card.mg-upc-list-cols-xl-2 .mg-upc-archive-list{width:49%}.mg-upc-list-card.mg-upc-list-cols-xl-3 .mg-upc-archive{gap:2%}.mg-upc-list-card.mg-upc-list-cols-xl-3 .mg-upc-archive-list{width:32%}.mg-upc-list-card.mg-upc-list-cols-xl-4 .mg-upc-archive{gap:1.3333333333%}.mg-upc-list-card.mg-upc-list-cols-xl-4 .mg-upc-archive-list{width:24%}.mg-upc-list-card.mg-upc-list-cols-xl-5 .mg-upc-archive{gap:1.25%}.mg-upc-list-card.mg-upc-list-cols-xl-5 .mg-upc-archive-list{width:19%}.mg-upc-list-card.mg-upc-list-cols-xl-6 .mg-upc-archive{gap:.8%}.mg-upc-list-card.mg-upc-list-cols-xl-6 .mg-upc-archive-list{width:16%}}@media(min-width: 1400px){.mg-upc-list-card.mg-upc-list-cols-xxl-1 .mg-upc-archive-list{width:100%}.mg-upc-list-card.mg-upc-list-cols-xxl-2 .mg-upc-archive{gap:2%}.mg-upc-list-card.mg-upc-list-cols-xxl-2 .mg-upc-archive-list{width:49%}.mg-upc-list-card.mg-upc-list-cols-xxl-3 .mg-upc-archive{gap:2%}.mg-upc-list-card.mg-upc-list-cols-xxl-3 .mg-upc-archive-list{width:32%}.mg-upc-list-card.mg-upc-list-cols-xxl-4 .mg-upc-archive{gap:1.3333333333%}.mg-upc-list-card.mg-upc-list-cols-xxl-4 .mg-upc-archive-list{width:24%}.mg-upc-list-card.mg-upc-list-cols-xxl-5 .mg-upc-archive{gap:1.25%}.mg-upc-list-card.mg-upc-list-cols-xxl-5 .mg-upc-archive-list{width:19%}.mg-upc-list-card.mg-upc-list-cols-xxl-6 .mg-upc-archive{gap:.8%}.mg-upc-list-card.mg-upc-list-cols-xxl-6 .mg-upc-archive-list{width:16%}}.mg-upc-list-card .mg-upc-thumbs-container{height:max-content;overflow:hidden}.mg-upc-archive .mg-upc-thumbs-container figure{height:0}.mg-upc-archive.mg-upc-list-card .mg-upc-thumbs-container{width:100%}.mg-upc-thumbs-1x1 .mg-upc-thumbs-container,.mg-upc-thumbs-1x2 .mg-upc-thumbs-container,.mg-upc-thumbs-1x3 .mg-upc-thumbs-container,.mg-upc-thumbs-1x4 .mg-upc-thumbs-container{background-size:200%}.mg-upc-thumbs-1x1 .mg-upc-thumbs-container figure,.mg-upc-thumbs-1x2 .mg-upc-thumbs-container figure,.mg-upc-thumbs-1x3 .mg-upc-thumbs-container figure,.mg-upc-thumbs-1x4 .mg-upc-thumbs-container figure{width:100%;padding-bottom:100%}.mg-upc-thumbs-1x1 .mg-upc-thumbs-container{aspect-ratio:1}.mg-upc-thumbs-1x2 .mg-upc-thumbs-container{aspect-ratio:.5}.mg-upc-thumbs-1x3 .mg-upc-thumbs-container{aspect-ratio:.33334}.mg-upc-thumbs-1x4 .mg-upc-thumbs-container{aspect-ratio:.25}.mg-upc-thumbs-2x1 .mg-upc-thumbs-container,.mg-upc-thumbs-2x2 .mg-upc-thumbs-container,.mg-upc-thumbs-2x3 .mg-upc-thumbs-container,.mg-upc-thumbs-2x4 .mg-upc-thumbs-container{background-size:100%}.mg-upc-thumbs-2x1 .mg-upc-thumbs-container figure,.mg-upc-thumbs-2x2 .mg-upc-thumbs-container figure,.mg-upc-thumbs-2x3 .mg-upc-thumbs-container figure,.mg-upc-thumbs-2x4 .mg-upc-thumbs-container figure{width:50%;padding-bottom:50%}.mg-upc-thumbs-2x1 .mg-upc-thumbs-container{aspect-ratio:2}.mg-upc-thumbs-2x2 .mg-upc-thumbs-container{aspect-ratio:1}.mg-upc-thumbs-2x3 .mg-upc-thumbs-container{aspect-ratio:.66667}.mg-upc-thumbs-2x4 .mg-upc-thumbs-container{aspect-ratio:.5}.mg-upc-thumbs-3x1 .mg-upc-thumbs-container,.mg-upc-thumbs-3x2 .mg-upc-thumbs-container,.mg-upc-thumbs-3x3 .mg-upc-thumbs-container,.mg-upc-thumbs-3x4 .mg-upc-thumbs-container{background-size:66.6666666667%}.mg-upc-thumbs-3x1 .mg-upc-thumbs-container figure,.mg-upc-thumbs-3x2 .mg-upc-thumbs-container figure,.mg-upc-thumbs-3x3 .mg-upc-thumbs-container figure,.mg-upc-thumbs-3x4 .mg-upc-thumbs-container figure{width:33.33334%;padding-bottom:33.33334%}.mg-upc-thumbs-3x1 .mg-upc-thumbs-container{aspect-ratio:3}.mg-upc-thumbs-3x2 .mg-upc-thumbs-container{aspect-ratio:1.5}.mg-upc-thumbs-3x3 .mg-upc-thumbs-container{aspect-ratio:1}.mg-upc-thumbs-3x4 .mg-upc-thumbs-container{aspect-ratio:.75}.mg-upc-thumbs-4x1 .mg-upc-thumbs-container,.mg-upc-thumbs-4x2 .mg-upc-thumbs-container,.mg-upc-thumbs-4x3 .mg-upc-thumbs-container,.mg-upc-thumbs-4x4 .mg-upc-thumbs-container{background-size:50%}.mg-upc-thumbs-4x1 .mg-upc-thumbs-container figure,.mg-upc-thumbs-4x2 .mg-upc-thumbs-container figure,.mg-upc-thumbs-4x3 .mg-upc-thumbs-container figure,.mg-upc-thumbs-4x4 .mg-upc-thumbs-container figure{width:25%;padding-bottom:25%}.mg-upc-thumbs-4x1 .mg-upc-thumbs-container{aspect-ratio:4}.mg-upc-thumbs-4x2 .mg-upc-thumbs-container{aspect-ratio:2}.mg-upc-thumbs-4x3 .mg-upc-thumbs-container{aspect-ratio:1.33334}.mg-upc-thumbs-4x4 .mg-upc-thumbs-container{aspect-ratio:1}@media(min-width: 0){.mg-upc-thumbs-xs-1x1 .mg-upc-thumbs-container,.mg-upc-thumbs-xs-1x2 .mg-upc-thumbs-container,.mg-upc-thumbs-xs-1x3 .mg-upc-thumbs-container,.mg-upc-thumbs-xs-1x4 .mg-upc-thumbs-container{background-size:200%}.mg-upc-thumbs-xs-1x1 .mg-upc-thumbs-container figure,.mg-upc-thumbs-xs-1x2 .mg-upc-thumbs-container figure,.mg-upc-thumbs-xs-1x3 .mg-upc-thumbs-container figure,.mg-upc-thumbs-xs-1x4 .mg-upc-thumbs-container figure{width:100%;padding-bottom:100%}.mg-upc-thumbs-xs-1x1 .mg-upc-thumbs-container{aspect-ratio:1}.mg-upc-thumbs-xs-1x2 .mg-upc-thumbs-container{aspect-ratio:.5}.mg-upc-thumbs-xs-1x3 .mg-upc-thumbs-container{aspect-ratio:.33334}.mg-upc-thumbs-xs-1x4 .mg-upc-thumbs-container{aspect-ratio:.25}.mg-upc-thumbs-xs-2x1 .mg-upc-thumbs-container,.mg-upc-thumbs-xs-2x2 .mg-upc-thumbs-container,.mg-upc-thumbs-xs-2x3 .mg-upc-thumbs-container,.mg-upc-thumbs-xs-2x4 .mg-upc-thumbs-container{background-size:100%}.mg-upc-thumbs-xs-2x1 .mg-upc-thumbs-container figure,.mg-upc-thumbs-xs-2x2 .mg-upc-thumbs-container figure,.mg-upc-thumbs-xs-2x3 .mg-upc-thumbs-container figure,.mg-upc-thumbs-xs-2x4 .mg-upc-thumbs-container figure{width:50%;padding-bottom:50%}.mg-upc-thumbs-xs-2x1 .mg-upc-thumbs-container{aspect-ratio:2}.mg-upc-thumbs-xs-2x2 .mg-upc-thumbs-container{aspect-ratio:1}.mg-upc-thumbs-xs-2x3 .mg-upc-thumbs-container{aspect-ratio:.66667}.mg-upc-thumbs-xs-2x4 .mg-upc-thumbs-container{aspect-ratio:.5}.mg-upc-thumbs-xs-3x1 .mg-upc-thumbs-container,.mg-upc-thumbs-xs-3x2 .mg-upc-thumbs-container,.mg-upc-thumbs-xs-3x3 .mg-upc-thumbs-container,.mg-upc-thumbs-xs-3x4 .mg-upc-thumbs-container{background-size:66.6666666667%}.mg-upc-thumbs-xs-3x1 .mg-upc-thumbs-container figure,.mg-upc-thumbs-xs-3x2 .mg-upc-thumbs-container figure,.mg-upc-thumbs-xs-3x3 .mg-upc-thumbs-container figure,.mg-upc-thumbs-xs-3x4 .mg-upc-thumbs-container figure{width:33.33334%;padding-bottom:33.33334%}.mg-upc-thumbs-xs-3x1 .mg-upc-thumbs-container{aspect-ratio:3}.mg-upc-thumbs-xs-3x2 .mg-upc-thumbs-container{aspect-ratio:1.5}.mg-upc-thumbs-xs-3x3 .mg-upc-thumbs-container{aspect-ratio:1}.mg-upc-thumbs-xs-3x4 .mg-upc-thumbs-container{aspect-ratio:.75}.mg-upc-thumbs-xs-4x1 .mg-upc-thumbs-container,.mg-upc-thumbs-xs-4x2 .mg-upc-thumbs-container,.mg-upc-thumbs-xs-4x3 .mg-upc-thumbs-container,.mg-upc-thumbs-xs-4x4 .mg-upc-thumbs-container{background-size:50%}.mg-upc-thumbs-xs-4x1 .mg-upc-thumbs-container figure,.mg-upc-thumbs-xs-4x2 .mg-upc-thumbs-container figure,.mg-upc-thumbs-xs-4x3 .mg-upc-thumbs-container figure,.mg-upc-thumbs-xs-4x4 .mg-upc-thumbs-container figure{width:25%;padding-bottom:25%}.mg-upc-thumbs-xs-4x1 .mg-upc-thumbs-container{aspect-ratio:4}.mg-upc-thumbs-xs-4x2 .mg-upc-thumbs-container{aspect-ratio:2}.mg-upc-thumbs-xs-4x3 .mg-upc-thumbs-container{aspect-ratio:1.33334}.mg-upc-thumbs-xs-4x4 .mg-upc-thumbs-container{aspect-ratio:1}}@media(min-width: 576px){.mg-upc-thumbs-sm-1x1 .mg-upc-thumbs-container,.mg-upc-thumbs-sm-1x2 .mg-upc-thumbs-container,.mg-upc-thumbs-sm-1x3 .mg-upc-thumbs-container,.mg-upc-thumbs-sm-1x4 .mg-upc-thumbs-container{background-size:200%}.mg-upc-thumbs-sm-1x1 .mg-upc-thumbs-container figure,.mg-upc-thumbs-sm-1x2 .mg-upc-thumbs-container figure,.mg-upc-thumbs-sm-1x3 .mg-upc-thumbs-container figure,.mg-upc-thumbs-sm-1x4 .mg-upc-thumbs-container figure{width:100%;padding-bottom:100%}.mg-upc-thumbs-sm-1x1 .mg-upc-thumbs-container{aspect-ratio:1}.mg-upc-thumbs-sm-1x2 .mg-upc-thumbs-container{aspect-ratio:.5}.mg-upc-thumbs-sm-1x3 .mg-upc-thumbs-container{aspect-ratio:.33334}.mg-upc-thumbs-sm-1x4 .mg-upc-thumbs-container{aspect-ratio:.25}.mg-upc-thumbs-sm-2x1 .mg-upc-thumbs-container,.mg-upc-thumbs-sm-2x2 .mg-upc-thumbs-container,.mg-upc-thumbs-sm-2x3 .mg-upc-thumbs-container,.mg-upc-thumbs-sm-2x4 .mg-upc-thumbs-container{background-size:100%}.mg-upc-thumbs-sm-2x1 .mg-upc-thumbs-container figure,.mg-upc-thumbs-sm-2x2 .mg-upc-thumbs-container figure,.mg-upc-thumbs-sm-2x3 .mg-upc-thumbs-container figure,.mg-upc-thumbs-sm-2x4 .mg-upc-thumbs-container figure{width:50%;padding-bottom:50%}.mg-upc-thumbs-sm-2x1 .mg-upc-thumbs-container{aspect-ratio:2}.mg-upc-thumbs-sm-2x2 .mg-upc-thumbs-container{aspect-ratio:1}.mg-upc-thumbs-sm-2x3 .mg-upc-thumbs-container{aspect-ratio:.66667}.mg-upc-thumbs-sm-2x4 .mg-upc-thumbs-container{aspect-ratio:.5}.mg-upc-thumbs-sm-3x1 .mg-upc-thumbs-container,.mg-upc-thumbs-sm-3x2 .mg-upc-thumbs-container,.mg-upc-thumbs-sm-3x3 .mg-upc-thumbs-container,.mg-upc-thumbs-sm-3x4 .mg-upc-thumbs-container{background-size:66.6666666667%}.mg-upc-thumbs-sm-3x1 .mg-upc-thumbs-container figure,.mg-upc-thumbs-sm-3x2 .mg-upc-thumbs-container figure,.mg-upc-thumbs-sm-3x3 .mg-upc-thumbs-container figure,.mg-upc-thumbs-sm-3x4 .mg-upc-thumbs-container figure{width:33.33334%;padding-bottom:33.33334%}.mg-upc-thumbs-sm-3x1 .mg-upc-thumbs-container{aspect-ratio:3}.mg-upc-thumbs-sm-3x2 .mg-upc-thumbs-container{aspect-ratio:1.5}.mg-upc-thumbs-sm-3x3 .mg-upc-thumbs-container{aspect-ratio:1}.mg-upc-thumbs-sm-3x4 .mg-upc-thumbs-container{aspect-ratio:.75}.mg-upc-thumbs-sm-4x1 .mg-upc-thumbs-container,.mg-upc-thumbs-sm-4x2 .mg-upc-thumbs-container,.mg-upc-thumbs-sm-4x3 .mg-upc-thumbs-container,.mg-upc-thumbs-sm-4x4 .mg-upc-thumbs-container{background-size:50%}.mg-upc-thumbs-sm-4x1 .mg-upc-thumbs-container figure,.mg-upc-thumbs-sm-4x2 .mg-upc-thumbs-container figure,.mg-upc-thumbs-sm-4x3 .mg-upc-thumbs-container figure,.mg-upc-thumbs-sm-4x4 .mg-upc-thumbs-container figure{width:25%;padding-bottom:25%}.mg-upc-thumbs-sm-4x1 .mg-upc-thumbs-container{aspect-ratio:4}.mg-upc-thumbs-sm-4x2 .mg-upc-thumbs-container{aspect-ratio:2}.mg-upc-thumbs-sm-4x3 .mg-upc-thumbs-container{aspect-ratio:1.33334}.mg-upc-thumbs-sm-4x4 .mg-upc-thumbs-container{aspect-ratio:1}}@media(min-width: 768px){.mg-upc-thumbs-md-1x1 .mg-upc-thumbs-container,.mg-upc-thumbs-md-1x2 .mg-upc-thumbs-container,.mg-upc-thumbs-md-1x3 .mg-upc-thumbs-container,.mg-upc-thumbs-md-1x4 .mg-upc-thumbs-container{background-size:200%}.mg-upc-thumbs-md-1x1 .mg-upc-thumbs-container figure,.mg-upc-thumbs-md-1x2 .mg-upc-thumbs-container figure,.mg-upc-thumbs-md-1x3 .mg-upc-thumbs-container figure,.mg-upc-thumbs-md-1x4 .mg-upc-thumbs-container figure{width:100%;padding-bottom:100%}.mg-upc-thumbs-md-1x1 .mg-upc-thumbs-container{aspect-ratio:1}.mg-upc-thumbs-md-1x2 .mg-upc-thumbs-container{aspect-ratio:.5}.mg-upc-thumbs-md-1x3 .mg-upc-thumbs-container{aspect-ratio:.33334}.mg-upc-thumbs-md-1x4 .mg-upc-thumbs-container{aspect-ratio:.25}.mg-upc-thumbs-md-2x1 .mg-upc-thumbs-container,.mg-upc-thumbs-md-2x2 .mg-upc-thumbs-container,.mg-upc-thumbs-md-2x3 .mg-upc-thumbs-container,.mg-upc-thumbs-md-2x4 .mg-upc-thumbs-container{background-size:100%}.mg-upc-thumbs-md-2x1 .mg-upc-thumbs-container figure,.mg-upc-thumbs-md-2x2 .mg-upc-thumbs-container figure,.mg-upc-thumbs-md-2x3 .mg-upc-thumbs-container figure,.mg-upc-thumbs-md-2x4 .mg-upc-thumbs-container figure{width:50%;padding-bottom:50%}.mg-upc-thumbs-md-2x1 .mg-upc-thumbs-container{aspect-ratio:2}.mg-upc-thumbs-md-2x2 .mg-upc-thumbs-container{aspect-ratio:1}.mg-upc-thumbs-md-2x3 .mg-upc-thumbs-container{aspect-ratio:.66667}.mg-upc-thumbs-md-2x4 .mg-upc-thumbs-container{aspect-ratio:.5}.mg-upc-thumbs-md-3x1 .mg-upc-thumbs-container,.mg-upc-thumbs-md-3x2 .mg-upc-thumbs-container,.mg-upc-thumbs-md-3x3 .mg-upc-thumbs-container,.mg-upc-thumbs-md-3x4 .mg-upc-thumbs-container{background-size:66.6666666667%}.mg-upc-thumbs-md-3x1 .mg-upc-thumbs-container figure,.mg-upc-thumbs-md-3x2 .mg-upc-thumbs-container figure,.mg-upc-thumbs-md-3x3 .mg-upc-thumbs-container figure,.mg-upc-thumbs-md-3x4 .mg-upc-thumbs-container figure{width:33.33334%;padding-bottom:33.33334%}.mg-upc-thumbs-md-3x1 .mg-upc-thumbs-container{aspect-ratio:3}.mg-upc-thumbs-md-3x2 .mg-upc-thumbs-container{aspect-ratio:1.5}.mg-upc-thumbs-md-3x3 .mg-upc-thumbs-container{aspect-ratio:1}.mg-upc-thumbs-md-3x4 .mg-upc-thumbs-container{aspect-ratio:.75}.mg-upc-thumbs-md-4x1 .mg-upc-thumbs-container,.mg-upc-thumbs-md-4x2 .mg-upc-thumbs-container,.mg-upc-thumbs-md-4x3 .mg-upc-thumbs-container,.mg-upc-thumbs-md-4x4 .mg-upc-thumbs-container{background-size:50%}.mg-upc-thumbs-md-4x1 .mg-upc-thumbs-container figure,.mg-upc-thumbs-md-4x2 .mg-upc-thumbs-container figure,.mg-upc-thumbs-md-4x3 .mg-upc-thumbs-container figure,.mg-upc-thumbs-md-4x4 .mg-upc-thumbs-container figure{width:25%;padding-bottom:25%}.mg-upc-thumbs-md-4x1 .mg-upc-thumbs-container{aspect-ratio:4}.mg-upc-thumbs-md-4x2 .mg-upc-thumbs-container{aspect-ratio:2}.mg-upc-thumbs-md-4x3 .mg-upc-thumbs-container{aspect-ratio:1.33334}.mg-upc-thumbs-md-4x4 .mg-upc-thumbs-container{aspect-ratio:1}}@media(min-width: 992px){.mg-upc-thumbs-lg-1x1 .mg-upc-thumbs-container,.mg-upc-thumbs-lg-1x2 .mg-upc-thumbs-container,.mg-upc-thumbs-lg-1x3 .mg-upc-thumbs-container,.mg-upc-thumbs-lg-1x4 .mg-upc-thumbs-container{background-size:200%}.mg-upc-thumbs-lg-1x1 .mg-upc-thumbs-container figure,.mg-upc-thumbs-lg-1x2 .mg-upc-thumbs-container figure,.mg-upc-thumbs-lg-1x3 .mg-upc-thumbs-container figure,.mg-upc-thumbs-lg-1x4 .mg-upc-thumbs-container figure{width:100%;padding-bottom:100%}.mg-upc-thumbs-lg-1x1 .mg-upc-thumbs-container{aspect-ratio:1}.mg-upc-thumbs-lg-1x2 .mg-upc-thumbs-container{aspect-ratio:.5}.mg-upc-thumbs-lg-1x3 .mg-upc-thumbs-container{aspect-ratio:.33334}.mg-upc-thumbs-lg-1x4 .mg-upc-thumbs-container{aspect-ratio:.25}.mg-upc-thumbs-lg-2x1 .mg-upc-thumbs-container,.mg-upc-thumbs-lg-2x2 .mg-upc-thumbs-container,.mg-upc-thumbs-lg-2x3 .mg-upc-thumbs-container,.mg-upc-thumbs-lg-2x4 .mg-upc-thumbs-container{background-size:100%}.mg-upc-thumbs-lg-2x1 .mg-upc-thumbs-container figure,.mg-upc-thumbs-lg-2x2 .mg-upc-thumbs-container figure,.mg-upc-thumbs-lg-2x3 .mg-upc-thumbs-container figure,.mg-upc-thumbs-lg-2x4 .mg-upc-thumbs-container figure{width:50%;padding-bottom:50%}.mg-upc-thumbs-lg-2x1 .mg-upc-thumbs-container{aspect-ratio:2}.mg-upc-thumbs-lg-2x2 .mg-upc-thumbs-container{aspect-ratio:1}.mg-upc-thumbs-lg-2x3 .mg-upc-thumbs-container{aspect-ratio:.66667}.mg-upc-thumbs-lg-2x4 .mg-upc-thumbs-container{aspect-ratio:.5}.mg-upc-thumbs-lg-3x1 .mg-upc-thumbs-container,.mg-upc-thumbs-lg-3x2 .mg-upc-thumbs-container,.mg-upc-thumbs-lg-3x3 .mg-upc-thumbs-container,.mg-upc-thumbs-lg-3x4 .mg-upc-thumbs-container{background-size:66.6666666667%}.mg-upc-thumbs-lg-3x1 .mg-upc-thumbs-container figure,.mg-upc-thumbs-lg-3x2 .mg-upc-thumbs-container figure,.mg-upc-thumbs-lg-3x3 .mg-upc-thumbs-container figure,.mg-upc-thumbs-lg-3x4 .mg-upc-thumbs-container figure{width:33.33334%;padding-bottom:33.33334%}.mg-upc-thumbs-lg-3x1 .mg-upc-thumbs-container{aspect-ratio:3}.mg-upc-thumbs-lg-3x2 .mg-upc-thumbs-container{aspect-ratio:1.5}.mg-upc-thumbs-lg-3x3 .mg-upc-thumbs-container{aspect-ratio:1}.mg-upc-thumbs-lg-3x4 .mg-upc-thumbs-container{aspect-ratio:.75}.mg-upc-thumbs-lg-4x1 .mg-upc-thumbs-container,.mg-upc-thumbs-lg-4x2 .mg-upc-thumbs-container,.mg-upc-thumbs-lg-4x3 .mg-upc-thumbs-container,.mg-upc-thumbs-lg-4x4 .mg-upc-thumbs-container{background-size:50%}.mg-upc-thumbs-lg-4x1 .mg-upc-thumbs-container figure,.mg-upc-thumbs-lg-4x2 .mg-upc-thumbs-container figure,.mg-upc-thumbs-lg-4x3 .mg-upc-thumbs-container figure,.mg-upc-thumbs-lg-4x4 .mg-upc-thumbs-container figure{width:25%;padding-bottom:25%}.mg-upc-thumbs-lg-4x1 .mg-upc-thumbs-container{aspect-ratio:4}.mg-upc-thumbs-lg-4x2 .mg-upc-thumbs-container{aspect-ratio:2}.mg-upc-thumbs-lg-4x3 .mg-upc-thumbs-container{aspect-ratio:1.33334}.mg-upc-thumbs-lg-4x4 .mg-upc-thumbs-container{aspect-ratio:1}}@media(min-width: 1200px){.mg-upc-thumbs-xl-1x1 .mg-upc-thumbs-container,.mg-upc-thumbs-xl-1x2 .mg-upc-thumbs-container,.mg-upc-thumbs-xl-1x3 .mg-upc-thumbs-container,.mg-upc-thumbs-xl-1x4 .mg-upc-thumbs-container{background-size:200%}.mg-upc-thumbs-xl-1x1 .mg-upc-thumbs-container figure,.mg-upc-thumbs-xl-1x2 .mg-upc-thumbs-container figure,.mg-upc-thumbs-xl-1x3 .mg-upc-thumbs-container figure,.mg-upc-thumbs-xl-1x4 .mg-upc-thumbs-container figure{width:100%;padding-bottom:100%}.mg-upc-thumbs-xl-1x1 .mg-upc-thumbs-container{aspect-ratio:1}.mg-upc-thumbs-xl-1x2 .mg-upc-thumbs-container{aspect-ratio:.5}.mg-upc-thumbs-xl-1x3 .mg-upc-thumbs-container{aspect-ratio:.33334}.mg-upc-thumbs-xl-1x4 .mg-upc-thumbs-container{aspect-ratio:.25}.mg-upc-thumbs-xl-2x1 .mg-upc-thumbs-container,.mg-upc-thumbs-xl-2x2 .mg-upc-thumbs-container,.mg-upc-thumbs-xl-2x3 .mg-upc-thumbs-container,.mg-upc-thumbs-xl-2x4 .mg-upc-thumbs-container{background-size:100%}.mg-upc-thumbs-xl-2x1 .mg-upc-thumbs-container figure,.mg-upc-thumbs-xl-2x2 .mg-upc-thumbs-container figure,.mg-upc-thumbs-xl-2x3 .mg-upc-thumbs-container figure,.mg-upc-thumbs-xl-2x4 .mg-upc-thumbs-container figure{width:50%;padding-bottom:50%}.mg-upc-thumbs-xl-2x1 .mg-upc-thumbs-container{aspect-ratio:2}.mg-upc-thumbs-xl-2x2 .mg-upc-thumbs-container{aspect-ratio:1}.mg-upc-thumbs-xl-2x3 .mg-upc-thumbs-container{aspect-ratio:.66667}.mg-upc-thumbs-xl-2x4 .mg-upc-thumbs-container{aspect-ratio:.5}.mg-upc-thumbs-xl-3x1 .mg-upc-thumbs-container,.mg-upc-thumbs-xl-3x2 .mg-upc-thumbs-container,.mg-upc-thumbs-xl-3x3 .mg-upc-thumbs-container,.mg-upc-thumbs-xl-3x4 .mg-upc-thumbs-container{background-size:66.6666666667%}.mg-upc-thumbs-xl-3x1 .mg-upc-thumbs-container figure,.mg-upc-thumbs-xl-3x2 .mg-upc-thumbs-container figure,.mg-upc-thumbs-xl-3x3 .mg-upc-thumbs-container figure,.mg-upc-thumbs-xl-3x4 .mg-upc-thumbs-container figure{width:33.33334%;padding-bottom:33.33334%}.mg-upc-thumbs-xl-3x1 .mg-upc-thumbs-container{aspect-ratio:3}.mg-upc-thumbs-xl-3x2 .mg-upc-thumbs-container{aspect-ratio:1.5}.mg-upc-thumbs-xl-3x3 .mg-upc-thumbs-container{aspect-ratio:1}.mg-upc-thumbs-xl-3x4 .mg-upc-thumbs-container{aspect-ratio:.75}.mg-upc-thumbs-xl-4x1 .mg-upc-thumbs-container,.mg-upc-thumbs-xl-4x2 .mg-upc-thumbs-container,.mg-upc-thumbs-xl-4x3 .mg-upc-thumbs-container,.mg-upc-thumbs-xl-4x4 .mg-upc-thumbs-container{background-size:50%}.mg-upc-thumbs-xl-4x1 .mg-upc-thumbs-container figure,.mg-upc-thumbs-xl-4x2 .mg-upc-thumbs-container figure,.mg-upc-thumbs-xl-4x3 .mg-upc-thumbs-container figure,.mg-upc-thumbs-xl-4x4 .mg-upc-thumbs-container figure{width:25%;padding-bottom:25%}.mg-upc-thumbs-xl-4x1 .mg-upc-thumbs-container{aspect-ratio:4}.mg-upc-thumbs-xl-4x2 .mg-upc-thumbs-container{aspect-ratio:2}.mg-upc-thumbs-xl-4x3 .mg-upc-thumbs-container{aspect-ratio:1.33334}.mg-upc-thumbs-xl-4x4 .mg-upc-thumbs-container{aspect-ratio:1}}@media(min-width: 1400px){.mg-upc-thumbs-xxl-1x1 .mg-upc-thumbs-container,.mg-upc-thumbs-xxl-1x2 .mg-upc-thumbs-container,.mg-upc-thumbs-xxl-1x3 .mg-upc-thumbs-container,.mg-upc-thumbs-xxl-1x4 .mg-upc-thumbs-container{background-size:200%}.mg-upc-thumbs-xxl-1x1 .mg-upc-thumbs-container figure,.mg-upc-thumbs-xxl-1x2 .mg-upc-thumbs-container figure,.mg-upc-thumbs-xxl-1x3 .mg-upc-thumbs-container figure,.mg-upc-thumbs-xxl-1x4 .mg-upc-thumbs-container figure{width:100%;padding-bottom:100%}.mg-upc-thumbs-xxl-1x1 .mg-upc-thumbs-container{aspect-ratio:1}.mg-upc-thumbs-xxl-1x2 .mg-upc-thumbs-container{aspect-ratio:.5}.mg-upc-thumbs-xxl-1x3 .mg-upc-thumbs-container{aspect-ratio:.33334}.mg-upc-thumbs-xxl-1x4 .mg-upc-thumbs-container{aspect-ratio:.25}.mg-upc-thumbs-xxl-2x1 .mg-upc-thumbs-container,.mg-upc-thumbs-xxl-2x2 .mg-upc-thumbs-container,.mg-upc-thumbs-xxl-2x3 .mg-upc-thumbs-container,.mg-upc-thumbs-xxl-2x4 .mg-upc-thumbs-container{background-size:100%}.mg-upc-thumbs-xxl-2x1 .mg-upc-thumbs-container figure,.mg-upc-thumbs-xxl-2x2 .mg-upc-thumbs-container figure,.mg-upc-thumbs-xxl-2x3 .mg-upc-thumbs-container figure,.mg-upc-thumbs-xxl-2x4 .mg-upc-thumbs-container figure{width:50%;padding-bottom:50%}.mg-upc-thumbs-xxl-2x1 .mg-upc-thumbs-container{aspect-ratio:2}.mg-upc-thumbs-xxl-2x2 .mg-upc-thumbs-container{aspect-ratio:1}.mg-upc-thumbs-xxl-2x3 .mg-upc-thumbs-container{aspect-ratio:.66667}.mg-upc-thumbs-xxl-2x4 .mg-upc-thumbs-container{aspect-ratio:.5}.mg-upc-thumbs-xxl-3x1 .mg-upc-thumbs-container,.mg-upc-thumbs-xxl-3x2 .mg-upc-thumbs-container,.mg-upc-thumbs-xxl-3x3 .mg-upc-thumbs-container,.mg-upc-thumbs-xxl-3x4 .mg-upc-thumbs-container{background-size:66.6666666667%}.mg-upc-thumbs-xxl-3x1 .mg-upc-thumbs-container figure,.mg-upc-thumbs-xxl-3x2 .mg-upc-thumbs-container figure,.mg-upc-thumbs-xxl-3x3 .mg-upc-thumbs-container figure,.mg-upc-thumbs-xxl-3x4 .mg-upc-thumbs-container figure{width:33.33334%;padding-bottom:33.33334%}.mg-upc-thumbs-xxl-3x1 .mg-upc-thumbs-container{aspect-ratio:3}.mg-upc-thumbs-xxl-3x2 .mg-upc-thumbs-container{aspect-ratio:1.5}.mg-upc-thumbs-xxl-3x3 .mg-upc-thumbs-container{aspect-ratio:1}.mg-upc-thumbs-xxl-3x4 .mg-upc-thumbs-container{aspect-ratio:.75}.mg-upc-thumbs-xxl-4x1 .mg-upc-thumbs-container,.mg-upc-thumbs-xxl-4x2 .mg-upc-thumbs-container,.mg-upc-thumbs-xxl-4x3 .mg-upc-thumbs-container,.mg-upc-thumbs-xxl-4x4 .mg-upc-thumbs-container{background-size:50%}.mg-upc-thumbs-xxl-4x1 .mg-upc-thumbs-container figure,.mg-upc-thumbs-xxl-4x2 .mg-upc-thumbs-container figure,.mg-upc-thumbs-xxl-4x3 .mg-upc-thumbs-container figure,.mg-upc-thumbs-xxl-4x4 .mg-upc-thumbs-container figure{width:25%;padding-bottom:25%}.mg-upc-thumbs-xxl-4x1 .mg-upc-thumbs-container{aspect-ratio:4}.mg-upc-thumbs-xxl-4x2 .mg-upc-thumbs-container{aspect-ratio:2}.mg-upc-thumbs-xxl-4x3 .mg-upc-thumbs-container{aspect-ratio:1.33334}.mg-upc-thumbs-xxl-4x4 .mg-upc-thumbs-container{aspect-ratio:1}}@media(min-width: 0){.mg-upc-thumbs-xs-0 .mg-upc-thumbs-container,.mg-upc-thumbs-xs-0x0 .mg-upc-thumbs-container{display:none}}@media(min-width: 576px){.mg-upc-thumbs-sm-0 .mg-upc-thumbs-container,.mg-upc-thumbs-sm-0x0 .mg-upc-thumbs-container{display:none}}@media(min-width: 768px){.mg-upc-thumbs-md-0 .mg-upc-thumbs-container,.mg-upc-thumbs-md-0x0 .mg-upc-thumbs-container{display:none}}@media(min-width: 992px){.mg-upc-thumbs-lg-0 .mg-upc-thumbs-container,.mg-upc-thumbs-lg-0x0 .mg-upc-thumbs-container{display:none}}@media(min-width: 1200px){.mg-upc-thumbs-xl-0 .mg-upc-thumbs-container,.mg-upc-thumbs-xl-0x0 .mg-upc-thumbs-container{display:none}}@media(min-width: 1400px){.mg-upc-thumbs-xxl-0 .mg-upc-thumbs-container,.mg-upc-thumbs-xxl-0x0 .mg-upc-thumbs-container{display:none}}.mg-upc-icon+span{margin-left:.6em;vertical-align:middle}.mg-upc-icon{vertical-align:middle}.mg-upc-dg-content button{min-height:30px}.mg-upc-dg-msg{display:block;background:rgba(172,205,100,.75);padding:.7em;border:solid 1px #7dbf21;border-radius:2px;color:#314f00;margin:1em 0;white-space:pre-line}@media screen and (min-width: 700px){.mg-upc-dg-msg{top:-2em}}.mg-upc-dg-error{display:block;background:rgba(255,48,48,.75);padding:.7em;border:solid 1px #bf2121;border-radius:2px;color:#4f0001;margin:1em 0;position:sticky;top:-1em;z-index:5;white-space:pre-line}@media screen and (min-width: 700px){.mg-upc-dg-error{top:-2em}}.mg-upc-dg-alert-close{float:right;color:#fff;text-decoration:none;text-shadow:0 0 2px #fff}.mg-upc-dg-wait{position:absolute;top:0;left:0;right:0;bottom:0;background:hsla(0,0%,100%,.7);z-index:9;display:none}.mg-upc-dg-wait:before{content:"";position:absolute;top:50%;right:50%;margin:-1em 0 0 -1em;width:2em;height:2em;border-radius:50%;border-top:2px solid #5583f8;border-bottom:2px solid #345fc9;border-right:2px solid rgba(0,0,0,0);animation:loading-spinner .6s linear infinite}.mg-upc-dg-status-loading{max-height:90vh;min-height:50px;overflow:hidden}@keyframes loading-spinner{to{transform:rotate(360deg)}}.mg-upc-dg-dn{display:none !important}.mg-upc-dg-content ul{padding:0;margin:1em .3em}.mg-upc-dg-item-list,.mg-upc-dg-item-list-type{display:flex;padding:.6em;margin:.2em;justify-content:flex-start;align-content:stretch;align-items:center;border:solid 1px #e5e5e5;cursor:pointer}.mg-upc-dg-item-list:hover,.mg-upc-dg-item-list:focus,.mg-upc-dg-item-list-type:hover,.mg-upc-dg-item-list-type:focus{border:solid 1px #a9a9a9;background:#fafafa}.mg-upc-dg-item-list .mg-upc-dg-item-type,.mg-upc-dg-item-list-type .mg-upc-dg-item-type{width:30px;height:30px;font-size:24px;line-height:30px;text-align:center}.mg-upc-dg-item-list .mg-upc-dg-item-title,.mg-upc-dg-item-list-type .mg-upc-dg-item-title{display:flex;flex-direction:column;color:#333;flex-grow:2;text-align:start;padding:.1em 1em;word-break:break-word}.mg-upc-dg-item-list .mg-upc-dg-item-title>span:nth-child(2),.mg-upc-dg-item-list-type .mg-upc-dg-item-title>span:nth-child(2){opacity:.6}.mg-upc-dg-item-list .mg-upc-dg-item-count,.mg-upc-dg-item-list-type .mg-upc-dg-item-count{width:3em;text-align:center;opacity:.5}@media screen and (max-width: 400px){.mg-upc-dg-item-list,.mg-upc-dg-item-list-type{flex-direction:column}.mg-upc-dg-item-list .mg-upc-dg-item-title,.mg-upc-dg-item-list-type .mg-upc-dg-item-title{text-align:center}}.mg-upc-dg-item-type:before{content:""}.mg-upc-dg-item-type-numbered:before{content:""}.mg-upc-dg-item-type-vote:before{content:""}.mg-upc-dg-item-type-favorites:before{content:""}.mg-upc-dg-item-type-bookmarks:before{content:""}.mg-upc-dg-item-type-cart:before{content:""}.mg-upc-dg-item-type-none:before{content:""}.mg-upg-edit{float:right}ul.mg-upc-dg-list::before{content:"";display:block;clear:both}.mg-upc-dg-title{margin-top:0;word-break:break-word}.mg-upc-dg-title>a{vertical-align:middle;font-size:1em;text-decoration:none}.mg-upc-dg-top-action{margin:1em 0;display:flex;align-items:center;align-content:stretch;flex-direction:row-reverse}.mg-upc-dg-top-action button{margin:.5em;flex-grow:2}@media(max-width: 550px){.mg-upc-dg-top-action{align-items:stretch;flex-direction:column}}.mg-upc-dg-total-votes{text-align:right;display:block;margin-bottom:2em}.mg-list-edit label{color:#000;display:block;margin-top:.5em}.mg-list-edit input[type=text],.mg-list-edit textarea,.mg-list-edit select{width:100%;margin-bottom:.5em;display:block;min-height:2em}.mg-list-edit textarea{height:8em}.mg-list-edit button{margin:.7em 0;float:left}.mg-list-edit button:first-of-type{float:right}@media(max-width: 550px){.mg-list-edit button{width:100%}}.mg-upc-dg-list-desc-edit-count{display:block;text-align:right}.mg-upc-dg-item{display:flex;align-items:center;margin:2em 0}.mg-upc-dg-item>*{flex-shrink:0}.mg-upc-dg-item>.mg-upc-dg-item-data{flex-grow:1;flex-shrink:2}.mg-upc-dg-item button{margin:.3em}@media(max-width: 550px){.mg-upc-dg-item{flex-direction:column;text-align:center}.mg-upc-dg-item .mg-upc-dg-item-number{position:relative;top:.1em;height:0;font-size:3em;color:#fff;font-weight:700;text-shadow:0 0 4px #000}.mg-upc-dg-item .mg-upc-dg-item-image{height:7em;width:7em}.mg-upc-dg-item .mg-upc-dg-stock>*,.mg-upc-dg-item .mg-upc-dg-price{float:none;margin:auto;display:block}}.mg-upc-dg-item-adding{margin:.5em;opacity:.7;padding:.3em 1em;background:#eaeaea}.mg-upc-dg-item-handle{padding:.5em;white-space:nowrap;cursor:move}.mg-upc-dg-item-number{width:3em;text-align:center;flex-shrink:0}.mg-upc-dg-item-image{height:5em;width:5em;max-width:none;object-fit:cover;background:#d5d5d5}.mg-upc-dg-item-data{padding-right:1em;padding-left:1em}.mg-upc-dg-item-data button{font-size:small}.mg-upc-dg-item-data>p{margin:0}.mg-upc-dg-btn-item-desc{width:100%}.mg-upc-dg-btn-item-desc-cancel,.mg-upc-dg-btn-item-desc-save{width:46%;margin:2%;float:left}.mg-upc-dg-price{float:right;margin-left:1em}.mg-upc-dg-price del{opacity:.5}.mg-upc-dg-stock>*{margin:0;float:right}.mg-upc-dg-pagination-div{display:flex;align-content:stretch;justify-content:center;align-items:center}.mg-upc-dg-hidden{opacity:.2}.mg-upc-dg-pagination-div.mg-upc-dg-hidden{display:none}.mg-upc-dg-pagination-div::after{content:"";clear:both;display:block}.mg-upc-dg-pagination,.mg-upc-dg-pagination-current{width:39%;text-align:center;position:relative}.mg-upc-dg-pagination-current{width:10%}.mg-upc-dg-pagination .sortable-chosen{position:absolute;top:0;left:0;bottom:0;right:0;margin:0;overflow:hidden;background:#ececd0}.mg-upc-dg-pagination .sortable-chosen .mg-upc-dg-item-handle,.mg-upc-dg-pagination .sortable-chosen .mg-upc-dg-item-number,.mg-upc-dg-pagination .sortable-chosen button{display:none}@keyframes mg-upc-dg-loading-skeleton{100%{transform:translateX(100%)}}.mg-upc-dg-loading-skeleton{--base-color: #ebebeb;--highlight-color: #f5f5f5;--animation-duration: 1.5s;--animation-direction: normal;--pseudo-element-display: block;background-color:var(--base-color);width:100%;border-radius:.25rem;display:inline-flex;line-height:1;position:relative;overflow:hidden;z-index:1}.mg-upc-dg-loading-skeleton::after{content:" ";display:var(--pseudo-element-display);position:absolute;top:0;left:0;right:0;height:100%;background-repeat:no-repeat;background-image:linear-gradient(90deg, var(--base-color), var(--highlight-color), var(--base-color));transform:translateX(-100%);animation-name:mg-upc-dg-loading-skeleton;animation-direction:var(--animation-direction);animation-duration:var(--animation-duration);animation-timing-function:ease-in-out;animation-iteration-count:infinite}.mg-upc-dg-loading-skeleton,.mg-upc-dg-on-loading{display:none}.mg-upc-dg-status-loading .mg-upc-dg-list-desc,.mg-upc-dg-status-loading .mg-upc-dg-pagination-div,.mg-upc-dg-status-loading button{display:none}.mg-upc-dg-status-loading .mg-upc-dg-list-of-lists,.mg-upc-dg-status-loading .mg-upc-dg-list{visibility:hidden}.mg-upc-dg-status-loading .mg-upc-dg-on-loading{display:block}.mg-upc-dg-status-loading .mg-upc-dg-loading-skeleton{display:inline-flex}@keyframes share-animate{from{max-height:0;transform:scaleY(0);opacity:0}to{max-height:125px;transform:scaleY(1);opacity:1}}.mg-upc-dg-share-link{margin:1em 0;max-height:none;animation:share-animate .3s linear;text-align:center}.mg-upc-dg-share-link input{width:70%;font-size:16px;height:40px;border:none;background:#e2e2e2;color:#333;margin:0;display:inline-block;vertical-align:bottom;box-sizing:border-box}.mg-upc-dg-share-link button{width:30%;font-size:16px;padding:2px !important;height:40px !important;line-height:36px !important;border:none;display:inline-block;vertical-align:bottom;box-sizing:border-box}.mg-upc-dg-share-link .mg-upc-dg-share{display:inline-block;margin:2% 0}.mg-upc-zero-quantity{opacity:.3}.mg-upc-dg-quantity{width:4em;display:flex;flex-direction:column;text-align:center;margin:1em}.mg-upc-dg-quantity small{opacity:.5}.mg-upc-dg-quantity input{text-align:center}.mg-upc-err-required_logged_in .mg-list-new,.mg-upc-err-required_logged_in .mg-upc-dg-alert-close{display:none}.mg-upc-share-btn-img{height:64px;width:64px;display:inline-block;vertical-align:middle;background-size:100%}.mg-upc-share-link{display:block;text-align:right;margin:1em 0}.mg-upc-share-link::after{content:"";display:block;clear:both}.mg-upc-share{text-decoration:none}.mg-upc-dg-share:hover .mg-upc-share-btn-img,.mg-upc-dg-share:focus .mg-upc-share-btn-img,.mg-upc-share:hover .mg-upc-share-btn-img,.mg-upc-share:focus .mg-upc-share-btn-img{transform:scale(1.3);transition:transform .3s}.mg-upc-share-facebook{background-image:url("data:image/svg+xml,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 viewBox=%270 0 64 64%27 width=%2764%27 height=%2764%27%3E%3Crect width=%2764%27 height=%2764%27 rx=%270%27 ry=%270%27 fill=%27%233b5998%27%3E%3C/rect%3E%3Cpath d=%27M34.1,47V33.3h4.6l0.7-5.3h-5.3v-3.4c0-1.5,0.4-2.6,2.6-2.6l2.8,0v-4.8c-0.5-0.1-2.2-0.2-4.1-0.2 c-4.1,0-6.9,2.5-6.9,7V28H24v5.3h4.6V47H34.1z%27 fill=%27white%27%3E%3C/path%3E%3C/svg%3E")}.mg-upc-share-twitter{background-image:url("data:image/svg+xml,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 viewBox=%270 0 64 64%27 width=%2764%27 height=%2764%27%3E%3Crect width=%2764%27 height=%2764%27 rx=%270%27 ry=%270%27 fill=%27%230f1419%27%3E%3C/rect%3E%3Cpath d=%27M 41.116 18.375 h 4.962 l -10.8405 12.39 l 12.753 16.86 H 38.005 l -7.821 -10.2255 L 21.235 47.625 H 16.27 l 11.595 -13.2525 L 15.631 18.375 H 25.87 l 7.0695 9.3465 z m -1.7415 26.28 h 2.7495 L 24.376 21.189 H 21.4255 z%27 fill=%27white%27%3E%3C/path%3E%3C/svg%3E")}.mg-upc-share-whatsapp{background-image:url("data:image/svg+xml,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 viewBox=%270 0 64 64%27 width=%2764%27 height=%2764%27%3E%3Crect width=%2764%27 height=%2764%27 rx=%270%27 ry=%270%27 fill=%27%2325D366%27%3E%3C/rect%3E%3Cpath d=%27m42.32286,33.93287c-0.5178,-0.2589 -3.04726,-1.49644 -3.52105,-1.66732c-0.4712,-0.17346 -0.81554,-0.2589 -1.15987,0.2589c-0.34175,0.51004 -1.33075,1.66474 -1.63108,2.00648c-0.30032,0.33658 -0.60064,0.36247 -1.11327,0.12945c-0.5178,-0.2589 -2.17994,-0.80259 -4.14759,-2.56312c-1.53269,-1.37217 -2.56312,-3.05503 -2.86603,-3.57283c-0.30033,-0.5178 -0.03366,-0.80259 0.22524,-1.06149c0.23301,-0.23301 0.5178,-0.59547 0.7767,-0.90616c0.25372,-0.31068 0.33657,-0.5178 0.51262,-0.85437c0.17088,-0.36246 0.08544,-0.64725 -0.04402,-0.90615c-0.12945,-0.2589 -1.15987,-2.79613 -1.58964,-3.80584c-0.41424,-1.00971 -0.84142,-0.88027 -1.15987,-0.88027c-0.29773,-0.02588 -0.64208,-0.02588 -0.98382,-0.02588c-0.34693,0 -0.90616,0.12945 -1.37736,0.62136c-0.4712,0.5178 -1.80194,1.76053 -1.80194,4.27186c0,2.51134 1.84596,4.945 2.10227,5.30747c0.2589,0.33657 3.63497,5.51458 8.80262,7.74113c1.23237,0.5178 2.1903,0.82848 2.94111,1.08738c1.23237,0.38836 2.35599,0.33657 3.24402,0.20712c0.99159,-0.15534 3.04985,-1.24272 3.47963,-2.45956c0.44013,-1.21683 0.44013,-2.22654 0.31068,-2.45955c-0.12945,-0.23301 -0.46601,-0.36247 -0.98382,-0.59548m-9.40068,12.84407l-0.02589,0c-3.05503,0 -6.08417,-0.82849 -8.72495,-2.38189l-0.62136,-0.37023l-6.47252,1.68286l1.73463,-6.29129l-0.41424,-0.64725c-1.70875,-2.71846 -2.6149,-5.85116 -2.6149,-9.07706c0,-9.39809 7.68934,-17.06155 17.15993,-17.06155c4.58253,0 8.88029,1.78642 12.11655,5.02268c3.23625,3.21036 5.02267,7.50812 5.02267,12.06476c-0.0078,9.3981 -7.69712,17.06155 -17.14699,17.06155m14.58906,-31.58846c-3.93529,-3.80584 -9.1133,-5.95471 -14.62789,-5.95471c-11.36055,0 -20.60848,9.2065 -20.61625,20.52564c0,3.61684 0.94757,7.14565 2.75211,10.26282l-2.92557,10.63564l10.93337,-2.85309c3.0136,1.63108 6.4052,2.4958 9.85634,2.49839l0.01037,0c11.36574,0 20.61884,-9.2091 20.62403,-20.53082c0,-5.48093 -2.14111,-10.64081 -6.03239,-14.51915%27 fill=%27white%27%3E%3C/path%3E%3C/svg%3E")}.mg-upc-share-telegram{background-image:url("data:image/svg+xml,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 viewBox=%270 0 64 64%27 width=%2764%27 height=%2764%27%3E%3Crect width=%2764%27 height=%2764%27 rx=%270%27 ry=%270%27 fill=%27%2337aee2%27%3E%3C/rect%3E%3Cpath d=%27m45.90873,15.44335c-0.6901,-0.0281 -1.37668,0.14048 -1.96142,0.41265c-0.84989,0.32661 -8.63939,3.33986 -16.5237,6.39174c-3.9685,1.53296 -7.93349,3.06593 -10.98537,4.24067c-3.05012,1.1765 -5.34694,2.05098 -5.4681,2.09312c-0.80775,0.28096 -1.89996,0.63566 -2.82712,1.72788c-0.23354,0.27218 -0.46884,0.62161 -0.58825,1.10275c-0.11941,0.48114 -0.06673,1.09222 0.16682,1.5716c0.46533,0.96052 1.25376,1.35737 2.18443,1.71383c3.09051,0.99037 6.28638,1.93508 8.93263,2.8236c0.97632,3.44171 1.91401,6.89571 2.84116,10.34268c0.30554,0.69185 0.97105,0.94823 1.65764,0.95525l-0.00351,0.03512c0,0 0.53908,0.05268 1.06412,-0.07375c0.52679,-0.12292 1.18879,-0.42846 1.79109,-0.99212c0.662,-0.62161 2.45836,-2.38812 3.47683,-3.38552l7.6736,5.66477l0.06146,0.03512c0,0 0.84989,0.59703 2.09312,0.68132c0.62161,0.04214 1.4399,-0.07726 2.14229,-0.59176c0.70766,-0.51626 1.1765,-1.34683 1.396,-2.29506c0.65673,-2.86224 5.00979,-23.57745 5.75257,-27.00686l-0.02107,0.08077c0.51977,-1.93157 0.32837,-3.70159 -0.87096,-4.74991c-0.60054,-0.52152 -1.2924,-0.7498 -1.98425,-0.77965l0,0.00176zm-0.2072,3.29069c0.04741,0.0439 0.0439,0.0439 0.00351,0.04741c-0.01229,-0.00351 0.14048,0.2072 -0.15804,1.32576l-0.01229,0.04214l-0.00878,0.03863c-0.75858,3.50668 -5.15554,24.40802 -5.74203,26.96472c-0.08077,0.34417 -0.11414,0.31959 -0.09482,0.29852c-0.1756,-0.02634 -0.50045,-0.16506 -0.52679,-0.1756l-13.13468,-9.70175c4.4988,-4.33199 9.09945,-8.25307 13.744,-12.43229c0.8218,-0.41265 0.68483,-1.68573 -0.29852,-1.70681c-1.04305,0.24584 -1.92279,0.99564 -2.8798,1.47502c-5.49971,3.2626 -11.11882,6.13186 -16.55882,9.49279c-2.792,-0.97105 -5.57873,-1.77704 -8.15298,-2.57601c2.2336,-0.89555 4.00889,-1.55579 5.75608,-2.23009c3.05188,-1.1765 7.01687,-2.7042 10.98537,-4.24067c7.94051,-3.06944 15.92667,-6.16346 16.62028,-6.43037l0.05619,-0.02283l0.05268,-0.02283c0.19316,-0.0878 0.30378,-0.09658 0.35471,-0.10009c0,0 -0.01756,-0.05795 -0.00351,-0.04566l-0.00176,0zm-20.91715,22.0638l2.16687,1.60145c-0.93418,0.91311 -1.81743,1.77353 -2.45485,2.38812l0.28798,-3.98957%27 fill=%27white%27%3E%3C/path%3E%3C/svg%3E")}.mg-upc-share-line{background-image:url("data:image/svg+xml,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 viewBox=%270 0 64 64%27 width=%2764%27 height=%2764%27%3E%3Crect width=%2764%27 height=%2764%27 rx=%270%27 ry=%270%27 fill=%27%2300b800%27%3E%3C/rect%3E%3Cpath d=%27M52.62 30.138c0 3.693-1.432 7.019-4.42 10.296h.001c-4.326 4.979-14 11.044-16.201 11.972-2.2.927-1.876-.591-1.786-1.112l.294-1.765c.069-.527.142-1.343-.066-1.865-.232-.574-1.146-.872-1.817-1.016-9.909-1.31-17.245-8.238-17.245-16.51 0-9.226 9.251-16.733 20.62-16.733 11.37 0 20.62 7.507 20.62 16.733zM27.81 25.68h-1.446a.402.402 0 0 0-.402.401v8.985c0 .221.18.4.402.4h1.446a.401.401 0 0 0 .402-.4v-8.985a.402.402 0 0 0-.402-.401zm9.956 0H36.32a.402.402 0 0 0-.402.401v5.338L31.8 25.858a.39.39 0 0 0-.031-.04l-.002-.003-.024-.025-.008-.007a.313.313 0 0 0-.032-.026.255.255 0 0 1-.021-.014l-.012-.007-.021-.012-.013-.006-.023-.01-.013-.005-.024-.008-.014-.003-.023-.005-.017-.002-.021-.003-.021-.002h-1.46a.402.402 0 0 0-.402.401v8.985c0 .221.18.4.402.4h1.446a.401.401 0 0 0 .402-.4v-5.337l4.123 5.568c.028.04.063.072.101.099l.004.003a.236.236 0 0 0 .025.015l.012.006.019.01a.154.154 0 0 1 .019.008l.012.004.028.01.005.001a.442.442 0 0 0 .104.013h1.446a.4.4 0 0 0 .401-.4v-8.985a.402.402 0 0 0-.401-.401zm-13.442 7.537h-3.93v-7.136a.401.401 0 0 0-.401-.401h-1.447a.4.4 0 0 0-.401.401v8.984a.392.392 0 0 0 .123.29c.072.068.17.111.278.111h5.778a.4.4 0 0 0 .401-.401v-1.447a.401.401 0 0 0-.401-.401zm21.429-5.287c.222 0 .401-.18.401-.402v-1.446a.401.401 0 0 0-.401-.402h-5.778a.398.398 0 0 0-.279.113l-.005.004-.006.008a.397.397 0 0 0-.111.276v8.984c0 .108.043.206.112.278l.005.006a.401.401 0 0 0 .284.117h5.778a.4.4 0 0 0 .401-.401v-1.447a.401.401 0 0 0-.401-.401h-3.93v-1.519h3.93c.222 0 .401-.18.401-.402V29.85a.401.401 0 0 0-.401-.402h-3.93V27.93h3.93z%27 fill=%27white%27%3E%3C/path%3E%3C/svg%3E")}.mg-upc-share-email{background-image:url("data:image/svg+xml,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 viewBox=%270 0 64 64%27 width=%2764%27 height=%2764%27%3E%3Crect width=%2764%27 height=%2764%27 rx=%270%27 ry=%270%27 fill=%27%23b2b2b2%27%3E%3C/rect%3E%3Cpath d=%27M17,22v20h30V22H17z M41.1,25L32,32.1L22.9,25H41.1z M20,39V26.6l12,9.3l12-9.3V39H20z%27 fill=%27white%27%3E%3C/path%3E%3C/svg%3E")}.mg-upc-share-pinterest{background-image:url("data:image/svg+xml,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%2764%27 height=%2764%27%3E%3Crect width=%2764%27 height=%2764%27 rx=%270%27 ry=%270%27 fill=%27%23dc0000%27/%3E%3Cpath d=%27M32.9 12.4c-10.4 0-15.6 7.6-15.6 13.7 0 3.7 1.5 7.1 4.5 8.3.6.3 1 0 1.1-.5l.4-1.8c.2-.5.2-.8-.2-1.2-1-1-1.6-2.3-1.6-4.3 0-5.6 4.1-10.5 10.8-10.5 6 0 9.2 3.6 9.2 8.4 0 6.2-2.9 11.6-7 11.6-2.2 0-4-2-3.4-4.3.7-2.7 2-5.7 2-7.7 0-1.8-1-3.3-3-3.3-2.4 0-4.3 2.3-4.3 5.6 0 2 .7 3.4.7 3.4l-2.9 11.9c-.4 1.6-1 8.3-1 9.8.9.4 2.2-1.6 3.5-3.8.7-1.2 1.6-2.8 2-4.4l1.5-6c.7 1.5 3 2.7 5.3 2.7 7 0 11.8-6.4 11.8-15 0-6.5-5.5-12.6-13.8-12.6z%27 fill=%27%23fff%27 paint-order=%27fill markers stroke%27/%3E%3C/svg%3E")} -
user-post-collections/tags/0.9.0/javascript/mg-upc-client/dist/main.js
r2856778 r3190768 1 (()=>{"use strict";var t,e,n,i,o,s,a ={},r=[],l=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i;function c(t,e){for(var n in e)t[n]=e[n];return t}function u(t){var e=t.parentNode;e&&e.removeChild(t)}function d(e,n,i){var o,s,a,r={};for(a in n)"key"==a?o=n[a]:"ref"==a?s=n[a]:r[a]=n[a];if(arguments.length>2&&(r.children=arguments.length>3?t.call(arguments,2):i),"function"==typeof e&&null!=e.defaultProps)for(a in e.defaultProps)void 0===r[a]&&(r[a]=e.defaultProps[a]);return p(e,r,o,s,null)}function p(t,i,o,s,a){var r={type:t,props:i,key:o,ref:s,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,__h:null,constructor:void 0,__v:null==a?++n:a};return null==a&&null!=e.vnode&&e.vnode(r),r}function _(t){return t.children}function m(t,e){this.props=t,this.context=e}function f(t,e){if(null==e)return t.__?f(t.__,t.__.__k.indexOf(t)+1):null;for(var n;e<t.__k.length;e++)if(null!=(n=t.__k[e])&&null!=n.__e)return n.__e;return"function"==typeof t.type?f(t):null}function g(t){var e,n;if(null!=(t=t.__)&&null!=t.__c){for(t.__e=t.__c.base=null,e=0;e<t.__k.length;e++)if(null!=(n=t.__k[e])&&null!=n.__e){t.__e=t.__c.base=n.__e;break}return g(t)}}function h(t){(!t.__d&&(t.__d=!0)&&i.push(t)&&!v.__r++||o!==e.debounceRendering)&&((o=e.debounceRendering)||setTimeout)(v)}function v(){for(var t;v.__r=i.length;)t=i.sort((function(t,e){return t.__v.__b-e.__v.__b})),i=[],t.some((function(t){var e,n,i,o,s,a;t.__d&&(s=(o=(e=t).__v).__e,(a=e.__P)&&(n=[],(i=c({},o)).__v=o.__v+1,I(a,o,i,e.__n,void 0!==a.ownerSVGElement,null!=o.__h?[s]:null,n,null==s?f(o):s,o.__h),S(n,o),o.__e!=s&&g(o)))}))}function y(t,e,n,i,o,s,l,c,u,d){var m,g,h,v,y,w,k,N=i&&i.__k||r,C=N.length;for(n.__k=[],m=0;m<e.length;m++)if(null!=(v=n.__k[m]=null==(v=e[m])||"boolean"==typeof v?null:"string"==typeof v||"number"==typeof v||"bigint"==typeof v?p(null,v,null,null,v):Array.isArray(v)?p(_,{children:v},null,null,null):v.__b>0?p(v.type,v.props,v.key,null,v.__v):v)){if(v.__=n,v.__b=n.__b+1,null===(h=N[m])||h&&v.key==h.key&&v.type===h.type)N[m]=void 0;else for(g=0;g<C;g++){if((h=N[g])&&v.key==h.key&&v.type===h.type){N[g]=void 0;break}h=null}I(t,v,h=h||a,o,s,l,c,u,d),y=v.__e,(g=v.ref)&&h.ref!=g&&(k||(k=[]),h.ref&&k.push(h.ref,null,v),k.push(g,v.__c||y,v)),null!=y?(null==w&&(w=y),"function"==typeof v.type&&v.__k===h.__k?v.__d=u=b(v,u,t):u=P(t,v,h,N,y,u),"function"==typeof n.type&&(n.__d=u)):u&&h.__e==u&&u.parentNode!=t&&(u=f(h))}for(n.__e=w,m=C;m--;)null!=N[m]&&("function"==typeof n.type&&null!=N[m].__e&&N[m].__e==n.__d&&(n.__d=f(i,m+1)),E(N[m],N[m]));if(k)for(m=0;m<k.length;m++)A(k[m],k[++m],k[++m])}function b(t,e,n){for(var i,o=t.__k,s=0;o&&s<o.length;s++)(i=o[s])&&(i.__=t,e="function"==typeof i.type?b(i,e,n):P(n,i,i,o,i.__e,e));return e}function w(t,e){return e=e||[],null==t||"boolean"==typeof t||(Array.isArray(t)?t.some((function(t){w(t,e)})):e.push(t)),e}function P(t,e,n,i,o,s){var a,r,l;if(void 0!==e.__d)a=e.__d,e.__d=void 0;else if(null==n||o!=s||null==o.parentNode)t:if(null==s||s.parentNode!==t)t.appendChild(o),a=null;else{for(r=s,l=0;(r=r.nextSibling)&&l<i.length;l+=2)if(r==o)break t;t.insertBefore(o,s),a=s}return void 0!==a?a:o.nextSibling}function k(t,e,n){"-"===e[0]?t.setProperty(e,n):t[e]=null==n?"":"number"!=typeof n||l.test(e)?n:n+"px"}function N(t,e,n,i,o){var s;t:if("style"===e)if("string"==typeof n)t.style.cssText=n;else{if("string"==typeof i&&(t.style.cssText=i=""),i)for(e in i)n&&e in n||k(t.style,e,"");if(n)for(e in n)i&&n[e]===i[e]||k(t.style,e,n[e])}else if("o"===e[0]&&"n"===e[1])s=e!==(e=e.replace(/Capture$/,"")),e=e.toLowerCase()in t?e.toLowerCase().slice(2):e.slice(2),t.l||(t.l={}),t.l[e+s]=n,n?i||t.addEventListener(e,s?x:C,s):t.removeEventListener(e,s?x:C,s);else if("dangerouslySetInnerHTML"!==e){if(o)e=e.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if("href"!==e&&"list"!==e&&"form"!==e&&"tabIndex"!==e&&"download"!==e&&e in t)try{t[e]=null==n?"":n;break t}catch(t){}"function"==typeof n||(null!=n&&(!1!==n||"a"===e[0]&&"r"===e[1])?t.setAttribute(e,n):t.removeAttribute(e))}}function C(t){this.l[t.type+!1](e.event?e.event(t):t)}function x(t){this.l[t.type+!0](e.event?e.event(t):t)}function I(t,n,i,o,s,a,r,l,u){var d,p,f,g,h,v,b,w,P,k,N,C,x,I=n.type;if(void 0!==n.constructor)return null;null!=i.__h&&(u=i.__h,l=n.__e=i.__e,n.__h=null,a=[l]),(d=e.__b)&&d(n);try{t:if("function"==typeof I){if(w=n.props,P=(d=I.contextType)&&o[d.__c],k=d?P?P.props.value:d.__:o,i.__c?b=(p=n.__c=i.__c).__=p.__E:("prototype"in I&&I.prototype.render?n.__c=p=new I(w,k):(n.__c=p=new m(w,k),p.constructor=I,p.render=L),P&&P.sub(p),p.props=w,p.state||(p.state={}),p.context=k,p.__n=o,f=p.__d=!0,p.__h=[]),null==p.__s&&(p.__s=p.state),null!=I.getDerivedStateFromProps&&(p.__s==p.state&&(p.__s=c({},p.__s)),c(p.__s,I.getDerivedStateFromProps(w,p.__s))),g=p.props,h=p.state,f)null==I.getDerivedStateFromProps&&null!=p.componentWillMount&&p.componentWillMount(),null!=p.componentDidMount&&p.__h.push(p.componentDidMount);else{if(null==I.getDerivedStateFromProps&&w!==g&&null!=p.componentWillReceiveProps&&p.componentWillReceiveProps(w,k),!p.__e&&null!=p.shouldComponentUpdate&&!1===p.shouldComponentUpdate(w,p.__s,k)||n.__v===i.__v){p.props=w,p.state=p.__s,n.__v!==i.__v&&(p.__d=!1),p.__v=n,n.__e=i.__e,n.__k=i.__k,n.__k.forEach((function(t){t&&(t.__=n)})),p.__h.length&&r.push(p);break t}null!=p.componentWillUpdate&&p.componentWillUpdate(w,p.__s,k),null!=p.componentDidUpdate&&p.__h.push((function(){p.componentDidUpdate(g,h,v)}))}if(p.context=k,p.props=w,p.__v=n,p.__P=t,N=e.__r,C=0,"prototype"in I&&I.prototype.render)p.state=p.__s,p.__d=!1,N&&N(n),d=p.render(p.props,p.state,p.context);else do{p.__d=!1,N&&N(n),d=p.render(p.props,p.state,p.context),p.state=p.__s}while(p.__d&&++C<25);p.state=p.__s,null!=p.getChildContext&&(o=c(c({},o),p.getChildContext())),f||null==p.getSnapshotBeforeUpdate||(v=p.getSnapshotBeforeUpdate(g,h)),x=null!=d&&d.type===_&&null==d.key?d.props.children:d,y(t,Array.isArray(x)?x:[x],n,i,o,s,a,r,l,u),p.base=n.__e,n.__h=null,p.__h.length&&r.push(p),b&&(p.__E=p.__=null),p.__e=!1}else null==a&&n.__v===i.__v?(n.__k=i.__k,n.__e=i.__e):n.__e=T(i.__e,n,i,o,s,a,r,u);(d=e.diffed)&&d(n)}catch(t){n.__v=null,(u||null!=a)&&(n.__e=l,n.__h=!!u,a[a.indexOf(l)]=null),e.__e(t,n,i)}}function S(t,n){e.__c&&e.__c(n,t),t.some((function(n){try{t=n.__h,n.__h=[],t.some((function(t){t.call(n)}))}catch(t){e.__e(t,n.__v)}}))}function T(e,n,i,o,s,r,l,c){var d,p,_,m=i.props,g=n.props,h=n.type,v=0;if("svg"===h&&(s=!0),null!=r)for(;v<r.length;v++)if((d=r[v])&&"setAttribute"in d==!!h&&(h?d.localName===h:3===d.nodeType)){e=d,r[v]=null;break}if(null==e){if(null===h)return document.createTextNode(g);e=s?document.createElementNS("http://www.w3.org/2000/svg",h):document.createElement(h,g.is&&g),r=null,c=!1}if(null===h)m===g||c&&e.data===g||(e.data=g);else{if(r=r&&t.call(e.childNodes),p=(m=i.props||a).dangerouslySetInnerHTML,_=g.dangerouslySetInnerHTML,!c){if(null!=r)for(m={},v=0;v<e.attributes.length;v++)m[e.attributes[v].name]=e.attributes[v].value;(_||p)&&(_&&(p&&_.__html==p.__html||_.__html===e.innerHTML)||(e.innerHTML=_&&_.__html||""))}if(function(t,e,n,i,o){var s;for(s in n)"children"===s||"key"===s||s in e||N(t,s,null,n[s],i);for(s in e)o&&"function"!=typeof e[s]||"children"===s||"key"===s||"value"===s||"checked"===s||n[s]===e[s]||N(t,s,e[s],n[s],i)}(e,g,m,s,c),_)n.__k=[];else if(v=n.props.children,y(e,Array.isArray(v)?v:[v],n,i,o,s&&"foreignObject"!==h,r,l,r?r[0]:i.__k&&f(i,0),c),null!=r)for(v=r.length;v--;)null!=r[v]&&u(r[v]);c||("value"in g&&void 0!==(v=g.value)&&(v!==e.value||"progress"===h&&!v||"option"===h&&v!==m.value)&&N(e,"value",v,m.value,!1),"checked"in g&&void 0!==(v=g.checked)&&v!==e.checked&&N(e,"checked",v,m.checked,!1))}return e}function A(t,n,i){try{"function"==typeof t?t(n):t.current=n}catch(t){e.__e(t,i)}}function E(t,n,i){var o,s;if(e.unmount&&e.unmount(t),(o=t.ref)&&(o.current&&o.current!==t.__e||A(o,null,n)),null!=(o=t.__c)){if(o.componentWillUnmount)try{o.componentWillUnmount()}catch(t){e.__e(t,n)}o.base=o.__P=null}if(o=t.__k)for(s=0;s<o.length;s++)o[s]&&E(o[s],n,"function"!=typeof t.type);i||null==t.__e||u(t.__e),t.__e=t.__d=void 0}function L(t,e,n){return this.constructor(t,n)}function D(n,i,o){var s,r,l;e.__&&e.__(n,i),r=(s="function"==typeof o)?null:o&&o.__k||i.__k,l=[],I(i,n=(!s&&o||i).__k=d(_,null,[n]),r||a,a,void 0!==i.ownerSVGElement,!s&&o?[o]:r?null:i.firstChild?t.call(i.childNodes):null,l,!s&&o?o:r?r.__e:i.firstChild,s),S(l,n)}t=r.slice,e={__e:function(t,e,n,i){for(var o,s,a;e=e.__;)if((o=e.__c)&&!o.__)try{if((s=o.constructor)&&null!=s.getDerivedStateFromError&&(o.setState(s.getDerivedStateFromError(t)),a=o.__d),null!=o.componentDidCatch&&(o.componentDidCatch(t,i||{}),a=o.__d),a)return o.__E=o}catch(e){t=e}throw t}},n=0,m.prototype.setState=function(t,e){var n;n=null!=this.__s&&this.__s!==this.state?this.__s:this.__s=c({},this.state),"function"==typeof t&&(t=t(c({},n),this.props)),t&&c(n,t),null!=t&&this.__v&&(e&&this.__h.push(e),h(this))},m.prototype.forceUpdate=function(t){this.__v&&(this.__e=!0,t&&this.__h.push(t),h(this))},m.prototype.render=_,i=[],v.__r=0,s=0;var O,j,U,R,W=0,H=[],$=[],M=e.__b,Q=e.__r,F=e.diffed,B=e.__c,q=e.unmount;function V(t,n){e.__h&&e.__h(j,t,W||n),W=0;var i=j.__H||(j.__H={__:[],__h:[]});return t>=i.__.length&&i.__.push({__V:$}),i.__[t]}function X(t){return W=1,K(st,t)}function K(t,e,n){var i=V(O++,2);if(i.t=t,!i.__c&&(i.__=[n?n(e):st(void 0,e),function(t){var e=i.__N?i.__N[0]:i.__[0],n=i.t(e,t);e!==n&&(i.__N=[n,i.__[1]],i.__c.setState({}))}],i.__c=j,!i.__c.u)){i.__c.__H.u=!0;var o=i.__c.shouldComponentUpdate;i.__c.shouldComponentUpdate=function(t,e,n){if(!i.__c.__H)return!0;var s=i.__c.__H.__.filter((function(t){return t.__c}));return(s.every((function(t){return!t.__N}))||!s.every((function(t){if(!t.__N)return!0;var e=t.__[0];return t.__=t.__N,t.__N=void 0,e===t.__[0]})))&&(!o||o(t,e,n))}}return i.__N||i.__}function G(t,n){var i=V(O++,3);!e.__s&&ot(i.__H,n)&&(i.__=t,i.i=n,j.__H.__h.push(i))}function z(t){return W=5,J((function(){return{current:t}}),[])}function J(t,e){var n=V(O++,7);return ot(n.__H,e)?(n.__V=t(),n.i=e,n.__h=t,n.__V):n.__}function Y(t,e){return W=8,J((function(){return t}),e)}function Z(t){var e=j.context[t.__c],n=V(O++,9);return n.c=t,e?(null==n.__&&(n.__=!0,e.sub(j)),e.props.value):t.__}function tt(){for(var t;t=H.shift();)if(t.__P&&t.__H)try{t.__H.__h.forEach(nt),t.__H.__h.forEach(it),t.__H.__h=[]}catch(n){t.__H.__h=[],e.__e(n,t.__v)}}e.__b=function(t){j=null,M&&M(t)},e.__r=function(t){Q&&Q(t),O=0;var e=(j=t.__c).__H;e&&(U===j?(e.__h=[],j.__h=[],e.__.forEach((function(t){t.__N&&(t.__=t.__N),t.__V=$,t.__N=t.i=void 0}))):(e.__h.forEach(nt),e.__h.forEach(it),e.__h=[])),U=j},e.diffed=function(t){F&&F(t);var n=t.__c;n&&n.__H&&(n.__H.__h.length&&(1!==H.push(n)&&R===e.requestAnimationFrame||((R=e.requestAnimationFrame)||function(t){var e,n=function(){clearTimeout(i),et&&cancelAnimationFrame(e),setTimeout(t)},i=setTimeout(n,100);et&&(e=requestAnimationFrame(n))})(tt)),n.__H.__.forEach((function(t){t.i&&(t.__H=t.i),t.__V!==$&&(t.__=t.__V),t.i=void 0,t.__V=$}))),U=j=null},e.__c=function(t,n){n.some((function(t){try{t.__h.forEach(nt),t.__h=t.__h.filter((function(t){return!t.__||it(t)}))}catch(i){n.some((function(t){t.__h&&(t.__h=[])})),n=[],e.__e(i,t.__v)}})),B&&B(t,n)},e.unmount=function(t){q&&q(t);var n,i=t.__c;i&&i.__H&&(i.__H.__.forEach((function(t){try{nt(t)}catch(t){n=t}})),n&&e.__e(n,i.__v))};var et="function"==typeof requestAnimationFrame;function nt(t){var e=j,n=t.__c;"function"==typeof n&&(t.__c=void 0,n()),j=e}function it(t){var e=j;t.__c=t.__(),j=e}function ot(t,e){return!t||t.length!==e.length||e.some((function(e,n){return e!==t[n]}))}function st(t,e){return"function"==typeof e?e(t):e}const at=function(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return MgUpcTexts&&MgUpcTexts[t]?e?e.reduce((function(t,e){return t.replace(/%s/,e)}),MgUpcTexts[t]):MgUpcTexts[t]:t},rt="ui/reset",lt="ui/error",ct="ui/message",ut="ui/editing",dt="listOfLists/set",pt="listOfLists/remove",_t="listOfLists/create",mt="listOfList/addingPost",ft="listOfList/setPage",gt="listOfList/setTotalPages",ht="list/set",vt="list/update",yt="list/setPage",bt="list/setTotalPages",wt="list/setItems",Pt="list/removeItem",kt="list/addItem",Nt="list/updateItem",Ct="list/moveItem",xt="list/cart",It=async function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"mg-upc/v1/lists";if(void 0===Dt().nonce){const t=new FormData;t.append("action","mg_upc_user");const e={method:"POST",credentials:"same-origin",referrerPolicy:"no-referrer",body:t},n=await fetch(Dt().ajaxUrl,e),i=await n.json();i.nonce&&(Dt().nonce=i.nonce),i.user_id&&(Dt().user_id=i.user_id)}const o={method:t,credentials:"same-origin",headers:{"Content-Type":"application/json","X-WP-Nonce":Dt().nonce},referrerPolicy:"no-referrer"};"GET"!==t&&n&&(o.body=JSON.stringify(n));const s=await fetch(Dt().root+i+e,o);s.headers.get("x-wp-nonce")&&(Dt().nonce=s.headers.get("x-wp-nonce"));const a=await s.json();return{data:a,headers:s.headers,status:s.status}};function St(t){const e=Object.entries(t).filter((t=>{let[,e]=t;return null!=e})).map((t=>{let[e,n]=t;return`${encodeURIComponent(e)}=${encodeURIComponent(String(n))}`})),n=-1!==Dt().root.indexOf("?")?"&":"?";return e.length>0?`${n}${e.join("&")}`:""}class Tt extends Error{constructor(t,e){var n;super(t),this.name="MgApiError",this.code=null==e||null===(n=e.data)||void 0===n?void 0:n.code,this.response=e}}function At(t){var e,n;let i=null==t||null===(e=t.data)||void 0===e||null===(n=e.data)||void 0===n?void 0:n.status;var o;if(!i&&t.status&&(i=t.status),400===i||401===i||403===i||404===i||409===i||500===i)throw new Tt(null==t||null===(o=t.data)||void 0===o?void 0:o.message,t)}let Et={my:function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return It("GET","/My"+St(t),{}).then((function(t){return At(t),t}))},discover:function(t){return It("GET","/"+St(t),{}).then((function(t){return At(t),t}))},get:function(t){return It("GET","/"+t,{}).then((function(t){return At(t),t}))},cart:function(t){return It("POST","/cart",{list:t},"mg-upc/v1").then((function(t){return At(t),t}))},items:function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return It("GET","/"+t+"/items"+St(e),{}).then((function(t){return At(t),t}))},delete:function(t){return It("DELETE","/"+t,{}).then((function(t){return At(t),t}))},create:function(t){return It("POST","",t).then((function(t){return At(t),t}))},update:function(t){let e=t.id;return delete t.id,It("PATCH","/"+e,t).then((function(t){return At(t),t}))},add:function(t,e){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return"object"!=typeof e&&(e={post_id:e}),It("POST","/"+t+"/items"+St(n),e).then((function(t){return At(t),t}))},quit:function(t,e){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return It("DELETE","/"+t+"/items/"+e+St(n),{}).then((function(t){return At(t),t}))},updateItem:function(t,e,n){return It("PATCH","/"+t+"/items/"+e,n).then((function(t){return At(t),t}))},vote:function(t,e){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return It("POST","/"+t+"/items/"+e+"/vote",n).then((function(t){return At(t),t}))},move:function(t,e,n){return It("PATCH","/"+t+"/items/"+e,{position:n}).then((function(t){return At(t),t}))}};const Lt=Et;function Dt(){return MgUserPostCollections}function Ot(){var t;return null===(t=Dt())||void 0===t?void 0:t.sortable}function jt(t){var e;const n=null===(e=Dt())||void 0===e?void 0:e.types;return!(!n||!n[t])&&n[t]}function Ut(t){var e;const n=null===(e=Dt())||void 0===e?void 0:e.statuses;return!(!n||!n[t])&&n[t]}function Rt(t,e){return!!t.type&&Ht(t.type,e)}function Wt(t){var e;const n=[],i=null===(e=Dt())||void 0===e?void 0:e.types;for(const e in i)i.hasOwnProperty(e)&&(Ht(e,"always_exists")||(null!=t&&t.type?i[e].available_post_types.includes(t.type)&&n.push(i[e]):n.push(i[e])));return n}function Ht(t,e){const n=jt(t);return!(!n||!n.supports)&&n.supports.includes(e)}const $t="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVQYV2NgYAAAAAMAAWgmWQ0AAAAASUVORK5CYII=";function Mt(t){return JSON.parse(JSON.stringify(t))}function Qt(t){return"string"!=typeof t?"":t.replace(/([^>\r\n]?)(\r\n|\n\r|\r|\n)/g,"$1<br>$2")}function Ft(t){return Lt.cart(t).then((t=>(jQuery&&t.data.fragments&&t.data.cart_hash&&jQuery(document.body).trigger("added_to_cart",[t.data.fragments,t.data.cart_hash]),t.data)))}function Bt(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"error";if(!jQuery)return!1;const n=jQuery("<div>").addClass("mg-upc-alert mg-upc-alert-"+e);n.append(jQuery("<p>").html(t));const i=jQuery('<a class="mg-upc-alert-close" href="#"><span class="mg-upc-icon upc-font-close"></span></a>').on("click",(function(){return n.remove(),!1}));return n.append(i),n}function qt(t,e){const{type:n,payload:i}=e;let o=!1;const s=t=>(o=a({status:"failed"}),t.error&&(o.error=t.error.message?t.error.message:"",o.errorCode=t.error.code?t.error.code:""),o),a=function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(o||(o=Mt(t)),e)for(const t in e)e.hasOwnProperty(t)&&(o[t]=e[t]);return o};let r=function(t,e){const{type:n,payload:i}=e;let o,s;const a=function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(s||(s=!1===t?{}:Mt(t)),e)for(const t in e)s[t]=e[t];return s};switch(n){case ht:return!0===i?{ID:-1,title:"",content:"",status:"",type:""}:i;case vt:return i.items=Mt(t.items),i;case _t:return i;case wt:return a({items:i});case"list/addItem/failed":case kt:return null!=i&&i.list?a(i.list):t;case Nt:const e=!!i.item&&i.item;return o=a().items.map((t=>t.post_id===i.post_id?e||Object.assign({},t,i):{...t})),a({items:o});case Pt:if(!t.items||1===t.items.length||!1===i)return t;if(s=a(),o=s.items.filter((t=>t.post_id!==i)),Ht(t.type,"sortable")){const e=parseInt(t.items[0].position,10);o.forEach(((t,n)=>{o[n].position=e+n}))}if(Ht(t.type,"vote")){const e=t.items.find((t=>t.post_id==i));e&&(s.vote_counter=s.vote_counter-e.votes)}return{...s,items:o};case Ct:const n=parseInt(t.items[0].position,10);o=a().items.slice();const r=a().items[i.oldIndex];return o.splice(i.oldIndex,1),o.splice(i.newIndex,0,r),isNaN(n)?(alert("positions error!"),t):(o.forEach(((t,e)=>{o[e].position=n+e})),a({items:o}));default:return t}}(t.list,e),l=function(t,e){const{type:n,payload:i}=e;switch(n){case dt:return i;case kt:case ht:return!1;case pt:return!1===i?t:Mt(t.filter((t=>t.ID!=i)));default:return t}}(t.listOfList,e);switch(t.list===r&&l===t.listOfList||(o=a({listOfList:l,list:r}),t.addingPost||(o.title=o.list?o.list.title:Gt.title)),n){case"ui/mode":return a({mode:i});case rt:return{...Gt,mode:t.mode};case lt:return a(!1===i?{error:!1,errorCode:!1}:{error:i});case ct:return a(!1===i?{message:!1,errorCode:!1}:{message:i});case xt:const n=a();return i.msg&&(n.message=i.msg),i.err&&(n.error=i.err),n;case ut:return a({editing:i});case mt:return o=a(),o.addingPost=i,i&&(o.title=at("Add to...")),o;case _t:o=a(),o.title=i.title?i.title:Gt.title,o.listTotalPages=1,o.listPage=1,o.addingPost=!1;break;case kt:if(o=a(),null!=i&&i.list){const t=i.list;o.title=t.title?t.title:Gt.title;const e=null==t?void 0:t.items_page;e&&(o.listTotalPages=e["X-WP-TotalPages"]?e["X-WP-TotalPages"]:1,o.listPage=e["X-WP-Page"]?e["X-WP-Page"]:1)}i.message&&(o.error=i.message,o.status="failed"),o.addingPost=!1;break;case ft:return a({page:i});case gt:return a({totalPages:i});case yt:return a({listPage:i});case bt:return a({listTotalPages:i});case"list/set/loading":return o=a(),o.status="loading",o.listOfList=!1,"object"==typeof i?(o.list=i,i.title&&(o.title=i.title)):o.list={ID:i},o;case"list/removeItem/loading":return o=a({status:"loading"}),"object"==typeof i&&i.list_id&&(o.list={ID:i.list_id}),o;case"listOfLists/set/loading":case"list/setItems/loading":case"list/updateItem/loading":case"list/addItem/loading":case"list/moveItemNext/loading":case"list/moveItemPrev/loading":case"list/update/loading":case _t+"/loading":case"list/cart/loading":return a({status:"loading"});case"list/addItem/succeeded":return o=a(),o.addingPost=!1,o.status="succeeded",o.error=!1,o.errorCode=!1,o.title=o.list?o.list.title:Gt.title,o;case"list/cart/succeeded":return a({status:"succeeded",errorCode:!1});case"list/set/succeeded":if(!1===t.list)break;return a({status:"succeeded",error:!1,errorCode:!1});case"listOfLists/set/succeeded":case"list/setItems/succeeded":case"list/updateItem/succeeded":case"list/removeItem/succeeded":case"list/moveItem/succeeded":case"list/moveItemNext/succeeded":case"list/moveItemPrev/succeeded":case"list/update/succeeded":case _t+"/succeeded":return a({status:"succeeded",error:!1,errorCode:!1});case _t+"/failed":return o=a({status:"failed"}),e.error&&e.error.message&&(o.error=e.error.message),o;case"list/addItem/failed":if(o=a(),o.addingPost=!1,o.title=o.list?o.list.title:Gt.title,null!=i&&i.list){const t=i.list;o.title=t.title?t.title:Gt.title;const e=null==t?void 0:t.items_page;e&&(o.listTotalPages=e["X-WP-TotalPages"]?e["X-WP-TotalPages"]:1,o.listPage=e["X-WP-Page"]?e["X-WP-Page"]:1)}return i.message&&(o.error=i.message,o.status="failed"),s(e);case"listOfLists/set/failed":case"list/setItems/failed":case"list/updateItem/failed":case"list/removeItem/failed":case"list/moveItem/failed":case"list/moveItemNext/failed":case"list/moveItemPrev/failed":case"list/update/failed":case"list/set/failed":case"list/cart/failed":return s(e)}return!1!==o?o:t}const Vt=(t,e)=>function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;for(var i=arguments.length,o=new Array(i>1?i-1:0),s=1;s<i;s++)o[s-1]=arguments[s];return{asyncThunk:!0,payload:e,type:t,arg:n,extra:o}};class Xt extends Error{constructor(t,e){super(t),this.name="MgUpcRejectWithValue",this.value=e}}const Kt=(t,e)=>n=>{let i;if((o=n)&&"object"==typeof o&&!0===o.asyncThunk){let o={dispatch:Kt(t,e),getState:e,extra:n.extra,rejectWithValue:t=>new Xt(n.type+": rejectWithValue",t)};t({type:n.type+"/loading",payload:n.arg}),i=n.payload(n.arg,o)}else{if(!(t=>!!t&&("object"==typeof t||"function"==typeof t)&&"function"==typeof t.then)(n.payload))return void t(n);t({type:n.type+"/loading"}),i=n.payload}var o;i.then((e=>{e instanceof Xt?t({type:n.type+"/failed",payload:e.value}):(t({type:n.type,payload:e}),t({type:n.type+"/succeeded"}))})).catch((e=>{t(e instanceof Xt?{type:n.type+"/failed",payload:e.value}:{type:n.type+"/failed",error:e})}))},Gt={list:!1,listOfList:!1,addingPost:null,status:"idle",error:null,message:null,errorCode:null,editing:!1,title:at("My Lists"),actualAction:"init",page:1,totalPages:1,listPage:1,listTotalPages:1,mode:"my"},zt=function(t,e){var n={__c:e="__cC"+s++,__:t,Consumer:function(t,e){return t.children(e)},Provider:function(t){var n,i;return this.getChildContext||(n=[],(i={})[e]=this,this.getChildContext=function(){return i},this.shouldComponentUpdate=function(t){this.props.value!==t.value&&n.some(h)},this.sub=function(t){n.push(t);var e=t.componentWillUnmount;t.componentWillUnmount=function(){n.splice(n.indexOf(t),1),e&&e.call(t)}}),t.children}};return n.Provider.__=n.Consumer.contextType=n}({});function Jt(t){return new Date(t).toLocaleDateString()}const Yt=function(t){const{state:e,dispatch:n}=Z(zt);return d("li",{className:"mg-upc-dg-item-list",onClick:t.onClick,onKeyPress:e=>{13===e.keyCode&&t.onClick(e)},tabIndex:"0"},d("i",{className:"mg-upc-icon mg-upc-dg-item-type mg-upc-dg-item-type-"+t.list.type}),d("div",{className:"mg-upc-dg-item-title"},d("span",null,t.list.title),"my"!==e.mode&&d(_,null,d("span",null,d("a",{href:"#",onClick:function(e){!function(t){t.stopImmediatePropagation&&t.stopImmediatePropagation(),t.stopPropagation&&t.stopPropagation(),t.preventDefault()}(e),function(t,e){const n=new URLSearchParams(document.location.hash.substring(1));n.set("author",e);let i=n.toString();""!==i&&(i="#"+i),window.location.hash=i}(0,t.list.author)}},t.list.user_login),d("span",{className:"mg-upc-list-dates"},d("i",null," ",d("b",null,"Created:")," ",Jt(t.list.created)),d("i",null," ",d("b",null,"Modified:")," ",Jt(t.list.modified)))))),d("span",{className:"mg-upc-dg-item-count"},t.list.count),d("span",{className:"mg-upc-dg-item-actions"},t.onRemove&&d("button",{"aria-label":at("Remove List"),onClick:e=>{e.stopPropagation(),t.onRemove(t.list)}},d("span",{className:"mg-upc-icon upc-font-trash"}))))};class Zt extends m{render(){const t=[];for(let e=0;e<this.props.count;e++){let n=this.props.styles?this.props.styles:{};null!=this.props.width&&(n.width=this.props.width),null!=this.props.height&&(n.height=this.props.height),null!==this.props.width&&null!==this.props.height&&this.props.circle&&(n.borderRadius="50%"),t.push(d("span",{key:e,className:"mg-upc-dg-loading-skeleton",style:n},""))}const e=this.props.wrapper;return d("span",null,e?t.map(((t,n)=>d(e,{key:n},t,""))):t)}}var te,ee,ne;ne={count:1,duration:1.2,width:null,wrapper:null,height:null,circle:!1},(ee="defaultProps")in(te=Zt)?Object.defineProperty(te,ee,{value:ne,enumerable:!0,configurable:!0,writable:!0}):te[ee]=ne;const ie=function(t){return d("div",{className:"mg-upc-dg-pagination-div"},d("button",{className:1===t.page?"mg-upc-dg-hidden mg-upc-dg-pagination":"mg-upc-dg-pagination",ref:t.prevRef,disabled:1===t.page,"aria-label":at("Previous page"),title:at("Previous page"),onClick:t.onPreview},d("span",{className:"mg-upc-icon upc-font-arrow_left"})),d("span",{className:t.totalPages>1?"mg-upc-dg-pagination-current":"mg-upc-dg-hidden mg-upc-dg-pagination-current"},t.page),d("button",{className:t.page>=t.totalPages?"mg-upc-dg-hidden mg-upc-dg-pagination":"mg-upc-dg-pagination",ref:t.nextRef,disabled:t.page>=t.totalPages,"aria-label":at("Next page"),title:at("Next page"),onClick:t.onNext},d("span",{className:"mg-upc-icon upc-font-arrow_right"})))},oe=()=>({type:rt,payload:null}),se=t=>({type:mt,payload:t}),ae=t=>({type:ut,payload:t}),re=Vt(xt,(async function(t,e){return await Ft(t)})),le=Vt(dt,(async function(t,e){var n;const i=null===(n=t)||void 0===n?void 0:n.addingPost;return null===t&&(t={}),t.addingPost?t.adding=t.addingPost:(t.adding="",delete t.adding),await Lt.my(t).then((t=>ce(t,e,i)))}));function ce(t,e,n){if(t.headers.get("x-wp-page")&&(e.dispatch(de(parseInt(t.headers.get("x-wp-page"),10))),e.dispatch(pe(parseInt(t.headers.get("X-WP-TotalPages"),10)))),n&&t.headers.get("X-WP-Post-Type")){const i={post_id:n},o={"X-WP-Post-Type":"type","X-WP-Post-Title":"title","X-WP-Post-Image":"image"};for(const e in o){const n=t.headers.get(e);n&&(i[o[e]]=decodeURIComponent(n))}e.dispatch(se(i))}return t.data}Vt(dt,(async function(t,e){return null===t&&(t={}),await Lt.discover(t).then((t=>ce(t,e,!1)))}));const ue=Vt(pt,(async function(t,e){return await Lt.delete(t).then((n=>{if(1===e.getState().listOfList.length){const n=e.getState().page,i=e.getState().totalPages;if(n<i)e.dispatch(le({page:n}));else{if(!(n>1&&n===i))return t;e.dispatch(le({page:n-1}))}return!1}return t}))})),de=t=>({type:ft,payload:t}),pe=t=>({type:gt,payload:t}),_e=t=>({type:yt,payload:t}),me=t=>({type:bt,payload:t}),fe=Vt(ht,(async function(t,e){return!1===t||!0===t?t:await Lt.get("object"==typeof t?t.ID:t).then((t=>(Ce(t,e.dispatch),t.data)))})),ge=Vt(vt,(async function(t,e){return await Lt.update(t).then((t=>(e.dispatch(ae(!1)),Ce(t,e.dispatch),t.data)))})),he=Vt(_t,(async function(t,e){return null===t&&(t={}),t.adding&&t.adding!==e.getState().addingPost&&e.dispatch(se({id:t.addingPost})),await Lt.create(t).then((t=>(e.dispatch(ae(!1)),Ce(t,e.dispatch),t.data)))})),ve=Vt(wt,(async function(t,e){return await Lt.items(e.getState().list.ID,t).then((t=>(Ce(t,e.dispatch),t.data)))})),ye=Vt(Pt,(async function(t,e){const n=e.getState();var i=e.extra.length>0?e.extra[0]:n.list.ID;const o=e.extra.length>1?e.extra[1]:"view";return await Lt.quit(i,t,{context:o}).then((s=>{if(s.data&&s.data.list_id,n.list&&n.list.ID){if(1===n.list.items.length){if(e.dispatch(ve({page})),n.list&&"view"===o){const t=n.listPage,i=n.listTotalPages;t<i?e.dispatch(ve({page:t})):t===i&&e.dispatch(ve({page:Math.max(1,t-1)}))}return!1}}else e.dispatch(fe({ID:i}));return t}))})),be=Vt(kt,(async function(t,e){let n=e.extra[0],i=!1;try{await Lt.add(t,n,{context:e.extra.length>1?e.extra[1]:"view"}).then((t=>{i=t.data}))}catch(t){var o;const n=null==t||null===(o=t.response)||void 0===o?void 0:o.data;i=e.rejectWithValue(n)}return i})),we=Vt(Nt,(async function(t,e){const n=e.extra[0];return await Lt.updateItem(e.getState().list.ID,t,n).then((e=>{var i;return{...n,post_id:t,item:null==e||null===(i=e.data)||void 0===i?void 0:i.item}}))})),Pe=Vt(Ct,(async function(t,e){const n=e.extra[0],i=e.extra[1],o=n.items[t],s=o.position-t+i;return await Lt.move(n.ID,o.post_id,s).then((e=>({oldIndex:t,newIndex:i})))})),ke=Vt("list/moveItemNext",(async function(t,e){const n=e.getState().list,i=parseInt(n.items[n.items.length-1].position,10);if(isNaN(i))throw alert("positions error!"),"positions error!";const o=n.items[t];return await Lt.move(n.ID,o.post_id,i+1),await e.dispatch(ve({page:e.getState().listPage})),t})),Ne=Vt("list/moveItemPrev",(async function(t,e){const n=e.getState().list,i=parseInt(n.items[0].position,10);if(isNaN(i))throw alert("positions error!"),"positions error!";const o=n.items[t];return await Lt.move(n.ID,o.post_id,i-1),await e.dispatch(ve({page:e.getState().listPage})),t}));function Ce(t,e){!t.data.items_page&&t.headers.get("x-wp-page")?(e(_e(parseInt(t.headers.get("x-wp-page"),10))),e(me(parseInt(t.headers.get("X-WP-TotalPages"),10)))):t.data.items_page&&(e(_e(parseInt(t.data.items_page["X-WP-Page"],10))),e(me(parseInt(t.data.items_page["X-WP-TotalPages"],10))))}const xe=function(t){const{state:e,dispatch:n}=Z(zt);return d(_,null,d("ul",{className:"mg-upc-dg-list-of-lists-fake mg-upc-dg-on-loading"},[0,1,2].map((t=>d("li",{className:"mg-upc-dg-item-list"},d("div",null,d(Zt,{width:"1.5em",height:"1.5em"})),d("div",{className:"mg-upc-dg-item-title"},d(Zt,null)),d("div",{className:"mg-upc-dg-item-count"},d(Zt,null)))))),d("ul",{className:"mg-upc-dg-list-of-lists"},t.lists&&t.lists.map((e=>d(Yt,{list:e,onClick:()=>t.onSelect(e),onRemove:t.onRemove,key:e.ID})))),e.totalPages>1&&d(ie,{totalPages:e.totalPages,page:e.page,onPreview:t.loadPreview,onNext:t.loadNext}))},Ie=function(t){var e,n,i;const[o,s]=X(!1),[a,r]=X(""),l=z({});G((()=>{r(t.item.description)}),[t.item]),G((()=>{o&&l.current.focus()}),[o]);const c=()=>"string"==typeof a&&a.length>0;return d(_,null,d("span",null,d("br",null),"Adding item:"),d("div",{className:"mg-upc-dg-item mg-upc-dg-item-adding","data-post_id":t.item.post_id},d("span",{className:"mg-upc-icon upc-font-add"}),d("span",null," "),d("img",{className:"mg-upc-dg-item-image",src:t.item.image?t.item.image:$t}),d("div",{className:"mg-upc-dg-item-data"},d("a",{href:null===(e=t.item)||void 0===e?void 0:e.link},null===(n=t.item)||void 0===n?void 0:n.title),!o&&d("p",null,null===(i=t.item)||void 0===i?void 0:i.description),!o&&d("button",{onClick:()=>{s(!0)}},c()&&d("span",null,at("Edit Comment")),!c()&&d("span",null,at("Add Comment"))),d("input",{ref:l,className:o?"mg-upc-dg-btn-item-desc":"mg-upc-dg-dn",type:"text",value:a,onChange:function(t){r(t.target.value)},maxLength:400}),o&&d("button",{className:"mg-upc-dg-btn-item-desc-cancel",onClick:()=>{s(!1),r(t.item.description)}},d("span",{className:"mg-upc-icon upc-font-close"}),d("span",null,at("Cancel"))),o&&d("button",{className:"mg-upc-dg-btn-item-desc-save",onClick:()=>{s(!1),t.onSaveItemDescription(a)}},d("span",{className:"mg-upc-icon upc-font-save"}),d("span",null,at("Save"))))),d("span",null,at("Select where the item will be added:")))};function Se(){return Se=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},Se.apply(this,arguments)}function Te(t,e){for(var n in t)if("__source"!==n&&!(n in e))return!0;for(var i in e)if("__source"!==i&&t[i]!==e[i])return!0;return!1}function Ae(t){this.props=t}(Ae.prototype=new m).isPureReactComponent=!0,Ae.prototype.shouldComponentUpdate=function(t,e){return Te(this.props,t)||Te(this.state,e)};var Ee=e.__b;e.__b=function(t){t.type&&t.type.__f&&t.ref&&(t.props.ref=t.ref,t.ref=null),Ee&&Ee(t)},"undefined"!=typeof Symbol&&Symbol.for&&Symbol.for("react.forward_ref");var Le=e.__e;e.__e=function(t,e,n,i){if(t.then)for(var o,s=e;s=s.__;)if((o=s.__c)&&o.__c)return null==e.__e&&(e.__e=n.__e,e.__k=n.__k),o.__c(t,e);Le(t,e,n,i)};var De=e.unmount;function Oe(){this.__u=0,this.t=null,this.__b=null}function je(t){var e=t.__.__c;return e&&e.__a&&e.__a(t)}function Ue(){this.u=null,this.o=null}e.unmount=function(t){var e=t.__c;e&&e.__R&&e.__R(),e&&!0===t.__h&&(t.type=null),De&&De(t)},(Oe.prototype=new m).__c=function(t,e){var n=e.__c,i=this;null==i.t&&(i.t=[]),i.t.push(n);var o=je(i.__v),s=!1,a=function(){s||(s=!0,n.__R=null,o?o(r):r())};n.__R=a;var r=function(){if(!--i.__u){if(i.state.__a){var t=i.state.__a;i.__v.__k[0]=function t(e,n,i){return e&&(e.__v=null,e.__k=e.__k&&e.__k.map((function(e){return t(e,n,i)})),e.__c&&e.__c.__P===n&&(e.__e&&i.insertBefore(e.__e,e.__d),e.__c.__e=!0,e.__c.__P=i)),e}(t,t.__c.__P,t.__c.__O)}var e;for(i.setState({__a:i.__b=null});e=i.t.pop();)e.forceUpdate()}},l=!0===e.__h;i.__u++||l||i.setState({__a:i.__b=i.__v.__k[0]}),t.then(a,a)},Oe.prototype.componentWillUnmount=function(){this.t=[]},Oe.prototype.render=function(t,e){if(this.__b){if(this.__v.__k){var n=document.createElement("div"),i=this.__v.__k[0].__c;this.__v.__k[0]=function t(e,n,i){return e&&(e.__c&&e.__c.__H&&(e.__c.__H.__.forEach((function(t){"function"==typeof t.__c&&t.__c()})),e.__c.__H=null),null!=(e=function(t,e){for(var n in e)t[n]=e[n];return t}({},e)).__c&&(e.__c.__P===i&&(e.__c.__P=n),e.__c=null),e.__k=e.__k&&e.__k.map((function(e){return t(e,n,i)}))),e}(this.__b,n,i.__O=i.__P)}this.__b=null}var o=e.__a&&d(_,null,t.fallback);return o&&(o.__h=null),[d(_,null,e.__a?null:t.children),o]};var Re=function(t,e,n){if(++n[1]===n[0]&&t.o.delete(e),t.props.revealOrder&&("t"!==t.props.revealOrder[0]||!t.o.size))for(n=t.u;n;){for(;n.length>3;)n.pop()();if(n[1]<n[0])break;t.u=n=n[2]}};function We(t){return this.getChildContext=function(){return t.context},t.children}function He(t){var e=this,n=t.i;e.componentWillUnmount=function(){D(null,e.l),e.l=null,e.i=null},e.i&&e.i!==n&&e.componentWillUnmount(),t.__v?(e.l||(e.i=n,e.l={nodeType:1,parentNode:n,childNodes:[],appendChild:function(t){this.childNodes.push(t),e.i.appendChild(t)},insertBefore:function(t,n){this.childNodes.push(t),e.i.appendChild(t)},removeChild:function(t){this.childNodes.splice(this.childNodes.indexOf(t)>>>1,1),e.i.removeChild(t)}}),D(d(We,{context:e.context},t.__v),e.l)):e.l&&e.componentWillUnmount()}(Ue.prototype=new m).__a=function(t){var e=this,n=je(e.__v),i=e.o.get(t);return i[0]++,function(o){var s=function(){e.props.revealOrder?(i.push(o),Re(e,t,i)):o()};n?n(s):s()}},Ue.prototype.render=function(t){this.u=null,this.o=new Map;var e=w(t.children);t.revealOrder&&"b"===t.revealOrder[0]&&e.reverse();for(var n=e.length;n--;)this.o.set(e[n],this.u=[1,0,this.u]);return t.children},Ue.prototype.componentDidUpdate=Ue.prototype.componentDidMount=function(){var t=this;this.o.forEach((function(e,n){Re(t,n,e)}))};var $e="undefined"!=typeof Symbol&&Symbol.for&&Symbol.for("react.element")||60103,Me=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image|letter|lighting|marker(?!H|W|U)|overline|paint|pointer|shape|stop|strikethrough|stroke|text(?!L)|transform|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/,Qe="undefined"!=typeof document,Fe=function(t){return("undefined"!=typeof Symbol&&"symbol"==typeof Symbol()?/fil|che|rad/i:/fil|che|ra/i).test(t)};m.prototype.isReactComponent={},["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach((function(t){Object.defineProperty(m.prototype,t,{configurable:!0,get:function(){return this["UNSAFE_"+t]},set:function(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:e})}})}));var Be=e.event;function qe(){}function Ve(){return this.cancelBubble}function Xe(){return this.defaultPrevented}e.event=function(t){return Be&&(t=Be(t)),t.persist=qe,t.isPropagationStopped=Ve,t.isDefaultPrevented=Xe,t.nativeEvent=t};var Ke={configurable:!0,get:function(){return this.class}},Ge=e.vnode;e.vnode=function(t){var e=t.type,n=t.props,i=n;if("string"==typeof e){var o=-1===e.indexOf("-");for(var s in i={},n){var a=n[s];Qe&&"children"===s&&"noscript"===e||"value"===s&&"defaultValue"in n&&null==a||("defaultValue"===s&&"value"in n&&null==n.value?s="value":"download"===s&&!0===a?a="":/ondoubleclick/i.test(s)?s="ondblclick":/^onchange(textarea|input)/i.test(s+e)&&!Fe(n.type)?s="oninput":/^onfocus$/i.test(s)?s="onfocusin":/^onblur$/i.test(s)?s="onfocusout":/^on(Ani|Tra|Tou|BeforeInp|Compo)/.test(s)?s=s.toLowerCase():o&&Me.test(s)?s=s.replace(/[A-Z0-9]/g,"-$&").toLowerCase():null===a&&(a=void 0),/^oninput$/i.test(s)&&(s=s.toLowerCase(),i[s]&&(s="oninputCapture")),i[s]=a)}"select"==e&&i.multiple&&Array.isArray(i.value)&&(i.value=w(n.children).forEach((function(t){t.props.selected=-1!=i.value.indexOf(t.props.value)}))),"select"==e&&null!=i.defaultValue&&(i.value=w(n.children).forEach((function(t){t.props.selected=i.multiple?-1!=i.defaultValue.indexOf(t.props.value):i.defaultValue==t.props.value}))),t.props=i,n.class!=n.className&&(Ke.enumerable="className"in n,null!=n.className&&(i.class=n.className),Object.defineProperty(i,"className",Ke))}t.$$typeof=$e,Ge&&Ge(t)};var ze=e.__r;e.__r=function(t){ze&&ze(t),t.__c};var Je=['a[href]:not([tabindex^="-"])','area[href]:not([tabindex^="-"])','input:not([type="hidden"]):not([type="radio"]):not([disabled]):not([tabindex^="-"])','input[type="radio"]:not([disabled]):not([tabindex^="-"])','select:not([disabled]):not([tabindex^="-"])','textarea:not([disabled]):not([tabindex^="-"])','button:not([disabled]):not([tabindex^="-"])','iframe:not([tabindex^="-"])','audio[controls]:not([tabindex^="-"])','video[controls]:not([tabindex^="-"])','[contenteditable]:not([tabindex^="-"])','[tabindex]:not([tabindex^="-"])'];function Ye(t){this._show=this.show.bind(this),this._hide=this.hide.bind(this),this._maintainFocus=this._maintainFocus.bind(this),this._bindKeypress=this._bindKeypress.bind(this),this.$el=t,this.shown=!1,this._id=this.$el.getAttribute("data-a11y-dialog")||this.$el.id,this._previouslyFocused=null,this._listeners={},this.create()}function Ze(t,e){return n=(e||document).querySelectorAll(t),Array.prototype.slice.call(n);var n}function tn(t){(t.querySelector("[autofocus]")||t).focus()}function en(){Ze("[data-a11y-dialog]").forEach((function(t){new Ye(t)}))}Ye.prototype.create=function(){return this.$el.setAttribute("aria-hidden",!0),this.$el.setAttribute("aria-modal",!0),this.$el.setAttribute("tabindex",-1),this.$el.hasAttribute("role")||this.$el.setAttribute("role","dialog"),this._openers=Ze('[data-a11y-dialog-show="'+this._id+'"]'),this._openers.forEach(function(t){t.addEventListener("click",this._show)}.bind(this)),this._closers=Ze("[data-a11y-dialog-hide]",this.$el).concat(Ze('[data-a11y-dialog-hide="'+this._id+'"]')),this._closers.forEach(function(t){t.addEventListener("click",this._hide)}.bind(this)),this._fire("create"),this},Ye.prototype.show=function(t){return this.shown||(this._previouslyFocused=document.activeElement,this.$el.removeAttribute("aria-hidden"),this.shown=!0,tn(this.$el),document.body.addEventListener("focus",this._maintainFocus,!0),document.addEventListener("keydown",this._bindKeypress),this._fire("show",t)),this},Ye.prototype.hide=function(t){return this.shown?(this.shown=!1,this.$el.setAttribute("aria-hidden","true"),this._previouslyFocused&&this._previouslyFocused.focus&&this._previouslyFocused.focus(),document.body.removeEventListener("focus",this._maintainFocus,!0),document.removeEventListener("keydown",this._bindKeypress),this._fire("hide",t),this):this},Ye.prototype.destroy=function(){return this.hide(),this._openers.forEach(function(t){t.removeEventListener("click",this._show)}.bind(this)),this._closers.forEach(function(t){t.removeEventListener("click",this._hide)}.bind(this)),this._fire("destroy"),this._listeners={},this},Ye.prototype.on=function(t,e){return void 0===this._listeners[t]&&(this._listeners[t]=[]),this._listeners[t].push(e),this},Ye.prototype.off=function(t,e){var n=(this._listeners[t]||[]).indexOf(e);return n>-1&&this._listeners[t].splice(n,1),this},Ye.prototype._fire=function(t,e){var n=this._listeners[t]||[],i=new CustomEvent(t,{detail:e});this.$el.dispatchEvent(i),n.forEach(function(t){t(this.$el,e)}.bind(this))},Ye.prototype._bindKeypress=function(t){this.$el.contains(document.activeElement)&&(this.shown&&"Escape"===t.key&&"alertdialog"!==this.$el.getAttribute("role")&&(t.preventDefault(),this.hide(t)),this.shown&&"Tab"===t.key&&function(t,e){var n=function(t){return Ze(Je.join(","),t).filter((function(t){return!!(t.offsetWidth||t.offsetHeight||t.getClientRects().length)}))}(t),i=n.indexOf(document.activeElement);e.shiftKey&&0===i?(n[n.length-1].focus(),e.preventDefault()):e.shiftKey||i!==n.length-1||(n[0].focus(),e.preventDefault())}(this.$el,t))},Ye.prototype._maintainFocus=function(t){!this.shown||t.target.closest('[aria-modal="true"]')||t.target.closest("[data-a11y-dialog-ignore-focus-trap]")||tn(this.$el)},"undefined"!=typeof document&&("loading"===document.readyState?document.addEventListener("DOMContentLoaded",en):window.requestAnimationFrame?window.requestAnimationFrame(en):window.setTimeout(en,16));const nn=t=>{const e=(()=>{const[t,e]=X(!1);return G((()=>e(!0)),[]),t})(),[n,i]=(t=>{const[e,n]=(()=>{const[t,e]=X(null);return[t,Y((t=>{null!==t&&e(new Ye(t))}),[])]})(),i=Y((()=>e.hide()),[e]),o=t.role||"dialog",s="alertdialog"===o,a=t.titleId||t.id+"-title";return G((()=>()=>{e&&e.destroy()}),[e]),[e,{container:{id:t.id,ref:n,role:o,tabIndex:-1,"aria-modal":!0,"aria-hidden":!0,"aria-labelledby":a},overlay:{onClick:s?void 0:i},dialog:{role:"document"},closeButton:{type:"button",onClick:i},title:{role:"heading","aria-level":1,id:a}}]})(t),{dialogRef:o}=t;if(G((()=>(n&&o(n),()=>o(void 0))),[o,n]),!e)return null;const s=t.dialogRoot?document.querySelector(t.dialogRoot):document.body,a=d("h2",Se({},i.title,{className:t.classNames.title,key:"title"}),t.onBack&&d("a",{"aria-label":t.backButtonLabel,href:"#",onClick:e=>{e.preventDefault(),t.onBack(e)}},"←")," ",t.title),r=d("button",Se({},i.closeButton,{className:t.classNames.closeButton,"aria-label":t.closeButtonLabel,key:"button"}),t.closeButtonContent),l=["first"===t.closeButtonPosition&&r,a,t.children,"last"===t.closeButtonPosition&&r].filter(Boolean);return function(t,e){var n=d(He,{__v:t,i:e});return n.containerInfo=e,n}(d("div",Se({},i.container,{className:t.classNames.container}),d("div",Se({},i.overlay,{className:t.classNames.overlay})),d("div",Se({},i.dialog,{className:t.classNames.dialog}),l)),s)};nn.defaultProps={role:"dialog",closeButtonLabel:"Close this dialog window",closeButtonContent:"×",closeButtonPosition:"first",classNames:{},backButtonLabel:"Back",dialogRef:()=>{}},function(t){function e(e,i,o,s){const a=o||s.parent(),r=a.find(".mg-upc-item-vote").attr("disabled",!0);mgUpcApiClient.vote(e,i,{context:"web",posts:n(a)}).then((function(e){t(document.body).trigger("mg_upc_vote_response",[e,a])})).catch((function(t){var e,n;r.attr("disabled",!1),null!==(e=t.response)&&void 0!==e&&null!==(n=e.data)&&void 0!==n&&n.message&&(s?s.append(Bt(t.response.data.message)):a.before(Bt(t.response.data.message)))}))}function n(e){return[...e.children().map((function(){return t(this).data("pid")}))].join(",")}t(".mg-upc-item-vote").on("click",(function(){const n=t(this).data("vote").split(",");return 2===n.length&&e(n[0],n[1],!1,t(this).closest(".mg-upc-item")),!1})),t((function(){t(".mg-upc-vote").each((function(){const n=t(this);e(n.data("id"),0,n.find(".mg-upc-items-container"),!1)}))})),t(document.body).on("mg_upc_vote_response",(function(e,n,i){if(!n.data)return;const o=parseInt(n.data.vote_counter,10),s=i.find(".mg-upc-item-vote");i.data("votes",o),n.data.can_vote?s.attr("disabled",!1).show():s.animate({width:0,padding:0,opacity:0},200,(function(){s.remove()})),n.data.posts.forEach((function(e){const n=i.find(".mg-upc-item[data-pid="+e.post_id+"]"),s=parseInt(e.votes,10);t(document.body).trigger("mg_upc_item_vote_set",[n,s,o])}))})),t(document.body).on("mg_upc_item_vote_set",(function(t,e,n,i){const o=i>0?Math.round(1e3*n/i)/10:0,s=e.find(".mg-upc-votes");s.find(".mg-upc-item-votes-number").html(n),s.find(".mg-upc-item-percent").html(o+"%"),s.find(".mg-upc-item-bar-progress").animate({width:o+"%"}),s.show()}))}(jQuery),function(t){t(".mg-upc-add-product-to-list").on("click",(function(){let e=t(this).data("id");const n=t(this).closest(".product,.summary").find("[name='variation_id']");return n.length>0&&parseInt(n.val(),10)>0&&(e=n.val()),window.addItemToList(e),!1}));const e="mg-upc-btn-loading",n="mg-upc-product-added",i="mg-upc-product-error",o="Sorry, an error occurred.";function s(a,r,l){if(r.hasClass(e))return!1;let c={product_id:r.data("product"),quantity:r.data("quantity")};if("0"==c.quantity){if(!l)return!!confirm(at("The quantity is zero! Do you want to add a unit?"))&&s(a,r,!0);c.quantity=1}t(document.body).trigger("adding_to_cart",[r,c]);const u=woocommerce_params.wc_ajax_url.toString().replace("%%endpoint%%","add_to_cart");return t.ajax({type:"POST",url:u,data:c,beforeSend:function(t){r.removeClass(n+" "+i).addClass(e)},success:function(i){r.removeClass(e),i&&(i.error&&i.product_url?alert(o):(r.addClass(n),t(document.body).trigger("added_to_cart",[i.fragments,i.cart_hash,r])))},error:function(){r.addClass(i).removeClass(e),alert(o)}}),!1}function s(a,r,l){if(r.hasClass(e))return!1;let c={product_id:r.data("product"),quantity:r.data("quantity")};if("0"==c.quantity){if(!l)return!!confirm(at("The quantity is zero! Do you want to add a unit?"))&&s(a,r,!0);c.quantity=1}t(document.body).trigger("adding_to_cart",[r,c]);const u=woocommerce_params.wc_ajax_url.toString().replace("%%endpoint%%","add_to_cart");return t.ajax({type:"POST",url:u,data:c,beforeSend:function(t){r.removeClass(n+" "+i).addClass(e)},success:function(i){r.removeClass(e),i&&(i.error&&i.product_url?alert(o):(r.addClass(n),t(document.body).trigger("added_to_cart",[i.fragments,i.cart_hash,r])))},error:function(){r.addClass(i).removeClass(e),alert(o)}}),!1}t((function(){if("undefined"==typeof wc_add_to_cart_params)return!1;t(".mg-upc-item-product").removeClass("mg-upc-hide").on("click",(function(e){return s(e,t(this),!1)})),t(".mg-upc-add-list-to-cart").removeClass("mg-upc-hide").on("click",(function(s){const a=t(this);return a.hasClass(e)||(a.removeClass(n+" "+i).addClass(e),window.mgUpcAddListToCart(t(this).data("id")).then((function(i){a.removeClass(e),i.err&&a.before(Bt(Qt(i.err))),i.msg&&a.before(Bt(Qt(i.msg),"success")),a.addClass(n),t(document.body).trigger("added_to_cart",[i.fragments,i.cart_hash,a])})).catch((t=>{var n,i;a.removeClass(e),null!==(n=t.response)&&void 0!==n&&null!==(i=n.data)&&void 0!==i&&i.message?a.before(Bt(Qt(t.response.data.message))):alert(o)}))),!1}))}))}(jQuery);const on=function(t){var e;const[n,i]=X(""),[o,s]=X(""),[a,r]=X(""),[l,c]=X(""),u=J((()=>Wt(t.addingPost)),[t.addingPost]);function p(t){t.default_title&&i(t.default_title),t.default_status&&c(t.default_status),r(t.name)}return""===a&&1===u.length&&p(u[0]),G((()=>{i(t.list.title),s(t.list.content),r(t.list.type),c(t.list.status)}),[t.list]),G((()=>{var t;null!==(t=jt(a))&&void 0!==t&&t.available_statuses&&-1===jt(a).available_statuses.indexOf(l)&&c(jt(a).available_statuses[0])}),[a]),d("div",{className:"mg-list-edit"},-1===t.list.ID&&""===a&&d(_,null,d("label",null,at("Select a list type:")),d("ul",{id:`type-${t.list.ID}`},u.map(((t,e)=>d("li",{className:"mg-upc-dg-item-list-type",key:t.name,onClick:()=>p(t),onKeyPress:e=>{13===e.keyCode&&p(t)},tabIndex:"0"},d("i",{className:"mg-upc-icon mg-upc-dg-item-type mg-upc-dg-item-type-"+t.name}),d("div",{className:"mg-upc-dg-item-title"},d("strong",null,t.label),d("div",{className:"mg-upc-dg-item-desc"},t.description))))))),""!==a&&Ht(a,"editable_title")&&d(_,null,d("label",{htmlFor:`title-${t.list.ID}`},at("Title")),d("input",{id:`title-${t.list.ID}`,type:"text",value:n,onChange:function(t){i(t.target.value)},maxLength:100})),""!==a&&Ht(a,"editable_content")&&d(_,null,d("label",{htmlFor:`content-${t.list.ID}`},at("Description")),d("textarea",{id:`content-${t.list.ID}`,value:o,onChange:function(t){s(t.target.value)},maxLength:500}),d("span",{className:"mg-upc-dg-list-desc-edit-count"},d("i",null,null==o?void 0:o.length),"/500")),""!==a&&!jt(a)&&d("span",null,at("Unknown List Type...")),""!==a&&(null===(e=jt(a))||void 0===e?void 0:e.available_statuses)&&jt(a).available_statuses.length>1&&d(_,null,d("label",{htmlFor:`status-${t.list.ID}`},at("Status")),d("select",{id:`status-${t.list.ID}`,value:l,onChange:function(t){c(t.target.value)}},jt(a).available_statuses.map(((t,e)=>{if(function(t){const e=Ut(t);return e&&e.show_in_status_list}(t))return d("option",{value:t},function(t){const e=Ut(t);return e?e.label:t}(t))})))),""!==a&&jt(a)&&d("div",{className:"mg-upc-dg-edit-actions"},d("button",{onClick:()=>t.onSave({title:n,content:o,type:a,status:l})},d("span",{className:"mg-upc-icon upc-font-save"}),d("span",null,at("Save"))),d("button",{onClick:()=>t.onCancel()},d("span",{className:"mg-upc-icon upc-font-close"}),d("span",null,at("Cancel")))))},sn=function(t){var e;const[n,i]=X(!1),[o,s]=X(""),[a,r]=X(null===(e=t.item)||void 0===e?void 0:e.quantity),l=z({});G((()=>{s(t.item.description)}),[t.item]),G((()=>{n&&l.current.focus()}),[n]);const c=z(!1);return G((()=>{t.item.quantity!==a&&(clearTimeout(c.current),c.current=setTimeout((function(){t.onSaveItemQuantity(a)}),600))}),[a]),d("li",{className:"mg-upc-dg-item","data-post_id":t.item.post_id},Rt(t.list,"sortable")&&d(_,null,d("span",{className:"mg-upc-dg-item-handle","aria-draggable":!0},"::"),d("span",{className:"mg-upc-dg-item-number"},t.item.position)),Rt(t.list,"vote")&&d(_,null,d("span",{className:"mg-upc-dg-item-number"},(()=>{const e=parseInt(t.list.vote_counter,10);return Rt(t.list,"vote")&&e>0?Math.round(100*parseInt(t.item.votes,10)/e)+"%":"0%"})())),d("a",{href:t.item.link},d("img",{className:"mg-upc-dg-item-image",src:t.item.image?t.item.image:$t})),d("div",{className:"mg-upc-dg-item-data"},d("a",{href:t.item.link},t.item.title),t.item.price_html&&d("span",{className:"mg-upc-dg-price",dangerouslySetInnerHTML:{__html:t.item.price_html}}),t.item.stock_html&&d("span",{className:"mg-upc-dg-stock",dangerouslySetInnerHTML:{__html:t.item.stock_html}}),t.editable&&!n&&d("p",null,t.item.description),t.editable&&!n&&Rt(t.list,"editable_item_description")&&d("button",{onClick:()=>{i(!0)}},d("span",{className:"mg-upc-icon upc-font-edit"}),""===o&&d("span",null,at("Add Comment")),""!==o&&d("span",null,at("Edit Comment"))),d("input",{ref:l,className:n?"mg-upc-dg-btn-item-desc":"mg-upc-dg-dn",type:"text",value:o,onChange:function(t){s(t.target.value)},maxLength:400}),t.editable&&n&&d("button",{className:"mg-upc-dg-btn-item-desc-cancel",onClick:()=>{i(!1),s(t.item.description)}},d("span",{className:"mg-upc-icon upc-font-close"}),d("span",null,at("Cancel"))),t.editable&&n&&d("button",{className:"mg-upc-dg-btn-item-desc-save",onClick:()=>{i(!1),t.onSaveItemDescription(o)}},d("span",{className:"mg-upc-icon upc-font-save"}),d("span",null,at("Save")))),t.editable&&Rt(t.list,"quantity")&&d("div",{className:"mg-upc-dg-quantity"},d("small",null,at("Quantity")),d("input",{"aria-label":at("Quantity"),type:"number",value:a,onChange:function(){r(event.target.value)}})),t.editable&&!n&&d("div",null,d("button",{"aria-label":"Remove item",onClick:t.onRemove},d("span",{className:"mg-upc-icon upc-font-trash"}))))},an=function(t){return new Promise((function(e,n){const i=document.createElement("script");let o=!1;i.type="text/javascript",i.src=t,i.async=!0,i.onerror=function(t){n(t,i)},i.onload=i.onreadystatechange=function(){o||this.readyState&&"complete"!=this.readyState||(o=!0,setTimeout((function(){e()}),100))},(document.head||document.body||document.documentElement).appendChild(i)}))},rn=function(t){var e,n,i;const o=z(null),s=z((e=>{t.onMove(e)}));return G((()=>{s.current=t.onMove})),G((()=>{let e=!1;if(Rt(t.list,"sortable")){const t=()=>{e=Sortable.create(o.current,{handle:".mg-upc-dg-item-handle",group:"shared",animation:150,onUpdate:function(t){s.current(t)}})};"undefined"!=typeof Sortable?t():an(Ot()).then((()=>{t()}))}return()=>{e&&e.destroy()}})),d(_,null,d("ul",{className:"mg-upc-dg-list-fake mg-upc-dg-on-loading"},[0,1,2].map((e=>d("li",{className:"mg-upc-dg-item"},Rt(t.list,"sortable")&&d(_,null,d("span",{className:"mg-upc-dg-item-handle-skeleton"}," ",d(Zt,{width:"1.5em"})," "),d("span",{className:"mg-upc-dg-item-number-skeleton"}," ",d(Zt,{width:"1em"})," ")),Rt(t.list,"vote")&&d(_,null,d("span",{className:"mg-upc-dg-item-number-skeleton"}," ",d(Zt,{width:"1em"})," ")),d("div",{className:"mg-upc-dg-item-skeleton-image"},d(Zt,{width:"5em",height:"5em"})),d("div",{className:"mg-upc-dg-item-data"},d(Zt,{count:2})))))),d("ul",{ref:o,className:"mg-upc-dg-list"},0===(null==t||null===(e=t.items)||void 0===e?void 0:e.length)&&d("span",null,"There are no items in this list"),(null==t||null===(n=t.items)||void 0===n?void 0:n.length)>0&&(null===(i=t.items)||void 0===i?void 0:i.map)&&t.items.map((e=>d(sn,{list:t.list,item:e,editable:t.editable,onRemove:()=>t.onRemove(t.list,e),onSaveItemDescription:n=>t.onSaveItemDescription(t.list,e,n),onSaveItemQuantity:n=>t.onSaveItemQuantity(t.list,e,n),key:e.ID+":"+e.post_id})))),Rt(t.list,"vote")&&d("span",{className:"mg-upc-dg-total-votes"}," ",at("Total votes:")," ",d("span",null," ",t.list.vote_counter)))},ln=function(t){const e=z(null),n=z(null),i=at("Copy"),[o,s]=X(i);G((()=>{let t=null;o!==i&&(t=setTimeout((()=>{s(i),clearTimeout(t)}),2e3))}),[o]);const a=encodeURIComponent(t.link),r=encodeURIComponent(t.title);let l=[{name:"Twitter",url:"https://twitter.com/share?url="+a+"&text="+r},{name:"Facebook",url:"https://www.facebook.com/sharer/sharer.php?u="+a+""e="+r},{name:"Pinterest",url:"https://pinterest.com/pin/create/button/?url="+a+"&description="+r},{name:"Whatsapp",url:"whatsapp://send?text="+a},{name:"Telegram",url:"https://t.me/share/url?url="+a+"&text="+r},{name:"LiNE",url:"https://social-plugins.line.me/lineit/share?url="+a+"&text="+r},{slug:"email",name:at("Email"),url:"mailto:?subject="+r+"&body="+a}];return void 0!==Dt().shareButtons&&(l=l.filter((t=>Dt().shareButtons.includes(t.slug||t.name.toLowerCase())))),d("div",{className:"mg-upc-dg-share-link"},d("input",{ref:e,value:t.link,onClick:function(){e.current.setSelectionRange(0,e.current.value.length)},readOnly:!0}),d("button",{ref:n,onClick:function(t){var n;(n=e.current).focus(),n.setSelectionRange(0,n.value.length),document.execCommand&&document.execCommand("copy")?s(at("Copied!")):s("Error!")}},d("span",{className:"mg-upc-icon upc-font-copy"}),d("span",null,o)),l.map((function(t){return(e=t).slug||(e.slug=e.name.toLowerCase()),d("a",{href:e.url,title:"Share with "+e.name,className:"mg-upc-dg-share",target:"_blank",rel:"noopener"},d("div",{className:"mg-upc-share-btn-img mg-upc-share-"+e.slug}," "));var e})))},cn=function(t){var e;const{state:n,dispatch:i}=Z(zt),[o,s]=X(!1),a=z(!1),r=z(!1);function l(t){t<1||t>n.listTotalPages||"loading"===n.status||i(ve({page:t}))}return G((()=>{const t=n.list;let e=!1,o=!1;if(t&&Rt(t,"sortable")){const t=()=>{a.current&&n.listPage<n.listTotalPages&&(e=Sortable.create(a.current,{group:"shared",onAdd:t=>{i(ke(t.oldIndex))}})),a.current&&n.listPage>1&&(o=Sortable.create(r.current,{group:"shared",onAdd:t=>{i(Ne(t.oldIndex))}}))};"undefined"!=typeof Sortable?t():an(Ot()).then((()=>{t()}))}return()=>{e&&e.destroy(),o&&o.destroy()}}),[n.list,n.listPage,n.listTotalPages]),G((()=>{s(!1)}),[n.editing,n.list,n.addingPost]),d(_,null,n.editing&&d(on,{list:n.list,addingPost:n.addingPost,onSave:function(t){if(-1===n.list.ID||t.title!==n.list.title||t.content!==n.list.content||t.status!==n.list.status)if(-1===n.list.ID){var e;const o={};o.title=t.title,o.content=t.content,o.type=t.type,o.status=t.status,null!==(e=n.addingPost)&&void 0!==e&&e.post_id&&(o.adding=n.addingPost.post_id),i(he(o))}else{const e={id:n.list.ID};t.status!==n.list.status&&(e.status=t.status),t.title!==n.list.title&&(e.title=t.title),t.content!==n.list.content&&(e.content=t.content),i(ge(e))}},onCancel:function(){i(ae(!1)),-1===n.list.ID&&(i(fe(!1)),i(oe()),i(le()))}}),!n.editing&&d(_,null,d("div",{className:"mg-upc-dg-top-action"},function(t){var e,n;const i=t.type;return Ht(i,"editable_title")||Ht(i,"editable_content")||(null===(e=jt(i))||void 0===e||null===(n=e.available_statuses)||void 0===n?void 0:n.length)>1}(n.list)&&d("button",{className:"mg-upg-edit",onClick:()=>i(ae(!0))},d("span",{className:"mg-upc-icon upc-font-edit"}),d("span",null,at("Edit"))),n.list.link&&d("button",{className:"mg-upg-share",onClick:()=>s(!o)},d("span",{className:"mg-upc-icon upc-font-share"}),d("span",null,at("Share"))),"cart"===n.list.type&&d("button",{className:"mg-upg-share",onClick:function(){i(re(n.list.ID))}},d("span",{className:"mg-upc-icon upc-font-cart"}),d("span",null,at("Add all to cart")))),o&&n.list.link&&d(ln,{link:n.list.link,title:n.list.title}),n.list.content&&d("p",{className:"mg-upc-dg-list-desc",dangerouslySetInnerHTML:{__html:Qt(n.list.content)}}),d(Zt,{count:3}),d(rn,{list:n.list,items:(null===(e=n.list)||void 0===e?void 0:e.items)||[],onMove:function(t){i(Pe(t.oldIndex,n.list,t.newIndex))},onRemove:function(t,e){i(ye(e.post_id))},onSaveItemDescription:function(t,e,n){i(we(e.post_id,{description:n}))},onSaveItemQuantity:function(t,e,n){i(we(e.post_id,{quantity:n}))},editable:t.editable})),(!n.editing||!n.list)&&n.listTotalPages>1&&d(ie,{totalPages:n.listTotalPages,page:n.listPage,onPreview:function(){l(n.listPage-1)},onNext:function(){l(n.listPage+1)},prevRef:r,nextRef:a}))};function un(t){return parseInt(t.author,10)===parseInt(Dt().user_id,10)}function dn(){"replaceState"in history?(history.replaceState("",document.title,location.pathname),history.go(-1)):location.hash=""}D(d((t=>{const[e,n]=K(qt,Gt);return d(zt.Provider,{value:{state:e,dispatch:Kt(n,(()=>e))}},t.children)}),null,d((function(){const{state:t,dispatch:e}=Z(zt),n=J((()=>Wt(t.addingPost)),[t.addingPost]),i=z(!1);let o="listOfList";if(t.addingPost)o=t.editing?"addingToNew":"adding";else if(t.editing){var s;o=-1!==(null===(s=t.list)||void 0===s?void 0:s.ID)?"edit":"new"}else o=t.list?"list":"listOfList";const a={container:"mg-upc-dg-container",overlay:"mg-upc-dg-overlay",dialog:"mg-upc-dg-content"+(t.errorCode?" mg-upc-err-"+t.errorCode:""),title:"mg-upc-dg-title",closeButton:"mg-upc-dg-close"};G((()=>{window.showMyLists=function(){r()},window.mgUpcShowList=function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";e(oe()),e(fe({ID:t,title:n||""})),i.current.show()},window.addItemToList=function(t){let n=arguments.length>1&&void 0!==arguments[1]&&arguments[1],o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"view";e(oe()),n?(e(be(n,t,o)),i.current.show()):l(t)},window.removeItemFromList=function(t,n){let o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"view";e(oe()),e(ye(t,n,o)),i.current.show()},window.mgUpcAddListToCart=Ft}),[i.current,e]);const r=()=>{e(oe()),e(le()),i.current.show()},l=t=>{e(se({post_id:t})),e(le({addingPost:t})),i.current.show()};function c(n){n<1||n>t.totalPages||"loading"===t.status||e(de(n))}const u="list"===o||"new"===o||"edit"===o||"addingToNew"===o;return d(nn,{id:"mg-upc-dg-dialog",dialogRef:function(t){i.current=t},title:t.title,classNames:a,onBack:!!u&&function(){switch(o){case"list":default:r();break;case"new":e(fe(!1)),e(ae(!1)),r();break;case"edit":e(ae(!1));break;case"addingToNew":e(fe(!1)),e(ae(!1)),e(le({addingPost:t.addingPost.post_id}))}}},d("div",{className:"mg-upc-dg-content-wrapper mg-upc-dg-status-"+t.status+" mg-upc-dg-view-"+o},d("div",{className:"mg-upc-dg-wait"}),t.message&&d("div",{className:"mg-upc-dg-msg"},t.message,d("a",{href:"#",className:"mg-upc-dg-alert-close","aria-label":"Hide alert",onClick:t=>{t.preventDefault(),e({type:ct,payload:null})}},d("span",{className:"mg-upc-icon upc-font-close"}))),t.error&&d("div",{className:"mg-upc-dg-error"},t.error,d("a",{href:"#",className:"mg-upc-dg-alert-close","aria-label":"Hide alert",onClick:t=>{t.preventDefault(),e({type:lt,payload:null})}},d("span",{className:"mg-upc-icon upc-font-close"}))),d("div",{className:"mg-upc-dg-body"},!t.error&&t.addingPost&&d(Ie,{item:t.addingPost,onSaveItemDescription:function(n){e(se({...t.addingPost,description:n}))}}),("listOfList"===o||"adding"===o)&&d(_,null,d("div",{className:"mg-upc-dg-top-action"},n.length>0&&!t.error&&d("button",{className:"mg-list-new",onClick:function(t){e(ae(!0)),e(fe(!0)),i.current.show()}},d("span",{className:"mg-upc-icon upc-font-add"}),d("span",null,at("Create List")))),d(xe,{lists:t.listOfList,onSelect:function(n){e(ae(!1)),t.addingPost?e(be(n.ID,t.addingPost)):(e(fe(n)),i.current.show())},onRemove:!t.addingPost&&function(t){e(ue(t.ID))},loadPreview:function(){c(t.page-1)},loadNext:function(){c(t.page+1)}})),t.list&&d(cn,{editable:un(t.list)}))))}),null)," "),document.querySelector("body")),"#my-lists"===location.hash&&dn(),window.addEventListener("hashchange",(function(){"#my-lists"===location.hash&&(window.showMyLists(),dn())}),!1),window.mgUpcApiClient=Lt,window.mgUpcListeners=function(){jQuery(".mg-upc-post-add").on("click",(function(){return jQuery(this).data("post-id")>0&&window.addItemToList(jQuery(this).data("post-id"),(jQuery(this).data("upc-list")+"").length>0&&jQuery(this).data("upc-list")),!1})),jQuery(".mg-upc-post-remove").on("click",(function(){return jQuery(this).data("post-id")>0&&void 0!==jQuery(this).data("upc-list")&&window.removeItemFromList(jQuery(this).data("post-id"),(jQuery(this).data("upc-list")+"").length>0&&jQuery(this).data("upc-list")),!1})),jQuery(".mg-upc-show-list").on("click",(function(){return void 0!==jQuery(this).data("upc-list")&&window.mgUpcShowList(jQuery(this).data("upc-list"),(jQuery(this).data("upc-title")+"").length>0&&jQuery(this).data("upc-title")),!1}))},window.mgUpcListeners()})();1 (()=>{"use strict";var t,e,n,i,o,s,a,r,l,c,u,d={},_=[],p=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,m=Array.isArray;function f(t,e){for(var n in e)t[n]=e[n];return t}function g(t){t&&t.parentNode&&t.parentNode.removeChild(t)}function h(e,n,i){var o,s,a,r={};for(a in n)"key"==a?o=n[a]:"ref"==a?s=n[a]:r[a]=n[a];if(arguments.length>2&&(r.children=arguments.length>3?t.call(arguments,2):i),"function"==typeof e&&null!=e.defaultProps)for(a in e.defaultProps)void 0===r[a]&&(r[a]=e.defaultProps[a]);return v(e,r,o,s,null)}function v(t,i,o,s,a){var r={type:t,props:i,key:o,ref:s,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:null==a?++n:a,__i:-1,__u:0};return null==a&&null!=e.vnode&&e.vnode(r),r}function y(t){return t.children}function b(t,e){this.props=t,this.context=e}function w(t,e){if(null==e)return t.__?w(t.__,t.__i+1):null;for(var n;e<t.__k.length;e++)if(null!=(n=t.__k[e])&&null!=n.__e)return n.__e;return"function"==typeof t.type?w(t):null}function P(t){var e,n;if(null!=(t=t.__)&&null!=t.__c){for(t.__e=t.__c.base=null,e=0;e<t.__k.length;e++)if(null!=(n=t.__k[e])&&null!=n.__e){t.__e=t.__c.base=n.__e;break}return P(t)}}function k(t){(!t.__d&&(t.__d=!0)&&i.push(t)&&!C.__r++||o!==e.debounceRendering)&&((o=e.debounceRendering)||s)(C)}function C(){var t,n,o,s,r,l,c,u;for(i.sort(a);t=i.shift();)t.__d&&(n=i.length,s=void 0,l=(r=(o=t).__v).__e,c=[],u=[],o.__P&&((s=f({},r)).__v=r.__v+1,e.vnode&&e.vnode(s),D(o.__P,s,r,o.__n,o.__P.namespaceURI,32&r.__u?[l]:null,c,null==l?w(r):l,!!(32&r.__u),u),s.__v=r.__v,s.__.__k[s.__i]=s,O(c,s,u),s.__e!=l&&P(s)),i.length>n&&i.sort(a));C.__r=0}function N(t,e,n,i,o,s,a,r,l,c,u){var p,m,f,g,h,v=i&&i.__k||_,y=e.length;for(n.__d=l,x(n,e,v),l=n.__d,p=0;p<y;p++)null!=(f=n.__k[p])&&(m=-1===f.__i?d:v[f.__i]||d,f.__i=p,D(t,f,m,o,s,a,r,l,c,u),g=f.__e,f.ref&&m.ref!=f.ref&&(m.ref&&j(m.ref,null,f),u.push(f.ref,f.__c||g,f)),null==h&&null!=g&&(h=g),65536&f.__u||m.__k===f.__k?l=S(f,l,t):"function"==typeof f.type&&void 0!==f.__d?l=f.__d:g&&(l=g.nextSibling),f.__d=void 0,f.__u&=-196609);n.__d=l,n.__e=h}function x(t,e,n){var i,o,s,a,r,l=e.length,c=n.length,u=c,d=0;for(t.__k=[],i=0;i<l;i++)null!=(o=e[i])&&"boolean"!=typeof o&&"function"!=typeof o?(a=i+d,(o=t.__k[i]="string"==typeof o||"number"==typeof o||"bigint"==typeof o||o.constructor==String?v(null,o,null,null,null):m(o)?v(y,{children:o},null,null,null):void 0===o.constructor&&o.__b>0?v(o.type,o.props,o.key,o.ref?o.ref:null,o.__v):o).__=t,o.__b=t.__b+1,s=null,-1!==(r=o.__i=T(o,n,a,u))&&(u--,(s=n[r])&&(s.__u|=131072)),null==s||null===s.__v?(-1==r&&d--,"function"!=typeof o.type&&(o.__u|=65536)):r!==a&&(r==a-1?d--:r==a+1?d++:(r>a?d--:d++,o.__u|=65536))):o=t.__k[i]=null;if(u)for(i=0;i<c;i++)null!=(s=n[i])&&!(131072&s.__u)&&(s.__e==t.__d&&(t.__d=w(s)),R(s,s))}function S(t,e,n){var i,o;if("function"==typeof t.type){for(i=t.__k,o=0;i&&o<i.length;o++)i[o]&&(i[o].__=t,e=S(i[o],e,n));return e}t.__e!=e&&(e&&t.type&&!n.contains(e)&&(e=w(t)),n.insertBefore(t.__e,e||null),e=t.__e);do{e=e&&e.nextSibling}while(null!=e&&8===e.nodeType);return e}function I(t,e){return e=e||[],null==t||"boolean"==typeof t||(m(t)?t.some((function(t){I(t,e)})):e.push(t)),e}function T(t,e,n,i){var o=t.key,s=t.type,a=n-1,r=n+1,l=e[n];if(null===l||l&&o==l.key&&s===l.type&&!(131072&l.__u))return n;if(i>(null==l||131072&l.__u?0:1))for(;a>=0||r<e.length;){if(a>=0){if((l=e[a])&&!(131072&l.__u)&&o==l.key&&s===l.type)return a;a--}if(r<e.length){if((l=e[r])&&!(131072&l.__u)&&o==l.key&&s===l.type)return r;r++}}return-1}function A(t,e,n){"-"===e[0]?t.setProperty(e,null==n?"":n):t[e]=null==n?"":"number"!=typeof n||p.test(e)?n:n+"px"}function E(t,e,n,i,o){var s;t:if("style"===e)if("string"==typeof n)t.style.cssText=n;else{if("string"==typeof i&&(t.style.cssText=i=""),i)for(e in i)n&&e in n||A(t.style,e,"");if(n)for(e in n)i&&n[e]===i[e]||A(t.style,e,n[e])}else if("o"===e[0]&&"n"===e[1])s=e!==(e=e.replace(/(PointerCapture)$|Capture$/i,"$1")),e=e.toLowerCase()in t||"onFocusOut"===e||"onFocusIn"===e?e.toLowerCase().slice(2):e.slice(2),t.l||(t.l={}),t.l[e+s]=n,n?i?n.u=i.u:(n.u=r,t.addEventListener(e,s?c:l,s)):t.removeEventListener(e,s?c:l,s);else{if("http://www.w3.org/2000/svg"==o)e=e.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if("width"!=e&&"height"!=e&&"href"!=e&&"list"!=e&&"form"!=e&&"tabIndex"!=e&&"download"!=e&&"rowSpan"!=e&&"colSpan"!=e&&"role"!=e&&"popover"!=e&&e in t)try{t[e]=null==n?"":n;break t}catch(t){}"function"==typeof n||(null==n||!1===n&&"-"!==e[4]?t.removeAttribute(e):t.setAttribute(e,"popover"==e&&1==n?"":n))}}function L(t){return function(n){if(this.l){var i=this.l[n.type+t];if(null==n.t)n.t=r++;else if(n.t<i.u)return;return i(e.event?e.event(n):n)}}}function D(t,n,i,o,s,a,r,l,c,u){var d,_,p,g,h,v,w,P,k,C,x,S,I,T,A,E,L=n.type;if(void 0!==n.constructor)return null;128&i.__u&&(c=!!(32&i.__u),a=[l=n.__e=i.__e]),(d=e.__b)&&d(n);t:if("function"==typeof L)try{if(P=n.props,k="prototype"in L&&L.prototype.render,C=(d=L.contextType)&&o[d.__c],x=d?C?C.props.value:d.__:o,i.__c?w=(_=n.__c=i.__c).__=_.__E:(k?n.__c=_=new L(P,x):(n.__c=_=new b(P,x),_.constructor=L,_.render=W),C&&C.sub(_),_.props=P,_.state||(_.state={}),_.context=x,_.__n=o,p=_.__d=!0,_.__h=[],_._sb=[]),k&&null==_.__s&&(_.__s=_.state),k&&null!=L.getDerivedStateFromProps&&(_.__s==_.state&&(_.__s=f({},_.__s)),f(_.__s,L.getDerivedStateFromProps(P,_.__s))),g=_.props,h=_.state,_.__v=n,p)k&&null==L.getDerivedStateFromProps&&null!=_.componentWillMount&&_.componentWillMount(),k&&null!=_.componentDidMount&&_.__h.push(_.componentDidMount);else{if(k&&null==L.getDerivedStateFromProps&&P!==g&&null!=_.componentWillReceiveProps&&_.componentWillReceiveProps(P,x),!_.__e&&(null!=_.shouldComponentUpdate&&!1===_.shouldComponentUpdate(P,_.__s,x)||n.__v===i.__v)){for(n.__v!==i.__v&&(_.props=P,_.state=_.__s,_.__d=!1),n.__e=i.__e,n.__k=i.__k,n.__k.some((function(t){t&&(t.__=n)})),S=0;S<_._sb.length;S++)_.__h.push(_._sb[S]);_._sb=[],_.__h.length&&r.push(_);break t}null!=_.componentWillUpdate&&_.componentWillUpdate(P,_.__s,x),k&&null!=_.componentDidUpdate&&_.__h.push((function(){_.componentDidUpdate(g,h,v)}))}if(_.context=x,_.props=P,_.__P=t,_.__e=!1,I=e.__r,T=0,k){for(_.state=_.__s,_.__d=!1,I&&I(n),d=_.render(_.props,_.state,_.context),A=0;A<_._sb.length;A++)_.__h.push(_._sb[A]);_._sb=[]}else do{_.__d=!1,I&&I(n),d=_.render(_.props,_.state,_.context),_.state=_.__s}while(_.__d&&++T<25);_.state=_.__s,null!=_.getChildContext&&(o=f(f({},o),_.getChildContext())),k&&!p&&null!=_.getSnapshotBeforeUpdate&&(v=_.getSnapshotBeforeUpdate(g,h)),N(t,m(E=null!=d&&d.type===y&&null==d.key?d.props.children:d)?E:[E],n,i,o,s,a,r,l,c,u),_.base=n.__e,n.__u&=-161,_.__h.length&&r.push(_),w&&(_.__E=_.__=null)}catch(t){if(n.__v=null,c||null!=a){for(n.__u|=c?160:128;l&&8===l.nodeType&&l.nextSibling;)l=l.nextSibling;a[a.indexOf(l)]=null,n.__e=l}else n.__e=i.__e,n.__k=i.__k;e.__e(t,n,i)}else null==a&&n.__v===i.__v?(n.__k=i.__k,n.__e=i.__e):n.__e=U(i.__e,n,i,o,s,a,r,c,u);(d=e.diffed)&&d(n)}function O(t,n,i){n.__d=void 0;for(var o=0;o<i.length;o++)j(i[o],i[++o],i[++o]);e.__c&&e.__c(n,t),t.some((function(n){try{t=n.__h,n.__h=[],t.some((function(t){t.call(n)}))}catch(t){e.__e(t,n.__v)}}))}function U(n,i,o,s,a,r,l,c,u){var _,p,f,h,v,y,b,P=o.props,k=i.props,C=i.type;if("svg"===C?a="http://www.w3.org/2000/svg":"math"===C?a="http://www.w3.org/1998/Math/MathML":a||(a="http://www.w3.org/1999/xhtml"),null!=r)for(_=0;_<r.length;_++)if((v=r[_])&&"setAttribute"in v==!!C&&(C?v.localName===C:3===v.nodeType)){n=v,r[_]=null;break}if(null==n){if(null===C)return document.createTextNode(k);n=document.createElementNS(a,C,k.is&&k),c&&(e.__m&&e.__m(i,r),c=!1),r=null}if(null===C)P===k||c&&n.data===k||(n.data=k);else{if(r=r&&t.call(n.childNodes),P=o.props||d,!c&&null!=r)for(P={},_=0;_<n.attributes.length;_++)P[(v=n.attributes[_]).name]=v.value;for(_ in P)if(v=P[_],"children"==_);else if("dangerouslySetInnerHTML"==_)f=v;else if(!(_ in k)){if("value"==_&&"defaultValue"in k||"checked"==_&&"defaultChecked"in k)continue;E(n,_,null,v,a)}for(_ in k)v=k[_],"children"==_?h=v:"dangerouslySetInnerHTML"==_?p=v:"value"==_?y=v:"checked"==_?b=v:c&&"function"!=typeof v||P[_]===v||E(n,_,v,P[_],a);if(p)c||f&&(p.__html===f.__html||p.__html===n.innerHTML)||(n.innerHTML=p.__html),i.__k=[];else if(f&&(n.innerHTML=""),N(n,m(h)?h:[h],i,o,s,"foreignObject"===C?"http://www.w3.org/1999/xhtml":a,r,l,r?r[0]:o.__k&&w(o,0),c,u),null!=r)for(_=r.length;_--;)g(r[_]);c||(_="value","progress"===C&&null==y?n.removeAttribute("value"):void 0!==y&&(y!==n[_]||"progress"===C&&!y||"option"===C&&y!==P[_])&&E(n,_,y,P[_],a),_="checked",void 0!==b&&b!==n[_]&&E(n,_,b,P[_],a))}return n}function j(t,n,i){try{if("function"==typeof t){var o="function"==typeof t.__u;o&&t.__u(),o&&null==n||(t.__u=t(n))}else t.current=n}catch(t){e.__e(t,i)}}function R(t,n,i){var o,s;if(e.unmount&&e.unmount(t),(o=t.ref)&&(o.current&&o.current!==t.__e||j(o,null,n)),null!=(o=t.__c)){if(o.componentWillUnmount)try{o.componentWillUnmount()}catch(t){e.__e(t,n)}o.base=o.__P=null}if(o=t.__k)for(s=0;s<o.length;s++)o[s]&&R(o[s],n,i||"function"!=typeof t.type);i||g(t.__e),t.__c=t.__=t.__e=t.__d=void 0}function W(t,e,n){return this.constructor(t,n)}function H(n,i,o){var s,a,r,l;e.__&&e.__(n,i),a=(s="function"==typeof o)?null:o&&o.__k||i.__k,r=[],l=[],D(i,n=(!s&&o||i).__k=h(y,null,[n]),a||d,d,i.namespaceURI,!s&&o?[o]:a?null:i.firstChild?t.call(i.childNodes):null,r,!s&&o?o:a?a.__e:i.firstChild,s,l),O(r,n,l)}t=_.slice,e={__e:function(t,e,n,i){for(var o,s,a;e=e.__;)if((o=e.__c)&&!o.__)try{if((s=o.constructor)&&null!=s.getDerivedStateFromError&&(o.setState(s.getDerivedStateFromError(t)),a=o.__d),null!=o.componentDidCatch&&(o.componentDidCatch(t,i||{}),a=o.__d),a)return o.__E=o}catch(e){t=e}throw t}},n=0,b.prototype.setState=function(t,e){var n;n=null!=this.__s&&this.__s!==this.state?this.__s:this.__s=f({},this.state),"function"==typeof t&&(t=t(f({},n),this.props)),t&&f(n,t),null!=t&&this.__v&&(e&&this._sb.push(e),k(this))},b.prototype.forceUpdate=function(t){this.__v&&(this.__e=!0,t&&this.__h.push(t),k(this))},b.prototype.render=y,i=[],s="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,a=function(t,e){return t.__v.__b-e.__v.__b},C.__r=0,r=0,l=L(!1),c=L(!0),u=0;var $,M,F,Q,q=0,B=[],X=e,V=X.__b,K=X.__r,G=X.diffed,z=X.__c,J=X.unmount,Y=X.__;function Z(t,e){X.__h&&X.__h(M,t,q||e),q=0;var n=M.__H||(M.__H={__:[],__h:[]});return t>=n.__.length&&n.__.push({}),n.__[t]}function tt(t){return q=1,et(pt,t)}function et(t,e,n){var i=Z($++,2);if(i.t=t,!i.__c&&(i.__=[n?n(e):pt(void 0,e),function(t){var e=i.__N?i.__N[0]:i.__[0],n=i.t(e,t);e!==n&&(i.__N=[n,i.__[1]],i.__c.setState({}))}],i.__c=M,!M.u)){var o=function(t,e,n){if(!i.__c.__H)return!0;var o=i.__c.__H.__.filter((function(t){return!!t.__c}));if(o.every((function(t){return!t.__N})))return!s||s.call(this,t,e,n);var a=!1;return o.forEach((function(t){if(t.__N){var e=t.__[0];t.__=t.__N,t.__N=void 0,e!==t.__[0]&&(a=!0)}})),!(!a&&i.__c.props===t)&&(!s||s.call(this,t,e,n))};M.u=!0;var s=M.shouldComponentUpdate,a=M.componentWillUpdate;M.componentWillUpdate=function(t,e,n){if(this.__e){var i=s;s=void 0,o(t,e,n),s=i}a&&a.call(this,t,e,n)},M.shouldComponentUpdate=o}return i.__N||i.__}function nt(t,e){var n=Z($++,3);!X.__s&&_t(n.__H,e)&&(n.__=t,n.i=e,M.__H.__h.push(n))}function it(t){return q=5,ot((function(){return{current:t}}),[])}function ot(t,e){var n=Z($++,7);return _t(n.__H,e)&&(n.__=t(),n.__H=e,n.__h=t),n.__}function st(t,e){return q=8,ot((function(){return t}),e)}function at(t){var e=M.context[t.__c],n=Z($++,9);return n.c=t,e?(null==n.__&&(n.__=!0,e.sub(M)),e.props.value):t.__}function rt(){for(var t;t=B.shift();)if(t.__P&&t.__H)try{t.__H.__h.forEach(ut),t.__H.__h.forEach(dt),t.__H.__h=[]}catch(e){t.__H.__h=[],X.__e(e,t.__v)}}X.__b=function(t){M=null,V&&V(t)},X.__=function(t,e){t&&e.__k&&e.__k.__m&&(t.__m=e.__k.__m),Y&&Y(t,e)},X.__r=function(t){K&&K(t),$=0;var e=(M=t.__c).__H;e&&(F===M?(e.__h=[],M.__h=[],e.__.forEach((function(t){t.__N&&(t.__=t.__N),t.i=t.__N=void 0}))):(e.__h.forEach(ut),e.__h.forEach(dt),e.__h=[],$=0)),F=M},X.diffed=function(t){G&&G(t);var e=t.__c;e&&e.__H&&(e.__H.__h.length&&(1!==B.push(e)&&Q===X.requestAnimationFrame||((Q=X.requestAnimationFrame)||ct)(rt)),e.__H.__.forEach((function(t){t.i&&(t.__H=t.i),t.i=void 0}))),F=M=null},X.__c=function(t,e){e.some((function(t){try{t.__h.forEach(ut),t.__h=t.__h.filter((function(t){return!t.__||dt(t)}))}catch(n){e.some((function(t){t.__h&&(t.__h=[])})),e=[],X.__e(n,t.__v)}})),z&&z(t,e)},X.unmount=function(t){J&&J(t);var e,n=t.__c;n&&n.__H&&(n.__H.__.forEach((function(t){try{ut(t)}catch(t){e=t}})),n.__H=void 0,e&&X.__e(e,n.__v))};var lt="function"==typeof requestAnimationFrame;function ct(t){var e,n=function(){clearTimeout(i),lt&&cancelAnimationFrame(e),setTimeout(t)},i=setTimeout(n,100);lt&&(e=requestAnimationFrame(n))}function ut(t){var e=M,n=t.__c;"function"==typeof n&&(t.__c=void 0,n()),M=e}function dt(t){var e=M;t.__c=t.__(),M=e}function _t(t,e){return!t||t.length!==e.length||e.some((function(e,n){return e!==t[n]}))}function pt(t,e){return"function"==typeof e?e(t):e}const mt=function(t,e=!1){return MgUpcTexts&&MgUpcTexts[t]?e?e.reduce((function(t,e){return t.replace(/%s/,e)}),MgUpcTexts[t]):MgUpcTexts[t]:t},ft="ui/reset",gt="ui/error",ht="ui/message",vt="ui/editing",yt="listOfLists/set",bt="listOfLists/remove",wt="listOfLists/create",Pt="listOfList/addingPost",kt="listOfList/setPage",Ct="listOfList/setTotalPages",Nt="list/set",xt="list/update",St="list/setPage",It="list/setTotalPages",Tt="list/setItems",At="list/removeItem",Et="list/addItem",Lt="list/updateItem",Dt="list/moveItem",Ot="list/moveItemNext",Ut="list/moveItemPrev",jt="list/cart",Rt=async function(t,e="",n={},i="mg-upc/v1/lists"){if(void 0===Qt().nonce){const t=new FormData;t.append("action","mg_upc_user");const e={method:"POST",credentials:"same-origin",referrerPolicy:"no-referrer",body:t},n=await fetch(Qt().ajaxUrl,e),i=await n.json();i.nonce&&(Qt().nonce=i.nonce),i.user_id&&(Qt().user_id=i.user_id)}const o={method:t,credentials:"same-origin",headers:{"Content-Type":"application/json","X-WP-Nonce":Qt().nonce},referrerPolicy:"no-referrer"};"GET"!==t&&n&&(o.body=JSON.stringify(n));const s=await fetch(Qt().root+i+e,o);return s.headers.get("x-wp-nonce")&&(Qt().nonce=s.headers.get("x-wp-nonce")),{data:await s.json(),headers:s.headers,status:s.status}};function Wt(t){const e=Object.entries(t).filter((([,t])=>null!=t)).map((([t,e])=>`${encodeURIComponent(t)}=${encodeURIComponent(String(e))}`)),n=-1!==Qt().root.indexOf("?")?"&":"?";return e.length>0?`${n}${e.join("&")}`:""}class Ht extends Error{constructor(t,e){super(t),this.name="MgApiError",this.code=e?.data?.code,this.response=e}}function $t(t){let e=t?.data?.data?.status;if(!e&&t.status&&(e=t.status),400===e||401===e||403===e||404===e||409===e||500===e)throw new Ht(t?.data?.message,t)}let Mt={my:function(t={}){return Rt("GET","/My"+Wt(t),{}).then((function(t){return $t(t),t}))},discover:function(t){return Rt("GET","/"+Wt(t),{}).then((function(t){return $t(t),t}))},get:function(t){return Rt("GET","/"+t,{}).then((function(t){return $t(t),t}))},cart:function(t){return Rt("POST","/cart",{list:t},"mg-upc/v1").then((function(t){return $t(t),t}))},items:function(t,e={}){return Rt("GET","/"+t+"/items"+Wt(e),{}).then((function(t){return $t(t),t}))},delete:function(t){return Rt("DELETE","/"+t,{}).then((function(t){return $t(t),t}))},create:function(t){return Rt("POST","",t).then((function(t){return $t(t),t}))},update:function(t){let e=t.id;return delete t.id,Rt("PATCH","/"+e,t).then((function(t){return $t(t),t}))},add:function(t,e,n={}){return"object"!=typeof e&&(e={post_id:e}),Rt("POST","/"+t+"/items"+Wt(n),e).then((function(t){return $t(t),t}))},quit:function(t,e,n={}){return Rt("DELETE","/"+t+"/items/"+e+Wt(n),{}).then((function(t){return $t(t),t}))},updateItem:function(t,e,n){return Rt("PATCH","/"+t+"/items/"+e,n).then((function(t){return $t(t),t}))},vote:function(t,e,n={}){return Rt("POST","/"+t+"/items/"+e+"/vote",n).then((function(t){return $t(t),t}))},move:function(t,e,n){return Rt("PATCH","/"+t+"/items/"+e,{position:n}).then((function(t){return $t(t),t}))}};const Ft=Mt;function Qt(){return MgUserPostCollections}function qt(){return Qt()?.sortable}function Bt(t){const e=Qt()?.types;return!(!e||!e[t])&&e[t]}function Xt(t){const e=Qt()?.statuses;return!(!e||!e[t])&&e[t]}function Vt(t,e){return!!t.type&&Gt(t.type,e)}function Kt(t){const e=[],n=Qt()?.types;for(const i in n)n.hasOwnProperty(i)&&(Gt(i,"always_exists")||(t?.type?n[i].available_post_types.includes(t.type)&&e.push(n[i]):e.push(n[i])));return e}function Gt(t,e){const n=Bt(t);return!(!n||!n.supports)&&n.supports.includes(e)}const zt="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVQYV2NgYAAAAAMAAWgmWQ0AAAAASUVORK5CYII=";function Jt(t){return JSON.parse(JSON.stringify(t))}function Yt(t){return"string"!=typeof t?"":t.replace(/([^>\r\n]?)(\r\n|\n\r|\r|\n)/g,"$1<br>$2")}function Zt(t){return Ft.cart(t).then((t=>(jQuery&&t.data.fragments&&t.data.cart_hash&&jQuery(document.body).trigger("added_to_cart",[t.data.fragments,t.data.cart_hash]),t.data)))}function te(t,e="error"){if(!jQuery)return!1;const n=jQuery("<div>").addClass("mg-upc-alert mg-upc-alert-"+e);n.append(jQuery("<p>").html(t));const i=jQuery('<a class="mg-upc-alert-close" href="#"><span class="mg-upc-icon upc-font-close"></span></a>').on("click",(function(){return n.remove(),!1}));return n.append(i),n}function ee(t,e){const{type:n,payload:i}=e;let o=!1;const s=t=>(o=a({status:"failed"}),t.error&&(o.error=t.error.message?t.error.message:"",o.errorCode=t.error.code?t.error.code:""),o),a=(e=null)=>{if(o||(o=Jt(t)),e)for(const t in e)e.hasOwnProperty(t)&&(o[t]=e[t]);return o},r=(t,e=0,n="succeeded")=>(0!==e&&(t.loadingCount=t.loadingCount+e),t.loadingCount<1?(t.loadingCount=0,t.status=n):t.status="loading",t);let l=function(t,e){const{type:n,payload:i}=e;let o,s;const a=(e=!1)=>{if(s||(s=!1===t?{}:Jt(t)),e)for(const t in e)s[t]=e[t];return s};switch(n){case Nt:return!0===i?{ID:-1,title:"",content:"",status:"",type:""}:i;case xt:return i.items=Jt(t.items),i;case wt:return i;case Tt:return a({items:i});case Et+"/failed":case Et:return i?.list?a(i.list):t;case Lt:const e=!!i.item&&i.item;return o=a().items.map((t=>t.post_id===i.post_id?e||Object.assign({},t,i):{...t})),a({items:o});case At:if(!t.items||1===t.items.length||!1===i)return t;if(s=a(),o=s.items.filter((t=>t.post_id!==i)),Gt(t.type,"sortable")){const e=parseInt(t.items[0].position,10);o.forEach(((t,n)=>{o[n].position=e+n}))}if(s.count=s.count-1,Gt(t.type,"vote")){const e=t.items.find((t=>t.post_id==i));e&&(s.vote_counter=s.vote_counter-e.votes)}return{...s,items:o};case Dt:const n=parseInt(t.items[0].position,10);o=a().items.slice();const r=a().items[i.oldIndex];return o.splice(i.oldIndex,1),o.splice(i.newIndex,0,r),isNaN(n)?(alert("positions error!"),t):(o.forEach(((t,e)=>{o[e].position=n+e})),a({items:o}));default:return t}}(t.list,e),c=function(t,e){const{type:n,payload:i}=e;switch(n){case yt:return i;case Et:case Nt:return!1;case bt:return!1===i?t:Jt(t.filter((t=>t.ID!=i)));default:return t}}(t.listOfList,e);switch(t.list===l&&c===t.listOfList||(o=a({listOfList:c,list:l}),t.addingPost||(o.title=o.list?o.list.title:se.title)),n){case"ui/mode":return a({mode:i});case ft:return{...se,mode:t.mode};case gt:return a(!1===i?{error:!1,errorCode:!1}:{error:i});case ht:return a(!1===i?{message:!1,errorCode:!1}:{message:i});case jt:const n=a();return i.msg&&(n.message=i.msg),i.err&&(n.error=i.err),n;case vt:return a({editing:i});case Pt:return o=a(),o.addingPost=i,i&&(o.title=mt("Add to...")),o;case wt:o=a(),o.title=i.title?i.title:se.title,o.listTotalPages=1,o.listPage=1,o.addingPost=!1;break;case Et:if(o=a(),i?.list){const t=i.list;o.title=t.title?t.title:se.title;const e=t?.items_page;e&&(o.listTotalPages=e["X-WP-TotalPages"]?e["X-WP-TotalPages"]:1,o.listPage=e["X-WP-Page"]?e["X-WP-Page"]:1)}i.message&&(o=r(o,-1,"failed"),o.error=i.message),o.addingPost=!1;break;case kt:return a({page:i});case Ct:return a({totalPages:i});case St:return a({listPage:i});case It:return a({listTotalPages:i});case Nt+"/loading":return o=r(a(),1),o.listOfList=!1,"object"==typeof i?(o.list=i,i.title&&(o.title=i.title)):o.list={ID:i},o;case At+"/loading":return o=r(a(),1),"object"==typeof i&&i.list_id&&(o.list={ID:i.list_id}),o;case yt+"/loading":case Tt+"/loading":case Lt+"/loading":case Et+"/loading":case Ot+"/loading":case Ut+"/loading":case xt+"/loading":case wt+"/loading":case jt+"/loading":return r(a(),1);case Et+"/succeeded":return o=r(a(),-1),o.addingPost=!1,o.status="succeeded",o.error=!1,o.errorCode=!1,o.title=o.list?o.list.title:se.title,o;case jt+"/succeeded":return r(a({errorCode:!1}),-1);case Nt+"/succeeded":var u={error:!1,errorCode:!1};return!1===t.list&&(u={}),r(a(u),-1);case yt+"/succeeded":case Tt+"/succeeded":case Lt+"/succeeded":case At+"/succeeded":case Dt+"/succeeded":case Ot+"/succeeded":case Ut+"/succeeded":case xt+"/succeeded":case wt+"/succeeded":return r(a({error:!1,errorCode:!1}),-1);case wt+"/failed":return o=r(a(),-1,"failed"),e.error&&e.error.message&&(o.error=e.error.message),o;case Et+"/failed":if(o=r(a(),-1),o.addingPost=!1,o.title=o.list?o.list.title:se.title,i?.list){const t=i.list;o.title=t.title?t.title:se.title;const e=t?.items_page;e&&(o.listTotalPages=e["X-WP-TotalPages"]?e["X-WP-TotalPages"]:1,o.listPage=e["X-WP-Page"]?e["X-WP-Page"]:1)}return i.message&&(o.error=i.message,o.status="failed"),s(e);case yt+"/failed":case Tt+"/failed":case Lt+"/failed":case At+"/failed":case Dt+"/failed":case Ot+"/failed":case Ut+"/failed":case xt+"/failed":case Nt+"/failed":case jt+"/failed":return r(s(e),-1)}return!1!==o?o:t}const ne=(t,e)=>function(n=null,...i){return{asyncThunk:!0,payload:e,type:t,arg:n,extra:i}};class ie extends Error{constructor(t,e){super(t),this.name="MgUpcRejectWithValue",this.value=e}}const oe=(t,e)=>n=>{let i;if((o=n)&&"object"==typeof o&&!0===o.asyncThunk){let o={dispatch:oe(t,e),getState:e,extra:n.extra,rejectWithValue:t=>new ie(n.type+": rejectWithValue",t)};t({type:n.type+"/loading",payload:n.arg}),i=n.payload(n.arg,o)}else{if(!(t=>!!t&&("object"==typeof t||"function"==typeof t)&&"function"==typeof t.then)(n.payload))return void t(n);t({type:n.type+"/loading"}),i=n.payload}var o;i.then((e=>{e instanceof ie?t({type:n.type+"/failed",payload:e.value}):(t({type:n.type,payload:e}),t({type:n.type+"/succeeded"}))})).catch((e=>{t(e instanceof ie?{type:n.type+"/failed",payload:e.value}:{type:n.type+"/failed",error:e})}))},se={list:!1,listOfList:!1,addingPost:null,status:"idle",loadingCount:0,error:null,message:null,errorCode:null,editing:!1,title:mt("My Lists"),actualAction:"init",page:1,totalPages:1,listPage:1,listTotalPages:1,mode:"my"},ae=function(t,e){var n={__c:e="__cC"+u++,__:t,Consumer:function(t,e){return t.children(e)},Provider:function(t){var n,i;return this.getChildContext||(n=new Set,(i={})[e]=this,this.getChildContext=function(){return i},this.componentWillUnmount=function(){n=null},this.shouldComponentUpdate=function(t){this.props.value!==t.value&&n.forEach((function(t){t.__e=!0,k(t)}))},this.sub=function(t){n.add(t);var e=t.componentWillUnmount;t.componentWillUnmount=function(){n&&n.delete(t),e&&e.call(t)}}),t.children}};return n.Provider.__=n.Consumer.contextType=n}({});function re(t){return new Date(t).toLocaleDateString()}const le=function(t){const{state:e,dispatch:n}=at(ae);return h("li",{className:"mg-upc-dg-item-list",onClick:t.onClick,onKeyPress:e=>{13===e.keyCode&&t.onClick(e)},tabIndex:"0"},h("i",{className:"mg-upc-icon mg-upc-dg-item-type mg-upc-dg-item-type-"+t.list.type}),h("div",{className:"mg-upc-dg-item-title"},h("span",null,t.list.title),"my"!==e.mode&&h(y,null,h("span",null,h("a",{href:"#",onClick:function(e){!function(t){t.stopImmediatePropagation&&t.stopImmediatePropagation(),t.stopPropagation&&t.stopPropagation(),t.preventDefault()}(e),function(t,e){const n=new URLSearchParams(document.location.hash.substring(1));n.set("author",e);let i=n.toString();""!==i&&(i="#"+i),window.location.hash=i}(0,t.list.author)}},t.list.user_login),h("span",{className:"mg-upc-list-dates"},h("i",null," ",h("b",null,"Created:")," ",re(t.list.created)),h("i",null," ",h("b",null,"Modified:")," ",re(t.list.modified)))))),h("span",{className:"mg-upc-dg-item-count"},t.list.count),h("span",{className:"mg-upc-dg-item-actions"},t.onRemove&&h("button",{"aria-label":mt("Remove List"),onClick:e=>{e.stopPropagation(),t.onRemove(t.list)}},h("span",{className:"mg-upc-icon upc-font-trash"}))))};class ce extends b{static defaultProps={count:1,duration:1.2,width:null,wrapper:null,height:null,circle:!1};render(){const t=[];for(let e=0;e<this.props.count;e++){let n=this.props.styles?this.props.styles:{};null!=this.props.width&&(n.width=this.props.width),null!=this.props.height&&(n.height=this.props.height),null!==this.props.width&&null!==this.props.height&&this.props.circle&&(n.borderRadius="50%"),t.push(h("span",{key:e,className:"mg-upc-dg-loading-skeleton",style:n},""))}const e=this.props.wrapper;return h("span",null,e?t.map(((t,n)=>h(e,{key:n},t,""))):t)}}const ue=function(t){return h("div",{className:"mg-upc-dg-pagination-div"},h("button",{className:1===t.page?"mg-upc-dg-hidden mg-upc-dg-pagination":"mg-upc-dg-pagination",ref:t.prevRef,disabled:1===t.page,"aria-label":mt("Previous page"),title:mt("Previous page"),onClick:t.onPreview},h("span",{className:"mg-upc-icon upc-font-arrow_left"})),h("span",{className:t.totalPages>1?"mg-upc-dg-pagination-current":"mg-upc-dg-hidden mg-upc-dg-pagination-current"},t.page),h("button",{className:t.page>=t.totalPages?"mg-upc-dg-hidden mg-upc-dg-pagination":"mg-upc-dg-pagination",ref:t.nextRef,disabled:t.page>=t.totalPages,"aria-label":mt("Next page"),title:mt("Next page"),onClick:t.onNext},h("span",{className:"mg-upc-icon upc-font-arrow_right"})))},de=()=>({type:ft,payload:null}),_e=t=>({type:Pt,payload:t}),pe=t=>({type:vt,payload:t}),me=ne(jt,(async function(t,e){return await Zt(t)})),fe=ne(yt,(async function(t,e){const n=t?.addingPost;return null===t&&(t={}),t.addingPost?t.adding=t.addingPost:(t.adding="",delete t.adding),await Ft.my(t).then((t=>ge(t,e,n)))}));function ge(t,e,n){if(t.headers.get("x-wp-page")&&(e.dispatch(ve(parseInt(t.headers.get("x-wp-page"),10))),e.dispatch(ye(parseInt(t.headers.get("X-WP-TotalPages"),10)))),n&&t.headers.get("X-WP-Post-Type")){const i={post_id:n},o={"X-WP-Post-Type":"type","X-WP-Post-Title":"title","X-WP-Post-Image":"image"};for(const e in o){const n=t.headers.get(e);n&&(i[o[e]]=decodeURIComponent(n))}e.dispatch(_e(i))}return t.data}ne(yt,(async function(t,e){return null===t&&(t={}),await Ft.discover(t).then((t=>ge(t,e,!1)))}));const he=ne(bt,(async function(t,e){return await Ft.delete(t).then((n=>{if(1===e.getState().listOfList.length){const n=e.getState().page,i=e.getState().totalPages;if(n<i)e.dispatch(fe({page:n}));else{if(!(n>1&&n===i))return t;e.dispatch(fe({page:n-1}))}return!1}return t}))})),ve=t=>({type:kt,payload:t}),ye=t=>({type:Ct,payload:t}),be=t=>({type:St,payload:t}),we=t=>({type:It,payload:t}),Pe=ne(Nt,(async function(t,e){return!1===t||!0===t?t:await Ft.get("object"==typeof t?t.ID:t).then((t=>(Le(t,e.dispatch),t.data)))})),ke=ne(xt,(async function(t,e){return await Ft.update(t).then((t=>(e.dispatch(pe(!1)),Le(t,e.dispatch),t.data)))})),Ce=ne(wt,(async function(t,e){return null===t&&(t={}),t.adding&&t.adding!==e.getState().addingPost&&e.dispatch(_e({id:t.addingPost})),await Ft.create(t).then((t=>(e.dispatch(pe(!1)),Le(t,e.dispatch),t.data)))})),Ne=ne(Tt,(async function(t,e){return await Ft.items(e.getState().list.ID,t).then((t=>(Le(t,e.dispatch),t.data)))})),xe=ne(At,(async function(t,e){const n=e.getState();var i=e.extra.length>0?e.extra[0]:n.list.ID;const o=e.extra.length>1?e.extra[1]:"view";return await Ft.quit(i,t,{context:o}).then((s=>{if(s.data&&s.data.list_id&&(i=s.data.list_id),n.list&&n.list.ID)if(1===n.list.items.length){if(n.list&&"view"===o){const t=n.listPage,i=n.listTotalPages;return t<i?e.dispatch(Ne({page:t})):t===i&&e.dispatch(Ne({page:Math.max(1,t-1)})),!1}}else n.list&&"view"===o&&n.listTotalPages===n.listPage+1&&n.list.count%n.list.items.length==1&&e.dispatch(Ne({page:n.listPage}));else e.dispatch(Pe({ID:i}));return t}))})),Se=ne(Et,(async function(t,e){let n=e.extra[0],i=!1;try{await Ft.add(t,n,{context:e.extra.length>1?e.extra[1]:"view"}).then((t=>{i=t.data}))}catch(t){const n=t?.response?.data;i=e.rejectWithValue(n)}return i})),Ie=ne(Lt,(async function(t,e){const n=e.extra[0];return await Ft.updateItem(e.getState().list.ID,t,n).then((e=>({...n,post_id:t,item:e?.data?.item})))})),Te=ne(Dt,(async function(t,e){const n=e.extra[0],i=e.extra[1],o=n.items[t],s=o.position-t+i;return await Ft.move(n.ID,o.post_id,s).then((e=>({oldIndex:t,newIndex:i})))})),Ae=ne(Ot,(async function(t,e){const n=e.getState().list,i=parseInt(n.items[n.items.length-1].position,10);if(isNaN(i))throw alert("positions error!"),"positions error!";const o=n.items[t];return await Ft.move(n.ID,o.post_id,i+1),await e.dispatch(Ne({page:e.getState().listPage})),t})),Ee=ne(Ut,(async function(t,e){const n=e.getState().list,i=parseInt(n.items[0].position,10);if(isNaN(i))throw alert("positions error!"),"positions error!";const o=n.items[t];return await Ft.move(n.ID,o.post_id,i-1),await e.dispatch(Ne({page:e.getState().listPage})),t}));function Le(t,e){!t.data.items_page&&t.headers.get("x-wp-page")?(e(be(parseInt(t.headers.get("x-wp-page"),10))),e(we(parseInt(t.headers.get("X-WP-TotalPages"),10)))):t.data.items_page&&(e(be(parseInt(t.data.items_page["X-WP-Page"],10))),e(we(parseInt(t.data.items_page["X-WP-TotalPages"],10))))}const De=function(t){const{state:e,dispatch:n}=at(ae);return h(y,null,h("ul",{className:"mg-upc-dg-list-of-lists-fake mg-upc-dg-on-loading"},[0,1,2].map((t=>h("li",{className:"mg-upc-dg-item-list"},h("div",null,h(ce,{width:"1.5em",height:"1.5em"})),h("div",{className:"mg-upc-dg-item-title"},h(ce,null)),h("div",{className:"mg-upc-dg-item-count"},h(ce,null)))))),h("ul",{className:"mg-upc-dg-list-of-lists"},t.lists&&t.lists.map((e=>h(le,{list:e,onClick:()=>t.onSelect(e),onRemove:t.onRemove,key:e.ID})))),e.totalPages>1&&h(ue,{totalPages:e.totalPages,page:e.page,onPreview:t.loadPreview,onNext:t.loadNext}))},Oe=function(t){const[e,n]=tt(!1),[i,o]=tt(""),s=it({});nt((()=>{o(t.item.description)}),[t.item]),nt((()=>{e&&s.current.focus()}),[e]);const a=()=>"string"==typeof i&&i.length>0;return h(y,null,h("span",null,h("br",null),"Adding item:"),h("div",{className:"mg-upc-dg-item mg-upc-dg-item-adding","data-post_id":t.item.post_id},h("span",{className:"mg-upc-icon upc-font-add"}),h("span",null," "),h("img",{className:"mg-upc-dg-item-image",src:t.item.image?t.item.image:zt}),h("div",{className:"mg-upc-dg-item-data"},h("a",{href:t.item?.link},t.item?.title),!e&&h("p",null,t.item?.description),!e&&h("button",{onClick:()=>{n(!0)}},a()&&h("span",null,mt("Edit Comment")),!a()&&h("span",null,mt("Add Comment"))),h("input",{ref:s,className:e?"mg-upc-dg-btn-item-desc":"mg-upc-dg-dn",type:"text",value:i,onChange:function(t){o(t.target.value)},onKeyDown:e=>{"Enter"===e.key&&(n(!1),t.onSaveItemDescription(i))},maxLength:400}),e&&h("button",{className:"mg-upc-dg-btn-item-desc-cancel",onClick:()=>{n(!1),o(t.item.description)}},h("span",{className:"mg-upc-icon upc-font-close"}),h("span",null,mt("Cancel"))),e&&h("button",{className:"mg-upc-dg-btn-item-desc-save",onClick:()=>{n(!1),t.onSaveItemDescription(i)}},h("span",{className:"mg-upc-icon upc-font-save"}),h("span",null,mt("Save"))))),h("span",null,mt("Select where the item will be added:")))};function Ue(){return Ue=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)({}).hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},Ue.apply(null,arguments)}function je(t,e){for(var n in t)if("__source"!==n&&!(n in e))return!0;for(var i in e)if("__source"!==i&&t[i]!==e[i])return!0;return!1}function Re(t,e){this.props=t,this.context=e}(Re.prototype=new b).isPureReactComponent=!0,Re.prototype.shouldComponentUpdate=function(t,e){return je(this.props,t)||je(this.state,e)};var We=e.__b;e.__b=function(t){t.type&&t.type.__f&&t.ref&&(t.props.ref=t.ref,t.ref=null),We&&We(t)},"undefined"!=typeof Symbol&&Symbol.for&&Symbol.for("react.forward_ref");var He=e.__e;e.__e=function(t,e,n,i){if(t.then)for(var o,s=e;s=s.__;)if((o=s.__c)&&o.__c)return null==e.__e&&(e.__e=n.__e,e.__k=n.__k),o.__c(t,e);He(t,e,n,i)};var $e=e.unmount;function Me(t,e,n){return t&&(t.__c&&t.__c.__H&&(t.__c.__H.__.forEach((function(t){"function"==typeof t.__c&&t.__c()})),t.__c.__H=null),null!=(t=function(t,e){for(var n in e)t[n]=e[n];return t}({},t)).__c&&(t.__c.__P===n&&(t.__c.__P=e),t.__c=null),t.__k=t.__k&&t.__k.map((function(t){return Me(t,e,n)}))),t}function Fe(t,e,n){return t&&n&&(t.__v=null,t.__k=t.__k&&t.__k.map((function(t){return Fe(t,e,n)})),t.__c&&t.__c.__P===e&&(t.__e&&n.appendChild(t.__e),t.__c.__e=!0,t.__c.__P=n)),t}function Qe(){this.__u=0,this.t=null,this.__b=null}function qe(t){var e=t.__.__c;return e&&e.__a&&e.__a(t)}function Be(){this.u=null,this.o=null}e.unmount=function(t){var e=t.__c;e&&e.__R&&e.__R(),e&&32&t.__u&&(t.type=null),$e&&$e(t)},(Qe.prototype=new b).__c=function(t,e){var n=e.__c,i=this;null==i.t&&(i.t=[]),i.t.push(n);var o=qe(i.__v),s=!1,a=function(){s||(s=!0,n.__R=null,o?o(r):r())};n.__R=a;var r=function(){if(! --i.__u){if(i.state.__a){var t=i.state.__a;i.__v.__k[0]=Fe(t,t.__c.__P,t.__c.__O)}var e;for(i.setState({__a:i.__b=null});e=i.t.pop();)e.forceUpdate()}};i.__u++||32&e.__u||i.setState({__a:i.__b=i.__v.__k[0]}),t.then(a,a)},Qe.prototype.componentWillUnmount=function(){this.t=[]},Qe.prototype.render=function(t,e){if(this.__b){if(this.__v.__k){var n=document.createElement("div"),i=this.__v.__k[0].__c;this.__v.__k[0]=Me(this.__b,n,i.__O=i.__P)}this.__b=null}var o=e.__a&&h(y,null,t.fallback);return o&&(o.__u&=-33),[h(y,null,e.__a?null:t.children),o]};var Xe=function(t,e,n){if(++n[1]===n[0]&&t.o.delete(e),t.props.revealOrder&&("t"!==t.props.revealOrder[0]||!t.o.size))for(n=t.u;n;){for(;n.length>3;)n.pop()();if(n[1]<n[0])break;t.u=n=n[2]}};function Ve(t){return this.getChildContext=function(){return t.context},t.children}function Ke(t){var e=this,n=t.i;e.componentWillUnmount=function(){H(null,e.l),e.l=null,e.i=null},e.i&&e.i!==n&&e.componentWillUnmount(),e.l||(e.i=n,e.l={nodeType:1,parentNode:n,childNodes:[],contains:function(){return!0},appendChild:function(t){this.childNodes.push(t),e.i.appendChild(t)},insertBefore:function(t,n){this.childNodes.push(t),e.i.appendChild(t)},removeChild:function(t){this.childNodes.splice(this.childNodes.indexOf(t)>>>1,1),e.i.removeChild(t)}}),H(h(Ve,{context:e.context},t.__v),e.l)}(Be.prototype=new b).__a=function(t){var e=this,n=qe(e.__v),i=e.o.get(t);return i[0]++,function(o){var s=function(){e.props.revealOrder?(i.push(o),Xe(e,t,i)):o()};n?n(s):s()}},Be.prototype.render=function(t){this.u=null,this.o=new Map;var e=I(t.children);t.revealOrder&&"b"===t.revealOrder[0]&&e.reverse();for(var n=e.length;n--;)this.o.set(e[n],this.u=[1,0,this.u]);return t.children},Be.prototype.componentDidUpdate=Be.prototype.componentDidMount=function(){var t=this;this.o.forEach((function(e,n){Xe(t,n,e)}))};var Ge="undefined"!=typeof Symbol&&Symbol.for&&Symbol.for("react.element")||60103,ze=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image(!S)|letter|lighting|marker(?!H|W|U)|overline|paint|pointer|shape|stop|strikethrough|stroke|text(?!L)|transform|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/,Je=/^on(Ani|Tra|Tou|BeforeInp|Compo)/,Ye=/[A-Z0-9]/g,Ze="undefined"!=typeof document,tn=function(t){return("undefined"!=typeof Symbol&&"symbol"==typeof Symbol()?/fil|che|rad/:/fil|che|ra/).test(t)};b.prototype.isReactComponent={},["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach((function(t){Object.defineProperty(b.prototype,t,{configurable:!0,get:function(){return this["UNSAFE_"+t]},set:function(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:e})}})}));var en=e.event;function nn(){}function on(){return this.cancelBubble}function sn(){return this.defaultPrevented}e.event=function(t){return en&&(t=en(t)),t.persist=nn,t.isPropagationStopped=on,t.isDefaultPrevented=sn,t.nativeEvent=t};var an={enumerable:!1,configurable:!0,get:function(){return this.class}},rn=e.vnode;e.vnode=function(t){"string"==typeof t.type&&function(t){var e=t.props,n=t.type,i={},o=-1===n.indexOf("-");for(var s in e){var a=e[s];if(!("value"===s&&"defaultValue"in e&&null==a||Ze&&"children"===s&&"noscript"===n||"class"===s||"className"===s)){var r=s.toLowerCase();"defaultValue"===s&&"value"in e&&null==e.value?s="value":"download"===s&&!0===a?a="":"translate"===r&&"no"===a?a=!1:"o"===r[0]&&"n"===r[1]?"ondoubleclick"===r?s="ondblclick":"onchange"!==r||"input"!==n&&"textarea"!==n||tn(e.type)?"onfocus"===r?s="onfocusin":"onblur"===r?s="onfocusout":Je.test(s)&&(s=r):r=s="oninput":o&&ze.test(s)?s=s.replace(Ye,"-$&").toLowerCase():null===a&&(a=void 0),"oninput"===r&&i[s=r]&&(s="oninputCapture"),i[s]=a}}"select"==n&&i.multiple&&Array.isArray(i.value)&&(i.value=I(e.children).forEach((function(t){t.props.selected=-1!=i.value.indexOf(t.props.value)}))),"select"==n&&null!=i.defaultValue&&(i.value=I(e.children).forEach((function(t){t.props.selected=i.multiple?-1!=i.defaultValue.indexOf(t.props.value):i.defaultValue==t.props.value}))),e.class&&!e.className?(i.class=e.class,Object.defineProperty(i,"className",an)):(e.className&&!e.class||e.class&&e.className)&&(i.class=i.className=e.className),t.props=i}(t),t.$$typeof=Ge,rn&&rn(t)};var ln=e.__r;e.__r=function(t){ln&&ln(t),t.__c};var cn=e.diffed;e.diffed=function(t){cn&&cn(t);var e=t.props,n=t.__e;null!=n&&"textarea"===t.type&&"value"in e&&e.value!==n.value&&(n.value=null==e.value?"":e.value)};var un=['a[href]:not([tabindex^="-"])','area[href]:not([tabindex^="-"])','input:not([type="hidden"]):not([type="radio"]):not([disabled]):not([tabindex^="-"])','input[type="radio"]:not([disabled]):not([tabindex^="-"])','select:not([disabled]):not([tabindex^="-"])','textarea:not([disabled]):not([tabindex^="-"])','button:not([disabled]):not([tabindex^="-"])','iframe:not([tabindex^="-"])','audio[controls]:not([tabindex^="-"])','video[controls]:not([tabindex^="-"])','[contenteditable]:not([tabindex^="-"])','[tabindex]:not([tabindex^="-"])'];function dn(t){this._show=this.show.bind(this),this._hide=this.hide.bind(this),this._maintainFocus=this._maintainFocus.bind(this),this._bindKeypress=this._bindKeypress.bind(this),this.$el=t,this.shown=!1,this._id=this.$el.getAttribute("data-a11y-dialog")||this.$el.id,this._previouslyFocused=null,this._listeners={},this.create()}function _n(t,e){return n=(e||document).querySelectorAll(t),Array.prototype.slice.call(n);var n}function pn(t){(t.querySelector("[autofocus]")||t).focus()}function mn(){_n("[data-a11y-dialog]").forEach((function(t){new dn(t)}))}dn.prototype.create=function(){this.$el.setAttribute("aria-hidden",!0),this.$el.setAttribute("aria-modal",!0),this.$el.setAttribute("tabindex",-1),this.$el.hasAttribute("role")||this.$el.setAttribute("role","dialog"),this._openers=_n('[data-a11y-dialog-show="'+this._id+'"]'),this._openers.forEach(function(t){t.addEventListener("click",this._show)}.bind(this));const t=this.$el;return this._closers=_n("[data-a11y-dialog-hide]",this.$el).filter((function(e){return e.closest('[aria-modal="true"], [data-a11y-dialog]')===t})).concat(_n('[data-a11y-dialog-hide="'+this._id+'"]')),this._closers.forEach(function(t){t.addEventListener("click",this._hide)}.bind(this)),this._fire("create"),this},dn.prototype.show=function(t){if(this.shown)return this;this._previouslyFocused=document.activeElement;const e=t&&t.target?t.target:null;return e&&Object.is(this._previouslyFocused,document.body)&&(this._previouslyFocused=e),this.$el.removeAttribute("aria-hidden"),this.shown=!0,pn(this.$el),document.body.addEventListener("focus",this._maintainFocus,!0),document.addEventListener("keydown",this._bindKeypress),this._fire("show",t),this},dn.prototype.hide=function(t){return this.shown?(this.shown=!1,this.$el.setAttribute("aria-hidden","true"),this._previouslyFocused&&this._previouslyFocused.focus&&this._previouslyFocused.focus(),document.body.removeEventListener("focus",this._maintainFocus,!0),document.removeEventListener("keydown",this._bindKeypress),this._fire("hide",t),this):this},dn.prototype.destroy=function(){return this.hide(),this._openers.forEach(function(t){t.removeEventListener("click",this._show)}.bind(this)),this._closers.forEach(function(t){t.removeEventListener("click",this._hide)}.bind(this)),this._fire("destroy"),this._listeners={},this},dn.prototype.on=function(t,e){return void 0===this._listeners[t]&&(this._listeners[t]=[]),this._listeners[t].push(e),this},dn.prototype.off=function(t,e){var n=(this._listeners[t]||[]).indexOf(e);return n>-1&&this._listeners[t].splice(n,1),this},dn.prototype._fire=function(t,e){var n=this._listeners[t]||[],i=new CustomEvent(t,{detail:e});this.$el.dispatchEvent(i),n.forEach(function(t){t(this.$el,e)}.bind(this))},dn.prototype._bindKeypress=function(t){const e=document.activeElement;e&&e.closest('[aria-modal="true"]')!==this.$el||(this.shown&&"Escape"===t.key&&"alertdialog"!==this.$el.getAttribute("role")&&(t.preventDefault(),this.hide(t)),this.shown&&"Tab"===t.key&&function(t,e){var n=function(t){return _n(un.join(","),t).filter((function(t){return!!(t.offsetWidth||t.offsetHeight||t.getClientRects().length)}))}(t),i=n.indexOf(document.activeElement);e.shiftKey&&0===i?(n[n.length-1].focus(),e.preventDefault()):e.shiftKey||i!==n.length-1||(n[0].focus(),e.preventDefault())}(this.$el,t))},dn.prototype._maintainFocus=function(t){!this.shown||t.target.closest('[aria-modal="true"]')||t.target.closest("[data-a11y-dialog-ignore-focus-trap]")||pn(this.$el)},"undefined"!=typeof document&&("loading"===document.readyState?document.addEventListener("DOMContentLoaded",mn):window.requestAnimationFrame?window.requestAnimationFrame(mn):window.setTimeout(mn,16));const fn=t=>{const e=(()=>{const[t,e]=tt(!1);return nt((()=>e(!0)),[]),t})(),[n,i]=(t=>{const[e,n]=(()=>{const[t,e]=tt(null);return[t,st((t=>{null!==t&&e(new dn(t))}),[])]})(),i=st((()=>e.hide()),[e]),o=t.role||"dialog",s="alertdialog"===o,a=t.titleId||t.id+"-title";return nt((()=>()=>{e&&e.destroy()}),[e]),[e,{container:{id:t.id,ref:n,role:o,tabIndex:-1,"aria-modal":!0,"aria-hidden":!0,"aria-labelledby":a},overlay:{onClick:s?void 0:i},dialog:{role:"document"},closeButton:{type:"button",onClick:i},title:{role:"heading","aria-level":1,id:a}}]})(t),{dialogRef:o}=t;if(nt((()=>(n&&o(n),()=>o(void 0))),[o,n]),!e)return null;const s=t.dialogRoot?document.querySelector(t.dialogRoot):document.body,a=h("h2",Ue({},i.title,{className:t.classNames.title,key:"title"}),t.onBack&&h("a",{"aria-label":t.backButtonLabel,href:"#",onClick:e=>{e.preventDefault(),t.onBack(e)}},"←")," ",t.title),r=h("button",Ue({},i.closeButton,{className:t.classNames.closeButton,"aria-label":t.closeButtonLabel,key:"button"}),t.closeButtonContent),l=["first"===t.closeButtonPosition&&r,a,t.children,"last"===t.closeButtonPosition&&r].filter(Boolean);return function(t,e){var n=h(Ke,{__v:t,i:e});return n.containerInfo=e,n}(h("div",Ue({},i.container,{className:t.classNames.container}),h("div",Ue({},i.overlay,{className:t.classNames.overlay})),h("div",Ue({},i.dialog,{className:t.classNames.dialog}),l)),s)};fn.defaultProps={role:"dialog",closeButtonLabel:"Close this dialog window",closeButtonContent:"×",closeButtonPosition:"first",classNames:{},backButtonLabel:"Back",dialogRef:()=>{}},function(t){function e(e,i,o,s){const a=o||s.parent(),r=a.find(".mg-upc-item-vote").attr("disabled",!0);mgUpcApiClient.vote(e,i,{context:"web",posts:n(a)}).then((function(e){t(document.body).trigger("mg_upc_vote_response",[e,a])})).catch((function(t){r.attr("disabled",!1),t.response?.data?.message&&(s?s.append(te(t.response.data.message)):a.before(te(t.response.data.message)))}))}function n(e){return[...e.children().map((function(){return t(this).data("pid")}))].join(",")}t(".mg-upc-item-vote").on("click",(function(){const n=t(this).data("vote").split(",");return 2===n.length&&e(n[0],n[1],!1,t(this).closest(".mg-upc-item")),!1})),t((function(){t(".mg-upc-vote").each((function(){const n=t(this);e(n.data("id"),0,n.find(".mg-upc-items-container"),!1)}))})),t(document.body).on("mg_upc_vote_response",(function(e,n,i){if(!n.data)return;const o=parseInt(n.data.vote_counter,10),s=i.find(".mg-upc-item-vote");i.data("votes",o),n.data.can_vote?s.attr("disabled",!1).show():s.animate({width:0,padding:0,opacity:0},200,(function(){s.remove()})),n.data.posts.forEach((function(e){const n=i.find(".mg-upc-item[data-pid="+e.post_id+"]"),s=parseInt(e.votes,10);t(document.body).trigger("mg_upc_item_vote_set",[n,s,o])}))})),t(document.body).on("mg_upc_item_vote_set",(function(t,e,n,i){const o=i>0?Math.round(1e3*n/i)/10:0,s=e.find(".mg-upc-votes");s.find(".mg-upc-item-votes-number").html(n),s.find(".mg-upc-item-percent").html(o+"%"),s.find(".mg-upc-item-bar-progress").animate({width:o+"%"}),s.show()}))}(jQuery),function(t){t(".mg-upc-add-product-to-list").on("click",(function(){let e=t(this).data("id");const n=t(this).closest(".product,.summary").find("[name='variation_id']");return n.length>0&&parseInt(n.val(),10)>0&&(e=n.val()),window.addItemToList(e),!1}));const e="mg-upc-btn-loading",n="mg-upc-product-added",i="mg-upc-product-error",o="Sorry, an error occurred.";function s(a,r,l){if(r.hasClass(e))return!1;let c={product_id:r.data("product"),quantity:r.data("quantity")};if("0"==c.quantity){if(!l)return!!confirm(mt("The quantity is zero! Do you want to add a unit?"))&&s(a,r,!0);c.quantity=1}t(document.body).trigger("adding_to_cart",[r,c]);const u=woocommerce_params.wc_ajax_url.toString().replace("%%endpoint%%","add_to_cart");return t.ajax({type:"POST",url:u,data:c,beforeSend:function(t){r.removeClass(n+" "+i).addClass(e)},success:function(i){r.removeClass(e),i&&(i.error&&i.product_url?alert(o):(r.addClass(n),t(document.body).trigger("added_to_cart",[i.fragments,i.cart_hash,r])))},error:function(){r.addClass(i).removeClass(e),alert(o)}}),!1}function s(a,r,l){if(r.hasClass(e))return!1;let c={product_id:r.data("product"),quantity:r.data("quantity")};if("0"==c.quantity){if(!l)return!!confirm(mt("The quantity is zero! Do you want to add a unit?"))&&s(a,r,!0);c.quantity=1}t(document.body).trigger("adding_to_cart",[r,c]);const u=woocommerce_params.wc_ajax_url.toString().replace("%%endpoint%%","add_to_cart");return t.ajax({type:"POST",url:u,data:c,beforeSend:function(t){r.removeClass(n+" "+i).addClass(e)},success:function(i){r.removeClass(e),i&&(i.error&&i.product_url?alert(o):(r.addClass(n),t(document.body).trigger("added_to_cart",[i.fragments,i.cart_hash,r])))},error:function(){r.addClass(i).removeClass(e),alert(o)}}),!1}t((function(){if("undefined"==typeof wc_add_to_cart_params)return!1;t(".mg-upc-item-product").removeClass("mg-upc-hide").on("click",(function(e){return s(e,t(this),!1)})),t(".mg-upc-add-list-to-cart").removeClass("mg-upc-hide").on("click",(function(s){const a=t(this);return a.hasClass(e)||(a.removeClass(n+" "+i).addClass(e),window.mgUpcAddListToCart(t(this).data("id")).then((function(i){a.removeClass(e),i.err&&a.before(te(Yt(i.err))),i.msg&&a.before(te(Yt(i.msg),"success")),a.addClass(n),t(document.body).trigger("added_to_cart",[i.fragments,i.cart_hash,a])})).catch((t=>{a.removeClass(e),t.response?.data?.message?a.before(te(Yt(t.response.data.message))):alert(o)}))),!1}))}))}(jQuery);const gn=function(t){const[e,n]=tt(""),[i,o]=tt(""),[s,a]=tt(""),[r,l]=tt(""),c=ot((()=>Kt(t.addingPost)),[t.addingPost]);function u(t){t.default_title&&n(t.default_title),t.default_status&&l(t.default_status),a(t.name)}return""===s&&1===c.length&&u(c[0]),nt((()=>{n(t.list.title),o(t.list.content),a(t.list.type),l(t.list.status)}),[t.list.title,t.list.content,t.list.type,t.list.type]),nt((()=>{Bt(s)?.available_statuses&&-1===Bt(s).available_statuses.indexOf(r)&&l(Bt(s).available_statuses[0])}),[s]),h("div",{className:"mg-list-edit"},-1===t.list.ID&&""===s&&h(y,null,h("label",null,mt("Select a list type:")),h("ul",{id:`type-${t.list.ID}`},c.map(((t,e)=>h("li",{className:"mg-upc-dg-item-list-type",key:t.name,onClick:()=>u(t),onKeyPress:e=>{13===e.keyCode&&u(t)},tabIndex:"0"},h("i",{className:"mg-upc-icon mg-upc-dg-item-type mg-upc-dg-item-type-"+t.name}),h("div",{className:"mg-upc-dg-item-title"},h("strong",null,t.label),h("div",{className:"mg-upc-dg-item-desc"},t.description))))))),""!==s&&Gt(s,"editable_title")&&h(y,null,h("label",{htmlFor:`title-${t.list.ID}`},mt("Title")),h("input",{id:`title-${t.list.ID}`,type:"text",value:e,onChange:function(t){n(t.target.value)},maxLength:100})),""!==s&&Gt(s,"editable_content")&&h(y,null,h("label",{htmlFor:`content-${t.list.ID}`},mt("Description")),h("textarea",{id:`content-${t.list.ID}`,value:i,onChange:function(t){o(t.target.value)},maxLength:500}),h("span",{className:"mg-upc-dg-list-desc-edit-count"},h("i",null,i?.length),"/500")),""!==s&&!Bt(s)&&h("span",null,mt("Unknown List Type...")),""!==s&&Bt(s)?.available_statuses&&Bt(s).available_statuses.length>1&&h(y,null,h("label",{htmlFor:`status-${t.list.ID}`},mt("Status")),h("select",{id:`status-${t.list.ID}`,value:r,onChange:function(t){l(t.target.value)}},Bt(s).available_statuses.map(((t,e)=>{if(function(t){const e=Xt(t);return e&&e.show_in_status_list}(t))return h("option",{value:t},function(t){const e=Xt(t);return e?e.label:t}(t))})))),""!==s&&Bt(s)&&h("div",{className:"mg-upc-dg-edit-actions"},h("button",{onClick:()=>t.onSave({title:e,content:i,type:s,status:r})},h("span",{className:"mg-upc-icon upc-font-save"}),h("span",null,mt("Save"))),h("button",{onClick:()=>t.onCancel()},h("span",{className:"mg-upc-icon upc-font-close"}),h("span",null,mt("Cancel")))))},hn=function(t){const[e,n]=tt(!1),[i,o]=tt(""),[s,a]=tt(t.item?.quantity),r=it({});nt((()=>{o(t.item.description)}),[t.item]),nt((()=>{e&&r.current.focus()}),[e]);const l=it(!1);return nt((()=>{t.item.quantity!==s&&(clearTimeout(l.current),l.current=setTimeout((function(){t.onSaveItemQuantity(s)}),600))}),[s]),h("li",{className:"mg-upc-dg-item","data-post_id":t.item.post_id},Vt(t.list,"sortable")&&h(y,null,h("span",{className:"mg-upc-dg-item-handle","aria-draggable":!0},"::"),h("span",{className:"mg-upc-dg-item-number"},t.item.position)),Vt(t.list,"vote")&&h(y,null,h("span",{className:"mg-upc-dg-item-number"},(()=>{const e=parseInt(t.list.vote_counter,10);return Vt(t.list,"vote")&&e>0?Math.round(100*parseInt(t.item.votes,10)/e)+"%":"0%"})())),h("a",{href:t.item.link},h("img",{className:"mg-upc-dg-item-image",src:t.item.image?t.item.image:zt})),h("div",{className:"mg-upc-dg-item-data"},h("a",{href:t.item.link},t.item.title),t.item.price_html&&h("span",{className:"mg-upc-dg-price",dangerouslySetInnerHTML:{__html:t.item.price_html}}),t.item.stock_html&&h("span",{className:"mg-upc-dg-stock",dangerouslySetInnerHTML:{__html:t.item.stock_html}}),t.editable&&!e&&h("p",null,t.item.description),t.editable&&!e&&Vt(t.list,"editable_item_description")&&h("button",{onClick:()=>{n(!0)}},h("span",{className:"mg-upc-icon upc-font-edit"}),""===i&&h("span",null,mt("Add Comment")),""!==i&&h("span",null,mt("Edit Comment"))),h("input",{ref:r,className:e?"mg-upc-dg-btn-item-desc":"mg-upc-dg-dn",type:"text",value:i,onChange:function(t){o(t.target.value)},onKeyDown:e=>{"Enter"===e.key&&(n(!1),t.onSaveItemDescription(i))},maxLength:400}),t.editable&&e&&h("button",{className:"mg-upc-dg-btn-item-desc-cancel",onClick:()=>{n(!1),o(t.item.description)}},h("span",{className:"mg-upc-icon upc-font-close"}),h("span",null,mt("Cancel"))),t.editable&&e&&h("button",{className:"mg-upc-dg-btn-item-desc-save",onClick:()=>{n(!1),t.onSaveItemDescription(i)}},h("span",{className:"mg-upc-icon upc-font-save"}),h("span",null,mt("Save")))),t.editable&&Vt(t.list,"quantity")&&h("div",{className:"mg-upc-dg-quantity"},h("small",null,mt("Quantity")),h("input",{"aria-label":mt("Quantity"),type:"number",value:s,onChange:function(){a(event.target.value)}})),t.editable&&!e&&h("div",null,h("button",{"aria-label":"Remove item",onClick:t.onRemove},h("span",{className:"mg-upc-icon upc-font-trash"}))))},vn=function(t){return new Promise((function(e,n){const i=document.createElement("script");let o=!1;i.type="text/javascript",i.src=t,i.async=!0,i.onerror=function(t){n(t,i)},i.onload=i.onreadystatechange=function(){o||this.readyState&&"complete"!=this.readyState||(o=!0,setTimeout((function(){e()}),100))},(document.head||document.body||document.documentElement).appendChild(i)}))},yn=function(t){const e=it(null),n=it((e=>{t.onMove(e)}));return nt((()=>{n.current=t.onMove})),nt((()=>{let i=!1;if(Vt(t.list,"sortable")){const t=()=>{i=Sortable.create(e.current,{handle:".mg-upc-dg-item-handle",group:"shared",animation:150,onUpdate:function(t){n.current(t)}})};"undefined"!=typeof Sortable?t():vn(qt()).then((()=>{t()}))}return()=>{i&&i.destroy()}})),h(y,null,h("ul",{className:"mg-upc-dg-list-fake mg-upc-dg-on-loading"},[0,1,2].map((e=>h("li",{className:"mg-upc-dg-item"},Vt(t.list,"sortable")&&h(y,null,h("span",{className:"mg-upc-dg-item-handle-skeleton"}," ",h(ce,{width:"1.5em"})," "),h("span",{className:"mg-upc-dg-item-number-skeleton"}," ",h(ce,{width:"1em"})," ")),Vt(t.list,"vote")&&h(y,null,h("span",{className:"mg-upc-dg-item-number-skeleton"}," ",h(ce,{width:"1em"})," ")),h("div",{className:"mg-upc-dg-item-skeleton-image"},h(ce,{width:"5em",height:"5em"})),h("div",{className:"mg-upc-dg-item-data"},h(ce,{count:2})))))),h("ul",{ref:e,className:"mg-upc-dg-list"},0===t?.items?.length&&h("span",null,"There are no items in this list"),t?.items?.length>0&&t.items?.map&&t.items.map((e=>h(hn,{list:t.list,item:e,editable:t.editable,onRemove:()=>t.onRemove(t.list,e),onSaveItemDescription:n=>t.onSaveItemDescription(t.list,e,n),onSaveItemQuantity:n=>t.onSaveItemQuantity(t.list,e,n),key:e.ID+":"+e.post_id})))),Vt(t.list,"vote")&&h("span",{className:"mg-upc-dg-total-votes"}," ",mt("Total votes:")," ",h("span",null," ",t.list.vote_counter)))},bn=function(t){const e=it(null),n=it(null),i=mt("Copy"),[o,s]=tt(i);nt((()=>{let t=null;o!==i&&(t=setTimeout((()=>{s(i),clearTimeout(t)}),2e3))}),[o]);const a=encodeURIComponent(t.link),r=encodeURIComponent(t.title);let l=[{name:"Twitter",url:"https://twitter.com/share?url="+a+"&text="+r},{name:"Facebook",url:"https://www.facebook.com/sharer/sharer.php?u="+a+""e="+r},{name:"Pinterest",url:"https://pinterest.com/pin/create/button/?url="+a+"&description="+r},{name:"Whatsapp",url:"whatsapp://send?text="+a},{name:"Telegram",url:"https://t.me/share/url?url="+a+"&text="+r},{name:"LiNE",url:"https://social-plugins.line.me/lineit/share?url="+a+"&text="+r},{slug:"email",name:mt("Email"),url:"mailto:?subject="+r+"&body="+a}];return void 0!==Qt().shareButtons&&(l=l.filter((t=>Qt().shareButtons.includes(t.slug||t.name.toLowerCase())))),h("div",{className:"mg-upc-dg-share-link"},h("input",{ref:e,value:t.link,onClick:function(){e.current.setSelectionRange(0,e.current.value.length)},readOnly:!0}),h("button",{ref:n,onClick:function(t){var n;(n=e.current).focus(),n.setSelectionRange(0,n.value.length),document.execCommand&&document.execCommand("copy")?s(mt("Copied!")):s("Error!")}},h("span",{className:"mg-upc-icon upc-font-copy"}),h("span",null,o)),l.map((function(t){return(e=t).slug||(e.slug=e.name.toLowerCase()),h("a",{href:e.url,title:"Share with "+e.name,className:"mg-upc-dg-share",target:"_blank",rel:"noopener"},h("div",{className:"mg-upc-share-btn-img mg-upc-share-"+e.slug}," "));var e})))},wn=function(t){const{state:e,dispatch:n}=at(ae),[i,o]=tt(!1),s=it(!1),a=it(!1);function r(t){t<1||t>e.listTotalPages||"loading"===e.status||n(Ne({page:t}))}return nt((()=>{const t=e.list;let i=!1,o=!1;if(t&&Vt(t,"sortable")){const t=()=>{s.current&&e.listPage<e.listTotalPages&&(i=Sortable.create(s.current,{group:"shared",onAdd:t=>{n(Ae(t.oldIndex))}})),s.current&&e.listPage>1&&(o=Sortable.create(a.current,{group:"shared",onAdd:t=>{n(Ee(t.oldIndex))}}))};"undefined"!=typeof Sortable?t():vn(qt()).then((()=>{t()}))}return()=>{i&&i.destroy(),o&&o.destroy()}}),[e.list,e.listPage,e.listTotalPages]),nt((()=>{o(!1)}),[e.editing,e.list,e.addingPost]),h(y,null,e.editing&&h(gn,{list:e.list,addingPost:e.addingPost,onSave:function(t){if(-1===e.list.ID||t.title!==e.list.title||t.content!==e.list.content||t.status!==e.list.status)if(-1===e.list.ID){const i={};i.title=t.title,i.content=t.content,i.type=t.type,i.status=t.status,e.addingPost?.post_id&&(i.adding=e.addingPost.post_id,e.addingPost?.description&&(i.description=e.addingPost.description)),n(Ce(i))}else{const i={id:e.list.ID};t.status!==e.list.status&&(i.status=t.status),t.title!==e.list.title&&(i.title=t.title),t.content!==e.list.content&&(i.content=t.content),n(ke(i))}},onCancel:function(){n(pe(!1)),-1===e.list.ID&&(n(Pe(!1)),n(de()),n(fe()))}}),!e.editing&&h(y,null,h("div",{className:"mg-upc-dg-top-action"},function(t){const e=t.type;return Gt(e,"editable_title")||Gt(e,"editable_content")||Bt(e)?.available_statuses?.length>1}(e.list)&&h("button",{className:"mg-upg-edit",onClick:()=>n(pe(!0))},h("span",{className:"mg-upc-icon upc-font-edit"}),h("span",null,mt("Edit"))),e.list.link&&h("button",{className:"mg-upg-share",onClick:()=>o(!i)},h("span",{className:"mg-upc-icon upc-font-share"}),h("span",null,mt("Share"))),"cart"===e.list.type&&h("button",{className:"mg-upg-share",onClick:function(){n(me(e.list.ID))}},h("span",{className:"mg-upc-icon upc-font-cart"}),h("span",null,mt("Add all to cart")))),i&&e.list.link&&h(bn,{link:e.list.link,title:e.list.title}),e.list.content&&h("p",{className:"mg-upc-dg-list-desc",dangerouslySetInnerHTML:{__html:Yt(e.list.content)}}),h(ce,{count:3}),h(yn,{list:e.list,items:e.list?.items||[],onMove:function(t){n(Te(t.oldIndex,e.list,t.newIndex))},onRemove:function(t,e){n(xe(e.post_id))},onSaveItemDescription:function(t,e,i){n(Ie(e.post_id,{description:i}))},onSaveItemQuantity:function(t,e,i){n(Ie(e.post_id,{quantity:i}))},editable:t.editable})),(!e.editing||!e.list)&&e.listTotalPages>1&&h(ue,{totalPages:e.listTotalPages,page:e.listPage,onPreview:function(){r(e.listPage-1)},onNext:function(){r(e.listPage+1)},prevRef:a,nextRef:s}))};function Pn(t){return parseInt(t.author,10)===parseInt(Qt().user_id,10)}function kn(){"replaceState"in history?(history.replaceState("",document.title,location.pathname),history.go(-1)):location.hash=""}H(h((t=>{const[e,n]=et(ee,se);return h(ae.Provider,{value:{state:e,dispatch:oe(n,(()=>e))}},t.children)}),null,h((function(){const{state:t,dispatch:e}=at(ae),n=ot((()=>Kt(t.addingPost)),[t.addingPost]),i=it(!1);let o="listOfList";o=t.addingPost?t.editing?"addingToNew":"adding":t.editing?-1!==t.list?.ID?"edit":"new":t.list?"list":"listOfList";const s={container:"mg-upc-dg-container",overlay:"mg-upc-dg-overlay",dialog:"mg-upc-dg-content"+(t.errorCode?" mg-upc-err-"+t.errorCode:""),title:"mg-upc-dg-title",closeButton:"mg-upc-dg-close"};nt((()=>{window.showMyLists=function(){a()},window.mgUpcShowList=function(t,n=""){e(de()),e(Pe({ID:t,title:n||""})),i.current.show()},window.addItemToList=function(t,n=!1,o="view"){e(de()),n?(e(Se(n,t,o)),i.current.show()):r(t)},window.removeItemFromList=function(t,n,o="view"){e(de()),e(xe(t,n,o)),i.current.show()},window.mgUpcAddListToCart=Zt}),[i.current,e]);const a=()=>{e(de()),e(fe()),i.current.show()},r=t=>{e(_e({post_id:t})),e(fe({addingPost:t})),i.current.show()};function l(n){n<1||n>t.totalPages||"loading"===t.status||e(ve(n))}const c="list"===o||"new"===o||"edit"===o||"addingToNew"===o;return h(fn,{id:"mg-upc-dg-dialog",dialogRef:function(t){i.current=t},title:t.title,classNames:s,onBack:!!c&&function(){switch(o){case"list":default:a();break;case"new":e(Pe(!1)),e(pe(!1)),a();break;case"edit":e(pe(!1));break;case"addingToNew":e(Pe(!1)),e(pe(!1)),e(fe({addingPost:t.addingPost.post_id}))}}},h("div",{className:"mg-upc-dg-content-wrapper mg-upc-dg-status-"+t.status+" mg-upc-dg-view-"+o},h("div",{className:"mg-upc-dg-wait"}),t.message&&h("div",{className:"mg-upc-dg-msg"},t.message,h("a",{href:"#",className:"mg-upc-dg-alert-close","aria-label":"Hide alert",onClick:t=>{t.preventDefault(),e({type:ht,payload:null})}},h("span",{className:"mg-upc-icon upc-font-close"}))),t.error&&h("div",{className:"mg-upc-dg-error"},t.error,h("a",{href:"#",className:"mg-upc-dg-alert-close","aria-label":"Hide alert",onClick:t=>{t.preventDefault(),e({type:gt,payload:null})}},h("span",{className:"mg-upc-icon upc-font-close"}))),h("div",{className:"mg-upc-dg-body"},!t.error&&t.addingPost&&h(Oe,{item:t.addingPost,onSaveItemDescription:function(n){e(_e({...t.addingPost,description:n}))}}),("listOfList"===o||"adding"===o)&&h(y,null,h("div",{className:"mg-upc-dg-top-action"},n.length>0&&!t.error&&h("button",{className:"mg-list-new",onClick:function(t){e(pe(!0)),e(Pe(!0)),i.current.show()}},h("span",{className:"mg-upc-icon upc-font-add"}),h("span",null,mt("Create List")))),h(De,{lists:t.listOfList,onSelect:function(n){e(pe(!1)),t.addingPost?e(Se(n.ID,t.addingPost,"view")):(e(Pe(n)),i.current.show())},onRemove:!t.addingPost&&function(t){e(he(t.ID))},loadPreview:function(){l(t.page-1)},loadNext:function(){l(t.page+1)}})),t.list&&h(wn,{editable:Pn(t.list)}))))}),null)," "),document.querySelector("body")),"#my-lists"===location.hash&&kn(),window.addEventListener("hashchange",(function(){"#my-lists"===location.hash&&(window.showMyLists(),kn())}),!1),window.mgUpcApiClient=Ft,window.mgUpcListeners=function(){jQuery(".mg-upc-post-add").on("click",(function(){return jQuery(this).data("post-id")>0&&window.addItemToList(jQuery(this).data("post-id"),(jQuery(this).data("upc-list")+"").length>0&&jQuery(this).data("upc-list")),!1})),jQuery(".mg-upc-post-remove").on("click",(function(){return jQuery(this).data("post-id")>0&&void 0!==jQuery(this).data("upc-list")&&window.removeItemFromList(jQuery(this).data("post-id"),(jQuery(this).data("upc-list")+"").length>0&&jQuery(this).data("upc-list")),!1})),jQuery(".mg-upc-show-list").on("click",(function(){return void 0!==jQuery(this).data("upc-list")&&window.mgUpcShowList(jQuery(this).data("upc-list"),(jQuery(this).data("upc-title")+"").length>0&&jQuery(this).data("upc-title")),!1}))},window.mgUpcListeners()})(); -
user-post-collections/tags/0.9.0/readme.txt
r2856778 r3190768 5 5 License URI: https://www.gnu.org/licenses/gpl.txt 6 6 Tags: User lists, Post Collections, Woocommerce Wishlist 7 Tested up to: 6. 17 Tested up to: 6.5.4 8 8 Stable tag: 0.8.32 9 9 Requires PHP: 7.0 10 Requires at least: 4.9.6 10 11 11 12 This plugin allows users to create lists of different types (simple, numbered, cart and poll) and share them. … … 30 31 All list types can be disabled. 31 32 32 If you are a developer and you are making a theme you can register your own list types.33 If you are a developer, and you are making a theme you can register your own list types. 33 34 34 35 ### Features … … 41 42 * Max items per list (configurable in each type of list) 42 43 * Share buttons for public lists 44 45 ### Collections Archive 46 47 The plugin adds a new page to the site where all the collections of the users are shown. This page can be disabled/enabled on the plugin settings. 48 This page is also used as the basis for displaying each list, but disabling the archive page from the plugin settings does not disable the pages of each collection.. 49 Archive URL example: https://domain.com/user-post-collection/ 50 Collection URL example: https://domain.com/user-post-collection/list-x-by-tauri/ 51 52 ### Shortcode 53 54 You can use the shortcode [user_posts_collections] to show the lists. Example: 55 56 [user_posts_collections type="vote" tpl-items="cards" exclude="32,45"] 57 [user_posts_collections author="23" tpl-items="list"] 58 [user_posts_collections limit="5" pagination="1" tpl-cols="4,4,4,3,2,1"] 59 [user_posts_collections author-name="tauri" orderby="title" order="ASC" limit=10 pagination=1] 60 [user_posts_collections include="23,31,412"] 61 62 #### Shortcode options 63 64 * __type:__ simple|numbered|vote|favorites|bookmarks|cart 65 * __author-name:__ Author username 66 * __author:__ Author ID 67 * __include:__ Lists ID to include (comma separated) 68 * __exclude:__ Lists ID to exclude (comma separated) 69 * __orderby:__ ID|views|vote_counter|count|created|modified|title 70 * __order:__ ASC|DESC 71 * __limit:__ Max lists to show 72 * __pagination:__ Show pagination. Set to 1 for enabled. Default: 0 73 * __id:__ Set unique string. Only letters, numbers and "-". Used for pagination. 74 * __tpl-items:__ (card|list) List type 75 * __tpl-cols:__ Number of columns, comma separated: xxl,xl,lg,md,sm,xs (for card list type) Default: 4,4,4,3,2,1 76 * __tpl-cols-(xs|sm|md|lg|xl|xxl):__ (1|2|3|4|5) Number of columns (for card list type) 77 * __tpl-thumbs:__ Default thumbnails layout. Set to "off" to not show 78 * __tpl-thumbs-(xs|sm|md|lg|xl|xxl):__ (0|2x2|2x3|3x2|4x1|[1-4]x[1-4]) Thumbnails layout 79 * __tpl-desc:__ (on|off) Show description. Set to "off" to hide description 80 * __tpl-user:__ (on|off) Show author. Set to "off" to hide user 81 * __tpl-meta:__ (on|off) Show meta. Set to "off" to hide meta 43 82 44 83 == Screenshots == … … 67 106 68 107 == Changelog == 108 109 = 0.9.0 = 110 * Added archive option 111 * Added shortcode [user_posts_collections] 69 112 70 113 = 0.8.32 = -
user-post-collections/tags/0.9.0/templates/content-single-mg-upc.php
r2768965 r3190768 26 26 } 27 27 ?> 28 <div id="mg-upc-<?php echo esc_attr( $mg_upc_list['ID']); ?>"29 data-id="<?php echo esc_attr( $mg_upc_list['ID']); ?>"30 <?php mg_upc_class( 'page-inner mg-upc-page-inner' , $mg_upc_list); ?>>28 <div id="mg-upc-<?php mg_upc_the_ID(); ?>" 29 data-id="<?php mg_upc_the_ID(); ?>" 30 <?php mg_upc_class( 'page-inner mg-upc-page-inner' ); ?>> 31 31 32 32 <?php … … 40 40 <?php 41 41 /** 42 * Hook: mg_upc_single_list_ summary.42 * Hook: mg_upc_single_list_content. 43 43 * 44 44 * @hooked mg_upc_template_single_title - 5 -
user-post-collections/tags/0.9.0/templates/mg-upc-wc/single-all-cart-buttons.php
r2768965 r3190768 2 2 global $mg_upc_list; 3 3 ?> 4 <a class="<?php echo esc_attr( mg_upc_btn_classes( 'mg-upc-add-list-to-cart' ) ); ?>"4 <a href="#" class="<?php echo esc_attr( mg_upc_btn_classes( 'mg-upc-add-list-to-cart' ) ); ?>" 5 5 data-id="<?php echo (int) $mg_upc_list['ID']; ?>"> 6 6 <?php echo esc_html( mg_upc_get_text( 'Add all to cart', 'mg_upc_list' ) ); ?> -
user-post-collections/tags/0.9.0/templates/single-mg-upc/description.php
r2768965 r3190768 10 10 exit; // Exit if accessed directly. 11 11 } 12 global $mg_upc_list;13 14 $content = $mg_upc_list['content'];15 if ( strpos( $content, '<' ) !== false ) {16 $content = force_balance_tags( $content );17 }18 12 ?> 19 13 <div class="mg-upc-description"> 20 14 <p> 21 <?php 22 echo wp_kses( nl2br( $content ), MG_UPC_List_Controller::get_instance()->list_allowed_tags() ); 23 ?> 15 <?php mg_upc_the_content(); ?> 24 16 </p> 25 17 </div> -
user-post-collections/tags/0.9.0/templates/single-mg-upc/items.php
r2768965 r3190768 6 6 * 7 7 */ 8 8 /** @global MG_UPC_List $mg_upc_list */ 9 9 global $mg_upc_list; 10 10 -
user-post-collections/tags/0.9.0/templates/single-mg-upc/pagination.php
r2768965 r3190768 11 11 } 12 12 13 $total = isset( $total ) ? $total :1;14 $current = isset( $current ) ? $current :1;15 $base = isset( $base ) ? $base :esc_url_raw(13 $total = $total ?? 1; 14 $current = $current ?? 1; 15 $base = $base ?? esc_url_raw( 16 16 str_replace( 17 17 999999999, … … 23 23 ) 24 24 ); 25 $format = isset( $format ) ? $format :'';25 $format = $format ?? ''; 26 26 27 27 if ( $total <= 1 ) { -
user-post-collections/tags/0.9.0/templates/single-mg-upc/title.php
r2768965 r3190768 11 11 } 12 12 13 the_title( '<h1 class="mg-upc-title entry-title">', '</h1>' );13 mg_upc_the_title( '<h1 class="mg-upc-title entry-title">', '</h1>' ); -
user-post-collections/tags/0.9.0/uninstall.php
r2770005 r3190768 78 78 'mg_upc_api_item_per_page', 79 79 'mg_upc_item_per_page', 80 'mg_upc_list_per_page', 80 81 'mg_upc_post_stats', 81 82 'mg_upc_share_buttons', 82 83 'mg_upc_share_buttons_client', 83 84 'mg_upc_ajax_load', 85 'mg_upc_archive_enable', 86 'mg_upc_archive_filter_type', 87 'mg_upc_archive_filter_author', 88 'mg_upc_archive_item_per_page', 89 'mg_upc_archive_item_template', 90 'mg_upc_archive_item_template_thumbs_xxl', 91 'mg_upc_archive_item_template_thumbs_xl', 92 'mg_upc_archive_item_template_thumbs_lg', 93 'mg_upc_archive_item_template_thumbs_md', 94 'mg_upc_archive_item_template_thumbs_sm', 95 'mg_upc_archive_item_template_thumbs_xs', 96 'mg_upc_archive_item_template_cols_xxl', 97 'mg_upc_archive_item_template_cols_xl', 98 'mg_upc_archive_item_template_cols_lg', 99 'mg_upc_archive_item_template_cols_md', 100 'mg_upc_archive_item_template_cols_sm', 101 'mg_upc_archive_item_template_cols_xs', 102 'mg_upc_archive_item_template_meta', 103 'mg_upc_archive_item_template_user', 104 'mg_upc_archive_item_template_desc', 105 'mg_upc_archive_title', 106 'mg_upc_archive_title_type', 107 'mg_upc_archive_title_author', 108 'mg_upc_archive_title_author_type', 109 'mg_upc_archive_document_title', 84 110 ); 85 111 foreach ( $options as $option ) { -
user-post-collections/tags/0.9.0/user-post-collections.php
r2856778 r3190768 4 4 Plugin URI: https://galetto.info/user-post-collections 5 5 Description: Allows users to create their post collections. 6 Version: 0. 8.326 Version: 0.9.0 7 7 Author: Mauricio Galetto 8 8 Author URI: https://galetto.info/ … … 24 24 /** @global User_Post_Collections|null $mg_upc */ 25 25 $GLOBALS['mg_upc'] = null; 26 27 /** @global MG_UPC_Query|null $mg_upc_the_query The main upc query*/ 28 $GLOBALS['mg_upc_the_query'] = null; 29 30 /** @global MG_UPC_Query|null $mg_upc_query The upc query for loop*/ 31 $GLOBALS['mg_upc_query'] = null; 26 32 27 33 /** … … 59 65 60 66 require_once __DIR__ . '/includes/utils.php'; 67 require_once __DIR__ . '/includes/mg-upc-list.php'; 61 68 require_once __DIR__ . '/includes/template-functions.php'; 62 69 require_once __DIR__ . '/includes/template-hooks.php'; … … 75 82 76 83 require_once __DIR__ . '/classes/mg-upc-module.php'; 84 require_once __DIR__ . '/classes/mg-upc-query.php'; 77 85 78 86 require_once __DIR__ . '/alt-models/mg-list-model.php'; … … 81 89 82 90 require_once __DIR__ . '/controllers/mg-list-page-alt.php'; 91 require_once __DIR__ . '/classes/mg-list-page-alt-settings.php'; 83 92 require_once __DIR__ . '/controllers/mg-upc-list-controller.php'; 84 93 require_once __DIR__ . '/controllers/mg-upc-rest-list-controller.php'; … … 93 102 require_once __DIR__ . '/classes/mg-upc-settings.php'; 94 103 require_once __DIR__ . '/classes/mg-upc-rest-api.php'; 104 require_once __DIR__ . '/includes/mg-upc-shortcode.php'; 95 105 96 106 require_once __DIR__ . '/classes/mg-upc-database.php'; -
user-post-collections/trunk/alt-models/mg-list-items-model.php
r2768965 r3190768 99 99 100 100 /** 101 * List list items101 * List the list items 102 102 * 103 103 * @param array $args Array with filters and configuration … … 182 182 $sql .= ' LIMIT %d, %d'; 183 183 $prepare[] = (int) $offset; 184 $prepare[] = (int) $args['items_per_page'];185 184 } else { 186 $sql .= ' LIMIT %d'; 187 $prepare[] = (int) $args['items_per_page']; 185 $sql .= ' LIMIT %d'; 188 186 } 187 $prepare[] = (int) $args['items_per_page']; 189 188 } 190 189 … … 388 387 389 388 /** 390 * Get an listitem389 * Get item 391 390 * 392 391 * @param int $list_id -
user-post-collections/trunk/alt-models/mg-list-model.php
r2768965 r3190768 139 139 140 140 $defaults = array( 141 'limit' => 20, 142 'page' => 1, 141 'limit' => 20, 142 'page' => 1, 143 'fields' => array(), 143 144 ); 144 145 $args = array_merge( $defaults, $args ); … … 152 153 $where = array(); 153 154 $prepare = array(); 155 156 $select_valid = array( 157 'ID', 158 'slug', 159 'title', 160 'content', 161 'author', 162 'type', 163 'status', 164 'count', 165 'views', 166 'vote_counter', 167 'created', 168 'modified', 169 ); 154 170 155 171 //compare only support with array=false … … 159 175 'array' => true, 160 176 ), 177 'not_ID' => array( 178 'type' => 'int', 179 'array' => true, 180 'db_column' => 'ID', 181 'compare' => 'NOT IN', 182 ), 161 183 'slug' => array( 162 184 'type' => 'string', 163 185 'array' => true, 164 186 ), 187 'not_slug' => array( 188 'type' => 'string', 189 'array' => true, 190 'db_column' => 'slug', 191 'compare' => 'NOT IN', 192 ), 165 193 'author' => array( 166 194 'type' => 'int', 167 195 'array' => true, 196 ), 197 'not_author' => array( 198 'type' => 'int', 199 'array' => true, 200 'db_column' => 'author', 201 'compare' => 'NOT IN', 168 202 ), 169 203 'type' => array( … … 173 207 'any' => 'any', 174 208 ), 209 'not_type' => array( 210 'type' => 'string', 211 'array' => true, 212 'db_column' => 'type', 213 'valid' => $this->valid_types( true ), 214 'compare' => 'NOT IN', 215 ), 175 216 'status' => array( 176 217 'type' => 'string', … … 203 244 'db_column' => 'modified', 204 245 ), 246 'year' => array( 247 'type' => 'date_function', 248 'db_func' => 'YEAR', 249 'array' => true, 250 'db_column' => 'created', 251 ), 252 'day' => array( 253 'type' => 'date_function', 254 'db_func' => 'DAYOFMONTH', 255 'array' => true, 256 'db_column' => 'created', 257 'valid' => range( 1, 31 ), 258 ), 259 'hour' => array( 260 'type' => 'date_function', 261 'db_func' => 'HOUR', 262 'array' => true, 263 'db_column' => 'created', 264 'valid' => range( 0, 23 ), 265 ), 266 'minute' => array( 267 'type' => 'date_function', 268 'db_func' => 'MINUTE', 269 'array' => true, 270 'db_column' => 'created', 271 'valid' => range( 0, 59 ), 272 ), 273 'second' => array( 274 'type' => 'date_function', 275 'db_func' => 'SECOND', 276 'array' => true, 277 'db_column' => 'created', 278 'valid' => range( 0, 59 ), 279 ), 280 'weekday' => array( 281 'type' => 'date_function', 282 'db_func' => 'WEEKDAY', 283 'array' => true, 284 'db_column' => 'created', 285 'valid' => range( 0, 6 ), 286 ), 287 'weekofyear' => array( 288 'type' => 'date_function', 289 'db_func' => 'WEEKOFYEAR', 290 'array' => true, 291 'db_column' => 'created', 292 'valid' => range( 0, 53 ), 293 ), 294 'month' => array( 295 'type' => 'date_function', 296 'db_func' => 'MONTH', 297 'array' => true, 298 'db_column' => 'created', 299 'valid' => range( 1, 12 ), 300 ), 205 301 ); 206 302 … … 209 305 210 306 if ( ! empty( $args[ $prop ] ) ) { 211 $db_column = isset( $filter['db_column'] ) ? $filter['db_column'] :$prop;212 $compare = isset( $filter['compare'] ) ? $filter['compare'] :'=';307 $db_column = $filter['db_column'] ?? $prop; 308 $compare = $filter['compare'] ?? '='; 213 309 $single_value = null; 214 310 … … 240 336 $where_values = array(); 241 337 foreach ( $args[ $prop ] as $value ) { 242 if ( 'int' === $filter['type'] ) { 243 if ( ! empty( $filter['valid'] ) && ! in_array( (int) $value, $filter['valid'], true ) ) { 338 if ( 'int' === $filter['type'] || 'date_function' === $filter['type'] ) { 339 if ( 340 ! empty( $filter['valid'] ) && 341 ! in_array( (int) $value, $filter['valid'], true ) 342 ) { 244 343 throw new MG_UPC_Invalid_Field_Exception( 245 344 'Invalid field ' . $prop . '.', … … 277 376 } 278 377 279 $where[] = '( `' . $db_column . '` IN (' . implode( ',', $where_values ) . '))'; 378 if ( ! in_array( $compare, array( 'IN', 'NOT IN' ), true ) ) { 379 $compare = 'IN'; 380 } 381 382 if ( ! empty( $filter['db_func'] ) ) { 383 $where[] = '( ' . $filter['db_func'] . '(`' . $db_column . '`) IN ' . 384 ' (' . implode( ',', $where_values ) . '))'; 385 } else { 386 $where[] = '( `' . $db_column . '` ' . $compare . ' (' . implode( ',', $where_values ) . '))'; 387 } 280 388 281 389 continue; //end count( $args[ $prop ] ) > 1 … … 291 399 //single value 292 400 if ( isset( $single_value ) ) { 293 if ( 'int' === $filter['type'] ) { 294 $where[] = '`' . $db_column . '` ' . $compare . ' %d'; 295 $prepare[] = (int) $single_value; 401 if ( 'IN' === $compare ) { 402 $compare = '='; 403 } elseif ( 'NOT IN' === $compare ) { 404 $compare = '!='; 405 } 406 $where_value = '%s'; 407 if ( 'int' === $filter['type'] || 'date_function' === $filter['type'] ) { 408 $where_value = '%d'; 409 $prepare[] = (int) $single_value; 296 410 } elseif ( 'string' === $filter['type'] ) { 297 $where[] = '`' . $db_column . '` ' . $compare . ' %s';298 411 $prepare[] = $single_value; 299 412 } elseif ( 'datetime' === $filter['type'] ) { … … 307 420 ); 308 421 } 309 $where[] = '`' . $db_column . '` ' . $compare . ' %s';310 422 $prepare[] = gmdate( 'Y-m-d H:i:s', $datetime ); 423 } 424 if ( ! empty( $filter['db_func'] ) ) { 425 $where[] = $filter['db_func'] . '(`' . $db_column . '`) ' . $compare . ' ' . $where_value; 426 } else { 427 $where[] = '`' . $db_column . '` ' . $compare . ' ' . $where_value; 311 428 } 312 429 } … … 322 439 323 440 $select_count = 'SELECT COUNT(*) FROM `' . $this->get_table_list() . '` '; 324 $select = 'SELECT * FROM `' . $this->get_table_list() . '` '; 325 $sql = ''; 441 442 $select_fields = array_intersect( $select_valid, $args['fields'] ); 443 if ( empty( $select_fields ) ) { 444 $select = 'SELECT * FROM `' . $this->get_table_list() . '` '; 445 } else { 446 $select = 'SELECT ' . implode( ',', $select_fields ) . ' FROM `' . $this->get_table_list() . '` '; 447 } 448 449 $sql = ''; 326 450 327 451 if ( ! empty( $where ) ) { … … 331 455 $args['page'] = max( intval( $args['page'] ), 1 ); 332 456 333 if ( $args['limit'] > 1 ) { //for find one not run count query and not set order 457 if ( $args['limit'] > 1 ) { //for find one not run count query and not set order. What?? FIXME 334 458 $sql_pin_query = ''; 335 459 if ( false !== $args['pined'] ) { … … 347 471 'created', 348 472 'modified', 473 'title', 349 474 ), 350 475 true … … 353 478 $sql_pin_query = $sql_pin_query ? $sql_pin_query . ', ' : ''; 354 479 $sql .= ' ORDER BY ' . $sql_pin_query . $args['orderby']; 355 if ( isset( $args['order'] ) && 'desc' === $args['order']) {480 if ( isset( $args['order'] ) && 'desc' === strtolower( $args['order'] ) ) { 356 481 $sql .= ' DESC'; 357 482 } else { 358 483 $sql .= ' ASC'; 359 484 } 360 } elseif ( false !== $sql_pin_query) {485 } elseif ( ! empty( $sql_pin_query ) ) { 361 486 $sql .= ' ORDER BY ' . $sql_pin_query; 362 487 } … … 375 500 $sql .= ' LIMIT %d, %d'; 376 501 $prepare[] = max( 0, (int) $args['offset'] ); 377 $prepare[] = $args['limit'];378 502 } elseif ( $args['page'] > 1 ) { 379 503 $offset = $args['limit'] * ( $args['page'] - 1 ); … … 381 505 $sql .= ' LIMIT %d, %d'; 382 506 $prepare[] = $offset; 383 $prepare[] = $args['limit'];384 507 } else { 385 $sql .= ' LIMIT %d'; 386 $prepare[] = $args['limit']; 508 $sql .= ' LIMIT %d'; 387 509 } 510 $prepare[] = $args['limit']; 388 511 } 389 512 $results = $wpdb->get_results( … … 463 586 } 464 587 $user = get_user_by( 'id', $args['author'] ); 465 if ( false === $user ->ID) {588 if ( false === $user ) { 466 589 throw new MG_UPC_Invalid_Field_Exception( 'Invalid author.', 0, null, 'author' ); 467 590 } … … 575 698 if ( ! empty( $args['author'] ) ) { 576 699 $user = get_user_by( 'id', $args['author'] ); 577 if ( false === $user ->ID) {700 if ( false === $user ) { 578 701 throw new MG_UPC_Invalid_Field_Exception( 'Invalid author.', 0, null, 'author' ); 579 702 } -
user-post-collections/trunk/alt-models/mg-list-votes-model.php
r2768965 r3190768 25 25 function( $list_id, $post_id ) { 26 26 $user_id = get_current_user_id(); 27 $this->add_vote( $list_id, $post_id, $user_id ); 27 try { 28 $this->add_vote( $list_id, $post_id, $user_id ); 29 } catch ( MG_UPC_Invalid_Field_Exception $e ) { 30 mg_upc_error_log( 'Error, inavlid field: ' . $e->getMessage() ); 31 } catch ( MG_UPC_Item_Not_Found_Exception $e ) { 32 mg_upc_error_log( 'Error, item not found: ' . $e->getMessage() ); 33 } 28 34 }, 29 35 10, … … 114 120 * List User Votes 115 121 * 116 * @param bool $filters117 * @param int $page Set to 0 for only run count query118 * @param int $votes_per_page119 * @param string $orderby120 * @param string $order122 * @param bool|array $filters 123 * @param int $page Set to 0 for only run count query 124 * @param int $votes_per_page 125 * @param string $orderby 126 * @param string $order 121 127 * 122 128 * @return array … … 138 144 $order = strtolower( $order ); 139 145 140 $int_filters = array( 'list_id', 'post_id', 'user_id' ); 141 foreach ( $int_filters as $prop ) { 142 if ( ! empty( $filters[ $prop ] ) ) { 143 $filters[ $prop ] = (int) $filters[ $prop ]; 144 if ( ! $filters[ $prop ] ) { 145 throw new MG_UPC_Invalid_Field_Exception( 'Invalid filter value.' ); 146 if ( false !== $filters ) { 147 $int_filters = array( 'list_id', 'post_id', 'user_id' ); 148 foreach ( $int_filters as $prop ) { 149 if ( ! empty( $filters[ $prop ] ) ) { 150 $filters[ $prop ] = (int) $filters[ $prop ]; 151 if ( ! $filters[ $prop ] ) { 152 throw new MG_UPC_Invalid_Field_Exception( 'Invalid filter value.' ); 153 } 146 154 } 147 155 } … … 163 171 $prepare = array(); 164 172 165 foreach ( $int_filters as $prop ) { 166 if ( ! empty( $filters[ $prop ] ) ) { 167 $where[] = '`' . $prop . '` = %d'; 168 $prepare[] = $filters[ $prop ]; 169 } 170 } 171 172 if ( ! empty( $filters['ip'] ) ) { 173 $where[] = '`ip` = %s'; 174 $prepare[] = $filters['ip']; 173 if ( false !== $filters ) { 174 foreach ( $int_filters as $prop ) { 175 if ( ! empty( $filters[ $prop ] ) ) { 176 $where[] = '`' . $prop . '` = %d'; 177 $prepare[] = $filters[ $prop ]; 178 } 179 } 180 181 if ( ! empty( $filters['ip'] ) ) { 182 $where[] = '`ip` = %s'; 183 $prepare[] = $filters['ip']; 184 } 175 185 } 176 186 … … 191 201 'votes' => array(), 192 202 'total' => $total, 193 'total_pages' => $votes_per_page > 0 ? ceil( $total / $votes_per_page ) : 1,203 'total_pages' => ceil( $total / $votes_per_page ), 194 204 'current' => 0, 195 205 ); … … 199 209 if ( ! empty( $orderby ) ) { 200 210 $sql .= ' ORDER BY ' . $orderby; 201 if ( isset( $order ) &&'desc' === $order ) {211 if ( 'desc' === $order ) { 202 212 $sql .= ' DESC'; 203 213 } else { … … 213 223 $sql .= ' LIMIT %d, %d'; 214 224 $prepare[] = (int) $offset; 215 $prepare[] = (int) $votes_per_page;216 225 } else { 217 $sql .= ' LIMIT %d';218 $prepare[] = (int) $votes_per_page;219 }226 $sql .= ' LIMIT %d'; 227 } 228 $prepare[] = (int) $votes_per_page; 220 229 } 221 230 … … 292 301 293 302 /** 294 * Get the vote of a nuser for a list303 * Get the vote of a user for a list 295 304 * 296 305 * @param int $list_id … … 323 332 324 333 /** 325 * Count votes of a nuser for a list334 * Count votes of a user for a list 326 335 * 327 336 * @param int $list_id The list ID -
user-post-collections/trunk/classes/mg-upc-database.php
r2770005 r3190768 48 48 /** @global MG_UPC_List_Type[] $mg_upc_list_types Global array with list types. */ 49 49 global $mg_upc_list_types; 50 $list_types_to_delete = array(); 50 51 if ( null === $reassign ) { 51 $list_types_to_delete = array();52 52 foreach ( $mg_upc_list_types as $list_type ) { 53 53 if ( $list_type->delete_with_user() ) { 54 54 $list_types_to_delete[] = $list_type->name; 55 } else {56 $list_types_to_delete[] = $list_type->name;57 55 } 58 56 } 59 $mg_upc->model->deleted_all_from_user( $id, $list_types_to_delete );60 57 } else { 61 58 //search for reassign or delete list ( always_exists list types that already has the reassign user) 62 $list_types_to_delete = array();63 59 $list_types_to_reassign = array(); 64 60 foreach ( $mg_upc_list_types as $list_type ) { … … 71 67 } 72 68 } catch ( MG_UPC_Invalid_Field_Exception $e ) { 73 error_log( 'MG_UPC: Error on delete list of removed user.' );69 mg_upc_error_log( 'MG_UPC: Error on delete list of removed user.' ); 74 70 } 75 71 } else { … … 78 74 } 79 75 $mg_upc->model->reassign_all_from_user( $id, $reassign, $list_types_to_reassign ); 80 $mg_upc->model->deleted_all_from_user( $id, $list_types_to_delete );81 }76 } 77 $mg_upc->model->deleted_all_from_user( $id, $list_types_to_delete ); 82 78 } 83 79 … … 113 109 114 110 if ( ! empty( $wpdb->charset ) ) { 115 $charset_collate = "DEFAULT CHARACTER SET {$wpdb->charset}";111 $charset_collate = "DEFAULT CHARACTER SET $wpdb->charset "; 116 112 } 117 113 118 114 if ( ! empty( $wpdb->collate ) ) { 119 $charset_collate .= "COLLATE {$wpdb->collate}";115 $charset_collate .= "COLLATE $wpdb->collate"; 120 116 } 121 117 … … 124 120 125 121 $sql = " 126 CREATE TABLE {$table_lists}(122 CREATE TABLE $table_lists ( 127 123 ID bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, 128 124 author bigint(20) DEFAULT NULL, … … 141 137 KEY type_status_created (type,status,created,ID), 142 138 KEY author_type (author,type) 143 ) {$charset_collate}ENGINE=InnoDB;";139 ) $charset_collate ENGINE=InnoDB;"; 144 140 145 141 require_once ABSPATH . 'wp-admin/includes/upgrade.php'; 146 142 dbDelta( $sql ); 147 143 148 $sql = "CREATE TABLE {$table_items}(144 $sql = "CREATE TABLE $table_items ( 149 145 list_id bigint(20) UNSIGNED NOT NULL, 150 146 post_id bigint(20) UNSIGNED NOT NULL, … … 157 153 KEY list_position (list_id,position), 158 154 KEY list_votes (list_id,votes) 159 ) {$charset_collate}ENGINE=InnoDB;";155 ) $charset_collate ENGINE=InnoDB;"; 160 156 161 157 dbDelta( $sql ); … … 175 171 176 172 if ( ! empty( $wpdb->charset ) ) { 177 $charset_collate = "DEFAULT CHARACTER SET {$wpdb->charset}";173 $charset_collate = "DEFAULT CHARACTER SET $wpdb->charset "; 178 174 } 179 175 180 176 if ( ! empty( $wpdb->collate ) ) { 181 $charset_collate .= "COLLATE {$wpdb->collate}";177 $charset_collate .= "COLLATE $wpdb->collate"; 182 178 } 183 179 … … 185 181 186 182 $sql = " 187 CREATE TABLE {$table_votes}(183 CREATE TABLE $table_votes ( 188 184 list_id bigint(20) UNSIGNED NOT NULL, 189 185 post_id bigint(20) UNSIGNED NOT NULL, … … 195 191 KEY post_id (post_id), 196 192 KEY list_post (list_id, post_id) 197 ) {$charset_collate}ENGINE=InnoDB;";193 ) $charset_collate ENGINE=InnoDB;"; 198 194 199 195 require_once ABSPATH . 'wp-admin/includes/upgrade.php'; … … 208 204 $table_items = $mg_upc->model->items->get_table_list_items(); 209 205 //phpcs:ignore 210 $wpdb->query( "ALTER TABLE {$table_items}ADD `quantity` int(11) UNSIGNED NOT NULL DEFAULT 0 AFTER `votes`;" );206 $wpdb->query( "ALTER TABLE $table_items ADD `quantity` int(11) UNSIGNED NOT NULL DEFAULT 0 AFTER `votes`;" ); 211 207 } 212 208 … … 218 214 $table_items = $mg_upc->model->items->get_table_list_items(); 219 215 //phpcs:ignore 220 $wpdb->query( "ALTER TABLE {$table_items}ADD `addon_json` longtext DEFAULT NULL AFTER `description`;" );216 $wpdb->query( "ALTER TABLE $table_items ADD `addon_json` longtext DEFAULT NULL AFTER `description`;" ); 221 217 } 222 218 } -
user-post-collections/trunk/classes/mg-upc-list-types-register.php
r2768965 r3190768 105 105 'show_in_settings', 106 106 ), 107 ' default_supports'=> array(107 'supports' => array( 108 108 'editable_item_description', 109 109 'show_in_my_lists', 110 'always_exists', //this create an end point with bookmarks instead the ID110 'always_exists', 111 111 'show_in_settings', 112 112 ), -
user-post-collections/trunk/classes/mg-upc-settings.php
r2856776 r3190768 297 297 // translators: not change %title%, %author%, %sitename% 298 298 'desc' => __( 'You can use %title%, %author%, %sitename%.', 'user-post-collections' ), 299 'default' => '%title% by %author% | User List | %sitename%',299 'default' => '%title% by %author% | User Lists | %sitename%', 300 300 'type' => 'text', 301 301 ); … … 308 308 'type' => 'radio', 309 309 'options' => array( 310 'off' => __( 'Non store', 'user-post-collections' ),311 'on' => __( 'Store IP', 'user-post-collections' ),310 'off' => __( 'Non store', 'user-post-collections' ), 311 'on' => __( 'Store IP', 'user-post-collections' ), 312 312 ), 313 313 ); … … 616 616 'mg_up_roles', 617 617 'mg_up_roles' . $list_type->name . '_err', 618 "Invalid role {$role_slug}"618 "Invalid role $role_slug" 619 619 ); 620 620 continue; … … 998 998 * Sanitize number option 999 999 * 1000 * @param $value1001 * @param $option1002 * @param $original_value1003 * @param $config1000 * @param mixed $value 1001 * @param string $option 1002 * @param int|float $original_value 1003 * @param array $config 1004 1004 * 1005 1005 * @return int|float -
user-post-collections/trunk/classes/user-post-collections.php
r2856778 r3190768 35 35 'MG_UPC_List_Controller' => MG_UPC_List_Controller::get_instance(), 36 36 'MG_UPC_List_Page' => MG_UPC_List_Page::get_instance(), 37 'MG_UPC_List_Page_Settings' => MG_UPC_List_Page_Settings::get_instance(), 37 38 'MG_UPC_Database' => MG_UPC_Database::get_instance(), 38 39 'MG_UPC_Rest_API' => MG_UPC_Rest_API::get_instance(), 39 40 'MG_UPC_Buttons' => MG_UPC_Buttons::get_instance(), 40 41 'MG_UPC_Woocommerce' => MG_UPC_Woocommerce::get_instance(), 42 'MG_UPC_Shortcode' => MG_UPC_Shortcode::get_instance(), 41 43 ); 42 44 … … 251 253 $module->init(); 252 254 } 255 if ( get_option( 'mg_upc_flush_rewrite', '0' ) === '1' ) { 256 update_option( 'mg_upc_flush_rewrite', '0' ); 257 flush_rewrite_rules(); 258 } 253 259 } 254 260 -
user-post-collections/trunk/controllers/mg-list-page-alt.php
r2770186 r3190768 8 8 private static $page_id = 0; 9 9 10 public function __construct() { } 10 private static $doing_shortcodes = false; 11 12 public function __construct() { 13 // Add base url hook 14 add_filter( 'mg_upc_base_url', array( 'MG_UPC_List_Page', 'base_url_filter' ), 10, 1 ); 15 } 11 16 12 17 public function init() { 13 18 14 //Search page saved as collection single page (Created on the activate )19 //Search page saved as collection single page (Created on the activated) 15 20 self::$page_id = self::get_page_id(); 16 21 17 22 if ( self::$page_id > 0 ) { 18 // Add query vars for collection page : list and list-page (for pagination)23 // Add query vars for collection page. Example: list and list-page (for pagination) 19 24 add_filter( 'query_vars', array( $this, 'add_list_query_var' ) ); 20 25 // Add the rewrite rule using slug from $page_id 21 $this->add_rewrite(); 22 if ( get_option( 'mg_upc_flush_rewrite', '0' ) === '1' ) { 23 update_option( 'mg_upc_flush_rewrite', '0' ); 24 flush_rewrite_rules(); 25 } 26 } 27 28 if ( is_admin() ) { 29 add_filter( 'mg_upc_settings_fields', array( $this, 'add_settings_fields' ) ); 30 add_action( 'save_post_page', array( $this, 'save_post_page' ), 10, 1 ); 26 self::add_rewrite(); 31 27 } 32 28 … … 45 41 add_filter( 'wpseo_opengraph_url', array( $this, 'list_canonical' ), 10, 2 ); 46 42 add_filter( 'prepare_list_data_for_response', array( $this, 'add_link_to_list_response' ) ); 43 add_filter( 'mg_upc_get_the_permalink', array( $this, 'filter_get_the_permalink' ), 10, 2 ); 44 add_filter( 'mg_upc_list_url', array( $this, 'mg_upc_list_url' ), 10, 2 ); 47 45 48 46 /* Image Hook*/ … … 50 48 51 49 /* Shortcode */ 52 add_shortcode( 'user_post_collection', array( $this, ' list_shortcode' ) );50 add_shortcode( 'user_post_collection', array( $this, 'page_shortcode' ) ); 53 51 54 52 /* Templates hook */ … … 58 56 59 57 /* Set global $mg_upc_list if query a collection*/ 60 add_action( 'parse_request', array( $this, 'parse_request' ), 10, 1 );58 add_action( 'parse_request', array( $this, 'parse_request' ), 90, 1 ); 61 59 62 60 /* Remove page links from head */ 63 61 add_action( 'template_redirect', array( $this, 'remove_links' ) ); 64 65 // Add a post display state for special page. 66 add_filter( 'display_post_states', array( $this, 'add_display_post_states' ), 10, 2 ); 67 68 } 69 70 public function save_post_page( $post_id ) { 71 if ( $post_id === self::$page_id ) { 72 $this->add_rewrite(); 73 flush_rewrite_rules(); 74 } 75 } 76 77 /** 78 * Add a post display state for special page in the page list table. 79 * 80 * @param array $post_states An array of post display states. 81 * @param WP_Post $post The current post object. 82 * 83 * @return array 84 */ 85 public function add_display_post_states( $post_states, $post ) { 86 if ( self::$page_id === $post->ID ) { 87 $post_states['mg_upc_page_for_list'] = __( 'User Post Collection Page', 'user-post-collections' ); 88 } 89 90 return $post_states; 91 } 92 93 /** 94 * If a list is requested load global $mg_upc_list 62 } 63 64 /** 65 * If list page is requested set variables 95 66 * 96 67 * @param $query … … 99 70 */ 100 71 public function parse_request( $query ) { 72 global $mg_upc_the_query; 73 if ( ! empty( $query->query_vars['pagename'] ) ) { 74 $page = WP_Post::get_instance( self::$page_id ); 75 if ( $page && $page->post_name === $query->query_vars['pagename'] ) { 76 $query->query_vars['page_id'] = self::$page_id; 77 } 78 } 79 101 80 if ( 102 81 isset( $query->query_vars['page_id'] ) && 103 (int) self::$page_id === (int) $query->query_vars['page_id'] && 104 isset( $query->query_vars['list'] ) 82 (int) self::$page_id === (int) $query->query_vars['page_id'] 105 83 ) { 106 $this->get_list_requested( false ); 107 remove_filter( 'the_content', array( 'MG_UPC_Buttons', 'the_content' ) ); 108 } 109 84 $atts = array(); 85 if ( isset( $query->query_vars['list'] ) ) { 86 if ( is_int( $query->query_vars['list'] ) ) { 87 $atts['ID'] = $query->query_vars['list']; 88 } elseif ( is_string( $query->query_vars['list'] ) ) { 89 $atts['name'] = $query->query_vars['list']; 90 } 91 $atts['lists_per_page'] = 1; 92 } elseif ( 'on' === get_option( 'mg_upc_archive_enable', 'on' ) ) { 93 if ( 'on' === get_option( 'mg_upc_archive_filter_author', 'on' ) ) { 94 $atts['author'] = $query->query_vars['list-author'] ?? ''; 95 $atts['author_name'] = $query->query_vars['list-author-name'] ?? ''; 96 } 97 if ( 'on' === get_option( 'mg_upc_archive_filter_type', 'on' ) ) { 98 $atts['list_type'] = $query->query_vars['list-type'] ?? ''; 99 } 100 $atts['paged'] = $query->query_vars['lists-page'] ?? 1; 101 $atts['orderby'] = $query->query_vars['lists-orderby'] ?? ''; 102 $atts['order'] = $query->query_vars['lists-order'] ?? ''; 103 $atts['lists_per_page'] = get_option( 'mg_upc_archive_item_per_page', 12 ); 104 } else { 105 return $query; 106 } 107 $mg_upc_the_query = new MG_UPC_Query( $atts ); 108 109 if ( $mg_upc_the_query->is_single() ) { 110 remove_filter( 'the_content', array( 'MG_UPC_Buttons', 'the_content' ) ); 111 } 112 } 110 113 return $query; 111 114 } … … 114 117 * Set the collection "single" url 115 118 */ 116 public function add_rewrite() { 117 if ( self::$page_id > 0 ) { 118 $list_page_link = get_page_link( self::$page_id ); 119 if ( ! empty( $list_page_link ) ) { 120 $reg = '^' . trim( wp_make_link_relative( $list_page_link ), '/' ) . '/([A-Za-z0-9\._\-@ ]+)/?$'; 121 add_rewrite_rule( 122 $reg, 123 'index.php?page_id=' . self::$page_id . '&post_type=page&list=$matches[1]', 124 'top' 125 ); 126 } 119 public static function add_rewrite() { 120 $base_url = self::get_base_url( true ); 121 if ( ! empty( $base_url ) && self::$page_id > 0 ) { 122 $reg = '^' . trim( $base_url, '/' ) . '/([A-Za-z0-9\._\-@ ]+)/?$'; 123 add_rewrite_rule( 124 $reg, 125 'index.php?page_id=' . self::$page_id . '&post_type=page&list=$matches[1]', 126 'top' 127 ); 127 128 } 128 129 } … … 165 166 $template = locate_template( $search_files ); 166 167 if ( ! $template ) { 167 $template = mg_upc_get_templates_path() . '/' . $default_file; 168 $template = trailingslashit( mg_upc_get_templates_path() ) . $default_file; 169 } 170 171 // Set global query 172 global $mg_upc_the_query, $mg_upc_query; 173 if ( ! empty( $mg_upc_the_query ) ) { 174 $mg_upc_query = $mg_upc_the_query; 168 175 } 169 176 } … … 178 185 */ 179 186 private static function get_template_loader_default_file() { 180 181 187 $default_file = ''; 182 188 if ( is_singular( 'page' ) ) { 183 189 if ( self::is_requesting_list_page() ) { 184 if ( false === self::get_list_requested() ) { 190 if ( 191 empty( get_query_var( 'list', false ) ) && 192 'on' === get_option( 'mg_upc_archive_enable', 'on' ) 193 ) { 194 $default_file = 'archive-mg-upc.php'; 195 } elseif ( false === self::get_list_requested() ) { 185 196 $default_file = '404.php'; 186 197 } else { … … 232 243 $vars[] = 'list'; 233 244 $vars[] = 'list-page'; 245 $vars[] = 'list-type'; 246 $vars[] = 'list-author'; 247 $vars[] = 'list-author-name'; 248 $vars[] = 'lists-page'; 249 $vars[] = 'lists-orderby'; 250 $vars[] = 'lists-order'; 234 251 235 252 return $vars; … … 250 267 251 268 return $list; 269 } 270 271 /** 272 * Set the list link 273 * 274 * @param string|null $url 275 * @param MG_UPC_List $list 276 * 277 * @return null|string 278 */ 279 public function mg_upc_list_url( $url, $list ) { 280 281 if ( mg_upc_is_list_publicly_viewable( $url ) ) { 282 return $this->get_list_url( $list ); 283 } 284 285 return $url; 286 } 287 288 /** 289 * Set the list link 290 * 291 * @param $permalink 292 * @param $list 293 * 294 * @return string 295 */ 296 public function filter_get_the_permalink( $permalink, $list ) { 297 $link = $this->get_list_url( $list ); 298 299 return empty( $link ) ? $permalink : $link; 252 300 } 253 301 … … 274 322 * @param bool $check_list_req 275 323 * 276 * @return array|bool324 * @return MG_UPC_List|bool 277 325 */ 278 326 public static function get_list_requested( $check_list_req = true ) { 327 /** @global MG_UPC_Query $mg_upc_query */ 328 global $mg_upc_the_query; 329 if ( ! $mg_upc_the_query || ! $mg_upc_the_query->is_single() ) { 330 return false; 331 } 279 332 280 333 if ( isset( $GLOBALS['mg_upc_list'] ) ) { … … 286 339 } 287 340 288 if ( ! empty( get_query_var( 'list', false ) ) ) { 289 return self::set_global_list( get_query_var( 'list', false ) ); 341 if ( $mg_upc_the_query && $mg_upc_the_query->is_single() && $mg_upc_the_query->have_lists() ) { 342 $mg_upc_the_query->the_list(); 343 return $GLOBALS['mg_upc_list']; 290 344 } 291 345 … … 298 352 * @param $list 299 353 * 300 * @return array|bool|object|WP_Error354 * @return bool|MG_UPC_List|object 301 355 */ 302 356 private static function set_global_list( $list ) { … … 306 360 307 361 if ( $list && mg_upc_is_list_publicly_viewable( $list ) ) { 308 $GLOBALS['mg_upc_list'] = MG_UPC_List_Controller::get_instance()->get_list_for_response( 309 array( 310 'id' => (int) $list->ID, 311 'items_per_page' => (int) get_option( 'mg_upc_item_per_page', 50 ), 312 'items_page' => get_query_var( 'list-page', 1 ), 313 ) 314 ); 315 316 if ( is_wp_error( $GLOBALS['mg_upc_list'] ) ) { 362 $GLOBALS['mg_upc_list'] = MG_UPC_List::get_instance( $list ); 363 if ( ! empty( $GLOBALS['mg_upc_list']->errors ) ) { 317 364 $GLOBALS['mg_upc_list'] = false; 318 365 } … … 333 380 */ 334 381 public function list_title( $old_title, $presentation = false ) { 382 global $mg_upc_the_query; 383 384 $new_title = false; 385 335 386 $list = self::get_list_requested(); 336 if ( ! empty( $list )) {387 if ( $list instanceof MG_UPC_List && $list->ID > 0 ) { 337 388 $parts = array( 338 389 '%title%' => $list['title'], … … 340 391 '%sitename%' => get_bloginfo( 'name' ), 341 392 ); 342 $template = get_option( 'mg_upc_single_title', '%title% by %author% | User List | %sitename%' );393 $template = get_option( 'mg_upc_single_title', '%title% by %author% | User Lists | %sitename%' ); 343 394 $new_title = str_replace( array_keys( $parts ), array_values( $parts ), $template ); 395 } else { 396 if ( $mg_upc_the_query ) { 397 if ( $mg_upc_the_query->is_author() ) { 398 $new_title = $this->get_author_title( $mg_upc_the_query->is_type(), true ); 399 } elseif ( $mg_upc_the_query->is_type() ) { 400 $new_title = $this->get_type_title( true ); 401 } elseif ( self::is_requesting_list_page() ) { 402 $new_title = $this->get_archive_title( 403 'mg_upc_archive_title', 404 array(), 405 true, 406 'User Lists' 407 ); 408 } 409 } 410 } 411 if ( false !== $new_title ) { 344 412 return apply_filters( 'mg_upc_list_doc_title_replace', $new_title, $old_title, $presentation ); 345 413 } … … 359 427 remove_filter( 'the_title', array( $this, 'the_title' ), 10 ); 360 428 $list = self::get_list_requested(); 361 if ( ! empty( $list )) {429 if ( $list instanceof MG_UPC_List && $list->ID > 0 ) { 362 430 $title = $list['title']; 431 } else { 432 /** @global $mg_upc_the_query MG_UPC_Query */ 433 global $mg_upc_the_query; 434 if ( $mg_upc_the_query ) { 435 if ( $mg_upc_the_query->is_author() ) { 436 $title = $this->get_author_title( $mg_upc_the_query->is_type(), false ); 437 } elseif ( $mg_upc_the_query->is_type() ) { 438 $title = $this->get_type_title( false ); 439 } elseif ( self::is_requesting_list_page() ) { 440 $title = $this->get_archive_title( 441 'mg_upc_archive_title', 442 array(), 443 false, 444 'User Lists' 445 ); 446 } 447 } 363 448 } 364 449 add_filter( 'the_title', array( $this, 'the_title' ), 10, 2 ); 365 450 } 366 451 return $title; 452 } 453 454 /** 455 * Get the title for list types archive lists 456 * 457 * @return string 458 */ 459 private function get_type_title( $document_title ) { 460 return $this->get_archive_title( 461 'mg_upc_archive_title_type', 462 array( '%type%' => self::get_query_type() ), 463 $document_title, 464 'User Lists | %type%' 465 ); 466 } 467 468 /** 469 * Get the title for an author archive lists 470 * 471 * @return string 472 */ 473 private function get_author_title( $with_type, $document_title ) { 474 $author = self::get_query_login(); 475 476 if ( empty( $author ) ) { 477 $new_title = __( 'User not found', 'user-post-collections' ); 478 } else { 479 $option = 'mg_upc_archive_title_author'; 480 $default = __( 'Lists created by %author%', 'user-post-collections' ); 481 $parts = array( '%author%' => $author ); 482 if ( $with_type ) { 483 $parts['%type%'] = self::get_query_type(); 484 $option = 'mg_upc_archive_title_author_type'; 485 $default = __( 'Lists created by %author% | %type%', 'user-post-collections' ); 486 } 487 $new_title = $this->get_archive_title( $option, $parts, $document_title, $default ); 488 } 489 return $new_title; 490 } 491 492 private function get_archive_title( $template_option, $parts, $document_title, $default_template ) { 493 $parts['%sitename%'] = get_bloginfo( 'name' ); 494 495 $template = get_option( $template_option, $default_template ); 496 $new_title = str_replace( array_keys( $parts ), array_values( $parts ), $template ); 497 498 if ( $document_title ) { 499 $template = get_option( 'mg_upc_archive_document_title', '%upctitle% | %sitename%' ); 500 $parts = array( 501 '%sitename%' => get_bloginfo( 'name' ), 502 '%upctitle%' => $new_title, 503 ); 504 505 $new_title = str_replace( array_keys( $parts ), array_values( $parts ), $template ); 506 } 507 return $new_title; 508 } 509 510 public static function get_query_type( $query = null ) { 511 if ( ! $query ) { 512 global $mg_upc_query, $mg_upc_the_query; 513 if ( ! empty( $mg_upc_query ) ) { 514 $query = $mg_upc_query; 515 } elseif ( ! empty( $mg_upc_the_query ) ) { 516 $query = $mg_upc_the_query; 517 } else { 518 return ''; 519 } 520 } 521 $type_labels = array(); 522 if ( $query->get( 'list_type', true ) ) { 523 $types = $query->get( 'list_type', true ); 524 foreach ( $types as $type ) { 525 $list_type = MG_UPC_Helper::get_instance()->get_list_type( $type, true ); 526 if ( $list_type ) { 527 $type_labels[] = $list_type['plural_label']; 528 } 529 } 530 } 531 532 return implode( ', ', $type_labels ); 533 } 534 public static function get_query_login( $query = null ) { 535 if ( ! $query ) { 536 global $mg_upc_query, $mg_upc_the_query; 537 if ( ! empty( $mg_upc_query ) ) { 538 $query = $mg_upc_query; 539 } elseif ( ! empty( $mg_upc_the_query ) ) { 540 $query = $mg_upc_the_query; 541 } else { 542 return ''; 543 } 544 } 545 $author_login = ''; 546 if ( $query->get( 'author', false ) ) { 547 $author_login = MG_UPC_Helper::get_instance()->get_user_login( (int) $query->get( 'author', false ) ); 548 } 549 if ( $query->get( 'author_name', false ) ) { 550 $author_name = mg_upc_sanitize_username( $query->get( 'author_name', false ) ); 551 $author = get_user_by( 'slug', $author_name ); 552 if ( $author ) { 553 $author_login = $author->user_login; 554 } 555 } 556 557 return $author_login; 367 558 } 368 559 … … 373 564 * @param bool|object $presentation 374 565 * 375 * @return mixed566 * @return string 376 567 * 377 568 * @noinspection PhpUnusedParameterInspection … … 379 570 public function list_desc( $desc, $presentation = false ) { 380 571 $list = self::get_list_requested(); 381 if ( ! empty( $list )) {572 if ( $list instanceof MG_UPC_List && $list->ID > 0 ) { 382 573 return wp_strip_all_tags( $list['content'] ); 383 574 } … … 392 583 * @param bool|object $presentation 393 584 * 394 * @return mixed585 * @return string|null 395 586 * 396 587 * @noinspection PhpUnusedParameterInspection … … 398 589 public function list_canonical( $link, $presentation = false ) { 399 590 $list = self::get_list_requested(); 400 if ( ! empty( $list )) {591 if ( $list instanceof MG_UPC_List && $list->ID > 0 ) { 401 592 return $this->get_list_url( $list ); 402 593 } … … 414 605 public function list_opengraph_image( $image_container ) { 415 606 $list = self::get_list_requested(); 416 if ( ! empty( $list )) {607 if ( $list instanceof MG_UPC_List && $list->ID > 0 ) { 417 608 $items = $list['items']; 418 609 … … 436 627 437 628 /** 629 * Shortcode on the reserved page ( legacy ) 630 * 631 * @param array $atts Array or empty string 632 * 633 * @return false|string 634 * 635 * @deprecated since 0.9.0 636 */ 637 public function list_shortcode( $atts = array() ) { 638 return $this->page_shortcode( $atts ); 639 } 640 641 /** 438 642 * Shortcode on the reserved page 439 643 * 440 * @param array $atts 644 * @param array $atts Array or empty string 441 645 * 442 646 * @return false|string 443 647 */ 444 public function list_shortcode( $atts = array() ) { 648 public function page_shortcode( $atts = array() ) { 649 global $mg_upc_the_query, $mg_upc_query; 650 if ( self::$doing_shortcodes ) { 651 return ''; 652 } 653 self::$doing_shortcodes = true; 654 ob_start(); 655 if ( ! is_array( $atts ) ) { 656 $atts = array(); 657 } 658 // Using page template title: 659 remove_action( 'mg_upc_single_list_content', 'mg_upc_template_single_title', 5 ); 660 445 661 if ( isset( $atts['id'] ) ) { 446 662 self::set_global_list( (int) $atts['id'] ); 447 } 448 449 // Using page template title: 450 remove_action( 'mg_upc_single_list_content', 'mg_upc_template_single_title', 5 ); 451 452 ob_start(); 453 if ( ! isset( $GLOBALS['mg_upc_list'] ) || false === $GLOBALS['mg_upc_list'] ) { 663 if ( empty( $GLOBALS['mg_upc_list'] ) ) { 664 mg_upc_get_template( 'shortcode-404.php' ); 665 } else { 666 mg_upc_get_template( 'content-single-mg-upc.php' ); 667 } 668 return ob_get_clean(); 669 } 670 if ( ! empty( $mg_upc_the_query ) ) { 671 mg_upc_reset_query(); 672 } 673 if ( ! isset( $mg_upc_query ) ) { 674 self::$doing_shortcodes = false; 675 return ''; 676 } 677 if ( $mg_upc_query->is_single() ) { 678 if ( empty( $GLOBALS['mg_upc_list'] ) ) { 679 mg_upc_get_template( 'shortcode-404.php' ); 680 } else { 681 mg_upc_get_template( 'content-single-mg-upc.php' ); 682 } 683 } elseif ( 'on' === get_option( 'mg_upc_archive_enable', 'on' ) ) { 684 $atts = array( 685 'pagination' => 1, 686 'tpl-desc' => get_option( 'mg_upc_archive_item_template_desc', 'off' ), 687 'tpl-thumbs' => '2x2', 688 'tpl-user' => get_option( 'mg_upc_archive_item_template_user', 'on' ), 689 'tpl-meta' => get_option( 'mg_upc_archive_item_template_meta', 'on' ), 690 'tpl-items' => get_option( 'mg_upc_archive_item_template', 'list' ), 691 'tpl-cols-xxl' => get_option( 'mg_upc_archive_item_template_cols_xxl', '4' ), 692 'tpl-cols-xl' => get_option( 'mg_upc_archive_item_template_cols_xl', '4' ), 693 'tpl-cols-lg' => get_option( 'mg_upc_archive_item_template_cols_lg', '4' ), 694 'tpl-cols-md' => get_option( 'mg_upc_archive_item_template_cols_md', '3' ), 695 'tpl-cols-sm' => get_option( 'mg_upc_archive_item_template_cols_sm', '2' ), 696 'tpl-cols-xs' => get_option( 'mg_upc_archive_item_template_cols_xs', '1' ), 697 'tpl-thumbs-xxl' => get_option( 'mg_upc_archive_item_template_thumbs_xxl', '2x2' ), 698 'tpl-thumbs-xl' => get_option( 'mg_upc_archive_item_template_thumbs_xl', '2x2' ), 699 'tpl-thumbs-lg' => get_option( 'mg_upc_archive_item_template_thumbs_lg', '2x2' ), 700 'tpl-thumbs-md' => get_option( 'mg_upc_archive_item_template_thumbs_md', '2x2' ), 701 'tpl-thumbs-sm' => get_option( 'mg_upc_archive_item_template_thumbs_sm', '2x2' ), 702 'tpl-thumbs-xs' => get_option( 'mg_upc_archive_item_template_thumbs_xs', '4x1' ), 703 ); 704 mg_upc_template_loop( $atts ); 705 } else { 454 706 mg_upc_get_template( 'shortcode-404.php' ); 455 } else {456 mg_upc_get_template( 'content-single-mg-upc.php' ); 457 }707 } 708 709 self::$doing_shortcodes = false; 458 710 return ob_get_clean(); 459 711 } 460 712 461 713 /** 462 * Get the li nt url714 * Get the list url 463 715 * 464 716 * @param array|object $list 465 717 * 466 * @return string |void718 * @return string 467 719 */ 468 720 public function get_list_url( $list ) { … … 474 726 } 475 727 if ( ! empty( $slug ) ) { 476 if ( self::$page_id > 0 ) { 477 $val = get_page_link( self::$page_id ); 478 if ( ! empty( $val ) ) { 479 $val = wp_make_link_relative( $val ); 480 if ( false === strpos( $val, '?' ) ) { 481 return home_url( '/' . trim( $val, '/' ) . '/' . rawurlencode( $slug ) ); 482 } 483 return home_url( '/' . add_query_arg( array( 'list' => rawurlencode( $slug ) ), $val ) ); 484 } 728 $val = self::get_base_url( true ); 729 if ( ! empty( $val ) ) { 730 if ( false === strpos( $val, '?' ) ) { 731 return home_url( '/' . trim( $val, '/' ) . '/' . rawurlencode( $slug ) ); 732 } 733 return home_url( '/' . add_query_arg( array( 'list' => rawurlencode( $slug ) ), $val ) ); 485 734 } 486 735 } … … 488 737 } 489 738 490 /** 491 * On plugin activated 492 * 493 * @param bool $network_wide 494 */ 495 public function activate( $network_wide ) { 496 497 update_option( 'mg_upc_flush_rewrite', '1' ); 498 499 self::$page_id = self::get_page_id(); 739 public static function base_url_filter( $url ) { 740 if ( 0 === self::$page_id ) { 741 self::$page_id = self::get_page_id(); 742 } 500 743 if ( self::$page_id > 0 ) { 501 $status = get_post_status( self::$page_id ); 502 if ( is_string( $status ) ) { 503 if ( 'trash' === $status ) { 504 wp_untrash_post( self::$page_id ); 505 wp_publish_post( self::$page_id ); 506 } 507 $list_page_link = get_page_link( self::$page_id ); 508 if ( ! empty( $list_page_link ) ) { 509 return; 510 } 511 } 512 } 513 514 //Create a page reserved for collection single 515 $post = array( 516 'post_title' => 'User Post Collection', 517 'post_content' => "<!-- wp:shortcode -->\n[user_post_collection]\n<!-- /wp:shortcode -->", 518 'post_type' => 'page', 519 'post_status' => 'publish', 520 ); 521 522 $post_id = wp_insert_post( $post ); 523 update_option( 'mg_upc_single_page', $post_id ); 524 525 $this->add_rewrite(); 526 } 527 528 /** 529 * Add settings filed for manage page 530 * 531 * @param $settings_fields 532 * 533 * @return mixed 534 */ 535 public function add_settings_fields( $settings_fields ) { 536 $new = array( 537 array( 538 'name' => 'mg_upc_single_page', 539 'label' => __( 'Collection Page', 'user-post-collections' ), 540 'desc' => __( 'make sure the shortcode [user_post_collection] is present on the selected page', 'user-post-collections' ), 541 'default' => self::get_page_id(), 542 'type' => 'pages', 543 'sanitize_callback_params' => 3, 544 'sanitize_callback' => function ( $value, $option, $original_value ) { 545 if ( ! is_numeric( $value ) ) { 546 return $original_value; 547 } 548 549 if ( $value !== $original_value ) { 550 update_option( 'mg_upc_flush_rewrite', '1' ); 551 } 552 553 return $value; 554 }, 555 ), 556 array( 557 'name' => 'mg_upc_single_page_mode', 558 'label' => __( 'Collection Page Template', 'user-post-collections' ), 559 'desc' => __( 'Try change this if the single list page not show as you like.', 'user-post-collections' ), 560 'default' => 'template_page', 561 'type' => 'radio', 562 'options' => array( 563 'template_upc' => __( 'Load UPC template', 'user-post-collections' ), 564 'template_page' => __( 'Load inside the default selected page template', 'user-post-collections' ), 565 ), 566 ), 567 ); 568 $settings_fields['mg_upc_general'] = array_merge( 569 $new, 570 $settings_fields['mg_upc_general'] 571 ); 572 573 return $settings_fields; 574 } 575 576 public function deactivate() { 577 self::$page_id = self::get_page_id(); 578 if ( self::$page_id > 0 ) { 579 $status = get_post_status( self::$page_id ); 580 if ( is_string( $status ) ) { 581 wp_trash_post( self::$page_id ); 582 } 583 } 744 $url = get_page_link( self::$page_id ); 745 } 746 return $url; 747 } 748 749 public static function get_base_url( $relative = false ) { 750 $url = apply_filters( 'mg_upc_base_url', '' ); 751 if ( $relative ) { 752 return wp_make_link_relative( $url ); 753 } 754 return $url; 584 755 } 585 756 586 757 public function register_hook_callbacks() { } 587 758 588 public function upgrade( $db_version = 0 ) { 589 if ( version_compare( $db_version, '0.7.1', '<' ) ) { 590 update_option( 'mg_upc_flush_rewrite', '0' );591 } 592 }759 public function upgrade( $db_version = 0 ) { } 760 761 public function activate( $network_wide ) { } 762 763 public function deactivate() { } 593 764 } -
user-post-collections/trunk/controllers/mg-upc-list-controller.php
r2768965 r3190768 73 73 //check user can edit list types 74 74 $unable_to_edit = array(); 75 foreach ( $my_list_types as $ k => $name_type ) {75 foreach ( $my_list_types as $name_type ) { 76 76 $_type = $helper->get_list_type( $name_type ); 77 77 if ( ! current_user_can( $_type->get_cap()->edit_posts ) ) { … … 169 169 * 170 170 * @param int|WP_REST_Request|array $config_or_request If is int type, then use as list_id 171 * If array, used keys: 'id'(required), 'exclude_not_found_error'171 * If is array, used keys: 'id'(required), 'exclude_not_found_error' 172 172 * If is WP_REST_Request, then params equivalents to as array 173 173 * … … 209 209 * 210 210 * @param int|WP_REST_Request|array $config_or_request If is int type, then use as list_id 211 * If array, used keys: 'id'(required), 'context', 'items_page', 'items_per_page'211 * If is array, used keys: 'id'(required), 'context', 'items_page', 'items_per_page' 212 212 * If is WP_REST_Request, then params equivalents to as array 213 213 * … … 235 235 * 236 236 * @param array|int|WP_REST_Request $config_or_request If is int type, then use as list_id 237 * If array, used keys: 'id'(required), 'page', 'per_page', 'orderby', 'order'237 * If is array, used keys: 'id'(required), 'page', 'per_page', 'orderby', 'order' 238 238 * If is WP_REST_Request, then params equivalents to as array 239 239 * … … 372 372 373 373 if ( ! empty( $list_data['created'] ) ) { 374 $list_data['created'] = gmdate( D ATE_ISO8601, strtotime( $list_data['created'] ) );374 $list_data['created'] = gmdate( DateTime::ATOM, strtotime( $list_data['created'] ) ); 375 375 } 376 376 377 377 if ( ! empty( $list_data['modified'] ) ) { 378 $list_data['modified'] = gmdate( DATE_ISO8601, strtotime( $list_data['modified'] ) ); 379 } 380 381 $list_data = apply_filters( 'prepare_list_data_for_response', $list_data, $list, $config ); 382 383 return $list_data; 378 $list_data['modified'] = gmdate( DateTime::ATOM, strtotime( $list_data['modified'] ) ); 379 } 380 381 return apply_filters( 'prepare_list_data_for_response', $list_data, $list, $config ); 384 382 } 385 383 … … 434 432 435 433 $excerpt = apply_filters( 'get_the_excerpt', $post->post_excerpt, $post ); 436 /** This filter is documented in wp-includes/post-template.php */ 437 $excerpt = apply_filters( 'the_excerpt', $excerpt ); 434 435 // Infinite loop protection 436 global $wp_current_filter; 437 $counts = array_count_values( $wp_current_filter ); 438 if ( isset( $counts['the_excerpt'] ) && $counts['the_excerpt'] < 2 ) { 439 /** This filter is documented in wp-includes/post-template.php */ 440 $excerpt = apply_filters( 'the_excerpt', $excerpt ); 441 } 438 442 $data['excerpt'] = post_password_required( $post ) ? '' : $excerpt; 439 443 440 $data['featured_media'] = '' . get_post_thumbnail_id( $post->ID ); //to string for max int on other plat aforms444 $data['featured_media'] = '' . get_post_thumbnail_id( $post->ID ); //to string for max int on other platforms 441 445 $data['image'] = get_the_post_thumbnail_url( $post->ID ); // or add size , 'medium' 442 446 … … 616 620 617 621 /** 618 * Check if the user can read a nspecified list622 * Check if the user can read a specified list 619 623 * 620 624 * @param int $list_id … … 634 638 635 639 /** 636 * Check if the user can read private a nspecified list type640 * Check if the user can read private a specified list type 637 641 * 638 642 * @param string $list_type … … 652 656 653 657 /** 654 * Check if the user can edit a nspecified list658 * Check if the user can edit a specified list 655 659 * 656 660 * @param int $list_id … … 669 673 670 674 /** 671 * Check if the user can delete a nspecified list675 * Check if the user can delete a specified list 672 676 * 673 677 * @param int $list_id -
user-post-collections/trunk/controllers/mg-upc-rest-list-controller.php
r2768965 r3190768 486 486 487 487 $response = $this->prepare_list_for_response( $list, $request ); 488 $response = rest_ensure_response( $response ); 489 490 return $response; 488 489 return rest_ensure_response( $response ); 491 490 } 492 491 … … 670 669 public function get_lists( $request ) { 671 670 671 if ( isset( $request['status'] ) && ! is_array( $request['status'] ) ) { 672 $request['status'] = array( $request['status'] ); 673 } 674 if ( isset( $request['types'] ) && ! is_array( $request['types'] ) ) { 675 $request['types'] = array( $request['types'] ); 676 } 677 672 678 $args = array( 673 679 'limit' => $request['per_page'], … … 697 703 } 698 704 699 if ( isset( $request['status'] ) && ! is_array( $request['status'] ) ) { 700 $request['status'] = array( $request['status'] ); 701 } 702 if ( isset( $request['type'] ) && ! is_array( $request['type'] ) ) { 703 $request['type'] = array( $request['type'] ); 704 } 705 706 //limit to searcheable list types and statuses 705 //limit to searchable list types and statuses 707 706 if ( ! empty( $args['search'] ) ) { 708 707 $searchable_list_type = MG_UPC_Helper::get_instance()->get_searchable_list_types(); … … 713 712 $request['status'] = $searchable_list_status; 714 713 } 715 if ( isset( $request['type'] ) && ! in_array( 'any', $request['type'], true ) ) { 716 $request['type'] = array_intersect( $request['type'], $searchable_list_type ); 714 //TODO: not filter for admin? 715 if ( isset( $request['types'] ) && ! in_array( 'any', $request['types'], true ) ) { 716 $args['type'] = array_intersect( $request['types'], $searchable_list_type ); 717 717 } else { 718 $ request['type'] = $searchable_list_type;718 $args['type'] = $searchable_list_type; 719 719 } 720 720 } … … 728 728 ) { 729 729 if ( empty( $args['author'] ) || get_current_user_id() !== $args['author'] ) { 730 if ( 731 ! empty( $args['type'] ) && 732 ! in_array( 'any', $args['type'], true ) 733 ) { 734 $list_types_to_access = $args['type']; 730 $only_public_status = false; 731 //valid list types with the private statuses filter 732 $list_types_filter = MG_UPC_Helper::get_instance()->get_list_types_can_private_read( $args['type'] ); 733 /* 734 * This disables listing mixed list types <-> private and public read status 735 * Example: 736 * If the current user has permissions to view public and private bookmarks, 737 * but only has permissions to view favorites with public status. 738 * A query with: 739 * - status=published,private and 740 * - list_type=bookmark,favorites 741 * Will be processed as: 742 * - status=published,private and 743 * - list_type=bookmark 744 * In the future it should be processed like: 745 * (type=bookmark AND status IN (published, private)) OR 746 * (type=favorite AND status = published ) 747 * 748 * (*) If current user only can read public lists for both types, will be processed as: 749 * - status=published 750 * - list_type=bookmark,favorites 751 **/ 752 //TODO: mixed query 753 if ( ! empty( $list_types_filter ) ) { 754 $args['type'] = $list_types_filter; // Only types that user can read with private status 735 755 } else { 736 $ list_types_to_access = array_keys( MG_UPC_Helper::get_instance()->get_list_types() );756 $only_public_status = true; // Don't find private statuses 737 757 } 738 $ok_access_list_types = array(); //list type with permission ok 739 foreach ( $list_types_to_access as $list_type ) { 740 if ( MG_UPC_List_Controller::get_instance()->can_read_private_type( $list_type ) ) { 741 $ok_access_list_types[] = $list_type; 742 } 743 } 744 if ( ! empty( $ok_access_list_types ) ) { 745 $args['type'] = $ok_access_list_types; 746 } else { 758 if ( $only_public_status ) { 747 759 //only public access 748 760 $request['status'] = MG_UPC_Helper::get_instance()->get_public_list_statuses(); … … 756 768 $args['status'] = $request['status']; 757 769 } 770 758 771 return $this->process_lists( $args, $request ); 759 772 } … … 921 934 922 935 /** 923 * Get a nspecified collection936 * Get a specified collection 924 937 * 925 938 * @param int $id List id … … 1013 1026 * This is copied from WP_REST_Controller class in the WP REST API v2 plugin. 1014 1027 * 1015 * @param array|WP_REST_Response $response Response object, i sis array this not change.1028 * @param array|WP_REST_Response $response Response object, if is array this not change. 1016 1029 * 1017 1030 * @return array Response data, ready for insertion into collection data. -
user-post-collections/trunk/controllers/mg-upc-rest-list-items-controller.php
r2856776 r3190768 596 596 'post_id' => $post_id, 597 597 ); 598 $response = array( 'data' => array() ); 598 $response = array( 599 'data' => array( 600 'status' => 201, 601 ), 602 'added' => true, 603 ); 599 604 if ( 600 605 is_string( $request['description'] ) && … … 608 613 ); 609 614 $response['data']['status'] = 409; 610 $response['added'] = true;611 615 } else { 612 $to_save['description'] = $request['description']; 613 $response['data']['status'] = 201; 614 $response['added'] = true; 615 } 616 } else { 617 $response['data']['status'] = 201; 618 $response['added'] = true; 616 $to_save['description'] = $request['description']; 617 } 619 618 } 620 619 if ( … … 624 623 if ( $list_type_obj->support( 'quantity' ) && 0 <= (int) $request['quantity'] ) { 625 624 $to_save['quantity'] = $request['quantity']; 626 if ( ! isset( $response['code'] ) ) {627 $response['data']['status'] = 201;628 $response['added'] = true;629 }630 625 } 631 626 } 632 627 633 628 if ( isset( $request['context'] ) && 'check' === $request['context'] ) { 634 if ( ! empty( $response['added'] ) ) { 635 $response['check'] = 'OK'; 636 } else { 637 $response['check'] = 'ERR'; 638 } 629 $response['check'] = ! empty( $response['added'] ) ? 'OK' : 'ERR'; 639 630 } 640 631 … … 653 644 $to_save['list_id'], 654 645 $to_save['post_id'], 655 isset( $to_save['description'] ) ? $to_save['description'] :'',656 isset( $to_save['quantity'] ) ? $to_save['quantity'] :0646 $to_save['description'] ?? '', 647 $to_save['quantity'] ?? 0 657 648 ); 658 649 -
user-post-collections/trunk/controllers/mg-upc-woocommerce.php
r2768965 r3190768 5 5 6 6 public function __construct() { 7 //before added list types on init with priority 10.. and WooCommerce already defined7 //before added list types on init with priority 10... and WooCommerce already defined 8 8 add_action( 'init', array( $this, 'pre_init' ), 5 ); 9 9 … … 98 98 99 99 /** 100 * Before added list types on init with priority 10.. and WooCommerce already defined100 * Before added list types on init with priority 10... and WooCommerce already defined 101 101 */ 102 102 public function pre_init() { … … 484 484 } 485 485 486 $item = $this->add_product_properties( $item, wc_get_product( $item['post_id'] ) ); 487 488 return $item; 486 return $this->add_product_properties( $item, wc_get_product( $item['post_id'] ) ); 489 487 } 490 488 … … 893 891 global $mg_upc_item; 894 892 895 if ( ! function_exists( 'wc_get_product' ) || false === $mg_upc_item['is_in_stock']) {893 if ( ! function_exists( 'wc_get_product' ) || empty( $mg_upc_item['is_in_stock'] ) ) { 896 894 return; 897 895 } … … 979 977 ); 980 978 981 //This not managed with version! Woo can install after that UPC.. 979 //This not managed with version! Woo can install after that UPC... 982 980 $activated = get_option( 'mg_upc_woo_activated', array() ); 983 981 if ( ! in_array( 'cart_type', $activated, true ) ) { -
user-post-collections/trunk/includes/list-types.php
r2768965 r3190768 211 211 function mg_upc_is_list_status_viewable( $list_status ) { 212 212 if ( is_scalar( $list_status ) ) { 213 $list_status = get_post_status_object( $list_status );213 $list_status = MG_UPC_Helper::get_instance()->get_list_status( $list_status ); 214 214 if ( ! $list_status ) { 215 215 return false; … … 244 244 * are viewable. 245 245 * 246 * @param array|stdClass| null $list Optional. Post ID or post object. Defaults to global $post.246 * @param array|stdClass|MG_UPC_List|null $list Optional. Post ID or post object. Defaults to global $post. 247 247 * @return bool Whether the post is publicly viewable. 248 248 */ -
user-post-collections/trunk/includes/mg-upc-helper.php
r2768965 r3190768 27 27 public function get_list_type( $type_name, $include_disabled = false ) { 28 28 $types = $this->get_list_types( $include_disabled ); 29 return array_key_exists( $type_name, $types ) ? $types[ $type_name ] : false;29 return is_string( $type_name ) && array_key_exists( $type_name, $types ) ? $types[ $type_name ] : false; 30 30 } 31 31 … … 363 363 364 364 /** 365 * Get list types that the user can read privates 366 * 367 * @param array $list_types List type 368 * 369 * @return string[] The private list types that user can read 370 */ 371 public function get_list_types_can_private_read( $list_types ) { 372 if ( 373 ! empty( $list_types ) && 374 ! in_array( 'any', $list_types, true ) 375 ) { 376 $list_types_to_access = $list_types; 377 } else { 378 $list_types_to_access = array_keys( $this->get_list_types() ); 379 } 380 $ok_access_list_types = array(); //list type with permission ok 381 foreach ( $list_types_to_access as $list_type ) { 382 if ( MG_UPC_List_Controller::get_instance()->can_read_private_type( $list_type ) ) { 383 $ok_access_list_types[] = $list_type; 384 } 385 } 386 387 return $ok_access_list_types; 388 } 389 390 /** 365 391 * Check if user can add the post type to any type of enabled list type. 366 392 * Use: Show the "add to list" button? -
user-post-collections/trunk/includes/mg-upc-list-type.php
r2768965 r3190768 97 97 98 98 /** 99 * The features that can be enable /disableby user.99 * The features that can be enabled/disabled by user. 100 100 * 101 101 * @var array|bool $supports … … 264 264 265 265 foreach ( $args as $property_name => $property_value ) { 266 if ( ! property_exists( $this, $property_name ) ) { 267 _doing_it_wrong( 268 'MG_UPC_List_Type->set_props', 269 'Property not found: ' . esc_html( $property_name ), 270 '1.0' 271 ); 272 } 266 273 $this->$property_name = $property_value; 267 274 } … … 506 513 507 514 508 public function offsetSet( $offset, $valor ) { 515 #[ReturnTypeWillChange] 516 public function offsetSet( $offset, $value ) { 509 517 //No set as array... 510 518 } 511 519 520 #[ReturnTypeWillChange] 512 521 public function offsetExists( $offset ) { 513 522 return isset( $this->$offset ); 514 523 } 515 524 525 #[ReturnTypeWillChange] 516 526 public function offsetUnset( $offset ) { 517 527 unset( $this->$offset ); 518 528 } 519 529 530 #[ReturnTypeWillChange] 520 531 public function offsetGet( $offset ) { 521 532 … … 537 548 } 538 549 539 return isset( $this->$offset ) ? $this->$offset :null;550 return $this->$offset ?? null; 540 551 } 541 552 -
user-post-collections/trunk/includes/mg-upc-settings-api.php
r2768965 r3190768 173 173 $this->settings_fields = $fields; 174 174 175 foreach ( $this->settings_fields as $ section => $field ) {175 foreach ( $this->settings_fields as $field ) { 176 176 foreach ( $field as $option ) { 177 177 $this->set_flags_from_field( $option ); … … 223 223 public function admin_init() { 224 224 //register settings sections 225 foreach ( $this->settings_sections as $section _id => $section) {225 foreach ( $this->settings_sections as $section ) { 226 226 // For save as array of sections (field as key) 227 227 if ( true === $section['as_array'] ) { … … 278 278 279 279 $name = $option['name']; 280 $type = isset( $option['type'] ) ? $option['type'] :'text';281 $label = isset( $option['label'] ) ? $option['label'] :'';282 $callback = isset( $option['callback'] ) ? $option['callback'] :array( $this, 'callback_' . $type );280 $type = $option['type'] ?? 'text'; 281 $label = $option['label'] ?? ''; 282 $callback = $option['callback'] ?? array( $this, 'callback_' . $type ); 283 283 $option_name = $name; 284 284 … … 331 331 332 332 if ( false === $label ) { 333 $label = isset( $option['label'] ) ? $option['label'] :'';333 $label = $option['label'] ?? ''; 334 334 } 335 335 if ( false === $type ) { 336 $type = isset( $option['type'] ) ? $option['type'] :'text';336 $type = $option['type'] ?? 'text'; 337 337 } 338 338 339 339 $args = array( 340 340 'id' => $option_id, 341 'class' => isset( $option['class'] ) ? $option['class'] :'',341 'class' => $option['class'] ?? '', 342 342 'label_for' => $option_input_name, 343 'desc' => isset( $option['desc'] ) ? $option['desc'] :'',343 'desc' => $option['desc'] ?? '', 344 344 'name' => $label, 345 345 'section' => $section_id, 346 'size' => isset( $option['size'] ) ? $option['size'] :null,347 'options' => isset( $option['options'] ) ? $option['options'] :'',348 'std' => isset( $option['default'] ) ? $option['default'] :'',349 'sanitize_callback' => isset( $option['sanitize_callback'] ) ? $option['sanitize_callback'] :'',346 'size' => $option['size'] ?? null, 347 'options' => $option['options'] ?? '', 348 'std' => $option['default'] ?? '', 349 'sanitize_callback' => $option['sanitize_callback'] ?? '', 350 350 'type' => $type, 351 'placeholder' => isset( $option['placeholder'] ) ? $option['placeholder'] :'',352 'min' => isset( $option['min'] ) ? $option['min'] :'',353 'max' => isset( $option['max'] ) ? $option['max'] :'',354 'step' => isset( $option['step'] ) ? $option['step'] :'',351 'placeholder' => $option['placeholder'] ?? '', 352 'min' => $option['min'] ?? '', 353 'max' => $option['max'] ?? '', 354 'step' => $option['step'] ?? '', 355 355 'option_name' => $option_input_name, 356 'readonly' => isset( $option['can_edit'] ) ? ! $option['can_edit'] : false, //only supports for text, number and checkbox356 'readonly' => isset( $option['can_edit'] ) && ! $option['can_edit'], //only supports for text, number and checkbox 357 357 ); 358 358 … … 525 525 ); 526 526 527 $type = isset( $item_option['type'] ) ? $item_option['type'] :'text';528 $callback_render = isset( $item_option['callback'] ) ? $item_option['callback'] :array(527 $type = $item_option['type'] ?? 'text'; 528 $callback_render = $item_option['callback'] ?? array( 529 529 $this, 530 530 'callback_' . $type, … … 600 600 $item_option_args['readonly'] = false; 601 601 602 $type = isset( $item_option['type'] ) ? $item_option['type'] :'text';603 $callback_render = isset( $item_option['callback'] ) ? $item_option['callback'] :array(602 $type = $item_option['type'] ?? 'text'; 603 $callback_render = $item_option['callback'] ?? array( 604 604 $this, 605 605 'callback_' . $type, … … 624 624 */ 625 625 public function callback_text( $args ) { 626 $args['value'] = isset( $args['value'] ) ? $args['value'] :$this->get_option( $args['id'], $args['section'], $args['std'] );626 $args['value'] = $args['value'] ?? $this->get_option( $args['id'], $args['section'], $args['std'] ); 627 627 $args['size'] = isset( $args['size'] ) && is_scalar( $args['size'] ) ? $args['size'] : 'regular'; 628 $args['type'] = isset( $args['type'] ) ? $args['type'] :'text';628 $args['type'] = $args['type'] ?? 'text'; 629 629 630 630 printf( … … 661 661 */ 662 662 public function callback_number( $args ) { 663 $value = isset( $args['value'] ) ? $args['value'] :$this->get_option( $args['id'], $args['section'], $args['std'] );663 $value = $args['value'] ?? $this->get_option( $args['id'], $args['section'], $args['std'] ); 664 664 $size = isset( $args['size'] ) && is_scalar( $args['size'] ) ? $args['size'] : 'regular'; 665 $type = isset( $args['type'] ) ? $args['type'] :'number';665 $type = $args['type'] ?? 'number'; 666 666 667 667 printf( … … 698 698 public function callback_checkbox( $args ) { 699 699 700 $value = isset( $args['value'] ) ? $args['value'] :$this->get_option( $args['id'], $args['section'], $args['std'] );700 $value = $args['value'] ?? $this->get_option( $args['id'], $args['section'], $args['std'] ); 701 701 702 702 echo '<fieldset>'; … … 730 730 */ 731 731 public function callback_multicheck( $args ) { 732 $value = isset( $args['value'] ) ? $args['value'] :$this->get_option( $args['id'], $args['section'], $args['std'] );732 $value = $args['value'] ?? $this->get_option( $args['id'], $args['section'], $args['std'] ); 733 733 echo '<fieldset>'; 734 734 printf( … … 760 760 public function callback_radio( $args ) { 761 761 762 $value = isset( $args['value'] ) ? $args['value'] :$this->get_option( $args['id'], $args['section'], $args['std'] );762 $value = $args['value'] ?? $this->get_option( $args['id'], $args['section'], $args['std'] ); 763 763 echo '<fieldset>'; 764 764 … … 785 785 */ 786 786 public function callback_select( $args ) { 787 $value = isset( $args['value'] ) ? $args['value'] :$this->get_option( $args['id'], $args['section'], $args['std'] );787 $value = $args['value'] ?? $this->get_option( $args['id'], $args['section'], $args['std'] ); 788 788 $size = isset( $args['size'] ) && is_scalar( $args['size'] ) ? $args['size'] : 'regular'; 789 789 … … 813 813 */ 814 814 public function callback_textarea( $args ) { 815 $value = isset( $args['value'] ) ? $args['value'] :$this->get_option( $args['id'], $args['section'], $args['std'] );815 $value = $args['value'] ?? $this->get_option( $args['id'], $args['section'], $args['std'] ); 816 816 $size = isset( $args['size'] ) && is_scalar( $args['size'] ) ? $args['size'] : 'regular'; 817 817 … … 849 849 public function callback_wysiwyg( $args ) { 850 850 851 $value = isset( $args['value'] ) ? $args['value'] :$this->get_option( $args['id'], $args['section'], $args['std'] );851 $value = $args['value'] ?? $this->get_option( $args['id'], $args['section'], $args['std'] ); 852 852 $size = isset( $args['size'] ) && is_scalar( $args['size'] ) ? $args['size'] : '500px'; 853 853 … … 877 877 */ 878 878 public function callback_file( $args ) { 879 $value = isset( $args['value'] ) ? $args['value'] :$this->get_option( $args['id'], $args['section'], $args['std'] );879 $value = $args['value'] ?? $this->get_option( $args['id'], $args['section'], $args['std'] ); 880 880 $size = isset( $args['size'] ) && is_scalar( $args['size'] ) ? $args['size'] : 'regular'; 881 $label = isset( $args['options']['button_label'] ) ? $args['options']['button_label'] :__( 'Choose File' );881 $label = $args['options']['button_label'] ?? __( 'Choose File' ); 882 882 883 883 printf( … … 904 904 public function callback_password( $args ) { 905 905 906 $value = isset( $args['value'] ) ? $args['value'] :$this->get_option( $args['id'], $args['section'], $args['std'] );906 $value = $args['value'] ?? $this->get_option( $args['id'], $args['section'], $args['std'] ); 907 907 $size = isset( $args['size'] ) && is_scalar( $args['size'] ) ? $args['size'] : 'regular'; 908 908 … … 928 928 public function callback_color( $args ) { 929 929 930 $value = isset( $args['value'] ) ? $args['value'] :$this->get_option( $args['id'], $args['section'], $args['std'] );930 $value = $args['value'] ?? $this->get_option( $args['id'], $args['section'], $args['std'] ); 931 931 $size = isset( $args['size'] ) && is_scalar( $args['size'] ) ? $args['size'] : 'regular'; 932 932 … … 953 953 public function callback_date( $args ) { 954 954 955 $value = isset( $args['value'] ) ? $args['value'] :$this->get_option( $args['id'], $args['section'], $args['std'] );955 $value = $args['value'] ?? $this->get_option( $args['id'], $args['section'], $args['std'] ); 956 956 $size = isset( $args['size'] ) && is_scalar( $args['size'] ) ? $args['size'] : 'regular'; 957 957 … … 984 984 */ 985 985 public function callback_datetime( $args ) { 986 $value = isset( $args['value'] ) ? $args['value'] :$this->get_option( $args['id'], $args['section'], $args['std'] );986 $value = $args['value'] ?? $this->get_option( $args['id'], $args['section'], $args['std'] ); 987 987 $size = isset( $args['size'] ) && is_scalar( $args['size'] ) ? $args['size'] : 'regular'; 988 988 … … 1019 1019 1020 1020 $dropdown_args = array( 1021 'selected' => isset( $args['value'] ) ? $args['value'] :$this->get_option( $args['id'], $args['section'], $args['std'] ),1021 'selected' => $args['value'] ?? $this->get_option( $args['id'], $args['section'], $args['std'] ), 1022 1022 'name' => $args['option_name'], 1023 1023 'id' => $args['option_name'], … … 1046 1046 $sanitize_callback = $this->get_sanitize_callback( $wp_option, $option_slug ); 1047 1047 if ( $sanitize_callback ) { 1048 $wp_value[ $option_slug ] = call_user_func( $sanitize_callback, $ wp_value[ $option_slug ]);1048 $wp_value[ $option_slug ] = call_user_func( $sanitize_callback, $option_value ); 1049 1049 } 1050 1050 } … … 1171 1171 if ( isset( $field['unique'] ) && $field['unique'] ) { 1172 1172 $no_repeat = array(); 1173 foreach ( $wp_value as $ index_arr => $option_value ) {1173 foreach ( $wp_value as $option_value ) { 1174 1174 if ( in_array( $option_value[ $field['name'] ], $no_repeat, true ) ) { 1175 1175 add_settings_error( … … 1266 1266 $option_value, 1267 1267 $option_array['name'] . '[' . $array_idx . '][' . $item_option_slug . ']', 1268 isset( $old_value[ $item_option_slug ] ) ? $old_value[ $item_option_slug ] :'',1268 $old_value[ $item_option_slug ] ?? '', 1269 1269 $sub_option, 1270 1270 ); … … 1429 1429 * Show the section settings forms 1430 1430 * 1431 * This function displays every section sin a different form1431 * This function displays every section in a different form 1432 1432 */ 1433 1433 public function show_forms() { -
user-post-collections/trunk/includes/template-functions.php
r2768965 r3190768 49 49 function mg_upc_template_single_items() { 50 50 mg_upc_get_template( 'single-mg-upc/items.php' ); 51 } 52 } 53 54 if ( ! function_exists( 'mg_upc_template_no_items_found' ) ) { 55 56 /** 57 * Empty list collections 58 */ 59 function mg_upc_template_no_items_found() { 60 mg_upc_get_template( 'single-mg-upc/empty-items.php' ); 51 61 } 52 62 } … … 198 208 /** 199 209 * Show item quantity. 200 *201 * @return string202 210 */ 203 211 function mg_upc_show_item_quantity() { … … 208 216 } 209 217 } 218 219 220 221 /**************************************************************** 222 * ARCHIVE 223 ****************************************************************/ 224 225 if ( ! function_exists( 'mg_upc_template_loop_single_info_start' ) ) { 226 227 /** 228 * Start infodiv 229 */ 230 function mg_upc_template_loop_single_info_start() { 231 echo '<div class="mg-upc-loop-list-info">'; 232 } 233 } 234 if ( ! function_exists( 'mg_upc_template_loop_single_info_end' ) ) { 235 236 /** 237 * Close info div 238 */ 239 function mg_upc_template_loop_single_info_end() { 240 echo '</div>'; 241 } 242 } 243 244 if ( ! function_exists( 'mg_upc_template_loop_single_title' ) ) { 245 246 /** 247 * Output the list title. 248 */ 249 function mg_upc_template_loop_single_title() { 250 mg_upc_get_template( 'loop/list/title.php' ); 251 } 252 } 253 254 if ( ! function_exists( 'mg_upc_template_loop_single_author' ) ) { 255 256 /** 257 * Output the list author. 258 */ 259 function mg_upc_template_loop_single_author() { 260 mg_upc_get_template( 'loop/list/author.php' ); 261 } 262 } 263 264 if ( ! function_exists( 'mg_upc_template_loop_single_meta' ) ) { 265 266 /** 267 * Output the list meta. 268 */ 269 function mg_upc_template_loop_single_meta() { 270 mg_upc_get_template( 'loop/list/meta.php' ); 271 } 272 } 273 274 if ( ! function_exists( 'mg_upc_template_loop_single_description' ) ) { 275 276 /** 277 * Output list description. 278 */ 279 function mg_upc_template_loop_single_description() { 280 mg_upc_get_template( 'loop/list/description.php' ); 281 } 282 } 283 284 285 if ( ! function_exists( 'mg_upc_template_loop_single_thumbs' ) ) { 286 287 /** 288 * Output the list items. 289 */ 290 function mg_upc_template_loop_single_thumbs() { 291 mg_upc_get_template( 'loop/list/items.php' ); 292 } 293 } 294 295 296 297 if ( ! function_exists( 'mg_upc_template_archive_pagination' ) ) { 298 299 /** 300 * Output the archive pagination. 301 */ 302 function mg_upc_template_archive_pagination() { 303 global $mg_upc_query; 304 305 $args = array( 306 'total' => $mg_upc_query->max_num_pages, 307 'current' => $mg_upc_query->query_vars['paged'], 308 'base' => esc_url_raw( add_query_arg( 'lists-page', '%#%', false ) ), 309 'format' => '?lists-page=%#%', 310 ); 311 312 mg_upc_get_template( 'loop/pagination.php', $args ); 313 } 314 } 315 316 317 318 if ( ! function_exists( 'mg_upc_template_loop_empty' ) ) { 319 320 /** 321 * Empty list collections 322 */ 323 function mg_upc_template_loop_empty() { 324 mg_upc_get_template( 'loop/empty.php' ); 325 } 326 } 327 328 329 330 331 332 /** 333 * Show UPC Loop 334 * 335 * Options: 336 * pagination Show pagination. Set to "1", it will use the main lists-page variable to show pagination (this should be used with a single page widget, otherwise all widgets/archives will be paginated together) 337 * tpl-items (card|list) List type 338 * tpl-cols Number of columns, comma separated: xxl,xl,lg,md,sm,xs (for card list type) Default: 4,4,4,3,2,1 339 * tpl-cols-[xs|sm|md|lg|xl|xxl] (1|2|3|4|5) Number of columns (for card list type). Override "tpl-cols". 340 * tpl-thumbs Default thumbnails layout. Set to "off" to not show 341 * tpl-thumbs-[xs|sm|md|lg|xl|xxl] (0|2x2|2x3|3x2|4x1|[1-4]x[1-4]) Thumbnails layout 342 * tpl-desc (on|off) Show description. Set to "off" to hide description 343 * tpl-user (on|off) Show author. Set to "off" to hide user 344 * tpl-meta (on|off) Show meta. Set to "off" to hide meta 345 * 346 * @param array $original_atts Array or empty string 347 * 348 */ 349 function mg_upc_template_loop( $original_atts = array() ) { 350 if ( ! is_array( $original_atts ) ) { 351 $original_atts = array(); 352 } 353 354 $defaults_atts = array( 355 'pagination' => null, 356 'tpl-desc' => 'on', 357 'tpl-thumbs' => 'on', 358 'tpl-user' => 'on', 359 'tpl-meta' => 'on', 360 'tpl-items' => 'list', 361 'tpl-cols' => '4,4,4,3,2,1', 362 'tpl-cols-xxl' => false, 363 'tpl-cols-xl' => false, 364 'tpl-cols-lg' => false, 365 'tpl-cols-md' => false, 366 'tpl-cols-sm' => false, 367 'tpl-cols-xs' => false, 368 'tpl-thumbs-xxl' => false, 369 'tpl-thumbs-xl' => false, 370 'tpl-thumbs-lg' => false, 371 'tpl-thumbs-md' => false, 372 'tpl-thumbs-sm' => false, 373 'tpl-thumbs-xs' => '4x1', 374 ); 375 $atts = array_merge( $defaults_atts, $original_atts ); 376 377 remove_action( 'mg_upc_single_list_content', 'mg_upc_template_single_title', 5 ); 378 /** @global MG_UPC_Query $mg_upc_query */ 379 global $mg_upc_query; 380 $breakpoints = array( 'xxl', 'xl', 'lg', 'md', 'sm', 'xs' ); 381 382 $tpl_cols = explode( ',', $atts['tpl-cols'] ); 383 foreach ( $breakpoints as $key => $breakpoint ) { 384 if ( isset( $tpl_cols[ $key ] ) ) { 385 $atts[ 'tpl-cols-' . $breakpoint ] = $tpl_cols[ $key ]; 386 } elseif ( $key >= 1 && isset( $atts[ 'tpl-cols-' . $breakpoints[ $key - 1 ] ] ) ) { 387 $atts[ 'tpl-cols-' . $breakpoint ] = $atts[ 'tpl-cols-' . $breakpoints[ $key - 1 ] ] - 1; 388 $atts[ 'tpl-cols-' . $breakpoint ] = max( $atts[ 'tpl-cols-' . $breakpoint ], 1 ); 389 } elseif ( isset( $breakpoints[ $key + 1 ] ) && isset( $atts[ 'tpl-cols-' . $breakpoints[ $key + 1 ] ] ) ) { 390 $atts[ 'tpl-cols-' . $breakpoint ] = $atts[ 'tpl-cols-' . $breakpoints[ $key + 1 ] ]; 391 } 392 if ( ! empty( $original_atts[ 'tpl-cols-' . $breakpoint ] ) ) { 393 $atts[ 'tpl-cols-' . $breakpoint ] = $original_atts[ 'tpl-cols-' . $breakpoint ]; 394 } 395 } 396 397 $map_class_tpl_args = array( 398 'cols' => array( 399 'prefix' => 'mg-upc-list-cols-', 400 'default' => 1, 401 'breakpoints' => $breakpoints, 402 ), 403 'thumbs' => array( 404 'prefix' => 'mg-upc-thumbs-', 405 'default' => $atts['tpl-thumbs'], 406 'breakpoints' => $breakpoints, 407 ), 408 'items' => array( 409 'prefix' => 'mg-upc-list-', 410 'default' => 'list', 411 ), 412 ); 413 414 $classes = array(); 415 foreach ( $map_class_tpl_args as $key => $map_class_tpl_arg ) { 416 if ( ! empty( $atts[ 'tpl-' . $key ] ) && '0' !== $atts[ 'tpl-' . $key ] ) { 417 $classes[] = $map_class_tpl_arg['prefix'] . $atts[ 'tpl-' . $key ]; 418 } elseif ( ! empty( $map_class_tpl_arg['default'] ) && '0' !== $map_class_tpl_arg['default'] ) { 419 $classes[] = $map_class_tpl_arg['prefix'] . $map_class_tpl_arg['default']; 420 } 421 if ( ! empty( $map_class_tpl_arg['breakpoints'] ) ) { 422 foreach ( $map_class_tpl_arg['breakpoints'] as $breakpoint ) { 423 $option_key = 'tpl-' . $key . '-' . $breakpoint; 424 if ( ! empty( $atts[ $option_key ] ) && '0' !== $atts[ $option_key ] ) { 425 $classes[] = $map_class_tpl_arg['prefix'] . $breakpoint . '-' . $atts[ $option_key ]; 426 } elseif ( ! empty( $map_class_tpl_arg['default'] ) && '0' !== $map_class_tpl_arg['default'] ) { 427 $classes[] = $map_class_tpl_arg['prefix'] . $breakpoint . '-' . $map_class_tpl_arg['default']; 428 } 429 } 430 } 431 } 432 433 $max_items = 0; 434 if ( 'off' !== $atts['tpl-thumbs'] ) { 435 if ( ! empty( $map_class_tpl_args['thumbs']['breakpoints'] ) ) { 436 foreach ( $map_class_tpl_args['thumbs']['breakpoints'] as $breakpoint ) { 437 if ( isset( $atts[ 'tpl-thumbs-' . $breakpoint ] ) ) { 438 $lines = explode( 'x', $atts[ 'tpl-thumbs-' . $breakpoint ] ); 439 $max_items = max( $max_items, (int) $lines[0] * (int) ( $lines[1] ?? 0 ) ); 440 } 441 } 442 } 443 if ( ! empty( $atts['tpl-thumbs'] ) ) { 444 $lines = explode( 'x', $atts['tpl-thumbs'] ); 445 $max_items = max( $max_items, (int) $lines[0] * (int) ( $lines[1] ?? 0 ) ); 446 } 447 } 448 449 // Set posts to get on query 450 $mg_upc_query->set_items_limit( $max_items ); 451 452 $template_args = array( 453 'mg_classes' => implode( ' ', $classes ), 454 ); 455 if ( $mg_upc_query->is_404 ) { 456 mg_upc_get_template( 'archive-404.php', $template_args ); 457 } else { 458 $hooks_to_remove = array(); 459 if ( isset( $atts['tpl-thumbs'] ) && 'off' === $atts['tpl-thumbs'] ) { 460 $hooks_to_remove[] = array( 461 'hook' => 'mg_upc_loop_single_list_content', 462 'callback' => 'mg_upc_template_loop_single_thumbs', 463 ); 464 } 465 if ( 'off' === $atts['tpl-desc'] ) { 466 $hooks_to_remove[] = array( 467 'hook' => 'mg_upc_loop_single_list_content', 468 'callback' => 'mg_upc_template_loop_single_description', 469 ); 470 } 471 if ( 'off' === $atts['tpl-user'] ) { 472 $hooks_to_remove[] = array( 473 'hook' => 'mg_upc_loop_single_list_content', 474 'callback' => 'mg_upc_template_loop_single_author', 475 ); 476 } 477 if ( 'off' === $atts['tpl-meta'] ) { 478 $hooks_to_remove[] = array( 479 'hook' => 'mg_upc_loop_single_list_content', 480 'callback' => 'mg_upc_template_loop_single_meta', 481 ); 482 } 483 if ( 1 !== (int) $atts['pagination'] ) { 484 $hooks_to_remove[] = array( 485 'hook' => 'mg_upc_after_archive_content', 486 'callback' => 'mg_upc_template_archive_pagination', 487 ); 488 } 489 foreach ( $hooks_to_remove as $k => $hook ) { 490 $priority = has_action( $hook['hook'], $hook['callback'] ); 491 if ( false !== $priority ) { 492 remove_action( $hook['hook'], $hook['callback'], $priority ); 493 $hooks_to_remove[ $k ]['priority'] = $priority; 494 $hooks_to_remove[ $k ]['removed'] = true; 495 } 496 } 497 498 mg_upc_get_template( 'content-archive-mg-upc.php', $template_args ); 499 500 foreach ( $hooks_to_remove as $hook ) { 501 if ( ! empty( $hook['removed'] ) ) { 502 add_action( $hook['hook'], $hook['callback'], $hook['priority'] ); 503 } 504 } 505 } 506 } -
user-post-collections/trunk/includes/template-hooks.php
r2768965 r3190768 40 40 add_action( 'mg_upc_loop_product_buttons', 'mg_upc_loop_product_button', 10 ); 41 41 42 /** 43 * Empty Collection 44 * 45 * @see mg_upc_template_no_items_found() 46 */ 47 add_action( 'mg_upc_no_items_found', 'mg_upc_template_no_items_found', 10 ); 42 48 43 49 /** … … 49 55 add_action( 'mg_upc_before_main_content', 'mg_upc_output_content_wrapper', 10 ); 50 56 add_action( 'mg_upc_after_main_content', 'mg_upc_output_content_wrapper_end', 10 ); 57 58 59 /** 60 * List content. 61 * 62 * @see mg_upc_template_loop_single_thumbs() 63 * @see mg_upc_template_loop_single_info_start() 64 * @see mg_upc_template_loop_single_title() 65 * @see mg_upc_template_loop_single_author() 66 * @see mg_upc_template_loop_single_meta() 67 * @see mg_upc_template_loop_single_description() 68 * @see mg_upc_template_loop_single_info_end() 69 */ 70 add_action( 'mg_upc_loop_single_list_content', 'mg_upc_template_loop_single_thumbs', 10 ); 71 add_action( 'mg_upc_loop_single_list_content', 'mg_upc_template_loop_single_info_start', 15 ); 72 add_action( 'mg_upc_loop_single_list_content', 'mg_upc_template_loop_single_title', 20 ); 73 add_action( 'mg_upc_loop_single_list_content', 'mg_upc_template_loop_single_author', 30 ); 74 add_action( 'mg_upc_loop_single_list_content', 'mg_upc_template_loop_single_meta', 40 ); 75 add_action( 'mg_upc_loop_single_list_content', 'mg_upc_template_loop_single_description', 50 ); 76 add_action( 'mg_upc_loop_single_list_content', 'mg_upc_template_loop_single_info_end', 60 ); 77 add_action( 'mg_upc_after_archive_content', 'mg_upc_template_archive_pagination', 10 ); 78 79 /** 80 * Empty List Collections 81 * 82 * @see mg_upc_template_loop_empty() 83 */ 84 add_action( 'mg_upc_loop_empty', 'mg_upc_template_loop_empty', 10 ); -
user-post-collections/trunk/includes/themes-helper.php
r2783097 r3190768 8 8 * 9 9 * @return false|int The collection ID or false 10 * @throws MG_UPC_Invalid_Field_Exception 10 11 */ 11 12 function mg_upc_post_in_collection( $post_id, $collection ) { 13 global $mg_upc; 12 14 if ( is_string( $collection ) ) { 13 global $mg_upc;14 15 $list = $mg_upc->model->find_always_exist( $collection, get_current_user_id() ); 15 16 … … 26 27 27 28 29 /** 30 * Display the ID of the current list in the Loop. 31 * 32 */ 33 function mg_upc_the_ID() { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.FunctionNameInvalid 34 echo (int) mg_upc_get_the_ID(); 35 } 36 37 /** 38 * Retrieve the ID of the current list in the Loop. 39 * 40 * @return int|false The ID of the current item in the Loop. False if $mg_upc_list is not set. 41 */ 42 function mg_upc_get_the_ID() { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.FunctionNameInvalid 43 $collection = mg_upc_get_list(); 44 return ! empty( $collection ) ? $collection->ID : false; 45 } 46 47 /** 48 * Retrieve a list 49 * 50 * This function attempts to fetch a list based on the provided `$collection` parameter. 51 * If `$collection` is not specified, it tries to use a global list variable. The function 52 * can return the list as an object or as an associative array depending on the `$output` parameter. 53 * 54 * @param mixed $collection Optional. The identifier for the collection to retrieve. This can be null, 55 * a list ID, a list object, or an array. If null, the function attempts 56 * to use a global list variable. Default null. 57 * @param string $output Optional. The desired format of the returned list. Accepts OBJECT for a standard 58 * object or ARRAY_A for an associative array. Default OBJECT. 59 * 60 * @return MG_UPC_List|array|null An instance of the list as an object or associative array based on `$output`, or 61 * null if the list cannot be found or `$collection` is invalid. 62 */ 63 function mg_upc_get_list( $collection = null, $output = OBJECT ) { 64 if ( empty( $collection ) && isset( $GLOBALS['mg_upc_list'] ) ) { 65 $collection = $GLOBALS['mg_upc_list']; 66 } 67 68 if ( $collection instanceof MG_UPC_List ) { 69 $_collection = $collection; 70 } else { 71 $_collection = MG_UPC_List::get_instance( $collection ); 72 } 73 74 if ( ! $_collection ) { 75 return null; 76 } 77 78 if ( ARRAY_A === $output ) { 79 return $_collection->to_array(); 80 } 81 82 return $_collection; 83 } 84 85 86 /** 87 * Get/print UPC Title 88 * 89 * @param string $before_escaped Optional. Code before. 90 * @param string $after_escaped Optional. Code after. 91 * @param bool $echo Optional. Print? (on false return code) 92 * 93 * @return string|void 94 */ 95 function mg_upc_the_title( $before_escaped = '', $after_escaped = '', $echo = true ) { 96 $title = mg_upc_get_the_title(); 97 98 if ( strlen( $title ) === 0 ) { 99 return ''; 100 } 101 102 if ( $echo ) { 103 // phpcs:ignore 104 echo $before_escaped . esc_html( $title ) . $after_escaped; 105 } 106 107 return $before_escaped . esc_html( $title ) . $after_escaped; 108 } 109 110 /** 111 * Retrieve list title. 112 * 113 * @param int|MG_UPC_List $list Optional. List ID or MG_UPC_List object. Default is global $post. 114 * 115 * @return string 116 */ 117 function mg_upc_get_the_title( $list = 0 ) { 118 119 $list = mg_upc_get_list( $list ); 120 121 $title = $list->title ?? ''; 122 $id = $list->ID ?? 0; 123 124 return apply_filters( 'mg_upc_the_title', $title, $id ); 125 } 126 127 128 129 /** 130 * Display the list content. 131 */ 132 function mg_upc_the_content() { 133 $content = mg_upc_get_the_content(); 134 135 /** 136 * Filters the list content. 137 * 138 * @param string $content Content of the current content. 139 */ 140 $content = apply_filters( 'mg_upc_the_content', $content ); 141 142 if ( strpos( $content, '<' ) !== false ) { 143 $content = force_balance_tags( $content ); 144 } 145 146 echo wp_kses( nl2br( $content ), MG_UPC_List_Controller::get_instance()->list_allowed_tags() ); 147 } 148 149 /** 150 * Retrieve the list content. 151 * 152 * @return string 153 */ 154 function mg_upc_get_the_content( $list = 0 ) { 155 $list = mg_upc_get_list( $list ); 156 157 return $list->content; 158 } 159 160 /** 161 * Displays the permalink for the current list. 162 * 163 * @param int|array|object $list Optional. List ID or list object. Default is the global `$mg_upc_list`. 164 */ 165 function mg_upc_the_permalink( $list = 0 ) { 166 echo esc_url( apply_filters( 'mg_upc_the_permalink', mg_upc_get_the_permalink( $list ), $list ) ); 167 } 168 169 /** 170 * Retrieve list title. 171 * 172 * @param int|array|object $list Optional. List ID or list object. Default is global $mg_upc_list. 173 * @return string 174 */ 175 function mg_upc_get_the_permalink( $list = 0 ) { 176 $list = mg_upc_get_list( $list ); 177 178 // Set by Page Controller 179 return apply_filters( 'mg_upc_get_the_permalink', '', $list ); 180 } 181 182 /** 183 * Check if the actual query is the main query. 184 * 185 * @global MG_UPC_Query $mg_upc_query 186 */ 187 function mg_upc_is_main_query() { 188 global $mg_upc_query; 189 return $mg_upc_query->is_main_query(); 190 } 191 192 /** 193 * Destroys the previous query and sets up a new query. 194 * 195 * @global MG_UPC_Query $mg_upc_query 196 * @global MG_UPC_Query $mg_upc_the_query 197 */ 198 function mg_upc_reset_query() { 199 $GLOBALS['mg_upc_query'] = $GLOBALS['mg_upc_the_query']; 200 mg_upc_reset_listdata(); 201 } 202 203 /** 204 * After looping through a separate query, this function restores 205 * the $mg_upc_item global to the current post in the main query. 206 * 207 * @global MG_UPC_Query $mg_upc_the_query MG_UPC_Query Query object. 208 */ 209 function mg_upc_reset_listdata() { 210 /** @global MG_UPC_Query $mg_upc_the_query MG_UPC_Query Query object. */ 211 global $mg_upc_the_query; 212 213 if ( isset( $mg_upc_the_query ) ) { 214 $mg_upc_the_query->reset_listdata(); 215 } 216 } -
user-post-collections/trunk/includes/utils.php
r2768965 r3190768 98 98 if ( $filter_template !== $template ) { 99 99 if ( ! file_exists( $filter_template ) ) { 100 error_log(100 mg_upc_error_log( 101 101 sprintf( 102 102 /* translators: %s template */ … … 119 119 if ( ! empty( $args ) && is_array( $args ) ) { 120 120 if ( isset( $args['action_args'] ) ) { 121 error_log(121 mg_upc_error_log( 122 122 __( 'action_args should not be overwritten when calling wc_get_template.', 'user-post-collections' ) 123 123 ); … … 135 135 ); 136 136 137 /** @noinspection PhpIncludeInspection */138 137 include $action_args['located']; 139 138 … … 199 198 * Display the classes for the product div. 200 199 * 201 * @param string|array $class One or more classes to add to the class list.202 * @param array $list list.200 * @param string|array $class One or more classes to add to the class list. 201 * @param array|MG_UPC_List $list list. 203 202 */ 204 203 function mg_upc_class( $class = '', $list = null ) { 205 204 $list_class = array( $class ); 206 if ( is_array( $list ) && isset( $list['type'] ) && 'vote' === $list['type'] ) { 207 $list_class[] = 'mg-upc-vote'; 205 $list = mg_upc_get_list( $list ); 206 207 if ( 208 null !== $list && 209 isset( $list['type'] ) && 210 in_array( $list['type'], array_keys( MG_UPC_Helper::get_instance()->get_list_types() ), true ) 211 ) { 212 $list_class[] = 'mg-upc-' . $list['type']; 208 213 } 209 214 echo 'class="' . esc_attr( implode( ' ', $list_class ) ) . '"'; 210 215 } 216 217 218 /** 219 * Sanitize username for query 220 * 221 * @param $username 222 * 223 * @return string 224 */ 225 function mg_upc_sanitize_username( $username ) { 226 if ( strpos( $username, '/' ) !== false ) { 227 $username = explode( '/', $username ); 228 if ( $username[ count( $username ) - 1 ] ) { 229 $username = $username[ count( $username ) - 1 ]; // No trailing slash. 230 } else { 231 $username = $username[ count( $username ) - 2 ]; // There was a trailing slash. 232 } 233 } 234 235 return sanitize_title_for_query( $username ); 236 } 237 238 239 /** 240 * Custom error logging function. 241 * 242 * This function checks if WP_DEBUG is defined and true, and if so, logs the provided message 243 * using PHP's error_log function. 244 * 245 * @param string $message The message to log. 246 */ 247 function mg_upc_error_log( $message ) { 248 if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) { 249 error_log( $message ); 250 } 251 } -
user-post-collections/trunk/javascript/mg-upc-client/dist/admin.js
r2856776 r3190768 1 (()=>{"use strict";var t,e,n,i,s,o,a ={},l=[],r=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i;function c(t,e){for(var n in e)t[n]=e[n];return t}function u(t){var e=t.parentNode;e&&e.removeChild(t)}function d(e,n,i){var s,o,a,l={};for(a in n)"key"==a?s=n[a]:"ref"==a?o=n[a]:l[a]=n[a];if(arguments.length>2&&(l.children=arguments.length>3?t.call(arguments,2):i),"function"==typeof e&&null!=e.defaultProps)for(a in e.defaultProps)void 0===l[a]&&(l[a]=e.defaultProps[a]);return p(e,l,s,o,null)}function p(t,i,s,o,a){var l={type:t,props:i,key:s,ref:o,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,__h:null,constructor:void 0,__v:null==a?++n:a};return null==a&&null!=e.vnode&&e.vnode(l),l}function _(t){return t.children}function m(t,e){this.props=t,this.context=e}function f(t,e){if(null==e)return t.__?f(t.__,t.__.__k.indexOf(t)+1):null;for(var n;e<t.__k.length;e++)if(null!=(n=t.__k[e])&&null!=n.__e)return n.__e;return"function"==typeof t.type?f(t):null}function g(t){var e,n;if(null!=(t=t.__)&&null!=t.__c){for(t.__e=t.__c.base=null,e=0;e<t.__k.length;e++)if(null!=(n=t.__k[e])&&null!=n.__e){t.__e=t.__c.base=n.__e;break}return g(t)}}function h(t){(!t.__d&&(t.__d=!0)&&i.push(t)&&!v.__r++||s!==e.debounceRendering)&&((s=e.debounceRendering)||setTimeout)(v)}function v(){for(var t;v.__r=i.length;)t=i.sort((function(t,e){return t.__v.__b-e.__v.__b})),i=[],t.some((function(t){var e,n,i,s,o,a;t.__d&&(o=(s=(e=t).__v).__e,(a=e.__P)&&(n=[],(i=c({},s)).__v=s.__v+1,I(a,s,i,e.__n,void 0!==a.ownerSVGElement,null!=s.__h?[o]:null,n,null==o?f(s):o,s.__h),S(n,s),s.__e!=o&&g(s)))}))}function y(t,e,n,i,s,o,r,c,u,d){var m,g,h,v,y,P,w,k=i&&i.__k||l,C=k.length;for(n.__k=[],m=0;m<e.length;m++)if(null!=(v=n.__k[m]=null==(v=e[m])||"boolean"==typeof v?null:"string"==typeof v||"number"==typeof v||"bigint"==typeof v?p(null,v,null,null,v):Array.isArray(v)?p(_,{children:v},null,null,null):v.__b>0?p(v.type,v.props,v.key,null,v.__v):v)){if(v.__=n,v.__b=n.__b+1,null===(h=k[m])||h&&v.key==h.key&&v.type===h.type)k[m]=void 0;else for(g=0;g<C;g++){if((h=k[g])&&v.key==h.key&&v.type===h.type){k[g]=void 0;break}h=null}I(t,v,h=h||a,s,o,r,c,u,d),y=v.__e,(g=v.ref)&&h.ref!=g&&(w||(w=[]),h.ref&&w.push(h.ref,null,v),w.push(g,v.__c||y,v)),null!=y?(null==P&&(P=y),"function"==typeof v.type&&v.__k===h.__k?v.__d=u=b(v,u,t):u=N(t,v,h,k,y,u),"function"==typeof n.type&&(n.__d=u)):u&&h.__e==u&&u.parentNode!=t&&(u=f(h))}for(n.__e=P,m=C;m--;)null!=k[m]&&("function"==typeof n.type&&null!=k[m].__e&&k[m].__e==n.__d&&(n.__d=f(i,m+1)),E(k[m],k[m]));if(w)for(m=0;m<w.length;m++)A(w[m],w[++m],w[++m])}function b(t,e,n){for(var i,s=t.__k,o=0;s&&o<s.length;o++)(i=s[o])&&(i.__=t,e="function"==typeof i.type?b(i,e,n):N(n,i,i,s,i.__e,e));return e}function P(t,e){return e=e||[],null==t||"boolean"==typeof t||(Array.isArray(t)?t.some((function(t){P(t,e)})):e.push(t)),e}function N(t,e,n,i,s,o){var a,l,r;if(void 0!==e.__d)a=e.__d,e.__d=void 0;else if(null==n||s!=o||null==s.parentNode)t:if(null==o||o.parentNode!==t)t.appendChild(s),a=null;else{for(l=o,r=0;(l=l.nextSibling)&&r<i.length;r+=2)if(l==s)break t;t.insertBefore(s,o),a=o}return void 0!==a?a:s.nextSibling}function w(t,e,n){"-"===e[0]?t.setProperty(e,n):t[e]=null==n?"":"number"!=typeof n||r.test(e)?n:n+"px"}function k(t,e,n,i,s){var o;t:if("style"===e)if("string"==typeof n)t.style.cssText=n;else{if("string"==typeof i&&(t.style.cssText=i=""),i)for(e in i)n&&e in n||w(t.style,e,"");if(n)for(e in n)i&&n[e]===i[e]||w(t.style,e,n[e])}else if("o"===e[0]&&"n"===e[1])o=e!==(e=e.replace(/Capture$/,"")),e=e.toLowerCase()in t?e.toLowerCase().slice(2):e.slice(2),t.l||(t.l={}),t.l[e+o]=n,n?i||t.addEventListener(e,o?x:C,o):t.removeEventListener(e,o?x:C,o);else if("dangerouslySetInnerHTML"!==e){if(s)e=e.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if("href"!==e&&"list"!==e&&"form"!==e&&"tabIndex"!==e&&"download"!==e&&e in t)try{t[e]=null==n?"":n;break t}catch(t){}"function"==typeof n||(null!=n&&(!1!==n||"a"===e[0]&&"r"===e[1])?t.setAttribute(e,n):t.removeAttribute(e))}}function C(t){this.l[t.type+!1](e.event?e.event(t):t)}function x(t){this.l[t.type+!0](e.event?e.event(t):t)}function I(t,n,i,s,o,a,l,r,u){var d,p,f,g,h,v,b,P,N,w,k,C,x,I=n.type;if(void 0!==n.constructor)return null;null!=i.__h&&(u=i.__h,r=n.__e=i.__e,n.__h=null,a=[r]),(d=e.__b)&&d(n);try{t:if("function"==typeof I){if(P=n.props,N=(d=I.contextType)&&s[d.__c],w=d?N?N.props.value:d.__:s,i.__c?b=(p=n.__c=i.__c).__=p.__E:("prototype"in I&&I.prototype.render?n.__c=p=new I(P,w):(n.__c=p=new m(P,w),p.constructor=I,p.render=L),N&&N.sub(p),p.props=P,p.state||(p.state={}),p.context=w,p.__n=s,f=p.__d=!0,p.__h=[]),null==p.__s&&(p.__s=p.state),null!=I.getDerivedStateFromProps&&(p.__s==p.state&&(p.__s=c({},p.__s)),c(p.__s,I.getDerivedStateFromProps(P,p.__s))),g=p.props,h=p.state,f)null==I.getDerivedStateFromProps&&null!=p.componentWillMount&&p.componentWillMount(),null!=p.componentDidMount&&p.__h.push(p.componentDidMount);else{if(null==I.getDerivedStateFromProps&&P!==g&&null!=p.componentWillReceiveProps&&p.componentWillReceiveProps(P,w),!p.__e&&null!=p.shouldComponentUpdate&&!1===p.shouldComponentUpdate(P,p.__s,w)||n.__v===i.__v){p.props=P,p.state=p.__s,n.__v!==i.__v&&(p.__d=!1),p.__v=n,n.__e=i.__e,n.__k=i.__k,n.__k.forEach((function(t){t&&(t.__=n)})),p.__h.length&&l.push(p);break t}null!=p.componentWillUpdate&&p.componentWillUpdate(P,p.__s,w),null!=p.componentDidUpdate&&p.__h.push((function(){p.componentDidUpdate(g,h,v)}))}if(p.context=w,p.props=P,p.__v=n,p.__P=t,k=e.__r,C=0,"prototype"in I&&I.prototype.render)p.state=p.__s,p.__d=!1,k&&k(n),d=p.render(p.props,p.state,p.context);else do{p.__d=!1,k&&k(n),d=p.render(p.props,p.state,p.context),p.state=p.__s}while(p.__d&&++C<25);p.state=p.__s,null!=p.getChildContext&&(s=c(c({},s),p.getChildContext())),f||null==p.getSnapshotBeforeUpdate||(v=p.getSnapshotBeforeUpdate(g,h)),x=null!=d&&d.type===_&&null==d.key?d.props.children:d,y(t,Array.isArray(x)?x:[x],n,i,s,o,a,l,r,u),p.base=n.__e,n.__h=null,p.__h.length&&l.push(p),b&&(p.__E=p.__=null),p.__e=!1}else null==a&&n.__v===i.__v?(n.__k=i.__k,n.__e=i.__e):n.__e=T(i.__e,n,i,s,o,a,l,u);(d=e.diffed)&&d(n)}catch(t){n.__v=null,(u||null!=a)&&(n.__e=r,n.__h=!!u,a[a.indexOf(r)]=null),e.__e(t,n,i)}}function S(t,n){e.__c&&e.__c(n,t),t.some((function(n){try{t=n.__h,n.__h=[],t.some((function(t){t.call(n)}))}catch(t){e.__e(t,n.__v)}}))}function T(e,n,i,s,o,l,r,c){var d,p,_,m=i.props,g=n.props,h=n.type,v=0;if("svg"===h&&(o=!0),null!=l)for(;v<l.length;v++)if((d=l[v])&&"setAttribute"in d==!!h&&(h?d.localName===h:3===d.nodeType)){e=d,l[v]=null;break}if(null==e){if(null===h)return document.createTextNode(g);e=o?document.createElementNS("http://www.w3.org/2000/svg",h):document.createElement(h,g.is&&g),l=null,c=!1}if(null===h)m===g||c&&e.data===g||(e.data=g);else{if(l=l&&t.call(e.childNodes),p=(m=i.props||a).dangerouslySetInnerHTML,_=g.dangerouslySetInnerHTML,!c){if(null!=l)for(m={},v=0;v<e.attributes.length;v++)m[e.attributes[v].name]=e.attributes[v].value;(_||p)&&(_&&(p&&_.__html==p.__html||_.__html===e.innerHTML)||(e.innerHTML=_&&_.__html||""))}if(function(t,e,n,i,s){var o;for(o in n)"children"===o||"key"===o||o in e||k(t,o,null,n[o],i);for(o in e)s&&"function"!=typeof e[o]||"children"===o||"key"===o||"value"===o||"checked"===o||n[o]===e[o]||k(t,o,e[o],n[o],i)}(e,g,m,o,c),_)n.__k=[];else if(v=n.props.children,y(e,Array.isArray(v)?v:[v],n,i,s,o&&"foreignObject"!==h,l,r,l?l[0]:i.__k&&f(i,0),c),null!=l)for(v=l.length;v--;)null!=l[v]&&u(l[v]);c||("value"in g&&void 0!==(v=g.value)&&(v!==e.value||"progress"===h&&!v||"option"===h&&v!==m.value)&&k(e,"value",v,m.value,!1),"checked"in g&&void 0!==(v=g.checked)&&v!==e.checked&&k(e,"checked",v,m.checked,!1))}return e}function A(t,n,i){try{"function"==typeof t?t(n):t.current=n}catch(t){e.__e(t,i)}}function E(t,n,i){var s,o;if(e.unmount&&e.unmount(t),(s=t.ref)&&(s.current&&s.current!==t.__e||A(s,null,n)),null!=(s=t.__c)){if(s.componentWillUnmount)try{s.componentWillUnmount()}catch(t){e.__e(t,n)}s.base=s.__P=null}if(s=t.__k)for(o=0;o<s.length;o++)s[o]&&E(s[o],n,"function"!=typeof t.type);i||null==t.__e||u(t.__e),t.__e=t.__d=void 0}function L(t,e,n){return this.constructor(t,n)}function D(n,i,s){var o,l,r;e.__&&e.__(n,i),l=(o="function"==typeof s)?null:s&&s.__k||i.__k,r=[],I(i,n=(!o&&s||i).__k=d(_,null,[n]),l||a,a,void 0!==i.ownerSVGElement,!o&&s?[s]:l?null:i.firstChild?t.call(i.childNodes):null,r,!o&&s?s:l?l.__e:i.firstChild,o),S(r,n)}t=l.slice,e={__e:function(t,e,n,i){for(var s,o,a;e=e.__;)if((s=e.__c)&&!s.__)try{if((o=s.constructor)&&null!=o.getDerivedStateFromError&&(s.setState(o.getDerivedStateFromError(t)),a=s.__d),null!=s.componentDidCatch&&(s.componentDidCatch(t,i||{}),a=s.__d),a)return s.__E=s}catch(e){t=e}throw t}},n=0,m.prototype.setState=function(t,e){var n;n=null!=this.__s&&this.__s!==this.state?this.__s:this.__s=c({},this.state),"function"==typeof t&&(t=t(c({},n),this.props)),t&&c(n,t),null!=t&&this.__v&&(e&&this.__h.push(e),h(this))},m.prototype.forceUpdate=function(t){this.__v&&(this.__e=!0,t&&this.__h.push(t),h(this))},m.prototype.render=_,i=[],v.__r=0,o=0;var O,U,R,W,$=0,H=[],M=[],j=e.__b,B=e.__r,F=e.diffed,V=e.__c,q=e.unmount;function X(t,n){e.__h&&e.__h(U,t,$||n),$=0;var i=U.__H||(U.__H={__:[],__h:[]});return t>=i.__.length&&i.__.push({__V:M}),i.__[t]}function K(t){return $=1,Q(ot,t)}function Q(t,e,n){var i=X(O++,2);if(i.t=t,!i.__c&&(i.__=[n?n(e):ot(void 0,e),function(t){var e=i.__N?i.__N[0]:i.__[0],n=i.t(e,t);e!==n&&(i.__N=[n,i.__[1]],i.__c.setState({}))}],i.__c=U,!i.__c.u)){i.__c.__H.u=!0;var s=i.__c.shouldComponentUpdate;i.__c.shouldComponentUpdate=function(t,e,n){if(!i.__c.__H)return!0;var o=i.__c.__H.__.filter((function(t){return t.__c}));return(o.every((function(t){return!t.__N}))||!o.every((function(t){if(!t.__N)return!0;var e=t.__[0];return t.__=t.__N,t.__N=void 0,e===t.__[0]})))&&(!s||s(t,e,n))}}return i.__N||i.__}function G(t,n){var i=X(O++,3);!e.__s&&st(i.__H,n)&&(i.__=t,i.i=n,U.__H.__h.push(i))}function z(t){return $=5,J((function(){return{current:t}}),[])}function J(t,e){var n=X(O++,7);return st(n.__H,e)?(n.__V=t(),n.i=e,n.__h=t,n.__V):n.__}function Y(t,e){return $=8,J((function(){return t}),e)}function Z(t){var e=U.context[t.__c],n=X(O++,9);return n.c=t,e?(null==n.__&&(n.__=!0,e.sub(U)),e.props.value):t.__}function tt(){for(var t;t=H.shift();)if(t.__P&&t.__H)try{t.__H.__h.forEach(nt),t.__H.__h.forEach(it),t.__H.__h=[]}catch(n){t.__H.__h=[],e.__e(n,t.__v)}}e.__b=function(t){U=null,j&&j(t)},e.__r=function(t){B&&B(t),O=0;var e=(U=t.__c).__H;e&&(R===U?(e.__h=[],U.__h=[],e.__.forEach((function(t){t.__N&&(t.__=t.__N),t.__V=M,t.__N=t.i=void 0}))):(e.__h.forEach(nt),e.__h.forEach(it),e.__h=[])),R=U},e.diffed=function(t){F&&F(t);var n=t.__c;n&&n.__H&&(n.__H.__h.length&&(1!==H.push(n)&&W===e.requestAnimationFrame||((W=e.requestAnimationFrame)||function(t){var e,n=function(){clearTimeout(i),et&&cancelAnimationFrame(e),setTimeout(t)},i=setTimeout(n,100);et&&(e=requestAnimationFrame(n))})(tt)),n.__H.__.forEach((function(t){t.i&&(t.__H=t.i),t.__V!==M&&(t.__=t.__V),t.i=void 0,t.__V=M}))),R=U=null},e.__c=function(t,n){n.some((function(t){try{t.__h.forEach(nt),t.__h=t.__h.filter((function(t){return!t.__||it(t)}))}catch(i){n.some((function(t){t.__h&&(t.__h=[])})),n=[],e.__e(i,t.__v)}})),V&&V(t,n)},e.unmount=function(t){q&&q(t);var n,i=t.__c;i&&i.__H&&(i.__H.__.forEach((function(t){try{nt(t)}catch(t){n=t}})),n&&e.__e(n,i.__v))};var et="function"==typeof requestAnimationFrame;function nt(t){var e=U,n=t.__c;"function"==typeof n&&(t.__c=void 0,n()),U=e}function it(t){var e=U;t.__c=t.__(),U=e}function st(t,e){return!t||t.length!==e.length||e.some((function(e,n){return e!==t[n]}))}function ot(t,e){return"function"==typeof e?e(t):e}const at=function(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return MgUpcTexts&&MgUpcTexts[t]?e?e.reduce((function(t,e){return t.replace(/%s/,e)}),MgUpcTexts[t]):MgUpcTexts[t]:t},lt="ui/reset",rt="ui/error",ct="ui/editing",ut="ui/mode",dt="listOfLists/set",pt="listOfLists/remove",_t="listOfLists/create",mt="listOfList/addingPost",ft="listOfList/setPage",gt="listOfList/setTotalPages",ht="list/set",vt="list/update",yt="list/setPage",bt="list/setTotalPages",Pt="list/setItems",Nt="list/removeItem",wt="list/addItem",kt="list/updateItem",Ct="list/moveItem",xt="list/cart",It=async function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"mg-upc/v1/lists";if(void 0===Dt().nonce){const t=new FormData;t.append("action","mg_upc_user");const e={method:"POST",credentials:"same-origin",referrerPolicy:"no-referrer",body:t},n=await fetch(Dt().ajaxUrl,e),i=await n.json();i.nonce&&(Dt().nonce=i.nonce),i.user_id&&(Dt().user_id=i.user_id)}const s={method:t,credentials:"same-origin",headers:{"Content-Type":"application/json","X-WP-Nonce":Dt().nonce},referrerPolicy:"no-referrer"};"GET"!==t&&n&&(s.body=JSON.stringify(n));const o=await fetch(Dt().root+i+e,s);o.headers.get("x-wp-nonce")&&(Dt().nonce=o.headers.get("x-wp-nonce"));const a=await o.json();return{data:a,headers:o.headers,status:o.status}};function St(t){const e=Object.entries(t).filter((t=>{let[,e]=t;return null!=e})).map((t=>{let[e,n]=t;return`${encodeURIComponent(e)}=${encodeURIComponent(String(n))}`})),n=-1!==Dt().root.indexOf("?")?"&":"?";return e.length>0?`${n}${e.join("&")}`:""}class Tt extends Error{constructor(t,e){var n;super(t),this.name="MgApiError",this.code=null==e||null===(n=e.data)||void 0===n?void 0:n.code,this.response=e}}function At(t){var e,n;let i=null==t||null===(e=t.data)||void 0===e||null===(n=e.data)||void 0===n?void 0:n.status;var s;if(!i&&t.status&&(i=t.status),400===i||401===i||403===i||404===i||409===i||500===i)throw new Tt(null==t||null===(s=t.data)||void 0===s?void 0:s.message,t)}let Et={my:function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return It("GET","/My"+St(t),{}).then((function(t){return At(t),t}))},discover:function(t){return It("GET","/"+St(t),{}).then((function(t){return At(t),t}))},get:function(t){return It("GET","/"+t,{}).then((function(t){return At(t),t}))},cart:function(t){return It("POST","/cart",{list:t},"mg-upc/v1").then((function(t){return At(t),t}))},items:function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return It("GET","/"+t+"/items"+St(e),{}).then((function(t){return At(t),t}))},delete:function(t){return It("DELETE","/"+t,{}).then((function(t){return At(t),t}))},create:function(t){return It("POST","",t).then((function(t){return At(t),t}))},update:function(t){let e=t.id;return delete t.id,It("PATCH","/"+e,t).then((function(t){return At(t),t}))},add:function(t,e){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return"object"!=typeof e&&(e={post_id:e}),It("POST","/"+t+"/items"+St(n),e).then((function(t){return At(t),t}))},quit:function(t,e){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return It("DELETE","/"+t+"/items/"+e+St(n),{}).then((function(t){return At(t),t}))},updateItem:function(t,e,n){return It("PATCH","/"+t+"/items/"+e,n).then((function(t){return At(t),t}))},vote:function(t,e){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return It("POST","/"+t+"/items/"+e+"/vote",n).then((function(t){return At(t),t}))},move:function(t,e,n){return It("PATCH","/"+t+"/items/"+e,{position:n}).then((function(t){return At(t),t}))}};const Lt=Et;function Dt(){return MgUserPostCollections}function Ot(){var t;return null===(t=Dt())||void 0===t?void 0:t.sortable}function Ut(t){var e;const n=null===(e=Dt())||void 0===e?void 0:e.types;return!(!n||!n[t])&&n[t]}function Rt(){var t;return Object.values(null===(t=Dt())||void 0===t?void 0:t.statuses)}function Wt(t){var e;const n=null===(e=Dt())||void 0===e?void 0:e.statuses;return!(!n||!n[t])&&n[t]}function $t(t,e){return!!t.type&&Mt(t.type,e)}function Ht(t){var e;const n=[],i=null===(e=Dt())||void 0===e?void 0:e.types;for(const e in i)i.hasOwnProperty(e)&&(Mt(e,"always_exists")||(null!=t&&t.type?i[e].available_post_types.includes(t.type)&&n.push(i[e]):n.push(i[e])));return n}function Mt(t,e){const n=Ut(t);return!(!n||!n.supports)&&n.supports.includes(e)}const jt="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVQYV2NgYAAAAAMAAWgmWQ0AAAAASUVORK5CYII=";function Bt(t){return JSON.parse(JSON.stringify(t))}function Ft(t){return t.stopImmediatePropagation&&t.stopImmediatePropagation(),t.stopPropagation&&t.stopPropagation(),t.preventDefault(),!1}function Vt(t,e){const{type:n,payload:i}=e;let s=!1;const o=t=>(s=a({status:"failed"}),t.error&&(s.error=t.error.message?t.error.message:"",s.errorCode=t.error.code?t.error.code:""),s),a=function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(s||(s=Bt(t)),e)for(const t in e)e.hasOwnProperty(t)&&(s[t]=e[t]);return s};let l=function(t,e){const{type:n,payload:i}=e;let s,o;const a=function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(o||(o=!1===t?{}:Bt(t)),e)for(const t in e)o[t]=e[t];return o};switch(n){case ht:return!0===i?{ID:-1,title:"",content:"",status:"",type:""}:i;case vt:return i.items=Bt(t.items),i;case _t:return i;case Pt:return a({items:i});case"list/addItem/failed":case wt:return null!=i&&i.list?a(i.list):t;case kt:const e=!!i.item&&i.item;return s=a().items.map((t=>t.post_id===i.post_id?e||Object.assign({},t,i):{...t})),a({items:s});case Nt:if(!t.items||1===t.items.length||!1===i)return t;if(o=a(),s=o.items.filter((t=>t.post_id!==i)),Mt(t.type,"sortable")){const e=parseInt(t.items[0].position,10);s.forEach(((t,n)=>{s[n].position=e+n}))}if(Mt(t.type,"vote")){const e=t.items.find((t=>t.post_id==i));e&&(o.vote_counter=o.vote_counter-e.votes)}return{...o,items:s};case Ct:const n=parseInt(t.items[0].position,10);s=a().items.slice();const l=a().items[i.oldIndex];return s.splice(i.oldIndex,1),s.splice(i.newIndex,0,l),isNaN(n)?(alert("positions error!"),t):(s.forEach(((t,e)=>{s[e].position=n+e})),a({items:s}));default:return t}}(t.list,e),r=function(t,e){const{type:n,payload:i}=e;switch(n){case dt:return i;case wt:case ht:return!1;case pt:return!1===i?t:Bt(t.filter((t=>t.ID!=i)));default:return t}}(t.listOfList,e);switch(t.list===l&&r===t.listOfList||(s=a({listOfList:r,list:l}),t.addingPost||(s.title=s.list?s.list.title:Qt.title)),n){case ut:return a({mode:i});case lt:return{...Qt,mode:t.mode};case rt:return a(!1===i?{error:!1,errorCode:!1}:{error:i});case"ui/message":return a(!1===i?{message:!1,errorCode:!1}:{message:i});case xt:const n=a();return i.msg&&(n.message=i.msg),i.err&&(n.error=i.err),n;case ct:return a({editing:i});case mt:return s=a(),s.addingPost=i,i&&(s.title=at("Add to...")),s;case _t:s=a(),s.title=i.title?i.title:Qt.title,s.listTotalPages=1,s.listPage=1,s.addingPost=!1;break;case wt:if(s=a(),null!=i&&i.list){const t=i.list;s.title=t.title?t.title:Qt.title;const e=null==t?void 0:t.items_page;e&&(s.listTotalPages=e["X-WP-TotalPages"]?e["X-WP-TotalPages"]:1,s.listPage=e["X-WP-Page"]?e["X-WP-Page"]:1)}i.message&&(s.error=i.message,s.status="failed"),s.addingPost=!1;break;case ft:return a({page:i});case gt:return a({totalPages:i});case yt:return a({listPage:i});case bt:return a({listTotalPages:i});case"list/set/loading":return s=a(),s.status="loading",s.listOfList=!1,"object"==typeof i?(s.list=i,i.title&&(s.title=i.title)):s.list={ID:i},s;case"list/removeItem/loading":return s=a({status:"loading"}),"object"==typeof i&&i.list_id&&(s.list={ID:i.list_id}),s;case"listOfLists/set/loading":case"list/setItems/loading":case"list/updateItem/loading":case"list/addItem/loading":case"list/moveItemNext/loading":case"list/moveItemPrev/loading":case"list/update/loading":case _t+"/loading":case"list/cart/loading":return a({status:"loading"});case"list/addItem/succeeded":return s=a(),s.addingPost=!1,s.status="succeeded",s.error=!1,s.errorCode=!1,s.title=s.list?s.list.title:Qt.title,s;case"list/cart/succeeded":return a({status:"succeeded",errorCode:!1});case"list/set/succeeded":if(!1===t.list)break;return a({status:"succeeded",error:!1,errorCode:!1});case"listOfLists/set/succeeded":case"list/setItems/succeeded":case"list/updateItem/succeeded":case"list/removeItem/succeeded":case"list/moveItem/succeeded":case"list/moveItemNext/succeeded":case"list/moveItemPrev/succeeded":case"list/update/succeeded":case _t+"/succeeded":return a({status:"succeeded",error:!1,errorCode:!1});case _t+"/failed":return s=a({status:"failed"}),e.error&&e.error.message&&(s.error=e.error.message),s;case"list/addItem/failed":if(s=a(),s.addingPost=!1,s.title=s.list?s.list.title:Qt.title,null!=i&&i.list){const t=i.list;s.title=t.title?t.title:Qt.title;const e=null==t?void 0:t.items_page;e&&(s.listTotalPages=e["X-WP-TotalPages"]?e["X-WP-TotalPages"]:1,s.listPage=e["X-WP-Page"]?e["X-WP-Page"]:1)}return i.message&&(s.error=i.message,s.status="failed"),o(e);case"listOfLists/set/failed":case"list/setItems/failed":case"list/updateItem/failed":case"list/removeItem/failed":case"list/moveItem/failed":case"list/moveItemNext/failed":case"list/moveItemPrev/failed":case"list/update/failed":case"list/set/failed":case"list/cart/failed":return o(e)}return!1!==s?s:t}const qt=(t,e)=>function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;for(var i=arguments.length,s=new Array(i>1?i-1:0),o=1;o<i;o++)s[o-1]=arguments[o];return{asyncThunk:!0,payload:e,type:t,arg:n,extra:s}};class Xt extends Error{constructor(t,e){super(t),this.name="MgUpcRejectWithValue",this.value=e}}const Kt=(t,e)=>n=>{let i;if((s=n)&&"object"==typeof s&&!0===s.asyncThunk){let s={dispatch:Kt(t,e),getState:e,extra:n.extra,rejectWithValue:t=>new Xt(n.type+": rejectWithValue",t)};t({type:n.type+"/loading",payload:n.arg}),i=n.payload(n.arg,s)}else{if(!(t=>!!t&&("object"==typeof t||"function"==typeof t)&&"function"==typeof t.then)(n.payload))return void t(n);t({type:n.type+"/loading"}),i=n.payload}var s;i.then((e=>{e instanceof Xt?t({type:n.type+"/failed",payload:e.value}):(t({type:n.type,payload:e}),t({type:n.type+"/succeeded"}))})).catch((e=>{t(e instanceof Xt?{type:n.type+"/failed",payload:e.value}:{type:n.type+"/failed",error:e})}))},Qt={list:!1,listOfList:!1,addingPost:null,status:"idle",error:null,message:null,errorCode:null,editing:!1,title:at("My Lists"),actualAction:"init",page:1,totalPages:1,listPage:1,listTotalPages:1,mode:"my"},Gt=function(t,e){var n={__c:e="__cC"+o++,__:t,Consumer:function(t,e){return t.children(e)},Provider:function(t){var n,i;return this.getChildContext||(n=[],(i={})[e]=this,this.getChildContext=function(){return i},this.shouldComponentUpdate=function(t){this.props.value!==t.value&&n.some(h)},this.sub=function(t){n.push(t);var e=t.componentWillUnmount;t.componentWillUnmount=function(){n.splice(n.indexOf(t),1),e&&e.call(t)}}),t.children}};return n.Provider.__=n.Consumer.contextType=n}({});function zt(t){return new Date(t).toLocaleDateString()}const Jt=function(t){const{state:e,dispatch:n}=Z(Gt);return d("li",{className:"mg-upc-dg-item-list",onClick:t.onClick,onKeyPress:e=>{13===e.keyCode&&t.onClick(e)},tabIndex:"0"},d("i",{className:"mg-upc-icon mg-upc-dg-item-type mg-upc-dg-item-type-"+t.list.type}),d("div",{className:"mg-upc-dg-item-title"},d("span",null,t.list.title),"my"!==e.mode&&d(_,null,d("span",null,d("a",{href:"#",onClick:function(e){Ft(e),function(t,e){const n=new URLSearchParams(document.location.hash.substring(1));n.set("author",e);let i=n.toString();""!==i&&(i="#"+i),window.location.hash=i}(0,t.list.author)}},t.list.user_login),d("span",{className:"mg-upc-list-dates"},d("i",null," ",d("b",null,"Created:")," ",zt(t.list.created)),d("i",null," ",d("b",null,"Modified:")," ",zt(t.list.modified)))))),d("span",{className:"mg-upc-dg-item-count"},t.list.count),d("span",{className:"mg-upc-dg-item-actions"},t.onRemove&&d("button",{"aria-label":at("Remove List"),onClick:e=>{e.stopPropagation(),t.onRemove(t.list)}},d("span",{className:"mg-upc-icon upc-font-trash"}))))};class Yt extends m{render(){const t=[];for(let e=0;e<this.props.count;e++){let n=this.props.styles?this.props.styles:{};null!=this.props.width&&(n.width=this.props.width),null!=this.props.height&&(n.height=this.props.height),null!==this.props.width&&null!==this.props.height&&this.props.circle&&(n.borderRadius="50%"),t.push(d("span",{key:e,className:"mg-upc-dg-loading-skeleton",style:n},""))}const e=this.props.wrapper;return d("span",null,e?t.map(((t,n)=>d(e,{key:n},t,""))):t)}}var Zt,te,ee;ee={count:1,duration:1.2,width:null,wrapper:null,height:null,circle:!1},(te="defaultProps")in(Zt=Yt)?Object.defineProperty(Zt,te,{value:ee,enumerable:!0,configurable:!0,writable:!0}):Zt[te]=ee;const ne=function(t){return d("div",{className:"mg-upc-dg-pagination-div"},d("button",{className:1===t.page?"mg-upc-dg-hidden mg-upc-dg-pagination":"mg-upc-dg-pagination",ref:t.prevRef,disabled:1===t.page,"aria-label":at("Previous page"),title:at("Previous page"),onClick:t.onPreview},d("span",{className:"mg-upc-icon upc-font-arrow_left"})),d("span",{className:t.totalPages>1?"mg-upc-dg-pagination-current":"mg-upc-dg-hidden mg-upc-dg-pagination-current"},t.page),d("button",{className:t.page>=t.totalPages?"mg-upc-dg-hidden mg-upc-dg-pagination":"mg-upc-dg-pagination",ref:t.nextRef,disabled:t.page>=t.totalPages,"aria-label":at("Next page"),title:at("Next page"),onClick:t.onNext},d("span",{className:"mg-upc-icon upc-font-arrow_right"})))},ie=()=>({type:lt,payload:null}),se=t=>({type:mt,payload:t}),oe=t=>({type:ct,payload:t}),ae=qt(xt,(async function(t,e){return await function(t){return Lt.cart(t).then((t=>(jQuery&&t.data.fragments&&t.data.cart_hash&&jQuery(document.body).trigger("added_to_cart",[t.data.fragments,t.data.cart_hash]),t.data)))}(t)})),le=qt(dt,(async function(t,e){var n;const i=null===(n=t)||void 0===n?void 0:n.addingPost;return null===t&&(t={}),t.addingPost?t.adding=t.addingPost:(t.adding="",delete t.adding),await Lt.my(t).then((t=>ce(t,e,i)))})),re=qt(dt,(async function(t,e){return null===t&&(t={}),await Lt.discover(t).then((t=>ce(t,e,!1)))}));function ce(t,e,n){if(t.headers.get("x-wp-page")&&(e.dispatch(de(parseInt(t.headers.get("x-wp-page"),10))),e.dispatch(pe(parseInt(t.headers.get("X-WP-TotalPages"),10)))),n&&t.headers.get("X-WP-Post-Type")){const i={post_id:n},s={"X-WP-Post-Type":"type","X-WP-Post-Title":"title","X-WP-Post-Image":"image"};for(const e in s){const n=t.headers.get(e);n&&(i[s[e]]=decodeURIComponent(n))}e.dispatch(se(i))}return t.data}const ue=qt(pt,(async function(t,e){return await Lt.delete(t).then((n=>{if(1===e.getState().listOfList.length){const n=e.getState().page,i=e.getState().totalPages;if(n<i)e.dispatch(le({page:n}));else{if(!(n>1&&n===i))return t;e.dispatch(le({page:n-1}))}return!1}return t}))})),de=t=>({type:ft,payload:t}),pe=t=>({type:gt,payload:t}),_e=t=>({type:yt,payload:t}),me=t=>({type:bt,payload:t}),fe=qt(ht,(async function(t,e){return!1===t||!0===t?t:await Lt.get("object"==typeof t?t.ID:t).then((t=>(Ce(t,e.dispatch),t.data)))})),ge=qt(vt,(async function(t,e){return await Lt.update(t).then((t=>(e.dispatch(oe(!1)),Ce(t,e.dispatch),t.data)))})),he=qt(_t,(async function(t,e){return null===t&&(t={}),t.adding&&t.adding!==e.getState().addingPost&&e.dispatch(se({id:t.addingPost})),await Lt.create(t).then((t=>(e.dispatch(oe(!1)),Ce(t,e.dispatch),t.data)))})),ve=qt(Pt,(async function(t,e){return await Lt.items(e.getState().list.ID,t).then((t=>(Ce(t,e.dispatch),t.data)))})),ye=qt(Nt,(async function(t,e){const n=e.getState();var i=e.extra.length>0?e.extra[0]:n.list.ID;const s=e.extra.length>1?e.extra[1]:"view";return await Lt.quit(i,t,{context:s}).then((o=>{if(o.data&&o.data.list_id,n.list&&n.list.ID){if(1===n.list.items.length){if(e.dispatch(ve({page})),n.list&&"view"===s){const t=n.listPage,i=n.listTotalPages;t<i?e.dispatch(ve({page:t})):t===i&&e.dispatch(ve({page:Math.max(1,t-1)}))}return!1}}else e.dispatch(fe({ID:i}));return t}))})),be=qt(wt,(async function(t,e){let n=e.extra[0],i=!1;try{await Lt.add(t,n,{context:e.extra.length>1?e.extra[1]:"view"}).then((t=>{i=t.data}))}catch(t){var s;const n=null==t||null===(s=t.response)||void 0===s?void 0:s.data;i=e.rejectWithValue(n)}return i})),Pe=qt(kt,(async function(t,e){const n=e.extra[0];return await Lt.updateItem(e.getState().list.ID,t,n).then((e=>{var i;return{...n,post_id:t,item:null==e||null===(i=e.data)||void 0===i?void 0:i.item}}))})),Ne=qt(Ct,(async function(t,e){const n=e.extra[0],i=e.extra[1],s=n.items[t],o=s.position-t+i;return await Lt.move(n.ID,s.post_id,o).then((e=>({oldIndex:t,newIndex:i})))})),we=qt("list/moveItemNext",(async function(t,e){const n=e.getState().list,i=parseInt(n.items[n.items.length-1].position,10);if(isNaN(i))throw alert("positions error!"),"positions error!";const s=n.items[t];return await Lt.move(n.ID,s.post_id,i+1),await e.dispatch(ve({page:e.getState().listPage})),t})),ke=qt("list/moveItemPrev",(async function(t,e){const n=e.getState().list,i=parseInt(n.items[0].position,10);if(isNaN(i))throw alert("positions error!"),"positions error!";const s=n.items[t];return await Lt.move(n.ID,s.post_id,i-1),await e.dispatch(ve({page:e.getState().listPage})),t}));function Ce(t,e){!t.data.items_page&&t.headers.get("x-wp-page")?(e(_e(parseInt(t.headers.get("x-wp-page"),10))),e(me(parseInt(t.headers.get("X-WP-TotalPages"),10)))):t.data.items_page&&(e(_e(parseInt(t.data.items_page["X-WP-Page"],10))),e(me(parseInt(t.data.items_page["X-WP-TotalPages"],10))))}const xe=function(t){const{state:e,dispatch:n}=Z(Gt);return d(_,null,d("ul",{className:"mg-upc-dg-list-of-lists-fake mg-upc-dg-on-loading"},[0,1,2].map((t=>d("li",{className:"mg-upc-dg-item-list"},d("div",null,d(Yt,{width:"1.5em",height:"1.5em"})),d("div",{className:"mg-upc-dg-item-title"},d(Yt,null)),d("div",{className:"mg-upc-dg-item-count"},d(Yt,null)))))),d("ul",{className:"mg-upc-dg-list-of-lists"},t.lists&&t.lists.map((e=>d(Jt,{list:e,onClick:()=>t.onSelect(e),onRemove:t.onRemove,key:e.ID})))),e.totalPages>1&&d(ne,{totalPages:e.totalPages,page:e.page,onPreview:t.loadPreview,onNext:t.loadNext}))},Ie=function(t){var e,n,i;const[s,o]=K(!1),[a,l]=K(""),r=z({});G((()=>{l(t.item.description)}),[t.item]),G((()=>{s&&r.current.focus()}),[s]);const c=()=>"string"==typeof a&&a.length>0;return d(_,null,d("span",null,d("br",null),"Adding item:"),d("div",{className:"mg-upc-dg-item mg-upc-dg-item-adding","data-post_id":t.item.post_id},d("span",{className:"mg-upc-icon upc-font-add"}),d("span",null," "),d("img",{className:"mg-upc-dg-item-image",src:t.item.image?t.item.image:jt}),d("div",{className:"mg-upc-dg-item-data"},d("a",{href:null===(e=t.item)||void 0===e?void 0:e.link},null===(n=t.item)||void 0===n?void 0:n.title),!s&&d("p",null,null===(i=t.item)||void 0===i?void 0:i.description),!s&&d("button",{onClick:()=>{o(!0)}},c()&&d("span",null,at("Edit Comment")),!c()&&d("span",null,at("Add Comment"))),d("input",{ref:r,className:s?"mg-upc-dg-btn-item-desc":"mg-upc-dg-dn",type:"text",value:a,onChange:function(t){l(t.target.value)},maxLength:400}),s&&d("button",{className:"mg-upc-dg-btn-item-desc-cancel",onClick:()=>{o(!1),l(t.item.description)}},d("span",{className:"mg-upc-icon upc-font-close"}),d("span",null,at("Cancel"))),s&&d("button",{className:"mg-upc-dg-btn-item-desc-save",onClick:()=>{o(!1),t.onSaveItemDescription(a)}},d("span",{className:"mg-upc-icon upc-font-save"}),d("span",null,at("Save"))))),d("span",null,at("Select where the item will be added:")))};function Se(){return Se=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},Se.apply(this,arguments)}function Te(t,e){for(var n in t)if("__source"!==n&&!(n in e))return!0;for(var i in e)if("__source"!==i&&t[i]!==e[i])return!0;return!1}function Ae(t){this.props=t}(Ae.prototype=new m).isPureReactComponent=!0,Ae.prototype.shouldComponentUpdate=function(t,e){return Te(this.props,t)||Te(this.state,e)};var Ee=e.__b;e.__b=function(t){t.type&&t.type.__f&&t.ref&&(t.props.ref=t.ref,t.ref=null),Ee&&Ee(t)},"undefined"!=typeof Symbol&&Symbol.for&&Symbol.for("react.forward_ref");var Le=e.__e;e.__e=function(t,e,n,i){if(t.then)for(var s,o=e;o=o.__;)if((s=o.__c)&&s.__c)return null==e.__e&&(e.__e=n.__e,e.__k=n.__k),s.__c(t,e);Le(t,e,n,i)};var De=e.unmount;function Oe(){this.__u=0,this.t=null,this.__b=null}function Ue(t){var e=t.__.__c;return e&&e.__a&&e.__a(t)}function Re(){this.u=null,this.o=null}e.unmount=function(t){var e=t.__c;e&&e.__R&&e.__R(),e&&!0===t.__h&&(t.type=null),De&&De(t)},(Oe.prototype=new m).__c=function(t,e){var n=e.__c,i=this;null==i.t&&(i.t=[]),i.t.push(n);var s=Ue(i.__v),o=!1,a=function(){o||(o=!0,n.__R=null,s?s(l):l())};n.__R=a;var l=function(){if(!--i.__u){if(i.state.__a){var t=i.state.__a;i.__v.__k[0]=function t(e,n,i){return e&&(e.__v=null,e.__k=e.__k&&e.__k.map((function(e){return t(e,n,i)})),e.__c&&e.__c.__P===n&&(e.__e&&i.insertBefore(e.__e,e.__d),e.__c.__e=!0,e.__c.__P=i)),e}(t,t.__c.__P,t.__c.__O)}var e;for(i.setState({__a:i.__b=null});e=i.t.pop();)e.forceUpdate()}},r=!0===e.__h;i.__u++||r||i.setState({__a:i.__b=i.__v.__k[0]}),t.then(a,a)},Oe.prototype.componentWillUnmount=function(){this.t=[]},Oe.prototype.render=function(t,e){if(this.__b){if(this.__v.__k){var n=document.createElement("div"),i=this.__v.__k[0].__c;this.__v.__k[0]=function t(e,n,i){return e&&(e.__c&&e.__c.__H&&(e.__c.__H.__.forEach((function(t){"function"==typeof t.__c&&t.__c()})),e.__c.__H=null),null!=(e=function(t,e){for(var n in e)t[n]=e[n];return t}({},e)).__c&&(e.__c.__P===i&&(e.__c.__P=n),e.__c=null),e.__k=e.__k&&e.__k.map((function(e){return t(e,n,i)}))),e}(this.__b,n,i.__O=i.__P)}this.__b=null}var s=e.__a&&d(_,null,t.fallback);return s&&(s.__h=null),[d(_,null,e.__a?null:t.children),s]};var We=function(t,e,n){if(++n[1]===n[0]&&t.o.delete(e),t.props.revealOrder&&("t"!==t.props.revealOrder[0]||!t.o.size))for(n=t.u;n;){for(;n.length>3;)n.pop()();if(n[1]<n[0])break;t.u=n=n[2]}};function $e(t){return this.getChildContext=function(){return t.context},t.children}function He(t){var e=this,n=t.i;e.componentWillUnmount=function(){D(null,e.l),e.l=null,e.i=null},e.i&&e.i!==n&&e.componentWillUnmount(),t.__v?(e.l||(e.i=n,e.l={nodeType:1,parentNode:n,childNodes:[],appendChild:function(t){this.childNodes.push(t),e.i.appendChild(t)},insertBefore:function(t,n){this.childNodes.push(t),e.i.appendChild(t)},removeChild:function(t){this.childNodes.splice(this.childNodes.indexOf(t)>>>1,1),e.i.removeChild(t)}}),D(d($e,{context:e.context},t.__v),e.l)):e.l&&e.componentWillUnmount()}(Re.prototype=new m).__a=function(t){var e=this,n=Ue(e.__v),i=e.o.get(t);return i[0]++,function(s){var o=function(){e.props.revealOrder?(i.push(s),We(e,t,i)):s()};n?n(o):o()}},Re.prototype.render=function(t){this.u=null,this.o=new Map;var e=P(t.children);t.revealOrder&&"b"===t.revealOrder[0]&&e.reverse();for(var n=e.length;n--;)this.o.set(e[n],this.u=[1,0,this.u]);return t.children},Re.prototype.componentDidUpdate=Re.prototype.componentDidMount=function(){var t=this;this.o.forEach((function(e,n){We(t,n,e)}))};var Me="undefined"!=typeof Symbol&&Symbol.for&&Symbol.for("react.element")||60103,je=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image|letter|lighting|marker(?!H|W|U)|overline|paint|pointer|shape|stop|strikethrough|stroke|text(?!L)|transform|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/,Be="undefined"!=typeof document,Fe=function(t){return("undefined"!=typeof Symbol&&"symbol"==typeof Symbol()?/fil|che|rad/i:/fil|che|ra/i).test(t)};m.prototype.isReactComponent={},["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach((function(t){Object.defineProperty(m.prototype,t,{configurable:!0,get:function(){return this["UNSAFE_"+t]},set:function(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:e})}})}));var Ve=e.event;function qe(){}function Xe(){return this.cancelBubble}function Ke(){return this.defaultPrevented}e.event=function(t){return Ve&&(t=Ve(t)),t.persist=qe,t.isPropagationStopped=Xe,t.isDefaultPrevented=Ke,t.nativeEvent=t};var Qe={configurable:!0,get:function(){return this.class}},Ge=e.vnode;e.vnode=function(t){var e=t.type,n=t.props,i=n;if("string"==typeof e){var s=-1===e.indexOf("-");for(var o in i={},n){var a=n[o];Be&&"children"===o&&"noscript"===e||"value"===o&&"defaultValue"in n&&null==a||("defaultValue"===o&&"value"in n&&null==n.value?o="value":"download"===o&&!0===a?a="":/ondoubleclick/i.test(o)?o="ondblclick":/^onchange(textarea|input)/i.test(o+e)&&!Fe(n.type)?o="oninput":/^onfocus$/i.test(o)?o="onfocusin":/^onblur$/i.test(o)?o="onfocusout":/^on(Ani|Tra|Tou|BeforeInp|Compo)/.test(o)?o=o.toLowerCase():s&&je.test(o)?o=o.replace(/[A-Z0-9]/g,"-$&").toLowerCase():null===a&&(a=void 0),/^oninput$/i.test(o)&&(o=o.toLowerCase(),i[o]&&(o="oninputCapture")),i[o]=a)}"select"==e&&i.multiple&&Array.isArray(i.value)&&(i.value=P(n.children).forEach((function(t){t.props.selected=-1!=i.value.indexOf(t.props.value)}))),"select"==e&&null!=i.defaultValue&&(i.value=P(n.children).forEach((function(t){t.props.selected=i.multiple?-1!=i.defaultValue.indexOf(t.props.value):i.defaultValue==t.props.value}))),t.props=i,n.class!=n.className&&(Qe.enumerable="className"in n,null!=n.className&&(i.class=n.className),Object.defineProperty(i,"className",Qe))}t.$$typeof=Me,Ge&&Ge(t)};var ze=e.__r;e.__r=function(t){ze&&ze(t),t.__c};var Je=['a[href]:not([tabindex^="-"])','area[href]:not([tabindex^="-"])','input:not([type="hidden"]):not([type="radio"]):not([disabled]):not([tabindex^="-"])','input[type="radio"]:not([disabled]):not([tabindex^="-"])','select:not([disabled]):not([tabindex^="-"])','textarea:not([disabled]):not([tabindex^="-"])','button:not([disabled]):not([tabindex^="-"])','iframe:not([tabindex^="-"])','audio[controls]:not([tabindex^="-"])','video[controls]:not([tabindex^="-"])','[contenteditable]:not([tabindex^="-"])','[tabindex]:not([tabindex^="-"])'];function Ye(t){this._show=this.show.bind(this),this._hide=this.hide.bind(this),this._maintainFocus=this._maintainFocus.bind(this),this._bindKeypress=this._bindKeypress.bind(this),this.$el=t,this.shown=!1,this._id=this.$el.getAttribute("data-a11y-dialog")||this.$el.id,this._previouslyFocused=null,this._listeners={},this.create()}function Ze(t,e){return n=(e||document).querySelectorAll(t),Array.prototype.slice.call(n);var n}function tn(t){(t.querySelector("[autofocus]")||t).focus()}function en(){Ze("[data-a11y-dialog]").forEach((function(t){new Ye(t)}))}Ye.prototype.create=function(){return this.$el.setAttribute("aria-hidden",!0),this.$el.setAttribute("aria-modal",!0),this.$el.setAttribute("tabindex",-1),this.$el.hasAttribute("role")||this.$el.setAttribute("role","dialog"),this._openers=Ze('[data-a11y-dialog-show="'+this._id+'"]'),this._openers.forEach(function(t){t.addEventListener("click",this._show)}.bind(this)),this._closers=Ze("[data-a11y-dialog-hide]",this.$el).concat(Ze('[data-a11y-dialog-hide="'+this._id+'"]')),this._closers.forEach(function(t){t.addEventListener("click",this._hide)}.bind(this)),this._fire("create"),this},Ye.prototype.show=function(t){return this.shown||(this._previouslyFocused=document.activeElement,this.$el.removeAttribute("aria-hidden"),this.shown=!0,tn(this.$el),document.body.addEventListener("focus",this._maintainFocus,!0),document.addEventListener("keydown",this._bindKeypress),this._fire("show",t)),this},Ye.prototype.hide=function(t){return this.shown?(this.shown=!1,this.$el.setAttribute("aria-hidden","true"),this._previouslyFocused&&this._previouslyFocused.focus&&this._previouslyFocused.focus(),document.body.removeEventListener("focus",this._maintainFocus,!0),document.removeEventListener("keydown",this._bindKeypress),this._fire("hide",t),this):this},Ye.prototype.destroy=function(){return this.hide(),this._openers.forEach(function(t){t.removeEventListener("click",this._show)}.bind(this)),this._closers.forEach(function(t){t.removeEventListener("click",this._hide)}.bind(this)),this._fire("destroy"),this._listeners={},this},Ye.prototype.on=function(t,e){return void 0===this._listeners[t]&&(this._listeners[t]=[]),this._listeners[t].push(e),this},Ye.prototype.off=function(t,e){var n=(this._listeners[t]||[]).indexOf(e);return n>-1&&this._listeners[t].splice(n,1),this},Ye.prototype._fire=function(t,e){var n=this._listeners[t]||[],i=new CustomEvent(t,{detail:e});this.$el.dispatchEvent(i),n.forEach(function(t){t(this.$el,e)}.bind(this))},Ye.prototype._bindKeypress=function(t){this.$el.contains(document.activeElement)&&(this.shown&&"Escape"===t.key&&"alertdialog"!==this.$el.getAttribute("role")&&(t.preventDefault(),this.hide(t)),this.shown&&"Tab"===t.key&&function(t,e){var n=function(t){return Ze(Je.join(","),t).filter((function(t){return!!(t.offsetWidth||t.offsetHeight||t.getClientRects().length)}))}(t),i=n.indexOf(document.activeElement);e.shiftKey&&0===i?(n[n.length-1].focus(),e.preventDefault()):e.shiftKey||i!==n.length-1||(n[0].focus(),e.preventDefault())}(this.$el,t))},Ye.prototype._maintainFocus=function(t){!this.shown||t.target.closest('[aria-modal="true"]')||t.target.closest("[data-a11y-dialog-ignore-focus-trap]")||tn(this.$el)},"undefined"!=typeof document&&("loading"===document.readyState?document.addEventListener("DOMContentLoaded",en):window.requestAnimationFrame?window.requestAnimationFrame(en):window.setTimeout(en,16));(t=>{const e=(()=>{const[t,e]=K(!1);return G((()=>e(!0)),[]),t})(),[n,i]=(t=>{const[e,n]=(()=>{const[t,e]=K(null);return[t,Y((t=>{null!==t&&e(new Ye(t))}),[])]})(),i=Y((()=>e.hide()),[e]),s=t.role||"dialog",o="alertdialog"===s,a=t.titleId||t.id+"-title";return G((()=>()=>{e&&e.destroy()}),[e]),[e,{container:{id:t.id,ref:n,role:s,tabIndex:-1,"aria-modal":!0,"aria-hidden":!0,"aria-labelledby":a},overlay:{onClick:o?void 0:i},dialog:{role:"document"},closeButton:{type:"button",onClick:i},title:{role:"heading","aria-level":1,id:a}}]})(t),{dialogRef:s}=t;if(G((()=>(n&&s(n),()=>s(void 0))),[s,n]),!e)return null;const o=t.dialogRoot?document.querySelector(t.dialogRoot):document.body,a=d("h2",Se({},i.title,{className:t.classNames.title,key:"title"}),t.onBack&&d("a",{"aria-label":t.backButtonLabel,href:"#",onClick:e=>{e.preventDefault(),t.onBack(e)}},"←")," ",t.title),l=d("button",Se({},i.closeButton,{className:t.classNames.closeButton,"aria-label":t.closeButtonLabel,key:"button"}),t.closeButtonContent),r=["first"===t.closeButtonPosition&&l,a,t.children,"last"===t.closeButtonPosition&&l].filter(Boolean);return function(t,e){var n=d(He,{__v:t,i:e});return n.containerInfo=e,n}(d("div",Se({},i.container,{className:t.classNames.container}),d("div",Se({},i.overlay,{className:t.classNames.overlay})),d("div",Se({},i.dialog,{className:t.classNames.dialog}),r)),o)}).defaultProps={role:"dialog",closeButtonLabel:"Close this dialog window",closeButtonContent:"×",closeButtonPosition:"first",classNames:{},backButtonLabel:"Back",dialogRef:()=>{}};const nn=function(t){var e;const[n,i]=K(""),[s,o]=K(""),[a,l]=K(""),[r,c]=K(""),u=J((()=>Ht(t.addingPost)),[t.addingPost]);function p(t){t.default_title&&i(t.default_title),t.default_status&&c(t.default_status),l(t.name)}return""===a&&1===u.length&&p(u[0]),G((()=>{i(t.list.title),o(t.list.content),l(t.list.type),c(t.list.status)}),[t.list]),G((()=>{var t;null!==(t=Ut(a))&&void 0!==t&&t.available_statuses&&-1===Ut(a).available_statuses.indexOf(r)&&c(Ut(a).available_statuses[0])}),[a]),d("div",{className:"mg-list-edit"},-1===t.list.ID&&""===a&&d(_,null,d("label",null,at("Select a list type:")),d("ul",{id:`type-${t.list.ID}`},u.map(((t,e)=>d("li",{className:"mg-upc-dg-item-list-type",key:t.name,onClick:()=>p(t),onKeyPress:e=>{13===e.keyCode&&p(t)},tabIndex:"0"},d("i",{className:"mg-upc-icon mg-upc-dg-item-type mg-upc-dg-item-type-"+t.name}),d("div",{className:"mg-upc-dg-item-title"},d("strong",null,t.label),d("div",{className:"mg-upc-dg-item-desc"},t.description))))))),""!==a&&Mt(a,"editable_title")&&d(_,null,d("label",{htmlFor:`title-${t.list.ID}`},at("Title")),d("input",{id:`title-${t.list.ID}`,type:"text",value:n,onChange:function(t){i(t.target.value)},maxLength:100})),""!==a&&Mt(a,"editable_content")&&d(_,null,d("label",{htmlFor:`content-${t.list.ID}`},at("Description")),d("textarea",{id:`content-${t.list.ID}`,value:s,onChange:function(t){o(t.target.value)},maxLength:500}),d("span",{className:"mg-upc-dg-list-desc-edit-count"},d("i",null,null==s?void 0:s.length),"/500")),""!==a&&!Ut(a)&&d("span",null,at("Unknown List Type...")),""!==a&&(null===(e=Ut(a))||void 0===e?void 0:e.available_statuses)&&Ut(a).available_statuses.length>1&&d(_,null,d("label",{htmlFor:`status-${t.list.ID}`},at("Status")),d("select",{id:`status-${t.list.ID}`,value:r,onChange:function(t){c(t.target.value)}},Ut(a).available_statuses.map(((t,e)=>{if(function(t){const e=Wt(t);return e&&e.show_in_status_list}(t))return d("option",{value:t},function(t){const e=Wt(t);return e?e.label:t}(t))})))),""!==a&&Ut(a)&&d("div",{className:"mg-upc-dg-edit-actions"},d("button",{onClick:()=>t.onSave({title:n,content:s,type:a,status:r})},d("span",{className:"mg-upc-icon upc-font-save"}),d("span",null,at("Save"))),d("button",{onClick:()=>t.onCancel()},d("span",{className:"mg-upc-icon upc-font-close"}),d("span",null,at("Cancel")))))},sn=function(t){var e;const[n,i]=K(!1),[s,o]=K(""),[a,l]=K(null===(e=t.item)||void 0===e?void 0:e.quantity),r=z({});G((()=>{o(t.item.description)}),[t.item]),G((()=>{n&&r.current.focus()}),[n]);const c=z(!1);return G((()=>{t.item.quantity!==a&&(clearTimeout(c.current),c.current=setTimeout((function(){t.onSaveItemQuantity(a)}),600))}),[a]),d("li",{className:"mg-upc-dg-item","data-post_id":t.item.post_id},$t(t.list,"sortable")&&d(_,null,d("span",{className:"mg-upc-dg-item-handle","aria-draggable":!0},"::"),d("span",{className:"mg-upc-dg-item-number"},t.item.position)),$t(t.list,"vote")&&d(_,null,d("span",{className:"mg-upc-dg-item-number"},(()=>{const e=parseInt(t.list.vote_counter,10);return $t(t.list,"vote")&&e>0?Math.round(100*parseInt(t.item.votes,10)/e)+"%":"0%"})())),d("a",{href:t.item.link},d("img",{className:"mg-upc-dg-item-image",src:t.item.image?t.item.image:jt})),d("div",{className:"mg-upc-dg-item-data"},d("a",{href:t.item.link},t.item.title),t.item.price_html&&d("span",{className:"mg-upc-dg-price",dangerouslySetInnerHTML:{__html:t.item.price_html}}),t.item.stock_html&&d("span",{className:"mg-upc-dg-stock",dangerouslySetInnerHTML:{__html:t.item.stock_html}}),t.editable&&!n&&d("p",null,t.item.description),t.editable&&!n&&$t(t.list,"editable_item_description")&&d("button",{onClick:()=>{i(!0)}},d("span",{className:"mg-upc-icon upc-font-edit"}),""===s&&d("span",null,at("Add Comment")),""!==s&&d("span",null,at("Edit Comment"))),d("input",{ref:r,className:n?"mg-upc-dg-btn-item-desc":"mg-upc-dg-dn",type:"text",value:s,onChange:function(t){o(t.target.value)},maxLength:400}),t.editable&&n&&d("button",{className:"mg-upc-dg-btn-item-desc-cancel",onClick:()=>{i(!1),o(t.item.description)}},d("span",{className:"mg-upc-icon upc-font-close"}),d("span",null,at("Cancel"))),t.editable&&n&&d("button",{className:"mg-upc-dg-btn-item-desc-save",onClick:()=>{i(!1),t.onSaveItemDescription(s)}},d("span",{className:"mg-upc-icon upc-font-save"}),d("span",null,at("Save")))),t.editable&&$t(t.list,"quantity")&&d("div",{className:"mg-upc-dg-quantity"},d("small",null,at("Quantity")),d("input",{"aria-label":at("Quantity"),type:"number",value:a,onChange:function(){l(event.target.value)}})),t.editable&&!n&&d("div",null,d("button",{"aria-label":"Remove item",onClick:t.onRemove},d("span",{className:"mg-upc-icon upc-font-trash"}))))},on=function(t){return new Promise((function(e,n){const i=document.createElement("script");let s=!1;i.type="text/javascript",i.src=t,i.async=!0,i.onerror=function(t){n(t,i)},i.onload=i.onreadystatechange=function(){s||this.readyState&&"complete"!=this.readyState||(s=!0,setTimeout((function(){e()}),100))},(document.head||document.body||document.documentElement).appendChild(i)}))},an=function(t){var e,n,i;const s=z(null),o=z((e=>{t.onMove(e)}));return G((()=>{o.current=t.onMove})),G((()=>{let e=!1;if($t(t.list,"sortable")){const t=()=>{e=Sortable.create(s.current,{handle:".mg-upc-dg-item-handle",group:"shared",animation:150,onUpdate:function(t){o.current(t)}})};"undefined"!=typeof Sortable?t():on(Ot()).then((()=>{t()}))}return()=>{e&&e.destroy()}})),d(_,null,d("ul",{className:"mg-upc-dg-list-fake mg-upc-dg-on-loading"},[0,1,2].map((e=>d("li",{className:"mg-upc-dg-item"},$t(t.list,"sortable")&&d(_,null,d("span",{className:"mg-upc-dg-item-handle-skeleton"}," ",d(Yt,{width:"1.5em"})," "),d("span",{className:"mg-upc-dg-item-number-skeleton"}," ",d(Yt,{width:"1em"})," ")),$t(t.list,"vote")&&d(_,null,d("span",{className:"mg-upc-dg-item-number-skeleton"}," ",d(Yt,{width:"1em"})," ")),d("div",{className:"mg-upc-dg-item-skeleton-image"},d(Yt,{width:"5em",height:"5em"})),d("div",{className:"mg-upc-dg-item-data"},d(Yt,{count:2})))))),d("ul",{ref:s,className:"mg-upc-dg-list"},0===(null==t||null===(e=t.items)||void 0===e?void 0:e.length)&&d("span",null,"There are no items in this list"),(null==t||null===(n=t.items)||void 0===n?void 0:n.length)>0&&(null===(i=t.items)||void 0===i?void 0:i.map)&&t.items.map((e=>d(sn,{list:t.list,item:e,editable:t.editable,onRemove:()=>t.onRemove(t.list,e),onSaveItemDescription:n=>t.onSaveItemDescription(t.list,e,n),onSaveItemQuantity:n=>t.onSaveItemQuantity(t.list,e,n),key:e.ID+":"+e.post_id})))),$t(t.list,"vote")&&d("span",{className:"mg-upc-dg-total-votes"}," ",at("Total votes:")," ",d("span",null," ",t.list.vote_counter)))},ln=function(t){const e=z(null),n=z(null),i=at("Copy"),[s,o]=K(i);G((()=>{let t=null;s!==i&&(t=setTimeout((()=>{o(i),clearTimeout(t)}),2e3))}),[s]);const a=encodeURIComponent(t.link),l=encodeURIComponent(t.title);let r=[{name:"Twitter",url:"https://twitter.com/share?url="+a+"&text="+l},{name:"Facebook",url:"https://www.facebook.com/sharer/sharer.php?u="+a+""e="+l},{name:"Pinterest",url:"https://pinterest.com/pin/create/button/?url="+a+"&description="+l},{name:"Whatsapp",url:"whatsapp://send?text="+a},{name:"Telegram",url:"https://t.me/share/url?url="+a+"&text="+l},{name:"LiNE",url:"https://social-plugins.line.me/lineit/share?url="+a+"&text="+l},{slug:"email",name:at("Email"),url:"mailto:?subject="+l+"&body="+a}];return void 0!==Dt().shareButtons&&(r=r.filter((t=>Dt().shareButtons.includes(t.slug||t.name.toLowerCase())))),d("div",{className:"mg-upc-dg-share-link"},d("input",{ref:e,value:t.link,onClick:function(){e.current.setSelectionRange(0,e.current.value.length)},readOnly:!0}),d("button",{ref:n,onClick:function(t){var n;(n=e.current).focus(),n.setSelectionRange(0,n.value.length),document.execCommand&&document.execCommand("copy")?o(at("Copied!")):o("Error!")}},d("span",{className:"mg-upc-icon upc-font-copy"}),d("span",null,s)),r.map((function(t){return(e=t).slug||(e.slug=e.name.toLowerCase()),d("a",{href:e.url,title:"Share with "+e.name,className:"mg-upc-dg-share",target:"_blank",rel:"noopener"},d("div",{className:"mg-upc-share-btn-img mg-upc-share-"+e.slug}," "));var e})))},rn=function(t){var e;const{state:n,dispatch:i}=Z(Gt),[s,o]=K(!1),a=z(!1),l=z(!1);function r(t){t<1||t>n.listTotalPages||"loading"===n.status||i(ve({page:t}))}return G((()=>{const t=n.list;let e=!1,s=!1;if(t&&$t(t,"sortable")){const t=()=>{a.current&&n.listPage<n.listTotalPages&&(e=Sortable.create(a.current,{group:"shared",onAdd:t=>{i(we(t.oldIndex))}})),a.current&&n.listPage>1&&(s=Sortable.create(l.current,{group:"shared",onAdd:t=>{i(ke(t.oldIndex))}}))};"undefined"!=typeof Sortable?t():on(Ot()).then((()=>{t()}))}return()=>{e&&e.destroy(),s&&s.destroy()}}),[n.list,n.listPage,n.listTotalPages]),G((()=>{o(!1)}),[n.editing,n.list,n.addingPost]),d(_,null,n.editing&&d(nn,{list:n.list,addingPost:n.addingPost,onSave:function(t){if(-1===n.list.ID||t.title!==n.list.title||t.content!==n.list.content||t.status!==n.list.status)if(-1===n.list.ID){var e;const s={};s.title=t.title,s.content=t.content,s.type=t.type,s.status=t.status,null!==(e=n.addingPost)&&void 0!==e&&e.post_id&&(s.adding=n.addingPost.post_id),i(he(s))}else{const e={id:n.list.ID};t.status!==n.list.status&&(e.status=t.status),t.title!==n.list.title&&(e.title=t.title),t.content!==n.list.content&&(e.content=t.content),i(ge(e))}},onCancel:function(){i(oe(!1)),-1===n.list.ID&&(i(fe(!1)),i(ie()),i(le()))}}),!n.editing&&d(_,null,d("div",{className:"mg-upc-dg-top-action"},function(t){var e,n;const i=t.type;return Mt(i,"editable_title")||Mt(i,"editable_content")||(null===(e=Ut(i))||void 0===e||null===(n=e.available_statuses)||void 0===n?void 0:n.length)>1}(n.list)&&d("button",{className:"mg-upg-edit",onClick:()=>i(oe(!0))},d("span",{className:"mg-upc-icon upc-font-edit"}),d("span",null,at("Edit"))),n.list.link&&d("button",{className:"mg-upg-share",onClick:()=>o(!s)},d("span",{className:"mg-upc-icon upc-font-share"}),d("span",null,at("Share"))),"cart"===n.list.type&&d("button",{className:"mg-upg-share",onClick:function(){i(ae(n.list.ID))}},d("span",{className:"mg-upc-icon upc-font-cart"}),d("span",null,at("Add all to cart")))),s&&n.list.link&&d(ln,{link:n.list.link,title:n.list.title}),n.list.content&&d("p",{className:"mg-upc-dg-list-desc",dangerouslySetInnerHTML:{__html:(c=n.list.content,"string"!=typeof c?"":c.replace(/([^>\r\n]?)(\r\n|\n\r|\r|\n)/g,"$1<br>$2"))}}),d(Yt,{count:3}),d(an,{list:n.list,items:(null===(e=n.list)||void 0===e?void 0:e.items)||[],onMove:function(t){i(Ne(t.oldIndex,n.list,t.newIndex))},onRemove:function(t,e){i(ye(e.post_id))},onSaveItemDescription:function(t,e,n){i(Pe(e.post_id,{description:n}))},onSaveItemQuantity:function(t,e,n){i(Pe(e.post_id,{quantity:n}))},editable:t.editable})),(!n.editing||!n.list)&&n.listTotalPages>1&&d(ne,{totalPages:n.listTotalPages,page:n.listPage,onPreview:function(){r(n.listPage-1)},onNext:function(){r(n.listPage+1)},prevRef:l,nextRef:a}));var c};D(d((t=>{const[e,n]=Q(Vt,Qt);return d(Gt.Provider,{value:{state:e,dispatch:Kt(n,(()=>e))}},t.children)}),null,d((function(){const{state:t,dispatch:e}=Z(Gt),[n,i]=K("any"),[s,o]=K("any"),[a,l]=K(""),[r,c]=K(null),u=z(!1),p=J((()=>Ht(t.addingPost)),[t.addingPost]),m=J((()=>{return Object.values(null===(t=Dt())||void 0===t?void 0:t.types);var t}),[]);let f="listOfList";if(t.addingPost)f=t.editing?"addingToNew":"adding";else if(t.editing){var g;f=-1!==(null===(g=t.list)||void 0===g?void 0:g.ID)?"edit":"new"}else f=t.list?"list":"listOfList";G((()=>{window.showMainLists=function(){e(ie()),h()},window.addItemToList=function(t){let n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];e(ie()),n||P(t)}}),[e]);const h=()=>{const i={};n&&(i.types=n),s&&(i.status=s),r&&(i.search=r),a&&(i.author=a),t.page>1&&(i.page=t.page),e(re(i))};function v(){t.page>1&&e(de(1))}function y(t){v(),i(t)}function b(t){v(),o(t)}G((()=>{Qt.title="",e({type:ut,payload:"admin"});const t=function(t){const n=parseInt(("author",new URLSearchParams(document.location.hash.substring(1)).get("author")),10);n>0&&n!==a&&(t&&Ft(t),e(de(1)),l(n),location.hash="")};return t(0),window.addEventListener("hashchange",t,!1),()=>{window.removeEventListener("hashchange",t)}}),[]),G((()=>{t.list||h()}),[n,s,a,t.page]),G((()=>{null!=r&&(clearTimeout(u.current),u.current=setTimeout((function(){h()}),300))}),[r]);const P=t=>{e(se({post_id:t})),e(le({addingPost:t}))};function N(n){n<1||n>t.totalPages||"loading"===t.status||e(de(n))}const w=d("h2",{key:"title"},("list"===f||"new"===f||"edit"===f||"addingToNew"===f)&&d("a",{"aria-label":"Back",className:"mg-upc-dg-back",href:"#",onClick:n=>{n.preventDefault(),function(){switch(f){case"list":e(fe(!1)),h();break;case"new":e(fe(!1)),e(oe(!1)),h();break;case"edit":e(oe(!1));break;case"addingToNew":e(fe(!1)),e(oe(!1)),e(le({addingPost:t.addingPost.post_id}));break;default:h()}}()}},"←")," ",t.title);return d(_,null,w,d("div",{className:"mg-upc-dg-content-wrapper mg-upc-dg-status-"+t.status+" mg-upc-dg-view-"+f},d("div",{className:"mg-upc-dg-wait"}),t.error&&d("div",{className:"mg-upc-dg-error"},t.error,d("a",{href:"#",className:"mg-upc-dg-alert-close","aria-label":"Hide alert",onClick:t=>{t.preventDefault(),e({type:rt,payload:null})}},d("span",{className:"mg-upc-icon upc-font-close"}))),d("div",{className:"mg-upc-dg-body"},!t.error&&t.addingPost&&d(Ie,{item:t.addingPost,onSaveItemDescription:function(n){e(se({...t.addingPost,description:n}))}}),("listOfList"===f||"adding"===f)&&d(_,null,d("div",{className:"mg-upc-dg-top-action"},p.length>0&&d("button",{className:"mg-list-new",onClick:function(t){e(oe(!0)),e(fe(!0))}},d("span",{className:"mg-upc-icon upc-font-add"}),d("span",null,at("Create List")))),d("ul",{className:"mg-upc-dg-filter"},d("li",{className:"mg-upc-dg-filter-label"},d("strong",null,at("Types"))),d("li",{className:"any"==n?"mg-upc-dg-item-list-type mg-upc-selected":"mg-upc-dg-item-list-type",onClick:()=>y("any"),onKeyPress:t=>{13===t.keyCode&&y("any")},tabIndex:"0"},d("i",{className:"mg-upc-icon upc-font-close mg-upc-dg-item-type mg-upc-dg-item-type-none"}),d("div",{className:"mg-upc-dg-item-title"},d("strong",null,"All"))),m.map(((t,e)=>d("li",{className:t.name==n?"mg-upc-dg-item-list-type mg-upc-selected":"mg-upc-dg-item-list-type",key:t.name,onClick:()=>y(t.name),onKeyPress:e=>{13===e.keyCode&&y(t.name)},tabIndex:"0"},d("i",{className:"mg-upc-icon mg-upc-dg-item-type mg-upc-dg-item-type-"+t.name}),d("div",{className:"mg-upc-dg-item-title"},d("strong",null,t.label)))))),Rt()&&d("ul",{className:"mg-upc-dg-filter"},d("li",{className:"mg-upc-dg-filter-label"},d("strong",null,at("Status"))),d("li",{className:"any"==s?"mg-upc-selected":"",onClick:()=>b("any"),onKeyPress:t=>{13===t.keyCode&&b("any")},tabIndex:"0"},d("div",{className:"mg-upc-dg-item-title"},d("strong",null,"All"))),Rt().map(((t,e)=>d("li",{className:t.name==s?"mg-upc-selected":"",key:t.name,onClick:()=>b(t.name),onKeyPress:e=>{13===e.keyCode&&b(t.name)},tabIndex:"0"},t.label)))),d("div",{className:"mg-upc-dg-df"},d("ul",{className:"mg-upc-dg-filter"},d("li",{className:"mg-upc-dg-filter-label"},d("strong",null,at("Search"))),d("input",{onChange:function(t){v(),c(t.target.value)},value:r})),d("ul",{className:"mg-upc-dg-filter"},d("li",{className:"mg-upc-dg-filter-label"},d("strong",null,at("Author (ID)"))),d("input",{type:"number",onChange:function(t){v(),l(t.target.value)},value:a}))),d(xe,{lists:t.listOfList,onSelect:function(n){e(oe(!1)),t.addingPost?e(be(n.ID,t.addingPost)):e(fe(n))},onRemove:!t.addingPost&&function(t){e(ue(t.ID))},loadPreview:function(){N(t.page-1)},loadNext:function(){N(t.page+1)}})),t.list&&d(rn,{editable:(t.list,!0)}))))}),null)," "),document.getElementById("mg-upc-admin-app")),setTimeout(window.showMainLists,1e3)})();1 (()=>{"use strict";var t,e,n,i,s,o,a,l,r,c,u,d={},_=[],p=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,m=Array.isArray;function f(t,e){for(var n in e)t[n]=e[n];return t}function g(t){t&&t.parentNode&&t.parentNode.removeChild(t)}function h(e,n,i){var s,o,a,l={};for(a in n)"key"==a?s=n[a]:"ref"==a?o=n[a]:l[a]=n[a];if(arguments.length>2&&(l.children=arguments.length>3?t.call(arguments,2):i),"function"==typeof e&&null!=e.defaultProps)for(a in e.defaultProps)void 0===l[a]&&(l[a]=e.defaultProps[a]);return v(e,l,s,o,null)}function v(t,i,s,o,a){var l={type:t,props:i,key:s,ref:o,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:null==a?++n:a,__i:-1,__u:0};return null==a&&null!=e.vnode&&e.vnode(l),l}function y(t){return t.children}function b(t,e){this.props=t,this.context=e}function P(t,e){if(null==e)return t.__?P(t.__,t.__i+1):null;for(var n;e<t.__k.length;e++)if(null!=(n=t.__k[e])&&null!=n.__e)return n.__e;return"function"==typeof t.type?P(t):null}function w(t){var e,n;if(null!=(t=t.__)&&null!=t.__c){for(t.__e=t.__c.base=null,e=0;e<t.__k.length;e++)if(null!=(n=t.__k[e])&&null!=n.__e){t.__e=t.__c.base=n.__e;break}return w(t)}}function N(t){(!t.__d&&(t.__d=!0)&&i.push(t)&&!k.__r++||s!==e.debounceRendering)&&((s=e.debounceRendering)||o)(k)}function k(){var t,n,s,o,l,r,c,u;for(i.sort(a);t=i.shift();)t.__d&&(n=i.length,o=void 0,r=(l=(s=t).__v).__e,c=[],u=[],s.__P&&((o=f({},l)).__v=l.__v+1,e.vnode&&e.vnode(o),L(s.__P,o,l,s.__n,s.__P.namespaceURI,32&l.__u?[r]:null,c,null==r?P(l):r,!!(32&l.__u),u),o.__v=l.__v,o.__.__k[o.__i]=o,O(c,o,u),o.__e!=r&&w(o)),i.length>n&&i.sort(a));k.__r=0}function C(t,e,n,i,s,o,a,l,r,c,u){var p,m,f,g,h,v=i&&i.__k||_,y=e.length;for(n.__d=r,x(n,e,v),r=n.__d,p=0;p<y;p++)null!=(f=n.__k[p])&&(m=-1===f.__i?d:v[f.__i]||d,f.__i=p,L(t,f,m,s,o,a,l,r,c,u),g=f.__e,f.ref&&m.ref!=f.ref&&(m.ref&&R(m.ref,null,f),u.push(f.ref,f.__c||g,f)),null==h&&null!=g&&(h=g),65536&f.__u||m.__k===f.__k?r=I(f,r,t):"function"==typeof f.type&&void 0!==f.__d?r=f.__d:g&&(r=g.nextSibling),f.__d=void 0,f.__u&=-196609);n.__d=r,n.__e=h}function x(t,e,n){var i,s,o,a,l,r=e.length,c=n.length,u=c,d=0;for(t.__k=[],i=0;i<r;i++)null!=(s=e[i])&&"boolean"!=typeof s&&"function"!=typeof s?(a=i+d,(s=t.__k[i]="string"==typeof s||"number"==typeof s||"bigint"==typeof s||s.constructor==String?v(null,s,null,null,null):m(s)?v(y,{children:s},null,null,null):void 0===s.constructor&&s.__b>0?v(s.type,s.props,s.key,s.ref?s.ref:null,s.__v):s).__=t,s.__b=t.__b+1,o=null,-1!==(l=s.__i=T(s,n,a,u))&&(u--,(o=n[l])&&(o.__u|=131072)),null==o||null===o.__v?(-1==l&&d--,"function"!=typeof s.type&&(s.__u|=65536)):l!==a&&(l==a-1?d--:l==a+1?d++:(l>a?d--:d++,s.__u|=65536))):s=t.__k[i]=null;if(u)for(i=0;i<c;i++)null!=(o=n[i])&&!(131072&o.__u)&&(o.__e==t.__d&&(t.__d=P(o)),W(o,o))}function I(t,e,n){var i,s;if("function"==typeof t.type){for(i=t.__k,s=0;i&&s<i.length;s++)i[s]&&(i[s].__=t,e=I(i[s],e,n));return e}t.__e!=e&&(e&&t.type&&!n.contains(e)&&(e=P(t)),n.insertBefore(t.__e,e||null),e=t.__e);do{e=e&&e.nextSibling}while(null!=e&&8===e.nodeType);return e}function S(t,e){return e=e||[],null==t||"boolean"==typeof t||(m(t)?t.some((function(t){S(t,e)})):e.push(t)),e}function T(t,e,n,i){var s=t.key,o=t.type,a=n-1,l=n+1,r=e[n];if(null===r||r&&s==r.key&&o===r.type&&!(131072&r.__u))return n;if(i>(null==r||131072&r.__u?0:1))for(;a>=0||l<e.length;){if(a>=0){if((r=e[a])&&!(131072&r.__u)&&s==r.key&&o===r.type)return a;a--}if(l<e.length){if((r=e[l])&&!(131072&r.__u)&&s==r.key&&o===r.type)return l;l++}}return-1}function E(t,e,n){"-"===e[0]?t.setProperty(e,null==n?"":n):t[e]=null==n?"":"number"!=typeof n||p.test(e)?n:n+"px"}function A(t,e,n,i,s){var o;t:if("style"===e)if("string"==typeof n)t.style.cssText=n;else{if("string"==typeof i&&(t.style.cssText=i=""),i)for(e in i)n&&e in n||E(t.style,e,"");if(n)for(e in n)i&&n[e]===i[e]||E(t.style,e,n[e])}else if("o"===e[0]&&"n"===e[1])o=e!==(e=e.replace(/(PointerCapture)$|Capture$/i,"$1")),e=e.toLowerCase()in t||"onFocusOut"===e||"onFocusIn"===e?e.toLowerCase().slice(2):e.slice(2),t.l||(t.l={}),t.l[e+o]=n,n?i?n.u=i.u:(n.u=l,t.addEventListener(e,o?c:r,o)):t.removeEventListener(e,o?c:r,o);else{if("http://www.w3.org/2000/svg"==s)e=e.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if("width"!=e&&"height"!=e&&"href"!=e&&"list"!=e&&"form"!=e&&"tabIndex"!=e&&"download"!=e&&"rowSpan"!=e&&"colSpan"!=e&&"role"!=e&&"popover"!=e&&e in t)try{t[e]=null==n?"":n;break t}catch(t){}"function"==typeof n||(null==n||!1===n&&"-"!==e[4]?t.removeAttribute(e):t.setAttribute(e,"popover"==e&&1==n?"":n))}}function D(t){return function(n){if(this.l){var i=this.l[n.type+t];if(null==n.t)n.t=l++;else if(n.t<i.u)return;return i(e.event?e.event(n):n)}}}function L(t,n,i,s,o,a,l,r,c,u){var d,_,p,g,h,v,P,w,N,k,x,I,S,T,E,A,D=n.type;if(void 0!==n.constructor)return null;128&i.__u&&(c=!!(32&i.__u),a=[r=n.__e=i.__e]),(d=e.__b)&&d(n);t:if("function"==typeof D)try{if(w=n.props,N="prototype"in D&&D.prototype.render,k=(d=D.contextType)&&s[d.__c],x=d?k?k.props.value:d.__:s,i.__c?P=(_=n.__c=i.__c).__=_.__E:(N?n.__c=_=new D(w,x):(n.__c=_=new b(w,x),_.constructor=D,_.render=H),k&&k.sub(_),_.props=w,_.state||(_.state={}),_.context=x,_.__n=s,p=_.__d=!0,_.__h=[],_._sb=[]),N&&null==_.__s&&(_.__s=_.state),N&&null!=D.getDerivedStateFromProps&&(_.__s==_.state&&(_.__s=f({},_.__s)),f(_.__s,D.getDerivedStateFromProps(w,_.__s))),g=_.props,h=_.state,_.__v=n,p)N&&null==D.getDerivedStateFromProps&&null!=_.componentWillMount&&_.componentWillMount(),N&&null!=_.componentDidMount&&_.__h.push(_.componentDidMount);else{if(N&&null==D.getDerivedStateFromProps&&w!==g&&null!=_.componentWillReceiveProps&&_.componentWillReceiveProps(w,x),!_.__e&&(null!=_.shouldComponentUpdate&&!1===_.shouldComponentUpdate(w,_.__s,x)||n.__v===i.__v)){for(n.__v!==i.__v&&(_.props=w,_.state=_.__s,_.__d=!1),n.__e=i.__e,n.__k=i.__k,n.__k.some((function(t){t&&(t.__=n)})),I=0;I<_._sb.length;I++)_.__h.push(_._sb[I]);_._sb=[],_.__h.length&&l.push(_);break t}null!=_.componentWillUpdate&&_.componentWillUpdate(w,_.__s,x),N&&null!=_.componentDidUpdate&&_.__h.push((function(){_.componentDidUpdate(g,h,v)}))}if(_.context=x,_.props=w,_.__P=t,_.__e=!1,S=e.__r,T=0,N){for(_.state=_.__s,_.__d=!1,S&&S(n),d=_.render(_.props,_.state,_.context),E=0;E<_._sb.length;E++)_.__h.push(_._sb[E]);_._sb=[]}else do{_.__d=!1,S&&S(n),d=_.render(_.props,_.state,_.context),_.state=_.__s}while(_.__d&&++T<25);_.state=_.__s,null!=_.getChildContext&&(s=f(f({},s),_.getChildContext())),N&&!p&&null!=_.getSnapshotBeforeUpdate&&(v=_.getSnapshotBeforeUpdate(g,h)),C(t,m(A=null!=d&&d.type===y&&null==d.key?d.props.children:d)?A:[A],n,i,s,o,a,l,r,c,u),_.base=n.__e,n.__u&=-161,_.__h.length&&l.push(_),P&&(_.__E=_.__=null)}catch(t){if(n.__v=null,c||null!=a){for(n.__u|=c?160:128;r&&8===r.nodeType&&r.nextSibling;)r=r.nextSibling;a[a.indexOf(r)]=null,n.__e=r}else n.__e=i.__e,n.__k=i.__k;e.__e(t,n,i)}else null==a&&n.__v===i.__v?(n.__k=i.__k,n.__e=i.__e):n.__e=U(i.__e,n,i,s,o,a,l,c,u);(d=e.diffed)&&d(n)}function O(t,n,i){n.__d=void 0;for(var s=0;s<i.length;s++)R(i[s],i[++s],i[++s]);e.__c&&e.__c(n,t),t.some((function(n){try{t=n.__h,n.__h=[],t.some((function(t){t.call(n)}))}catch(t){e.__e(t,n.__v)}}))}function U(n,i,s,o,a,l,r,c,u){var _,p,f,h,v,y,b,w=s.props,N=i.props,k=i.type;if("svg"===k?a="http://www.w3.org/2000/svg":"math"===k?a="http://www.w3.org/1998/Math/MathML":a||(a="http://www.w3.org/1999/xhtml"),null!=l)for(_=0;_<l.length;_++)if((v=l[_])&&"setAttribute"in v==!!k&&(k?v.localName===k:3===v.nodeType)){n=v,l[_]=null;break}if(null==n){if(null===k)return document.createTextNode(N);n=document.createElementNS(a,k,N.is&&N),c&&(e.__m&&e.__m(i,l),c=!1),l=null}if(null===k)w===N||c&&n.data===N||(n.data=N);else{if(l=l&&t.call(n.childNodes),w=s.props||d,!c&&null!=l)for(w={},_=0;_<n.attributes.length;_++)w[(v=n.attributes[_]).name]=v.value;for(_ in w)if(v=w[_],"children"==_);else if("dangerouslySetInnerHTML"==_)f=v;else if(!(_ in N)){if("value"==_&&"defaultValue"in N||"checked"==_&&"defaultChecked"in N)continue;A(n,_,null,v,a)}for(_ in N)v=N[_],"children"==_?h=v:"dangerouslySetInnerHTML"==_?p=v:"value"==_?y=v:"checked"==_?b=v:c&&"function"!=typeof v||w[_]===v||A(n,_,v,w[_],a);if(p)c||f&&(p.__html===f.__html||p.__html===n.innerHTML)||(n.innerHTML=p.__html),i.__k=[];else if(f&&(n.innerHTML=""),C(n,m(h)?h:[h],i,s,o,"foreignObject"===k?"http://www.w3.org/1999/xhtml":a,l,r,l?l[0]:s.__k&&P(s,0),c,u),null!=l)for(_=l.length;_--;)g(l[_]);c||(_="value","progress"===k&&null==y?n.removeAttribute("value"):void 0!==y&&(y!==n[_]||"progress"===k&&!y||"option"===k&&y!==w[_])&&A(n,_,y,w[_],a),_="checked",void 0!==b&&b!==n[_]&&A(n,_,b,w[_],a))}return n}function R(t,n,i){try{if("function"==typeof t){var s="function"==typeof t.__u;s&&t.__u(),s&&null==n||(t.__u=t(n))}else t.current=n}catch(t){e.__e(t,i)}}function W(t,n,i){var s,o;if(e.unmount&&e.unmount(t),(s=t.ref)&&(s.current&&s.current!==t.__e||R(s,null,n)),null!=(s=t.__c)){if(s.componentWillUnmount)try{s.componentWillUnmount()}catch(t){e.__e(t,n)}s.base=s.__P=null}if(s=t.__k)for(o=0;o<s.length;o++)s[o]&&W(s[o],n,i||"function"!=typeof t.type);i||g(t.__e),t.__c=t.__=t.__e=t.__d=void 0}function H(t,e,n){return this.constructor(t,n)}function $(n,i,s){var o,a,l,r;e.__&&e.__(n,i),a=(o="function"==typeof s)?null:s&&s.__k||i.__k,l=[],r=[],L(i,n=(!o&&s||i).__k=h(y,null,[n]),a||d,d,i.namespaceURI,!o&&s?[s]:a?null:i.firstChild?t.call(i.childNodes):null,l,!o&&s?s:a?a.__e:i.firstChild,o,r),O(l,n,r)}t=_.slice,e={__e:function(t,e,n,i){for(var s,o,a;e=e.__;)if((s=e.__c)&&!s.__)try{if((o=s.constructor)&&null!=o.getDerivedStateFromError&&(s.setState(o.getDerivedStateFromError(t)),a=s.__d),null!=s.componentDidCatch&&(s.componentDidCatch(t,i||{}),a=s.__d),a)return s.__E=s}catch(e){t=e}throw t}},n=0,b.prototype.setState=function(t,e){var n;n=null!=this.__s&&this.__s!==this.state?this.__s:this.__s=f({},this.state),"function"==typeof t&&(t=t(f({},n),this.props)),t&&f(n,t),null!=t&&this.__v&&(e&&this._sb.push(e),N(this))},b.prototype.forceUpdate=function(t){this.__v&&(this.__e=!0,t&&this.__h.push(t),N(this))},b.prototype.render=y,i=[],o="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,a=function(t,e){return t.__v.__b-e.__v.__b},k.__r=0,l=0,r=D(!1),c=D(!0),u=0;var M,F,j,B,q=0,K=[],X=e,V=X.__b,Q=X.__r,G=X.diffed,z=X.__c,J=X.unmount,Y=X.__;function Z(t,e){X.__h&&X.__h(F,t,q||e),q=0;var n=F.__H||(F.__H={__:[],__h:[]});return t>=n.__.length&&n.__.push({}),n.__[t]}function tt(t){return q=1,et(pt,t)}function et(t,e,n){var i=Z(M++,2);if(i.t=t,!i.__c&&(i.__=[n?n(e):pt(void 0,e),function(t){var e=i.__N?i.__N[0]:i.__[0],n=i.t(e,t);e!==n&&(i.__N=[n,i.__[1]],i.__c.setState({}))}],i.__c=F,!F.u)){var s=function(t,e,n){if(!i.__c.__H)return!0;var s=i.__c.__H.__.filter((function(t){return!!t.__c}));if(s.every((function(t){return!t.__N})))return!o||o.call(this,t,e,n);var a=!1;return s.forEach((function(t){if(t.__N){var e=t.__[0];t.__=t.__N,t.__N=void 0,e!==t.__[0]&&(a=!0)}})),!(!a&&i.__c.props===t)&&(!o||o.call(this,t,e,n))};F.u=!0;var o=F.shouldComponentUpdate,a=F.componentWillUpdate;F.componentWillUpdate=function(t,e,n){if(this.__e){var i=o;o=void 0,s(t,e,n),o=i}a&&a.call(this,t,e,n)},F.shouldComponentUpdate=s}return i.__N||i.__}function nt(t,e){var n=Z(M++,3);!X.__s&&_t(n.__H,e)&&(n.__=t,n.i=e,F.__H.__h.push(n))}function it(t){return q=5,st((function(){return{current:t}}),[])}function st(t,e){var n=Z(M++,7);return _t(n.__H,e)&&(n.__=t(),n.__H=e,n.__h=t),n.__}function ot(t,e){return q=8,st((function(){return t}),e)}function at(t){var e=F.context[t.__c],n=Z(M++,9);return n.c=t,e?(null==n.__&&(n.__=!0,e.sub(F)),e.props.value):t.__}function lt(){for(var t;t=K.shift();)if(t.__P&&t.__H)try{t.__H.__h.forEach(ut),t.__H.__h.forEach(dt),t.__H.__h=[]}catch(e){t.__H.__h=[],X.__e(e,t.__v)}}X.__b=function(t){F=null,V&&V(t)},X.__=function(t,e){t&&e.__k&&e.__k.__m&&(t.__m=e.__k.__m),Y&&Y(t,e)},X.__r=function(t){Q&&Q(t),M=0;var e=(F=t.__c).__H;e&&(j===F?(e.__h=[],F.__h=[],e.__.forEach((function(t){t.__N&&(t.__=t.__N),t.i=t.__N=void 0}))):(e.__h.forEach(ut),e.__h.forEach(dt),e.__h=[],M=0)),j=F},X.diffed=function(t){G&&G(t);var e=t.__c;e&&e.__H&&(e.__H.__h.length&&(1!==K.push(e)&&B===X.requestAnimationFrame||((B=X.requestAnimationFrame)||ct)(lt)),e.__H.__.forEach((function(t){t.i&&(t.__H=t.i),t.i=void 0}))),j=F=null},X.__c=function(t,e){e.some((function(t){try{t.__h.forEach(ut),t.__h=t.__h.filter((function(t){return!t.__||dt(t)}))}catch(n){e.some((function(t){t.__h&&(t.__h=[])})),e=[],X.__e(n,t.__v)}})),z&&z(t,e)},X.unmount=function(t){J&&J(t);var e,n=t.__c;n&&n.__H&&(n.__H.__.forEach((function(t){try{ut(t)}catch(t){e=t}})),n.__H=void 0,e&&X.__e(e,n.__v))};var rt="function"==typeof requestAnimationFrame;function ct(t){var e,n=function(){clearTimeout(i),rt&&cancelAnimationFrame(e),setTimeout(t)},i=setTimeout(n,100);rt&&(e=requestAnimationFrame(n))}function ut(t){var e=F,n=t.__c;"function"==typeof n&&(t.__c=void 0,n()),F=e}function dt(t){var e=F;t.__c=t.__(),F=e}function _t(t,e){return!t||t.length!==e.length||e.some((function(e,n){return e!==t[n]}))}function pt(t,e){return"function"==typeof e?e(t):e}const mt=function(t,e=!1){return MgUpcTexts&&MgUpcTexts[t]?e?e.reduce((function(t,e){return t.replace(/%s/,e)}),MgUpcTexts[t]):MgUpcTexts[t]:t},ft="ui/reset",gt="ui/error",ht="ui/editing",vt="ui/mode",yt="listOfLists/set",bt="listOfLists/remove",Pt="listOfLists/create",wt="listOfList/addingPost",Nt="listOfList/setPage",kt="listOfList/setTotalPages",Ct="list/set",xt="list/update",It="list/setPage",St="list/setTotalPages",Tt="list/setItems",Et="list/removeItem",At="list/addItem",Dt="list/updateItem",Lt="list/moveItem",Ot="list/moveItemNext",Ut="list/moveItemPrev",Rt="list/cart",Wt=async function(t,e="",n={},i="mg-upc/v1/lists"){if(void 0===Bt().nonce){const t=new FormData;t.append("action","mg_upc_user");const e={method:"POST",credentials:"same-origin",referrerPolicy:"no-referrer",body:t},n=await fetch(Bt().ajaxUrl,e),i=await n.json();i.nonce&&(Bt().nonce=i.nonce),i.user_id&&(Bt().user_id=i.user_id)}const s={method:t,credentials:"same-origin",headers:{"Content-Type":"application/json","X-WP-Nonce":Bt().nonce},referrerPolicy:"no-referrer"};"GET"!==t&&n&&(s.body=JSON.stringify(n));const o=await fetch(Bt().root+i+e,s);return o.headers.get("x-wp-nonce")&&(Bt().nonce=o.headers.get("x-wp-nonce")),{data:await o.json(),headers:o.headers,status:o.status}};function Ht(t){const e=Object.entries(t).filter((([,t])=>null!=t)).map((([t,e])=>`${encodeURIComponent(t)}=${encodeURIComponent(String(e))}`)),n=-1!==Bt().root.indexOf("?")?"&":"?";return e.length>0?`${n}${e.join("&")}`:""}class $t extends Error{constructor(t,e){super(t),this.name="MgApiError",this.code=e?.data?.code,this.response=e}}function Mt(t){let e=t?.data?.data?.status;if(!e&&t.status&&(e=t.status),400===e||401===e||403===e||404===e||409===e||500===e)throw new $t(t?.data?.message,t)}let Ft={my:function(t={}){return Wt("GET","/My"+Ht(t),{}).then((function(t){return Mt(t),t}))},discover:function(t){return Wt("GET","/"+Ht(t),{}).then((function(t){return Mt(t),t}))},get:function(t){return Wt("GET","/"+t,{}).then((function(t){return Mt(t),t}))},cart:function(t){return Wt("POST","/cart",{list:t},"mg-upc/v1").then((function(t){return Mt(t),t}))},items:function(t,e={}){return Wt("GET","/"+t+"/items"+Ht(e),{}).then((function(t){return Mt(t),t}))},delete:function(t){return Wt("DELETE","/"+t,{}).then((function(t){return Mt(t),t}))},create:function(t){return Wt("POST","",t).then((function(t){return Mt(t),t}))},update:function(t){let e=t.id;return delete t.id,Wt("PATCH","/"+e,t).then((function(t){return Mt(t),t}))},add:function(t,e,n={}){return"object"!=typeof e&&(e={post_id:e}),Wt("POST","/"+t+"/items"+Ht(n),e).then((function(t){return Mt(t),t}))},quit:function(t,e,n={}){return Wt("DELETE","/"+t+"/items/"+e+Ht(n),{}).then((function(t){return Mt(t),t}))},updateItem:function(t,e,n){return Wt("PATCH","/"+t+"/items/"+e,n).then((function(t){return Mt(t),t}))},vote:function(t,e,n={}){return Wt("POST","/"+t+"/items/"+e+"/vote",n).then((function(t){return Mt(t),t}))},move:function(t,e,n){return Wt("PATCH","/"+t+"/items/"+e,{position:n}).then((function(t){return Mt(t),t}))}};const jt=Ft;function Bt(){return MgUserPostCollections}function qt(){return Bt()?.sortable}function Kt(t){const e=Bt()?.types;return!(!e||!e[t])&&e[t]}function Xt(){return Object.values(Bt()?.statuses)}function Vt(t){const e=Bt()?.statuses;return!(!e||!e[t])&&e[t]}function Qt(t,e){return!!t.type&&zt(t.type,e)}function Gt(t){const e=[],n=Bt()?.types;for(const i in n)n.hasOwnProperty(i)&&(zt(i,"always_exists")||(t?.type?n[i].available_post_types.includes(t.type)&&e.push(n[i]):e.push(n[i])));return e}function zt(t,e){const n=Kt(t);return!(!n||!n.supports)&&n.supports.includes(e)}const Jt="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVQYV2NgYAAAAAMAAWgmWQ0AAAAASUVORK5CYII=";function Yt(t){return JSON.parse(JSON.stringify(t))}function Zt(t){return t.stopImmediatePropagation&&t.stopImmediatePropagation(),t.stopPropagation&&t.stopPropagation(),t.preventDefault(),!1}function te(t,e){const{type:n,payload:i}=e;let s=!1;const o=t=>(s=a({status:"failed"}),t.error&&(s.error=t.error.message?t.error.message:"",s.errorCode=t.error.code?t.error.code:""),s),a=(e=null)=>{if(s||(s=Yt(t)),e)for(const t in e)e.hasOwnProperty(t)&&(s[t]=e[t]);return s},l=(t,e=0,n="succeeded")=>(0!==e&&(t.loadingCount=t.loadingCount+e),t.loadingCount<1?(t.loadingCount=0,t.status=n):t.status="loading",t);let r=function(t,e){const{type:n,payload:i}=e;let s,o;const a=(e=!1)=>{if(o||(o=!1===t?{}:Yt(t)),e)for(const t in e)o[t]=e[t];return o};switch(n){case Ct:return!0===i?{ID:-1,title:"",content:"",status:"",type:""}:i;case xt:return i.items=Yt(t.items),i;case Pt:return i;case Tt:return a({items:i});case At+"/failed":case At:return i?.list?a(i.list):t;case Dt:const e=!!i.item&&i.item;return s=a().items.map((t=>t.post_id===i.post_id?e||Object.assign({},t,i):{...t})),a({items:s});case Et:if(!t.items||1===t.items.length||!1===i)return t;if(o=a(),s=o.items.filter((t=>t.post_id!==i)),zt(t.type,"sortable")){const e=parseInt(t.items[0].position,10);s.forEach(((t,n)=>{s[n].position=e+n}))}if(o.count=o.count-1,zt(t.type,"vote")){const e=t.items.find((t=>t.post_id==i));e&&(o.vote_counter=o.vote_counter-e.votes)}return{...o,items:s};case Lt:const n=parseInt(t.items[0].position,10);s=a().items.slice();const l=a().items[i.oldIndex];return s.splice(i.oldIndex,1),s.splice(i.newIndex,0,l),isNaN(n)?(alert("positions error!"),t):(s.forEach(((t,e)=>{s[e].position=n+e})),a({items:s}));default:return t}}(t.list,e),c=function(t,e){const{type:n,payload:i}=e;switch(n){case yt:return i;case At:case Ct:return!1;case bt:return!1===i?t:Yt(t.filter((t=>t.ID!=i)));default:return t}}(t.listOfList,e);switch(t.list===r&&c===t.listOfList||(s=a({listOfList:c,list:r}),t.addingPost||(s.title=s.list?s.list.title:se.title)),n){case vt:return a({mode:i});case ft:return{...se,mode:t.mode};case gt:return a(!1===i?{error:!1,errorCode:!1}:{error:i});case"ui/message":return a(!1===i?{message:!1,errorCode:!1}:{message:i});case Rt:const n=a();return i.msg&&(n.message=i.msg),i.err&&(n.error=i.err),n;case ht:return a({editing:i});case wt:return s=a(),s.addingPost=i,i&&(s.title=mt("Add to...")),s;case Pt:s=a(),s.title=i.title?i.title:se.title,s.listTotalPages=1,s.listPage=1,s.addingPost=!1;break;case At:if(s=a(),i?.list){const t=i.list;s.title=t.title?t.title:se.title;const e=t?.items_page;e&&(s.listTotalPages=e["X-WP-TotalPages"]?e["X-WP-TotalPages"]:1,s.listPage=e["X-WP-Page"]?e["X-WP-Page"]:1)}i.message&&(s=l(s,-1,"failed"),s.error=i.message),s.addingPost=!1;break;case Nt:return a({page:i});case kt:return a({totalPages:i});case It:return a({listPage:i});case St:return a({listTotalPages:i});case Ct+"/loading":return s=l(a(),1),s.listOfList=!1,"object"==typeof i?(s.list=i,i.title&&(s.title=i.title)):s.list={ID:i},s;case Et+"/loading":return s=l(a(),1),"object"==typeof i&&i.list_id&&(s.list={ID:i.list_id}),s;case yt+"/loading":case Tt+"/loading":case Dt+"/loading":case At+"/loading":case Ot+"/loading":case Ut+"/loading":case xt+"/loading":case Pt+"/loading":case Rt+"/loading":return l(a(),1);case At+"/succeeded":return s=l(a(),-1),s.addingPost=!1,s.status="succeeded",s.error=!1,s.errorCode=!1,s.title=s.list?s.list.title:se.title,s;case Rt+"/succeeded":return l(a({errorCode:!1}),-1);case Ct+"/succeeded":var u={error:!1,errorCode:!1};return!1===t.list&&(u={}),l(a(u),-1);case yt+"/succeeded":case Tt+"/succeeded":case Dt+"/succeeded":case Et+"/succeeded":case Lt+"/succeeded":case Ot+"/succeeded":case Ut+"/succeeded":case xt+"/succeeded":case Pt+"/succeeded":return l(a({error:!1,errorCode:!1}),-1);case Pt+"/failed":return s=l(a(),-1,"failed"),e.error&&e.error.message&&(s.error=e.error.message),s;case At+"/failed":if(s=l(a(),-1),s.addingPost=!1,s.title=s.list?s.list.title:se.title,i?.list){const t=i.list;s.title=t.title?t.title:se.title;const e=t?.items_page;e&&(s.listTotalPages=e["X-WP-TotalPages"]?e["X-WP-TotalPages"]:1,s.listPage=e["X-WP-Page"]?e["X-WP-Page"]:1)}return i.message&&(s.error=i.message,s.status="failed"),o(e);case yt+"/failed":case Tt+"/failed":case Dt+"/failed":case Et+"/failed":case Lt+"/failed":case Ot+"/failed":case Ut+"/failed":case xt+"/failed":case Ct+"/failed":case Rt+"/failed":return l(o(e),-1)}return!1!==s?s:t}const ee=(t,e)=>function(n=null,...i){return{asyncThunk:!0,payload:e,type:t,arg:n,extra:i}};class ne extends Error{constructor(t,e){super(t),this.name="MgUpcRejectWithValue",this.value=e}}const ie=(t,e)=>n=>{let i;if((s=n)&&"object"==typeof s&&!0===s.asyncThunk){let s={dispatch:ie(t,e),getState:e,extra:n.extra,rejectWithValue:t=>new ne(n.type+": rejectWithValue",t)};t({type:n.type+"/loading",payload:n.arg}),i=n.payload(n.arg,s)}else{if(!(t=>!!t&&("object"==typeof t||"function"==typeof t)&&"function"==typeof t.then)(n.payload))return void t(n);t({type:n.type+"/loading"}),i=n.payload}var s;i.then((e=>{e instanceof ne?t({type:n.type+"/failed",payload:e.value}):(t({type:n.type,payload:e}),t({type:n.type+"/succeeded"}))})).catch((e=>{t(e instanceof ne?{type:n.type+"/failed",payload:e.value}:{type:n.type+"/failed",error:e})}))},se={list:!1,listOfList:!1,addingPost:null,status:"idle",loadingCount:0,error:null,message:null,errorCode:null,editing:!1,title:mt("My Lists"),actualAction:"init",page:1,totalPages:1,listPage:1,listTotalPages:1,mode:"my"},oe=function(t,e){var n={__c:e="__cC"+u++,__:t,Consumer:function(t,e){return t.children(e)},Provider:function(t){var n,i;return this.getChildContext||(n=new Set,(i={})[e]=this,this.getChildContext=function(){return i},this.componentWillUnmount=function(){n=null},this.shouldComponentUpdate=function(t){this.props.value!==t.value&&n.forEach((function(t){t.__e=!0,N(t)}))},this.sub=function(t){n.add(t);var e=t.componentWillUnmount;t.componentWillUnmount=function(){n&&n.delete(t),e&&e.call(t)}}),t.children}};return n.Provider.__=n.Consumer.contextType=n}({});function ae(t){return new Date(t).toLocaleDateString()}const le=function(t){const{state:e,dispatch:n}=at(oe);return h("li",{className:"mg-upc-dg-item-list",onClick:t.onClick,onKeyPress:e=>{13===e.keyCode&&t.onClick(e)},tabIndex:"0"},h("i",{className:"mg-upc-icon mg-upc-dg-item-type mg-upc-dg-item-type-"+t.list.type}),h("div",{className:"mg-upc-dg-item-title"},h("span",null,t.list.title),"my"!==e.mode&&h(y,null,h("span",null,h("a",{href:"#",onClick:function(e){Zt(e),function(t,e){const n=new URLSearchParams(document.location.hash.substring(1));n.set("author",e);let i=n.toString();""!==i&&(i="#"+i),window.location.hash=i}(0,t.list.author)}},t.list.user_login),h("span",{className:"mg-upc-list-dates"},h("i",null," ",h("b",null,"Created:")," ",ae(t.list.created)),h("i",null," ",h("b",null,"Modified:")," ",ae(t.list.modified)))))),h("span",{className:"mg-upc-dg-item-count"},t.list.count),h("span",{className:"mg-upc-dg-item-actions"},t.onRemove&&h("button",{"aria-label":mt("Remove List"),onClick:e=>{e.stopPropagation(),t.onRemove(t.list)}},h("span",{className:"mg-upc-icon upc-font-trash"}))))};class re extends b{static defaultProps={count:1,duration:1.2,width:null,wrapper:null,height:null,circle:!1};render(){const t=[];for(let e=0;e<this.props.count;e++){let n=this.props.styles?this.props.styles:{};null!=this.props.width&&(n.width=this.props.width),null!=this.props.height&&(n.height=this.props.height),null!==this.props.width&&null!==this.props.height&&this.props.circle&&(n.borderRadius="50%"),t.push(h("span",{key:e,className:"mg-upc-dg-loading-skeleton",style:n},""))}const e=this.props.wrapper;return h("span",null,e?t.map(((t,n)=>h(e,{key:n},t,""))):t)}}const ce=function(t){return h("div",{className:"mg-upc-dg-pagination-div"},h("button",{className:1===t.page?"mg-upc-dg-hidden mg-upc-dg-pagination":"mg-upc-dg-pagination",ref:t.prevRef,disabled:1===t.page,"aria-label":mt("Previous page"),title:mt("Previous page"),onClick:t.onPreview},h("span",{className:"mg-upc-icon upc-font-arrow_left"})),h("span",{className:t.totalPages>1?"mg-upc-dg-pagination-current":"mg-upc-dg-hidden mg-upc-dg-pagination-current"},t.page),h("button",{className:t.page>=t.totalPages?"mg-upc-dg-hidden mg-upc-dg-pagination":"mg-upc-dg-pagination",ref:t.nextRef,disabled:t.page>=t.totalPages,"aria-label":mt("Next page"),title:mt("Next page"),onClick:t.onNext},h("span",{className:"mg-upc-icon upc-font-arrow_right"})))},ue=()=>({type:ft,payload:null}),de=t=>({type:wt,payload:t}),_e=t=>({type:ht,payload:t}),pe=ee(Rt,(async function(t,e){return await function(t){return jt.cart(t).then((t=>(jQuery&&t.data.fragments&&t.data.cart_hash&&jQuery(document.body).trigger("added_to_cart",[t.data.fragments,t.data.cart_hash]),t.data)))}(t)})),me=ee(yt,(async function(t,e){const n=t?.addingPost;return null===t&&(t={}),t.addingPost?t.adding=t.addingPost:(t.adding="",delete t.adding),await jt.my(t).then((t=>ge(t,e,n)))})),fe=ee(yt,(async function(t,e){return null===t&&(t={}),await jt.discover(t).then((t=>ge(t,e,!1)))}));function ge(t,e,n){if(t.headers.get("x-wp-page")&&(e.dispatch(ve(parseInt(t.headers.get("x-wp-page"),10))),e.dispatch(ye(parseInt(t.headers.get("X-WP-TotalPages"),10)))),n&&t.headers.get("X-WP-Post-Type")){const i={post_id:n},s={"X-WP-Post-Type":"type","X-WP-Post-Title":"title","X-WP-Post-Image":"image"};for(const e in s){const n=t.headers.get(e);n&&(i[s[e]]=decodeURIComponent(n))}e.dispatch(de(i))}return t.data}const he=ee(bt,(async function(t,e){return await jt.delete(t).then((n=>{if(1===e.getState().listOfList.length){const n=e.getState().page,i=e.getState().totalPages;if(n<i)e.dispatch(me({page:n}));else{if(!(n>1&&n===i))return t;e.dispatch(me({page:n-1}))}return!1}return t}))})),ve=t=>({type:Nt,payload:t}),ye=t=>({type:kt,payload:t}),be=t=>({type:It,payload:t}),Pe=t=>({type:St,payload:t}),we=ee(Ct,(async function(t,e){return!1===t||!0===t?t:await jt.get("object"==typeof t?t.ID:t).then((t=>(De(t,e.dispatch),t.data)))})),Ne=ee(xt,(async function(t,e){return await jt.update(t).then((t=>(e.dispatch(_e(!1)),De(t,e.dispatch),t.data)))})),ke=ee(Pt,(async function(t,e){return null===t&&(t={}),t.adding&&t.adding!==e.getState().addingPost&&e.dispatch(de({id:t.addingPost})),await jt.create(t).then((t=>(e.dispatch(_e(!1)),De(t,e.dispatch),t.data)))})),Ce=ee(Tt,(async function(t,e){return await jt.items(e.getState().list.ID,t).then((t=>(De(t,e.dispatch),t.data)))})),xe=ee(Et,(async function(t,e){const n=e.getState();var i=e.extra.length>0?e.extra[0]:n.list.ID;const s=e.extra.length>1?e.extra[1]:"view";return await jt.quit(i,t,{context:s}).then((o=>{if(o.data&&o.data.list_id&&(i=o.data.list_id),n.list&&n.list.ID)if(1===n.list.items.length){if(n.list&&"view"===s){const t=n.listPage,i=n.listTotalPages;return t<i?e.dispatch(Ce({page:t})):t===i&&e.dispatch(Ce({page:Math.max(1,t-1)})),!1}}else n.list&&"view"===s&&n.listTotalPages===n.listPage+1&&n.list.count%n.list.items.length==1&&e.dispatch(Ce({page:n.listPage}));else e.dispatch(we({ID:i}));return t}))})),Ie=ee(At,(async function(t,e){let n=e.extra[0],i=!1;try{await jt.add(t,n,{context:e.extra.length>1?e.extra[1]:"view"}).then((t=>{i=t.data}))}catch(t){const n=t?.response?.data;i=e.rejectWithValue(n)}return i})),Se=ee(Dt,(async function(t,e){const n=e.extra[0];return await jt.updateItem(e.getState().list.ID,t,n).then((e=>({...n,post_id:t,item:e?.data?.item})))})),Te=ee(Lt,(async function(t,e){const n=e.extra[0],i=e.extra[1],s=n.items[t],o=s.position-t+i;return await jt.move(n.ID,s.post_id,o).then((e=>({oldIndex:t,newIndex:i})))})),Ee=ee(Ot,(async function(t,e){const n=e.getState().list,i=parseInt(n.items[n.items.length-1].position,10);if(isNaN(i))throw alert("positions error!"),"positions error!";const s=n.items[t];return await jt.move(n.ID,s.post_id,i+1),await e.dispatch(Ce({page:e.getState().listPage})),t})),Ae=ee(Ut,(async function(t,e){const n=e.getState().list,i=parseInt(n.items[0].position,10);if(isNaN(i))throw alert("positions error!"),"positions error!";const s=n.items[t];return await jt.move(n.ID,s.post_id,i-1),await e.dispatch(Ce({page:e.getState().listPage})),t}));function De(t,e){!t.data.items_page&&t.headers.get("x-wp-page")?(e(be(parseInt(t.headers.get("x-wp-page"),10))),e(Pe(parseInt(t.headers.get("X-WP-TotalPages"),10)))):t.data.items_page&&(e(be(parseInt(t.data.items_page["X-WP-Page"],10))),e(Pe(parseInt(t.data.items_page["X-WP-TotalPages"],10))))}const Le=function(t){const{state:e,dispatch:n}=at(oe);return h(y,null,h("ul",{className:"mg-upc-dg-list-of-lists-fake mg-upc-dg-on-loading"},[0,1,2].map((t=>h("li",{className:"mg-upc-dg-item-list"},h("div",null,h(re,{width:"1.5em",height:"1.5em"})),h("div",{className:"mg-upc-dg-item-title"},h(re,null)),h("div",{className:"mg-upc-dg-item-count"},h(re,null)))))),h("ul",{className:"mg-upc-dg-list-of-lists"},t.lists&&t.lists.map((e=>h(le,{list:e,onClick:()=>t.onSelect(e),onRemove:t.onRemove,key:e.ID})))),e.totalPages>1&&h(ce,{totalPages:e.totalPages,page:e.page,onPreview:t.loadPreview,onNext:t.loadNext}))},Oe=function(t){const[e,n]=tt(!1),[i,s]=tt(""),o=it({});nt((()=>{s(t.item.description)}),[t.item]),nt((()=>{e&&o.current.focus()}),[e]);const a=()=>"string"==typeof i&&i.length>0;return h(y,null,h("span",null,h("br",null),"Adding item:"),h("div",{className:"mg-upc-dg-item mg-upc-dg-item-adding","data-post_id":t.item.post_id},h("span",{className:"mg-upc-icon upc-font-add"}),h("span",null," "),h("img",{className:"mg-upc-dg-item-image",src:t.item.image?t.item.image:Jt}),h("div",{className:"mg-upc-dg-item-data"},h("a",{href:t.item?.link},t.item?.title),!e&&h("p",null,t.item?.description),!e&&h("button",{onClick:()=>{n(!0)}},a()&&h("span",null,mt("Edit Comment")),!a()&&h("span",null,mt("Add Comment"))),h("input",{ref:o,className:e?"mg-upc-dg-btn-item-desc":"mg-upc-dg-dn",type:"text",value:i,onChange:function(t){s(t.target.value)},onKeyDown:e=>{"Enter"===e.key&&(n(!1),t.onSaveItemDescription(i))},maxLength:400}),e&&h("button",{className:"mg-upc-dg-btn-item-desc-cancel",onClick:()=>{n(!1),s(t.item.description)}},h("span",{className:"mg-upc-icon upc-font-close"}),h("span",null,mt("Cancel"))),e&&h("button",{className:"mg-upc-dg-btn-item-desc-save",onClick:()=>{n(!1),t.onSaveItemDescription(i)}},h("span",{className:"mg-upc-icon upc-font-save"}),h("span",null,mt("Save"))))),h("span",null,mt("Select where the item will be added:")))};function Ue(){return Ue=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)({}).hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},Ue.apply(null,arguments)}function Re(t,e){for(var n in t)if("__source"!==n&&!(n in e))return!0;for(var i in e)if("__source"!==i&&t[i]!==e[i])return!0;return!1}function We(t,e){this.props=t,this.context=e}(We.prototype=new b).isPureReactComponent=!0,We.prototype.shouldComponentUpdate=function(t,e){return Re(this.props,t)||Re(this.state,e)};var He=e.__b;e.__b=function(t){t.type&&t.type.__f&&t.ref&&(t.props.ref=t.ref,t.ref=null),He&&He(t)},"undefined"!=typeof Symbol&&Symbol.for&&Symbol.for("react.forward_ref");var $e=e.__e;e.__e=function(t,e,n,i){if(t.then)for(var s,o=e;o=o.__;)if((s=o.__c)&&s.__c)return null==e.__e&&(e.__e=n.__e,e.__k=n.__k),s.__c(t,e);$e(t,e,n,i)};var Me=e.unmount;function Fe(t,e,n){return t&&(t.__c&&t.__c.__H&&(t.__c.__H.__.forEach((function(t){"function"==typeof t.__c&&t.__c()})),t.__c.__H=null),null!=(t=function(t,e){for(var n in e)t[n]=e[n];return t}({},t)).__c&&(t.__c.__P===n&&(t.__c.__P=e),t.__c=null),t.__k=t.__k&&t.__k.map((function(t){return Fe(t,e,n)}))),t}function je(t,e,n){return t&&n&&(t.__v=null,t.__k=t.__k&&t.__k.map((function(t){return je(t,e,n)})),t.__c&&t.__c.__P===e&&(t.__e&&n.appendChild(t.__e),t.__c.__e=!0,t.__c.__P=n)),t}function Be(){this.__u=0,this.t=null,this.__b=null}function qe(t){var e=t.__.__c;return e&&e.__a&&e.__a(t)}function Ke(){this.u=null,this.o=null}e.unmount=function(t){var e=t.__c;e&&e.__R&&e.__R(),e&&32&t.__u&&(t.type=null),Me&&Me(t)},(Be.prototype=new b).__c=function(t,e){var n=e.__c,i=this;null==i.t&&(i.t=[]),i.t.push(n);var s=qe(i.__v),o=!1,a=function(){o||(o=!0,n.__R=null,s?s(l):l())};n.__R=a;var l=function(){if(! --i.__u){if(i.state.__a){var t=i.state.__a;i.__v.__k[0]=je(t,t.__c.__P,t.__c.__O)}var e;for(i.setState({__a:i.__b=null});e=i.t.pop();)e.forceUpdate()}};i.__u++||32&e.__u||i.setState({__a:i.__b=i.__v.__k[0]}),t.then(a,a)},Be.prototype.componentWillUnmount=function(){this.t=[]},Be.prototype.render=function(t,e){if(this.__b){if(this.__v.__k){var n=document.createElement("div"),i=this.__v.__k[0].__c;this.__v.__k[0]=Fe(this.__b,n,i.__O=i.__P)}this.__b=null}var s=e.__a&&h(y,null,t.fallback);return s&&(s.__u&=-33),[h(y,null,e.__a?null:t.children),s]};var Xe=function(t,e,n){if(++n[1]===n[0]&&t.o.delete(e),t.props.revealOrder&&("t"!==t.props.revealOrder[0]||!t.o.size))for(n=t.u;n;){for(;n.length>3;)n.pop()();if(n[1]<n[0])break;t.u=n=n[2]}};function Ve(t){return this.getChildContext=function(){return t.context},t.children}function Qe(t){var e=this,n=t.i;e.componentWillUnmount=function(){$(null,e.l),e.l=null,e.i=null},e.i&&e.i!==n&&e.componentWillUnmount(),e.l||(e.i=n,e.l={nodeType:1,parentNode:n,childNodes:[],contains:function(){return!0},appendChild:function(t){this.childNodes.push(t),e.i.appendChild(t)},insertBefore:function(t,n){this.childNodes.push(t),e.i.appendChild(t)},removeChild:function(t){this.childNodes.splice(this.childNodes.indexOf(t)>>>1,1),e.i.removeChild(t)}}),$(h(Ve,{context:e.context},t.__v),e.l)}(Ke.prototype=new b).__a=function(t){var e=this,n=qe(e.__v),i=e.o.get(t);return i[0]++,function(s){var o=function(){e.props.revealOrder?(i.push(s),Xe(e,t,i)):s()};n?n(o):o()}},Ke.prototype.render=function(t){this.u=null,this.o=new Map;var e=S(t.children);t.revealOrder&&"b"===t.revealOrder[0]&&e.reverse();for(var n=e.length;n--;)this.o.set(e[n],this.u=[1,0,this.u]);return t.children},Ke.prototype.componentDidUpdate=Ke.prototype.componentDidMount=function(){var t=this;this.o.forEach((function(e,n){Xe(t,n,e)}))};var Ge="undefined"!=typeof Symbol&&Symbol.for&&Symbol.for("react.element")||60103,ze=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image(!S)|letter|lighting|marker(?!H|W|U)|overline|paint|pointer|shape|stop|strikethrough|stroke|text(?!L)|transform|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/,Je=/^on(Ani|Tra|Tou|BeforeInp|Compo)/,Ye=/[A-Z0-9]/g,Ze="undefined"!=typeof document,tn=function(t){return("undefined"!=typeof Symbol&&"symbol"==typeof Symbol()?/fil|che|rad/:/fil|che|ra/).test(t)};b.prototype.isReactComponent={},["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach((function(t){Object.defineProperty(b.prototype,t,{configurable:!0,get:function(){return this["UNSAFE_"+t]},set:function(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:e})}})}));var en=e.event;function nn(){}function sn(){return this.cancelBubble}function on(){return this.defaultPrevented}e.event=function(t){return en&&(t=en(t)),t.persist=nn,t.isPropagationStopped=sn,t.isDefaultPrevented=on,t.nativeEvent=t};var an={enumerable:!1,configurable:!0,get:function(){return this.class}},ln=e.vnode;e.vnode=function(t){"string"==typeof t.type&&function(t){var e=t.props,n=t.type,i={},s=-1===n.indexOf("-");for(var o in e){var a=e[o];if(!("value"===o&&"defaultValue"in e&&null==a||Ze&&"children"===o&&"noscript"===n||"class"===o||"className"===o)){var l=o.toLowerCase();"defaultValue"===o&&"value"in e&&null==e.value?o="value":"download"===o&&!0===a?a="":"translate"===l&&"no"===a?a=!1:"o"===l[0]&&"n"===l[1]?"ondoubleclick"===l?o="ondblclick":"onchange"!==l||"input"!==n&&"textarea"!==n||tn(e.type)?"onfocus"===l?o="onfocusin":"onblur"===l?o="onfocusout":Je.test(o)&&(o=l):l=o="oninput":s&&ze.test(o)?o=o.replace(Ye,"-$&").toLowerCase():null===a&&(a=void 0),"oninput"===l&&i[o=l]&&(o="oninputCapture"),i[o]=a}}"select"==n&&i.multiple&&Array.isArray(i.value)&&(i.value=S(e.children).forEach((function(t){t.props.selected=-1!=i.value.indexOf(t.props.value)}))),"select"==n&&null!=i.defaultValue&&(i.value=S(e.children).forEach((function(t){t.props.selected=i.multiple?-1!=i.defaultValue.indexOf(t.props.value):i.defaultValue==t.props.value}))),e.class&&!e.className?(i.class=e.class,Object.defineProperty(i,"className",an)):(e.className&&!e.class||e.class&&e.className)&&(i.class=i.className=e.className),t.props=i}(t),t.$$typeof=Ge,ln&&ln(t)};var rn=e.__r;e.__r=function(t){rn&&rn(t),t.__c};var cn=e.diffed;e.diffed=function(t){cn&&cn(t);var e=t.props,n=t.__e;null!=n&&"textarea"===t.type&&"value"in e&&e.value!==n.value&&(n.value=null==e.value?"":e.value)};var un=['a[href]:not([tabindex^="-"])','area[href]:not([tabindex^="-"])','input:not([type="hidden"]):not([type="radio"]):not([disabled]):not([tabindex^="-"])','input[type="radio"]:not([disabled]):not([tabindex^="-"])','select:not([disabled]):not([tabindex^="-"])','textarea:not([disabled]):not([tabindex^="-"])','button:not([disabled]):not([tabindex^="-"])','iframe:not([tabindex^="-"])','audio[controls]:not([tabindex^="-"])','video[controls]:not([tabindex^="-"])','[contenteditable]:not([tabindex^="-"])','[tabindex]:not([tabindex^="-"])'];function dn(t){this._show=this.show.bind(this),this._hide=this.hide.bind(this),this._maintainFocus=this._maintainFocus.bind(this),this._bindKeypress=this._bindKeypress.bind(this),this.$el=t,this.shown=!1,this._id=this.$el.getAttribute("data-a11y-dialog")||this.$el.id,this._previouslyFocused=null,this._listeners={},this.create()}function _n(t,e){return n=(e||document).querySelectorAll(t),Array.prototype.slice.call(n);var n}function pn(t){(t.querySelector("[autofocus]")||t).focus()}function mn(){_n("[data-a11y-dialog]").forEach((function(t){new dn(t)}))}dn.prototype.create=function(){this.$el.setAttribute("aria-hidden",!0),this.$el.setAttribute("aria-modal",!0),this.$el.setAttribute("tabindex",-1),this.$el.hasAttribute("role")||this.$el.setAttribute("role","dialog"),this._openers=_n('[data-a11y-dialog-show="'+this._id+'"]'),this._openers.forEach(function(t){t.addEventListener("click",this._show)}.bind(this));const t=this.$el;return this._closers=_n("[data-a11y-dialog-hide]",this.$el).filter((function(e){return e.closest('[aria-modal="true"], [data-a11y-dialog]')===t})).concat(_n('[data-a11y-dialog-hide="'+this._id+'"]')),this._closers.forEach(function(t){t.addEventListener("click",this._hide)}.bind(this)),this._fire("create"),this},dn.prototype.show=function(t){if(this.shown)return this;this._previouslyFocused=document.activeElement;const e=t&&t.target?t.target:null;return e&&Object.is(this._previouslyFocused,document.body)&&(this._previouslyFocused=e),this.$el.removeAttribute("aria-hidden"),this.shown=!0,pn(this.$el),document.body.addEventListener("focus",this._maintainFocus,!0),document.addEventListener("keydown",this._bindKeypress),this._fire("show",t),this},dn.prototype.hide=function(t){return this.shown?(this.shown=!1,this.$el.setAttribute("aria-hidden","true"),this._previouslyFocused&&this._previouslyFocused.focus&&this._previouslyFocused.focus(),document.body.removeEventListener("focus",this._maintainFocus,!0),document.removeEventListener("keydown",this._bindKeypress),this._fire("hide",t),this):this},dn.prototype.destroy=function(){return this.hide(),this._openers.forEach(function(t){t.removeEventListener("click",this._show)}.bind(this)),this._closers.forEach(function(t){t.removeEventListener("click",this._hide)}.bind(this)),this._fire("destroy"),this._listeners={},this},dn.prototype.on=function(t,e){return void 0===this._listeners[t]&&(this._listeners[t]=[]),this._listeners[t].push(e),this},dn.prototype.off=function(t,e){var n=(this._listeners[t]||[]).indexOf(e);return n>-1&&this._listeners[t].splice(n,1),this},dn.prototype._fire=function(t,e){var n=this._listeners[t]||[],i=new CustomEvent(t,{detail:e});this.$el.dispatchEvent(i),n.forEach(function(t){t(this.$el,e)}.bind(this))},dn.prototype._bindKeypress=function(t){const e=document.activeElement;e&&e.closest('[aria-modal="true"]')!==this.$el||(this.shown&&"Escape"===t.key&&"alertdialog"!==this.$el.getAttribute("role")&&(t.preventDefault(),this.hide(t)),this.shown&&"Tab"===t.key&&function(t,e){var n=function(t){return _n(un.join(","),t).filter((function(t){return!!(t.offsetWidth||t.offsetHeight||t.getClientRects().length)}))}(t),i=n.indexOf(document.activeElement);e.shiftKey&&0===i?(n[n.length-1].focus(),e.preventDefault()):e.shiftKey||i!==n.length-1||(n[0].focus(),e.preventDefault())}(this.$el,t))},dn.prototype._maintainFocus=function(t){!this.shown||t.target.closest('[aria-modal="true"]')||t.target.closest("[data-a11y-dialog-ignore-focus-trap]")||pn(this.$el)},"undefined"!=typeof document&&("loading"===document.readyState?document.addEventListener("DOMContentLoaded",mn):window.requestAnimationFrame?window.requestAnimationFrame(mn):window.setTimeout(mn,16));(t=>{const e=(()=>{const[t,e]=tt(!1);return nt((()=>e(!0)),[]),t})(),[n,i]=(t=>{const[e,n]=(()=>{const[t,e]=tt(null);return[t,ot((t=>{null!==t&&e(new dn(t))}),[])]})(),i=ot((()=>e.hide()),[e]),s=t.role||"dialog",o="alertdialog"===s,a=t.titleId||t.id+"-title";return nt((()=>()=>{e&&e.destroy()}),[e]),[e,{container:{id:t.id,ref:n,role:s,tabIndex:-1,"aria-modal":!0,"aria-hidden":!0,"aria-labelledby":a},overlay:{onClick:o?void 0:i},dialog:{role:"document"},closeButton:{type:"button",onClick:i},title:{role:"heading","aria-level":1,id:a}}]})(t),{dialogRef:s}=t;if(nt((()=>(n&&s(n),()=>s(void 0))),[s,n]),!e)return null;const o=t.dialogRoot?document.querySelector(t.dialogRoot):document.body,a=h("h2",Ue({},i.title,{className:t.classNames.title,key:"title"}),t.onBack&&h("a",{"aria-label":t.backButtonLabel,href:"#",onClick:e=>{e.preventDefault(),t.onBack(e)}},"←")," ",t.title),l=h("button",Ue({},i.closeButton,{className:t.classNames.closeButton,"aria-label":t.closeButtonLabel,key:"button"}),t.closeButtonContent),r=["first"===t.closeButtonPosition&&l,a,t.children,"last"===t.closeButtonPosition&&l].filter(Boolean);return function(t,e){var n=h(Qe,{__v:t,i:e});return n.containerInfo=e,n}(h("div",Ue({},i.container,{className:t.classNames.container}),h("div",Ue({},i.overlay,{className:t.classNames.overlay})),h("div",Ue({},i.dialog,{className:t.classNames.dialog}),r)),o)}).defaultProps={role:"dialog",closeButtonLabel:"Close this dialog window",closeButtonContent:"×",closeButtonPosition:"first",classNames:{},backButtonLabel:"Back",dialogRef:()=>{}};const fn=function(t){const[e,n]=tt(""),[i,s]=tt(""),[o,a]=tt(""),[l,r]=tt(""),c=st((()=>Gt(t.addingPost)),[t.addingPost]);function u(t){t.default_title&&n(t.default_title),t.default_status&&r(t.default_status),a(t.name)}return""===o&&1===c.length&&u(c[0]),nt((()=>{n(t.list.title),s(t.list.content),a(t.list.type),r(t.list.status)}),[t.list.title,t.list.content,t.list.type,t.list.type]),nt((()=>{Kt(o)?.available_statuses&&-1===Kt(o).available_statuses.indexOf(l)&&r(Kt(o).available_statuses[0])}),[o]),h("div",{className:"mg-list-edit"},-1===t.list.ID&&""===o&&h(y,null,h("label",null,mt("Select a list type:")),h("ul",{id:`type-${t.list.ID}`},c.map(((t,e)=>h("li",{className:"mg-upc-dg-item-list-type",key:t.name,onClick:()=>u(t),onKeyPress:e=>{13===e.keyCode&&u(t)},tabIndex:"0"},h("i",{className:"mg-upc-icon mg-upc-dg-item-type mg-upc-dg-item-type-"+t.name}),h("div",{className:"mg-upc-dg-item-title"},h("strong",null,t.label),h("div",{className:"mg-upc-dg-item-desc"},t.description))))))),""!==o&&zt(o,"editable_title")&&h(y,null,h("label",{htmlFor:`title-${t.list.ID}`},mt("Title")),h("input",{id:`title-${t.list.ID}`,type:"text",value:e,onChange:function(t){n(t.target.value)},maxLength:100})),""!==o&&zt(o,"editable_content")&&h(y,null,h("label",{htmlFor:`content-${t.list.ID}`},mt("Description")),h("textarea",{id:`content-${t.list.ID}`,value:i,onChange:function(t){s(t.target.value)},maxLength:500}),h("span",{className:"mg-upc-dg-list-desc-edit-count"},h("i",null,i?.length),"/500")),""!==o&&!Kt(o)&&h("span",null,mt("Unknown List Type...")),""!==o&&Kt(o)?.available_statuses&&Kt(o).available_statuses.length>1&&h(y,null,h("label",{htmlFor:`status-${t.list.ID}`},mt("Status")),h("select",{id:`status-${t.list.ID}`,value:l,onChange:function(t){r(t.target.value)}},Kt(o).available_statuses.map(((t,e)=>{if(function(t){const e=Vt(t);return e&&e.show_in_status_list}(t))return h("option",{value:t},function(t){const e=Vt(t);return e?e.label:t}(t))})))),""!==o&&Kt(o)&&h("div",{className:"mg-upc-dg-edit-actions"},h("button",{onClick:()=>t.onSave({title:e,content:i,type:o,status:l})},h("span",{className:"mg-upc-icon upc-font-save"}),h("span",null,mt("Save"))),h("button",{onClick:()=>t.onCancel()},h("span",{className:"mg-upc-icon upc-font-close"}),h("span",null,mt("Cancel")))))},gn=function(t){const[e,n]=tt(!1),[i,s]=tt(""),[o,a]=tt(t.item?.quantity),l=it({});nt((()=>{s(t.item.description)}),[t.item]),nt((()=>{e&&l.current.focus()}),[e]);const r=it(!1);return nt((()=>{t.item.quantity!==o&&(clearTimeout(r.current),r.current=setTimeout((function(){t.onSaveItemQuantity(o)}),600))}),[o]),h("li",{className:"mg-upc-dg-item","data-post_id":t.item.post_id},Qt(t.list,"sortable")&&h(y,null,h("span",{className:"mg-upc-dg-item-handle","aria-draggable":!0},"::"),h("span",{className:"mg-upc-dg-item-number"},t.item.position)),Qt(t.list,"vote")&&h(y,null,h("span",{className:"mg-upc-dg-item-number"},(()=>{const e=parseInt(t.list.vote_counter,10);return Qt(t.list,"vote")&&e>0?Math.round(100*parseInt(t.item.votes,10)/e)+"%":"0%"})())),h("a",{href:t.item.link},h("img",{className:"mg-upc-dg-item-image",src:t.item.image?t.item.image:Jt})),h("div",{className:"mg-upc-dg-item-data"},h("a",{href:t.item.link},t.item.title),t.item.price_html&&h("span",{className:"mg-upc-dg-price",dangerouslySetInnerHTML:{__html:t.item.price_html}}),t.item.stock_html&&h("span",{className:"mg-upc-dg-stock",dangerouslySetInnerHTML:{__html:t.item.stock_html}}),t.editable&&!e&&h("p",null,t.item.description),t.editable&&!e&&Qt(t.list,"editable_item_description")&&h("button",{onClick:()=>{n(!0)}},h("span",{className:"mg-upc-icon upc-font-edit"}),""===i&&h("span",null,mt("Add Comment")),""!==i&&h("span",null,mt("Edit Comment"))),h("input",{ref:l,className:e?"mg-upc-dg-btn-item-desc":"mg-upc-dg-dn",type:"text",value:i,onChange:function(t){s(t.target.value)},onKeyDown:e=>{"Enter"===e.key&&(n(!1),t.onSaveItemDescription(i))},maxLength:400}),t.editable&&e&&h("button",{className:"mg-upc-dg-btn-item-desc-cancel",onClick:()=>{n(!1),s(t.item.description)}},h("span",{className:"mg-upc-icon upc-font-close"}),h("span",null,mt("Cancel"))),t.editable&&e&&h("button",{className:"mg-upc-dg-btn-item-desc-save",onClick:()=>{n(!1),t.onSaveItemDescription(i)}},h("span",{className:"mg-upc-icon upc-font-save"}),h("span",null,mt("Save")))),t.editable&&Qt(t.list,"quantity")&&h("div",{className:"mg-upc-dg-quantity"},h("small",null,mt("Quantity")),h("input",{"aria-label":mt("Quantity"),type:"number",value:o,onChange:function(){a(event.target.value)}})),t.editable&&!e&&h("div",null,h("button",{"aria-label":"Remove item",onClick:t.onRemove},h("span",{className:"mg-upc-icon upc-font-trash"}))))},hn=function(t){return new Promise((function(e,n){const i=document.createElement("script");let s=!1;i.type="text/javascript",i.src=t,i.async=!0,i.onerror=function(t){n(t,i)},i.onload=i.onreadystatechange=function(){s||this.readyState&&"complete"!=this.readyState||(s=!0,setTimeout((function(){e()}),100))},(document.head||document.body||document.documentElement).appendChild(i)}))},vn=function(t){const e=it(null),n=it((e=>{t.onMove(e)}));return nt((()=>{n.current=t.onMove})),nt((()=>{let i=!1;if(Qt(t.list,"sortable")){const t=()=>{i=Sortable.create(e.current,{handle:".mg-upc-dg-item-handle",group:"shared",animation:150,onUpdate:function(t){n.current(t)}})};"undefined"!=typeof Sortable?t():hn(qt()).then((()=>{t()}))}return()=>{i&&i.destroy()}})),h(y,null,h("ul",{className:"mg-upc-dg-list-fake mg-upc-dg-on-loading"},[0,1,2].map((e=>h("li",{className:"mg-upc-dg-item"},Qt(t.list,"sortable")&&h(y,null,h("span",{className:"mg-upc-dg-item-handle-skeleton"}," ",h(re,{width:"1.5em"})," "),h("span",{className:"mg-upc-dg-item-number-skeleton"}," ",h(re,{width:"1em"})," ")),Qt(t.list,"vote")&&h(y,null,h("span",{className:"mg-upc-dg-item-number-skeleton"}," ",h(re,{width:"1em"})," ")),h("div",{className:"mg-upc-dg-item-skeleton-image"},h(re,{width:"5em",height:"5em"})),h("div",{className:"mg-upc-dg-item-data"},h(re,{count:2})))))),h("ul",{ref:e,className:"mg-upc-dg-list"},0===t?.items?.length&&h("span",null,"There are no items in this list"),t?.items?.length>0&&t.items?.map&&t.items.map((e=>h(gn,{list:t.list,item:e,editable:t.editable,onRemove:()=>t.onRemove(t.list,e),onSaveItemDescription:n=>t.onSaveItemDescription(t.list,e,n),onSaveItemQuantity:n=>t.onSaveItemQuantity(t.list,e,n),key:e.ID+":"+e.post_id})))),Qt(t.list,"vote")&&h("span",{className:"mg-upc-dg-total-votes"}," ",mt("Total votes:")," ",h("span",null," ",t.list.vote_counter)))},yn=function(t){const e=it(null),n=it(null),i=mt("Copy"),[s,o]=tt(i);nt((()=>{let t=null;s!==i&&(t=setTimeout((()=>{o(i),clearTimeout(t)}),2e3))}),[s]);const a=encodeURIComponent(t.link),l=encodeURIComponent(t.title);let r=[{name:"Twitter",url:"https://twitter.com/share?url="+a+"&text="+l},{name:"Facebook",url:"https://www.facebook.com/sharer/sharer.php?u="+a+""e="+l},{name:"Pinterest",url:"https://pinterest.com/pin/create/button/?url="+a+"&description="+l},{name:"Whatsapp",url:"whatsapp://send?text="+a},{name:"Telegram",url:"https://t.me/share/url?url="+a+"&text="+l},{name:"LiNE",url:"https://social-plugins.line.me/lineit/share?url="+a+"&text="+l},{slug:"email",name:mt("Email"),url:"mailto:?subject="+l+"&body="+a}];return void 0!==Bt().shareButtons&&(r=r.filter((t=>Bt().shareButtons.includes(t.slug||t.name.toLowerCase())))),h("div",{className:"mg-upc-dg-share-link"},h("input",{ref:e,value:t.link,onClick:function(){e.current.setSelectionRange(0,e.current.value.length)},readOnly:!0}),h("button",{ref:n,onClick:function(t){var n;(n=e.current).focus(),n.setSelectionRange(0,n.value.length),document.execCommand&&document.execCommand("copy")?o(mt("Copied!")):o("Error!")}},h("span",{className:"mg-upc-icon upc-font-copy"}),h("span",null,s)),r.map((function(t){return(e=t).slug||(e.slug=e.name.toLowerCase()),h("a",{href:e.url,title:"Share with "+e.name,className:"mg-upc-dg-share",target:"_blank",rel:"noopener"},h("div",{className:"mg-upc-share-btn-img mg-upc-share-"+e.slug}," "));var e})))},bn=function(t){const{state:e,dispatch:n}=at(oe),[i,s]=tt(!1),o=it(!1),a=it(!1);function l(t){t<1||t>e.listTotalPages||"loading"===e.status||n(Ce({page:t}))}return nt((()=>{const t=e.list;let i=!1,s=!1;if(t&&Qt(t,"sortable")){const t=()=>{o.current&&e.listPage<e.listTotalPages&&(i=Sortable.create(o.current,{group:"shared",onAdd:t=>{n(Ee(t.oldIndex))}})),o.current&&e.listPage>1&&(s=Sortable.create(a.current,{group:"shared",onAdd:t=>{n(Ae(t.oldIndex))}}))};"undefined"!=typeof Sortable?t():hn(qt()).then((()=>{t()}))}return()=>{i&&i.destroy(),s&&s.destroy()}}),[e.list,e.listPage,e.listTotalPages]),nt((()=>{s(!1)}),[e.editing,e.list,e.addingPost]),h(y,null,e.editing&&h(fn,{list:e.list,addingPost:e.addingPost,onSave:function(t){if(-1===e.list.ID||t.title!==e.list.title||t.content!==e.list.content||t.status!==e.list.status)if(-1===e.list.ID){const i={};i.title=t.title,i.content=t.content,i.type=t.type,i.status=t.status,e.addingPost?.post_id&&(i.adding=e.addingPost.post_id,e.addingPost?.description&&(i.description=e.addingPost.description)),n(ke(i))}else{const i={id:e.list.ID};t.status!==e.list.status&&(i.status=t.status),t.title!==e.list.title&&(i.title=t.title),t.content!==e.list.content&&(i.content=t.content),n(Ne(i))}},onCancel:function(){n(_e(!1)),-1===e.list.ID&&(n(we(!1)),n(ue()),n(me()))}}),!e.editing&&h(y,null,h("div",{className:"mg-upc-dg-top-action"},function(t){const e=t.type;return zt(e,"editable_title")||zt(e,"editable_content")||Kt(e)?.available_statuses?.length>1}(e.list)&&h("button",{className:"mg-upg-edit",onClick:()=>n(_e(!0))},h("span",{className:"mg-upc-icon upc-font-edit"}),h("span",null,mt("Edit"))),e.list.link&&h("button",{className:"mg-upg-share",onClick:()=>s(!i)},h("span",{className:"mg-upc-icon upc-font-share"}),h("span",null,mt("Share"))),"cart"===e.list.type&&h("button",{className:"mg-upg-share",onClick:function(){n(pe(e.list.ID))}},h("span",{className:"mg-upc-icon upc-font-cart"}),h("span",null,mt("Add all to cart")))),i&&e.list.link&&h(yn,{link:e.list.link,title:e.list.title}),e.list.content&&h("p",{className:"mg-upc-dg-list-desc",dangerouslySetInnerHTML:{__html:(r=e.list.content,"string"!=typeof r?"":r.replace(/([^>\r\n]?)(\r\n|\n\r|\r|\n)/g,"$1<br>$2"))}}),h(re,{count:3}),h(vn,{list:e.list,items:e.list?.items||[],onMove:function(t){n(Te(t.oldIndex,e.list,t.newIndex))},onRemove:function(t,e){n(xe(e.post_id))},onSaveItemDescription:function(t,e,i){n(Se(e.post_id,{description:i}))},onSaveItemQuantity:function(t,e,i){n(Se(e.post_id,{quantity:i}))},editable:t.editable})),(!e.editing||!e.list)&&e.listTotalPages>1&&h(ce,{totalPages:e.listTotalPages,page:e.listPage,onPreview:function(){l(e.listPage-1)},onNext:function(){l(e.listPage+1)},prevRef:a,nextRef:o}));var r};document.getElementById("mg-upc-admin-app")&&($(h((t=>{const[e,n]=et(te,se);return h(oe.Provider,{value:{state:e,dispatch:ie(n,(()=>e))}},t.children)}),null,h((function(){const{state:t,dispatch:e}=at(oe),[n,i]=tt("any"),[s,o]=tt("any"),[a,l]=tt(""),[r,c]=tt(null),u=it(!1),d=st((()=>Gt(t.addingPost)),[t.addingPost]),_=st((()=>Object.values(Bt()?.types)),[]);let p="listOfList";p=t.addingPost?t.editing?"addingToNew":"adding":t.editing?-1!==t.list?.ID?"edit":"new":t.list?"list":"listOfList",nt((()=>{window.showMainLists=function(){e(ue()),m()},window.addItemToList=function(t,n=!1){e(ue()),n||b(t)}}),[e]);const m=()=>{const i={};n&&(i.types=n),s&&(i.status=s),r&&(i.search=r),a&&(i.author=a),t.page>1&&(i.page=t.page),e(fe(i))};function f(){t.page>1&&e(ve(1))}function g(t){f(),i(t)}function v(t){f(),o(t)}nt((()=>{se.title="",e({type:vt,payload:"admin"});const t=function(t){const n=parseInt(new URLSearchParams(document.location.hash.substring(1)).get("author"),10);n>0&&n!==a&&(t&&Zt(t),e(ve(1)),l(n),location.hash="")};return t(0),window.addEventListener("hashchange",t,!1),()=>{window.removeEventListener("hashchange",t)}}),[]),nt((()=>{t.list||m()}),[n,s,a,t.page]),nt((()=>{null!=r&&(clearTimeout(u.current),u.current=setTimeout((function(){m()}),300))}),[r]);const b=t=>{e(de({post_id:t})),e(me({addingPost:t}))};function P(n){n<1||n>t.totalPages||"loading"===t.status||e(ve(n))}const w=h("h2",{key:"title"},("list"===p||"new"===p||"edit"===p||"addingToNew"===p)&&h("a",{"aria-label":"Back",className:"mg-upc-dg-back",href:"#",onClick:n=>{n.preventDefault(),function(){switch(p){case"list":e(we(!1)),m();break;case"new":e(we(!1)),e(_e(!1)),m();break;case"edit":e(_e(!1));break;case"addingToNew":e(we(!1)),e(_e(!1)),e(me({addingPost:t.addingPost.post_id}));break;default:m()}}()}},"←")," ",t.title);return h(y,null,w,h("div",{className:"mg-upc-dg-content-wrapper mg-upc-dg-status-"+t.status+" mg-upc-dg-view-"+p},h("div",{className:"mg-upc-dg-wait"}),t.error&&h("div",{className:"mg-upc-dg-error"},t.error,h("a",{href:"#",className:"mg-upc-dg-alert-close","aria-label":"Hide alert",onClick:t=>{t.preventDefault(),e({type:gt,payload:null})}},h("span",{className:"mg-upc-icon upc-font-close"}))),h("div",{className:"mg-upc-dg-body"},!t.error&&t.addingPost&&h(Oe,{item:t.addingPost,onSaveItemDescription:function(n){e(de({...t.addingPost,description:n}))}}),("listOfList"===p||"adding"===p)&&h(y,null,h("div",{className:"mg-upc-dg-top-action"},d.length>0&&h("button",{className:"mg-list-new",onClick:function(t){e(_e(!0)),e(we(!0))}},h("span",{className:"mg-upc-icon upc-font-add"}),h("span",null,mt("Create List")))),h("ul",{className:"mg-upc-dg-filter"},h("li",{className:"mg-upc-dg-filter-label"},h("strong",null,mt("Types"))),h("li",{className:"any"==n?"mg-upc-dg-item-list-type mg-upc-selected":"mg-upc-dg-item-list-type",onClick:()=>g("any"),onKeyPress:t=>{13===t.keyCode&&g("any")},tabIndex:"0"},h("i",{className:"mg-upc-icon upc-font-close mg-upc-dg-item-type mg-upc-dg-item-type-none"}),h("div",{className:"mg-upc-dg-item-title"},h("strong",null,"All"))),_.map(((t,e)=>h("li",{className:t.name==n?"mg-upc-dg-item-list-type mg-upc-selected":"mg-upc-dg-item-list-type",key:t.name,onClick:()=>g(t.name),onKeyPress:e=>{13===e.keyCode&&g(t.name)},tabIndex:"0"},h("i",{className:"mg-upc-icon mg-upc-dg-item-type mg-upc-dg-item-type-"+t.name}),h("div",{className:"mg-upc-dg-item-title"},h("strong",null,t.label)))))),Xt()&&h("ul",{className:"mg-upc-dg-filter"},h("li",{className:"mg-upc-dg-filter-label"},h("strong",null,mt("Status"))),h("li",{className:"any"==s?"mg-upc-selected":"",onClick:()=>v("any"),onKeyPress:t=>{13===t.keyCode&&v("any")},tabIndex:"0"},h("div",{className:"mg-upc-dg-item-title"},h("strong",null,"All"))),Xt().map(((t,e)=>h("li",{className:t.name==s?"mg-upc-selected":"",key:t.name,onClick:()=>v(t.name),onKeyPress:e=>{13===e.keyCode&&v(t.name)},tabIndex:"0"},t.label)))),h("div",{className:"mg-upc-dg-df"},h("ul",{className:"mg-upc-dg-filter"},h("li",{className:"mg-upc-dg-filter-label"},h("strong",null,mt("Search"))),h("input",{onChange:function(t){f(),c(t.target.value)},value:r})),h("ul",{className:"mg-upc-dg-filter"},h("li",{className:"mg-upc-dg-filter-label"},h("strong",null,mt("Author (ID)"))),h("input",{type:"number",onChange:function(t){f(),l(t.target.value)},value:a}))),h(Le,{lists:t.listOfList,onSelect:function(n){e(_e(!1)),t.addingPost?e(Ie(n.ID,t.addingPost)):e(we(n))},onRemove:!t.addingPost&&function(t){e(he(t.ID))},loadPreview:function(){P(t.page-1)},loadNext:function(){P(t.page+1)}})),t.list&&h(bn,{editable:(t.list,!0)}))))}),null)," "),document.getElementById("mg-upc-admin-app")),setTimeout(window.showMainLists,1e3))})(); -
user-post-collections/trunk/javascript/mg-upc-client/dist/css/styles.css
r2770186 r3190768 1 .mg-upc-single-template .mg-upc-description{margin-top:1em}.mg-upc-single-template .mg-upc-author-box{margin:1em 0}.mg-upc-page-inner{flex-grow:2}.mg-upc-page-inner .mg-upc-author-box{padding:12px 10px 32px 120px;position:relative;min-height:120px}.mg-upc-page-inner .mg-upc-author-box .mg-upc-author-avatar{width:96px;height:96px;object-fit:cover;position:absolute;top:12px;left:0}.mg-upc-page-inner .mg-upc-author-box h4{font-size:21px;margin:12px 0 8px}.mg-upc-items-container{margin-left:0;margin-bottom:0;clear:both}.mg-upc-item{display:flex;flex-direction:row;position:relative;align-items:center;margin:40px 0}.mg-upc-item::after{content:' ';position:absolute;bottom:-20px;left:50%;width:80%;background:rgba(0,0,0,0.15);height:1px;margin-left:-40%}.mg-upc-item:last-child::after{display:none}.mg-upc-item .mg-upc-list-item-price{display:inline-block;margin-right:1em}.mg-upc-item p.stock{margin:0;display:inline-block;float:right}.mg-upc-item-data{flex-grow:1;flex-shrink:2;padding-right:1em;padding-left:1em}.mg-upc-item-data header h2{margin:10px 0 5px;font-size:20px;font-weight:600}.mg-upc-item-data header a{text-decoration:none}@media (max-width: 500px){.mg-upc-item{flex-direction:column;text-align:center;align-items:stretch}.mg-upc-item-actions button,.mg-upc-item-actions>a{width:100%}}.mg-upc-item-img{width:15%;min-width:100px;margin:auto}.mg-upc-item-img figure{margin:0}.mg-upc-item-img img{min-height:130px;width:100%;background:#6f7277;object-fit:cover;object-position:center}.mg-upc-item-desc{margin:0;line-height:1.3;font-weight:300;clear:both}.mg-upc-item-number{font-size:2em;min-width:2em;text-align:center}.mg-upc-item-quantity{margin:0.3em 1em}.mg-upc-item-quantity>*{display:block;text-align:center;padding:0.1em 0.5em}.mg-upc-item-quantity small{opacity:0.5}.mg-upc-item-actions{display:flex;flex-direction:column;row-gap:0.5em;padding:1em 0}.mg-upc-item-actions button,.mg-upc-item-actions>a{min-width:9em;text-align:center;white-space:nowrap}.mg-upc-votes{width:100%;height:45px;position:relative;clear:both}.mg-upc-item-bar{width:100%;height:10px;position:absolute;top:24px}.mg-upc-item-bar-progress,.mg-upc-item-bar-fill{display:block;width:100%;height:100%;background:#ededed;border:solid 1px #ccc;position:absolute;top:0}.mg-upc-item-bar-fill{box-shadow:0 0 3px #aaa}.mg-upc-item-bar-progress{background:#380;border-color:#286103}.mg-upc-item-percent{right:0;position:absolute;line-height:24px;font-size:20px}.mg-upc-item-votes{display:block;font-size:12px;left:0;position:absolute;line-height:25px;top:3px}.mg-upc-items-pagination{padding:1em 0;border:1px solid rgba(0,0,0,0.05);border-width:1px 0;text-align:center;clear:both}.mg-upc-items-pagination ul.page-numbers::after,.mg-upc-items-pagination ul.page-numbers::before{content:'';display:table}.mg-upc-items-pagination ul.page-numbers::after{clear:both}.mg-upc-items-pagination .page-numbers{list-style:none;margin:0}.mg-upc-items-pagination .page-numbers li{display:inline-block}.mg-upc-items-pagination .page-numbers li .page-numbers{border-left-width:0;display:inline-block;padding:.3342343017em .875em;background-color:rgba(0,0,0,0.025);color:#43454b}.mg-upc-items-pagination .page-numbers li .page-numbers.current{background-color:#474747;border-color:#474747;color:#fff}.mg-upc-items-pagination .page-numbers li .page-numbers.dots{background-color:transparent}.mg-upc-items-pagination .page-numbers li .page-numbers.next,.mg-upc-items-pagination .page-numbers li .page-numbers.prev{padding-left:1em;padding-right:1em}.mg-upc-items-pagination .page-numbers li a.page-numbers:hover{background-color:rgba(0,0,0,0.05)}.rtl .mg-upc-items-pagination a.next,.rtl .mg-upc-items-pagination a.prev{-webkit-transform:rotateY(180deg);transform:rotateY(180deg)}@keyframes mg-upc-alert{0%{transform:scaleY(0);margin-bottom:-19px}100%{transform:scaleY(1);margin-bottom:0}}.mg-upc-alert{padding:10px 40px 10px 1em;border:solid 1px #017401;background:rgba(154,240,173,0.8);color:#000;margin:1em 0;animation:mg-upc-alert 0.3s 1 ease-in-out both}.mg-upc-alert p{margin:0}.mg-upc-item .mg-upc-alert{position:absolute;bottom:-19px;left:0;right:0;margin:0}.mg-upc-alert-error{border-color:#d50000;background:rgba(255,121,121,0.8)}.mg-upc-alert-close{position:absolute;top:10px;right:15px;text-decoration:none !important;color:black}.mg-upc-hide{display:none}.mg-upc-product-added{background-color:#a3e8a3;color:#445e18}.mg-upc-product-error{color:#740000;background-color:#f89a9a}@keyframes mg-upc-btn-loading{100%{transform:translateX(100%)}}.mg-upc-btn-loading{background-color:#c7c7c7;position:relative;overflow:hidden;z-index:1;vertical-align:middle}.mg-upc-btn-loading::before,.mg-upc-btn-loading::after{content:' ';display:block !important;position:absolute;top:0;left:0;right:0;height:100%;background-color:#c7c7c7;z-index:2}.mg-upc-btn-loading::after{background-repeat:no-repeat;background-image:linear-gradient(90deg, #c7c7c7, #f5f5f5, #c7c7c7);transform:translateX(-100%);animation-name:mg-upc-btn-loading;animation-duration:0.8s;animation-timing-function:ease-in-out;animation-iteration-count:infinite}.mg-upc-add-product-to-list{margin-bottom:0.236em;margin-top:0.236em}.post-adding{margin:1em;text-align:center}.mg-upc-add-list-to-cart{margin:1em 1em 1em 0}.mg-upc-dg-container,.mg-upc-dg-overlay{position:fixed;top:0;right:0;bottom:0;left:0}.mg-upc-dg-container{z-index:999999;display:flex}.mg-upc-dg-container[aria-hidden='true']{display:none}.mg-upc-dg-overlay{background-color:rgba(43,46,56,0.9);animation:fade-in 200ms both}.mg-upc-dg-content{margin:auto;z-index:2;position:relative;background-color:#fff;color:#333;overflow-y:auto;animation:fade-in 400ms 200ms both, slide-up 400ms 200ms both;padding:1em;max-width:90%;max-height:80%;width:800px;border-radius:2px}.mg-upc-dg-content p{color:#333}.mg-upc-dg-content::after,.mg-list-edit::after{content:'';display:block;clear:both}@media screen and (min-width: 700px){.mg-upc-dg-content{padding:2em 1.5em}}.mg-upc-dg-close{position:absolute;top:0.5em;right:0.5em;border:0;padding:0;background-color:transparent;color:#000;font-weight:bold;font-size:1.25em;line-height:1.25em;min-width:1.2em;min-height:1.2em;text-align:center;cursor:pointer;transition:0.15s}@media screen and (min-width: 700px){.mg-upc-dg-close{top:1em;right:1em}}.mg-upc-dialog-content-wrapper{position:relative}@keyframes fade-in{from{opacity:0}}@keyframes slide-up{from{transform:translateY(10%)}}@font-face{font-family:"mgupc";src:url(../fd323a61b0577418b63a.eot?3p2eq6);src:url(../fd323a61b0577418b63a.eot?3p2eq6#iefix) format("embedded-opentype"),url(../aeaf4155903c2239613b.ttf?3p2eq6) format("truetype"),url(../d90b677af57f791b2998.woff?3p2eq6) format("woff"),url(../2f74331407887267c9f0.svg?3p2eq6#mgupc) format("svg");font-weight:normal;font-style:normal;font-display:block}.mg-upc-icon{font-family:"mgupc" !important;speak:never;font-style:normal;font-weight:normal;font-variant:normal;text-transform:none;line-height:1;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.upc-font-close:before{content:""}.upc-font-copy:before{content:""}.upc-font-first_page:before{content:""}.upc-font-last_page:before{content:""}.upc-font-arrow_left:before{content:""}.upc-font-arrow_right:before{content:""}.upc-font-poll:before{content:""}.upc-font-numbered:before{content:""}.upc-font-cart:before{content:""}.upc-font-bookmark:before{content:""}.upc-font-heart:before{content:""}.upc-font-save:before{content:""}.upc-font-edit:before{content:""}.upc-font-share:before{content:""}.upc-font-list:before{content:""}.upc-font-add:before{content:""}.upc-font-trash:before{content:""}.mg-upc-icon+span{margin-left:0.6em;vertical-align:middle}.mg-upc-icon{vertical-align:middle}.mg-upc-dg-content button{min-height:30px}.mg-upc-dg-msg{display:block;background:rgba(172,205,100,0.75);padding:0.7em;border:solid 1px #7dbf21;border-radius:2px;color:#314f00;margin:1em 0;white-space:pre-line}@media screen and (min-width: 700px){.mg-upc-dg-msg{top:-2em}}.mg-upc-dg-error{display:block;background:rgba(255,48,48,0.75);padding:0.7em;border:solid 1px #bf2121;border-radius:2px;color:#4f0001;margin:1em 0;position:sticky;top:-1em;z-index:5;white-space:pre-line}@media screen and (min-width: 700px){.mg-upc-dg-error{top:-2em}}.mg-upc-dg-alert-close{float:right;color:#fff;text-decoration:none;text-shadow:0 0 2px #ffff}.mg-upc-dg-wait{position:absolute;top:0;left:0;right:0;bottom:0;background:rgba(255,255,255,0.7);z-index:9;display:none}.mg-upc-dg-wait:before{content:'';position:absolute;top:50%;right:50%;margin:-1em 0 0 -1em;width:2em;height:2em;border-radius:50%;border-top:2px solid #5583f8;border-bottom:2px solid #345fc9;border-right:2px solid transparent;animation:loading-spinner .6s linear infinite}.mg-upc-dg-status-loading{max-height:90vh;min-height:50px;overflow:hidden}@keyframes loading-spinner{to{transform:rotate(360deg)}}.mg-upc-dg-dn{display:none !important}.mg-upc-dg-content ul{padding:0;margin:1em 0.3em}.mg-upc-dg-item-list,.mg-upc-dg-item-list-type{display:flex;padding:0.6em;margin:0.2em;justify-content:flex-start;align-content:stretch;align-items:center;border:solid 1px #e5e5e5;cursor:pointer}.mg-upc-dg-item-list:hover,.mg-upc-dg-item-list:focus,.mg-upc-dg-item-list-type:hover,.mg-upc-dg-item-list-type:focus{border:solid 1px #a9a9a9;background:#fafafa}.mg-upc-dg-item-list .mg-upc-dg-item-type,.mg-upc-dg-item-list-type .mg-upc-dg-item-type{width:30px;height:30px;font-size:24px;line-height:30px;text-align:center}.mg-upc-dg-item-list .mg-upc-dg-item-title,.mg-upc-dg-item-list-type .mg-upc-dg-item-title{display:flex;flex-direction:column;color:#333;flex-grow:2;text-align:start;padding:0.1em 1em;word-break:break-word}.mg-upc-dg-item-list .mg-upc-dg-item-title>span:nth-child(2),.mg-upc-dg-item-list-type .mg-upc-dg-item-title>span:nth-child(2){opacity:0.6}.mg-upc-dg-item-list .mg-upc-dg-item-count,.mg-upc-dg-item-list-type .mg-upc-dg-item-count{width:3em;text-align:center;opacity:0.5}@media screen and (max-width: 400px){.mg-upc-dg-item-list,.mg-upc-dg-item-list-type{flex-direction:column}.mg-upc-dg-item-list .mg-upc-dg-item-title,.mg-upc-dg-item-list-type .mg-upc-dg-item-title{text-align:center}}.mg-upc-dg-item-type:before{content:""}.mg-upc-dg-item-type-numbered:before{content:""}.mg-upc-dg-item-type-vote:before{content:""}.mg-upc-dg-item-type-favorites:before{content:""}.mg-upc-dg-item-type-bookmarks:before{content:""}.mg-upc-dg-item-type-cart:before{content:""}.mg-upc-dg-item-type-none:before{content:""}.mg-upg-edit{float:right}ul.mg-upc-dg-list::before{content:'';display:block;clear:both}.mg-upc-dg-title{margin-top:0;word-break:break-word}.mg-upc-dg-title>a{vertical-align:middle;font-size:1em;text-decoration:none}.mg-upc-dg-top-action{margin:1em 0;display:flex;align-items:center;align-content:stretch;flex-direction:row-reverse}.mg-upc-dg-top-action button{margin:0.5em;flex-grow:2}@media (max-width: 550px){.mg-upc-dg-top-action{align-items:stretch;flex-direction:column}}.mg-upc-dg-total-votes{text-align:right;display:block;margin-bottom:2em}.mg-list-edit label{color:#000000;display:block;margin-top:0.5em}.mg-list-edit input[type=text],.mg-list-edit textarea,.mg-list-edit select{width:100%;margin-bottom:0.5em;display:block;min-height:2em}.mg-list-edit textarea{height:8em}.mg-list-edit button{margin:0.7em 0;float:left}.mg-list-edit button:first-of-type{float:right}@media (max-width: 550px){.mg-list-edit button{width:100%}}.mg-upc-dg-list-desc-edit-count{display:block;text-align:right}.mg-upc-dg-item{display:flex;align-items:center;margin:2em 0}.mg-upc-dg-item>*{flex-shrink:0}.mg-upc-dg-item>.mg-upc-dg-item-data{flex-grow:1;flex-shrink:2}.mg-upc-dg-item button{margin:0.3em}@media (max-width: 550px){.mg-upc-dg-item{flex-direction:column;text-align:center}.mg-upc-dg-item .mg-upc-dg-item-number{position:relative;top:0.1em;height:0;font-size:3em;color:#fff;font-weight:700;text-shadow:0 0 4px black}.mg-upc-dg-item .mg-upc-dg-item-image{height:7em;width:7em}.mg-upc-dg-item .mg-upc-dg-stock>*,.mg-upc-dg-item .mg-upc-dg-price{float:none;margin:auto;display:block}}.mg-upc-dg-item-adding{margin:0.5em;opacity:0.7;padding:0.3em 1em;background:#eaeaea}.mg-upc-dg-item-handle{padding:0.5em;white-space:nowrap;cursor:move}.mg-upc-dg-item-number{width:3em;text-align:center;flex-shrink:0}.mg-upc-dg-item-image{height:5em;width:5em;max-width:none;object-fit:cover;background:#d5d5d5}.mg-upc-dg-item-data{padding-right:1em;padding-left:1em}.mg-upc-dg-item-data button{font-size:small}.mg-upc-dg-item-data>p{margin:0}.mg-upc-dg-btn-item-desc{width:100%}.mg-upc-dg-btn-item-desc-cancel,.mg-upc-dg-btn-item-desc-save{width:46%;margin:2%;float:left}.mg-upc-dg-price{float:right;margin-left:1em}.mg-upc-dg-price del{opacity:0.5}.mg-upc-dg-stock>*{margin:0;float:right}.mg-upc-dg-pagination-div{display:flex;align-content:stretch;justify-content:center;align-items:center}.mg-upc-dg-hidden{opacity:0.2}.mg-upc-dg-pagination-div.mg-upc-dg-hidden{display:none}.mg-upc-dg-pagination-div::after{content:'';clear:both;display:block}.mg-upc-dg-pagination,.mg-upc-dg-pagination-current{width:39%;text-align:center;position:relative}.mg-upc-dg-pagination-current{width:10%}.mg-upc-dg-pagination .sortable-chosen{position:absolute;top:0;left:0;bottom:0;right:0;margin:0;overflow:hidden;background:#ececd0}.mg-upc-dg-pagination .sortable-chosen .mg-upc-dg-item-handle,.mg-upc-dg-pagination .sortable-chosen .mg-upc-dg-item-number,.mg-upc-dg-pagination .sortable-chosen button{display:none}@keyframes mg-upc-dg-loading-skeleton{100%{transform:translateX(100%)}}.mg-upc-dg-loading-skeleton{--base-color: #ebebeb;--highlight-color: #f5f5f5;--animation-duration: 1.5s;--animation-direction: normal;--pseudo-element-display: block;background-color:var(--base-color);width:100%;border-radius:0.25rem;display:inline-flex;line-height:1;position:relative;overflow:hidden;z-index:1}.mg-upc-dg-loading-skeleton::after{content:' ';display:var(--pseudo-element-display);position:absolute;top:0;left:0;right:0;height:100%;background-repeat:no-repeat;background-image:linear-gradient(90deg, var(--base-color), var(--highlight-color), var(--base-color));transform:translateX(-100%);animation-name:mg-upc-dg-loading-skeleton;animation-direction:var(--animation-direction);animation-duration:var(--animation-duration);animation-timing-function:ease-in-out;animation-iteration-count:infinite}.mg-upc-dg-loading-skeleton,.mg-upc-dg-on-loading{display:none}.mg-upc-dg-status-loading .mg-upc-dg-list-desc,.mg-upc-dg-status-loading .mg-upc-dg-pagination-div,.mg-upc-dg-status-loading button{display:none}.mg-upc-dg-status-loading .mg-upc-dg-list-of-lists,.mg-upc-dg-status-loading .mg-upc-dg-list{visibility:hidden}.mg-upc-dg-status-loading .mg-upc-dg-on-loading{display:block}.mg-upc-dg-status-loading .mg-upc-dg-loading-skeleton{display:inline-flex}@keyframes share-animate{from{max-height:0;transform:scaleY(0);opacity:0}to{max-height:125px;transform:scaleY(1);opacity:1}}.mg-upc-dg-share-link{margin:1em 0;max-height:none;animation:share-animate .3s linear;text-align:center}.mg-upc-dg-share-link input{width:70%;font-size:16px;height:40px;border:none;background:#e2e2e2;color:#333;margin:0;display:inline-block;vertical-align:bottom;box-sizing:border-box}.mg-upc-dg-share-link button{width:30%;font-size:16px;padding:2px !important;height:40px !important;line-height:36px !important;border:none;display:inline-block;vertical-align:bottom;box-sizing:border-box}.mg-upc-dg-share-link .mg-upc-dg-share{display:inline-block;margin:2% 0}.mg-upc-zero-quantity{opacity:0.3}.mg-upc-dg-quantity{width:4em;display:flex;flex-direction:column;text-align:center;margin:1em}.mg-upc-dg-quantity small{opacity:0.5}.mg-upc-dg-quantity input{text-align:center}.mg-upc-err-required_logged_in .mg-list-new,.mg-upc-err-required_logged_in .mg-upc-dg-alert-close{display:none}.mg-upc-share-btn-img{height:64px;width:64px;display:inline-block;vertical-align:middle;background-size:100%}.mg-upc-share-link{display:block;text-align:right;margin:1em 0}.mg-upc-share-link::after{content:'';display:block;clear:both}.mg-upc-share{text-decoration:none}.mg-upc-dg-share:hover .mg-upc-share-btn-img,.mg-upc-dg-share:focus .mg-upc-share-btn-img,.mg-upc-share:hover .mg-upc-share-btn-img,.mg-upc-share:focus .mg-upc-share-btn-img{transform:scale(1.3);transition:transform 0.3s}.mg-upc-share-facebook{background-image:url("data:image/svg+xml,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 viewBox=%270 0 64 64%27 width=%2764%27 height=%2764%27%3E%3Crect width=%2764%27 height=%2764%27 rx=%270%27 ry=%270%27 fill=%27%233b5998%27%3E%3C/rect%3E%3Cpath d=%27M34.1,47V33.3h4.6l0.7-5.3h-5.3v-3.4c0-1.5,0.4-2.6,2.6-2.6l2.8,0v-4.8c-0.5-0.1-2.2-0.2-4.1-0.2 c-4.1,0-6.9,2.5-6.9,7V28H24v5.3h4.6V47H34.1z%27 fill=%27white%27%3E%3C/path%3E%3C/svg%3E")}.mg-upc-share-twitter{background-image:url("data:image/svg+xml,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 viewBox=%270 0 64 64%27 width=%2764%27 height=%2764%27%3E%3Crect width=%2764%27 height=%2764%27 rx=%270%27 ry=%270%27 fill=%27%2300aced%27%3E%3C/rect%3E%3Cpath d=%27M48,22.1c-1.2,0.5-2.4,0.9-3.8,1c1.4-0.8,2.4-2.1,2.9-3.6c-1.3,0.8-2.7,1.3-4.2,1.6 C41.7,19.8,40,19,38.2,19c-3.6,0-6.6,2.9-6.6,6.6c0,0.5,0.1,1,0.2,1.5c-5.5-0.3-10.3-2.9-13.5-6.9c-0.6,1-0.9,2.1-0.9,3.3 c0,2.3,1.2,4.3,2.9,5.5c-1.1,0-2.1-0.3-3-0.8c0,0,0,0.1,0,0.1c0,3.2,2.3,5.8,5.3,6.4c-0.6,0.1-1.1,0.2-1.7,0.2c-0.4,0-0.8,0-1.2-0.1 c0.8,2.6,3.3,4.5,6.1,4.6c-2.2,1.8-5.1,2.8-8.2,2.8c-0.5,0-1.1,0-1.6-0.1c2.9,1.9,6.4,2.9,10.1,2.9c12.1,0,18.7-10,18.7-18.7 c0-0.3,0-0.6,0-0.8C46,24.5,47.1,23.4,48,22.1z%27 fill=%27white%27%3E%3C/path%3E%3C/svg%3E")}.mg-upc-share-whatsapp{background-image:url("data:image/svg+xml,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 viewBox=%270 0 64 64%27 width=%2764%27 height=%2764%27%3E%3Crect width=%2764%27 height=%2764%27 rx=%270%27 ry=%270%27 fill=%27%2325D366%27%3E%3C/rect%3E%3Cpath d=%27m42.32286,33.93287c-0.5178,-0.2589 -3.04726,-1.49644 -3.52105,-1.66732c-0.4712,-0.17346 -0.81554,-0.2589 -1.15987,0.2589c-0.34175,0.51004 -1.33075,1.66474 -1.63108,2.00648c-0.30032,0.33658 -0.60064,0.36247 -1.11327,0.12945c-0.5178,-0.2589 -2.17994,-0.80259 -4.14759,-2.56312c-1.53269,-1.37217 -2.56312,-3.05503 -2.86603,-3.57283c-0.30033,-0.5178 -0.03366,-0.80259 0.22524,-1.06149c0.23301,-0.23301 0.5178,-0.59547 0.7767,-0.90616c0.25372,-0.31068 0.33657,-0.5178 0.51262,-0.85437c0.17088,-0.36246 0.08544,-0.64725 -0.04402,-0.90615c-0.12945,-0.2589 -1.15987,-2.79613 -1.58964,-3.80584c-0.41424,-1.00971 -0.84142,-0.88027 -1.15987,-0.88027c-0.29773,-0.02588 -0.64208,-0.02588 -0.98382,-0.02588c-0.34693,0 -0.90616,0.12945 -1.37736,0.62136c-0.4712,0.5178 -1.80194,1.76053 -1.80194,4.27186c0,2.51134 1.84596,4.945 2.10227,5.30747c0.2589,0.33657 3.63497,5.51458 8.80262,7.74113c1.23237,0.5178 2.1903,0.82848 2.94111,1.08738c1.23237,0.38836 2.35599,0.33657 3.24402,0.20712c0.99159,-0.15534 3.04985,-1.24272 3.47963,-2.45956c0.44013,-1.21683 0.44013,-2.22654 0.31068,-2.45955c-0.12945,-0.23301 -0.46601,-0.36247 -0.98382,-0.59548m-9.40068,12.84407l-0.02589,0c-3.05503,0 -6.08417,-0.82849 -8.72495,-2.38189l-0.62136,-0.37023l-6.47252,1.68286l1.73463,-6.29129l-0.41424,-0.64725c-1.70875,-2.71846 -2.6149,-5.85116 -2.6149,-9.07706c0,-9.39809 7.68934,-17.06155 17.15993,-17.06155c4.58253,0 8.88029,1.78642 12.11655,5.02268c3.23625,3.21036 5.02267,7.50812 5.02267,12.06476c-0.0078,9.3981 -7.69712,17.06155 -17.14699,17.06155m14.58906,-31.58846c-3.93529,-3.80584 -9.1133,-5.95471 -14.62789,-5.95471c-11.36055,0 -20.60848,9.2065 -20.61625,20.52564c0,3.61684 0.94757,7.14565 2.75211,10.26282l-2.92557,10.63564l10.93337,-2.85309c3.0136,1.63108 6.4052,2.4958 9.85634,2.49839l0.01037,0c11.36574,0 20.61884,-9.2091 20.62403,-20.53082c0,-5.48093 -2.14111,-10.64081 -6.03239,-14.51915%27 fill=%27white%27%3E%3C/path%3E%3C/svg%3E")}.mg-upc-share-telegram{background-image:url("data:image/svg+xml,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 viewBox=%270 0 64 64%27 width=%2764%27 height=%2764%27%3E%3Crect width=%2764%27 height=%2764%27 rx=%270%27 ry=%270%27 fill=%27%2337aee2%27%3E%3C/rect%3E%3Cpath d=%27m45.90873,15.44335c-0.6901,-0.0281 -1.37668,0.14048 -1.96142,0.41265c-0.84989,0.32661 -8.63939,3.33986 -16.5237,6.39174c-3.9685,1.53296 -7.93349,3.06593 -10.98537,4.24067c-3.05012,1.1765 -5.34694,2.05098 -5.4681,2.09312c-0.80775,0.28096 -1.89996,0.63566 -2.82712,1.72788c-0.23354,0.27218 -0.46884,0.62161 -0.58825,1.10275c-0.11941,0.48114 -0.06673,1.09222 0.16682,1.5716c0.46533,0.96052 1.25376,1.35737 2.18443,1.71383c3.09051,0.99037 6.28638,1.93508 8.93263,2.8236c0.97632,3.44171 1.91401,6.89571 2.84116,10.34268c0.30554,0.69185 0.97105,0.94823 1.65764,0.95525l-0.00351,0.03512c0,0 0.53908,0.05268 1.06412,-0.07375c0.52679,-0.12292 1.18879,-0.42846 1.79109,-0.99212c0.662,-0.62161 2.45836,-2.38812 3.47683,-3.38552l7.6736,5.66477l0.06146,0.03512c0,0 0.84989,0.59703 2.09312,0.68132c0.62161,0.04214 1.4399,-0.07726 2.14229,-0.59176c0.70766,-0.51626 1.1765,-1.34683 1.396,-2.29506c0.65673,-2.86224 5.00979,-23.57745 5.75257,-27.00686l-0.02107,0.08077c0.51977,-1.93157 0.32837,-3.70159 -0.87096,-4.74991c-0.60054,-0.52152 -1.2924,-0.7498 -1.98425,-0.77965l0,0.00176zm-0.2072,3.29069c0.04741,0.0439 0.0439,0.0439 0.00351,0.04741c-0.01229,-0.00351 0.14048,0.2072 -0.15804,1.32576l-0.01229,0.04214l-0.00878,0.03863c-0.75858,3.50668 -5.15554,24.40802 -5.74203,26.96472c-0.08077,0.34417 -0.11414,0.31959 -0.09482,0.29852c-0.1756,-0.02634 -0.50045,-0.16506 -0.52679,-0.1756l-13.13468,-9.70175c4.4988,-4.33199 9.09945,-8.25307 13.744,-12.43229c0.8218,-0.41265 0.68483,-1.68573 -0.29852,-1.70681c-1.04305,0.24584 -1.92279,0.99564 -2.8798,1.47502c-5.49971,3.2626 -11.11882,6.13186 -16.55882,9.49279c-2.792,-0.97105 -5.57873,-1.77704 -8.15298,-2.57601c2.2336,-0.89555 4.00889,-1.55579 5.75608,-2.23009c3.05188,-1.1765 7.01687,-2.7042 10.98537,-4.24067c7.94051,-3.06944 15.92667,-6.16346 16.62028,-6.43037l0.05619,-0.02283l0.05268,-0.02283c0.19316,-0.0878 0.30378,-0.09658 0.35471,-0.10009c0,0 -0.01756,-0.05795 -0.00351,-0.04566l-0.00176,0zm-20.91715,22.0638l2.16687,1.60145c-0.93418,0.91311 -1.81743,1.77353 -2.45485,2.38812l0.28798,-3.98957%27 fill=%27white%27%3E%3C/path%3E%3C/svg%3E")}.mg-upc-share-line{background-image:url("data:image/svg+xml,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 viewBox=%270 0 64 64%27 width=%2764%27 height=%2764%27%3E%3Crect width=%2764%27 height=%2764%27 rx=%270%27 ry=%270%27 fill=%27%2300b800%27%3E%3C/rect%3E%3Cpath d=%27M52.62 30.138c0 3.693-1.432 7.019-4.42 10.296h.001c-4.326 4.979-14 11.044-16.201 11.972-2.2.927-1.876-.591-1.786-1.112l.294-1.765c.069-.527.142-1.343-.066-1.865-.232-.574-1.146-.872-1.817-1.016-9.909-1.31-17.245-8.238-17.245-16.51 0-9.226 9.251-16.733 20.62-16.733 11.37 0 20.62 7.507 20.62 16.733zM27.81 25.68h-1.446a.402.402 0 0 0-.402.401v8.985c0 .221.18.4.402.4h1.446a.401.401 0 0 0 .402-.4v-8.985a.402.402 0 0 0-.402-.401zm9.956 0H36.32a.402.402 0 0 0-.402.401v5.338L31.8 25.858a.39.39 0 0 0-.031-.04l-.002-.003-.024-.025-.008-.007a.313.313 0 0 0-.032-.026.255.255 0 0 1-.021-.014l-.012-.007-.021-.012-.013-.006-.023-.01-.013-.005-.024-.008-.014-.003-.023-.005-.017-.002-.021-.003-.021-.002h-1.46a.402.402 0 0 0-.402.401v8.985c0 .221.18.4.402.4h1.446a.401.401 0 0 0 .402-.4v-5.337l4.123 5.568c.028.04.063.072.101.099l.004.003a.236.236 0 0 0 .025.015l.012.006.019.01a.154.154 0 0 1 .019.008l.012.004.028.01.005.001a.442.442 0 0 0 .104.013h1.446a.4.4 0 0 0 .401-.4v-8.985a.402.402 0 0 0-.401-.401zm-13.442 7.537h-3.93v-7.136a.401.401 0 0 0-.401-.401h-1.447a.4.4 0 0 0-.401.401v8.984a.392.392 0 0 0 .123.29c.072.068.17.111.278.111h5.778a.4.4 0 0 0 .401-.401v-1.447a.401.401 0 0 0-.401-.401zm21.429-5.287c.222 0 .401-.18.401-.402v-1.446a.401.401 0 0 0-.401-.402h-5.778a.398.398 0 0 0-.279.113l-.005.004-.006.008a.397.397 0 0 0-.111.276v8.984c0 .108.043.206.112.278l.005.006a.401.401 0 0 0 .284.117h5.778a.4.4 0 0 0 .401-.401v-1.447a.401.401 0 0 0-.401-.401h-3.93v-1.519h3.93c.222 0 .401-.18.401-.402V29.85a.401.401 0 0 0-.401-.402h-3.93V27.93h3.93z%27 fill=%27white%27%3E%3C/path%3E%3C/svg%3E")}.mg-upc-share-email{background-image:url("data:image/svg+xml,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 viewBox=%270 0 64 64%27 width=%2764%27 height=%2764%27%3E%3Crect width=%2764%27 height=%2764%27 rx=%270%27 ry=%270%27 fill=%27%23b2b2b2%27%3E%3C/rect%3E%3Cpath d=%27M17,22v20h30V22H17z M41.1,25L32,32.1L22.9,25H41.1z M20,39V26.6l12,9.3l12-9.3V39H20z%27 fill=%27white%27%3E%3C/path%3E%3C/svg%3E")}.mg-upc-share-pinterest{background-image:url("data:image/svg+xml,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%2764%27 height=%2764%27%3E%3Crect width=%2764%27 height=%2764%27 rx=%270%27 ry=%270%27 fill=%27%23dc0000%27/%3E%3Cpath d=%27M32.9 12.4c-10.4 0-15.6 7.6-15.6 13.7 0 3.7 1.5 7.1 4.5 8.3.6.3 1 0 1.1-.5l.4-1.8c.2-.5.2-.8-.2-1.2-1-1-1.6-2.3-1.6-4.3 0-5.6 4.1-10.5 10.8-10.5 6 0 9.2 3.6 9.2 8.4 0 6.2-2.9 11.6-7 11.6-2.2 0-4-2-3.4-4.3.7-2.7 2-5.7 2-7.7 0-1.8-1-3.3-3-3.3-2.4 0-4.3 2.3-4.3 5.6 0 2 .7 3.4.7 3.4l-2.9 11.9c-.4 1.6-1 8.3-1 9.8.9.4 2.2-1.6 3.5-3.8.7-1.2 1.6-2.8 2-4.4l1.5-6c.7 1.5 3 2.7 5.3 2.7 7 0 11.8-6.4 11.8-15 0-6.5-5.5-12.6-13.8-12.6z%27 fill=%27%23fff%27 paint-order=%27fill markers stroke%27/%3E%3C/svg%3E")} 2 1 .mg-upc-dg-container,.mg-upc-dg-overlay{position:fixed;top:0;right:0;bottom:0;left:0}.mg-upc-dg-container{z-index:999999;display:flex}.mg-upc-dg-container[aria-hidden=true]{display:none}.mg-upc-dg-overlay{background-color:rgba(43,46,56,.9);animation:fade-in 200ms both}.mg-upc-dg-content{margin:auto;z-index:2;position:relative;background-color:#fff;color:#333;overflow-y:auto;animation:fade-in 400ms 200ms both,slide-up 400ms 200ms both;padding:1em;max-width:90%;max-height:80%;width:800px;border-radius:2px}.mg-upc-dg-content p{color:#333}.mg-upc-dg-content::after,.mg-list-edit::after{content:"";display:block;clear:both}@media screen and (min-width: 700px){.mg-upc-dg-content{padding:2em 1.5em}}.mg-upc-dg-close{position:absolute;top:.5em;right:.5em;border:0;padding:0;background-color:rgba(0,0,0,0);color:#000;font-weight:bold;font-size:1.25em;line-height:1.25em;min-width:1.2em;min-height:1.2em;text-align:center;cursor:pointer;transition:.15s}@media screen and (min-width: 700px){.mg-upc-dg-close{top:1em;right:1em}}.mg-upc-dialog-content-wrapper{position:relative}@keyframes fade-in{from{opacity:0}}@keyframes slide-up{from{transform:translateY(10%)}}@font-face{font-family:"mgupc";src:url(../fd323a61b0577418b63a.eot?3p2eq6);src:url(../fd323a61b0577418b63a.eot?3p2eq6#iefix) format("embedded-opentype"),url(../aeaf4155903c2239613b.ttf?3p2eq6) format("truetype"),url(../d90b677af57f791b2998.woff?3p2eq6) format("woff"),url(../2f74331407887267c9f0.svg?3p2eq6#mgupc) format("svg");font-weight:normal;font-style:normal;font-display:block}.mg-upc-icon{font-family:"mgupc" !important;speak:never;font-style:normal;font-weight:normal;font-variant:normal;text-transform:none;line-height:1;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.upc-font-close:before{content:""}.upc-font-copy:before{content:""}.upc-font-first_page:before{content:""}.upc-font-last_page:before{content:""}.upc-font-arrow_left:before{content:""}.upc-font-arrow_right:before{content:""}.upc-font-poll:before{content:""}.upc-font-numbered:before{content:""}.upc-font-cart:before{content:""}.upc-font-bookmark:before{content:""}.upc-font-heart:before{content:""}.upc-font-save:before{content:""}.upc-font-edit:before{content:""}.upc-font-share:before{content:""}.upc-font-list:before{content:""}.upc-font-add:before{content:""}.upc-font-trash:before{content:""}.mg-upc-single-template .mg-upc-description{margin-top:1em}.mg-upc-single-template .mg-upc-author-box{margin:1em 0}.mg-upc-page-inner{flex-grow:2}.mg-upc-page-inner .mg-upc-author-box{padding:12px 10px 32px 120px;position:relative;min-height:120px}.mg-upc-page-inner .mg-upc-author-box .mg-upc-author-avatar{width:96px;height:96px;object-fit:cover;position:absolute;top:12px;left:0}.mg-upc-page-inner .mg-upc-author-box h4{font-size:21px;margin:12px 0 8px}.mg-upc-items-container{margin-left:0;margin-bottom:0;clear:both}.mg-upc-item{display:flex;flex-direction:row;position:relative;align-items:center;margin:40px 0}.mg-upc-item::after{content:" ";position:absolute;bottom:-20px;left:50%;width:80%;background:rgba(0,0,0,.15);height:1px;margin-left:-40%}.mg-upc-item:last-child::after{display:none}.mg-upc-item .mg-upc-list-item-price{display:inline-block;margin-right:1em}.mg-upc-item p.stock{margin:0;display:inline-block;float:right}.mg-upc-item-data{flex-grow:1;flex-shrink:2;padding-right:1em;padding-left:1em}.mg-upc-item-data header h2{margin:10px 0 5px;font-size:20px;font-weight:600}.mg-upc-item-data header a{text-decoration:none}@media(max-width: 500px){.mg-upc-item{flex-direction:column;text-align:center;align-items:stretch}.mg-upc-item-actions button,.mg-upc-item-actions>a{width:100%}}.mg-upc-item-img{width:15%;min-width:100px;margin:auto}.mg-upc-item-img figure{margin:0}.mg-upc-item-img img{min-height:130px;width:100%;background:#6f7277;object-fit:cover;object-position:center}.mg-upc-item-desc{margin:0;line-height:1.3;font-weight:300;clear:both}.mg-upc-item-number{font-size:2em;min-width:2em;text-align:center}.mg-upc-item-quantity{margin:.3em 1em}.mg-upc-item-quantity>*{display:block;text-align:center;padding:.1em .5em}.mg-upc-item-quantity small{opacity:.5}.mg-upc-item-actions{display:flex;flex-direction:column;row-gap:.5em;padding:1em 0}.mg-upc-item-actions button,.mg-upc-item-actions>a{min-width:9em;text-align:center;white-space:nowrap}.mg-upc-votes{width:100%;height:45px;position:relative;clear:both}.mg-upc-item-bar{width:100%;height:10px;position:absolute;top:24px}.mg-upc-item-bar-progress,.mg-upc-item-bar-fill{display:block;width:100%;height:100%;background:#ededed;border:solid 1px #ccc;position:absolute;top:0}.mg-upc-item-bar-fill{box-shadow:0 0 3px #aaa}.mg-upc-item-bar-progress{background:#380;border-color:#286103}.mg-upc-item-percent{right:0;position:absolute;line-height:24px;font-size:20px}.mg-upc-item-votes{display:block;font-size:12px;left:0;position:absolute;line-height:25px;top:3px}.mg-upc-items-pagination{padding:1em 0;border:1px solid rgba(0,0,0,.05);border-width:1px 0;text-align:center;clear:both}.mg-upc-items-pagination ul.page-numbers::after,.mg-upc-items-pagination ul.page-numbers::before{content:"";display:table}.mg-upc-items-pagination ul.page-numbers::after{clear:both}.mg-upc-items-pagination .page-numbers{list-style:none;margin:0}.mg-upc-items-pagination .page-numbers li{display:inline-block}.mg-upc-items-pagination .page-numbers li .page-numbers{border-left-width:0;display:inline-block;padding:0.3342343017em .875em;background-color:rgba(0,0,0,.025);color:#43454b}.mg-upc-items-pagination .page-numbers li .page-numbers.current{background-color:#474747;border-color:#474747;color:#fff}.mg-upc-items-pagination .page-numbers li .page-numbers.dots{background-color:rgba(0,0,0,0)}.mg-upc-items-pagination .page-numbers li .page-numbers.next,.mg-upc-items-pagination .page-numbers li .page-numbers.prev{padding-left:1em;padding-right:1em}.mg-upc-items-pagination .page-numbers li a.page-numbers:hover{background-color:rgba(0,0,0,.05)}.rtl .mg-upc-items-pagination a.next,.rtl .mg-upc-items-pagination a.prev{-webkit-transform:rotateY(180deg);transform:rotateY(180deg)}@keyframes mg-upc-alert{0%{transform:scaleY(0) translateY(-19px);margin-bottom:-19px}100%{transform:scaleY(1) translateY(0)}}.mg-upc-alert{padding:10px 40px 10px 1em;border:solid 1px #017401;background:rgba(154,240,173,.8);color:#000;margin:1em 0;animation:mg-upc-alert .3s 1 ease-in-out both}.mg-upc-alert p{margin:0}.mg-upc-item .mg-upc-alert{position:absolute;bottom:-19px;left:0;right:0;margin:0}.mg-upc-alert-error{border-color:#d50000;background:rgba(255,121,121,.8)}.mg-upc-alert-close{position:absolute;top:10px;right:15px;text-decoration:none !important;color:#000}.mg-upc-hide{display:none}.mg-upc-product-added{background-color:#a3e8a3;color:#445e18}.mg-upc-product-error{color:#740000;background-color:#f89a9a}@keyframes mg-upc-btn-loading{100%{transform:translateX(100%)}}.mg-upc-btn-loading{background-color:#c7c7c7;position:relative;overflow:hidden !important;z-index:1;vertical-align:middle;display:inline-block}.mg-upc-btn-loading::before,.mg-upc-btn-loading::after{content:" ";display:block !important;position:absolute;top:0;left:0;right:0;height:100%;background-color:#c7c7c7;z-index:2}.mg-upc-btn-loading::after{background-repeat:no-repeat;background-image:linear-gradient(90deg, #c7c7c7, #f5f5f5, #c7c7c7);transform:translateX(-100%);animation-name:mg-upc-btn-loading;animation-duration:.8s;animation-timing-function:ease-in-out;animation-iteration-count:infinite}.mg-upc-add-product-to-list{margin-bottom:.236em;margin-top:.236em}.post-adding{margin:1em;text-align:center}.mg-upc-add-list-to-cart{margin:1em 1em 1em 0}.mg-upc-add-list-to-cart+a.added_to_cart.wc-forward{margin:1em}.mg-upc-archive-list{margin-bottom:15px;display:flex}.mg-upc-archive-list .mg-upc-loop-list-title::before{width:1em;height:1em;margin-right:.35em;font-size:.8em;text-align:center;vertical-align:baseline;font-family:"mgupc" !important;speak:never;font-style:normal;font-weight:normal;font-variant:normal;text-transform:none;line-height:1;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;opacity:.5;content:""}.mg-upc-archive-list.mg-upc-vote .mg-upc-loop-list-title::before{content:""}.mg-upc-archive-list.mg-upc-cart .mg-upc-loop-list-title::before{content:""}.mg-upc-archive-list.mg-upc-numbered .mg-upc-loop-list-title::before{content:""}.mg-upc-archive-list.mg-upc-bookmark .mg-upc-loop-list-title::before{content:""}.mg-upc-archive-list.mg-upc-favorite .mg-upc-loop-list-title::before{content:""}h2.mg-upc-loop-list-title{margin:.25em 0 .15em;flex:100% 0 0}.mg-upc-archive-list .mg-upc-loop-list-title a{color:inherit;text-decoration:none}.mg-upc-thumbs-container{width:180px;min-width:50px;height:fit-content;overflow:hidden;font-size:0;line-height:0;display:inline-block;background-color:rgba(175,175,175,.13);background-image:url("data:image/svg+xml,%3Csvg viewBox=%270 0 52.92 52.92%27 xmlns=%27http://www.w3.org/2000/svg%27%3E%3Cpath fill=%27%239d9d9d%27 d=%27M0 0h26.46v26.46H0z%27/%3E%3Cpath fill=%27%23b3b3b3%27 d=%27M26.46 0h26.46v26.46H26.46z%27/%3E%3Cpath fill=%27%23cfcfcf%27 d=%27M0 26.46h26.46v26.46H0z%27/%3E%3Cpath fill=%27%23ebebeb%27 d=%27M26.46 26.46h26.46v26.46H26.46z%27/%3E%3C/svg%3E");background-size:cover;background-position:left bottom}@media(min-width: 576px){.mg-upc-thumbs-container{aspect-ratio:1}}.mg-upc-thumbs-container figure{width:50%;height:0;padding-bottom:50%;display:inline-block;position:relative;margin:0}.mg-upc-thumbs-container figure>img{position:absolute;height:100%;width:100%;object-fit:cover;margin:0;max-width:none;box-shadow:none !important}.mg-upc-loop-list-info{width:70%;width:calc(100% - 180px);display:inline-block;vertical-align:top;padding:1.5% 1% 1.5% 3%;box-sizing:border-box;flex:1 1;display:flex;flex-wrap:wrap;align-content:flex-start;justify-content:flex-start;align-items:center;gap:0 .7em}.mg-upc-loop-author-list,.mg-upc-loop-list-meta{display:inline-block;line-height:2em;vertical-align:middle;text-decoration:none;margin-right:.3em}.mg-upc-loop-list-meta>span{vertical-align:middle}.mg-upc-loop-author-list>.mg-upc-author-avatar{width:1.9em;height:1.9em;object-fit:cover;display:inline-block;vertical-align:middle}.mg-upc-loop-author-list>span{line-height:2em;display:inline-block;vertical-align:middle;margin-left:.5em;font-weight:700}.mg-upc-loop-author-list>span a{text-decoration:none}.mg-upc-loop-list-description{margin-top:20px;flex:100% 0 0}@media(max-width: 768px){.mg-upc-list-list .mg-upc-thumbs-container{width:120px}.mg-upc-list-list h2.mg-upc-loop-list-title{font-size:1.5em;margin-bottom:.2em}.mg-upc-list-list .mg-upc-loop-list-description{display:none}}@media(max-width: 576px){.mg-upc-list-list .mg-upc-thumbs-container{width:100%;height:auto}.mg-upc-list-list .mg-upc-loop-list-info{width:100%;padding:0 0 10px 0}.mg-upc-list-list .mg-upc-thumbs-container{background-size:50%;background-position:bottom}.mg-upc-list-list .mg-upc-thumbs-container figure{width:25%;height:0;padding-bottom:25%}.mg-upc-list-list .mg-upc-archive-list{flex-direction:column;margin-bottom:20px}}.mg-upc-list-card .mg-upc-loop-list-title{font-size:16px}@media(min-width: 600px){.mg-upc-list-card .mg-upc-loop-list-title{font-size:20px}}@media(min-width: 1024px){.mg-upc-list-card .mg-upc-loop-list-title{font-size:22px}}.mg-upc-list-card .mg-upc-archive{display:flex;flex-wrap:wrap}.mg-upc-list-card .mg-upc-archive-list{display:flex;flex-direction:column}.mg-upc-list-card .mg-upc-loop-list-info{width:100%;padding:5px 10px;background:#f9f9f9;flex-grow:2}.mg-upc-list-card .mg-upc-thumbs-container{position:relative;width:100%}.mg-upc-list-card .mg-upc-loop-list-description p{margin-bottom:0}@media(min-width: 0){.mg-upc-list-card.mg-upc-list-cols-xs-1 .mg-upc-archive-list{width:100%}.mg-upc-list-card.mg-upc-list-cols-xs-2 .mg-upc-archive{gap:2%}.mg-upc-list-card.mg-upc-list-cols-xs-2 .mg-upc-archive-list{width:49%}.mg-upc-list-card.mg-upc-list-cols-xs-3 .mg-upc-archive{gap:2%}.mg-upc-list-card.mg-upc-list-cols-xs-3 .mg-upc-archive-list{width:32%}.mg-upc-list-card.mg-upc-list-cols-xs-4 .mg-upc-archive{gap:1.3333333333%}.mg-upc-list-card.mg-upc-list-cols-xs-4 .mg-upc-archive-list{width:24%}.mg-upc-list-card.mg-upc-list-cols-xs-5 .mg-upc-archive{gap:1.25%}.mg-upc-list-card.mg-upc-list-cols-xs-5 .mg-upc-archive-list{width:19%}.mg-upc-list-card.mg-upc-list-cols-xs-6 .mg-upc-archive{gap:.8%}.mg-upc-list-card.mg-upc-list-cols-xs-6 .mg-upc-archive-list{width:16%}}@media(min-width: 576px){.mg-upc-list-card.mg-upc-list-cols-sm-1 .mg-upc-archive-list{width:100%}.mg-upc-list-card.mg-upc-list-cols-sm-2 .mg-upc-archive{gap:2%}.mg-upc-list-card.mg-upc-list-cols-sm-2 .mg-upc-archive-list{width:49%}.mg-upc-list-card.mg-upc-list-cols-sm-3 .mg-upc-archive{gap:2%}.mg-upc-list-card.mg-upc-list-cols-sm-3 .mg-upc-archive-list{width:32%}.mg-upc-list-card.mg-upc-list-cols-sm-4 .mg-upc-archive{gap:1.3333333333%}.mg-upc-list-card.mg-upc-list-cols-sm-4 .mg-upc-archive-list{width:24%}.mg-upc-list-card.mg-upc-list-cols-sm-5 .mg-upc-archive{gap:1.25%}.mg-upc-list-card.mg-upc-list-cols-sm-5 .mg-upc-archive-list{width:19%}.mg-upc-list-card.mg-upc-list-cols-sm-6 .mg-upc-archive{gap:.8%}.mg-upc-list-card.mg-upc-list-cols-sm-6 .mg-upc-archive-list{width:16%}}@media(min-width: 768px){.mg-upc-list-card.mg-upc-list-cols-md-1 .mg-upc-archive-list{width:100%}.mg-upc-list-card.mg-upc-list-cols-md-2 .mg-upc-archive{gap:2%}.mg-upc-list-card.mg-upc-list-cols-md-2 .mg-upc-archive-list{width:49%}.mg-upc-list-card.mg-upc-list-cols-md-3 .mg-upc-archive{gap:2%}.mg-upc-list-card.mg-upc-list-cols-md-3 .mg-upc-archive-list{width:32%}.mg-upc-list-card.mg-upc-list-cols-md-4 .mg-upc-archive{gap:1.3333333333%}.mg-upc-list-card.mg-upc-list-cols-md-4 .mg-upc-archive-list{width:24%}.mg-upc-list-card.mg-upc-list-cols-md-5 .mg-upc-archive{gap:1.25%}.mg-upc-list-card.mg-upc-list-cols-md-5 .mg-upc-archive-list{width:19%}.mg-upc-list-card.mg-upc-list-cols-md-6 .mg-upc-archive{gap:.8%}.mg-upc-list-card.mg-upc-list-cols-md-6 .mg-upc-archive-list{width:16%}}@media(min-width: 992px){.mg-upc-list-card.mg-upc-list-cols-lg-1 .mg-upc-archive-list{width:100%}.mg-upc-list-card.mg-upc-list-cols-lg-2 .mg-upc-archive{gap:2%}.mg-upc-list-card.mg-upc-list-cols-lg-2 .mg-upc-archive-list{width:49%}.mg-upc-list-card.mg-upc-list-cols-lg-3 .mg-upc-archive{gap:2%}.mg-upc-list-card.mg-upc-list-cols-lg-3 .mg-upc-archive-list{width:32%}.mg-upc-list-card.mg-upc-list-cols-lg-4 .mg-upc-archive{gap:1.3333333333%}.mg-upc-list-card.mg-upc-list-cols-lg-4 .mg-upc-archive-list{width:24%}.mg-upc-list-card.mg-upc-list-cols-lg-5 .mg-upc-archive{gap:1.25%}.mg-upc-list-card.mg-upc-list-cols-lg-5 .mg-upc-archive-list{width:19%}.mg-upc-list-card.mg-upc-list-cols-lg-6 .mg-upc-archive{gap:.8%}.mg-upc-list-card.mg-upc-list-cols-lg-6 .mg-upc-archive-list{width:16%}}@media(min-width: 1200px){.mg-upc-list-card.mg-upc-list-cols-xl-1 .mg-upc-archive-list{width:100%}.mg-upc-list-card.mg-upc-list-cols-xl-2 .mg-upc-archive{gap:2%}.mg-upc-list-card.mg-upc-list-cols-xl-2 .mg-upc-archive-list{width:49%}.mg-upc-list-card.mg-upc-list-cols-xl-3 .mg-upc-archive{gap:2%}.mg-upc-list-card.mg-upc-list-cols-xl-3 .mg-upc-archive-list{width:32%}.mg-upc-list-card.mg-upc-list-cols-xl-4 .mg-upc-archive{gap:1.3333333333%}.mg-upc-list-card.mg-upc-list-cols-xl-4 .mg-upc-archive-list{width:24%}.mg-upc-list-card.mg-upc-list-cols-xl-5 .mg-upc-archive{gap:1.25%}.mg-upc-list-card.mg-upc-list-cols-xl-5 .mg-upc-archive-list{width:19%}.mg-upc-list-card.mg-upc-list-cols-xl-6 .mg-upc-archive{gap:.8%}.mg-upc-list-card.mg-upc-list-cols-xl-6 .mg-upc-archive-list{width:16%}}@media(min-width: 1400px){.mg-upc-list-card.mg-upc-list-cols-xxl-1 .mg-upc-archive-list{width:100%}.mg-upc-list-card.mg-upc-list-cols-xxl-2 .mg-upc-archive{gap:2%}.mg-upc-list-card.mg-upc-list-cols-xxl-2 .mg-upc-archive-list{width:49%}.mg-upc-list-card.mg-upc-list-cols-xxl-3 .mg-upc-archive{gap:2%}.mg-upc-list-card.mg-upc-list-cols-xxl-3 .mg-upc-archive-list{width:32%}.mg-upc-list-card.mg-upc-list-cols-xxl-4 .mg-upc-archive{gap:1.3333333333%}.mg-upc-list-card.mg-upc-list-cols-xxl-4 .mg-upc-archive-list{width:24%}.mg-upc-list-card.mg-upc-list-cols-xxl-5 .mg-upc-archive{gap:1.25%}.mg-upc-list-card.mg-upc-list-cols-xxl-5 .mg-upc-archive-list{width:19%}.mg-upc-list-card.mg-upc-list-cols-xxl-6 .mg-upc-archive{gap:.8%}.mg-upc-list-card.mg-upc-list-cols-xxl-6 .mg-upc-archive-list{width:16%}}.mg-upc-list-card .mg-upc-thumbs-container{height:max-content;overflow:hidden}.mg-upc-archive .mg-upc-thumbs-container figure{height:0}.mg-upc-archive.mg-upc-list-card .mg-upc-thumbs-container{width:100%}.mg-upc-thumbs-1x1 .mg-upc-thumbs-container,.mg-upc-thumbs-1x2 .mg-upc-thumbs-container,.mg-upc-thumbs-1x3 .mg-upc-thumbs-container,.mg-upc-thumbs-1x4 .mg-upc-thumbs-container{background-size:200%}.mg-upc-thumbs-1x1 .mg-upc-thumbs-container figure,.mg-upc-thumbs-1x2 .mg-upc-thumbs-container figure,.mg-upc-thumbs-1x3 .mg-upc-thumbs-container figure,.mg-upc-thumbs-1x4 .mg-upc-thumbs-container figure{width:100%;padding-bottom:100%}.mg-upc-thumbs-1x1 .mg-upc-thumbs-container{aspect-ratio:1}.mg-upc-thumbs-1x2 .mg-upc-thumbs-container{aspect-ratio:.5}.mg-upc-thumbs-1x3 .mg-upc-thumbs-container{aspect-ratio:.33334}.mg-upc-thumbs-1x4 .mg-upc-thumbs-container{aspect-ratio:.25}.mg-upc-thumbs-2x1 .mg-upc-thumbs-container,.mg-upc-thumbs-2x2 .mg-upc-thumbs-container,.mg-upc-thumbs-2x3 .mg-upc-thumbs-container,.mg-upc-thumbs-2x4 .mg-upc-thumbs-container{background-size:100%}.mg-upc-thumbs-2x1 .mg-upc-thumbs-container figure,.mg-upc-thumbs-2x2 .mg-upc-thumbs-container figure,.mg-upc-thumbs-2x3 .mg-upc-thumbs-container figure,.mg-upc-thumbs-2x4 .mg-upc-thumbs-container figure{width:50%;padding-bottom:50%}.mg-upc-thumbs-2x1 .mg-upc-thumbs-container{aspect-ratio:2}.mg-upc-thumbs-2x2 .mg-upc-thumbs-container{aspect-ratio:1}.mg-upc-thumbs-2x3 .mg-upc-thumbs-container{aspect-ratio:.66667}.mg-upc-thumbs-2x4 .mg-upc-thumbs-container{aspect-ratio:.5}.mg-upc-thumbs-3x1 .mg-upc-thumbs-container,.mg-upc-thumbs-3x2 .mg-upc-thumbs-container,.mg-upc-thumbs-3x3 .mg-upc-thumbs-container,.mg-upc-thumbs-3x4 .mg-upc-thumbs-container{background-size:66.6666666667%}.mg-upc-thumbs-3x1 .mg-upc-thumbs-container figure,.mg-upc-thumbs-3x2 .mg-upc-thumbs-container figure,.mg-upc-thumbs-3x3 .mg-upc-thumbs-container figure,.mg-upc-thumbs-3x4 .mg-upc-thumbs-container figure{width:33.33334%;padding-bottom:33.33334%}.mg-upc-thumbs-3x1 .mg-upc-thumbs-container{aspect-ratio:3}.mg-upc-thumbs-3x2 .mg-upc-thumbs-container{aspect-ratio:1.5}.mg-upc-thumbs-3x3 .mg-upc-thumbs-container{aspect-ratio:1}.mg-upc-thumbs-3x4 .mg-upc-thumbs-container{aspect-ratio:.75}.mg-upc-thumbs-4x1 .mg-upc-thumbs-container,.mg-upc-thumbs-4x2 .mg-upc-thumbs-container,.mg-upc-thumbs-4x3 .mg-upc-thumbs-container,.mg-upc-thumbs-4x4 .mg-upc-thumbs-container{background-size:50%}.mg-upc-thumbs-4x1 .mg-upc-thumbs-container figure,.mg-upc-thumbs-4x2 .mg-upc-thumbs-container figure,.mg-upc-thumbs-4x3 .mg-upc-thumbs-container figure,.mg-upc-thumbs-4x4 .mg-upc-thumbs-container figure{width:25%;padding-bottom:25%}.mg-upc-thumbs-4x1 .mg-upc-thumbs-container{aspect-ratio:4}.mg-upc-thumbs-4x2 .mg-upc-thumbs-container{aspect-ratio:2}.mg-upc-thumbs-4x3 .mg-upc-thumbs-container{aspect-ratio:1.33334}.mg-upc-thumbs-4x4 .mg-upc-thumbs-container{aspect-ratio:1}@media(min-width: 0){.mg-upc-thumbs-xs-1x1 .mg-upc-thumbs-container,.mg-upc-thumbs-xs-1x2 .mg-upc-thumbs-container,.mg-upc-thumbs-xs-1x3 .mg-upc-thumbs-container,.mg-upc-thumbs-xs-1x4 .mg-upc-thumbs-container{background-size:200%}.mg-upc-thumbs-xs-1x1 .mg-upc-thumbs-container figure,.mg-upc-thumbs-xs-1x2 .mg-upc-thumbs-container figure,.mg-upc-thumbs-xs-1x3 .mg-upc-thumbs-container figure,.mg-upc-thumbs-xs-1x4 .mg-upc-thumbs-container figure{width:100%;padding-bottom:100%}.mg-upc-thumbs-xs-1x1 .mg-upc-thumbs-container{aspect-ratio:1}.mg-upc-thumbs-xs-1x2 .mg-upc-thumbs-container{aspect-ratio:.5}.mg-upc-thumbs-xs-1x3 .mg-upc-thumbs-container{aspect-ratio:.33334}.mg-upc-thumbs-xs-1x4 .mg-upc-thumbs-container{aspect-ratio:.25}.mg-upc-thumbs-xs-2x1 .mg-upc-thumbs-container,.mg-upc-thumbs-xs-2x2 .mg-upc-thumbs-container,.mg-upc-thumbs-xs-2x3 .mg-upc-thumbs-container,.mg-upc-thumbs-xs-2x4 .mg-upc-thumbs-container{background-size:100%}.mg-upc-thumbs-xs-2x1 .mg-upc-thumbs-container figure,.mg-upc-thumbs-xs-2x2 .mg-upc-thumbs-container figure,.mg-upc-thumbs-xs-2x3 .mg-upc-thumbs-container figure,.mg-upc-thumbs-xs-2x4 .mg-upc-thumbs-container figure{width:50%;padding-bottom:50%}.mg-upc-thumbs-xs-2x1 .mg-upc-thumbs-container{aspect-ratio:2}.mg-upc-thumbs-xs-2x2 .mg-upc-thumbs-container{aspect-ratio:1}.mg-upc-thumbs-xs-2x3 .mg-upc-thumbs-container{aspect-ratio:.66667}.mg-upc-thumbs-xs-2x4 .mg-upc-thumbs-container{aspect-ratio:.5}.mg-upc-thumbs-xs-3x1 .mg-upc-thumbs-container,.mg-upc-thumbs-xs-3x2 .mg-upc-thumbs-container,.mg-upc-thumbs-xs-3x3 .mg-upc-thumbs-container,.mg-upc-thumbs-xs-3x4 .mg-upc-thumbs-container{background-size:66.6666666667%}.mg-upc-thumbs-xs-3x1 .mg-upc-thumbs-container figure,.mg-upc-thumbs-xs-3x2 .mg-upc-thumbs-container figure,.mg-upc-thumbs-xs-3x3 .mg-upc-thumbs-container figure,.mg-upc-thumbs-xs-3x4 .mg-upc-thumbs-container figure{width:33.33334%;padding-bottom:33.33334%}.mg-upc-thumbs-xs-3x1 .mg-upc-thumbs-container{aspect-ratio:3}.mg-upc-thumbs-xs-3x2 .mg-upc-thumbs-container{aspect-ratio:1.5}.mg-upc-thumbs-xs-3x3 .mg-upc-thumbs-container{aspect-ratio:1}.mg-upc-thumbs-xs-3x4 .mg-upc-thumbs-container{aspect-ratio:.75}.mg-upc-thumbs-xs-4x1 .mg-upc-thumbs-container,.mg-upc-thumbs-xs-4x2 .mg-upc-thumbs-container,.mg-upc-thumbs-xs-4x3 .mg-upc-thumbs-container,.mg-upc-thumbs-xs-4x4 .mg-upc-thumbs-container{background-size:50%}.mg-upc-thumbs-xs-4x1 .mg-upc-thumbs-container figure,.mg-upc-thumbs-xs-4x2 .mg-upc-thumbs-container figure,.mg-upc-thumbs-xs-4x3 .mg-upc-thumbs-container figure,.mg-upc-thumbs-xs-4x4 .mg-upc-thumbs-container figure{width:25%;padding-bottom:25%}.mg-upc-thumbs-xs-4x1 .mg-upc-thumbs-container{aspect-ratio:4}.mg-upc-thumbs-xs-4x2 .mg-upc-thumbs-container{aspect-ratio:2}.mg-upc-thumbs-xs-4x3 .mg-upc-thumbs-container{aspect-ratio:1.33334}.mg-upc-thumbs-xs-4x4 .mg-upc-thumbs-container{aspect-ratio:1}}@media(min-width: 576px){.mg-upc-thumbs-sm-1x1 .mg-upc-thumbs-container,.mg-upc-thumbs-sm-1x2 .mg-upc-thumbs-container,.mg-upc-thumbs-sm-1x3 .mg-upc-thumbs-container,.mg-upc-thumbs-sm-1x4 .mg-upc-thumbs-container{background-size:200%}.mg-upc-thumbs-sm-1x1 .mg-upc-thumbs-container figure,.mg-upc-thumbs-sm-1x2 .mg-upc-thumbs-container figure,.mg-upc-thumbs-sm-1x3 .mg-upc-thumbs-container figure,.mg-upc-thumbs-sm-1x4 .mg-upc-thumbs-container figure{width:100%;padding-bottom:100%}.mg-upc-thumbs-sm-1x1 .mg-upc-thumbs-container{aspect-ratio:1}.mg-upc-thumbs-sm-1x2 .mg-upc-thumbs-container{aspect-ratio:.5}.mg-upc-thumbs-sm-1x3 .mg-upc-thumbs-container{aspect-ratio:.33334}.mg-upc-thumbs-sm-1x4 .mg-upc-thumbs-container{aspect-ratio:.25}.mg-upc-thumbs-sm-2x1 .mg-upc-thumbs-container,.mg-upc-thumbs-sm-2x2 .mg-upc-thumbs-container,.mg-upc-thumbs-sm-2x3 .mg-upc-thumbs-container,.mg-upc-thumbs-sm-2x4 .mg-upc-thumbs-container{background-size:100%}.mg-upc-thumbs-sm-2x1 .mg-upc-thumbs-container figure,.mg-upc-thumbs-sm-2x2 .mg-upc-thumbs-container figure,.mg-upc-thumbs-sm-2x3 .mg-upc-thumbs-container figure,.mg-upc-thumbs-sm-2x4 .mg-upc-thumbs-container figure{width:50%;padding-bottom:50%}.mg-upc-thumbs-sm-2x1 .mg-upc-thumbs-container{aspect-ratio:2}.mg-upc-thumbs-sm-2x2 .mg-upc-thumbs-container{aspect-ratio:1}.mg-upc-thumbs-sm-2x3 .mg-upc-thumbs-container{aspect-ratio:.66667}.mg-upc-thumbs-sm-2x4 .mg-upc-thumbs-container{aspect-ratio:.5}.mg-upc-thumbs-sm-3x1 .mg-upc-thumbs-container,.mg-upc-thumbs-sm-3x2 .mg-upc-thumbs-container,.mg-upc-thumbs-sm-3x3 .mg-upc-thumbs-container,.mg-upc-thumbs-sm-3x4 .mg-upc-thumbs-container{background-size:66.6666666667%}.mg-upc-thumbs-sm-3x1 .mg-upc-thumbs-container figure,.mg-upc-thumbs-sm-3x2 .mg-upc-thumbs-container figure,.mg-upc-thumbs-sm-3x3 .mg-upc-thumbs-container figure,.mg-upc-thumbs-sm-3x4 .mg-upc-thumbs-container figure{width:33.33334%;padding-bottom:33.33334%}.mg-upc-thumbs-sm-3x1 .mg-upc-thumbs-container{aspect-ratio:3}.mg-upc-thumbs-sm-3x2 .mg-upc-thumbs-container{aspect-ratio:1.5}.mg-upc-thumbs-sm-3x3 .mg-upc-thumbs-container{aspect-ratio:1}.mg-upc-thumbs-sm-3x4 .mg-upc-thumbs-container{aspect-ratio:.75}.mg-upc-thumbs-sm-4x1 .mg-upc-thumbs-container,.mg-upc-thumbs-sm-4x2 .mg-upc-thumbs-container,.mg-upc-thumbs-sm-4x3 .mg-upc-thumbs-container,.mg-upc-thumbs-sm-4x4 .mg-upc-thumbs-container{background-size:50%}.mg-upc-thumbs-sm-4x1 .mg-upc-thumbs-container figure,.mg-upc-thumbs-sm-4x2 .mg-upc-thumbs-container figure,.mg-upc-thumbs-sm-4x3 .mg-upc-thumbs-container figure,.mg-upc-thumbs-sm-4x4 .mg-upc-thumbs-container figure{width:25%;padding-bottom:25%}.mg-upc-thumbs-sm-4x1 .mg-upc-thumbs-container{aspect-ratio:4}.mg-upc-thumbs-sm-4x2 .mg-upc-thumbs-container{aspect-ratio:2}.mg-upc-thumbs-sm-4x3 .mg-upc-thumbs-container{aspect-ratio:1.33334}.mg-upc-thumbs-sm-4x4 .mg-upc-thumbs-container{aspect-ratio:1}}@media(min-width: 768px){.mg-upc-thumbs-md-1x1 .mg-upc-thumbs-container,.mg-upc-thumbs-md-1x2 .mg-upc-thumbs-container,.mg-upc-thumbs-md-1x3 .mg-upc-thumbs-container,.mg-upc-thumbs-md-1x4 .mg-upc-thumbs-container{background-size:200%}.mg-upc-thumbs-md-1x1 .mg-upc-thumbs-container figure,.mg-upc-thumbs-md-1x2 .mg-upc-thumbs-container figure,.mg-upc-thumbs-md-1x3 .mg-upc-thumbs-container figure,.mg-upc-thumbs-md-1x4 .mg-upc-thumbs-container figure{width:100%;padding-bottom:100%}.mg-upc-thumbs-md-1x1 .mg-upc-thumbs-container{aspect-ratio:1}.mg-upc-thumbs-md-1x2 .mg-upc-thumbs-container{aspect-ratio:.5}.mg-upc-thumbs-md-1x3 .mg-upc-thumbs-container{aspect-ratio:.33334}.mg-upc-thumbs-md-1x4 .mg-upc-thumbs-container{aspect-ratio:.25}.mg-upc-thumbs-md-2x1 .mg-upc-thumbs-container,.mg-upc-thumbs-md-2x2 .mg-upc-thumbs-container,.mg-upc-thumbs-md-2x3 .mg-upc-thumbs-container,.mg-upc-thumbs-md-2x4 .mg-upc-thumbs-container{background-size:100%}.mg-upc-thumbs-md-2x1 .mg-upc-thumbs-container figure,.mg-upc-thumbs-md-2x2 .mg-upc-thumbs-container figure,.mg-upc-thumbs-md-2x3 .mg-upc-thumbs-container figure,.mg-upc-thumbs-md-2x4 .mg-upc-thumbs-container figure{width:50%;padding-bottom:50%}.mg-upc-thumbs-md-2x1 .mg-upc-thumbs-container{aspect-ratio:2}.mg-upc-thumbs-md-2x2 .mg-upc-thumbs-container{aspect-ratio:1}.mg-upc-thumbs-md-2x3 .mg-upc-thumbs-container{aspect-ratio:.66667}.mg-upc-thumbs-md-2x4 .mg-upc-thumbs-container{aspect-ratio:.5}.mg-upc-thumbs-md-3x1 .mg-upc-thumbs-container,.mg-upc-thumbs-md-3x2 .mg-upc-thumbs-container,.mg-upc-thumbs-md-3x3 .mg-upc-thumbs-container,.mg-upc-thumbs-md-3x4 .mg-upc-thumbs-container{background-size:66.6666666667%}.mg-upc-thumbs-md-3x1 .mg-upc-thumbs-container figure,.mg-upc-thumbs-md-3x2 .mg-upc-thumbs-container figure,.mg-upc-thumbs-md-3x3 .mg-upc-thumbs-container figure,.mg-upc-thumbs-md-3x4 .mg-upc-thumbs-container figure{width:33.33334%;padding-bottom:33.33334%}.mg-upc-thumbs-md-3x1 .mg-upc-thumbs-container{aspect-ratio:3}.mg-upc-thumbs-md-3x2 .mg-upc-thumbs-container{aspect-ratio:1.5}.mg-upc-thumbs-md-3x3 .mg-upc-thumbs-container{aspect-ratio:1}.mg-upc-thumbs-md-3x4 .mg-upc-thumbs-container{aspect-ratio:.75}.mg-upc-thumbs-md-4x1 .mg-upc-thumbs-container,.mg-upc-thumbs-md-4x2 .mg-upc-thumbs-container,.mg-upc-thumbs-md-4x3 .mg-upc-thumbs-container,.mg-upc-thumbs-md-4x4 .mg-upc-thumbs-container{background-size:50%}.mg-upc-thumbs-md-4x1 .mg-upc-thumbs-container figure,.mg-upc-thumbs-md-4x2 .mg-upc-thumbs-container figure,.mg-upc-thumbs-md-4x3 .mg-upc-thumbs-container figure,.mg-upc-thumbs-md-4x4 .mg-upc-thumbs-container figure{width:25%;padding-bottom:25%}.mg-upc-thumbs-md-4x1 .mg-upc-thumbs-container{aspect-ratio:4}.mg-upc-thumbs-md-4x2 .mg-upc-thumbs-container{aspect-ratio:2}.mg-upc-thumbs-md-4x3 .mg-upc-thumbs-container{aspect-ratio:1.33334}.mg-upc-thumbs-md-4x4 .mg-upc-thumbs-container{aspect-ratio:1}}@media(min-width: 992px){.mg-upc-thumbs-lg-1x1 .mg-upc-thumbs-container,.mg-upc-thumbs-lg-1x2 .mg-upc-thumbs-container,.mg-upc-thumbs-lg-1x3 .mg-upc-thumbs-container,.mg-upc-thumbs-lg-1x4 .mg-upc-thumbs-container{background-size:200%}.mg-upc-thumbs-lg-1x1 .mg-upc-thumbs-container figure,.mg-upc-thumbs-lg-1x2 .mg-upc-thumbs-container figure,.mg-upc-thumbs-lg-1x3 .mg-upc-thumbs-container figure,.mg-upc-thumbs-lg-1x4 .mg-upc-thumbs-container figure{width:100%;padding-bottom:100%}.mg-upc-thumbs-lg-1x1 .mg-upc-thumbs-container{aspect-ratio:1}.mg-upc-thumbs-lg-1x2 .mg-upc-thumbs-container{aspect-ratio:.5}.mg-upc-thumbs-lg-1x3 .mg-upc-thumbs-container{aspect-ratio:.33334}.mg-upc-thumbs-lg-1x4 .mg-upc-thumbs-container{aspect-ratio:.25}.mg-upc-thumbs-lg-2x1 .mg-upc-thumbs-container,.mg-upc-thumbs-lg-2x2 .mg-upc-thumbs-container,.mg-upc-thumbs-lg-2x3 .mg-upc-thumbs-container,.mg-upc-thumbs-lg-2x4 .mg-upc-thumbs-container{background-size:100%}.mg-upc-thumbs-lg-2x1 .mg-upc-thumbs-container figure,.mg-upc-thumbs-lg-2x2 .mg-upc-thumbs-container figure,.mg-upc-thumbs-lg-2x3 .mg-upc-thumbs-container figure,.mg-upc-thumbs-lg-2x4 .mg-upc-thumbs-container figure{width:50%;padding-bottom:50%}.mg-upc-thumbs-lg-2x1 .mg-upc-thumbs-container{aspect-ratio:2}.mg-upc-thumbs-lg-2x2 .mg-upc-thumbs-container{aspect-ratio:1}.mg-upc-thumbs-lg-2x3 .mg-upc-thumbs-container{aspect-ratio:.66667}.mg-upc-thumbs-lg-2x4 .mg-upc-thumbs-container{aspect-ratio:.5}.mg-upc-thumbs-lg-3x1 .mg-upc-thumbs-container,.mg-upc-thumbs-lg-3x2 .mg-upc-thumbs-container,.mg-upc-thumbs-lg-3x3 .mg-upc-thumbs-container,.mg-upc-thumbs-lg-3x4 .mg-upc-thumbs-container{background-size:66.6666666667%}.mg-upc-thumbs-lg-3x1 .mg-upc-thumbs-container figure,.mg-upc-thumbs-lg-3x2 .mg-upc-thumbs-container figure,.mg-upc-thumbs-lg-3x3 .mg-upc-thumbs-container figure,.mg-upc-thumbs-lg-3x4 .mg-upc-thumbs-container figure{width:33.33334%;padding-bottom:33.33334%}.mg-upc-thumbs-lg-3x1 .mg-upc-thumbs-container{aspect-ratio:3}.mg-upc-thumbs-lg-3x2 .mg-upc-thumbs-container{aspect-ratio:1.5}.mg-upc-thumbs-lg-3x3 .mg-upc-thumbs-container{aspect-ratio:1}.mg-upc-thumbs-lg-3x4 .mg-upc-thumbs-container{aspect-ratio:.75}.mg-upc-thumbs-lg-4x1 .mg-upc-thumbs-container,.mg-upc-thumbs-lg-4x2 .mg-upc-thumbs-container,.mg-upc-thumbs-lg-4x3 .mg-upc-thumbs-container,.mg-upc-thumbs-lg-4x4 .mg-upc-thumbs-container{background-size:50%}.mg-upc-thumbs-lg-4x1 .mg-upc-thumbs-container figure,.mg-upc-thumbs-lg-4x2 .mg-upc-thumbs-container figure,.mg-upc-thumbs-lg-4x3 .mg-upc-thumbs-container figure,.mg-upc-thumbs-lg-4x4 .mg-upc-thumbs-container figure{width:25%;padding-bottom:25%}.mg-upc-thumbs-lg-4x1 .mg-upc-thumbs-container{aspect-ratio:4}.mg-upc-thumbs-lg-4x2 .mg-upc-thumbs-container{aspect-ratio:2}.mg-upc-thumbs-lg-4x3 .mg-upc-thumbs-container{aspect-ratio:1.33334}.mg-upc-thumbs-lg-4x4 .mg-upc-thumbs-container{aspect-ratio:1}}@media(min-width: 1200px){.mg-upc-thumbs-xl-1x1 .mg-upc-thumbs-container,.mg-upc-thumbs-xl-1x2 .mg-upc-thumbs-container,.mg-upc-thumbs-xl-1x3 .mg-upc-thumbs-container,.mg-upc-thumbs-xl-1x4 .mg-upc-thumbs-container{background-size:200%}.mg-upc-thumbs-xl-1x1 .mg-upc-thumbs-container figure,.mg-upc-thumbs-xl-1x2 .mg-upc-thumbs-container figure,.mg-upc-thumbs-xl-1x3 .mg-upc-thumbs-container figure,.mg-upc-thumbs-xl-1x4 .mg-upc-thumbs-container figure{width:100%;padding-bottom:100%}.mg-upc-thumbs-xl-1x1 .mg-upc-thumbs-container{aspect-ratio:1}.mg-upc-thumbs-xl-1x2 .mg-upc-thumbs-container{aspect-ratio:.5}.mg-upc-thumbs-xl-1x3 .mg-upc-thumbs-container{aspect-ratio:.33334}.mg-upc-thumbs-xl-1x4 .mg-upc-thumbs-container{aspect-ratio:.25}.mg-upc-thumbs-xl-2x1 .mg-upc-thumbs-container,.mg-upc-thumbs-xl-2x2 .mg-upc-thumbs-container,.mg-upc-thumbs-xl-2x3 .mg-upc-thumbs-container,.mg-upc-thumbs-xl-2x4 .mg-upc-thumbs-container{background-size:100%}.mg-upc-thumbs-xl-2x1 .mg-upc-thumbs-container figure,.mg-upc-thumbs-xl-2x2 .mg-upc-thumbs-container figure,.mg-upc-thumbs-xl-2x3 .mg-upc-thumbs-container figure,.mg-upc-thumbs-xl-2x4 .mg-upc-thumbs-container figure{width:50%;padding-bottom:50%}.mg-upc-thumbs-xl-2x1 .mg-upc-thumbs-container{aspect-ratio:2}.mg-upc-thumbs-xl-2x2 .mg-upc-thumbs-container{aspect-ratio:1}.mg-upc-thumbs-xl-2x3 .mg-upc-thumbs-container{aspect-ratio:.66667}.mg-upc-thumbs-xl-2x4 .mg-upc-thumbs-container{aspect-ratio:.5}.mg-upc-thumbs-xl-3x1 .mg-upc-thumbs-container,.mg-upc-thumbs-xl-3x2 .mg-upc-thumbs-container,.mg-upc-thumbs-xl-3x3 .mg-upc-thumbs-container,.mg-upc-thumbs-xl-3x4 .mg-upc-thumbs-container{background-size:66.6666666667%}.mg-upc-thumbs-xl-3x1 .mg-upc-thumbs-container figure,.mg-upc-thumbs-xl-3x2 .mg-upc-thumbs-container figure,.mg-upc-thumbs-xl-3x3 .mg-upc-thumbs-container figure,.mg-upc-thumbs-xl-3x4 .mg-upc-thumbs-container figure{width:33.33334%;padding-bottom:33.33334%}.mg-upc-thumbs-xl-3x1 .mg-upc-thumbs-container{aspect-ratio:3}.mg-upc-thumbs-xl-3x2 .mg-upc-thumbs-container{aspect-ratio:1.5}.mg-upc-thumbs-xl-3x3 .mg-upc-thumbs-container{aspect-ratio:1}.mg-upc-thumbs-xl-3x4 .mg-upc-thumbs-container{aspect-ratio:.75}.mg-upc-thumbs-xl-4x1 .mg-upc-thumbs-container,.mg-upc-thumbs-xl-4x2 .mg-upc-thumbs-container,.mg-upc-thumbs-xl-4x3 .mg-upc-thumbs-container,.mg-upc-thumbs-xl-4x4 .mg-upc-thumbs-container{background-size:50%}.mg-upc-thumbs-xl-4x1 .mg-upc-thumbs-container figure,.mg-upc-thumbs-xl-4x2 .mg-upc-thumbs-container figure,.mg-upc-thumbs-xl-4x3 .mg-upc-thumbs-container figure,.mg-upc-thumbs-xl-4x4 .mg-upc-thumbs-container figure{width:25%;padding-bottom:25%}.mg-upc-thumbs-xl-4x1 .mg-upc-thumbs-container{aspect-ratio:4}.mg-upc-thumbs-xl-4x2 .mg-upc-thumbs-container{aspect-ratio:2}.mg-upc-thumbs-xl-4x3 .mg-upc-thumbs-container{aspect-ratio:1.33334}.mg-upc-thumbs-xl-4x4 .mg-upc-thumbs-container{aspect-ratio:1}}@media(min-width: 1400px){.mg-upc-thumbs-xxl-1x1 .mg-upc-thumbs-container,.mg-upc-thumbs-xxl-1x2 .mg-upc-thumbs-container,.mg-upc-thumbs-xxl-1x3 .mg-upc-thumbs-container,.mg-upc-thumbs-xxl-1x4 .mg-upc-thumbs-container{background-size:200%}.mg-upc-thumbs-xxl-1x1 .mg-upc-thumbs-container figure,.mg-upc-thumbs-xxl-1x2 .mg-upc-thumbs-container figure,.mg-upc-thumbs-xxl-1x3 .mg-upc-thumbs-container figure,.mg-upc-thumbs-xxl-1x4 .mg-upc-thumbs-container figure{width:100%;padding-bottom:100%}.mg-upc-thumbs-xxl-1x1 .mg-upc-thumbs-container{aspect-ratio:1}.mg-upc-thumbs-xxl-1x2 .mg-upc-thumbs-container{aspect-ratio:.5}.mg-upc-thumbs-xxl-1x3 .mg-upc-thumbs-container{aspect-ratio:.33334}.mg-upc-thumbs-xxl-1x4 .mg-upc-thumbs-container{aspect-ratio:.25}.mg-upc-thumbs-xxl-2x1 .mg-upc-thumbs-container,.mg-upc-thumbs-xxl-2x2 .mg-upc-thumbs-container,.mg-upc-thumbs-xxl-2x3 .mg-upc-thumbs-container,.mg-upc-thumbs-xxl-2x4 .mg-upc-thumbs-container{background-size:100%}.mg-upc-thumbs-xxl-2x1 .mg-upc-thumbs-container figure,.mg-upc-thumbs-xxl-2x2 .mg-upc-thumbs-container figure,.mg-upc-thumbs-xxl-2x3 .mg-upc-thumbs-container figure,.mg-upc-thumbs-xxl-2x4 .mg-upc-thumbs-container figure{width:50%;padding-bottom:50%}.mg-upc-thumbs-xxl-2x1 .mg-upc-thumbs-container{aspect-ratio:2}.mg-upc-thumbs-xxl-2x2 .mg-upc-thumbs-container{aspect-ratio:1}.mg-upc-thumbs-xxl-2x3 .mg-upc-thumbs-container{aspect-ratio:.66667}.mg-upc-thumbs-xxl-2x4 .mg-upc-thumbs-container{aspect-ratio:.5}.mg-upc-thumbs-xxl-3x1 .mg-upc-thumbs-container,.mg-upc-thumbs-xxl-3x2 .mg-upc-thumbs-container,.mg-upc-thumbs-xxl-3x3 .mg-upc-thumbs-container,.mg-upc-thumbs-xxl-3x4 .mg-upc-thumbs-container{background-size:66.6666666667%}.mg-upc-thumbs-xxl-3x1 .mg-upc-thumbs-container figure,.mg-upc-thumbs-xxl-3x2 .mg-upc-thumbs-container figure,.mg-upc-thumbs-xxl-3x3 .mg-upc-thumbs-container figure,.mg-upc-thumbs-xxl-3x4 .mg-upc-thumbs-container figure{width:33.33334%;padding-bottom:33.33334%}.mg-upc-thumbs-xxl-3x1 .mg-upc-thumbs-container{aspect-ratio:3}.mg-upc-thumbs-xxl-3x2 .mg-upc-thumbs-container{aspect-ratio:1.5}.mg-upc-thumbs-xxl-3x3 .mg-upc-thumbs-container{aspect-ratio:1}.mg-upc-thumbs-xxl-3x4 .mg-upc-thumbs-container{aspect-ratio:.75}.mg-upc-thumbs-xxl-4x1 .mg-upc-thumbs-container,.mg-upc-thumbs-xxl-4x2 .mg-upc-thumbs-container,.mg-upc-thumbs-xxl-4x3 .mg-upc-thumbs-container,.mg-upc-thumbs-xxl-4x4 .mg-upc-thumbs-container{background-size:50%}.mg-upc-thumbs-xxl-4x1 .mg-upc-thumbs-container figure,.mg-upc-thumbs-xxl-4x2 .mg-upc-thumbs-container figure,.mg-upc-thumbs-xxl-4x3 .mg-upc-thumbs-container figure,.mg-upc-thumbs-xxl-4x4 .mg-upc-thumbs-container figure{width:25%;padding-bottom:25%}.mg-upc-thumbs-xxl-4x1 .mg-upc-thumbs-container{aspect-ratio:4}.mg-upc-thumbs-xxl-4x2 .mg-upc-thumbs-container{aspect-ratio:2}.mg-upc-thumbs-xxl-4x3 .mg-upc-thumbs-container{aspect-ratio:1.33334}.mg-upc-thumbs-xxl-4x4 .mg-upc-thumbs-container{aspect-ratio:1}}@media(min-width: 0){.mg-upc-thumbs-xs-0 .mg-upc-thumbs-container,.mg-upc-thumbs-xs-0x0 .mg-upc-thumbs-container{display:none}}@media(min-width: 576px){.mg-upc-thumbs-sm-0 .mg-upc-thumbs-container,.mg-upc-thumbs-sm-0x0 .mg-upc-thumbs-container{display:none}}@media(min-width: 768px){.mg-upc-thumbs-md-0 .mg-upc-thumbs-container,.mg-upc-thumbs-md-0x0 .mg-upc-thumbs-container{display:none}}@media(min-width: 992px){.mg-upc-thumbs-lg-0 .mg-upc-thumbs-container,.mg-upc-thumbs-lg-0x0 .mg-upc-thumbs-container{display:none}}@media(min-width: 1200px){.mg-upc-thumbs-xl-0 .mg-upc-thumbs-container,.mg-upc-thumbs-xl-0x0 .mg-upc-thumbs-container{display:none}}@media(min-width: 1400px){.mg-upc-thumbs-xxl-0 .mg-upc-thumbs-container,.mg-upc-thumbs-xxl-0x0 .mg-upc-thumbs-container{display:none}}.mg-upc-icon+span{margin-left:.6em;vertical-align:middle}.mg-upc-icon{vertical-align:middle}.mg-upc-dg-content button{min-height:30px}.mg-upc-dg-msg{display:block;background:rgba(172,205,100,.75);padding:.7em;border:solid 1px #7dbf21;border-radius:2px;color:#314f00;margin:1em 0;white-space:pre-line}@media screen and (min-width: 700px){.mg-upc-dg-msg{top:-2em}}.mg-upc-dg-error{display:block;background:rgba(255,48,48,.75);padding:.7em;border:solid 1px #bf2121;border-radius:2px;color:#4f0001;margin:1em 0;position:sticky;top:-1em;z-index:5;white-space:pre-line}@media screen and (min-width: 700px){.mg-upc-dg-error{top:-2em}}.mg-upc-dg-alert-close{float:right;color:#fff;text-decoration:none;text-shadow:0 0 2px #fff}.mg-upc-dg-wait{position:absolute;top:0;left:0;right:0;bottom:0;background:hsla(0,0%,100%,.7);z-index:9;display:none}.mg-upc-dg-wait:before{content:"";position:absolute;top:50%;right:50%;margin:-1em 0 0 -1em;width:2em;height:2em;border-radius:50%;border-top:2px solid #5583f8;border-bottom:2px solid #345fc9;border-right:2px solid rgba(0,0,0,0);animation:loading-spinner .6s linear infinite}.mg-upc-dg-status-loading{max-height:90vh;min-height:50px;overflow:hidden}@keyframes loading-spinner{to{transform:rotate(360deg)}}.mg-upc-dg-dn{display:none !important}.mg-upc-dg-content ul{padding:0;margin:1em .3em}.mg-upc-dg-item-list,.mg-upc-dg-item-list-type{display:flex;padding:.6em;margin:.2em;justify-content:flex-start;align-content:stretch;align-items:center;border:solid 1px #e5e5e5;cursor:pointer}.mg-upc-dg-item-list:hover,.mg-upc-dg-item-list:focus,.mg-upc-dg-item-list-type:hover,.mg-upc-dg-item-list-type:focus{border:solid 1px #a9a9a9;background:#fafafa}.mg-upc-dg-item-list .mg-upc-dg-item-type,.mg-upc-dg-item-list-type .mg-upc-dg-item-type{width:30px;height:30px;font-size:24px;line-height:30px;text-align:center}.mg-upc-dg-item-list .mg-upc-dg-item-title,.mg-upc-dg-item-list-type .mg-upc-dg-item-title{display:flex;flex-direction:column;color:#333;flex-grow:2;text-align:start;padding:.1em 1em;word-break:break-word}.mg-upc-dg-item-list .mg-upc-dg-item-title>span:nth-child(2),.mg-upc-dg-item-list-type .mg-upc-dg-item-title>span:nth-child(2){opacity:.6}.mg-upc-dg-item-list .mg-upc-dg-item-count,.mg-upc-dg-item-list-type .mg-upc-dg-item-count{width:3em;text-align:center;opacity:.5}@media screen and (max-width: 400px){.mg-upc-dg-item-list,.mg-upc-dg-item-list-type{flex-direction:column}.mg-upc-dg-item-list .mg-upc-dg-item-title,.mg-upc-dg-item-list-type .mg-upc-dg-item-title{text-align:center}}.mg-upc-dg-item-type:before{content:""}.mg-upc-dg-item-type-numbered:before{content:""}.mg-upc-dg-item-type-vote:before{content:""}.mg-upc-dg-item-type-favorites:before{content:""}.mg-upc-dg-item-type-bookmarks:before{content:""}.mg-upc-dg-item-type-cart:before{content:""}.mg-upc-dg-item-type-none:before{content:""}.mg-upg-edit{float:right}ul.mg-upc-dg-list::before{content:"";display:block;clear:both}.mg-upc-dg-title{margin-top:0;word-break:break-word}.mg-upc-dg-title>a{vertical-align:middle;font-size:1em;text-decoration:none}.mg-upc-dg-top-action{margin:1em 0;display:flex;align-items:center;align-content:stretch;flex-direction:row-reverse}.mg-upc-dg-top-action button{margin:.5em;flex-grow:2}@media(max-width: 550px){.mg-upc-dg-top-action{align-items:stretch;flex-direction:column}}.mg-upc-dg-total-votes{text-align:right;display:block;margin-bottom:2em}.mg-list-edit label{color:#000;display:block;margin-top:.5em}.mg-list-edit input[type=text],.mg-list-edit textarea,.mg-list-edit select{width:100%;margin-bottom:.5em;display:block;min-height:2em}.mg-list-edit textarea{height:8em}.mg-list-edit button{margin:.7em 0;float:left}.mg-list-edit button:first-of-type{float:right}@media(max-width: 550px){.mg-list-edit button{width:100%}}.mg-upc-dg-list-desc-edit-count{display:block;text-align:right}.mg-upc-dg-item{display:flex;align-items:center;margin:2em 0}.mg-upc-dg-item>*{flex-shrink:0}.mg-upc-dg-item>.mg-upc-dg-item-data{flex-grow:1;flex-shrink:2}.mg-upc-dg-item button{margin:.3em}@media(max-width: 550px){.mg-upc-dg-item{flex-direction:column;text-align:center}.mg-upc-dg-item .mg-upc-dg-item-number{position:relative;top:.1em;height:0;font-size:3em;color:#fff;font-weight:700;text-shadow:0 0 4px #000}.mg-upc-dg-item .mg-upc-dg-item-image{height:7em;width:7em}.mg-upc-dg-item .mg-upc-dg-stock>*,.mg-upc-dg-item .mg-upc-dg-price{float:none;margin:auto;display:block}}.mg-upc-dg-item-adding{margin:.5em;opacity:.7;padding:.3em 1em;background:#eaeaea}.mg-upc-dg-item-handle{padding:.5em;white-space:nowrap;cursor:move}.mg-upc-dg-item-number{width:3em;text-align:center;flex-shrink:0}.mg-upc-dg-item-image{height:5em;width:5em;max-width:none;object-fit:cover;background:#d5d5d5}.mg-upc-dg-item-data{padding-right:1em;padding-left:1em}.mg-upc-dg-item-data button{font-size:small}.mg-upc-dg-item-data>p{margin:0}.mg-upc-dg-btn-item-desc{width:100%}.mg-upc-dg-btn-item-desc-cancel,.mg-upc-dg-btn-item-desc-save{width:46%;margin:2%;float:left}.mg-upc-dg-price{float:right;margin-left:1em}.mg-upc-dg-price del{opacity:.5}.mg-upc-dg-stock>*{margin:0;float:right}.mg-upc-dg-pagination-div{display:flex;align-content:stretch;justify-content:center;align-items:center}.mg-upc-dg-hidden{opacity:.2}.mg-upc-dg-pagination-div.mg-upc-dg-hidden{display:none}.mg-upc-dg-pagination-div::after{content:"";clear:both;display:block}.mg-upc-dg-pagination,.mg-upc-dg-pagination-current{width:39%;text-align:center;position:relative}.mg-upc-dg-pagination-current{width:10%}.mg-upc-dg-pagination .sortable-chosen{position:absolute;top:0;left:0;bottom:0;right:0;margin:0;overflow:hidden;background:#ececd0}.mg-upc-dg-pagination .sortable-chosen .mg-upc-dg-item-handle,.mg-upc-dg-pagination .sortable-chosen .mg-upc-dg-item-number,.mg-upc-dg-pagination .sortable-chosen button{display:none}@keyframes mg-upc-dg-loading-skeleton{100%{transform:translateX(100%)}}.mg-upc-dg-loading-skeleton{--base-color: #ebebeb;--highlight-color: #f5f5f5;--animation-duration: 1.5s;--animation-direction: normal;--pseudo-element-display: block;background-color:var(--base-color);width:100%;border-radius:.25rem;display:inline-flex;line-height:1;position:relative;overflow:hidden;z-index:1}.mg-upc-dg-loading-skeleton::after{content:" ";display:var(--pseudo-element-display);position:absolute;top:0;left:0;right:0;height:100%;background-repeat:no-repeat;background-image:linear-gradient(90deg, var(--base-color), var(--highlight-color), var(--base-color));transform:translateX(-100%);animation-name:mg-upc-dg-loading-skeleton;animation-direction:var(--animation-direction);animation-duration:var(--animation-duration);animation-timing-function:ease-in-out;animation-iteration-count:infinite}.mg-upc-dg-loading-skeleton,.mg-upc-dg-on-loading{display:none}.mg-upc-dg-status-loading .mg-upc-dg-list-desc,.mg-upc-dg-status-loading .mg-upc-dg-pagination-div,.mg-upc-dg-status-loading button{display:none}.mg-upc-dg-status-loading .mg-upc-dg-list-of-lists,.mg-upc-dg-status-loading .mg-upc-dg-list{visibility:hidden}.mg-upc-dg-status-loading .mg-upc-dg-on-loading{display:block}.mg-upc-dg-status-loading .mg-upc-dg-loading-skeleton{display:inline-flex}@keyframes share-animate{from{max-height:0;transform:scaleY(0);opacity:0}to{max-height:125px;transform:scaleY(1);opacity:1}}.mg-upc-dg-share-link{margin:1em 0;max-height:none;animation:share-animate .3s linear;text-align:center}.mg-upc-dg-share-link input{width:70%;font-size:16px;height:40px;border:none;background:#e2e2e2;color:#333;margin:0;display:inline-block;vertical-align:bottom;box-sizing:border-box}.mg-upc-dg-share-link button{width:30%;font-size:16px;padding:2px !important;height:40px !important;line-height:36px !important;border:none;display:inline-block;vertical-align:bottom;box-sizing:border-box}.mg-upc-dg-share-link .mg-upc-dg-share{display:inline-block;margin:2% 0}.mg-upc-zero-quantity{opacity:.3}.mg-upc-dg-quantity{width:4em;display:flex;flex-direction:column;text-align:center;margin:1em}.mg-upc-dg-quantity small{opacity:.5}.mg-upc-dg-quantity input{text-align:center}.mg-upc-err-required_logged_in .mg-list-new,.mg-upc-err-required_logged_in .mg-upc-dg-alert-close{display:none}.mg-upc-share-btn-img{height:64px;width:64px;display:inline-block;vertical-align:middle;background-size:100%}.mg-upc-share-link{display:block;text-align:right;margin:1em 0}.mg-upc-share-link::after{content:"";display:block;clear:both}.mg-upc-share{text-decoration:none}.mg-upc-dg-share:hover .mg-upc-share-btn-img,.mg-upc-dg-share:focus .mg-upc-share-btn-img,.mg-upc-share:hover .mg-upc-share-btn-img,.mg-upc-share:focus .mg-upc-share-btn-img{transform:scale(1.3);transition:transform .3s}.mg-upc-share-facebook{background-image:url("data:image/svg+xml,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 viewBox=%270 0 64 64%27 width=%2764%27 height=%2764%27%3E%3Crect width=%2764%27 height=%2764%27 rx=%270%27 ry=%270%27 fill=%27%233b5998%27%3E%3C/rect%3E%3Cpath d=%27M34.1,47V33.3h4.6l0.7-5.3h-5.3v-3.4c0-1.5,0.4-2.6,2.6-2.6l2.8,0v-4.8c-0.5-0.1-2.2-0.2-4.1-0.2 c-4.1,0-6.9,2.5-6.9,7V28H24v5.3h4.6V47H34.1z%27 fill=%27white%27%3E%3C/path%3E%3C/svg%3E")}.mg-upc-share-twitter{background-image:url("data:image/svg+xml,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 viewBox=%270 0 64 64%27 width=%2764%27 height=%2764%27%3E%3Crect width=%2764%27 height=%2764%27 rx=%270%27 ry=%270%27 fill=%27%230f1419%27%3E%3C/rect%3E%3Cpath d=%27M 41.116 18.375 h 4.962 l -10.8405 12.39 l 12.753 16.86 H 38.005 l -7.821 -10.2255 L 21.235 47.625 H 16.27 l 11.595 -13.2525 L 15.631 18.375 H 25.87 l 7.0695 9.3465 z m -1.7415 26.28 h 2.7495 L 24.376 21.189 H 21.4255 z%27 fill=%27white%27%3E%3C/path%3E%3C/svg%3E")}.mg-upc-share-whatsapp{background-image:url("data:image/svg+xml,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 viewBox=%270 0 64 64%27 width=%2764%27 height=%2764%27%3E%3Crect width=%2764%27 height=%2764%27 rx=%270%27 ry=%270%27 fill=%27%2325D366%27%3E%3C/rect%3E%3Cpath d=%27m42.32286,33.93287c-0.5178,-0.2589 -3.04726,-1.49644 -3.52105,-1.66732c-0.4712,-0.17346 -0.81554,-0.2589 -1.15987,0.2589c-0.34175,0.51004 -1.33075,1.66474 -1.63108,2.00648c-0.30032,0.33658 -0.60064,0.36247 -1.11327,0.12945c-0.5178,-0.2589 -2.17994,-0.80259 -4.14759,-2.56312c-1.53269,-1.37217 -2.56312,-3.05503 -2.86603,-3.57283c-0.30033,-0.5178 -0.03366,-0.80259 0.22524,-1.06149c0.23301,-0.23301 0.5178,-0.59547 0.7767,-0.90616c0.25372,-0.31068 0.33657,-0.5178 0.51262,-0.85437c0.17088,-0.36246 0.08544,-0.64725 -0.04402,-0.90615c-0.12945,-0.2589 -1.15987,-2.79613 -1.58964,-3.80584c-0.41424,-1.00971 -0.84142,-0.88027 -1.15987,-0.88027c-0.29773,-0.02588 -0.64208,-0.02588 -0.98382,-0.02588c-0.34693,0 -0.90616,0.12945 -1.37736,0.62136c-0.4712,0.5178 -1.80194,1.76053 -1.80194,4.27186c0,2.51134 1.84596,4.945 2.10227,5.30747c0.2589,0.33657 3.63497,5.51458 8.80262,7.74113c1.23237,0.5178 2.1903,0.82848 2.94111,1.08738c1.23237,0.38836 2.35599,0.33657 3.24402,0.20712c0.99159,-0.15534 3.04985,-1.24272 3.47963,-2.45956c0.44013,-1.21683 0.44013,-2.22654 0.31068,-2.45955c-0.12945,-0.23301 -0.46601,-0.36247 -0.98382,-0.59548m-9.40068,12.84407l-0.02589,0c-3.05503,0 -6.08417,-0.82849 -8.72495,-2.38189l-0.62136,-0.37023l-6.47252,1.68286l1.73463,-6.29129l-0.41424,-0.64725c-1.70875,-2.71846 -2.6149,-5.85116 -2.6149,-9.07706c0,-9.39809 7.68934,-17.06155 17.15993,-17.06155c4.58253,0 8.88029,1.78642 12.11655,5.02268c3.23625,3.21036 5.02267,7.50812 5.02267,12.06476c-0.0078,9.3981 -7.69712,17.06155 -17.14699,17.06155m14.58906,-31.58846c-3.93529,-3.80584 -9.1133,-5.95471 -14.62789,-5.95471c-11.36055,0 -20.60848,9.2065 -20.61625,20.52564c0,3.61684 0.94757,7.14565 2.75211,10.26282l-2.92557,10.63564l10.93337,-2.85309c3.0136,1.63108 6.4052,2.4958 9.85634,2.49839l0.01037,0c11.36574,0 20.61884,-9.2091 20.62403,-20.53082c0,-5.48093 -2.14111,-10.64081 -6.03239,-14.51915%27 fill=%27white%27%3E%3C/path%3E%3C/svg%3E")}.mg-upc-share-telegram{background-image:url("data:image/svg+xml,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 viewBox=%270 0 64 64%27 width=%2764%27 height=%2764%27%3E%3Crect width=%2764%27 height=%2764%27 rx=%270%27 ry=%270%27 fill=%27%2337aee2%27%3E%3C/rect%3E%3Cpath d=%27m45.90873,15.44335c-0.6901,-0.0281 -1.37668,0.14048 -1.96142,0.41265c-0.84989,0.32661 -8.63939,3.33986 -16.5237,6.39174c-3.9685,1.53296 -7.93349,3.06593 -10.98537,4.24067c-3.05012,1.1765 -5.34694,2.05098 -5.4681,2.09312c-0.80775,0.28096 -1.89996,0.63566 -2.82712,1.72788c-0.23354,0.27218 -0.46884,0.62161 -0.58825,1.10275c-0.11941,0.48114 -0.06673,1.09222 0.16682,1.5716c0.46533,0.96052 1.25376,1.35737 2.18443,1.71383c3.09051,0.99037 6.28638,1.93508 8.93263,2.8236c0.97632,3.44171 1.91401,6.89571 2.84116,10.34268c0.30554,0.69185 0.97105,0.94823 1.65764,0.95525l-0.00351,0.03512c0,0 0.53908,0.05268 1.06412,-0.07375c0.52679,-0.12292 1.18879,-0.42846 1.79109,-0.99212c0.662,-0.62161 2.45836,-2.38812 3.47683,-3.38552l7.6736,5.66477l0.06146,0.03512c0,0 0.84989,0.59703 2.09312,0.68132c0.62161,0.04214 1.4399,-0.07726 2.14229,-0.59176c0.70766,-0.51626 1.1765,-1.34683 1.396,-2.29506c0.65673,-2.86224 5.00979,-23.57745 5.75257,-27.00686l-0.02107,0.08077c0.51977,-1.93157 0.32837,-3.70159 -0.87096,-4.74991c-0.60054,-0.52152 -1.2924,-0.7498 -1.98425,-0.77965l0,0.00176zm-0.2072,3.29069c0.04741,0.0439 0.0439,0.0439 0.00351,0.04741c-0.01229,-0.00351 0.14048,0.2072 -0.15804,1.32576l-0.01229,0.04214l-0.00878,0.03863c-0.75858,3.50668 -5.15554,24.40802 -5.74203,26.96472c-0.08077,0.34417 -0.11414,0.31959 -0.09482,0.29852c-0.1756,-0.02634 -0.50045,-0.16506 -0.52679,-0.1756l-13.13468,-9.70175c4.4988,-4.33199 9.09945,-8.25307 13.744,-12.43229c0.8218,-0.41265 0.68483,-1.68573 -0.29852,-1.70681c-1.04305,0.24584 -1.92279,0.99564 -2.8798,1.47502c-5.49971,3.2626 -11.11882,6.13186 -16.55882,9.49279c-2.792,-0.97105 -5.57873,-1.77704 -8.15298,-2.57601c2.2336,-0.89555 4.00889,-1.55579 5.75608,-2.23009c3.05188,-1.1765 7.01687,-2.7042 10.98537,-4.24067c7.94051,-3.06944 15.92667,-6.16346 16.62028,-6.43037l0.05619,-0.02283l0.05268,-0.02283c0.19316,-0.0878 0.30378,-0.09658 0.35471,-0.10009c0,0 -0.01756,-0.05795 -0.00351,-0.04566l-0.00176,0zm-20.91715,22.0638l2.16687,1.60145c-0.93418,0.91311 -1.81743,1.77353 -2.45485,2.38812l0.28798,-3.98957%27 fill=%27white%27%3E%3C/path%3E%3C/svg%3E")}.mg-upc-share-line{background-image:url("data:image/svg+xml,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 viewBox=%270 0 64 64%27 width=%2764%27 height=%2764%27%3E%3Crect width=%2764%27 height=%2764%27 rx=%270%27 ry=%270%27 fill=%27%2300b800%27%3E%3C/rect%3E%3Cpath d=%27M52.62 30.138c0 3.693-1.432 7.019-4.42 10.296h.001c-4.326 4.979-14 11.044-16.201 11.972-2.2.927-1.876-.591-1.786-1.112l.294-1.765c.069-.527.142-1.343-.066-1.865-.232-.574-1.146-.872-1.817-1.016-9.909-1.31-17.245-8.238-17.245-16.51 0-9.226 9.251-16.733 20.62-16.733 11.37 0 20.62 7.507 20.62 16.733zM27.81 25.68h-1.446a.402.402 0 0 0-.402.401v8.985c0 .221.18.4.402.4h1.446a.401.401 0 0 0 .402-.4v-8.985a.402.402 0 0 0-.402-.401zm9.956 0H36.32a.402.402 0 0 0-.402.401v5.338L31.8 25.858a.39.39 0 0 0-.031-.04l-.002-.003-.024-.025-.008-.007a.313.313 0 0 0-.032-.026.255.255 0 0 1-.021-.014l-.012-.007-.021-.012-.013-.006-.023-.01-.013-.005-.024-.008-.014-.003-.023-.005-.017-.002-.021-.003-.021-.002h-1.46a.402.402 0 0 0-.402.401v8.985c0 .221.18.4.402.4h1.446a.401.401 0 0 0 .402-.4v-5.337l4.123 5.568c.028.04.063.072.101.099l.004.003a.236.236 0 0 0 .025.015l.012.006.019.01a.154.154 0 0 1 .019.008l.012.004.028.01.005.001a.442.442 0 0 0 .104.013h1.446a.4.4 0 0 0 .401-.4v-8.985a.402.402 0 0 0-.401-.401zm-13.442 7.537h-3.93v-7.136a.401.401 0 0 0-.401-.401h-1.447a.4.4 0 0 0-.401.401v8.984a.392.392 0 0 0 .123.29c.072.068.17.111.278.111h5.778a.4.4 0 0 0 .401-.401v-1.447a.401.401 0 0 0-.401-.401zm21.429-5.287c.222 0 .401-.18.401-.402v-1.446a.401.401 0 0 0-.401-.402h-5.778a.398.398 0 0 0-.279.113l-.005.004-.006.008a.397.397 0 0 0-.111.276v8.984c0 .108.043.206.112.278l.005.006a.401.401 0 0 0 .284.117h5.778a.4.4 0 0 0 .401-.401v-1.447a.401.401 0 0 0-.401-.401h-3.93v-1.519h3.93c.222 0 .401-.18.401-.402V29.85a.401.401 0 0 0-.401-.402h-3.93V27.93h3.93z%27 fill=%27white%27%3E%3C/path%3E%3C/svg%3E")}.mg-upc-share-email{background-image:url("data:image/svg+xml,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 viewBox=%270 0 64 64%27 width=%2764%27 height=%2764%27%3E%3Crect width=%2764%27 height=%2764%27 rx=%270%27 ry=%270%27 fill=%27%23b2b2b2%27%3E%3C/rect%3E%3Cpath d=%27M17,22v20h30V22H17z M41.1,25L32,32.1L22.9,25H41.1z M20,39V26.6l12,9.3l12-9.3V39H20z%27 fill=%27white%27%3E%3C/path%3E%3C/svg%3E")}.mg-upc-share-pinterest{background-image:url("data:image/svg+xml,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%2764%27 height=%2764%27%3E%3Crect width=%2764%27 height=%2764%27 rx=%270%27 ry=%270%27 fill=%27%23dc0000%27/%3E%3Cpath d=%27M32.9 12.4c-10.4 0-15.6 7.6-15.6 13.7 0 3.7 1.5 7.1 4.5 8.3.6.3 1 0 1.1-.5l.4-1.8c.2-.5.2-.8-.2-1.2-1-1-1.6-2.3-1.6-4.3 0-5.6 4.1-10.5 10.8-10.5 6 0 9.2 3.6 9.2 8.4 0 6.2-2.9 11.6-7 11.6-2.2 0-4-2-3.4-4.3.7-2.7 2-5.7 2-7.7 0-1.8-1-3.3-3-3.3-2.4 0-4.3 2.3-4.3 5.6 0 2 .7 3.4.7 3.4l-2.9 11.9c-.4 1.6-1 8.3-1 9.8.9.4 2.2-1.6 3.5-3.8.7-1.2 1.6-2.8 2-4.4l1.5-6c.7 1.5 3 2.7 5.3 2.7 7 0 11.8-6.4 11.8-15 0-6.5-5.5-12.6-13.8-12.6z%27 fill=%27%23fff%27 paint-order=%27fill markers stroke%27/%3E%3C/svg%3E")} -
user-post-collections/trunk/javascript/mg-upc-client/dist/main.js
r2856778 r3190768 1 (()=>{"use strict";var t,e,n,i,o,s,a ={},r=[],l=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i;function c(t,e){for(var n in e)t[n]=e[n];return t}function u(t){var e=t.parentNode;e&&e.removeChild(t)}function d(e,n,i){var o,s,a,r={};for(a in n)"key"==a?o=n[a]:"ref"==a?s=n[a]:r[a]=n[a];if(arguments.length>2&&(r.children=arguments.length>3?t.call(arguments,2):i),"function"==typeof e&&null!=e.defaultProps)for(a in e.defaultProps)void 0===r[a]&&(r[a]=e.defaultProps[a]);return p(e,r,o,s,null)}function p(t,i,o,s,a){var r={type:t,props:i,key:o,ref:s,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,__h:null,constructor:void 0,__v:null==a?++n:a};return null==a&&null!=e.vnode&&e.vnode(r),r}function _(t){return t.children}function m(t,e){this.props=t,this.context=e}function f(t,e){if(null==e)return t.__?f(t.__,t.__.__k.indexOf(t)+1):null;for(var n;e<t.__k.length;e++)if(null!=(n=t.__k[e])&&null!=n.__e)return n.__e;return"function"==typeof t.type?f(t):null}function g(t){var e,n;if(null!=(t=t.__)&&null!=t.__c){for(t.__e=t.__c.base=null,e=0;e<t.__k.length;e++)if(null!=(n=t.__k[e])&&null!=n.__e){t.__e=t.__c.base=n.__e;break}return g(t)}}function h(t){(!t.__d&&(t.__d=!0)&&i.push(t)&&!v.__r++||o!==e.debounceRendering)&&((o=e.debounceRendering)||setTimeout)(v)}function v(){for(var t;v.__r=i.length;)t=i.sort((function(t,e){return t.__v.__b-e.__v.__b})),i=[],t.some((function(t){var e,n,i,o,s,a;t.__d&&(s=(o=(e=t).__v).__e,(a=e.__P)&&(n=[],(i=c({},o)).__v=o.__v+1,I(a,o,i,e.__n,void 0!==a.ownerSVGElement,null!=o.__h?[s]:null,n,null==s?f(o):s,o.__h),S(n,o),o.__e!=s&&g(o)))}))}function y(t,e,n,i,o,s,l,c,u,d){var m,g,h,v,y,w,k,N=i&&i.__k||r,C=N.length;for(n.__k=[],m=0;m<e.length;m++)if(null!=(v=n.__k[m]=null==(v=e[m])||"boolean"==typeof v?null:"string"==typeof v||"number"==typeof v||"bigint"==typeof v?p(null,v,null,null,v):Array.isArray(v)?p(_,{children:v},null,null,null):v.__b>0?p(v.type,v.props,v.key,null,v.__v):v)){if(v.__=n,v.__b=n.__b+1,null===(h=N[m])||h&&v.key==h.key&&v.type===h.type)N[m]=void 0;else for(g=0;g<C;g++){if((h=N[g])&&v.key==h.key&&v.type===h.type){N[g]=void 0;break}h=null}I(t,v,h=h||a,o,s,l,c,u,d),y=v.__e,(g=v.ref)&&h.ref!=g&&(k||(k=[]),h.ref&&k.push(h.ref,null,v),k.push(g,v.__c||y,v)),null!=y?(null==w&&(w=y),"function"==typeof v.type&&v.__k===h.__k?v.__d=u=b(v,u,t):u=P(t,v,h,N,y,u),"function"==typeof n.type&&(n.__d=u)):u&&h.__e==u&&u.parentNode!=t&&(u=f(h))}for(n.__e=w,m=C;m--;)null!=N[m]&&("function"==typeof n.type&&null!=N[m].__e&&N[m].__e==n.__d&&(n.__d=f(i,m+1)),E(N[m],N[m]));if(k)for(m=0;m<k.length;m++)A(k[m],k[++m],k[++m])}function b(t,e,n){for(var i,o=t.__k,s=0;o&&s<o.length;s++)(i=o[s])&&(i.__=t,e="function"==typeof i.type?b(i,e,n):P(n,i,i,o,i.__e,e));return e}function w(t,e){return e=e||[],null==t||"boolean"==typeof t||(Array.isArray(t)?t.some((function(t){w(t,e)})):e.push(t)),e}function P(t,e,n,i,o,s){var a,r,l;if(void 0!==e.__d)a=e.__d,e.__d=void 0;else if(null==n||o!=s||null==o.parentNode)t:if(null==s||s.parentNode!==t)t.appendChild(o),a=null;else{for(r=s,l=0;(r=r.nextSibling)&&l<i.length;l+=2)if(r==o)break t;t.insertBefore(o,s),a=s}return void 0!==a?a:o.nextSibling}function k(t,e,n){"-"===e[0]?t.setProperty(e,n):t[e]=null==n?"":"number"!=typeof n||l.test(e)?n:n+"px"}function N(t,e,n,i,o){var s;t:if("style"===e)if("string"==typeof n)t.style.cssText=n;else{if("string"==typeof i&&(t.style.cssText=i=""),i)for(e in i)n&&e in n||k(t.style,e,"");if(n)for(e in n)i&&n[e]===i[e]||k(t.style,e,n[e])}else if("o"===e[0]&&"n"===e[1])s=e!==(e=e.replace(/Capture$/,"")),e=e.toLowerCase()in t?e.toLowerCase().slice(2):e.slice(2),t.l||(t.l={}),t.l[e+s]=n,n?i||t.addEventListener(e,s?x:C,s):t.removeEventListener(e,s?x:C,s);else if("dangerouslySetInnerHTML"!==e){if(o)e=e.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if("href"!==e&&"list"!==e&&"form"!==e&&"tabIndex"!==e&&"download"!==e&&e in t)try{t[e]=null==n?"":n;break t}catch(t){}"function"==typeof n||(null!=n&&(!1!==n||"a"===e[0]&&"r"===e[1])?t.setAttribute(e,n):t.removeAttribute(e))}}function C(t){this.l[t.type+!1](e.event?e.event(t):t)}function x(t){this.l[t.type+!0](e.event?e.event(t):t)}function I(t,n,i,o,s,a,r,l,u){var d,p,f,g,h,v,b,w,P,k,N,C,x,I=n.type;if(void 0!==n.constructor)return null;null!=i.__h&&(u=i.__h,l=n.__e=i.__e,n.__h=null,a=[l]),(d=e.__b)&&d(n);try{t:if("function"==typeof I){if(w=n.props,P=(d=I.contextType)&&o[d.__c],k=d?P?P.props.value:d.__:o,i.__c?b=(p=n.__c=i.__c).__=p.__E:("prototype"in I&&I.prototype.render?n.__c=p=new I(w,k):(n.__c=p=new m(w,k),p.constructor=I,p.render=L),P&&P.sub(p),p.props=w,p.state||(p.state={}),p.context=k,p.__n=o,f=p.__d=!0,p.__h=[]),null==p.__s&&(p.__s=p.state),null!=I.getDerivedStateFromProps&&(p.__s==p.state&&(p.__s=c({},p.__s)),c(p.__s,I.getDerivedStateFromProps(w,p.__s))),g=p.props,h=p.state,f)null==I.getDerivedStateFromProps&&null!=p.componentWillMount&&p.componentWillMount(),null!=p.componentDidMount&&p.__h.push(p.componentDidMount);else{if(null==I.getDerivedStateFromProps&&w!==g&&null!=p.componentWillReceiveProps&&p.componentWillReceiveProps(w,k),!p.__e&&null!=p.shouldComponentUpdate&&!1===p.shouldComponentUpdate(w,p.__s,k)||n.__v===i.__v){p.props=w,p.state=p.__s,n.__v!==i.__v&&(p.__d=!1),p.__v=n,n.__e=i.__e,n.__k=i.__k,n.__k.forEach((function(t){t&&(t.__=n)})),p.__h.length&&r.push(p);break t}null!=p.componentWillUpdate&&p.componentWillUpdate(w,p.__s,k),null!=p.componentDidUpdate&&p.__h.push((function(){p.componentDidUpdate(g,h,v)}))}if(p.context=k,p.props=w,p.__v=n,p.__P=t,N=e.__r,C=0,"prototype"in I&&I.prototype.render)p.state=p.__s,p.__d=!1,N&&N(n),d=p.render(p.props,p.state,p.context);else do{p.__d=!1,N&&N(n),d=p.render(p.props,p.state,p.context),p.state=p.__s}while(p.__d&&++C<25);p.state=p.__s,null!=p.getChildContext&&(o=c(c({},o),p.getChildContext())),f||null==p.getSnapshotBeforeUpdate||(v=p.getSnapshotBeforeUpdate(g,h)),x=null!=d&&d.type===_&&null==d.key?d.props.children:d,y(t,Array.isArray(x)?x:[x],n,i,o,s,a,r,l,u),p.base=n.__e,n.__h=null,p.__h.length&&r.push(p),b&&(p.__E=p.__=null),p.__e=!1}else null==a&&n.__v===i.__v?(n.__k=i.__k,n.__e=i.__e):n.__e=T(i.__e,n,i,o,s,a,r,u);(d=e.diffed)&&d(n)}catch(t){n.__v=null,(u||null!=a)&&(n.__e=l,n.__h=!!u,a[a.indexOf(l)]=null),e.__e(t,n,i)}}function S(t,n){e.__c&&e.__c(n,t),t.some((function(n){try{t=n.__h,n.__h=[],t.some((function(t){t.call(n)}))}catch(t){e.__e(t,n.__v)}}))}function T(e,n,i,o,s,r,l,c){var d,p,_,m=i.props,g=n.props,h=n.type,v=0;if("svg"===h&&(s=!0),null!=r)for(;v<r.length;v++)if((d=r[v])&&"setAttribute"in d==!!h&&(h?d.localName===h:3===d.nodeType)){e=d,r[v]=null;break}if(null==e){if(null===h)return document.createTextNode(g);e=s?document.createElementNS("http://www.w3.org/2000/svg",h):document.createElement(h,g.is&&g),r=null,c=!1}if(null===h)m===g||c&&e.data===g||(e.data=g);else{if(r=r&&t.call(e.childNodes),p=(m=i.props||a).dangerouslySetInnerHTML,_=g.dangerouslySetInnerHTML,!c){if(null!=r)for(m={},v=0;v<e.attributes.length;v++)m[e.attributes[v].name]=e.attributes[v].value;(_||p)&&(_&&(p&&_.__html==p.__html||_.__html===e.innerHTML)||(e.innerHTML=_&&_.__html||""))}if(function(t,e,n,i,o){var s;for(s in n)"children"===s||"key"===s||s in e||N(t,s,null,n[s],i);for(s in e)o&&"function"!=typeof e[s]||"children"===s||"key"===s||"value"===s||"checked"===s||n[s]===e[s]||N(t,s,e[s],n[s],i)}(e,g,m,s,c),_)n.__k=[];else if(v=n.props.children,y(e,Array.isArray(v)?v:[v],n,i,o,s&&"foreignObject"!==h,r,l,r?r[0]:i.__k&&f(i,0),c),null!=r)for(v=r.length;v--;)null!=r[v]&&u(r[v]);c||("value"in g&&void 0!==(v=g.value)&&(v!==e.value||"progress"===h&&!v||"option"===h&&v!==m.value)&&N(e,"value",v,m.value,!1),"checked"in g&&void 0!==(v=g.checked)&&v!==e.checked&&N(e,"checked",v,m.checked,!1))}return e}function A(t,n,i){try{"function"==typeof t?t(n):t.current=n}catch(t){e.__e(t,i)}}function E(t,n,i){var o,s;if(e.unmount&&e.unmount(t),(o=t.ref)&&(o.current&&o.current!==t.__e||A(o,null,n)),null!=(o=t.__c)){if(o.componentWillUnmount)try{o.componentWillUnmount()}catch(t){e.__e(t,n)}o.base=o.__P=null}if(o=t.__k)for(s=0;s<o.length;s++)o[s]&&E(o[s],n,"function"!=typeof t.type);i||null==t.__e||u(t.__e),t.__e=t.__d=void 0}function L(t,e,n){return this.constructor(t,n)}function D(n,i,o){var s,r,l;e.__&&e.__(n,i),r=(s="function"==typeof o)?null:o&&o.__k||i.__k,l=[],I(i,n=(!s&&o||i).__k=d(_,null,[n]),r||a,a,void 0!==i.ownerSVGElement,!s&&o?[o]:r?null:i.firstChild?t.call(i.childNodes):null,l,!s&&o?o:r?r.__e:i.firstChild,s),S(l,n)}t=r.slice,e={__e:function(t,e,n,i){for(var o,s,a;e=e.__;)if((o=e.__c)&&!o.__)try{if((s=o.constructor)&&null!=s.getDerivedStateFromError&&(o.setState(s.getDerivedStateFromError(t)),a=o.__d),null!=o.componentDidCatch&&(o.componentDidCatch(t,i||{}),a=o.__d),a)return o.__E=o}catch(e){t=e}throw t}},n=0,m.prototype.setState=function(t,e){var n;n=null!=this.__s&&this.__s!==this.state?this.__s:this.__s=c({},this.state),"function"==typeof t&&(t=t(c({},n),this.props)),t&&c(n,t),null!=t&&this.__v&&(e&&this.__h.push(e),h(this))},m.prototype.forceUpdate=function(t){this.__v&&(this.__e=!0,t&&this.__h.push(t),h(this))},m.prototype.render=_,i=[],v.__r=0,s=0;var O,j,U,R,W=0,H=[],$=[],M=e.__b,Q=e.__r,F=e.diffed,B=e.__c,q=e.unmount;function V(t,n){e.__h&&e.__h(j,t,W||n),W=0;var i=j.__H||(j.__H={__:[],__h:[]});return t>=i.__.length&&i.__.push({__V:$}),i.__[t]}function X(t){return W=1,K(st,t)}function K(t,e,n){var i=V(O++,2);if(i.t=t,!i.__c&&(i.__=[n?n(e):st(void 0,e),function(t){var e=i.__N?i.__N[0]:i.__[0],n=i.t(e,t);e!==n&&(i.__N=[n,i.__[1]],i.__c.setState({}))}],i.__c=j,!i.__c.u)){i.__c.__H.u=!0;var o=i.__c.shouldComponentUpdate;i.__c.shouldComponentUpdate=function(t,e,n){if(!i.__c.__H)return!0;var s=i.__c.__H.__.filter((function(t){return t.__c}));return(s.every((function(t){return!t.__N}))||!s.every((function(t){if(!t.__N)return!0;var e=t.__[0];return t.__=t.__N,t.__N=void 0,e===t.__[0]})))&&(!o||o(t,e,n))}}return i.__N||i.__}function G(t,n){var i=V(O++,3);!e.__s&&ot(i.__H,n)&&(i.__=t,i.i=n,j.__H.__h.push(i))}function z(t){return W=5,J((function(){return{current:t}}),[])}function J(t,e){var n=V(O++,7);return ot(n.__H,e)?(n.__V=t(),n.i=e,n.__h=t,n.__V):n.__}function Y(t,e){return W=8,J((function(){return t}),e)}function Z(t){var e=j.context[t.__c],n=V(O++,9);return n.c=t,e?(null==n.__&&(n.__=!0,e.sub(j)),e.props.value):t.__}function tt(){for(var t;t=H.shift();)if(t.__P&&t.__H)try{t.__H.__h.forEach(nt),t.__H.__h.forEach(it),t.__H.__h=[]}catch(n){t.__H.__h=[],e.__e(n,t.__v)}}e.__b=function(t){j=null,M&&M(t)},e.__r=function(t){Q&&Q(t),O=0;var e=(j=t.__c).__H;e&&(U===j?(e.__h=[],j.__h=[],e.__.forEach((function(t){t.__N&&(t.__=t.__N),t.__V=$,t.__N=t.i=void 0}))):(e.__h.forEach(nt),e.__h.forEach(it),e.__h=[])),U=j},e.diffed=function(t){F&&F(t);var n=t.__c;n&&n.__H&&(n.__H.__h.length&&(1!==H.push(n)&&R===e.requestAnimationFrame||((R=e.requestAnimationFrame)||function(t){var e,n=function(){clearTimeout(i),et&&cancelAnimationFrame(e),setTimeout(t)},i=setTimeout(n,100);et&&(e=requestAnimationFrame(n))})(tt)),n.__H.__.forEach((function(t){t.i&&(t.__H=t.i),t.__V!==$&&(t.__=t.__V),t.i=void 0,t.__V=$}))),U=j=null},e.__c=function(t,n){n.some((function(t){try{t.__h.forEach(nt),t.__h=t.__h.filter((function(t){return!t.__||it(t)}))}catch(i){n.some((function(t){t.__h&&(t.__h=[])})),n=[],e.__e(i,t.__v)}})),B&&B(t,n)},e.unmount=function(t){q&&q(t);var n,i=t.__c;i&&i.__H&&(i.__H.__.forEach((function(t){try{nt(t)}catch(t){n=t}})),n&&e.__e(n,i.__v))};var et="function"==typeof requestAnimationFrame;function nt(t){var e=j,n=t.__c;"function"==typeof n&&(t.__c=void 0,n()),j=e}function it(t){var e=j;t.__c=t.__(),j=e}function ot(t,e){return!t||t.length!==e.length||e.some((function(e,n){return e!==t[n]}))}function st(t,e){return"function"==typeof e?e(t):e}const at=function(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return MgUpcTexts&&MgUpcTexts[t]?e?e.reduce((function(t,e){return t.replace(/%s/,e)}),MgUpcTexts[t]):MgUpcTexts[t]:t},rt="ui/reset",lt="ui/error",ct="ui/message",ut="ui/editing",dt="listOfLists/set",pt="listOfLists/remove",_t="listOfLists/create",mt="listOfList/addingPost",ft="listOfList/setPage",gt="listOfList/setTotalPages",ht="list/set",vt="list/update",yt="list/setPage",bt="list/setTotalPages",wt="list/setItems",Pt="list/removeItem",kt="list/addItem",Nt="list/updateItem",Ct="list/moveItem",xt="list/cart",It=async function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"mg-upc/v1/lists";if(void 0===Dt().nonce){const t=new FormData;t.append("action","mg_upc_user");const e={method:"POST",credentials:"same-origin",referrerPolicy:"no-referrer",body:t},n=await fetch(Dt().ajaxUrl,e),i=await n.json();i.nonce&&(Dt().nonce=i.nonce),i.user_id&&(Dt().user_id=i.user_id)}const o={method:t,credentials:"same-origin",headers:{"Content-Type":"application/json","X-WP-Nonce":Dt().nonce},referrerPolicy:"no-referrer"};"GET"!==t&&n&&(o.body=JSON.stringify(n));const s=await fetch(Dt().root+i+e,o);s.headers.get("x-wp-nonce")&&(Dt().nonce=s.headers.get("x-wp-nonce"));const a=await s.json();return{data:a,headers:s.headers,status:s.status}};function St(t){const e=Object.entries(t).filter((t=>{let[,e]=t;return null!=e})).map((t=>{let[e,n]=t;return`${encodeURIComponent(e)}=${encodeURIComponent(String(n))}`})),n=-1!==Dt().root.indexOf("?")?"&":"?";return e.length>0?`${n}${e.join("&")}`:""}class Tt extends Error{constructor(t,e){var n;super(t),this.name="MgApiError",this.code=null==e||null===(n=e.data)||void 0===n?void 0:n.code,this.response=e}}function At(t){var e,n;let i=null==t||null===(e=t.data)||void 0===e||null===(n=e.data)||void 0===n?void 0:n.status;var o;if(!i&&t.status&&(i=t.status),400===i||401===i||403===i||404===i||409===i||500===i)throw new Tt(null==t||null===(o=t.data)||void 0===o?void 0:o.message,t)}let Et={my:function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return It("GET","/My"+St(t),{}).then((function(t){return At(t),t}))},discover:function(t){return It("GET","/"+St(t),{}).then((function(t){return At(t),t}))},get:function(t){return It("GET","/"+t,{}).then((function(t){return At(t),t}))},cart:function(t){return It("POST","/cart",{list:t},"mg-upc/v1").then((function(t){return At(t),t}))},items:function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return It("GET","/"+t+"/items"+St(e),{}).then((function(t){return At(t),t}))},delete:function(t){return It("DELETE","/"+t,{}).then((function(t){return At(t),t}))},create:function(t){return It("POST","",t).then((function(t){return At(t),t}))},update:function(t){let e=t.id;return delete t.id,It("PATCH","/"+e,t).then((function(t){return At(t),t}))},add:function(t,e){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return"object"!=typeof e&&(e={post_id:e}),It("POST","/"+t+"/items"+St(n),e).then((function(t){return At(t),t}))},quit:function(t,e){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return It("DELETE","/"+t+"/items/"+e+St(n),{}).then((function(t){return At(t),t}))},updateItem:function(t,e,n){return It("PATCH","/"+t+"/items/"+e,n).then((function(t){return At(t),t}))},vote:function(t,e){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return It("POST","/"+t+"/items/"+e+"/vote",n).then((function(t){return At(t),t}))},move:function(t,e,n){return It("PATCH","/"+t+"/items/"+e,{position:n}).then((function(t){return At(t),t}))}};const Lt=Et;function Dt(){return MgUserPostCollections}function Ot(){var t;return null===(t=Dt())||void 0===t?void 0:t.sortable}function jt(t){var e;const n=null===(e=Dt())||void 0===e?void 0:e.types;return!(!n||!n[t])&&n[t]}function Ut(t){var e;const n=null===(e=Dt())||void 0===e?void 0:e.statuses;return!(!n||!n[t])&&n[t]}function Rt(t,e){return!!t.type&&Ht(t.type,e)}function Wt(t){var e;const n=[],i=null===(e=Dt())||void 0===e?void 0:e.types;for(const e in i)i.hasOwnProperty(e)&&(Ht(e,"always_exists")||(null!=t&&t.type?i[e].available_post_types.includes(t.type)&&n.push(i[e]):n.push(i[e])));return n}function Ht(t,e){const n=jt(t);return!(!n||!n.supports)&&n.supports.includes(e)}const $t="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVQYV2NgYAAAAAMAAWgmWQ0AAAAASUVORK5CYII=";function Mt(t){return JSON.parse(JSON.stringify(t))}function Qt(t){return"string"!=typeof t?"":t.replace(/([^>\r\n]?)(\r\n|\n\r|\r|\n)/g,"$1<br>$2")}function Ft(t){return Lt.cart(t).then((t=>(jQuery&&t.data.fragments&&t.data.cart_hash&&jQuery(document.body).trigger("added_to_cart",[t.data.fragments,t.data.cart_hash]),t.data)))}function Bt(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"error";if(!jQuery)return!1;const n=jQuery("<div>").addClass("mg-upc-alert mg-upc-alert-"+e);n.append(jQuery("<p>").html(t));const i=jQuery('<a class="mg-upc-alert-close" href="#"><span class="mg-upc-icon upc-font-close"></span></a>').on("click",(function(){return n.remove(),!1}));return n.append(i),n}function qt(t,e){const{type:n,payload:i}=e;let o=!1;const s=t=>(o=a({status:"failed"}),t.error&&(o.error=t.error.message?t.error.message:"",o.errorCode=t.error.code?t.error.code:""),o),a=function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(o||(o=Mt(t)),e)for(const t in e)e.hasOwnProperty(t)&&(o[t]=e[t]);return o};let r=function(t,e){const{type:n,payload:i}=e;let o,s;const a=function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(s||(s=!1===t?{}:Mt(t)),e)for(const t in e)s[t]=e[t];return s};switch(n){case ht:return!0===i?{ID:-1,title:"",content:"",status:"",type:""}:i;case vt:return i.items=Mt(t.items),i;case _t:return i;case wt:return a({items:i});case"list/addItem/failed":case kt:return null!=i&&i.list?a(i.list):t;case Nt:const e=!!i.item&&i.item;return o=a().items.map((t=>t.post_id===i.post_id?e||Object.assign({},t,i):{...t})),a({items:o});case Pt:if(!t.items||1===t.items.length||!1===i)return t;if(s=a(),o=s.items.filter((t=>t.post_id!==i)),Ht(t.type,"sortable")){const e=parseInt(t.items[0].position,10);o.forEach(((t,n)=>{o[n].position=e+n}))}if(Ht(t.type,"vote")){const e=t.items.find((t=>t.post_id==i));e&&(s.vote_counter=s.vote_counter-e.votes)}return{...s,items:o};case Ct:const n=parseInt(t.items[0].position,10);o=a().items.slice();const r=a().items[i.oldIndex];return o.splice(i.oldIndex,1),o.splice(i.newIndex,0,r),isNaN(n)?(alert("positions error!"),t):(o.forEach(((t,e)=>{o[e].position=n+e})),a({items:o}));default:return t}}(t.list,e),l=function(t,e){const{type:n,payload:i}=e;switch(n){case dt:return i;case kt:case ht:return!1;case pt:return!1===i?t:Mt(t.filter((t=>t.ID!=i)));default:return t}}(t.listOfList,e);switch(t.list===r&&l===t.listOfList||(o=a({listOfList:l,list:r}),t.addingPost||(o.title=o.list?o.list.title:Gt.title)),n){case"ui/mode":return a({mode:i});case rt:return{...Gt,mode:t.mode};case lt:return a(!1===i?{error:!1,errorCode:!1}:{error:i});case ct:return a(!1===i?{message:!1,errorCode:!1}:{message:i});case xt:const n=a();return i.msg&&(n.message=i.msg),i.err&&(n.error=i.err),n;case ut:return a({editing:i});case mt:return o=a(),o.addingPost=i,i&&(o.title=at("Add to...")),o;case _t:o=a(),o.title=i.title?i.title:Gt.title,o.listTotalPages=1,o.listPage=1,o.addingPost=!1;break;case kt:if(o=a(),null!=i&&i.list){const t=i.list;o.title=t.title?t.title:Gt.title;const e=null==t?void 0:t.items_page;e&&(o.listTotalPages=e["X-WP-TotalPages"]?e["X-WP-TotalPages"]:1,o.listPage=e["X-WP-Page"]?e["X-WP-Page"]:1)}i.message&&(o.error=i.message,o.status="failed"),o.addingPost=!1;break;case ft:return a({page:i});case gt:return a({totalPages:i});case yt:return a({listPage:i});case bt:return a({listTotalPages:i});case"list/set/loading":return o=a(),o.status="loading",o.listOfList=!1,"object"==typeof i?(o.list=i,i.title&&(o.title=i.title)):o.list={ID:i},o;case"list/removeItem/loading":return o=a({status:"loading"}),"object"==typeof i&&i.list_id&&(o.list={ID:i.list_id}),o;case"listOfLists/set/loading":case"list/setItems/loading":case"list/updateItem/loading":case"list/addItem/loading":case"list/moveItemNext/loading":case"list/moveItemPrev/loading":case"list/update/loading":case _t+"/loading":case"list/cart/loading":return a({status:"loading"});case"list/addItem/succeeded":return o=a(),o.addingPost=!1,o.status="succeeded",o.error=!1,o.errorCode=!1,o.title=o.list?o.list.title:Gt.title,o;case"list/cart/succeeded":return a({status:"succeeded",errorCode:!1});case"list/set/succeeded":if(!1===t.list)break;return a({status:"succeeded",error:!1,errorCode:!1});case"listOfLists/set/succeeded":case"list/setItems/succeeded":case"list/updateItem/succeeded":case"list/removeItem/succeeded":case"list/moveItem/succeeded":case"list/moveItemNext/succeeded":case"list/moveItemPrev/succeeded":case"list/update/succeeded":case _t+"/succeeded":return a({status:"succeeded",error:!1,errorCode:!1});case _t+"/failed":return o=a({status:"failed"}),e.error&&e.error.message&&(o.error=e.error.message),o;case"list/addItem/failed":if(o=a(),o.addingPost=!1,o.title=o.list?o.list.title:Gt.title,null!=i&&i.list){const t=i.list;o.title=t.title?t.title:Gt.title;const e=null==t?void 0:t.items_page;e&&(o.listTotalPages=e["X-WP-TotalPages"]?e["X-WP-TotalPages"]:1,o.listPage=e["X-WP-Page"]?e["X-WP-Page"]:1)}return i.message&&(o.error=i.message,o.status="failed"),s(e);case"listOfLists/set/failed":case"list/setItems/failed":case"list/updateItem/failed":case"list/removeItem/failed":case"list/moveItem/failed":case"list/moveItemNext/failed":case"list/moveItemPrev/failed":case"list/update/failed":case"list/set/failed":case"list/cart/failed":return s(e)}return!1!==o?o:t}const Vt=(t,e)=>function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;for(var i=arguments.length,o=new Array(i>1?i-1:0),s=1;s<i;s++)o[s-1]=arguments[s];return{asyncThunk:!0,payload:e,type:t,arg:n,extra:o}};class Xt extends Error{constructor(t,e){super(t),this.name="MgUpcRejectWithValue",this.value=e}}const Kt=(t,e)=>n=>{let i;if((o=n)&&"object"==typeof o&&!0===o.asyncThunk){let o={dispatch:Kt(t,e),getState:e,extra:n.extra,rejectWithValue:t=>new Xt(n.type+": rejectWithValue",t)};t({type:n.type+"/loading",payload:n.arg}),i=n.payload(n.arg,o)}else{if(!(t=>!!t&&("object"==typeof t||"function"==typeof t)&&"function"==typeof t.then)(n.payload))return void t(n);t({type:n.type+"/loading"}),i=n.payload}var o;i.then((e=>{e instanceof Xt?t({type:n.type+"/failed",payload:e.value}):(t({type:n.type,payload:e}),t({type:n.type+"/succeeded"}))})).catch((e=>{t(e instanceof Xt?{type:n.type+"/failed",payload:e.value}:{type:n.type+"/failed",error:e})}))},Gt={list:!1,listOfList:!1,addingPost:null,status:"idle",error:null,message:null,errorCode:null,editing:!1,title:at("My Lists"),actualAction:"init",page:1,totalPages:1,listPage:1,listTotalPages:1,mode:"my"},zt=function(t,e){var n={__c:e="__cC"+s++,__:t,Consumer:function(t,e){return t.children(e)},Provider:function(t){var n,i;return this.getChildContext||(n=[],(i={})[e]=this,this.getChildContext=function(){return i},this.shouldComponentUpdate=function(t){this.props.value!==t.value&&n.some(h)},this.sub=function(t){n.push(t);var e=t.componentWillUnmount;t.componentWillUnmount=function(){n.splice(n.indexOf(t),1),e&&e.call(t)}}),t.children}};return n.Provider.__=n.Consumer.contextType=n}({});function Jt(t){return new Date(t).toLocaleDateString()}const Yt=function(t){const{state:e,dispatch:n}=Z(zt);return d("li",{className:"mg-upc-dg-item-list",onClick:t.onClick,onKeyPress:e=>{13===e.keyCode&&t.onClick(e)},tabIndex:"0"},d("i",{className:"mg-upc-icon mg-upc-dg-item-type mg-upc-dg-item-type-"+t.list.type}),d("div",{className:"mg-upc-dg-item-title"},d("span",null,t.list.title),"my"!==e.mode&&d(_,null,d("span",null,d("a",{href:"#",onClick:function(e){!function(t){t.stopImmediatePropagation&&t.stopImmediatePropagation(),t.stopPropagation&&t.stopPropagation(),t.preventDefault()}(e),function(t,e){const n=new URLSearchParams(document.location.hash.substring(1));n.set("author",e);let i=n.toString();""!==i&&(i="#"+i),window.location.hash=i}(0,t.list.author)}},t.list.user_login),d("span",{className:"mg-upc-list-dates"},d("i",null," ",d("b",null,"Created:")," ",Jt(t.list.created)),d("i",null," ",d("b",null,"Modified:")," ",Jt(t.list.modified)))))),d("span",{className:"mg-upc-dg-item-count"},t.list.count),d("span",{className:"mg-upc-dg-item-actions"},t.onRemove&&d("button",{"aria-label":at("Remove List"),onClick:e=>{e.stopPropagation(),t.onRemove(t.list)}},d("span",{className:"mg-upc-icon upc-font-trash"}))))};class Zt extends m{render(){const t=[];for(let e=0;e<this.props.count;e++){let n=this.props.styles?this.props.styles:{};null!=this.props.width&&(n.width=this.props.width),null!=this.props.height&&(n.height=this.props.height),null!==this.props.width&&null!==this.props.height&&this.props.circle&&(n.borderRadius="50%"),t.push(d("span",{key:e,className:"mg-upc-dg-loading-skeleton",style:n},""))}const e=this.props.wrapper;return d("span",null,e?t.map(((t,n)=>d(e,{key:n},t,""))):t)}}var te,ee,ne;ne={count:1,duration:1.2,width:null,wrapper:null,height:null,circle:!1},(ee="defaultProps")in(te=Zt)?Object.defineProperty(te,ee,{value:ne,enumerable:!0,configurable:!0,writable:!0}):te[ee]=ne;const ie=function(t){return d("div",{className:"mg-upc-dg-pagination-div"},d("button",{className:1===t.page?"mg-upc-dg-hidden mg-upc-dg-pagination":"mg-upc-dg-pagination",ref:t.prevRef,disabled:1===t.page,"aria-label":at("Previous page"),title:at("Previous page"),onClick:t.onPreview},d("span",{className:"mg-upc-icon upc-font-arrow_left"})),d("span",{className:t.totalPages>1?"mg-upc-dg-pagination-current":"mg-upc-dg-hidden mg-upc-dg-pagination-current"},t.page),d("button",{className:t.page>=t.totalPages?"mg-upc-dg-hidden mg-upc-dg-pagination":"mg-upc-dg-pagination",ref:t.nextRef,disabled:t.page>=t.totalPages,"aria-label":at("Next page"),title:at("Next page"),onClick:t.onNext},d("span",{className:"mg-upc-icon upc-font-arrow_right"})))},oe=()=>({type:rt,payload:null}),se=t=>({type:mt,payload:t}),ae=t=>({type:ut,payload:t}),re=Vt(xt,(async function(t,e){return await Ft(t)})),le=Vt(dt,(async function(t,e){var n;const i=null===(n=t)||void 0===n?void 0:n.addingPost;return null===t&&(t={}),t.addingPost?t.adding=t.addingPost:(t.adding="",delete t.adding),await Lt.my(t).then((t=>ce(t,e,i)))}));function ce(t,e,n){if(t.headers.get("x-wp-page")&&(e.dispatch(de(parseInt(t.headers.get("x-wp-page"),10))),e.dispatch(pe(parseInt(t.headers.get("X-WP-TotalPages"),10)))),n&&t.headers.get("X-WP-Post-Type")){const i={post_id:n},o={"X-WP-Post-Type":"type","X-WP-Post-Title":"title","X-WP-Post-Image":"image"};for(const e in o){const n=t.headers.get(e);n&&(i[o[e]]=decodeURIComponent(n))}e.dispatch(se(i))}return t.data}Vt(dt,(async function(t,e){return null===t&&(t={}),await Lt.discover(t).then((t=>ce(t,e,!1)))}));const ue=Vt(pt,(async function(t,e){return await Lt.delete(t).then((n=>{if(1===e.getState().listOfList.length){const n=e.getState().page,i=e.getState().totalPages;if(n<i)e.dispatch(le({page:n}));else{if(!(n>1&&n===i))return t;e.dispatch(le({page:n-1}))}return!1}return t}))})),de=t=>({type:ft,payload:t}),pe=t=>({type:gt,payload:t}),_e=t=>({type:yt,payload:t}),me=t=>({type:bt,payload:t}),fe=Vt(ht,(async function(t,e){return!1===t||!0===t?t:await Lt.get("object"==typeof t?t.ID:t).then((t=>(Ce(t,e.dispatch),t.data)))})),ge=Vt(vt,(async function(t,e){return await Lt.update(t).then((t=>(e.dispatch(ae(!1)),Ce(t,e.dispatch),t.data)))})),he=Vt(_t,(async function(t,e){return null===t&&(t={}),t.adding&&t.adding!==e.getState().addingPost&&e.dispatch(se({id:t.addingPost})),await Lt.create(t).then((t=>(e.dispatch(ae(!1)),Ce(t,e.dispatch),t.data)))})),ve=Vt(wt,(async function(t,e){return await Lt.items(e.getState().list.ID,t).then((t=>(Ce(t,e.dispatch),t.data)))})),ye=Vt(Pt,(async function(t,e){const n=e.getState();var i=e.extra.length>0?e.extra[0]:n.list.ID;const o=e.extra.length>1?e.extra[1]:"view";return await Lt.quit(i,t,{context:o}).then((s=>{if(s.data&&s.data.list_id,n.list&&n.list.ID){if(1===n.list.items.length){if(e.dispatch(ve({page})),n.list&&"view"===o){const t=n.listPage,i=n.listTotalPages;t<i?e.dispatch(ve({page:t})):t===i&&e.dispatch(ve({page:Math.max(1,t-1)}))}return!1}}else e.dispatch(fe({ID:i}));return t}))})),be=Vt(kt,(async function(t,e){let n=e.extra[0],i=!1;try{await Lt.add(t,n,{context:e.extra.length>1?e.extra[1]:"view"}).then((t=>{i=t.data}))}catch(t){var o;const n=null==t||null===(o=t.response)||void 0===o?void 0:o.data;i=e.rejectWithValue(n)}return i})),we=Vt(Nt,(async function(t,e){const n=e.extra[0];return await Lt.updateItem(e.getState().list.ID,t,n).then((e=>{var i;return{...n,post_id:t,item:null==e||null===(i=e.data)||void 0===i?void 0:i.item}}))})),Pe=Vt(Ct,(async function(t,e){const n=e.extra[0],i=e.extra[1],o=n.items[t],s=o.position-t+i;return await Lt.move(n.ID,o.post_id,s).then((e=>({oldIndex:t,newIndex:i})))})),ke=Vt("list/moveItemNext",(async function(t,e){const n=e.getState().list,i=parseInt(n.items[n.items.length-1].position,10);if(isNaN(i))throw alert("positions error!"),"positions error!";const o=n.items[t];return await Lt.move(n.ID,o.post_id,i+1),await e.dispatch(ve({page:e.getState().listPage})),t})),Ne=Vt("list/moveItemPrev",(async function(t,e){const n=e.getState().list,i=parseInt(n.items[0].position,10);if(isNaN(i))throw alert("positions error!"),"positions error!";const o=n.items[t];return await Lt.move(n.ID,o.post_id,i-1),await e.dispatch(ve({page:e.getState().listPage})),t}));function Ce(t,e){!t.data.items_page&&t.headers.get("x-wp-page")?(e(_e(parseInt(t.headers.get("x-wp-page"),10))),e(me(parseInt(t.headers.get("X-WP-TotalPages"),10)))):t.data.items_page&&(e(_e(parseInt(t.data.items_page["X-WP-Page"],10))),e(me(parseInt(t.data.items_page["X-WP-TotalPages"],10))))}const xe=function(t){const{state:e,dispatch:n}=Z(zt);return d(_,null,d("ul",{className:"mg-upc-dg-list-of-lists-fake mg-upc-dg-on-loading"},[0,1,2].map((t=>d("li",{className:"mg-upc-dg-item-list"},d("div",null,d(Zt,{width:"1.5em",height:"1.5em"})),d("div",{className:"mg-upc-dg-item-title"},d(Zt,null)),d("div",{className:"mg-upc-dg-item-count"},d(Zt,null)))))),d("ul",{className:"mg-upc-dg-list-of-lists"},t.lists&&t.lists.map((e=>d(Yt,{list:e,onClick:()=>t.onSelect(e),onRemove:t.onRemove,key:e.ID})))),e.totalPages>1&&d(ie,{totalPages:e.totalPages,page:e.page,onPreview:t.loadPreview,onNext:t.loadNext}))},Ie=function(t){var e,n,i;const[o,s]=X(!1),[a,r]=X(""),l=z({});G((()=>{r(t.item.description)}),[t.item]),G((()=>{o&&l.current.focus()}),[o]);const c=()=>"string"==typeof a&&a.length>0;return d(_,null,d("span",null,d("br",null),"Adding item:"),d("div",{className:"mg-upc-dg-item mg-upc-dg-item-adding","data-post_id":t.item.post_id},d("span",{className:"mg-upc-icon upc-font-add"}),d("span",null," "),d("img",{className:"mg-upc-dg-item-image",src:t.item.image?t.item.image:$t}),d("div",{className:"mg-upc-dg-item-data"},d("a",{href:null===(e=t.item)||void 0===e?void 0:e.link},null===(n=t.item)||void 0===n?void 0:n.title),!o&&d("p",null,null===(i=t.item)||void 0===i?void 0:i.description),!o&&d("button",{onClick:()=>{s(!0)}},c()&&d("span",null,at("Edit Comment")),!c()&&d("span",null,at("Add Comment"))),d("input",{ref:l,className:o?"mg-upc-dg-btn-item-desc":"mg-upc-dg-dn",type:"text",value:a,onChange:function(t){r(t.target.value)},maxLength:400}),o&&d("button",{className:"mg-upc-dg-btn-item-desc-cancel",onClick:()=>{s(!1),r(t.item.description)}},d("span",{className:"mg-upc-icon upc-font-close"}),d("span",null,at("Cancel"))),o&&d("button",{className:"mg-upc-dg-btn-item-desc-save",onClick:()=>{s(!1),t.onSaveItemDescription(a)}},d("span",{className:"mg-upc-icon upc-font-save"}),d("span",null,at("Save"))))),d("span",null,at("Select where the item will be added:")))};function Se(){return Se=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},Se.apply(this,arguments)}function Te(t,e){for(var n in t)if("__source"!==n&&!(n in e))return!0;for(var i in e)if("__source"!==i&&t[i]!==e[i])return!0;return!1}function Ae(t){this.props=t}(Ae.prototype=new m).isPureReactComponent=!0,Ae.prototype.shouldComponentUpdate=function(t,e){return Te(this.props,t)||Te(this.state,e)};var Ee=e.__b;e.__b=function(t){t.type&&t.type.__f&&t.ref&&(t.props.ref=t.ref,t.ref=null),Ee&&Ee(t)},"undefined"!=typeof Symbol&&Symbol.for&&Symbol.for("react.forward_ref");var Le=e.__e;e.__e=function(t,e,n,i){if(t.then)for(var o,s=e;s=s.__;)if((o=s.__c)&&o.__c)return null==e.__e&&(e.__e=n.__e,e.__k=n.__k),o.__c(t,e);Le(t,e,n,i)};var De=e.unmount;function Oe(){this.__u=0,this.t=null,this.__b=null}function je(t){var e=t.__.__c;return e&&e.__a&&e.__a(t)}function Ue(){this.u=null,this.o=null}e.unmount=function(t){var e=t.__c;e&&e.__R&&e.__R(),e&&!0===t.__h&&(t.type=null),De&&De(t)},(Oe.prototype=new m).__c=function(t,e){var n=e.__c,i=this;null==i.t&&(i.t=[]),i.t.push(n);var o=je(i.__v),s=!1,a=function(){s||(s=!0,n.__R=null,o?o(r):r())};n.__R=a;var r=function(){if(!--i.__u){if(i.state.__a){var t=i.state.__a;i.__v.__k[0]=function t(e,n,i){return e&&(e.__v=null,e.__k=e.__k&&e.__k.map((function(e){return t(e,n,i)})),e.__c&&e.__c.__P===n&&(e.__e&&i.insertBefore(e.__e,e.__d),e.__c.__e=!0,e.__c.__P=i)),e}(t,t.__c.__P,t.__c.__O)}var e;for(i.setState({__a:i.__b=null});e=i.t.pop();)e.forceUpdate()}},l=!0===e.__h;i.__u++||l||i.setState({__a:i.__b=i.__v.__k[0]}),t.then(a,a)},Oe.prototype.componentWillUnmount=function(){this.t=[]},Oe.prototype.render=function(t,e){if(this.__b){if(this.__v.__k){var n=document.createElement("div"),i=this.__v.__k[0].__c;this.__v.__k[0]=function t(e,n,i){return e&&(e.__c&&e.__c.__H&&(e.__c.__H.__.forEach((function(t){"function"==typeof t.__c&&t.__c()})),e.__c.__H=null),null!=(e=function(t,e){for(var n in e)t[n]=e[n];return t}({},e)).__c&&(e.__c.__P===i&&(e.__c.__P=n),e.__c=null),e.__k=e.__k&&e.__k.map((function(e){return t(e,n,i)}))),e}(this.__b,n,i.__O=i.__P)}this.__b=null}var o=e.__a&&d(_,null,t.fallback);return o&&(o.__h=null),[d(_,null,e.__a?null:t.children),o]};var Re=function(t,e,n){if(++n[1]===n[0]&&t.o.delete(e),t.props.revealOrder&&("t"!==t.props.revealOrder[0]||!t.o.size))for(n=t.u;n;){for(;n.length>3;)n.pop()();if(n[1]<n[0])break;t.u=n=n[2]}};function We(t){return this.getChildContext=function(){return t.context},t.children}function He(t){var e=this,n=t.i;e.componentWillUnmount=function(){D(null,e.l),e.l=null,e.i=null},e.i&&e.i!==n&&e.componentWillUnmount(),t.__v?(e.l||(e.i=n,e.l={nodeType:1,parentNode:n,childNodes:[],appendChild:function(t){this.childNodes.push(t),e.i.appendChild(t)},insertBefore:function(t,n){this.childNodes.push(t),e.i.appendChild(t)},removeChild:function(t){this.childNodes.splice(this.childNodes.indexOf(t)>>>1,1),e.i.removeChild(t)}}),D(d(We,{context:e.context},t.__v),e.l)):e.l&&e.componentWillUnmount()}(Ue.prototype=new m).__a=function(t){var e=this,n=je(e.__v),i=e.o.get(t);return i[0]++,function(o){var s=function(){e.props.revealOrder?(i.push(o),Re(e,t,i)):o()};n?n(s):s()}},Ue.prototype.render=function(t){this.u=null,this.o=new Map;var e=w(t.children);t.revealOrder&&"b"===t.revealOrder[0]&&e.reverse();for(var n=e.length;n--;)this.o.set(e[n],this.u=[1,0,this.u]);return t.children},Ue.prototype.componentDidUpdate=Ue.prototype.componentDidMount=function(){var t=this;this.o.forEach((function(e,n){Re(t,n,e)}))};var $e="undefined"!=typeof Symbol&&Symbol.for&&Symbol.for("react.element")||60103,Me=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image|letter|lighting|marker(?!H|W|U)|overline|paint|pointer|shape|stop|strikethrough|stroke|text(?!L)|transform|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/,Qe="undefined"!=typeof document,Fe=function(t){return("undefined"!=typeof Symbol&&"symbol"==typeof Symbol()?/fil|che|rad/i:/fil|che|ra/i).test(t)};m.prototype.isReactComponent={},["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach((function(t){Object.defineProperty(m.prototype,t,{configurable:!0,get:function(){return this["UNSAFE_"+t]},set:function(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:e})}})}));var Be=e.event;function qe(){}function Ve(){return this.cancelBubble}function Xe(){return this.defaultPrevented}e.event=function(t){return Be&&(t=Be(t)),t.persist=qe,t.isPropagationStopped=Ve,t.isDefaultPrevented=Xe,t.nativeEvent=t};var Ke={configurable:!0,get:function(){return this.class}},Ge=e.vnode;e.vnode=function(t){var e=t.type,n=t.props,i=n;if("string"==typeof e){var o=-1===e.indexOf("-");for(var s in i={},n){var a=n[s];Qe&&"children"===s&&"noscript"===e||"value"===s&&"defaultValue"in n&&null==a||("defaultValue"===s&&"value"in n&&null==n.value?s="value":"download"===s&&!0===a?a="":/ondoubleclick/i.test(s)?s="ondblclick":/^onchange(textarea|input)/i.test(s+e)&&!Fe(n.type)?s="oninput":/^onfocus$/i.test(s)?s="onfocusin":/^onblur$/i.test(s)?s="onfocusout":/^on(Ani|Tra|Tou|BeforeInp|Compo)/.test(s)?s=s.toLowerCase():o&&Me.test(s)?s=s.replace(/[A-Z0-9]/g,"-$&").toLowerCase():null===a&&(a=void 0),/^oninput$/i.test(s)&&(s=s.toLowerCase(),i[s]&&(s="oninputCapture")),i[s]=a)}"select"==e&&i.multiple&&Array.isArray(i.value)&&(i.value=w(n.children).forEach((function(t){t.props.selected=-1!=i.value.indexOf(t.props.value)}))),"select"==e&&null!=i.defaultValue&&(i.value=w(n.children).forEach((function(t){t.props.selected=i.multiple?-1!=i.defaultValue.indexOf(t.props.value):i.defaultValue==t.props.value}))),t.props=i,n.class!=n.className&&(Ke.enumerable="className"in n,null!=n.className&&(i.class=n.className),Object.defineProperty(i,"className",Ke))}t.$$typeof=$e,Ge&&Ge(t)};var ze=e.__r;e.__r=function(t){ze&&ze(t),t.__c};var Je=['a[href]:not([tabindex^="-"])','area[href]:not([tabindex^="-"])','input:not([type="hidden"]):not([type="radio"]):not([disabled]):not([tabindex^="-"])','input[type="radio"]:not([disabled]):not([tabindex^="-"])','select:not([disabled]):not([tabindex^="-"])','textarea:not([disabled]):not([tabindex^="-"])','button:not([disabled]):not([tabindex^="-"])','iframe:not([tabindex^="-"])','audio[controls]:not([tabindex^="-"])','video[controls]:not([tabindex^="-"])','[contenteditable]:not([tabindex^="-"])','[tabindex]:not([tabindex^="-"])'];function Ye(t){this._show=this.show.bind(this),this._hide=this.hide.bind(this),this._maintainFocus=this._maintainFocus.bind(this),this._bindKeypress=this._bindKeypress.bind(this),this.$el=t,this.shown=!1,this._id=this.$el.getAttribute("data-a11y-dialog")||this.$el.id,this._previouslyFocused=null,this._listeners={},this.create()}function Ze(t,e){return n=(e||document).querySelectorAll(t),Array.prototype.slice.call(n);var n}function tn(t){(t.querySelector("[autofocus]")||t).focus()}function en(){Ze("[data-a11y-dialog]").forEach((function(t){new Ye(t)}))}Ye.prototype.create=function(){return this.$el.setAttribute("aria-hidden",!0),this.$el.setAttribute("aria-modal",!0),this.$el.setAttribute("tabindex",-1),this.$el.hasAttribute("role")||this.$el.setAttribute("role","dialog"),this._openers=Ze('[data-a11y-dialog-show="'+this._id+'"]'),this._openers.forEach(function(t){t.addEventListener("click",this._show)}.bind(this)),this._closers=Ze("[data-a11y-dialog-hide]",this.$el).concat(Ze('[data-a11y-dialog-hide="'+this._id+'"]')),this._closers.forEach(function(t){t.addEventListener("click",this._hide)}.bind(this)),this._fire("create"),this},Ye.prototype.show=function(t){return this.shown||(this._previouslyFocused=document.activeElement,this.$el.removeAttribute("aria-hidden"),this.shown=!0,tn(this.$el),document.body.addEventListener("focus",this._maintainFocus,!0),document.addEventListener("keydown",this._bindKeypress),this._fire("show",t)),this},Ye.prototype.hide=function(t){return this.shown?(this.shown=!1,this.$el.setAttribute("aria-hidden","true"),this._previouslyFocused&&this._previouslyFocused.focus&&this._previouslyFocused.focus(),document.body.removeEventListener("focus",this._maintainFocus,!0),document.removeEventListener("keydown",this._bindKeypress),this._fire("hide",t),this):this},Ye.prototype.destroy=function(){return this.hide(),this._openers.forEach(function(t){t.removeEventListener("click",this._show)}.bind(this)),this._closers.forEach(function(t){t.removeEventListener("click",this._hide)}.bind(this)),this._fire("destroy"),this._listeners={},this},Ye.prototype.on=function(t,e){return void 0===this._listeners[t]&&(this._listeners[t]=[]),this._listeners[t].push(e),this},Ye.prototype.off=function(t,e){var n=(this._listeners[t]||[]).indexOf(e);return n>-1&&this._listeners[t].splice(n,1),this},Ye.prototype._fire=function(t,e){var n=this._listeners[t]||[],i=new CustomEvent(t,{detail:e});this.$el.dispatchEvent(i),n.forEach(function(t){t(this.$el,e)}.bind(this))},Ye.prototype._bindKeypress=function(t){this.$el.contains(document.activeElement)&&(this.shown&&"Escape"===t.key&&"alertdialog"!==this.$el.getAttribute("role")&&(t.preventDefault(),this.hide(t)),this.shown&&"Tab"===t.key&&function(t,e){var n=function(t){return Ze(Je.join(","),t).filter((function(t){return!!(t.offsetWidth||t.offsetHeight||t.getClientRects().length)}))}(t),i=n.indexOf(document.activeElement);e.shiftKey&&0===i?(n[n.length-1].focus(),e.preventDefault()):e.shiftKey||i!==n.length-1||(n[0].focus(),e.preventDefault())}(this.$el,t))},Ye.prototype._maintainFocus=function(t){!this.shown||t.target.closest('[aria-modal="true"]')||t.target.closest("[data-a11y-dialog-ignore-focus-trap]")||tn(this.$el)},"undefined"!=typeof document&&("loading"===document.readyState?document.addEventListener("DOMContentLoaded",en):window.requestAnimationFrame?window.requestAnimationFrame(en):window.setTimeout(en,16));const nn=t=>{const e=(()=>{const[t,e]=X(!1);return G((()=>e(!0)),[]),t})(),[n,i]=(t=>{const[e,n]=(()=>{const[t,e]=X(null);return[t,Y((t=>{null!==t&&e(new Ye(t))}),[])]})(),i=Y((()=>e.hide()),[e]),o=t.role||"dialog",s="alertdialog"===o,a=t.titleId||t.id+"-title";return G((()=>()=>{e&&e.destroy()}),[e]),[e,{container:{id:t.id,ref:n,role:o,tabIndex:-1,"aria-modal":!0,"aria-hidden":!0,"aria-labelledby":a},overlay:{onClick:s?void 0:i},dialog:{role:"document"},closeButton:{type:"button",onClick:i},title:{role:"heading","aria-level":1,id:a}}]})(t),{dialogRef:o}=t;if(G((()=>(n&&o(n),()=>o(void 0))),[o,n]),!e)return null;const s=t.dialogRoot?document.querySelector(t.dialogRoot):document.body,a=d("h2",Se({},i.title,{className:t.classNames.title,key:"title"}),t.onBack&&d("a",{"aria-label":t.backButtonLabel,href:"#",onClick:e=>{e.preventDefault(),t.onBack(e)}},"←")," ",t.title),r=d("button",Se({},i.closeButton,{className:t.classNames.closeButton,"aria-label":t.closeButtonLabel,key:"button"}),t.closeButtonContent),l=["first"===t.closeButtonPosition&&r,a,t.children,"last"===t.closeButtonPosition&&r].filter(Boolean);return function(t,e){var n=d(He,{__v:t,i:e});return n.containerInfo=e,n}(d("div",Se({},i.container,{className:t.classNames.container}),d("div",Se({},i.overlay,{className:t.classNames.overlay})),d("div",Se({},i.dialog,{className:t.classNames.dialog}),l)),s)};nn.defaultProps={role:"dialog",closeButtonLabel:"Close this dialog window",closeButtonContent:"×",closeButtonPosition:"first",classNames:{},backButtonLabel:"Back",dialogRef:()=>{}},function(t){function e(e,i,o,s){const a=o||s.parent(),r=a.find(".mg-upc-item-vote").attr("disabled",!0);mgUpcApiClient.vote(e,i,{context:"web",posts:n(a)}).then((function(e){t(document.body).trigger("mg_upc_vote_response",[e,a])})).catch((function(t){var e,n;r.attr("disabled",!1),null!==(e=t.response)&&void 0!==e&&null!==(n=e.data)&&void 0!==n&&n.message&&(s?s.append(Bt(t.response.data.message)):a.before(Bt(t.response.data.message)))}))}function n(e){return[...e.children().map((function(){return t(this).data("pid")}))].join(",")}t(".mg-upc-item-vote").on("click",(function(){const n=t(this).data("vote").split(",");return 2===n.length&&e(n[0],n[1],!1,t(this).closest(".mg-upc-item")),!1})),t((function(){t(".mg-upc-vote").each((function(){const n=t(this);e(n.data("id"),0,n.find(".mg-upc-items-container"),!1)}))})),t(document.body).on("mg_upc_vote_response",(function(e,n,i){if(!n.data)return;const o=parseInt(n.data.vote_counter,10),s=i.find(".mg-upc-item-vote");i.data("votes",o),n.data.can_vote?s.attr("disabled",!1).show():s.animate({width:0,padding:0,opacity:0},200,(function(){s.remove()})),n.data.posts.forEach((function(e){const n=i.find(".mg-upc-item[data-pid="+e.post_id+"]"),s=parseInt(e.votes,10);t(document.body).trigger("mg_upc_item_vote_set",[n,s,o])}))})),t(document.body).on("mg_upc_item_vote_set",(function(t,e,n,i){const o=i>0?Math.round(1e3*n/i)/10:0,s=e.find(".mg-upc-votes");s.find(".mg-upc-item-votes-number").html(n),s.find(".mg-upc-item-percent").html(o+"%"),s.find(".mg-upc-item-bar-progress").animate({width:o+"%"}),s.show()}))}(jQuery),function(t){t(".mg-upc-add-product-to-list").on("click",(function(){let e=t(this).data("id");const n=t(this).closest(".product,.summary").find("[name='variation_id']");return n.length>0&&parseInt(n.val(),10)>0&&(e=n.val()),window.addItemToList(e),!1}));const e="mg-upc-btn-loading",n="mg-upc-product-added",i="mg-upc-product-error",o="Sorry, an error occurred.";function s(a,r,l){if(r.hasClass(e))return!1;let c={product_id:r.data("product"),quantity:r.data("quantity")};if("0"==c.quantity){if(!l)return!!confirm(at("The quantity is zero! Do you want to add a unit?"))&&s(a,r,!0);c.quantity=1}t(document.body).trigger("adding_to_cart",[r,c]);const u=woocommerce_params.wc_ajax_url.toString().replace("%%endpoint%%","add_to_cart");return t.ajax({type:"POST",url:u,data:c,beforeSend:function(t){r.removeClass(n+" "+i).addClass(e)},success:function(i){r.removeClass(e),i&&(i.error&&i.product_url?alert(o):(r.addClass(n),t(document.body).trigger("added_to_cart",[i.fragments,i.cart_hash,r])))},error:function(){r.addClass(i).removeClass(e),alert(o)}}),!1}function s(a,r,l){if(r.hasClass(e))return!1;let c={product_id:r.data("product"),quantity:r.data("quantity")};if("0"==c.quantity){if(!l)return!!confirm(at("The quantity is zero! Do you want to add a unit?"))&&s(a,r,!0);c.quantity=1}t(document.body).trigger("adding_to_cart",[r,c]);const u=woocommerce_params.wc_ajax_url.toString().replace("%%endpoint%%","add_to_cart");return t.ajax({type:"POST",url:u,data:c,beforeSend:function(t){r.removeClass(n+" "+i).addClass(e)},success:function(i){r.removeClass(e),i&&(i.error&&i.product_url?alert(o):(r.addClass(n),t(document.body).trigger("added_to_cart",[i.fragments,i.cart_hash,r])))},error:function(){r.addClass(i).removeClass(e),alert(o)}}),!1}t((function(){if("undefined"==typeof wc_add_to_cart_params)return!1;t(".mg-upc-item-product").removeClass("mg-upc-hide").on("click",(function(e){return s(e,t(this),!1)})),t(".mg-upc-add-list-to-cart").removeClass("mg-upc-hide").on("click",(function(s){const a=t(this);return a.hasClass(e)||(a.removeClass(n+" "+i).addClass(e),window.mgUpcAddListToCart(t(this).data("id")).then((function(i){a.removeClass(e),i.err&&a.before(Bt(Qt(i.err))),i.msg&&a.before(Bt(Qt(i.msg),"success")),a.addClass(n),t(document.body).trigger("added_to_cart",[i.fragments,i.cart_hash,a])})).catch((t=>{var n,i;a.removeClass(e),null!==(n=t.response)&&void 0!==n&&null!==(i=n.data)&&void 0!==i&&i.message?a.before(Bt(Qt(t.response.data.message))):alert(o)}))),!1}))}))}(jQuery);const on=function(t){var e;const[n,i]=X(""),[o,s]=X(""),[a,r]=X(""),[l,c]=X(""),u=J((()=>Wt(t.addingPost)),[t.addingPost]);function p(t){t.default_title&&i(t.default_title),t.default_status&&c(t.default_status),r(t.name)}return""===a&&1===u.length&&p(u[0]),G((()=>{i(t.list.title),s(t.list.content),r(t.list.type),c(t.list.status)}),[t.list]),G((()=>{var t;null!==(t=jt(a))&&void 0!==t&&t.available_statuses&&-1===jt(a).available_statuses.indexOf(l)&&c(jt(a).available_statuses[0])}),[a]),d("div",{className:"mg-list-edit"},-1===t.list.ID&&""===a&&d(_,null,d("label",null,at("Select a list type:")),d("ul",{id:`type-${t.list.ID}`},u.map(((t,e)=>d("li",{className:"mg-upc-dg-item-list-type",key:t.name,onClick:()=>p(t),onKeyPress:e=>{13===e.keyCode&&p(t)},tabIndex:"0"},d("i",{className:"mg-upc-icon mg-upc-dg-item-type mg-upc-dg-item-type-"+t.name}),d("div",{className:"mg-upc-dg-item-title"},d("strong",null,t.label),d("div",{className:"mg-upc-dg-item-desc"},t.description))))))),""!==a&&Ht(a,"editable_title")&&d(_,null,d("label",{htmlFor:`title-${t.list.ID}`},at("Title")),d("input",{id:`title-${t.list.ID}`,type:"text",value:n,onChange:function(t){i(t.target.value)},maxLength:100})),""!==a&&Ht(a,"editable_content")&&d(_,null,d("label",{htmlFor:`content-${t.list.ID}`},at("Description")),d("textarea",{id:`content-${t.list.ID}`,value:o,onChange:function(t){s(t.target.value)},maxLength:500}),d("span",{className:"mg-upc-dg-list-desc-edit-count"},d("i",null,null==o?void 0:o.length),"/500")),""!==a&&!jt(a)&&d("span",null,at("Unknown List Type...")),""!==a&&(null===(e=jt(a))||void 0===e?void 0:e.available_statuses)&&jt(a).available_statuses.length>1&&d(_,null,d("label",{htmlFor:`status-${t.list.ID}`},at("Status")),d("select",{id:`status-${t.list.ID}`,value:l,onChange:function(t){c(t.target.value)}},jt(a).available_statuses.map(((t,e)=>{if(function(t){const e=Ut(t);return e&&e.show_in_status_list}(t))return d("option",{value:t},function(t){const e=Ut(t);return e?e.label:t}(t))})))),""!==a&&jt(a)&&d("div",{className:"mg-upc-dg-edit-actions"},d("button",{onClick:()=>t.onSave({title:n,content:o,type:a,status:l})},d("span",{className:"mg-upc-icon upc-font-save"}),d("span",null,at("Save"))),d("button",{onClick:()=>t.onCancel()},d("span",{className:"mg-upc-icon upc-font-close"}),d("span",null,at("Cancel")))))},sn=function(t){var e;const[n,i]=X(!1),[o,s]=X(""),[a,r]=X(null===(e=t.item)||void 0===e?void 0:e.quantity),l=z({});G((()=>{s(t.item.description)}),[t.item]),G((()=>{n&&l.current.focus()}),[n]);const c=z(!1);return G((()=>{t.item.quantity!==a&&(clearTimeout(c.current),c.current=setTimeout((function(){t.onSaveItemQuantity(a)}),600))}),[a]),d("li",{className:"mg-upc-dg-item","data-post_id":t.item.post_id},Rt(t.list,"sortable")&&d(_,null,d("span",{className:"mg-upc-dg-item-handle","aria-draggable":!0},"::"),d("span",{className:"mg-upc-dg-item-number"},t.item.position)),Rt(t.list,"vote")&&d(_,null,d("span",{className:"mg-upc-dg-item-number"},(()=>{const e=parseInt(t.list.vote_counter,10);return Rt(t.list,"vote")&&e>0?Math.round(100*parseInt(t.item.votes,10)/e)+"%":"0%"})())),d("a",{href:t.item.link},d("img",{className:"mg-upc-dg-item-image",src:t.item.image?t.item.image:$t})),d("div",{className:"mg-upc-dg-item-data"},d("a",{href:t.item.link},t.item.title),t.item.price_html&&d("span",{className:"mg-upc-dg-price",dangerouslySetInnerHTML:{__html:t.item.price_html}}),t.item.stock_html&&d("span",{className:"mg-upc-dg-stock",dangerouslySetInnerHTML:{__html:t.item.stock_html}}),t.editable&&!n&&d("p",null,t.item.description),t.editable&&!n&&Rt(t.list,"editable_item_description")&&d("button",{onClick:()=>{i(!0)}},d("span",{className:"mg-upc-icon upc-font-edit"}),""===o&&d("span",null,at("Add Comment")),""!==o&&d("span",null,at("Edit Comment"))),d("input",{ref:l,className:n?"mg-upc-dg-btn-item-desc":"mg-upc-dg-dn",type:"text",value:o,onChange:function(t){s(t.target.value)},maxLength:400}),t.editable&&n&&d("button",{className:"mg-upc-dg-btn-item-desc-cancel",onClick:()=>{i(!1),s(t.item.description)}},d("span",{className:"mg-upc-icon upc-font-close"}),d("span",null,at("Cancel"))),t.editable&&n&&d("button",{className:"mg-upc-dg-btn-item-desc-save",onClick:()=>{i(!1),t.onSaveItemDescription(o)}},d("span",{className:"mg-upc-icon upc-font-save"}),d("span",null,at("Save")))),t.editable&&Rt(t.list,"quantity")&&d("div",{className:"mg-upc-dg-quantity"},d("small",null,at("Quantity")),d("input",{"aria-label":at("Quantity"),type:"number",value:a,onChange:function(){r(event.target.value)}})),t.editable&&!n&&d("div",null,d("button",{"aria-label":"Remove item",onClick:t.onRemove},d("span",{className:"mg-upc-icon upc-font-trash"}))))},an=function(t){return new Promise((function(e,n){const i=document.createElement("script");let o=!1;i.type="text/javascript",i.src=t,i.async=!0,i.onerror=function(t){n(t,i)},i.onload=i.onreadystatechange=function(){o||this.readyState&&"complete"!=this.readyState||(o=!0,setTimeout((function(){e()}),100))},(document.head||document.body||document.documentElement).appendChild(i)}))},rn=function(t){var e,n,i;const o=z(null),s=z((e=>{t.onMove(e)}));return G((()=>{s.current=t.onMove})),G((()=>{let e=!1;if(Rt(t.list,"sortable")){const t=()=>{e=Sortable.create(o.current,{handle:".mg-upc-dg-item-handle",group:"shared",animation:150,onUpdate:function(t){s.current(t)}})};"undefined"!=typeof Sortable?t():an(Ot()).then((()=>{t()}))}return()=>{e&&e.destroy()}})),d(_,null,d("ul",{className:"mg-upc-dg-list-fake mg-upc-dg-on-loading"},[0,1,2].map((e=>d("li",{className:"mg-upc-dg-item"},Rt(t.list,"sortable")&&d(_,null,d("span",{className:"mg-upc-dg-item-handle-skeleton"}," ",d(Zt,{width:"1.5em"})," "),d("span",{className:"mg-upc-dg-item-number-skeleton"}," ",d(Zt,{width:"1em"})," ")),Rt(t.list,"vote")&&d(_,null,d("span",{className:"mg-upc-dg-item-number-skeleton"}," ",d(Zt,{width:"1em"})," ")),d("div",{className:"mg-upc-dg-item-skeleton-image"},d(Zt,{width:"5em",height:"5em"})),d("div",{className:"mg-upc-dg-item-data"},d(Zt,{count:2})))))),d("ul",{ref:o,className:"mg-upc-dg-list"},0===(null==t||null===(e=t.items)||void 0===e?void 0:e.length)&&d("span",null,"There are no items in this list"),(null==t||null===(n=t.items)||void 0===n?void 0:n.length)>0&&(null===(i=t.items)||void 0===i?void 0:i.map)&&t.items.map((e=>d(sn,{list:t.list,item:e,editable:t.editable,onRemove:()=>t.onRemove(t.list,e),onSaveItemDescription:n=>t.onSaveItemDescription(t.list,e,n),onSaveItemQuantity:n=>t.onSaveItemQuantity(t.list,e,n),key:e.ID+":"+e.post_id})))),Rt(t.list,"vote")&&d("span",{className:"mg-upc-dg-total-votes"}," ",at("Total votes:")," ",d("span",null," ",t.list.vote_counter)))},ln=function(t){const e=z(null),n=z(null),i=at("Copy"),[o,s]=X(i);G((()=>{let t=null;o!==i&&(t=setTimeout((()=>{s(i),clearTimeout(t)}),2e3))}),[o]);const a=encodeURIComponent(t.link),r=encodeURIComponent(t.title);let l=[{name:"Twitter",url:"https://twitter.com/share?url="+a+"&text="+r},{name:"Facebook",url:"https://www.facebook.com/sharer/sharer.php?u="+a+""e="+r},{name:"Pinterest",url:"https://pinterest.com/pin/create/button/?url="+a+"&description="+r},{name:"Whatsapp",url:"whatsapp://send?text="+a},{name:"Telegram",url:"https://t.me/share/url?url="+a+"&text="+r},{name:"LiNE",url:"https://social-plugins.line.me/lineit/share?url="+a+"&text="+r},{slug:"email",name:at("Email"),url:"mailto:?subject="+r+"&body="+a}];return void 0!==Dt().shareButtons&&(l=l.filter((t=>Dt().shareButtons.includes(t.slug||t.name.toLowerCase())))),d("div",{className:"mg-upc-dg-share-link"},d("input",{ref:e,value:t.link,onClick:function(){e.current.setSelectionRange(0,e.current.value.length)},readOnly:!0}),d("button",{ref:n,onClick:function(t){var n;(n=e.current).focus(),n.setSelectionRange(0,n.value.length),document.execCommand&&document.execCommand("copy")?s(at("Copied!")):s("Error!")}},d("span",{className:"mg-upc-icon upc-font-copy"}),d("span",null,o)),l.map((function(t){return(e=t).slug||(e.slug=e.name.toLowerCase()),d("a",{href:e.url,title:"Share with "+e.name,className:"mg-upc-dg-share",target:"_blank",rel:"noopener"},d("div",{className:"mg-upc-share-btn-img mg-upc-share-"+e.slug}," "));var e})))},cn=function(t){var e;const{state:n,dispatch:i}=Z(zt),[o,s]=X(!1),a=z(!1),r=z(!1);function l(t){t<1||t>n.listTotalPages||"loading"===n.status||i(ve({page:t}))}return G((()=>{const t=n.list;let e=!1,o=!1;if(t&&Rt(t,"sortable")){const t=()=>{a.current&&n.listPage<n.listTotalPages&&(e=Sortable.create(a.current,{group:"shared",onAdd:t=>{i(ke(t.oldIndex))}})),a.current&&n.listPage>1&&(o=Sortable.create(r.current,{group:"shared",onAdd:t=>{i(Ne(t.oldIndex))}}))};"undefined"!=typeof Sortable?t():an(Ot()).then((()=>{t()}))}return()=>{e&&e.destroy(),o&&o.destroy()}}),[n.list,n.listPage,n.listTotalPages]),G((()=>{s(!1)}),[n.editing,n.list,n.addingPost]),d(_,null,n.editing&&d(on,{list:n.list,addingPost:n.addingPost,onSave:function(t){if(-1===n.list.ID||t.title!==n.list.title||t.content!==n.list.content||t.status!==n.list.status)if(-1===n.list.ID){var e;const o={};o.title=t.title,o.content=t.content,o.type=t.type,o.status=t.status,null!==(e=n.addingPost)&&void 0!==e&&e.post_id&&(o.adding=n.addingPost.post_id),i(he(o))}else{const e={id:n.list.ID};t.status!==n.list.status&&(e.status=t.status),t.title!==n.list.title&&(e.title=t.title),t.content!==n.list.content&&(e.content=t.content),i(ge(e))}},onCancel:function(){i(ae(!1)),-1===n.list.ID&&(i(fe(!1)),i(oe()),i(le()))}}),!n.editing&&d(_,null,d("div",{className:"mg-upc-dg-top-action"},function(t){var e,n;const i=t.type;return Ht(i,"editable_title")||Ht(i,"editable_content")||(null===(e=jt(i))||void 0===e||null===(n=e.available_statuses)||void 0===n?void 0:n.length)>1}(n.list)&&d("button",{className:"mg-upg-edit",onClick:()=>i(ae(!0))},d("span",{className:"mg-upc-icon upc-font-edit"}),d("span",null,at("Edit"))),n.list.link&&d("button",{className:"mg-upg-share",onClick:()=>s(!o)},d("span",{className:"mg-upc-icon upc-font-share"}),d("span",null,at("Share"))),"cart"===n.list.type&&d("button",{className:"mg-upg-share",onClick:function(){i(re(n.list.ID))}},d("span",{className:"mg-upc-icon upc-font-cart"}),d("span",null,at("Add all to cart")))),o&&n.list.link&&d(ln,{link:n.list.link,title:n.list.title}),n.list.content&&d("p",{className:"mg-upc-dg-list-desc",dangerouslySetInnerHTML:{__html:Qt(n.list.content)}}),d(Zt,{count:3}),d(rn,{list:n.list,items:(null===(e=n.list)||void 0===e?void 0:e.items)||[],onMove:function(t){i(Pe(t.oldIndex,n.list,t.newIndex))},onRemove:function(t,e){i(ye(e.post_id))},onSaveItemDescription:function(t,e,n){i(we(e.post_id,{description:n}))},onSaveItemQuantity:function(t,e,n){i(we(e.post_id,{quantity:n}))},editable:t.editable})),(!n.editing||!n.list)&&n.listTotalPages>1&&d(ie,{totalPages:n.listTotalPages,page:n.listPage,onPreview:function(){l(n.listPage-1)},onNext:function(){l(n.listPage+1)},prevRef:r,nextRef:a}))};function un(t){return parseInt(t.author,10)===parseInt(Dt().user_id,10)}function dn(){"replaceState"in history?(history.replaceState("",document.title,location.pathname),history.go(-1)):location.hash=""}D(d((t=>{const[e,n]=K(qt,Gt);return d(zt.Provider,{value:{state:e,dispatch:Kt(n,(()=>e))}},t.children)}),null,d((function(){const{state:t,dispatch:e}=Z(zt),n=J((()=>Wt(t.addingPost)),[t.addingPost]),i=z(!1);let o="listOfList";if(t.addingPost)o=t.editing?"addingToNew":"adding";else if(t.editing){var s;o=-1!==(null===(s=t.list)||void 0===s?void 0:s.ID)?"edit":"new"}else o=t.list?"list":"listOfList";const a={container:"mg-upc-dg-container",overlay:"mg-upc-dg-overlay",dialog:"mg-upc-dg-content"+(t.errorCode?" mg-upc-err-"+t.errorCode:""),title:"mg-upc-dg-title",closeButton:"mg-upc-dg-close"};G((()=>{window.showMyLists=function(){r()},window.mgUpcShowList=function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";e(oe()),e(fe({ID:t,title:n||""})),i.current.show()},window.addItemToList=function(t){let n=arguments.length>1&&void 0!==arguments[1]&&arguments[1],o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"view";e(oe()),n?(e(be(n,t,o)),i.current.show()):l(t)},window.removeItemFromList=function(t,n){let o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"view";e(oe()),e(ye(t,n,o)),i.current.show()},window.mgUpcAddListToCart=Ft}),[i.current,e]);const r=()=>{e(oe()),e(le()),i.current.show()},l=t=>{e(se({post_id:t})),e(le({addingPost:t})),i.current.show()};function c(n){n<1||n>t.totalPages||"loading"===t.status||e(de(n))}const u="list"===o||"new"===o||"edit"===o||"addingToNew"===o;return d(nn,{id:"mg-upc-dg-dialog",dialogRef:function(t){i.current=t},title:t.title,classNames:a,onBack:!!u&&function(){switch(o){case"list":default:r();break;case"new":e(fe(!1)),e(ae(!1)),r();break;case"edit":e(ae(!1));break;case"addingToNew":e(fe(!1)),e(ae(!1)),e(le({addingPost:t.addingPost.post_id}))}}},d("div",{className:"mg-upc-dg-content-wrapper mg-upc-dg-status-"+t.status+" mg-upc-dg-view-"+o},d("div",{className:"mg-upc-dg-wait"}),t.message&&d("div",{className:"mg-upc-dg-msg"},t.message,d("a",{href:"#",className:"mg-upc-dg-alert-close","aria-label":"Hide alert",onClick:t=>{t.preventDefault(),e({type:ct,payload:null})}},d("span",{className:"mg-upc-icon upc-font-close"}))),t.error&&d("div",{className:"mg-upc-dg-error"},t.error,d("a",{href:"#",className:"mg-upc-dg-alert-close","aria-label":"Hide alert",onClick:t=>{t.preventDefault(),e({type:lt,payload:null})}},d("span",{className:"mg-upc-icon upc-font-close"}))),d("div",{className:"mg-upc-dg-body"},!t.error&&t.addingPost&&d(Ie,{item:t.addingPost,onSaveItemDescription:function(n){e(se({...t.addingPost,description:n}))}}),("listOfList"===o||"adding"===o)&&d(_,null,d("div",{className:"mg-upc-dg-top-action"},n.length>0&&!t.error&&d("button",{className:"mg-list-new",onClick:function(t){e(ae(!0)),e(fe(!0)),i.current.show()}},d("span",{className:"mg-upc-icon upc-font-add"}),d("span",null,at("Create List")))),d(xe,{lists:t.listOfList,onSelect:function(n){e(ae(!1)),t.addingPost?e(be(n.ID,t.addingPost)):(e(fe(n)),i.current.show())},onRemove:!t.addingPost&&function(t){e(ue(t.ID))},loadPreview:function(){c(t.page-1)},loadNext:function(){c(t.page+1)}})),t.list&&d(cn,{editable:un(t.list)}))))}),null)," "),document.querySelector("body")),"#my-lists"===location.hash&&dn(),window.addEventListener("hashchange",(function(){"#my-lists"===location.hash&&(window.showMyLists(),dn())}),!1),window.mgUpcApiClient=Lt,window.mgUpcListeners=function(){jQuery(".mg-upc-post-add").on("click",(function(){return jQuery(this).data("post-id")>0&&window.addItemToList(jQuery(this).data("post-id"),(jQuery(this).data("upc-list")+"").length>0&&jQuery(this).data("upc-list")),!1})),jQuery(".mg-upc-post-remove").on("click",(function(){return jQuery(this).data("post-id")>0&&void 0!==jQuery(this).data("upc-list")&&window.removeItemFromList(jQuery(this).data("post-id"),(jQuery(this).data("upc-list")+"").length>0&&jQuery(this).data("upc-list")),!1})),jQuery(".mg-upc-show-list").on("click",(function(){return void 0!==jQuery(this).data("upc-list")&&window.mgUpcShowList(jQuery(this).data("upc-list"),(jQuery(this).data("upc-title")+"").length>0&&jQuery(this).data("upc-title")),!1}))},window.mgUpcListeners()})();1 (()=>{"use strict";var t,e,n,i,o,s,a,r,l,c,u,d={},_=[],p=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,m=Array.isArray;function f(t,e){for(var n in e)t[n]=e[n];return t}function g(t){t&&t.parentNode&&t.parentNode.removeChild(t)}function h(e,n,i){var o,s,a,r={};for(a in n)"key"==a?o=n[a]:"ref"==a?s=n[a]:r[a]=n[a];if(arguments.length>2&&(r.children=arguments.length>3?t.call(arguments,2):i),"function"==typeof e&&null!=e.defaultProps)for(a in e.defaultProps)void 0===r[a]&&(r[a]=e.defaultProps[a]);return v(e,r,o,s,null)}function v(t,i,o,s,a){var r={type:t,props:i,key:o,ref:s,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:null==a?++n:a,__i:-1,__u:0};return null==a&&null!=e.vnode&&e.vnode(r),r}function y(t){return t.children}function b(t,e){this.props=t,this.context=e}function w(t,e){if(null==e)return t.__?w(t.__,t.__i+1):null;for(var n;e<t.__k.length;e++)if(null!=(n=t.__k[e])&&null!=n.__e)return n.__e;return"function"==typeof t.type?w(t):null}function P(t){var e,n;if(null!=(t=t.__)&&null!=t.__c){for(t.__e=t.__c.base=null,e=0;e<t.__k.length;e++)if(null!=(n=t.__k[e])&&null!=n.__e){t.__e=t.__c.base=n.__e;break}return P(t)}}function k(t){(!t.__d&&(t.__d=!0)&&i.push(t)&&!C.__r++||o!==e.debounceRendering)&&((o=e.debounceRendering)||s)(C)}function C(){var t,n,o,s,r,l,c,u;for(i.sort(a);t=i.shift();)t.__d&&(n=i.length,s=void 0,l=(r=(o=t).__v).__e,c=[],u=[],o.__P&&((s=f({},r)).__v=r.__v+1,e.vnode&&e.vnode(s),D(o.__P,s,r,o.__n,o.__P.namespaceURI,32&r.__u?[l]:null,c,null==l?w(r):l,!!(32&r.__u),u),s.__v=r.__v,s.__.__k[s.__i]=s,O(c,s,u),s.__e!=l&&P(s)),i.length>n&&i.sort(a));C.__r=0}function N(t,e,n,i,o,s,a,r,l,c,u){var p,m,f,g,h,v=i&&i.__k||_,y=e.length;for(n.__d=l,x(n,e,v),l=n.__d,p=0;p<y;p++)null!=(f=n.__k[p])&&(m=-1===f.__i?d:v[f.__i]||d,f.__i=p,D(t,f,m,o,s,a,r,l,c,u),g=f.__e,f.ref&&m.ref!=f.ref&&(m.ref&&j(m.ref,null,f),u.push(f.ref,f.__c||g,f)),null==h&&null!=g&&(h=g),65536&f.__u||m.__k===f.__k?l=S(f,l,t):"function"==typeof f.type&&void 0!==f.__d?l=f.__d:g&&(l=g.nextSibling),f.__d=void 0,f.__u&=-196609);n.__d=l,n.__e=h}function x(t,e,n){var i,o,s,a,r,l=e.length,c=n.length,u=c,d=0;for(t.__k=[],i=0;i<l;i++)null!=(o=e[i])&&"boolean"!=typeof o&&"function"!=typeof o?(a=i+d,(o=t.__k[i]="string"==typeof o||"number"==typeof o||"bigint"==typeof o||o.constructor==String?v(null,o,null,null,null):m(o)?v(y,{children:o},null,null,null):void 0===o.constructor&&o.__b>0?v(o.type,o.props,o.key,o.ref?o.ref:null,o.__v):o).__=t,o.__b=t.__b+1,s=null,-1!==(r=o.__i=T(o,n,a,u))&&(u--,(s=n[r])&&(s.__u|=131072)),null==s||null===s.__v?(-1==r&&d--,"function"!=typeof o.type&&(o.__u|=65536)):r!==a&&(r==a-1?d--:r==a+1?d++:(r>a?d--:d++,o.__u|=65536))):o=t.__k[i]=null;if(u)for(i=0;i<c;i++)null!=(s=n[i])&&!(131072&s.__u)&&(s.__e==t.__d&&(t.__d=w(s)),R(s,s))}function S(t,e,n){var i,o;if("function"==typeof t.type){for(i=t.__k,o=0;i&&o<i.length;o++)i[o]&&(i[o].__=t,e=S(i[o],e,n));return e}t.__e!=e&&(e&&t.type&&!n.contains(e)&&(e=w(t)),n.insertBefore(t.__e,e||null),e=t.__e);do{e=e&&e.nextSibling}while(null!=e&&8===e.nodeType);return e}function I(t,e){return e=e||[],null==t||"boolean"==typeof t||(m(t)?t.some((function(t){I(t,e)})):e.push(t)),e}function T(t,e,n,i){var o=t.key,s=t.type,a=n-1,r=n+1,l=e[n];if(null===l||l&&o==l.key&&s===l.type&&!(131072&l.__u))return n;if(i>(null==l||131072&l.__u?0:1))for(;a>=0||r<e.length;){if(a>=0){if((l=e[a])&&!(131072&l.__u)&&o==l.key&&s===l.type)return a;a--}if(r<e.length){if((l=e[r])&&!(131072&l.__u)&&o==l.key&&s===l.type)return r;r++}}return-1}function A(t,e,n){"-"===e[0]?t.setProperty(e,null==n?"":n):t[e]=null==n?"":"number"!=typeof n||p.test(e)?n:n+"px"}function E(t,e,n,i,o){var s;t:if("style"===e)if("string"==typeof n)t.style.cssText=n;else{if("string"==typeof i&&(t.style.cssText=i=""),i)for(e in i)n&&e in n||A(t.style,e,"");if(n)for(e in n)i&&n[e]===i[e]||A(t.style,e,n[e])}else if("o"===e[0]&&"n"===e[1])s=e!==(e=e.replace(/(PointerCapture)$|Capture$/i,"$1")),e=e.toLowerCase()in t||"onFocusOut"===e||"onFocusIn"===e?e.toLowerCase().slice(2):e.slice(2),t.l||(t.l={}),t.l[e+s]=n,n?i?n.u=i.u:(n.u=r,t.addEventListener(e,s?c:l,s)):t.removeEventListener(e,s?c:l,s);else{if("http://www.w3.org/2000/svg"==o)e=e.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if("width"!=e&&"height"!=e&&"href"!=e&&"list"!=e&&"form"!=e&&"tabIndex"!=e&&"download"!=e&&"rowSpan"!=e&&"colSpan"!=e&&"role"!=e&&"popover"!=e&&e in t)try{t[e]=null==n?"":n;break t}catch(t){}"function"==typeof n||(null==n||!1===n&&"-"!==e[4]?t.removeAttribute(e):t.setAttribute(e,"popover"==e&&1==n?"":n))}}function L(t){return function(n){if(this.l){var i=this.l[n.type+t];if(null==n.t)n.t=r++;else if(n.t<i.u)return;return i(e.event?e.event(n):n)}}}function D(t,n,i,o,s,a,r,l,c,u){var d,_,p,g,h,v,w,P,k,C,x,S,I,T,A,E,L=n.type;if(void 0!==n.constructor)return null;128&i.__u&&(c=!!(32&i.__u),a=[l=n.__e=i.__e]),(d=e.__b)&&d(n);t:if("function"==typeof L)try{if(P=n.props,k="prototype"in L&&L.prototype.render,C=(d=L.contextType)&&o[d.__c],x=d?C?C.props.value:d.__:o,i.__c?w=(_=n.__c=i.__c).__=_.__E:(k?n.__c=_=new L(P,x):(n.__c=_=new b(P,x),_.constructor=L,_.render=W),C&&C.sub(_),_.props=P,_.state||(_.state={}),_.context=x,_.__n=o,p=_.__d=!0,_.__h=[],_._sb=[]),k&&null==_.__s&&(_.__s=_.state),k&&null!=L.getDerivedStateFromProps&&(_.__s==_.state&&(_.__s=f({},_.__s)),f(_.__s,L.getDerivedStateFromProps(P,_.__s))),g=_.props,h=_.state,_.__v=n,p)k&&null==L.getDerivedStateFromProps&&null!=_.componentWillMount&&_.componentWillMount(),k&&null!=_.componentDidMount&&_.__h.push(_.componentDidMount);else{if(k&&null==L.getDerivedStateFromProps&&P!==g&&null!=_.componentWillReceiveProps&&_.componentWillReceiveProps(P,x),!_.__e&&(null!=_.shouldComponentUpdate&&!1===_.shouldComponentUpdate(P,_.__s,x)||n.__v===i.__v)){for(n.__v!==i.__v&&(_.props=P,_.state=_.__s,_.__d=!1),n.__e=i.__e,n.__k=i.__k,n.__k.some((function(t){t&&(t.__=n)})),S=0;S<_._sb.length;S++)_.__h.push(_._sb[S]);_._sb=[],_.__h.length&&r.push(_);break t}null!=_.componentWillUpdate&&_.componentWillUpdate(P,_.__s,x),k&&null!=_.componentDidUpdate&&_.__h.push((function(){_.componentDidUpdate(g,h,v)}))}if(_.context=x,_.props=P,_.__P=t,_.__e=!1,I=e.__r,T=0,k){for(_.state=_.__s,_.__d=!1,I&&I(n),d=_.render(_.props,_.state,_.context),A=0;A<_._sb.length;A++)_.__h.push(_._sb[A]);_._sb=[]}else do{_.__d=!1,I&&I(n),d=_.render(_.props,_.state,_.context),_.state=_.__s}while(_.__d&&++T<25);_.state=_.__s,null!=_.getChildContext&&(o=f(f({},o),_.getChildContext())),k&&!p&&null!=_.getSnapshotBeforeUpdate&&(v=_.getSnapshotBeforeUpdate(g,h)),N(t,m(E=null!=d&&d.type===y&&null==d.key?d.props.children:d)?E:[E],n,i,o,s,a,r,l,c,u),_.base=n.__e,n.__u&=-161,_.__h.length&&r.push(_),w&&(_.__E=_.__=null)}catch(t){if(n.__v=null,c||null!=a){for(n.__u|=c?160:128;l&&8===l.nodeType&&l.nextSibling;)l=l.nextSibling;a[a.indexOf(l)]=null,n.__e=l}else n.__e=i.__e,n.__k=i.__k;e.__e(t,n,i)}else null==a&&n.__v===i.__v?(n.__k=i.__k,n.__e=i.__e):n.__e=U(i.__e,n,i,o,s,a,r,c,u);(d=e.diffed)&&d(n)}function O(t,n,i){n.__d=void 0;for(var o=0;o<i.length;o++)j(i[o],i[++o],i[++o]);e.__c&&e.__c(n,t),t.some((function(n){try{t=n.__h,n.__h=[],t.some((function(t){t.call(n)}))}catch(t){e.__e(t,n.__v)}}))}function U(n,i,o,s,a,r,l,c,u){var _,p,f,h,v,y,b,P=o.props,k=i.props,C=i.type;if("svg"===C?a="http://www.w3.org/2000/svg":"math"===C?a="http://www.w3.org/1998/Math/MathML":a||(a="http://www.w3.org/1999/xhtml"),null!=r)for(_=0;_<r.length;_++)if((v=r[_])&&"setAttribute"in v==!!C&&(C?v.localName===C:3===v.nodeType)){n=v,r[_]=null;break}if(null==n){if(null===C)return document.createTextNode(k);n=document.createElementNS(a,C,k.is&&k),c&&(e.__m&&e.__m(i,r),c=!1),r=null}if(null===C)P===k||c&&n.data===k||(n.data=k);else{if(r=r&&t.call(n.childNodes),P=o.props||d,!c&&null!=r)for(P={},_=0;_<n.attributes.length;_++)P[(v=n.attributes[_]).name]=v.value;for(_ in P)if(v=P[_],"children"==_);else if("dangerouslySetInnerHTML"==_)f=v;else if(!(_ in k)){if("value"==_&&"defaultValue"in k||"checked"==_&&"defaultChecked"in k)continue;E(n,_,null,v,a)}for(_ in k)v=k[_],"children"==_?h=v:"dangerouslySetInnerHTML"==_?p=v:"value"==_?y=v:"checked"==_?b=v:c&&"function"!=typeof v||P[_]===v||E(n,_,v,P[_],a);if(p)c||f&&(p.__html===f.__html||p.__html===n.innerHTML)||(n.innerHTML=p.__html),i.__k=[];else if(f&&(n.innerHTML=""),N(n,m(h)?h:[h],i,o,s,"foreignObject"===C?"http://www.w3.org/1999/xhtml":a,r,l,r?r[0]:o.__k&&w(o,0),c,u),null!=r)for(_=r.length;_--;)g(r[_]);c||(_="value","progress"===C&&null==y?n.removeAttribute("value"):void 0!==y&&(y!==n[_]||"progress"===C&&!y||"option"===C&&y!==P[_])&&E(n,_,y,P[_],a),_="checked",void 0!==b&&b!==n[_]&&E(n,_,b,P[_],a))}return n}function j(t,n,i){try{if("function"==typeof t){var o="function"==typeof t.__u;o&&t.__u(),o&&null==n||(t.__u=t(n))}else t.current=n}catch(t){e.__e(t,i)}}function R(t,n,i){var o,s;if(e.unmount&&e.unmount(t),(o=t.ref)&&(o.current&&o.current!==t.__e||j(o,null,n)),null!=(o=t.__c)){if(o.componentWillUnmount)try{o.componentWillUnmount()}catch(t){e.__e(t,n)}o.base=o.__P=null}if(o=t.__k)for(s=0;s<o.length;s++)o[s]&&R(o[s],n,i||"function"!=typeof t.type);i||g(t.__e),t.__c=t.__=t.__e=t.__d=void 0}function W(t,e,n){return this.constructor(t,n)}function H(n,i,o){var s,a,r,l;e.__&&e.__(n,i),a=(s="function"==typeof o)?null:o&&o.__k||i.__k,r=[],l=[],D(i,n=(!s&&o||i).__k=h(y,null,[n]),a||d,d,i.namespaceURI,!s&&o?[o]:a?null:i.firstChild?t.call(i.childNodes):null,r,!s&&o?o:a?a.__e:i.firstChild,s,l),O(r,n,l)}t=_.slice,e={__e:function(t,e,n,i){for(var o,s,a;e=e.__;)if((o=e.__c)&&!o.__)try{if((s=o.constructor)&&null!=s.getDerivedStateFromError&&(o.setState(s.getDerivedStateFromError(t)),a=o.__d),null!=o.componentDidCatch&&(o.componentDidCatch(t,i||{}),a=o.__d),a)return o.__E=o}catch(e){t=e}throw t}},n=0,b.prototype.setState=function(t,e){var n;n=null!=this.__s&&this.__s!==this.state?this.__s:this.__s=f({},this.state),"function"==typeof t&&(t=t(f({},n),this.props)),t&&f(n,t),null!=t&&this.__v&&(e&&this._sb.push(e),k(this))},b.prototype.forceUpdate=function(t){this.__v&&(this.__e=!0,t&&this.__h.push(t),k(this))},b.prototype.render=y,i=[],s="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,a=function(t,e){return t.__v.__b-e.__v.__b},C.__r=0,r=0,l=L(!1),c=L(!0),u=0;var $,M,F,Q,q=0,B=[],X=e,V=X.__b,K=X.__r,G=X.diffed,z=X.__c,J=X.unmount,Y=X.__;function Z(t,e){X.__h&&X.__h(M,t,q||e),q=0;var n=M.__H||(M.__H={__:[],__h:[]});return t>=n.__.length&&n.__.push({}),n.__[t]}function tt(t){return q=1,et(pt,t)}function et(t,e,n){var i=Z($++,2);if(i.t=t,!i.__c&&(i.__=[n?n(e):pt(void 0,e),function(t){var e=i.__N?i.__N[0]:i.__[0],n=i.t(e,t);e!==n&&(i.__N=[n,i.__[1]],i.__c.setState({}))}],i.__c=M,!M.u)){var o=function(t,e,n){if(!i.__c.__H)return!0;var o=i.__c.__H.__.filter((function(t){return!!t.__c}));if(o.every((function(t){return!t.__N})))return!s||s.call(this,t,e,n);var a=!1;return o.forEach((function(t){if(t.__N){var e=t.__[0];t.__=t.__N,t.__N=void 0,e!==t.__[0]&&(a=!0)}})),!(!a&&i.__c.props===t)&&(!s||s.call(this,t,e,n))};M.u=!0;var s=M.shouldComponentUpdate,a=M.componentWillUpdate;M.componentWillUpdate=function(t,e,n){if(this.__e){var i=s;s=void 0,o(t,e,n),s=i}a&&a.call(this,t,e,n)},M.shouldComponentUpdate=o}return i.__N||i.__}function nt(t,e){var n=Z($++,3);!X.__s&&_t(n.__H,e)&&(n.__=t,n.i=e,M.__H.__h.push(n))}function it(t){return q=5,ot((function(){return{current:t}}),[])}function ot(t,e){var n=Z($++,7);return _t(n.__H,e)&&(n.__=t(),n.__H=e,n.__h=t),n.__}function st(t,e){return q=8,ot((function(){return t}),e)}function at(t){var e=M.context[t.__c],n=Z($++,9);return n.c=t,e?(null==n.__&&(n.__=!0,e.sub(M)),e.props.value):t.__}function rt(){for(var t;t=B.shift();)if(t.__P&&t.__H)try{t.__H.__h.forEach(ut),t.__H.__h.forEach(dt),t.__H.__h=[]}catch(e){t.__H.__h=[],X.__e(e,t.__v)}}X.__b=function(t){M=null,V&&V(t)},X.__=function(t,e){t&&e.__k&&e.__k.__m&&(t.__m=e.__k.__m),Y&&Y(t,e)},X.__r=function(t){K&&K(t),$=0;var e=(M=t.__c).__H;e&&(F===M?(e.__h=[],M.__h=[],e.__.forEach((function(t){t.__N&&(t.__=t.__N),t.i=t.__N=void 0}))):(e.__h.forEach(ut),e.__h.forEach(dt),e.__h=[],$=0)),F=M},X.diffed=function(t){G&&G(t);var e=t.__c;e&&e.__H&&(e.__H.__h.length&&(1!==B.push(e)&&Q===X.requestAnimationFrame||((Q=X.requestAnimationFrame)||ct)(rt)),e.__H.__.forEach((function(t){t.i&&(t.__H=t.i),t.i=void 0}))),F=M=null},X.__c=function(t,e){e.some((function(t){try{t.__h.forEach(ut),t.__h=t.__h.filter((function(t){return!t.__||dt(t)}))}catch(n){e.some((function(t){t.__h&&(t.__h=[])})),e=[],X.__e(n,t.__v)}})),z&&z(t,e)},X.unmount=function(t){J&&J(t);var e,n=t.__c;n&&n.__H&&(n.__H.__.forEach((function(t){try{ut(t)}catch(t){e=t}})),n.__H=void 0,e&&X.__e(e,n.__v))};var lt="function"==typeof requestAnimationFrame;function ct(t){var e,n=function(){clearTimeout(i),lt&&cancelAnimationFrame(e),setTimeout(t)},i=setTimeout(n,100);lt&&(e=requestAnimationFrame(n))}function ut(t){var e=M,n=t.__c;"function"==typeof n&&(t.__c=void 0,n()),M=e}function dt(t){var e=M;t.__c=t.__(),M=e}function _t(t,e){return!t||t.length!==e.length||e.some((function(e,n){return e!==t[n]}))}function pt(t,e){return"function"==typeof e?e(t):e}const mt=function(t,e=!1){return MgUpcTexts&&MgUpcTexts[t]?e?e.reduce((function(t,e){return t.replace(/%s/,e)}),MgUpcTexts[t]):MgUpcTexts[t]:t},ft="ui/reset",gt="ui/error",ht="ui/message",vt="ui/editing",yt="listOfLists/set",bt="listOfLists/remove",wt="listOfLists/create",Pt="listOfList/addingPost",kt="listOfList/setPage",Ct="listOfList/setTotalPages",Nt="list/set",xt="list/update",St="list/setPage",It="list/setTotalPages",Tt="list/setItems",At="list/removeItem",Et="list/addItem",Lt="list/updateItem",Dt="list/moveItem",Ot="list/moveItemNext",Ut="list/moveItemPrev",jt="list/cart",Rt=async function(t,e="",n={},i="mg-upc/v1/lists"){if(void 0===Qt().nonce){const t=new FormData;t.append("action","mg_upc_user");const e={method:"POST",credentials:"same-origin",referrerPolicy:"no-referrer",body:t},n=await fetch(Qt().ajaxUrl,e),i=await n.json();i.nonce&&(Qt().nonce=i.nonce),i.user_id&&(Qt().user_id=i.user_id)}const o={method:t,credentials:"same-origin",headers:{"Content-Type":"application/json","X-WP-Nonce":Qt().nonce},referrerPolicy:"no-referrer"};"GET"!==t&&n&&(o.body=JSON.stringify(n));const s=await fetch(Qt().root+i+e,o);return s.headers.get("x-wp-nonce")&&(Qt().nonce=s.headers.get("x-wp-nonce")),{data:await s.json(),headers:s.headers,status:s.status}};function Wt(t){const e=Object.entries(t).filter((([,t])=>null!=t)).map((([t,e])=>`${encodeURIComponent(t)}=${encodeURIComponent(String(e))}`)),n=-1!==Qt().root.indexOf("?")?"&":"?";return e.length>0?`${n}${e.join("&")}`:""}class Ht extends Error{constructor(t,e){super(t),this.name="MgApiError",this.code=e?.data?.code,this.response=e}}function $t(t){let e=t?.data?.data?.status;if(!e&&t.status&&(e=t.status),400===e||401===e||403===e||404===e||409===e||500===e)throw new Ht(t?.data?.message,t)}let Mt={my:function(t={}){return Rt("GET","/My"+Wt(t),{}).then((function(t){return $t(t),t}))},discover:function(t){return Rt("GET","/"+Wt(t),{}).then((function(t){return $t(t),t}))},get:function(t){return Rt("GET","/"+t,{}).then((function(t){return $t(t),t}))},cart:function(t){return Rt("POST","/cart",{list:t},"mg-upc/v1").then((function(t){return $t(t),t}))},items:function(t,e={}){return Rt("GET","/"+t+"/items"+Wt(e),{}).then((function(t){return $t(t),t}))},delete:function(t){return Rt("DELETE","/"+t,{}).then((function(t){return $t(t),t}))},create:function(t){return Rt("POST","",t).then((function(t){return $t(t),t}))},update:function(t){let e=t.id;return delete t.id,Rt("PATCH","/"+e,t).then((function(t){return $t(t),t}))},add:function(t,e,n={}){return"object"!=typeof e&&(e={post_id:e}),Rt("POST","/"+t+"/items"+Wt(n),e).then((function(t){return $t(t),t}))},quit:function(t,e,n={}){return Rt("DELETE","/"+t+"/items/"+e+Wt(n),{}).then((function(t){return $t(t),t}))},updateItem:function(t,e,n){return Rt("PATCH","/"+t+"/items/"+e,n).then((function(t){return $t(t),t}))},vote:function(t,e,n={}){return Rt("POST","/"+t+"/items/"+e+"/vote",n).then((function(t){return $t(t),t}))},move:function(t,e,n){return Rt("PATCH","/"+t+"/items/"+e,{position:n}).then((function(t){return $t(t),t}))}};const Ft=Mt;function Qt(){return MgUserPostCollections}function qt(){return Qt()?.sortable}function Bt(t){const e=Qt()?.types;return!(!e||!e[t])&&e[t]}function Xt(t){const e=Qt()?.statuses;return!(!e||!e[t])&&e[t]}function Vt(t,e){return!!t.type&&Gt(t.type,e)}function Kt(t){const e=[],n=Qt()?.types;for(const i in n)n.hasOwnProperty(i)&&(Gt(i,"always_exists")||(t?.type?n[i].available_post_types.includes(t.type)&&e.push(n[i]):e.push(n[i])));return e}function Gt(t,e){const n=Bt(t);return!(!n||!n.supports)&&n.supports.includes(e)}const zt="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVQYV2NgYAAAAAMAAWgmWQ0AAAAASUVORK5CYII=";function Jt(t){return JSON.parse(JSON.stringify(t))}function Yt(t){return"string"!=typeof t?"":t.replace(/([^>\r\n]?)(\r\n|\n\r|\r|\n)/g,"$1<br>$2")}function Zt(t){return Ft.cart(t).then((t=>(jQuery&&t.data.fragments&&t.data.cart_hash&&jQuery(document.body).trigger("added_to_cart",[t.data.fragments,t.data.cart_hash]),t.data)))}function te(t,e="error"){if(!jQuery)return!1;const n=jQuery("<div>").addClass("mg-upc-alert mg-upc-alert-"+e);n.append(jQuery("<p>").html(t));const i=jQuery('<a class="mg-upc-alert-close" href="#"><span class="mg-upc-icon upc-font-close"></span></a>').on("click",(function(){return n.remove(),!1}));return n.append(i),n}function ee(t,e){const{type:n,payload:i}=e;let o=!1;const s=t=>(o=a({status:"failed"}),t.error&&(o.error=t.error.message?t.error.message:"",o.errorCode=t.error.code?t.error.code:""),o),a=(e=null)=>{if(o||(o=Jt(t)),e)for(const t in e)e.hasOwnProperty(t)&&(o[t]=e[t]);return o},r=(t,e=0,n="succeeded")=>(0!==e&&(t.loadingCount=t.loadingCount+e),t.loadingCount<1?(t.loadingCount=0,t.status=n):t.status="loading",t);let l=function(t,e){const{type:n,payload:i}=e;let o,s;const a=(e=!1)=>{if(s||(s=!1===t?{}:Jt(t)),e)for(const t in e)s[t]=e[t];return s};switch(n){case Nt:return!0===i?{ID:-1,title:"",content:"",status:"",type:""}:i;case xt:return i.items=Jt(t.items),i;case wt:return i;case Tt:return a({items:i});case Et+"/failed":case Et:return i?.list?a(i.list):t;case Lt:const e=!!i.item&&i.item;return o=a().items.map((t=>t.post_id===i.post_id?e||Object.assign({},t,i):{...t})),a({items:o});case At:if(!t.items||1===t.items.length||!1===i)return t;if(s=a(),o=s.items.filter((t=>t.post_id!==i)),Gt(t.type,"sortable")){const e=parseInt(t.items[0].position,10);o.forEach(((t,n)=>{o[n].position=e+n}))}if(s.count=s.count-1,Gt(t.type,"vote")){const e=t.items.find((t=>t.post_id==i));e&&(s.vote_counter=s.vote_counter-e.votes)}return{...s,items:o};case Dt:const n=parseInt(t.items[0].position,10);o=a().items.slice();const r=a().items[i.oldIndex];return o.splice(i.oldIndex,1),o.splice(i.newIndex,0,r),isNaN(n)?(alert("positions error!"),t):(o.forEach(((t,e)=>{o[e].position=n+e})),a({items:o}));default:return t}}(t.list,e),c=function(t,e){const{type:n,payload:i}=e;switch(n){case yt:return i;case Et:case Nt:return!1;case bt:return!1===i?t:Jt(t.filter((t=>t.ID!=i)));default:return t}}(t.listOfList,e);switch(t.list===l&&c===t.listOfList||(o=a({listOfList:c,list:l}),t.addingPost||(o.title=o.list?o.list.title:se.title)),n){case"ui/mode":return a({mode:i});case ft:return{...se,mode:t.mode};case gt:return a(!1===i?{error:!1,errorCode:!1}:{error:i});case ht:return a(!1===i?{message:!1,errorCode:!1}:{message:i});case jt:const n=a();return i.msg&&(n.message=i.msg),i.err&&(n.error=i.err),n;case vt:return a({editing:i});case Pt:return o=a(),o.addingPost=i,i&&(o.title=mt("Add to...")),o;case wt:o=a(),o.title=i.title?i.title:se.title,o.listTotalPages=1,o.listPage=1,o.addingPost=!1;break;case Et:if(o=a(),i?.list){const t=i.list;o.title=t.title?t.title:se.title;const e=t?.items_page;e&&(o.listTotalPages=e["X-WP-TotalPages"]?e["X-WP-TotalPages"]:1,o.listPage=e["X-WP-Page"]?e["X-WP-Page"]:1)}i.message&&(o=r(o,-1,"failed"),o.error=i.message),o.addingPost=!1;break;case kt:return a({page:i});case Ct:return a({totalPages:i});case St:return a({listPage:i});case It:return a({listTotalPages:i});case Nt+"/loading":return o=r(a(),1),o.listOfList=!1,"object"==typeof i?(o.list=i,i.title&&(o.title=i.title)):o.list={ID:i},o;case At+"/loading":return o=r(a(),1),"object"==typeof i&&i.list_id&&(o.list={ID:i.list_id}),o;case yt+"/loading":case Tt+"/loading":case Lt+"/loading":case Et+"/loading":case Ot+"/loading":case Ut+"/loading":case xt+"/loading":case wt+"/loading":case jt+"/loading":return r(a(),1);case Et+"/succeeded":return o=r(a(),-1),o.addingPost=!1,o.status="succeeded",o.error=!1,o.errorCode=!1,o.title=o.list?o.list.title:se.title,o;case jt+"/succeeded":return r(a({errorCode:!1}),-1);case Nt+"/succeeded":var u={error:!1,errorCode:!1};return!1===t.list&&(u={}),r(a(u),-1);case yt+"/succeeded":case Tt+"/succeeded":case Lt+"/succeeded":case At+"/succeeded":case Dt+"/succeeded":case Ot+"/succeeded":case Ut+"/succeeded":case xt+"/succeeded":case wt+"/succeeded":return r(a({error:!1,errorCode:!1}),-1);case wt+"/failed":return o=r(a(),-1,"failed"),e.error&&e.error.message&&(o.error=e.error.message),o;case Et+"/failed":if(o=r(a(),-1),o.addingPost=!1,o.title=o.list?o.list.title:se.title,i?.list){const t=i.list;o.title=t.title?t.title:se.title;const e=t?.items_page;e&&(o.listTotalPages=e["X-WP-TotalPages"]?e["X-WP-TotalPages"]:1,o.listPage=e["X-WP-Page"]?e["X-WP-Page"]:1)}return i.message&&(o.error=i.message,o.status="failed"),s(e);case yt+"/failed":case Tt+"/failed":case Lt+"/failed":case At+"/failed":case Dt+"/failed":case Ot+"/failed":case Ut+"/failed":case xt+"/failed":case Nt+"/failed":case jt+"/failed":return r(s(e),-1)}return!1!==o?o:t}const ne=(t,e)=>function(n=null,...i){return{asyncThunk:!0,payload:e,type:t,arg:n,extra:i}};class ie extends Error{constructor(t,e){super(t),this.name="MgUpcRejectWithValue",this.value=e}}const oe=(t,e)=>n=>{let i;if((o=n)&&"object"==typeof o&&!0===o.asyncThunk){let o={dispatch:oe(t,e),getState:e,extra:n.extra,rejectWithValue:t=>new ie(n.type+": rejectWithValue",t)};t({type:n.type+"/loading",payload:n.arg}),i=n.payload(n.arg,o)}else{if(!(t=>!!t&&("object"==typeof t||"function"==typeof t)&&"function"==typeof t.then)(n.payload))return void t(n);t({type:n.type+"/loading"}),i=n.payload}var o;i.then((e=>{e instanceof ie?t({type:n.type+"/failed",payload:e.value}):(t({type:n.type,payload:e}),t({type:n.type+"/succeeded"}))})).catch((e=>{t(e instanceof ie?{type:n.type+"/failed",payload:e.value}:{type:n.type+"/failed",error:e})}))},se={list:!1,listOfList:!1,addingPost:null,status:"idle",loadingCount:0,error:null,message:null,errorCode:null,editing:!1,title:mt("My Lists"),actualAction:"init",page:1,totalPages:1,listPage:1,listTotalPages:1,mode:"my"},ae=function(t,e){var n={__c:e="__cC"+u++,__:t,Consumer:function(t,e){return t.children(e)},Provider:function(t){var n,i;return this.getChildContext||(n=new Set,(i={})[e]=this,this.getChildContext=function(){return i},this.componentWillUnmount=function(){n=null},this.shouldComponentUpdate=function(t){this.props.value!==t.value&&n.forEach((function(t){t.__e=!0,k(t)}))},this.sub=function(t){n.add(t);var e=t.componentWillUnmount;t.componentWillUnmount=function(){n&&n.delete(t),e&&e.call(t)}}),t.children}};return n.Provider.__=n.Consumer.contextType=n}({});function re(t){return new Date(t).toLocaleDateString()}const le=function(t){const{state:e,dispatch:n}=at(ae);return h("li",{className:"mg-upc-dg-item-list",onClick:t.onClick,onKeyPress:e=>{13===e.keyCode&&t.onClick(e)},tabIndex:"0"},h("i",{className:"mg-upc-icon mg-upc-dg-item-type mg-upc-dg-item-type-"+t.list.type}),h("div",{className:"mg-upc-dg-item-title"},h("span",null,t.list.title),"my"!==e.mode&&h(y,null,h("span",null,h("a",{href:"#",onClick:function(e){!function(t){t.stopImmediatePropagation&&t.stopImmediatePropagation(),t.stopPropagation&&t.stopPropagation(),t.preventDefault()}(e),function(t,e){const n=new URLSearchParams(document.location.hash.substring(1));n.set("author",e);let i=n.toString();""!==i&&(i="#"+i),window.location.hash=i}(0,t.list.author)}},t.list.user_login),h("span",{className:"mg-upc-list-dates"},h("i",null," ",h("b",null,"Created:")," ",re(t.list.created)),h("i",null," ",h("b",null,"Modified:")," ",re(t.list.modified)))))),h("span",{className:"mg-upc-dg-item-count"},t.list.count),h("span",{className:"mg-upc-dg-item-actions"},t.onRemove&&h("button",{"aria-label":mt("Remove List"),onClick:e=>{e.stopPropagation(),t.onRemove(t.list)}},h("span",{className:"mg-upc-icon upc-font-trash"}))))};class ce extends b{static defaultProps={count:1,duration:1.2,width:null,wrapper:null,height:null,circle:!1};render(){const t=[];for(let e=0;e<this.props.count;e++){let n=this.props.styles?this.props.styles:{};null!=this.props.width&&(n.width=this.props.width),null!=this.props.height&&(n.height=this.props.height),null!==this.props.width&&null!==this.props.height&&this.props.circle&&(n.borderRadius="50%"),t.push(h("span",{key:e,className:"mg-upc-dg-loading-skeleton",style:n},""))}const e=this.props.wrapper;return h("span",null,e?t.map(((t,n)=>h(e,{key:n},t,""))):t)}}const ue=function(t){return h("div",{className:"mg-upc-dg-pagination-div"},h("button",{className:1===t.page?"mg-upc-dg-hidden mg-upc-dg-pagination":"mg-upc-dg-pagination",ref:t.prevRef,disabled:1===t.page,"aria-label":mt("Previous page"),title:mt("Previous page"),onClick:t.onPreview},h("span",{className:"mg-upc-icon upc-font-arrow_left"})),h("span",{className:t.totalPages>1?"mg-upc-dg-pagination-current":"mg-upc-dg-hidden mg-upc-dg-pagination-current"},t.page),h("button",{className:t.page>=t.totalPages?"mg-upc-dg-hidden mg-upc-dg-pagination":"mg-upc-dg-pagination",ref:t.nextRef,disabled:t.page>=t.totalPages,"aria-label":mt("Next page"),title:mt("Next page"),onClick:t.onNext},h("span",{className:"mg-upc-icon upc-font-arrow_right"})))},de=()=>({type:ft,payload:null}),_e=t=>({type:Pt,payload:t}),pe=t=>({type:vt,payload:t}),me=ne(jt,(async function(t,e){return await Zt(t)})),fe=ne(yt,(async function(t,e){const n=t?.addingPost;return null===t&&(t={}),t.addingPost?t.adding=t.addingPost:(t.adding="",delete t.adding),await Ft.my(t).then((t=>ge(t,e,n)))}));function ge(t,e,n){if(t.headers.get("x-wp-page")&&(e.dispatch(ve(parseInt(t.headers.get("x-wp-page"),10))),e.dispatch(ye(parseInt(t.headers.get("X-WP-TotalPages"),10)))),n&&t.headers.get("X-WP-Post-Type")){const i={post_id:n},o={"X-WP-Post-Type":"type","X-WP-Post-Title":"title","X-WP-Post-Image":"image"};for(const e in o){const n=t.headers.get(e);n&&(i[o[e]]=decodeURIComponent(n))}e.dispatch(_e(i))}return t.data}ne(yt,(async function(t,e){return null===t&&(t={}),await Ft.discover(t).then((t=>ge(t,e,!1)))}));const he=ne(bt,(async function(t,e){return await Ft.delete(t).then((n=>{if(1===e.getState().listOfList.length){const n=e.getState().page,i=e.getState().totalPages;if(n<i)e.dispatch(fe({page:n}));else{if(!(n>1&&n===i))return t;e.dispatch(fe({page:n-1}))}return!1}return t}))})),ve=t=>({type:kt,payload:t}),ye=t=>({type:Ct,payload:t}),be=t=>({type:St,payload:t}),we=t=>({type:It,payload:t}),Pe=ne(Nt,(async function(t,e){return!1===t||!0===t?t:await Ft.get("object"==typeof t?t.ID:t).then((t=>(Le(t,e.dispatch),t.data)))})),ke=ne(xt,(async function(t,e){return await Ft.update(t).then((t=>(e.dispatch(pe(!1)),Le(t,e.dispatch),t.data)))})),Ce=ne(wt,(async function(t,e){return null===t&&(t={}),t.adding&&t.adding!==e.getState().addingPost&&e.dispatch(_e({id:t.addingPost})),await Ft.create(t).then((t=>(e.dispatch(pe(!1)),Le(t,e.dispatch),t.data)))})),Ne=ne(Tt,(async function(t,e){return await Ft.items(e.getState().list.ID,t).then((t=>(Le(t,e.dispatch),t.data)))})),xe=ne(At,(async function(t,e){const n=e.getState();var i=e.extra.length>0?e.extra[0]:n.list.ID;const o=e.extra.length>1?e.extra[1]:"view";return await Ft.quit(i,t,{context:o}).then((s=>{if(s.data&&s.data.list_id&&(i=s.data.list_id),n.list&&n.list.ID)if(1===n.list.items.length){if(n.list&&"view"===o){const t=n.listPage,i=n.listTotalPages;return t<i?e.dispatch(Ne({page:t})):t===i&&e.dispatch(Ne({page:Math.max(1,t-1)})),!1}}else n.list&&"view"===o&&n.listTotalPages===n.listPage+1&&n.list.count%n.list.items.length==1&&e.dispatch(Ne({page:n.listPage}));else e.dispatch(Pe({ID:i}));return t}))})),Se=ne(Et,(async function(t,e){let n=e.extra[0],i=!1;try{await Ft.add(t,n,{context:e.extra.length>1?e.extra[1]:"view"}).then((t=>{i=t.data}))}catch(t){const n=t?.response?.data;i=e.rejectWithValue(n)}return i})),Ie=ne(Lt,(async function(t,e){const n=e.extra[0];return await Ft.updateItem(e.getState().list.ID,t,n).then((e=>({...n,post_id:t,item:e?.data?.item})))})),Te=ne(Dt,(async function(t,e){const n=e.extra[0],i=e.extra[1],o=n.items[t],s=o.position-t+i;return await Ft.move(n.ID,o.post_id,s).then((e=>({oldIndex:t,newIndex:i})))})),Ae=ne(Ot,(async function(t,e){const n=e.getState().list,i=parseInt(n.items[n.items.length-1].position,10);if(isNaN(i))throw alert("positions error!"),"positions error!";const o=n.items[t];return await Ft.move(n.ID,o.post_id,i+1),await e.dispatch(Ne({page:e.getState().listPage})),t})),Ee=ne(Ut,(async function(t,e){const n=e.getState().list,i=parseInt(n.items[0].position,10);if(isNaN(i))throw alert("positions error!"),"positions error!";const o=n.items[t];return await Ft.move(n.ID,o.post_id,i-1),await e.dispatch(Ne({page:e.getState().listPage})),t}));function Le(t,e){!t.data.items_page&&t.headers.get("x-wp-page")?(e(be(parseInt(t.headers.get("x-wp-page"),10))),e(we(parseInt(t.headers.get("X-WP-TotalPages"),10)))):t.data.items_page&&(e(be(parseInt(t.data.items_page["X-WP-Page"],10))),e(we(parseInt(t.data.items_page["X-WP-TotalPages"],10))))}const De=function(t){const{state:e,dispatch:n}=at(ae);return h(y,null,h("ul",{className:"mg-upc-dg-list-of-lists-fake mg-upc-dg-on-loading"},[0,1,2].map((t=>h("li",{className:"mg-upc-dg-item-list"},h("div",null,h(ce,{width:"1.5em",height:"1.5em"})),h("div",{className:"mg-upc-dg-item-title"},h(ce,null)),h("div",{className:"mg-upc-dg-item-count"},h(ce,null)))))),h("ul",{className:"mg-upc-dg-list-of-lists"},t.lists&&t.lists.map((e=>h(le,{list:e,onClick:()=>t.onSelect(e),onRemove:t.onRemove,key:e.ID})))),e.totalPages>1&&h(ue,{totalPages:e.totalPages,page:e.page,onPreview:t.loadPreview,onNext:t.loadNext}))},Oe=function(t){const[e,n]=tt(!1),[i,o]=tt(""),s=it({});nt((()=>{o(t.item.description)}),[t.item]),nt((()=>{e&&s.current.focus()}),[e]);const a=()=>"string"==typeof i&&i.length>0;return h(y,null,h("span",null,h("br",null),"Adding item:"),h("div",{className:"mg-upc-dg-item mg-upc-dg-item-adding","data-post_id":t.item.post_id},h("span",{className:"mg-upc-icon upc-font-add"}),h("span",null," "),h("img",{className:"mg-upc-dg-item-image",src:t.item.image?t.item.image:zt}),h("div",{className:"mg-upc-dg-item-data"},h("a",{href:t.item?.link},t.item?.title),!e&&h("p",null,t.item?.description),!e&&h("button",{onClick:()=>{n(!0)}},a()&&h("span",null,mt("Edit Comment")),!a()&&h("span",null,mt("Add Comment"))),h("input",{ref:s,className:e?"mg-upc-dg-btn-item-desc":"mg-upc-dg-dn",type:"text",value:i,onChange:function(t){o(t.target.value)},onKeyDown:e=>{"Enter"===e.key&&(n(!1),t.onSaveItemDescription(i))},maxLength:400}),e&&h("button",{className:"mg-upc-dg-btn-item-desc-cancel",onClick:()=>{n(!1),o(t.item.description)}},h("span",{className:"mg-upc-icon upc-font-close"}),h("span",null,mt("Cancel"))),e&&h("button",{className:"mg-upc-dg-btn-item-desc-save",onClick:()=>{n(!1),t.onSaveItemDescription(i)}},h("span",{className:"mg-upc-icon upc-font-save"}),h("span",null,mt("Save"))))),h("span",null,mt("Select where the item will be added:")))};function Ue(){return Ue=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)({}).hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},Ue.apply(null,arguments)}function je(t,e){for(var n in t)if("__source"!==n&&!(n in e))return!0;for(var i in e)if("__source"!==i&&t[i]!==e[i])return!0;return!1}function Re(t,e){this.props=t,this.context=e}(Re.prototype=new b).isPureReactComponent=!0,Re.prototype.shouldComponentUpdate=function(t,e){return je(this.props,t)||je(this.state,e)};var We=e.__b;e.__b=function(t){t.type&&t.type.__f&&t.ref&&(t.props.ref=t.ref,t.ref=null),We&&We(t)},"undefined"!=typeof Symbol&&Symbol.for&&Symbol.for("react.forward_ref");var He=e.__e;e.__e=function(t,e,n,i){if(t.then)for(var o,s=e;s=s.__;)if((o=s.__c)&&o.__c)return null==e.__e&&(e.__e=n.__e,e.__k=n.__k),o.__c(t,e);He(t,e,n,i)};var $e=e.unmount;function Me(t,e,n){return t&&(t.__c&&t.__c.__H&&(t.__c.__H.__.forEach((function(t){"function"==typeof t.__c&&t.__c()})),t.__c.__H=null),null!=(t=function(t,e){for(var n in e)t[n]=e[n];return t}({},t)).__c&&(t.__c.__P===n&&(t.__c.__P=e),t.__c=null),t.__k=t.__k&&t.__k.map((function(t){return Me(t,e,n)}))),t}function Fe(t,e,n){return t&&n&&(t.__v=null,t.__k=t.__k&&t.__k.map((function(t){return Fe(t,e,n)})),t.__c&&t.__c.__P===e&&(t.__e&&n.appendChild(t.__e),t.__c.__e=!0,t.__c.__P=n)),t}function Qe(){this.__u=0,this.t=null,this.__b=null}function qe(t){var e=t.__.__c;return e&&e.__a&&e.__a(t)}function Be(){this.u=null,this.o=null}e.unmount=function(t){var e=t.__c;e&&e.__R&&e.__R(),e&&32&t.__u&&(t.type=null),$e&&$e(t)},(Qe.prototype=new b).__c=function(t,e){var n=e.__c,i=this;null==i.t&&(i.t=[]),i.t.push(n);var o=qe(i.__v),s=!1,a=function(){s||(s=!0,n.__R=null,o?o(r):r())};n.__R=a;var r=function(){if(! --i.__u){if(i.state.__a){var t=i.state.__a;i.__v.__k[0]=Fe(t,t.__c.__P,t.__c.__O)}var e;for(i.setState({__a:i.__b=null});e=i.t.pop();)e.forceUpdate()}};i.__u++||32&e.__u||i.setState({__a:i.__b=i.__v.__k[0]}),t.then(a,a)},Qe.prototype.componentWillUnmount=function(){this.t=[]},Qe.prototype.render=function(t,e){if(this.__b){if(this.__v.__k){var n=document.createElement("div"),i=this.__v.__k[0].__c;this.__v.__k[0]=Me(this.__b,n,i.__O=i.__P)}this.__b=null}var o=e.__a&&h(y,null,t.fallback);return o&&(o.__u&=-33),[h(y,null,e.__a?null:t.children),o]};var Xe=function(t,e,n){if(++n[1]===n[0]&&t.o.delete(e),t.props.revealOrder&&("t"!==t.props.revealOrder[0]||!t.o.size))for(n=t.u;n;){for(;n.length>3;)n.pop()();if(n[1]<n[0])break;t.u=n=n[2]}};function Ve(t){return this.getChildContext=function(){return t.context},t.children}function Ke(t){var e=this,n=t.i;e.componentWillUnmount=function(){H(null,e.l),e.l=null,e.i=null},e.i&&e.i!==n&&e.componentWillUnmount(),e.l||(e.i=n,e.l={nodeType:1,parentNode:n,childNodes:[],contains:function(){return!0},appendChild:function(t){this.childNodes.push(t),e.i.appendChild(t)},insertBefore:function(t,n){this.childNodes.push(t),e.i.appendChild(t)},removeChild:function(t){this.childNodes.splice(this.childNodes.indexOf(t)>>>1,1),e.i.removeChild(t)}}),H(h(Ve,{context:e.context},t.__v),e.l)}(Be.prototype=new b).__a=function(t){var e=this,n=qe(e.__v),i=e.o.get(t);return i[0]++,function(o){var s=function(){e.props.revealOrder?(i.push(o),Xe(e,t,i)):o()};n?n(s):s()}},Be.prototype.render=function(t){this.u=null,this.o=new Map;var e=I(t.children);t.revealOrder&&"b"===t.revealOrder[0]&&e.reverse();for(var n=e.length;n--;)this.o.set(e[n],this.u=[1,0,this.u]);return t.children},Be.prototype.componentDidUpdate=Be.prototype.componentDidMount=function(){var t=this;this.o.forEach((function(e,n){Xe(t,n,e)}))};var Ge="undefined"!=typeof Symbol&&Symbol.for&&Symbol.for("react.element")||60103,ze=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image(!S)|letter|lighting|marker(?!H|W|U)|overline|paint|pointer|shape|stop|strikethrough|stroke|text(?!L)|transform|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/,Je=/^on(Ani|Tra|Tou|BeforeInp|Compo)/,Ye=/[A-Z0-9]/g,Ze="undefined"!=typeof document,tn=function(t){return("undefined"!=typeof Symbol&&"symbol"==typeof Symbol()?/fil|che|rad/:/fil|che|ra/).test(t)};b.prototype.isReactComponent={},["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach((function(t){Object.defineProperty(b.prototype,t,{configurable:!0,get:function(){return this["UNSAFE_"+t]},set:function(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:e})}})}));var en=e.event;function nn(){}function on(){return this.cancelBubble}function sn(){return this.defaultPrevented}e.event=function(t){return en&&(t=en(t)),t.persist=nn,t.isPropagationStopped=on,t.isDefaultPrevented=sn,t.nativeEvent=t};var an={enumerable:!1,configurable:!0,get:function(){return this.class}},rn=e.vnode;e.vnode=function(t){"string"==typeof t.type&&function(t){var e=t.props,n=t.type,i={},o=-1===n.indexOf("-");for(var s in e){var a=e[s];if(!("value"===s&&"defaultValue"in e&&null==a||Ze&&"children"===s&&"noscript"===n||"class"===s||"className"===s)){var r=s.toLowerCase();"defaultValue"===s&&"value"in e&&null==e.value?s="value":"download"===s&&!0===a?a="":"translate"===r&&"no"===a?a=!1:"o"===r[0]&&"n"===r[1]?"ondoubleclick"===r?s="ondblclick":"onchange"!==r||"input"!==n&&"textarea"!==n||tn(e.type)?"onfocus"===r?s="onfocusin":"onblur"===r?s="onfocusout":Je.test(s)&&(s=r):r=s="oninput":o&&ze.test(s)?s=s.replace(Ye,"-$&").toLowerCase():null===a&&(a=void 0),"oninput"===r&&i[s=r]&&(s="oninputCapture"),i[s]=a}}"select"==n&&i.multiple&&Array.isArray(i.value)&&(i.value=I(e.children).forEach((function(t){t.props.selected=-1!=i.value.indexOf(t.props.value)}))),"select"==n&&null!=i.defaultValue&&(i.value=I(e.children).forEach((function(t){t.props.selected=i.multiple?-1!=i.defaultValue.indexOf(t.props.value):i.defaultValue==t.props.value}))),e.class&&!e.className?(i.class=e.class,Object.defineProperty(i,"className",an)):(e.className&&!e.class||e.class&&e.className)&&(i.class=i.className=e.className),t.props=i}(t),t.$$typeof=Ge,rn&&rn(t)};var ln=e.__r;e.__r=function(t){ln&&ln(t),t.__c};var cn=e.diffed;e.diffed=function(t){cn&&cn(t);var e=t.props,n=t.__e;null!=n&&"textarea"===t.type&&"value"in e&&e.value!==n.value&&(n.value=null==e.value?"":e.value)};var un=['a[href]:not([tabindex^="-"])','area[href]:not([tabindex^="-"])','input:not([type="hidden"]):not([type="radio"]):not([disabled]):not([tabindex^="-"])','input[type="radio"]:not([disabled]):not([tabindex^="-"])','select:not([disabled]):not([tabindex^="-"])','textarea:not([disabled]):not([tabindex^="-"])','button:not([disabled]):not([tabindex^="-"])','iframe:not([tabindex^="-"])','audio[controls]:not([tabindex^="-"])','video[controls]:not([tabindex^="-"])','[contenteditable]:not([tabindex^="-"])','[tabindex]:not([tabindex^="-"])'];function dn(t){this._show=this.show.bind(this),this._hide=this.hide.bind(this),this._maintainFocus=this._maintainFocus.bind(this),this._bindKeypress=this._bindKeypress.bind(this),this.$el=t,this.shown=!1,this._id=this.$el.getAttribute("data-a11y-dialog")||this.$el.id,this._previouslyFocused=null,this._listeners={},this.create()}function _n(t,e){return n=(e||document).querySelectorAll(t),Array.prototype.slice.call(n);var n}function pn(t){(t.querySelector("[autofocus]")||t).focus()}function mn(){_n("[data-a11y-dialog]").forEach((function(t){new dn(t)}))}dn.prototype.create=function(){this.$el.setAttribute("aria-hidden",!0),this.$el.setAttribute("aria-modal",!0),this.$el.setAttribute("tabindex",-1),this.$el.hasAttribute("role")||this.$el.setAttribute("role","dialog"),this._openers=_n('[data-a11y-dialog-show="'+this._id+'"]'),this._openers.forEach(function(t){t.addEventListener("click",this._show)}.bind(this));const t=this.$el;return this._closers=_n("[data-a11y-dialog-hide]",this.$el).filter((function(e){return e.closest('[aria-modal="true"], [data-a11y-dialog]')===t})).concat(_n('[data-a11y-dialog-hide="'+this._id+'"]')),this._closers.forEach(function(t){t.addEventListener("click",this._hide)}.bind(this)),this._fire("create"),this},dn.prototype.show=function(t){if(this.shown)return this;this._previouslyFocused=document.activeElement;const e=t&&t.target?t.target:null;return e&&Object.is(this._previouslyFocused,document.body)&&(this._previouslyFocused=e),this.$el.removeAttribute("aria-hidden"),this.shown=!0,pn(this.$el),document.body.addEventListener("focus",this._maintainFocus,!0),document.addEventListener("keydown",this._bindKeypress),this._fire("show",t),this},dn.prototype.hide=function(t){return this.shown?(this.shown=!1,this.$el.setAttribute("aria-hidden","true"),this._previouslyFocused&&this._previouslyFocused.focus&&this._previouslyFocused.focus(),document.body.removeEventListener("focus",this._maintainFocus,!0),document.removeEventListener("keydown",this._bindKeypress),this._fire("hide",t),this):this},dn.prototype.destroy=function(){return this.hide(),this._openers.forEach(function(t){t.removeEventListener("click",this._show)}.bind(this)),this._closers.forEach(function(t){t.removeEventListener("click",this._hide)}.bind(this)),this._fire("destroy"),this._listeners={},this},dn.prototype.on=function(t,e){return void 0===this._listeners[t]&&(this._listeners[t]=[]),this._listeners[t].push(e),this},dn.prototype.off=function(t,e){var n=(this._listeners[t]||[]).indexOf(e);return n>-1&&this._listeners[t].splice(n,1),this},dn.prototype._fire=function(t,e){var n=this._listeners[t]||[],i=new CustomEvent(t,{detail:e});this.$el.dispatchEvent(i),n.forEach(function(t){t(this.$el,e)}.bind(this))},dn.prototype._bindKeypress=function(t){const e=document.activeElement;e&&e.closest('[aria-modal="true"]')!==this.$el||(this.shown&&"Escape"===t.key&&"alertdialog"!==this.$el.getAttribute("role")&&(t.preventDefault(),this.hide(t)),this.shown&&"Tab"===t.key&&function(t,e){var n=function(t){return _n(un.join(","),t).filter((function(t){return!!(t.offsetWidth||t.offsetHeight||t.getClientRects().length)}))}(t),i=n.indexOf(document.activeElement);e.shiftKey&&0===i?(n[n.length-1].focus(),e.preventDefault()):e.shiftKey||i!==n.length-1||(n[0].focus(),e.preventDefault())}(this.$el,t))},dn.prototype._maintainFocus=function(t){!this.shown||t.target.closest('[aria-modal="true"]')||t.target.closest("[data-a11y-dialog-ignore-focus-trap]")||pn(this.$el)},"undefined"!=typeof document&&("loading"===document.readyState?document.addEventListener("DOMContentLoaded",mn):window.requestAnimationFrame?window.requestAnimationFrame(mn):window.setTimeout(mn,16));const fn=t=>{const e=(()=>{const[t,e]=tt(!1);return nt((()=>e(!0)),[]),t})(),[n,i]=(t=>{const[e,n]=(()=>{const[t,e]=tt(null);return[t,st((t=>{null!==t&&e(new dn(t))}),[])]})(),i=st((()=>e.hide()),[e]),o=t.role||"dialog",s="alertdialog"===o,a=t.titleId||t.id+"-title";return nt((()=>()=>{e&&e.destroy()}),[e]),[e,{container:{id:t.id,ref:n,role:o,tabIndex:-1,"aria-modal":!0,"aria-hidden":!0,"aria-labelledby":a},overlay:{onClick:s?void 0:i},dialog:{role:"document"},closeButton:{type:"button",onClick:i},title:{role:"heading","aria-level":1,id:a}}]})(t),{dialogRef:o}=t;if(nt((()=>(n&&o(n),()=>o(void 0))),[o,n]),!e)return null;const s=t.dialogRoot?document.querySelector(t.dialogRoot):document.body,a=h("h2",Ue({},i.title,{className:t.classNames.title,key:"title"}),t.onBack&&h("a",{"aria-label":t.backButtonLabel,href:"#",onClick:e=>{e.preventDefault(),t.onBack(e)}},"←")," ",t.title),r=h("button",Ue({},i.closeButton,{className:t.classNames.closeButton,"aria-label":t.closeButtonLabel,key:"button"}),t.closeButtonContent),l=["first"===t.closeButtonPosition&&r,a,t.children,"last"===t.closeButtonPosition&&r].filter(Boolean);return function(t,e){var n=h(Ke,{__v:t,i:e});return n.containerInfo=e,n}(h("div",Ue({},i.container,{className:t.classNames.container}),h("div",Ue({},i.overlay,{className:t.classNames.overlay})),h("div",Ue({},i.dialog,{className:t.classNames.dialog}),l)),s)};fn.defaultProps={role:"dialog",closeButtonLabel:"Close this dialog window",closeButtonContent:"×",closeButtonPosition:"first",classNames:{},backButtonLabel:"Back",dialogRef:()=>{}},function(t){function e(e,i,o,s){const a=o||s.parent(),r=a.find(".mg-upc-item-vote").attr("disabled",!0);mgUpcApiClient.vote(e,i,{context:"web",posts:n(a)}).then((function(e){t(document.body).trigger("mg_upc_vote_response",[e,a])})).catch((function(t){r.attr("disabled",!1),t.response?.data?.message&&(s?s.append(te(t.response.data.message)):a.before(te(t.response.data.message)))}))}function n(e){return[...e.children().map((function(){return t(this).data("pid")}))].join(",")}t(".mg-upc-item-vote").on("click",(function(){const n=t(this).data("vote").split(",");return 2===n.length&&e(n[0],n[1],!1,t(this).closest(".mg-upc-item")),!1})),t((function(){t(".mg-upc-vote").each((function(){const n=t(this);e(n.data("id"),0,n.find(".mg-upc-items-container"),!1)}))})),t(document.body).on("mg_upc_vote_response",(function(e,n,i){if(!n.data)return;const o=parseInt(n.data.vote_counter,10),s=i.find(".mg-upc-item-vote");i.data("votes",o),n.data.can_vote?s.attr("disabled",!1).show():s.animate({width:0,padding:0,opacity:0},200,(function(){s.remove()})),n.data.posts.forEach((function(e){const n=i.find(".mg-upc-item[data-pid="+e.post_id+"]"),s=parseInt(e.votes,10);t(document.body).trigger("mg_upc_item_vote_set",[n,s,o])}))})),t(document.body).on("mg_upc_item_vote_set",(function(t,e,n,i){const o=i>0?Math.round(1e3*n/i)/10:0,s=e.find(".mg-upc-votes");s.find(".mg-upc-item-votes-number").html(n),s.find(".mg-upc-item-percent").html(o+"%"),s.find(".mg-upc-item-bar-progress").animate({width:o+"%"}),s.show()}))}(jQuery),function(t){t(".mg-upc-add-product-to-list").on("click",(function(){let e=t(this).data("id");const n=t(this).closest(".product,.summary").find("[name='variation_id']");return n.length>0&&parseInt(n.val(),10)>0&&(e=n.val()),window.addItemToList(e),!1}));const e="mg-upc-btn-loading",n="mg-upc-product-added",i="mg-upc-product-error",o="Sorry, an error occurred.";function s(a,r,l){if(r.hasClass(e))return!1;let c={product_id:r.data("product"),quantity:r.data("quantity")};if("0"==c.quantity){if(!l)return!!confirm(mt("The quantity is zero! Do you want to add a unit?"))&&s(a,r,!0);c.quantity=1}t(document.body).trigger("adding_to_cart",[r,c]);const u=woocommerce_params.wc_ajax_url.toString().replace("%%endpoint%%","add_to_cart");return t.ajax({type:"POST",url:u,data:c,beforeSend:function(t){r.removeClass(n+" "+i).addClass(e)},success:function(i){r.removeClass(e),i&&(i.error&&i.product_url?alert(o):(r.addClass(n),t(document.body).trigger("added_to_cart",[i.fragments,i.cart_hash,r])))},error:function(){r.addClass(i).removeClass(e),alert(o)}}),!1}function s(a,r,l){if(r.hasClass(e))return!1;let c={product_id:r.data("product"),quantity:r.data("quantity")};if("0"==c.quantity){if(!l)return!!confirm(mt("The quantity is zero! Do you want to add a unit?"))&&s(a,r,!0);c.quantity=1}t(document.body).trigger("adding_to_cart",[r,c]);const u=woocommerce_params.wc_ajax_url.toString().replace("%%endpoint%%","add_to_cart");return t.ajax({type:"POST",url:u,data:c,beforeSend:function(t){r.removeClass(n+" "+i).addClass(e)},success:function(i){r.removeClass(e),i&&(i.error&&i.product_url?alert(o):(r.addClass(n),t(document.body).trigger("added_to_cart",[i.fragments,i.cart_hash,r])))},error:function(){r.addClass(i).removeClass(e),alert(o)}}),!1}t((function(){if("undefined"==typeof wc_add_to_cart_params)return!1;t(".mg-upc-item-product").removeClass("mg-upc-hide").on("click",(function(e){return s(e,t(this),!1)})),t(".mg-upc-add-list-to-cart").removeClass("mg-upc-hide").on("click",(function(s){const a=t(this);return a.hasClass(e)||(a.removeClass(n+" "+i).addClass(e),window.mgUpcAddListToCart(t(this).data("id")).then((function(i){a.removeClass(e),i.err&&a.before(te(Yt(i.err))),i.msg&&a.before(te(Yt(i.msg),"success")),a.addClass(n),t(document.body).trigger("added_to_cart",[i.fragments,i.cart_hash,a])})).catch((t=>{a.removeClass(e),t.response?.data?.message?a.before(te(Yt(t.response.data.message))):alert(o)}))),!1}))}))}(jQuery);const gn=function(t){const[e,n]=tt(""),[i,o]=tt(""),[s,a]=tt(""),[r,l]=tt(""),c=ot((()=>Kt(t.addingPost)),[t.addingPost]);function u(t){t.default_title&&n(t.default_title),t.default_status&&l(t.default_status),a(t.name)}return""===s&&1===c.length&&u(c[0]),nt((()=>{n(t.list.title),o(t.list.content),a(t.list.type),l(t.list.status)}),[t.list.title,t.list.content,t.list.type,t.list.type]),nt((()=>{Bt(s)?.available_statuses&&-1===Bt(s).available_statuses.indexOf(r)&&l(Bt(s).available_statuses[0])}),[s]),h("div",{className:"mg-list-edit"},-1===t.list.ID&&""===s&&h(y,null,h("label",null,mt("Select a list type:")),h("ul",{id:`type-${t.list.ID}`},c.map(((t,e)=>h("li",{className:"mg-upc-dg-item-list-type",key:t.name,onClick:()=>u(t),onKeyPress:e=>{13===e.keyCode&&u(t)},tabIndex:"0"},h("i",{className:"mg-upc-icon mg-upc-dg-item-type mg-upc-dg-item-type-"+t.name}),h("div",{className:"mg-upc-dg-item-title"},h("strong",null,t.label),h("div",{className:"mg-upc-dg-item-desc"},t.description))))))),""!==s&&Gt(s,"editable_title")&&h(y,null,h("label",{htmlFor:`title-${t.list.ID}`},mt("Title")),h("input",{id:`title-${t.list.ID}`,type:"text",value:e,onChange:function(t){n(t.target.value)},maxLength:100})),""!==s&&Gt(s,"editable_content")&&h(y,null,h("label",{htmlFor:`content-${t.list.ID}`},mt("Description")),h("textarea",{id:`content-${t.list.ID}`,value:i,onChange:function(t){o(t.target.value)},maxLength:500}),h("span",{className:"mg-upc-dg-list-desc-edit-count"},h("i",null,i?.length),"/500")),""!==s&&!Bt(s)&&h("span",null,mt("Unknown List Type...")),""!==s&&Bt(s)?.available_statuses&&Bt(s).available_statuses.length>1&&h(y,null,h("label",{htmlFor:`status-${t.list.ID}`},mt("Status")),h("select",{id:`status-${t.list.ID}`,value:r,onChange:function(t){l(t.target.value)}},Bt(s).available_statuses.map(((t,e)=>{if(function(t){const e=Xt(t);return e&&e.show_in_status_list}(t))return h("option",{value:t},function(t){const e=Xt(t);return e?e.label:t}(t))})))),""!==s&&Bt(s)&&h("div",{className:"mg-upc-dg-edit-actions"},h("button",{onClick:()=>t.onSave({title:e,content:i,type:s,status:r})},h("span",{className:"mg-upc-icon upc-font-save"}),h("span",null,mt("Save"))),h("button",{onClick:()=>t.onCancel()},h("span",{className:"mg-upc-icon upc-font-close"}),h("span",null,mt("Cancel")))))},hn=function(t){const[e,n]=tt(!1),[i,o]=tt(""),[s,a]=tt(t.item?.quantity),r=it({});nt((()=>{o(t.item.description)}),[t.item]),nt((()=>{e&&r.current.focus()}),[e]);const l=it(!1);return nt((()=>{t.item.quantity!==s&&(clearTimeout(l.current),l.current=setTimeout((function(){t.onSaveItemQuantity(s)}),600))}),[s]),h("li",{className:"mg-upc-dg-item","data-post_id":t.item.post_id},Vt(t.list,"sortable")&&h(y,null,h("span",{className:"mg-upc-dg-item-handle","aria-draggable":!0},"::"),h("span",{className:"mg-upc-dg-item-number"},t.item.position)),Vt(t.list,"vote")&&h(y,null,h("span",{className:"mg-upc-dg-item-number"},(()=>{const e=parseInt(t.list.vote_counter,10);return Vt(t.list,"vote")&&e>0?Math.round(100*parseInt(t.item.votes,10)/e)+"%":"0%"})())),h("a",{href:t.item.link},h("img",{className:"mg-upc-dg-item-image",src:t.item.image?t.item.image:zt})),h("div",{className:"mg-upc-dg-item-data"},h("a",{href:t.item.link},t.item.title),t.item.price_html&&h("span",{className:"mg-upc-dg-price",dangerouslySetInnerHTML:{__html:t.item.price_html}}),t.item.stock_html&&h("span",{className:"mg-upc-dg-stock",dangerouslySetInnerHTML:{__html:t.item.stock_html}}),t.editable&&!e&&h("p",null,t.item.description),t.editable&&!e&&Vt(t.list,"editable_item_description")&&h("button",{onClick:()=>{n(!0)}},h("span",{className:"mg-upc-icon upc-font-edit"}),""===i&&h("span",null,mt("Add Comment")),""!==i&&h("span",null,mt("Edit Comment"))),h("input",{ref:r,className:e?"mg-upc-dg-btn-item-desc":"mg-upc-dg-dn",type:"text",value:i,onChange:function(t){o(t.target.value)},onKeyDown:e=>{"Enter"===e.key&&(n(!1),t.onSaveItemDescription(i))},maxLength:400}),t.editable&&e&&h("button",{className:"mg-upc-dg-btn-item-desc-cancel",onClick:()=>{n(!1),o(t.item.description)}},h("span",{className:"mg-upc-icon upc-font-close"}),h("span",null,mt("Cancel"))),t.editable&&e&&h("button",{className:"mg-upc-dg-btn-item-desc-save",onClick:()=>{n(!1),t.onSaveItemDescription(i)}},h("span",{className:"mg-upc-icon upc-font-save"}),h("span",null,mt("Save")))),t.editable&&Vt(t.list,"quantity")&&h("div",{className:"mg-upc-dg-quantity"},h("small",null,mt("Quantity")),h("input",{"aria-label":mt("Quantity"),type:"number",value:s,onChange:function(){a(event.target.value)}})),t.editable&&!e&&h("div",null,h("button",{"aria-label":"Remove item",onClick:t.onRemove},h("span",{className:"mg-upc-icon upc-font-trash"}))))},vn=function(t){return new Promise((function(e,n){const i=document.createElement("script");let o=!1;i.type="text/javascript",i.src=t,i.async=!0,i.onerror=function(t){n(t,i)},i.onload=i.onreadystatechange=function(){o||this.readyState&&"complete"!=this.readyState||(o=!0,setTimeout((function(){e()}),100))},(document.head||document.body||document.documentElement).appendChild(i)}))},yn=function(t){const e=it(null),n=it((e=>{t.onMove(e)}));return nt((()=>{n.current=t.onMove})),nt((()=>{let i=!1;if(Vt(t.list,"sortable")){const t=()=>{i=Sortable.create(e.current,{handle:".mg-upc-dg-item-handle",group:"shared",animation:150,onUpdate:function(t){n.current(t)}})};"undefined"!=typeof Sortable?t():vn(qt()).then((()=>{t()}))}return()=>{i&&i.destroy()}})),h(y,null,h("ul",{className:"mg-upc-dg-list-fake mg-upc-dg-on-loading"},[0,1,2].map((e=>h("li",{className:"mg-upc-dg-item"},Vt(t.list,"sortable")&&h(y,null,h("span",{className:"mg-upc-dg-item-handle-skeleton"}," ",h(ce,{width:"1.5em"})," "),h("span",{className:"mg-upc-dg-item-number-skeleton"}," ",h(ce,{width:"1em"})," ")),Vt(t.list,"vote")&&h(y,null,h("span",{className:"mg-upc-dg-item-number-skeleton"}," ",h(ce,{width:"1em"})," ")),h("div",{className:"mg-upc-dg-item-skeleton-image"},h(ce,{width:"5em",height:"5em"})),h("div",{className:"mg-upc-dg-item-data"},h(ce,{count:2})))))),h("ul",{ref:e,className:"mg-upc-dg-list"},0===t?.items?.length&&h("span",null,"There are no items in this list"),t?.items?.length>0&&t.items?.map&&t.items.map((e=>h(hn,{list:t.list,item:e,editable:t.editable,onRemove:()=>t.onRemove(t.list,e),onSaveItemDescription:n=>t.onSaveItemDescription(t.list,e,n),onSaveItemQuantity:n=>t.onSaveItemQuantity(t.list,e,n),key:e.ID+":"+e.post_id})))),Vt(t.list,"vote")&&h("span",{className:"mg-upc-dg-total-votes"}," ",mt("Total votes:")," ",h("span",null," ",t.list.vote_counter)))},bn=function(t){const e=it(null),n=it(null),i=mt("Copy"),[o,s]=tt(i);nt((()=>{let t=null;o!==i&&(t=setTimeout((()=>{s(i),clearTimeout(t)}),2e3))}),[o]);const a=encodeURIComponent(t.link),r=encodeURIComponent(t.title);let l=[{name:"Twitter",url:"https://twitter.com/share?url="+a+"&text="+r},{name:"Facebook",url:"https://www.facebook.com/sharer/sharer.php?u="+a+""e="+r},{name:"Pinterest",url:"https://pinterest.com/pin/create/button/?url="+a+"&description="+r},{name:"Whatsapp",url:"whatsapp://send?text="+a},{name:"Telegram",url:"https://t.me/share/url?url="+a+"&text="+r},{name:"LiNE",url:"https://social-plugins.line.me/lineit/share?url="+a+"&text="+r},{slug:"email",name:mt("Email"),url:"mailto:?subject="+r+"&body="+a}];return void 0!==Qt().shareButtons&&(l=l.filter((t=>Qt().shareButtons.includes(t.slug||t.name.toLowerCase())))),h("div",{className:"mg-upc-dg-share-link"},h("input",{ref:e,value:t.link,onClick:function(){e.current.setSelectionRange(0,e.current.value.length)},readOnly:!0}),h("button",{ref:n,onClick:function(t){var n;(n=e.current).focus(),n.setSelectionRange(0,n.value.length),document.execCommand&&document.execCommand("copy")?s(mt("Copied!")):s("Error!")}},h("span",{className:"mg-upc-icon upc-font-copy"}),h("span",null,o)),l.map((function(t){return(e=t).slug||(e.slug=e.name.toLowerCase()),h("a",{href:e.url,title:"Share with "+e.name,className:"mg-upc-dg-share",target:"_blank",rel:"noopener"},h("div",{className:"mg-upc-share-btn-img mg-upc-share-"+e.slug}," "));var e})))},wn=function(t){const{state:e,dispatch:n}=at(ae),[i,o]=tt(!1),s=it(!1),a=it(!1);function r(t){t<1||t>e.listTotalPages||"loading"===e.status||n(Ne({page:t}))}return nt((()=>{const t=e.list;let i=!1,o=!1;if(t&&Vt(t,"sortable")){const t=()=>{s.current&&e.listPage<e.listTotalPages&&(i=Sortable.create(s.current,{group:"shared",onAdd:t=>{n(Ae(t.oldIndex))}})),s.current&&e.listPage>1&&(o=Sortable.create(a.current,{group:"shared",onAdd:t=>{n(Ee(t.oldIndex))}}))};"undefined"!=typeof Sortable?t():vn(qt()).then((()=>{t()}))}return()=>{i&&i.destroy(),o&&o.destroy()}}),[e.list,e.listPage,e.listTotalPages]),nt((()=>{o(!1)}),[e.editing,e.list,e.addingPost]),h(y,null,e.editing&&h(gn,{list:e.list,addingPost:e.addingPost,onSave:function(t){if(-1===e.list.ID||t.title!==e.list.title||t.content!==e.list.content||t.status!==e.list.status)if(-1===e.list.ID){const i={};i.title=t.title,i.content=t.content,i.type=t.type,i.status=t.status,e.addingPost?.post_id&&(i.adding=e.addingPost.post_id,e.addingPost?.description&&(i.description=e.addingPost.description)),n(Ce(i))}else{const i={id:e.list.ID};t.status!==e.list.status&&(i.status=t.status),t.title!==e.list.title&&(i.title=t.title),t.content!==e.list.content&&(i.content=t.content),n(ke(i))}},onCancel:function(){n(pe(!1)),-1===e.list.ID&&(n(Pe(!1)),n(de()),n(fe()))}}),!e.editing&&h(y,null,h("div",{className:"mg-upc-dg-top-action"},function(t){const e=t.type;return Gt(e,"editable_title")||Gt(e,"editable_content")||Bt(e)?.available_statuses?.length>1}(e.list)&&h("button",{className:"mg-upg-edit",onClick:()=>n(pe(!0))},h("span",{className:"mg-upc-icon upc-font-edit"}),h("span",null,mt("Edit"))),e.list.link&&h("button",{className:"mg-upg-share",onClick:()=>o(!i)},h("span",{className:"mg-upc-icon upc-font-share"}),h("span",null,mt("Share"))),"cart"===e.list.type&&h("button",{className:"mg-upg-share",onClick:function(){n(me(e.list.ID))}},h("span",{className:"mg-upc-icon upc-font-cart"}),h("span",null,mt("Add all to cart")))),i&&e.list.link&&h(bn,{link:e.list.link,title:e.list.title}),e.list.content&&h("p",{className:"mg-upc-dg-list-desc",dangerouslySetInnerHTML:{__html:Yt(e.list.content)}}),h(ce,{count:3}),h(yn,{list:e.list,items:e.list?.items||[],onMove:function(t){n(Te(t.oldIndex,e.list,t.newIndex))},onRemove:function(t,e){n(xe(e.post_id))},onSaveItemDescription:function(t,e,i){n(Ie(e.post_id,{description:i}))},onSaveItemQuantity:function(t,e,i){n(Ie(e.post_id,{quantity:i}))},editable:t.editable})),(!e.editing||!e.list)&&e.listTotalPages>1&&h(ue,{totalPages:e.listTotalPages,page:e.listPage,onPreview:function(){r(e.listPage-1)},onNext:function(){r(e.listPage+1)},prevRef:a,nextRef:s}))};function Pn(t){return parseInt(t.author,10)===parseInt(Qt().user_id,10)}function kn(){"replaceState"in history?(history.replaceState("",document.title,location.pathname),history.go(-1)):location.hash=""}H(h((t=>{const[e,n]=et(ee,se);return h(ae.Provider,{value:{state:e,dispatch:oe(n,(()=>e))}},t.children)}),null,h((function(){const{state:t,dispatch:e}=at(ae),n=ot((()=>Kt(t.addingPost)),[t.addingPost]),i=it(!1);let o="listOfList";o=t.addingPost?t.editing?"addingToNew":"adding":t.editing?-1!==t.list?.ID?"edit":"new":t.list?"list":"listOfList";const s={container:"mg-upc-dg-container",overlay:"mg-upc-dg-overlay",dialog:"mg-upc-dg-content"+(t.errorCode?" mg-upc-err-"+t.errorCode:""),title:"mg-upc-dg-title",closeButton:"mg-upc-dg-close"};nt((()=>{window.showMyLists=function(){a()},window.mgUpcShowList=function(t,n=""){e(de()),e(Pe({ID:t,title:n||""})),i.current.show()},window.addItemToList=function(t,n=!1,o="view"){e(de()),n?(e(Se(n,t,o)),i.current.show()):r(t)},window.removeItemFromList=function(t,n,o="view"){e(de()),e(xe(t,n,o)),i.current.show()},window.mgUpcAddListToCart=Zt}),[i.current,e]);const a=()=>{e(de()),e(fe()),i.current.show()},r=t=>{e(_e({post_id:t})),e(fe({addingPost:t})),i.current.show()};function l(n){n<1||n>t.totalPages||"loading"===t.status||e(ve(n))}const c="list"===o||"new"===o||"edit"===o||"addingToNew"===o;return h(fn,{id:"mg-upc-dg-dialog",dialogRef:function(t){i.current=t},title:t.title,classNames:s,onBack:!!c&&function(){switch(o){case"list":default:a();break;case"new":e(Pe(!1)),e(pe(!1)),a();break;case"edit":e(pe(!1));break;case"addingToNew":e(Pe(!1)),e(pe(!1)),e(fe({addingPost:t.addingPost.post_id}))}}},h("div",{className:"mg-upc-dg-content-wrapper mg-upc-dg-status-"+t.status+" mg-upc-dg-view-"+o},h("div",{className:"mg-upc-dg-wait"}),t.message&&h("div",{className:"mg-upc-dg-msg"},t.message,h("a",{href:"#",className:"mg-upc-dg-alert-close","aria-label":"Hide alert",onClick:t=>{t.preventDefault(),e({type:ht,payload:null})}},h("span",{className:"mg-upc-icon upc-font-close"}))),t.error&&h("div",{className:"mg-upc-dg-error"},t.error,h("a",{href:"#",className:"mg-upc-dg-alert-close","aria-label":"Hide alert",onClick:t=>{t.preventDefault(),e({type:gt,payload:null})}},h("span",{className:"mg-upc-icon upc-font-close"}))),h("div",{className:"mg-upc-dg-body"},!t.error&&t.addingPost&&h(Oe,{item:t.addingPost,onSaveItemDescription:function(n){e(_e({...t.addingPost,description:n}))}}),("listOfList"===o||"adding"===o)&&h(y,null,h("div",{className:"mg-upc-dg-top-action"},n.length>0&&!t.error&&h("button",{className:"mg-list-new",onClick:function(t){e(pe(!0)),e(Pe(!0)),i.current.show()}},h("span",{className:"mg-upc-icon upc-font-add"}),h("span",null,mt("Create List")))),h(De,{lists:t.listOfList,onSelect:function(n){e(pe(!1)),t.addingPost?e(Se(n.ID,t.addingPost,"view")):(e(Pe(n)),i.current.show())},onRemove:!t.addingPost&&function(t){e(he(t.ID))},loadPreview:function(){l(t.page-1)},loadNext:function(){l(t.page+1)}})),t.list&&h(wn,{editable:Pn(t.list)}))))}),null)," "),document.querySelector("body")),"#my-lists"===location.hash&&kn(),window.addEventListener("hashchange",(function(){"#my-lists"===location.hash&&(window.showMyLists(),kn())}),!1),window.mgUpcApiClient=Ft,window.mgUpcListeners=function(){jQuery(".mg-upc-post-add").on("click",(function(){return jQuery(this).data("post-id")>0&&window.addItemToList(jQuery(this).data("post-id"),(jQuery(this).data("upc-list")+"").length>0&&jQuery(this).data("upc-list")),!1})),jQuery(".mg-upc-post-remove").on("click",(function(){return jQuery(this).data("post-id")>0&&void 0!==jQuery(this).data("upc-list")&&window.removeItemFromList(jQuery(this).data("post-id"),(jQuery(this).data("upc-list")+"").length>0&&jQuery(this).data("upc-list")),!1})),jQuery(".mg-upc-show-list").on("click",(function(){return void 0!==jQuery(this).data("upc-list")&&window.mgUpcShowList(jQuery(this).data("upc-list"),(jQuery(this).data("upc-title")+"").length>0&&jQuery(this).data("upc-title")),!1}))},window.mgUpcListeners()})(); -
user-post-collections/trunk/readme.txt
r2856778 r3190768 5 5 License URI: https://www.gnu.org/licenses/gpl.txt 6 6 Tags: User lists, Post Collections, Woocommerce Wishlist 7 Tested up to: 6. 17 Tested up to: 6.5.4 8 8 Stable tag: 0.8.32 9 9 Requires PHP: 7.0 10 Requires at least: 4.9.6 10 11 11 12 This plugin allows users to create lists of different types (simple, numbered, cart and poll) and share them. … … 30 31 All list types can be disabled. 31 32 32 If you are a developer and you are making a theme you can register your own list types.33 If you are a developer, and you are making a theme you can register your own list types. 33 34 34 35 ### Features … … 41 42 * Max items per list (configurable in each type of list) 42 43 * Share buttons for public lists 44 45 ### Collections Archive 46 47 The plugin adds a new page to the site where all the collections of the users are shown. This page can be disabled/enabled on the plugin settings. 48 This page is also used as the basis for displaying each list, but disabling the archive page from the plugin settings does not disable the pages of each collection.. 49 Archive URL example: https://domain.com/user-post-collection/ 50 Collection URL example: https://domain.com/user-post-collection/list-x-by-tauri/ 51 52 ### Shortcode 53 54 You can use the shortcode [user_posts_collections] to show the lists. Example: 55 56 [user_posts_collections type="vote" tpl-items="cards" exclude="32,45"] 57 [user_posts_collections author="23" tpl-items="list"] 58 [user_posts_collections limit="5" pagination="1" tpl-cols="4,4,4,3,2,1"] 59 [user_posts_collections author-name="tauri" orderby="title" order="ASC" limit=10 pagination=1] 60 [user_posts_collections include="23,31,412"] 61 62 #### Shortcode options 63 64 * __type:__ simple|numbered|vote|favorites|bookmarks|cart 65 * __author-name:__ Author username 66 * __author:__ Author ID 67 * __include:__ Lists ID to include (comma separated) 68 * __exclude:__ Lists ID to exclude (comma separated) 69 * __orderby:__ ID|views|vote_counter|count|created|modified|title 70 * __order:__ ASC|DESC 71 * __limit:__ Max lists to show 72 * __pagination:__ Show pagination. Set to 1 for enabled. Default: 0 73 * __id:__ Set unique string. Only letters, numbers and "-". Used for pagination. 74 * __tpl-items:__ (card|list) List type 75 * __tpl-cols:__ Number of columns, comma separated: xxl,xl,lg,md,sm,xs (for card list type) Default: 4,4,4,3,2,1 76 * __tpl-cols-(xs|sm|md|lg|xl|xxl):__ (1|2|3|4|5) Number of columns (for card list type) 77 * __tpl-thumbs:__ Default thumbnails layout. Set to "off" to not show 78 * __tpl-thumbs-(xs|sm|md|lg|xl|xxl):__ (0|2x2|2x3|3x2|4x1|[1-4]x[1-4]) Thumbnails layout 79 * __tpl-desc:__ (on|off) Show description. Set to "off" to hide description 80 * __tpl-user:__ (on|off) Show author. Set to "off" to hide user 81 * __tpl-meta:__ (on|off) Show meta. Set to "off" to hide meta 43 82 44 83 == Screenshots == … … 67 106 68 107 == Changelog == 108 109 = 0.9.0 = 110 * Added archive option 111 * Added shortcode [user_posts_collections] 69 112 70 113 = 0.8.32 = -
user-post-collections/trunk/templates/content-single-mg-upc.php
r2768965 r3190768 26 26 } 27 27 ?> 28 <div id="mg-upc-<?php echo esc_attr( $mg_upc_list['ID']); ?>"29 data-id="<?php echo esc_attr( $mg_upc_list['ID']); ?>"30 <?php mg_upc_class( 'page-inner mg-upc-page-inner' , $mg_upc_list); ?>>28 <div id="mg-upc-<?php mg_upc_the_ID(); ?>" 29 data-id="<?php mg_upc_the_ID(); ?>" 30 <?php mg_upc_class( 'page-inner mg-upc-page-inner' ); ?>> 31 31 32 32 <?php … … 40 40 <?php 41 41 /** 42 * Hook: mg_upc_single_list_ summary.42 * Hook: mg_upc_single_list_content. 43 43 * 44 44 * @hooked mg_upc_template_single_title - 5 -
user-post-collections/trunk/templates/mg-upc-wc/single-all-cart-buttons.php
r2768965 r3190768 2 2 global $mg_upc_list; 3 3 ?> 4 <a class="<?php echo esc_attr( mg_upc_btn_classes( 'mg-upc-add-list-to-cart' ) ); ?>"4 <a href="#" class="<?php echo esc_attr( mg_upc_btn_classes( 'mg-upc-add-list-to-cart' ) ); ?>" 5 5 data-id="<?php echo (int) $mg_upc_list['ID']; ?>"> 6 6 <?php echo esc_html( mg_upc_get_text( 'Add all to cart', 'mg_upc_list' ) ); ?> -
user-post-collections/trunk/templates/single-mg-upc/description.php
r2768965 r3190768 10 10 exit; // Exit if accessed directly. 11 11 } 12 global $mg_upc_list;13 14 $content = $mg_upc_list['content'];15 if ( strpos( $content, '<' ) !== false ) {16 $content = force_balance_tags( $content );17 }18 12 ?> 19 13 <div class="mg-upc-description"> 20 14 <p> 21 <?php 22 echo wp_kses( nl2br( $content ), MG_UPC_List_Controller::get_instance()->list_allowed_tags() ); 23 ?> 15 <?php mg_upc_the_content(); ?> 24 16 </p> 25 17 </div> -
user-post-collections/trunk/templates/single-mg-upc/items.php
r2768965 r3190768 6 6 * 7 7 */ 8 8 /** @global MG_UPC_List $mg_upc_list */ 9 9 global $mg_upc_list; 10 10 -
user-post-collections/trunk/templates/single-mg-upc/pagination.php
r2768965 r3190768 11 11 } 12 12 13 $total = isset( $total ) ? $total :1;14 $current = isset( $current ) ? $current :1;15 $base = isset( $base ) ? $base :esc_url_raw(13 $total = $total ?? 1; 14 $current = $current ?? 1; 15 $base = $base ?? esc_url_raw( 16 16 str_replace( 17 17 999999999, … … 23 23 ) 24 24 ); 25 $format = isset( $format ) ? $format :'';25 $format = $format ?? ''; 26 26 27 27 if ( $total <= 1 ) { -
user-post-collections/trunk/templates/single-mg-upc/title.php
r2768965 r3190768 11 11 } 12 12 13 the_title( '<h1 class="mg-upc-title entry-title">', '</h1>' );13 mg_upc_the_title( '<h1 class="mg-upc-title entry-title">', '</h1>' ); -
user-post-collections/trunk/uninstall.php
r2770005 r3190768 78 78 'mg_upc_api_item_per_page', 79 79 'mg_upc_item_per_page', 80 'mg_upc_list_per_page', 80 81 'mg_upc_post_stats', 81 82 'mg_upc_share_buttons', 82 83 'mg_upc_share_buttons_client', 83 84 'mg_upc_ajax_load', 85 'mg_upc_archive_enable', 86 'mg_upc_archive_filter_type', 87 'mg_upc_archive_filter_author', 88 'mg_upc_archive_item_per_page', 89 'mg_upc_archive_item_template', 90 'mg_upc_archive_item_template_thumbs_xxl', 91 'mg_upc_archive_item_template_thumbs_xl', 92 'mg_upc_archive_item_template_thumbs_lg', 93 'mg_upc_archive_item_template_thumbs_md', 94 'mg_upc_archive_item_template_thumbs_sm', 95 'mg_upc_archive_item_template_thumbs_xs', 96 'mg_upc_archive_item_template_cols_xxl', 97 'mg_upc_archive_item_template_cols_xl', 98 'mg_upc_archive_item_template_cols_lg', 99 'mg_upc_archive_item_template_cols_md', 100 'mg_upc_archive_item_template_cols_sm', 101 'mg_upc_archive_item_template_cols_xs', 102 'mg_upc_archive_item_template_meta', 103 'mg_upc_archive_item_template_user', 104 'mg_upc_archive_item_template_desc', 105 'mg_upc_archive_title', 106 'mg_upc_archive_title_type', 107 'mg_upc_archive_title_author', 108 'mg_upc_archive_title_author_type', 109 'mg_upc_archive_document_title', 84 110 ); 85 111 foreach ( $options as $option ) { -
user-post-collections/trunk/user-post-collections.php
r2856778 r3190768 4 4 Plugin URI: https://galetto.info/user-post-collections 5 5 Description: Allows users to create their post collections. 6 Version: 0. 8.326 Version: 0.9.0 7 7 Author: Mauricio Galetto 8 8 Author URI: https://galetto.info/ … … 24 24 /** @global User_Post_Collections|null $mg_upc */ 25 25 $GLOBALS['mg_upc'] = null; 26 27 /** @global MG_UPC_Query|null $mg_upc_the_query The main upc query*/ 28 $GLOBALS['mg_upc_the_query'] = null; 29 30 /** @global MG_UPC_Query|null $mg_upc_query The upc query for loop*/ 31 $GLOBALS['mg_upc_query'] = null; 26 32 27 33 /** … … 59 65 60 66 require_once __DIR__ . '/includes/utils.php'; 67 require_once __DIR__ . '/includes/mg-upc-list.php'; 61 68 require_once __DIR__ . '/includes/template-functions.php'; 62 69 require_once __DIR__ . '/includes/template-hooks.php'; … … 75 82 76 83 require_once __DIR__ . '/classes/mg-upc-module.php'; 84 require_once __DIR__ . '/classes/mg-upc-query.php'; 77 85 78 86 require_once __DIR__ . '/alt-models/mg-list-model.php'; … … 81 89 82 90 require_once __DIR__ . '/controllers/mg-list-page-alt.php'; 91 require_once __DIR__ . '/classes/mg-list-page-alt-settings.php'; 83 92 require_once __DIR__ . '/controllers/mg-upc-list-controller.php'; 84 93 require_once __DIR__ . '/controllers/mg-upc-rest-list-controller.php'; … … 93 102 require_once __DIR__ . '/classes/mg-upc-settings.php'; 94 103 require_once __DIR__ . '/classes/mg-upc-rest-api.php'; 104 require_once __DIR__ . '/includes/mg-upc-shortcode.php'; 95 105 96 106 require_once __DIR__ . '/classes/mg-upc-database.php';
Note: See TracChangeset
for help on using the changeset viewer.