"use strict";function _typeof(e){return _typeof="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},_typeof(e)}function _regeneratorRuntime(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */_regeneratorRuntime=function(){return e};var e={},t=Object.prototype,n=t.hasOwnProperty,r=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",a=o.asyncIterator||"@@asyncIterator",c=o.toStringTag||"@@toStringTag";function u(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{u({},"")}catch(e){u=function(e,t,n){return e[t]=n}}function l(e,t,n,o){var i=t&&t.prototype instanceof f?t:f,a=Object.create(i.prototype),c=new S(o||[]);return r(a,"_invoke",{value:x(e,n,c)}),a}function s(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}e.wrap=l;var d={};function f(){}function h(){}function y(){}var p={};u(p,i,(function(){return this}));var m=Object.getPrototypeOf,w=m&&m(m(k([])));w&&w!==t&&n.call(w,i)&&(p=w);var v=y.prototype=f.prototype=Object.create(p);function g(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function b(e,t){function o(r,i,a,c){var u=s(e[r],e,i);if("throw"!==u.type){var l=u.arg,d=l.value;return d&&"object"==_typeof(d)&&n.call(d,"__await")?t.resolve(d.__await).then((function(e){o("next",e,a,c)}),(function(e){o("throw",e,a,c)})):t.resolve(d).then((function(e){l.value=e,a(l)}),(function(e){return o("throw",e,a,c)}))}c(u.arg)}var i;r(this,"_invoke",{value:function(e,n){function r(){return new t((function(t,r){o(e,n,t,r)}))}return i=i?i.then(r,r):r()}})}function x(e,t,n){var r="suspendedStart";return function(o,i){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===o)throw i;return P()}for(n.method=o,n.arg=i;;){var a=n.delegate;if(a){var c=L(a,n);if(c){if(c===d)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===r)throw r="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r="executing";var u=s(e,t,n);if("normal"===u.type){if(r=n.done?"completed":"suspendedYield",u.arg===d)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(r="completed",n.method="throw",n.arg=u.arg)}}}function L(e,t){var n=t.method,r=e.iterator[n];if(void 0===r)return t.delegate=null,"throw"===n&&e.iterator.return&&(t.method="return",t.arg=void 0,L(e,t),"throw"===t.method)||"return"!==n&&(t.method="throw",t.arg=new TypeError("The iterator does not provide a '"+n+"' method")),d;var o=s(r,e.iterator,t.arg);if("throw"===o.type)return t.method="throw",t.arg=o.arg,t.delegate=null,d;var i=o.arg;return i?i.done?(t[e.resultName]=i.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,d):i:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,d)}function _(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function E(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function S(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(_,this),this.reset(!0)}function k(e){if(e){var t=e[i];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var r=-1,o=function t(){for(;++r<e.length;)if(n.call(e,r))return t.value=e[r],t.done=!1,t;return t.value=void 0,t.done=!0,t};return o.next=o}}return{next:P}}function P(){return{value:void 0,done:!0}}return h.prototype=y,r(v,"constructor",{value:y,configurable:!0}),r(y,"constructor",{value:h,configurable:!0}),h.displayName=u(y,c,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===h||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,y):(e.__proto__=y,u(e,c,"GeneratorFunction")),e.prototype=Object.create(v),e},e.awrap=function(e){return{__await:e}},g(b.prototype),u(b.prototype,a,(function(){return this})),e.AsyncIterator=b,e.async=function(t,n,r,o,i){void 0===i&&(i=Promise);var a=new b(l(t,n,r,o),i);return e.isGeneratorFunction(n)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},g(v),u(v,c,"Generator"),u(v,i,(function(){return this})),u(v,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},e.values=k,S.prototype={constructor:S,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(E),!e)for(var t in this)"t"===t.charAt(0)&&n.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function r(n,r){return a.type="throw",a.arg=e,t.next=n,r&&(t.method="next",t.arg=void 0),!!r}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return r("end");if(i.tryLoc<=this.prev){var c=n.call(i,"catchLoc"),u=n.call(i,"finallyLoc");if(c&&u){if(this.prev<i.catchLoc)return r(i.catchLoc,!0);if(this.prev<i.finallyLoc)return r(i.finallyLoc)}else if(c){if(this.prev<i.catchLoc)return r(i.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return r(i.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=e,a.arg=t,i?(this.method="next",this.next=i.finallyLoc,d):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),d},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),E(n),d}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var o=r.arg;E(n)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:k(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=void 0),d}},e}function asyncGeneratorStep(e,t,n,r,o,i,a){try{var c=e[i](a),u=c.value}catch(e){return void n(e)}c.done?t(u):Promise.resolve(u).then(r,o)}function _asyncToGenerator(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var i=e.apply(t,n);function a(e){asyncGeneratorStep(i,r,o,a,c,"next",e)}function c(e){asyncGeneratorStep(i,r,o,a,c,"throw",e)}a(void 0)}))}}function _defineProperty(e,t,n){return(t=_toPropertyKey(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function _toPropertyKey(e){var t=_toPrimitive(e,"string");return"symbol"===_typeof(t)?t:String(t)}function _toPrimitive(e,t){if("object"!==_typeof(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!==_typeof(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}window.logout=function(){var e;fetch("/api/member/signout",(e={method:"POST",headers:window.fetchHeaders,cache:"no-store",credentials:"same-origin"},_defineProperty(e,"cache","no-store"),_defineProperty(e,"credentials","same-origin"),_defineProperty(e,"body",{}),e)).then(window.handleFetchResponse).then((function(e){window.location.reload()})).catch((function(e){console.error(e)}))},window.logClientSideError=function(e){fetch("/api/generalapi/LogClientError",{method:"POST",headers:window.fetchHeaders,cache:"no-store",credentials:"same-origin",body:e}).catch((function(e){console.error(e)}))},window.parseBool=function(e){var t;return"true"===(null==e||null===(t=e.toLowerCase())||void 0===t?void 0:t.trim())},window.parseString=function(e){return null==e?void 0:e.trim()},window.formatNumber=function(e,t,n){return new Intl.NumberFormat(n,{minimumFractionDigits:t,maximumFractionDigits:t}).format(e)},window.formatCurrency=function(e,t,n,r){return new Intl.NumberFormat(n,{minimumFractionDigits:t,maximumFractionDigits:t,style:"currency",currency:r}).format(e)},window.copyToClipboard=function(e,t){window.navigator.clipboard.writeText(e),t.querySelector(".copied").classList.add("show"),window.setTimeout((function(){t.querySelector(".copied").classList.remove("show")}),500)},window.handleFetchResponse=function(){var e=_asyncToGenerator(_regeneratorRuntime().mark((function e(t,n){var r;return _regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!t.ok){e.next=6;break}return e.next=3,t.json();case 3:return e.abrupt("return",e.sent);case 6:return r={},e.prev=7,e.next=10,t.json();case 10:r=e.sent,e.next=15;break;case 13:e.prev=13,e.t0=e.catch(7);case 15:throw{message:"".concat(t.status," - ").concat(t.url),exception:r.Message,source:n};case 16:case"end":return e.stop()}}),e,null,[[7,13]])})));return function(t,n){return e.apply(this,arguments)}}(),window.handleResourcesArray=function(e){var t={};return e&&Object.keys(e).forEach((function(n){t[e[n].Name.replace(/\.$/,"")]=e[n].Value})),t},window.catchFetchErrors=function(e){console.error(e),e instanceof TypeError&&(e={message:e.message}),showError(),window.logClientSideError(JSON.stringify(e))},window.getResource=function(e){var t=!1;return e instanceof Array||(t=!0,e=[e]),fetch("/api/generalapi/FetchResources",{method:"POST",headers:window.fetchHeaders,cache:"no-store",credentials:"same-origin",body:JSON.stringify({resources:e,countryId:getCountryId(),languageId:getLanguageId(),useDate:getDate()})}).then(window.handleFetchResponse).then((function(e){return t?e[0]:e}))},window.getResources=window.fetchResources=window.getResource,window.decodeBase64=function(e){return null==e?null:decodeURIComponent(escape(window.atob(e)))},window.trackOutbound=function(e){var t=element.attributes.href.value,n="_blank"==element.attributes.target.value,r=function(){};return n||(r=function(){window.location.href=t}),"function"==typeof gtag?gtag("event","click",{send_to:"default",event_category:"outbound",event_label:t,transport_type:"beacon",event_callback:r}):window.location.href=t,n},window.lazyImages=function(){console.log("lazyImages"),document.querySelectorAll('img[loading="lazy"]:not(.lazy-loaded)').forEach((function(e){e.complete&&0!==e.naturalHeight?e.classList.add("lazy-loaded"):e.addEventListener("load",(function(t){e.classList.add("lazy-loaded")}))}))},window.addLoadFunction(window.lazyImages),window.lazyImages(),window.keepAliveTimer=0,window.keepAlive=(clearTimeout(keepAliveTimer),void(keepAliveTimer=setInterval((function(e){fetch("/api/member/keepSessionAlive",{method:"POST",headers:window.fetchHeaders,cache:"no-store",credentials:"same-origin",body:null})}),6e5))),document.addEventListener("show.bs.modal",(function(e){if("undefined"==typeof Enumerable){var t=e.target,n=1040+10*document.querySelectorAll(".modal.fade.show").length,r=0;document.querySelectorAll(".modal.fade.show").forEach((function(e,t){var o;+(null==t||null===(o=t.style)||void 0===o?void 0:o.zIndex)>=n&&r++})),n+=10*r,console.log(t.id+" showing at",n),t.style.zIndex=n,window.setTimeout((function(){console.log(t.id+" backdrop showing at",n-1);var e=document.querySelectorAll(".modal-backdrop:not(.modal-stack)"),r=[];e.forEach((function(e){r.push(e)})),r.length&&(r[r.length-1].style.zIndex=n-1,r[r.length-1].classList.add("modal-stack"))}),0)}else{t=e.target;var o=1040,i=[];document.querySelectorAll(".modal.fade.show").forEach((function(e){e!=t&&i.push(e)})),i.length&&(o=Enumerable.From(i).Select((function(e){return+e.style.zIndex})).Max()+10),console.log(t.id+" showing at",o),t.style.zIndex=o,window.setTimeout((function(){console.log(t.id+" backdrop showing at",o-1);var e=document.querySelectorAll(".modal-backdrop:not(.modal-stack)"),n=[];e.forEach((function(e){n.push(e)})),n.length&&(n[n.length-1].style.zIndex=o-1,n[n.length-1].classList.add("modal-stack"))}),0)}})),document.addEventListener("hidden.bs.modal",(function(e){document.querySelectorAll(".modal.show").length&&document.body.classList.add("modal-open")})),window.elementIntersection=function(e,t){return Math.max(0,Math.min(e.x+e.w,t.x+t.w)-Math.max(e.x,t.x))*Math.max(0,Math.min(e.y+e.h,t.y+t.h)-Math.max(e.y,t.y))},window.elementPercentInViewport=function(e){var t=e.getBoundingClientRect(),n={x:t.x,y:t.y,w:t.width,h:t.height},r={x:0,y:0,w:window.innerWidth,h:window.innerHeight},o=n.w*n.h;return window.elementIntersection(n,r)/o};
///*# sourceMappingURL=https://www.designersguild.com/js/dist/models/common/common-functions.min.js.map */
;
"use strict";function _typeof(t){return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},_typeof(t)}function flattenIntoArray(t,r,e,o,n,a){for(var y=e,i=0,f=toLength(r.length);i<f;){var c="".concat(i);if(c in r){var p=r[c];n&&(p=n.call(a,p,i,t));var l=void 0;if((l="object"===_typeof(p)&&(void 0!==(l=p[Symbol.isConcatSpreadable])?!!l:Array.isArray(p)))&&o>0){y=flattenIntoArray(t,p,y,o-1)-1}else{if(y!==toLength(y))throw TypeError();t[y]=p}}y+=1,i+=1}return y}function arraySpeciesCreate(t,r){if((r=toLength(r))<0)throw new RangeError;var e;return Array.isArray(t)||("function"!=typeof(e=t.constructor)||e!==Array&&!Array.isArray(e.prototype)||(e=void 0),("object"===_typeof(e)?null!==e:"function"==typeof e)&&null===(e=e[Symbol.species])&&(e=void 0)),void 0===e&&(e=Array),new e(r)}function toLength(t){return t>0?Math.min(toInteger(t),9007199254740991):0}function toInteger(t){return t=+t,isNaN(t)?0:(t>0?Math.floor:Math.ceil)(t)}function toObject(t){if(void 0===t)throw new TypeError("Can't call method on ".concat(t));return Object(t)}"function"!=typeof Array.prototype.flatMap&&Object.defineProperty(Array.prototype,"flatMap",{enumerable:!1,value:function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0,e=toObject(this),o=arraySpeciesCreate(e,0);return flattenIntoArray(o,e,0,1,t,r),o}}),"function"!=typeof Array.prototype.flatten&&Object.defineProperty(Array.prototype,"flatten",{enumerable:!1,value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1/0,r=toObject(this),e=arraySpeciesCreate(r,0);return flattenIntoArray(e,r,0,t=Number(t)),e}});
///*# sourceMappingURL=https://www.designersguild.com/js/dist/models/common/polyfills.min.js.map */
;
Array.prototype.equals&&console.warn("Overriding existing Array.prototype.equals. Possible causes: New API defines the method, there's a framework conflict or you've got double inclusions in your code."),Array.prototype.equals=function(e){if(!e)return!1;if(this.length!=e.length)return!1;for(var t=0,r=this.length;t<r;t++)if(this[t]instanceof Array&&e[t]instanceof Array){if(!this[t].equals(e[t]))return!1}else if(this[t]!=e[t])return!1;return!0},Object.defineProperty(Array.prototype,"equals",{enumerable:!1}),Set.prototype.multipleIntersect&&console.warn("Overriding existing Set.prototype.multipleIntersect. Possible causes: New API defines the method, there's a framework conflict or you've got double inclusions in your code."),Set.prototype.multipleIntersect=function(...e){let t=e.length;return e.length&&this.forEach((r=>{let o=t,n=!0;for(;o--&&(n=e[o].has(r),n););n||this.delete(r)})),this},Object.defineProperty(Set.prototype,"multipleIntersect",{enumerable:!1});
///*# sourceMappingURL=https://www.designersguild.com/js/dist/util/extensions.min.js.map */
;
"use strict";var productViewModel=function(e,r){var a={};a.data=ko.observable(),a.productId=e,a.basketLineTypeId=r,a.productPageId=ko.observable(),a.enabled=ko.observable(!0),a.quantity=ko.observable(),a.resources=getPrefetchedResources();var n=a.data.subscribe((function(e){var r,o,i,t,s,u,d,c,m;Object.assign(a,e),a.quantity(null!==(r=null===(o=a.stockMessage)||void 0===o?void 0:o.quantityMinimum)&&void 0!==r?r:1);var l=9999;switch(a.basketLineTypeId){case 2:case 3:l=a.stockMessage.reserveQuantityMaximum;break;default:l=a.stockMessage.quantityMaximum}a.quantity.extend({numberFormatted:{digits:countDecimals(null===(i=a.stockMessage)||void 0===i?void 0:i.quantityIncrement),currency:{FormattingCulture:getCulture()},minValue:null===(t=a.stockMessage)||void 0===t?void 0:t.quantityMinimum,maxValue:l,unit:null===(s=a.stockMessage)||void 0===s?void 0:s.unit},roundedNumeric:{precision:countDecimals(null!==(u=null===(d=a.stockMessage)||void 0===d?void 0:d.quantityIncrement)&&void 0!==u?u:1)}}),a.quantity.extend({required:{params:!0,onlyIf:function(){return a.enabled()},message:a.resources.QuantityRequired},errorPulse:{},min:{params:null===(c=a.stockMessage)||void 0===c?void 0:c.quantityMinimum,onlyIf:function(){return a.enabled()},message:"".concat(a.resources.pleaseGreaterThanEqualTo," ").concat(null===(m=a.stockMessage)||void 0===m?void 0:m.quantityMinimum)},max:{params:l,onlyIf:function(){return a.enabled()},message:"".concat(a.resources.pleaseLessThanEqualTo," ").concat(l)}}),l||a.enabled(!1),n.dispose()}));return a.image=ko.observable(),a.products=ko.observableArray([]),a.errors=new ko.validation.group([a.quantity]),a.isValid=function(){return a.errors.showAllMessages(!1),!(a.errors().length>0)||(a.errors.showAllMessages(!0),a.errors.filter((function(e){e.isValid.notifySubscribers(e.isValid())})),!1)},a.showLargeImage=function(){},a.primaryProductId=ko.observable(),a.getProductByBasketLineType=function(e,r){return a.products().filter((function(a){return a.productId==e&&a.basketLineTypeId==r}))[0]},a.buildPopover=function(){var e=a.quantity.DOMElement.closest(".order-form-item");if(e){var r=e.querySelector(".reserve-overlay");r&&"popover"==r.dataset.bsToggle&&bootstrap.Popover.getOrCreateInstance(r)}},a},orderFormGroupViewModel=function(e){var r={parent:e};return r.data=ko.observable(),r.dataSub=r.data.subscribe((function(e){Object.assign(r,e),r.dataSub.dispose()})),r.primaryProductId=ko.observable(),r.image=ko.observable(),r.createImage=function(){return imageViewModel(r.Definition.productPageId)},r.showLargeImage=function(e,a){window.hasOwnProperty("largeImageModal")&&window.largeImageModal.load(r,a)},r.sizeGroups=ko.observableArray([]),r.createSizeGroup=function(){return sizeGroupViewModel(r)},r.products=ko.observableArray([]),r.getProductByBasketLineType=function(e,a){return r.products().filter((function(r){return r.productId==e&&r.basketLineTypeId==a}))[0]},r},sizeGroupViewModel=function(e){var r={parent:e};return r.data=ko.observable(),r.dataSub=r.data.subscribe((function(e){Object.assign(r,e),r.dataSub.dispose()})),r.image=ko.observable(),r.createImage=function(){return imageViewModel(r.Definition.productPageId)},r.showLargeImage=function(e,a){window.hasOwnProperty("largeImageModal")&&window.largeImageModal.load(r,a)},r.products=ko.observableArray([]),r.getProductByBasketLineType=function(e,a){return r.products().filter((function(r){return r.productId==e&&r.basketLineTypeId==a}))[0]},r},imageViewModel=function(e){var r={};r.ProductPageID=e,r.data=ko.observable();var a=r.data.subscribe((function(e){Object.assign(r,e),a.dispose(),r.hotspots(r.Hotspots)}));return r.orderFormGroups=ko.observableArray([]),r.createOrderFormGroup=function(){return orderFormGroupViewModel(r)},r.hotspots=ko.observableArray([]),r},htmlViewModel=function(e){var r={parent:e};return r.images=ko.observableArray([]),r.getImageById=function(e){return r.images().filter((function(r){return r.ProductPageID==e}))[0]},r},stockMessage=function(){var e={};return e.cssClasses=ko.observable(),e.stockMessage=ko.observable(),e},marketingPermissionCheckerViewModel=function(e){var r={parent:e};return r.busy=e.busy||ko.observable(!1),r.email=e.email||ko.observable().extend({required:{params:!0,message:"marketingPermissionChecker email required - email was not inherited from parent"},email:{params:!0,message:"marketingPermissionChecker email format - email was not inherited from parent"}}),r.emailConfirmation=e.emailConfirmation||ko.observable().extend({required:{params:!0,message:"marketingPermissionChecker emailConfirmation required - emailConfirmation was not inherited from parent"},email:{params:!0,message:"marketingPermissionChecker emailConfirmation format - emailConfirmation was not inherited from parent"}}),r.addressRequired=e.addressRequired||ko.observable(!1),r.sourceId=e.sourceId||0,r.thirdPartyId=e.thirdPartyId||null,r.availableLanguages=e.availableLanguages||ko.observableArray([]),r.languageId=e.languageId||window.getLanguageId(),r.countryId=e.countryId||window.getCountryId(),r.marketingCountryId=e.marketingCountryId||window.getCountryId(),r.marketingPermissions=ko.observableArray([]).extend({postable:!0}),r.havePerformedMarketingPermissionCheck=ko.observable(!1).extend({equal:{params:!0,message:"marketingPermissionChecker has not checked for marketing permissions"}}),r.email.subscribe((function(e){return r.havePerformedMarketingPermissionCheck(!1)})),r.emailConfirmation.subscribe((function(e){return r.havePerformedMarketingPermissionCheck(!1)})),r.emailConfirmation.isValid.subscribe((function(e){e&&setTimeout((function(){return r.checkMarketingPermissions()}),0)})),r.marketingCountryId.subscribe((function(e){r.loadLanguages(),r.checkMarketingPermissions()})),r.loadLanguages=function(){fetch("/api/member/LoadLanguagesForCountry",{method:"POST",headers:window.fetchHeaders,cache:"no-store",credentials:"same-origin",body:JSON.stringify({countryId:r.marketingCountryId()})}).then(window.handleFetchResponse).then((function(e){r.availableLanguages(e)}))},r.checkMarketingPermissions=function(){r.email()&&r.email.isValid()?(r.busy(!0),fetch("/api/form/CheckMarketingPermission",{method:"POST",headers:window.fetchHeaders,cache:"no-store",credentials:"same-origin",body:r.toJSON()}).then(window.handleFetchResponse).then((function(e){r.parent.userEmailMarketingPermitted(e.EmailMarketingPermitted),r.parent.userUnsubscribedFromEmailMarketing(e.UnsubscribedFromEmailMarketing),r.marketingPermissions(e.Permissions.map((function(e){return marketingPermission(e)}))),r.havePerformedMarketingPermissionCheck(!0),r.busy(!1)})).catch((function(e){r.parent.userEmailMarketingPermitted(!1),r.parent.userUnsubscribedFromEmailMarketing(!1),r.marketingPermissions([]),r.havePerformedMarketingPermissionCheck(!1),r.busy(!1),window.showError()}))):r.busy(!1)},r.toJS=function(){var e=ko.unwrap(r.languageId);return{Email:ko.unwrap(r.email),AddressRequired:ko.unwrap(r.addressRequired),CountryID:ko.unwrap(r.countryId),LanguageID:e||1,SourceID:ko.unwrap(r.sourceId),MarketingCountryID:ko.unwrap(r.marketingCountryId),ThirdPartyID:ko.unwrap(r.thirdPartyId)}},r.toJSON=function(){return JSON.stringify(r.toJS())},r},marketingPermission=function(e){var r=Object.assign({},e);return r.Checked=ko.observable(r.Default),r};
///*# sourceMappingURL=https://www.designersguild.com/js/dist/models/common/common-models.min.js.map */
;
"use strict";try{window.stockInfoViewModel=function(t){var e={parent:t};return e.busy=ko.observable(!1),e.product=ko.observable(),e.totalStock=ko.observable(),e.totalPurchaseOrderStock=ko.observable(),e.totalSupplierPurchaseOrderStock=ko.observable(),e.unit=ko.observable(),e.stockStatus=ko.observable(),e.inStockData=ko.observable(),e.dueInData=ko.observable(),e.supplierDueInData=ko.observable(),e.supplierData=ko.observable(),e.supplierStockAvailabilityMessage=ko.observable(),e.stockModalElement=document.querySelector("#stock-modal"),e.totalInStock=ko.pureComputed((function(){if(e.inStockData()){var t=0;return e.inStockData().flatMap((function(t){return t.Pieces})).forEach((function(e){t+=+e.Length.replace(/[^\d.]/,"")})),Number(Math.round(10*t)/10).toFixed(2)+e.unit()}return 0}),e),e.totalDueIn=ko.pureComputed((function(){if(e.dueInData()){var t=0;return e.dueInData().forEach((function(e){t+=+e.Length.replace(/[^\d.]/,"")})),Number(Math.round(10*t)/10).toFixed(2)+e.unit()}return 0}),e),e.totalSupplier=ko.pureComputed((function(){if(e.supplierData()){var t=0;return e.supplierData().flatMap((function(t){return t.Pieces})).forEach((function(e){t+=+e.Length.replace(/[^\d.]/,"")})),Number(Math.round(10*t)/10).toFixed(2)+e.unit()}return 0}),e),e.totalSupplierDueIn=ko.pureComputed((function(){if(e.supplierDueInData()){var t=0;return e.supplierDueInData().forEach((function(e){t+=+e.Length.replace(/[^\d.]/,"")})),Number(Math.round(10*t)/10).toFixed(2)+e.unit()}return 0}),e),e.supplierHasStock=ko.pureComputed((function(){return"0.00m"!=e.totalSupplier()&&0!=e.totalSupplier()}),e),e.sufficientSinglePieceAvailable=ko.pureComputed((function(){return e.supplierData().flatMap((function(t){return[t.Pieces]})).find((function(t){return+t.Length.replace(/[^\d.]/,"")<=+e.Quantity}))}),e),e.showStockInfo=function(t,o){(o=void 0===o?0:o,e.busy(!0),e.product(t),t.hasOwnProperty("stockMessage")?(e.unit(t.stockMessage.unit),e.stockStatus(t.statusMessage)):(e.unit(""),e.stockStatus("")),null==e.stockModalElement&&(e.stockModalElement=document.querySelector("#stock-modal")),null!=e.stockModalElement)?(null==ko.dataFor(e.stockModalElement)&&(ko.cleanNode(e.stockModalElement),ko.applyBindings({stockInfoModel:e},e.stockModalElement)),"undefined"!=typeof bootstrap?bootstrap.Modal.getOrCreateInstance(e.stockModalElement).show():window.addBootstrapLoadFunction((function(){bootstrap.Modal.getOrCreateInstance(e.stockModalElement).show()})),e.busy(!0),e.parent.hasOwnProperty("deliveryAddressFactory")&&(e.product().PermitCutLengthBreakdown||e.product().PermitBatch?e.parent.deliveryAddressFactory.actingCutLength(e.product()):e.parent.deliveryAddressFactory.actingCutLength(void 0)),e.supplierStockAvailabilityMessage(void 0),fetch("/api/stockist/GetPieceLevelStockInfo",{method:"POST",headers:window.fetchHeaders,cache:"no-store",credentials:"same-origin",body:JSON.stringify({productId:ko.unwrap(e.product().productId)||e.product().ProductID,countryId:getCountryId(),languageId:getLanguageId()})}).then(window.handleFetchResponse).then((function(t){if(console.log("getpiecelevelstockinfo returned",t),null!=t)if(e.totalStock(t.TotalStock),ko.utils.arrayForEach(t.Batches,(function(t){var e=0;t.Pieces.forEach((function(t){e+=Math.round(Number(t.Length)*Number(t.Quantity)*10)/10})),t.totalStock=Number(Math.round(10*e)/10).toFixed(2)})),e.inStockData(t.Batches),e.supplierData(t.SupplierStock),e.dueInData(t.PurchaseOrders),e.supplierDueInData(t.SupplierPurchaseOrders),e.totalPurchaseOrderStock(t.TotalPurchaseOrderLength),e.totalSupplierPurchaseOrderStock(t.TotalSupplierPurchaseOrderLength),e.supplierStockAvailabilityMessage(t.SupplierAvailabilityMessage),2!=o||e.supplierHasStock()){var r=document.querySelector("#stock-tab-menu li:nth-child("+(o+1)+") button");bootstrap.Tab.getOrCreateInstance(r).show()}else{var a=document.querySelector("#stock-tab-menu li:first-child button");bootstrap.Tab.getOrCreateInstance(a).show()}e.parent.hasOwnProperty("deliveryAddressFactory")&&e.product().hasOwnProperty("cutLengthBreakdown")&&(e.product().cutLengthBreakdown.selectedBatch(void 0),e.product().cutLengthBreakdown.availableBatches(e.inStockData().map((function(t){return{batch:t.BatchNumber,text:t.BatchNumber}})))),e.busy(!1)})).catch((function(t){e.busy(!1),window.catchFetchErrors(t)}))):console.error("#stock-modal was not found!")},e.init=function(){var t=window.location.search,o=new URLSearchParams(t);if(o.has("stock")){var r=o.get("stock");e.parent.data.subscribe((function(t){window.setTimeout((function(){var t=e.parent.AllProducts.find((function(t){return t.ProductCode==r}));t&&e.showStockInfo(t.Product)}),0)}))}},e.init(),e}}catch(t){}
///*# sourceMappingURL=https://www.designersguild.com/js/dist/models/common/stock-info.min.js.map */
;
