{
  "version": 3,
  "sources": ["/cdn/shop/t/26/assets/collection-load-more.js?=143832079564096820271793374997&v%5B0%5D%5B1000%5D=whscheck"],
  "sourcesContent": ["function loadMoreProducts(){\nvar products_on_page = jQuery('.products-on-page');\nvar next_url = products_on_page.data('next-url');\nvar delay_type = products_on_page.data('delay-type');\nvar delay_speed = products_on_page.data('delay-speed');\nvar load_more_btn = jQuery('.load-more__btn');\nvar load_more_spinner = jQuery('.load-more__spinner');\nvar current_page = products_on_page.data('current-page');\nvar last_item = products_on_page.find(\".grid__item\").last().data(\"product-id\");\njQuery.ajax(\n    {\n        url: next_url,\n        type: 'GET',\n        dataType: 'html',\n        beforeSend: function(){\n            //remove appended class from products who are now not the most recently appended\n            products_on_page.find('.appended_product').each(function() {\n                $(this).removeClass('appended_product');\n            })\n            load_more_btn.hide();\n            load_more_spinner.show();\n            last_item = products_on_page.find(\".grid__item\").last().data(\"product-id\");\n        }\n    }\n).done(function(next_page){\n    //find the collection grid, update the new paginate url, update response product count\n    var new_products = jQuery(next_page).find('.products-on-page');\n    var new_url = new_products.data('next-url');\n    var loaded = 0;\n    var new_products_html = $(new_products.html());\n    var final_products = [];\n    var final_product_count = 0;\n    //testing each node in response to make sure it is a valid node, and if so add to the final product array to append\n    new_products_html.each(function() {\n        //if node type isn't text, we can add the node\n        if ($(this)[0].nodeType == 1) {\n            $(this).find(\"img\").first().attr(\"loading\", \"eager\");\n            final_products.push($(this)[0]);\n            final_product_count++;\n            $(this).addClass(\"appended_product\");\n            //adding duplicate_product class to items appended on collections with ads that are backfilling products to make sure\n            //products don't display multiple times in a row.\n            let productClass = \"#product-grid .grid__item[data-product-id='\" + $(this).data(\"product-id\") + \"']\";\n            let productElement = $(productClass);\n            if (productElement.length > 0) {\n              $(this).addClass(\"duplicate_product\");\n            }\n            if ($(this).data(\"product-id\") == last_item) {\n                $(this).addClass(\"duplicate_product\");\n            }\n        }\n    });\n    $(final_products).each(function() {\n        $(this).find(\"img\").first().bind(\"load\", function() {\n            loaded++;\n            //if loaded equals the number of products in ajax call, all first images have been loaded.\n            if (loaded == final_product_count) {\n                window.postMessage({ type: 'collection_grid', action: \"products_loaded\", load_more: true }, '*');\n                load_more_spinner.hide();\n                products_on_page.append(final_products);\n                if (delay_type == 'fade') {\n                    $(final_products).hide().fadeIn(delay_speed);\n                }\n                if (new_url) {\n                    load_more_btn.show();\n                    next_url = new_url;\n                    products_on_page.data('next-url', next_url);\n                    current_page++;\n                    products_on_page.data('current-page', current_page);\n                }\n            }\n        });\n    });\n});\n} \n"],
  "mappings": "AAAA,SAAS,kBAAkB,CAC3B,IAAI,iBAAmB,OAAO,mBAAmB,EAC7C,SAAW,iBAAiB,KAAK,UAAU,EAC3C,WAAa,iBAAiB,KAAK,YAAY,EAC/C,YAAc,iBAAiB,KAAK,aAAa,EACjD,cAAgB,OAAO,iBAAiB,EACxC,kBAAoB,OAAO,qBAAqB,EAChD,aAAe,iBAAiB,KAAK,cAAc,EACnD,UAAY,iBAAiB,KAAK,aAAa,EAAE,KAAK,EAAE,KAAK,YAAY,EAC7E,OAAO,KACH,CACI,IAAK,SACL,KAAM,MACN,SAAU,OACV,WAAY,UAAU,CAElB,iBAAiB,KAAK,mBAAmB,EAAE,KAAK,UAAW,CACvD,EAAE,IAAI,EAAE,YAAY,kBAAkB,CAC1C,CAAC,EACD,cAAc,KAAK,EACnB,kBAAkB,KAAK,EACvB,UAAY,iBAAiB,KAAK,aAAa,EAAE,KAAK,EAAE,KAAK,YAAY,CAC7E,CACJ,CACJ,EAAE,KAAK,SAAS,UAAU,CAEtB,IAAI,aAAe,OAAO,SAAS,EAAE,KAAK,mBAAmB,EACzD,QAAU,aAAa,KAAK,UAAU,EACtC,OAAS,EACT,kBAAoB,EAAE,aAAa,KAAK,CAAC,EACzC,eAAiB,CAAC,EAClB,oBAAsB,EAE1B,kBAAkB,KAAK,UAAW,CAE9B,GAAI,EAAE,IAAI,EAAE,CAAC,EAAE,UAAY,EAAG,CAC1B,EAAE,IAAI,EAAE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