diff --git a/dist/stencil-utils.min.js b/dist/stencil-utils.min.js index 809d981..ec879a2 100644 --- a/dist/stencil-utils.min.js +++ b/dist/stencil-utils.min.js @@ -1 +1 @@ -var stencilUtils=function(e){function t(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var n={};return t.m=e,t.c=n,t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=5)}([function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var u=function(){function e(e,t){for(var n=0;n0;c.requestOptions.formData||(l["content-type"]="application/x-www-form-urlencoded; charset=UTF-8"),d&&(l["stencil-options"]=JSON.stringify({render_with:p.join(",")}));var h={method:c.method,headers:l,credentials:"include"},b=c.requestOptions.baseUrl?""+c.requestOptions.baseUrl+e:e;-1===["GET","HEAD"].indexOf(h.method)?h.body=c.requestOptions.formData?f:(0,o.stringify)(f,{includeArrayIndex:!0}):f&&(b+="?"+(0,o.stringify)(f)),fetch(b,h).then(function(e){return-1!==e.headers.get("content-type").indexOf("application/json")?e.json():e.text()}).then(function(e){var t=c.remote?e.content:e,o=e;if(d){if("object"===(void 0===t?"undefined":r(t))){var i=!0,u=!1,a=void 0;try{for(var s,f=Object.keys(t)[Symbol.iterator]();!(i=(s=f.next()).done);i=!0){var l=s.value;t[l.replace(/^components\//,"")]=t[l],delete t[l]}}catch(e){u=!0,a=e}finally{try{!i&&f.return&&f.return()}finally{if(u)throw a}}}if(y){var p=c.requestOptions.template,h=!0,b=!1,v=void 0;try{for(var m,_=Object.keys(p)[Symbol.iterator]();!(h=(m=_.next()).done);h=!0){var w=m.value;t[w]=t[p[w]],delete t[p[w]]}}catch(e){b=!0,v=e}finally{try{!h&&_.return&&_.return()}finally{if(b)throw v}}}c.remote||(o=t)}n(null,o)}).catch(function(e){return n(e)})},n(17);var o=n(4),i=function(e){return-1!==["GET","POST","PUT","DELETE"].indexOf(e)},u=function(e){return"object"===(void 0===e?"undefined":r(e))&&!Array.isArray(e)},a=function(e){var t=[];if(u(e))for(var n in e)e.hasOwnProperty(n)&&t.push(e[n]);else"string"==typeof e?t=[e]:Array.isArray(e)&&e.length>0&&(t=e);return t}},function(e,t,n){"use strict";function r(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t1&&void 0!==arguments[1]?arguments[1]:{filterValues:!1,arrayIndex:!1};if(!e)return"";var n={},r=function(n){return t.filterValues&&(""===e[n]||void 0===e[n])};Object.keys(e).forEach(function(t){r(t)||(n[t]=e[t])});var o=Object.keys(n);return o.sort(),o.map(function(n){var r=e[n];return void 0===r?"":null===r?s(n):Array.isArray(r)?r.reduce(p(t)(n),[]).join("&"):s(n)+"="+s(r)}).filter(function(e){return e.length>0}).join("&")}Object.defineProperty(t,"__esModule",{value:!0});var u=function(){function e(e,t){var n=[],r=!0,o=!1,i=void 0;try{for(var u,a=e[Symbol.iterator]();!(r=(u=a.next()).done)&&(n.push(u.value),!t||n.length!==t);r=!0);}catch(e){o=!0,i=e}finally{try{!r&&a.return&&a.return()}finally{if(o)throw i}}return n}return function(t,n){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return e(t,n);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};t.parse=o,t.stringify=i;var s=function(e){return encodeURIComponent(e).replace(/[!'()*]/g,function(e){return"%"+e.charCodeAt(0).toString(16).toUpperCase()})},c=function(e,t){var n=e.indexOf(t);return-1===n?[e]:[e.slice(0,n),e.slice(n+t.length)]},f=function e(t){return Array.isArray(t)?t.sort():"object"===(void 0===t?"undefined":a(t))?e(Object.keys(t)).sort(function(e,t){return Number(e)-Number(t)}).map(function(e){return t[e]}):t},l=function(e,t,n){return void 0===n[e]?t:[].concat(n[e],t)},p=function(e){return function(t){return function(n,o){if(void 0===o)return n;if(null===o)return[].concat(r(n),[s(t)]);if(e.includeArrayIndex){if("object"===(void 0===o?"undefined":a(o))){var i=n.length/Object.keys(o).length;return n.concat(Object.keys(o).map(function(e){return[s(t),"[",s(i),"]","[",s(e),"]=",s(o[e])].join("")}))}var u=n.length;return[].concat(r(n),[[s(t),"[",s(u),"]=",s(o)].join("")])}return[].concat(r(n),[[s(t),"=",s(o)].join("")])}}}},function(e,t,n){"use strict";(function(e){function r(e){return e&&e.__esModule?e:{default:e}}var o;Object.defineProperty(t,"__esModule",{value:!0}),t.tools=t.api=t.hooks=void 0;var i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},u=n(2),a=r(u),s=n(16),c=r(s),f=n(24),l=r(f),p={hooks:a.default,api:c.default,tools:l.default};t.hooks=a.default,t.api=c.default,t.tools=l.default,t.default=p,function(r){n(28)&&r?void 0!==(o=function(){r.stencilUtils=p}.call(t,n,t,e))&&(e.exports=o):"object"===i(e)&&e.exports?e.exports=p:window.stencilUtils=p}(void 0)}).call(t,n(6)(e))},function(e,t){e.exports=function(e){return e.webpackPolyfill||(e.deprecate=function(){},e.paths=[],e.children||(e.children=[]),Object.defineProperty(e,"loaded",{enumerable:!0,get:function(){return e.l}}),Object.defineProperty(e,"id",{enumerable:!0,get:function(){return e.i}}),e.webpackPolyfill=1),e}},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var u=function(){function e(e,t){for(var n=0;n-1?t:e}function b(e,t){if(!(this instanceof b))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');t=t||{};var n=t.body;if(e instanceof b){if(e.bodyUsed)throw new TypeError("Already read");this.url=e.url,this.credentials=e.credentials,t.headers||(this.headers=new a(e.headers)),this.method=e.method,this.mode=e.mode,this.signal=e.signal,n||null==e._bodyInit||(n=e._bodyInit,e.bodyUsed=!0)}else this.url=String(e);if(this.credentials=t.credentials||this.credentials||"same-origin",!t.headers&&this.headers||(this.headers=new a(t.headers)),this.method=h(t.method||this.method||"GET"),this.mode=t.mode||this.mode||null,this.signal=t.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&n)throw new TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(n),!("GET"!==this.method&&"HEAD"!==this.method||"no-store"!==t.cache&&"no-cache"!==t.cache)){var r=/([?&])_=[^&]*/;if(r.test(this.url))this.url=this.url.replace(r,"$1_="+(new Date).getTime());else{var o=/\?/;this.url+=(o.test(this.url)?"&":"?")+"_="+(new Date).getTime()}}}function v(e){var t=new FormData;return e.trim().split("&").forEach(function(e){if(e){var n=e.split("="),r=n.shift().replace(/\+/g," "),o=n.join("=").replace(/\+/g," ");t.append(decodeURIComponent(r),decodeURIComponent(o))}}),t}function m(e){var t=new a;return e.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach(function(e){var n=e.split(":"),r=n.shift().trim();if(r){var o=n.join(":").trim();t.append(r,o)}}),t}function _(e,t){if(!(this instanceof _))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');t||(t={}),this.type="default",this.status=void 0===t.status?200:t.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in t?t.statusText:"",this.headers=new a(t.headers),this.url=t.url||"",this._initBody(e)}function w(e,t){return new Promise(function(n,r){function o(){s.abort()}var u=new b(e,t);if(u.signal&&u.signal.aborted)return r(new k("Aborted","AbortError"));var s=new XMLHttpRequest;s.onload=function(){var e={status:s.status,statusText:s.statusText,headers:m(s.getAllResponseHeaders()||"")};e.url="responseURL"in s?s.responseURL:e.headers.get("X-Request-URL");var t="response"in s?s.response:s.responseText;setTimeout(function(){n(new _(t,e))},0)},s.onerror=function(){setTimeout(function(){r(new TypeError("Network request failed"))},0)},s.ontimeout=function(){setTimeout(function(){r(new TypeError("Network request failed"))},0)},s.onabort=function(){setTimeout(function(){r(new k("Aborted","AbortError"))},0)},s.open(u.method,function(e){try{return""===e&&O.location.href?O.location.href:e}catch(t){return e}}(u.url),!0),"include"===u.credentials?s.withCredentials=!0:"omit"===u.credentials&&(s.withCredentials=!1),"responseType"in s&&(g.blob?s.responseType="blob":g.arrayBuffer&&u.headers.get("Content-Type")&&-1!==u.headers.get("Content-Type").indexOf("application/octet-stream")&&(s.responseType="arraybuffer")),!t||"object"!=typeof t.headers||t.headers instanceof a?u.headers.forEach(function(e,t){s.setRequestHeader(t,e)}):Object.getOwnPropertyNames(t.headers).forEach(function(e){s.setRequestHeader(e,i(t.headers[e]))}),u.signal&&(u.signal.addEventListener("abort",o),s.onreadystatechange=function(){4===s.readyState&&u.signal.removeEventListener("abort",o)}),s.send(void 0===u._bodyInit?null:u._bodyInit)})}Object.defineProperty(t,"__esModule",{value:!0}),t.Headers=a,t.Request=b,t.Response=_,n.d(t,"DOMException",function(){return k}),t.fetch=w;var O="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof self&&self||void 0!==O&&O,g={searchParams:"URLSearchParams"in O,iterable:"Symbol"in O&&"iterator"in Symbol,blob:"FileReader"in O&&"Blob"in O&&function(){try{return new Blob,!0}catch(e){return!1}}(),formData:"FormData"in O,arrayBuffer:"ArrayBuffer"in O};if(g.arrayBuffer)var j=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],P=ArrayBuffer.isView||function(e){return e&&j.indexOf(Object.prototype.toString.call(e))>-1};a.prototype.append=function(e,t){e=o(e),t=i(t);var n=this.map[e];this.map[e]=n?n+", "+t:t},a.prototype.delete=function(e){delete this.map[o(e)]},a.prototype.get=function(e){return e=o(e),this.has(e)?this.map[e]:null},a.prototype.has=function(e){return this.map.hasOwnProperty(o(e))},a.prototype.set=function(e,t){this.map[o(e)]=i(t)},a.prototype.forEach=function(e,t){for(var n in this.map)this.map.hasOwnProperty(n)&&e.call(t,this.map[n],n,this)},a.prototype.keys=function(){var e=[];return this.forEach(function(t,n){e.push(n)}),u(e)},a.prototype.values=function(){var e=[];return this.forEach(function(t){e.push(t)}),u(e)},a.prototype.entries=function(){var e=[];return this.forEach(function(t,n){e.push([n,t])}),u(e)},g.iterable&&(a.prototype[Symbol.iterator]=a.prototype.entries);var E=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];b.prototype.clone=function(){return new b(this,{body:this._bodyInit})},d.call(b.prototype),d.call(_.prototype),_.prototype.clone=function(){return new _(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new a(this.headers),url:this.url})},_.error=function(){var e=new _(null,{status:0,statusText:""});return e.type="error",e};var T=[301,302,303,307,308];_.redirect=function(e,t){if(-1===T.indexOf(t))throw new RangeError("Invalid status code");return new _(null,{status:t,headers:{location:e}})};var k=O.DOMException;try{new k}catch(e){k=function(e,t){this.message=e,this.name=t;var n=Error(e);this.stack=n.stack},k.prototype=Object.create(Error.prototype),k.prototype.constructor=k}w.polyfill=!0,O.fetch||(O.fetch=w,O.Headers=a,O.Request=b,O.Response=_)},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var u=function(){function e(e,t){for(var n=0;n2&&void 0!==arguments[2]?arguments[2]:null,r=arguments[3],o=n,i=r;"function"==typeof o&&(i=o,o=null);var u=(0,p.normalizeQueryStringParams)(t);this.remoteRequest(this.endpoint+e,"POST",{params:u,template:o},function(e,t){var n={err:e,response:t};l.default.emit("product-options-change-remote",n),i(e,t)})}},{key:"configureInCart",value:function(e,t,n){this.remoteRequest(this.inCartEndpoint+e,"GET",t,function(e,t){n(e,t)})}}]),t}(c.default);t.default=y},function(e,t,n){"use strict";function r(e){var t=o.parse(e);return o.stringify(t,{filterValues:!0})}Object.defineProperty(t,"__esModule",{value:!0}),t.normalizeQueryStringParams=r;var o=n(4)},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function u(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var a=function(){function e(e,t){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:{},t=arguments[1],n="/api/storefront/carts";e.includeOptions&&(n=this.includeOptions(n)),this.makeRequest(n,"GET",e,!0,function(e,n){t(e,n)})}},{key:"getCart",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments[1];if(!e.cartId)return this.getCarts(e,function(e,n){return t(e,n[0])});var n="/api/storefront/carts/"+e.cartId;e.includeOptions&&(n=this.includeOptions(n)),this.makeRequest(n,"GET",e,!0,function(e,n){t(e,n)})}},{key:"includeOptions",value:function(e){return e+"?include=lineItems.physicalItems.options,lineItems.digitalItems.options"}},{key:"getCartQuantity",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments[1];this.getCart(e,function(e,n){if(e)return t(e);var r=0;if(n){var o=n;r=[o.lineItems.physicalItems,o.lineItems.digitalItems,o.lineItems.customItems].reduce(function(e,t){return e.concat(t)}).filter(function(e){return!e.parentId}).map(function(e){return e.quantity}).reduce(function(e,t){return e+t},0)+o.lineItems.giftCertificates.length}t(null,r)})}},{key:"itemAdd",value:function(e,t){this.remoteRequest("/cart/add","POST",{formData:e},function(e,n){var r={err:e,response:n};l.default.emit("cart-item-add-remote",r),t(e,n)})}},{key:"itemUpdate",value:function(e,t,n){var r=n,o=void 0;Array.isArray(e)&&"function"==typeof t?(r=t,o=e):o=[{id:e,quantity:t}],this.update(o,function(e,t){var n={items:o,err:e,response:t};l.default.emit("cart-item-update-remote",n),r(e,t)})}},{key:"itemRemove",value:function(e,t){var n=[{id:e,quantity:0}];this.update(n,function(e,r){var o={items:n,err:e,response:r};l.default.emit("cart-item-remove-remote",o),t(e,r)})}},{key:"getItemGiftWrappingOptions",value:function(e,t,n){var r=t||{},o=n;"function"==typeof r&&(o=r,r={}),this.remoteRequest("/gift-wrapping/"+e,"GET",r,o)}},{key:"submitItemGiftWrappingOption",value:function(e,t,n){this.remoteRequest("/gift-wrapping/"+e,"POST",{params:t},n)}},{key:"update",value:function(e,t){var n={items:e};this.remoteRequest("/cart/update","POST",{params:n},t)}},{key:"getContent",value:function(e,t){var n=e||{},r=t;"function"==typeof n&&(r=n,n={}),this.makeRequest("/cart.php","GET",n,!1,r)}},{key:"getShippingQuotes",value:function(e,t,n){var r={params:e},o=n,i=t;"function"!=typeof o&&(o=i,i=null),i&&(r.template=i),this.remoteRequest("/shipping-quote","GET",r,o)}},{key:"submitShippingQuote",value:function(e,t){var n={params:{shipping_method:e}};this.remoteRequest("/shipping-quote","POST",n,t)}},{key:"applyCode",value:function(e,t){var n={params:{code:e}};this.remoteRequest("/apply-code","POST",n,t)}},{key:"applyGiftCertificate",value:function(e,t){var n={params:{code:e}};this.remoteRequest("/gift-certificates","POST",n,t)}}]),t}(c.default);t.default=p},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var o=n(25),i=r(o),u=n(26),a=r(u),s=n(27),c=r(s);t.default={image:new i.default,imageSrcset:new a.default,storage:new c.default}},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i=function(){function e(e,t){for(var n=0;n0;c.requestOptions.formData||(l["content-type"]="application/x-www-form-urlencoded; charset=UTF-8"),d&&(l["stencil-options"]=JSON.stringify({render_with:p.join(",")}));var h={method:c.method,headers:l,credentials:"include"},b=c.requestOptions.baseUrl?""+c.requestOptions.baseUrl+e:e;-1===["GET","HEAD"].indexOf(h.method)?h.body=c.requestOptions.formData?f:(0,o.stringify)(f,{includeArrayIndex:!0}):f&&(b+="?"+(0,o.stringify)(f)),fetch(b,h).then(function(e){return-1!==e.headers.get("content-type").indexOf("application/json")?e.json():e.text()}).then(function(e){var t=c.remote?e.content:e,o=e;if(d){if("object"===(void 0===t?"undefined":r(t))){var i=!0,u=!1,a=void 0;try{for(var s,f=Object.keys(t)[Symbol.iterator]();!(i=(s=f.next()).done);i=!0){var l=s.value;t[l.replace(/^components\//,"")]=t[l],delete t[l]}}catch(e){u=!0,a=e}finally{try{!i&&f.return&&f.return()}finally{if(u)throw a}}}if(y){var p=c.requestOptions.template,h=!0,b=!1,v=void 0;try{for(var m,_=Object.keys(p)[Symbol.iterator]();!(h=(m=_.next()).done);h=!0){var w=m.value;t[w]=t[p[w]],delete t[p[w]]}}catch(e){b=!0,v=e}finally{try{!h&&_.return&&_.return()}finally{if(b)throw v}}}c.remote||(o=t)}n(null,o)}).catch(function(e){return n(e)})},n(17);var o=n(4),i=function(e){return-1!==["GET","POST","PUT","DELETE"].indexOf(e)},u=function(e){return"object"===(void 0===e?"undefined":r(e))&&!Array.isArray(e)},a=function(e){var t=[];if(u(e))for(var n in e)e.hasOwnProperty(n)&&t.push(e[n]);else"string"==typeof e?t=[e]:Array.isArray(e)&&e.length>0&&(t=e);return t}},function(e,t,n){"use strict";function r(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t1&&void 0!==arguments[1]?arguments[1]:{filterValues:!1,arrayIndex:!1};if(!e)return"";var n={},r=function(n){return t.filterValues&&(""===e[n]||void 0===e[n])};Object.keys(e).forEach(function(t){r(t)||(n[t]=e[t])});var o=Object.keys(n);return o.sort(),o.map(function(n){var r=e[n];return void 0===r?"":null===r?s(n):Array.isArray(r)?r.reduce(p(t)(n),[]).join("&"):s(n)+"="+s(r)}).filter(function(e){return e.length>0}).join("&")}Object.defineProperty(t,"__esModule",{value:!0});var u=function(){function e(e,t){var n=[],r=!0,o=!1,i=void 0;try{for(var u,a=e[Symbol.iterator]();!(r=(u=a.next()).done)&&(n.push(u.value),!t||n.length!==t);r=!0);}catch(e){o=!0,i=e}finally{try{!r&&a.return&&a.return()}finally{if(o)throw i}}return n}return function(t,n){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return e(t,n);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};t.parse=o,t.stringify=i;var s=function(e){return encodeURIComponent(e).replace(/[!'()*]/g,function(e){return"%"+e.charCodeAt(0).toString(16).toUpperCase()})},c=function(e,t){var n=e.indexOf(t);return-1===n?[e]:[e.slice(0,n),e.slice(n+t.length)]},f=function e(t){return Array.isArray(t)?t.sort():"object"===(void 0===t?"undefined":a(t))?e(Object.keys(t)).sort(function(e,t){return Number(e)-Number(t)}).map(function(e){return t[e]}):t},l=function(e,t,n){return void 0===n[e]?t:[].concat(n[e],t)},p=function(e){return function(t){return function(n,o){if(void 0===o)return n;if(null===o)return[].concat(r(n),[s(t)]);if(e.includeArrayIndex){if("object"===(void 0===o?"undefined":a(o))){var i=n.length/Object.keys(o).length;return n.concat(Object.keys(o).map(function(e){return[s(t),"[",s(i),"]","[",s(e),"]=",s(o[e])].join("")}))}var u=n.length;return[].concat(r(n),[[s(t),"[",s(u),"]=",s(o)].join("")])}return[].concat(r(n),[[s(t),"=",s(o)].join("")])}}}},function(e,t,n){"use strict";(function(e){function r(e){return e&&e.__esModule?e:{default:e}}var o;Object.defineProperty(t,"__esModule",{value:!0}),t.tools=t.api=t.hooks=void 0;var i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},u=n(2),a=r(u),s=n(16),c=r(s),f=n(24),l=r(f),p={hooks:a.default,api:c.default,tools:l.default};t.hooks=a.default,t.api=c.default,t.tools=l.default,t.default=p,function(r){n(28)&&r?void 0!==(o=function(){r.stencilUtils=p}.call(t,n,t,e))&&(e.exports=o):"object"===i(e)&&e.exports?e.exports=p:window.stencilUtils=p}(void 0)}).call(t,n(6)(e))},function(e,t){e.exports=function(e){return e.webpackPolyfill||(e.deprecate=function(){},e.paths=[],e.children||(e.children=[]),Object.defineProperty(e,"loaded",{enumerable:!0,get:function(){return e.l}}),Object.defineProperty(e,"id",{enumerable:!0,get:function(){return e.i}}),e.webpackPolyfill=1),e}},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var u=function(){function e(e,t){for(var n=0;n-1?t:e}function b(e,t){if(!(this instanceof b))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');t=t||{};var n=t.body;if(e instanceof b){if(e.bodyUsed)throw new TypeError("Already read");this.url=e.url,this.credentials=e.credentials,t.headers||(this.headers=new a(e.headers)),this.method=e.method,this.mode=e.mode,this.signal=e.signal,n||null==e._bodyInit||(n=e._bodyInit,e.bodyUsed=!0)}else this.url=String(e);if(this.credentials=t.credentials||this.credentials||"same-origin",!t.headers&&this.headers||(this.headers=new a(t.headers)),this.method=h(t.method||this.method||"GET"),this.mode=t.mode||this.mode||null,this.signal=t.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&n)throw new TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(n),!("GET"!==this.method&&"HEAD"!==this.method||"no-store"!==t.cache&&"no-cache"!==t.cache)){var r=/([?&])_=[^&]*/;if(r.test(this.url))this.url=this.url.replace(r,"$1_="+(new Date).getTime());else{var o=/\?/;this.url+=(o.test(this.url)?"&":"?")+"_="+(new Date).getTime()}}}function v(e){var t=new FormData;return e.trim().split("&").forEach(function(e){if(e){var n=e.split("="),r=n.shift().replace(/\+/g," "),o=n.join("=").replace(/\+/g," ");t.append(decodeURIComponent(r),decodeURIComponent(o))}}),t}function m(e){var t=new a;return e.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach(function(e){var n=e.split(":"),r=n.shift().trim();if(r){var o=n.join(":").trim();t.append(r,o)}}),t}function _(e,t){if(!(this instanceof _))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');t||(t={}),this.type="default",this.status=void 0===t.status?200:t.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in t?t.statusText:"",this.headers=new a(t.headers),this.url=t.url||"",this._initBody(e)}function w(e,t){return new Promise(function(n,r){function o(){s.abort()}var u=new b(e,t);if(u.signal&&u.signal.aborted)return r(new k("Aborted","AbortError"));var s=new XMLHttpRequest;s.onload=function(){var e={status:s.status,statusText:s.statusText,headers:m(s.getAllResponseHeaders()||"")};e.url="responseURL"in s?s.responseURL:e.headers.get("X-Request-URL");var t="response"in s?s.response:s.responseText;setTimeout(function(){n(new _(t,e))},0)},s.onerror=function(){setTimeout(function(){r(new TypeError("Network request failed"))},0)},s.ontimeout=function(){setTimeout(function(){r(new TypeError("Network request failed"))},0)},s.onabort=function(){setTimeout(function(){r(new k("Aborted","AbortError"))},0)},s.open(u.method,function(e){try{return""===e&&O.location.href?O.location.href:e}catch(t){return e}}(u.url),!0),"include"===u.credentials?s.withCredentials=!0:"omit"===u.credentials&&(s.withCredentials=!1),"responseType"in s&&(g.blob?s.responseType="blob":g.arrayBuffer&&u.headers.get("Content-Type")&&-1!==u.headers.get("Content-Type").indexOf("application/octet-stream")&&(s.responseType="arraybuffer")),!t||"object"!=typeof t.headers||t.headers instanceof a?u.headers.forEach(function(e,t){s.setRequestHeader(t,e)}):Object.getOwnPropertyNames(t.headers).forEach(function(e){s.setRequestHeader(e,i(t.headers[e]))}),u.signal&&(u.signal.addEventListener("abort",o),s.onreadystatechange=function(){4===s.readyState&&u.signal.removeEventListener("abort",o)}),s.send(void 0===u._bodyInit?null:u._bodyInit)})}Object.defineProperty(t,"__esModule",{value:!0}),t.Headers=a,t.Request=b,t.Response=_,n.d(t,"DOMException",function(){return k}),t.fetch=w;var O="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof self&&self||void 0!==O&&O,g={searchParams:"URLSearchParams"in O,iterable:"Symbol"in O&&"iterator"in Symbol,blob:"FileReader"in O&&"Blob"in O&&function(){try{return new Blob,!0}catch(e){return!1}}(),formData:"FormData"in O,arrayBuffer:"ArrayBuffer"in O};if(g.arrayBuffer)var j=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],P=ArrayBuffer.isView||function(e){return e&&j.indexOf(Object.prototype.toString.call(e))>-1};a.prototype.append=function(e,t){e=o(e),t=i(t);var n=this.map[e];this.map[e]=n?n+", "+t:t},a.prototype.delete=function(e){delete this.map[o(e)]},a.prototype.get=function(e){return e=o(e),this.has(e)?this.map[e]:null},a.prototype.has=function(e){return this.map.hasOwnProperty(o(e))},a.prototype.set=function(e,t){this.map[o(e)]=i(t)},a.prototype.forEach=function(e,t){for(var n in this.map)this.map.hasOwnProperty(n)&&e.call(t,this.map[n],n,this)},a.prototype.keys=function(){var e=[];return this.forEach(function(t,n){e.push(n)}),u(e)},a.prototype.values=function(){var e=[];return this.forEach(function(t){e.push(t)}),u(e)},a.prototype.entries=function(){var e=[];return this.forEach(function(t,n){e.push([n,t])}),u(e)},g.iterable&&(a.prototype[Symbol.iterator]=a.prototype.entries);var E=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];b.prototype.clone=function(){return new b(this,{body:this._bodyInit})},d.call(b.prototype),d.call(_.prototype),_.prototype.clone=function(){return new _(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new a(this.headers),url:this.url})},_.error=function(){var e=new _(null,{status:0,statusText:""});return e.type="error",e};var T=[301,302,303,307,308];_.redirect=function(e,t){if(-1===T.indexOf(t))throw new RangeError("Invalid status code");return new _(null,{status:t,headers:{location:e}})};var k=O.DOMException;try{new k}catch(e){k=function(e,t){this.message=e,this.name=t;var n=Error(e);this.stack=n.stack},k.prototype=Object.create(Error.prototype),k.prototype.constructor=k}w.polyfill=!0,O.fetch||(O.fetch=w,O.Headers=a,O.Request=b,O.Response=_)},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var u=function(){function e(e,t){for(var n=0;n2&&void 0!==arguments[2]?arguments[2]:null,r=arguments[3],o=n,i=r;"function"==typeof o&&(i=o,o=null);var u=(0,p.normalizeQueryStringParams)(t);this.remoteRequest(this.endpoint+e,"POST",{params:u,template:o},function(e,t){var n={err:e,response:t};l.default.emit("product-options-change-remote",n),i(e,t)})}},{key:"configureInCart",value:function(e,t,n){this.remoteRequest(this.inCartEndpoint+e,"GET",t,function(e,t){n(e,t)})}}]),t}(c.default);t.default=y},function(e,t,n){"use strict";function r(e){var t=o.parse(e);return o.stringify(t,{filterValues:!0})}Object.defineProperty(t,"__esModule",{value:!0}),t.normalizeQueryStringParams=r;var o=n(4)},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function u(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var a=function(){function e(e,t){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:{},t=arguments[1],n="/api/storefront/carts";e.includeOptions&&(n=this.includeOptions(n)),this.makeRequest(n,"GET",e,!0,function(e,n){t(e,n)})}},{key:"getCart",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments[1];if(!e.cartId)return this.getCarts(e,function(e,n){return t(e,n[0])});var n="/api/storefront/carts/"+e.cartId;e.includeOptions&&(n=this.includeOptions(n)),this.makeRequest(n,"GET",e,!0,function(e,n){t(e,n)})}},{key:"includeOptions",value:function(e){return e+"?include=lineItems.physicalItems.options,lineItems.digitalItems.options"}},{key:"getCartQuantity",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments[1];this.getCart(e,function(e,n){if(e)return t(e);var r=0;if(n){var o=n;r=[o.lineItems.physicalItems,o.lineItems.digitalItems,o.lineItems.customItems].reduce(function(e,t){return e.concat(t)}).filter(function(e){return!e.parentId}).map(function(e){return e.quantity}).reduce(function(e,t){return e+t},0)+o.lineItems.giftCertificates.length}t(null,r)})}},{key:"itemAdd",value:function(e,t){this.remoteRequest("/cart/add","POST",{formData:e},function(e,n){var r={err:e,response:n};l.default.emit("cart-item-add-remote",r),t(e,n)})}},{key:"itemUpdate",value:function(e,t,n){var r=n,o=void 0;Array.isArray(e)&&"function"==typeof t?(r=t,o=e):o=[{id:e,quantity:t}],this.update(o,function(e,t){var n={items:o,err:e,response:t};l.default.emit("cart-item-update-remote",n),r(e,t)})}},{key:"itemRemove",value:function(e,t){var n=[{id:e,quantity:0}];this.update(n,function(e,r){var o={items:n,err:e,response:r};l.default.emit("cart-item-remove-remote",o),t(e,r)})}},{key:"getItemGiftWrappingOptions",value:function(e,t,n){var r=t||{},o=n;"function"==typeof r&&(o=r,r={}),this.remoteRequest("/gift-wrapping/"+e,"GET",r,o)}},{key:"submitItemGiftWrappingOption",value:function(e,t,n){this.remoteRequest("/gift-wrapping/"+e,"POST",{params:t},n)}},{key:"update",value:function(e,t){var n={items:e};this.remoteRequest("/cart/update","POST",{params:n},t)}},{key:"getContent",value:function(e,t){var n=e||{},r=t;"function"==typeof n&&(r=n,n={}),this.makeRequest("/cart.php","GET",n,!1,r)}},{key:"getShippingQuotes",value:function(e,t,n){var r={params:e},o=n,i=t;"function"!=typeof o&&(o=i,i=null),i&&(r.template=i),this.remoteRequest("/shipping-quote","GET",r,o)}},{key:"submitShippingQuote",value:function(e,t){var n={params:{shipping_method:e}};this.remoteRequest("/shipping-quote","POST",n,t)}},{key:"applyCode",value:function(e,t){var n={params:{code:e}};this.remoteRequest("/apply-code","POST",n,t)}},{key:"applyGiftCertificate",value:function(e,t){var n={params:{code:e}};this.remoteRequest("/gift-certificates","POST",n,t)}}]),t}(c.default);t.default=p},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var o=n(25),i=r(o),u=n(26),a=r(u),s=n(27),c=r(s);t.default={image:new i.default,imageSrcset:new a.default,storage:new c.default}},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i=function(){function e(e,t){for(var n=0;n