1234567891011121314151617181920212223242526272829303132333435 |
- if(!function(e,t){"use strict";"object"==typeof module&&"object"==typeof module.exports?module.exports=e.document?t(e,!0):function(e){if(!e.document)throw new Error("jQuery requires a window with a document");return t(e)}:t(e)}("undefined"!=typeof window?window:this,function(e,t){"use strict";function r(e,t,r){var i,a,o=(r=r||ue).createElement("script");if(o.text=e,t)for(i in pe)(a=t[i]||t.getAttribute&&t.getAttribute(i))&&o.setAttribute(i,a);r.head.appendChild(o).parentNode.removeChild(o)}function i(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?ie[ae.call(e)]||"object":typeof e}function a(e){var t=!!e&&"length"in e&&e.length,r=i(e);return!ce(e)&&!de(e)&&("array"===r||0===t||"number"==typeof t&&0<t&&t-1 in e)}function o(e,t){return e.nodeName&&e.nodeName.toLowerCase()===t.toLowerCase()}function n(e,t,r){return ce(t)?ge.grep(e,function(e,i){return!!t.call(e,i,e)!==r}):t.nodeType?ge.grep(e,function(e){return e===t!==r}):"string"!=typeof t?ge.grep(e,function(e){return-1<re.call(t,e)!==r}):ge.filter(t,e,r)}function s(e,t){for(;(e=e[t])&&1!==e.nodeType;);return e}function l(e){return e}function c(e){throw e}function d(e,t,r,i){var a;try{e&&ce(a=e.promise)?a.call(e).done(t).fail(r):e&&ce(a=e.then)?a.call(e,t,r):t.apply(void 0,[e].slice(i))}catch(e){r.apply(void 0,[e])}}function u(){ue.removeEventListener("DOMContentLoaded",u),e.removeEventListener("load",u),ge.ready()}function p(e,t){return t.toUpperCase()}function h(e){return e.replace(Oe,"ms-").replace(Re,p)}function g(){this.expando=ge.expando+g.uid++}function f(e,t,r){var i,a;if(void 0===r&&1===e.nodeType)if(i="data-"+t.replace(Me,"-$&").toLowerCase(),"string"==typeof(r=e.getAttribute(i))){try{r="true"===(a=r)||"false"!==a&&("null"===a?null:a===+a+""?+a:we.test(a)?JSON.parse(a):a)}catch(e){}Le.set(e,t,r)}else r=void 0;return r}function m(e,t,r,i){var a,o,n=20,s=i?function(){return i.cur()}:function(){return ge.css(e,t,"")},l=s(),c=r&&r[3]||(ge.cssNumber[t]?"":"px"),d=e.nodeType&&(ge.cssNumber[t]||"px"!==c&&+l)&&ke.exec(ge.css(e,t));if(d&&d[3]!==c){for(l/=2,c=c||d[3],d=+l||1;n--;)ge.style(e,t,d+c),(1-o)*(1-(o=s()/l||.5))<=0&&(n=0),d/=o;d*=2,ge.style(e,t,d+c),r=r||[]}return r&&(d=+d||+l||0,a=r[1]?d+(r[1]+1)*r[2]:+r[2],i&&(i.unit=c,i.start=d,i.end=a)),a}function I(e,t){for(var r,i,a,o,n,s,l,c=[],d=0,u=e.length;d<u;d++)(i=e[d]).style&&(r=i.style.display,t?("none"===r&&(c[d]=De.get(i,"display")||null,c[d]||(i.style.display="")),""===i.style.display&&Ve(i)&&(c[d]=(l=n=o=void 0,n=(a=i).ownerDocument,s=a.nodeName,(l=Ye[s])||(o=n.body.appendChild(n.createElement(s)),l=ge.css(o,"display"),o.parentNode.removeChild(o),"none"===l&&(l="block"),Ye[s]=l)))):"none"!==r&&(c[d]="none",De.set(i,"display",r)));for(d=0;d<u;d++)null!=c[d]&&(e[d].style.display=c[d]);return e}function E(e,t){var r;return r="undefined"!=typeof e.getElementsByTagName?e.getElementsByTagName(t||"*"):"undefined"!=typeof e.querySelectorAll?e.querySelectorAll(t||"*"):[],void 0===t||t&&o(e,t)?ge.merge([e],r):r}function y(e,t){for(var r=0,i=e.length;r<i;r++)De.set(e[r],"globalEval",!t||De.get(t[r],"globalEval"))}function v(e,t,r,a,o){for(var n,s,l,c,d,u,p=t.createDocumentFragment(),h=[],g=0,f=e.length;g<f;g++)if((n=e[g])||0===n)if("object"===i(n))ge.merge(h,n.nodeType?[n]:n);else if(ze.test(n)){for(s=s||p.appendChild(t.createElement("div")),l=(We.exec(n)||["",""])[1].toLowerCase(),c=Ke[l]||Ke._default,s.innerHTML=c[1]+ge.htmlPrefilter(n)+c[2],u=c[0];u--;)s=s.lastChild;ge.merge(h,s.childNodes),(s=p.firstChild).textContent=""}else h.push(t.createTextNode(n));for(p.textContent="",g=0;n=h[g++];)if(a&&-1<ge.inArray(n,a))o&&o.push(n);else if(d=Fe(n),s=E(p.appendChild(n),"script"),d&&y(s),r)for(u=0;n=s[u++];)$e.test(n.type||"")&&r.push(n);return p}function b(){return!0}function T(){return!1}function P(e,t){return e===function(){try{return ue.activeElement}catch(e){}}()==("focus"===t)}function S(e,t,r,i,a,o){var n,s;if("object"==typeof t){for(s in"string"!=typeof r&&(i=i||r,r=void 0),t)S(e,s,r,i,t[s],o);return e}if(null==i&&null==a?(a=r,i=r=void 0):null==a&&("string"==typeof r?(a=i,i=void 0):(a=i,i=r,r=void 0)),!1===a)a=T;else if(!a)return e;return 1===o&&(n=a,(a=function(e){return ge().off(e),n.apply(this,arguments)}).guid=n.guid||(n.guid=ge.guid++)),e.each(function(){ge.event.add(this,t,a,i,r)})}function C(e,t,r){r?(De.set(e,t,!1),ge.event.add(e,t,{namespace:!1,handler:function(e){var i,a,o=De.get(this,t);if(1&e.isTrigger&&this[t]){if(o.length)(ge.event.special[t]||{}).delegateType&&e.stopPropagation();else if(o=Z.call(arguments),De.set(this,t,o),i=r(this,t),this[t](),o!==(a=De.get(this,t))||i?De.set(this,t,!1):a={},o!==a)return e.stopImmediatePropagation(),e.preventDefault(),a.value}else o.length&&(De.set(this,t,{value:ge.event.trigger(ge.extend(o[0],ge.Event.prototype),o.slice(1),this)}),e.stopImmediatePropagation())}})):void 0===De.get(e,t)&&ge.event.add(e,t,b)}function _(e,t){return o(e,"table")&&o(11!==t.nodeType?t:t.firstChild,"tr")&&ge(e).children("tbody")[0]||e}function A(e){return e.type=(null!==e.getAttribute("type"))+"/"+e.type,e}function O(e){return"true/"===(e.type||"").slice(0,5)?e.type=e.type.slice(5):e.removeAttribute("type"),e}function R(e,t){var r,i,a,o,n,s;if(1===t.nodeType){if(De.hasData(e)&&(s=De.get(e).events))for(a in De.remove(t,"handle events"),s)for(r=0,i=s[a].length;r<i;r++)ge.event.add(t,a,s[a][r]);Le.hasData(e)&&(o=Le.access(e),n=ge.extend({},o),Le.set(t,n))}}function N(e,t,i,a){t=ee(t);var o,n,s,l,c,d,u=0,p=e.length,h=p-1,g=t[0],f=ce(g);if(f||1<p&&"string"==typeof g&&!le.checkClone&&et.test(g))return e.each(function(r){var o=e.eq(r);f&&(t[0]=g.call(this,r,o.html())),N(o,t,i,a)});if(p&&(n=(o=v(t,e[0].ownerDocument,!1,e,a)).firstChild,1===o.childNodes.length&&(o=n),n||a)){for(l=(s=ge.map(E(o,"script"),A)).length;u<p;u++)c=o,u!==h&&(c=ge.clone(c,!0,!0),l&&ge.merge(s,E(c,"script"))),i.call(e[u],c,u);if(l)for(d=s[s.length-1].ownerDocument,ge.map(s,O),u=0;u<l;u++)c=s[u],$e.test(c.type||"")&&!De.access(c,"globalEval")&&ge.contains(d,c)&&(c.src&&"module"!==(c.type||"").toLowerCase()?ge._evalUrl&&!c.noModule&&ge._evalUrl(c.src,{nonce:c.nonce||c.getAttribute("nonce")},d):r(c.textContent.replace(tt,""),c,d))}return e}function D(e,t,r){for(var i,a=t?ge.filter(t,e):e,o=0;null!=(i=a[o]);o++)r||1!==i.nodeType||ge.cleanData(E(i)),i.parentNode&&(r&&Fe(i)&&y(E(i,"script")),i.parentNode.removeChild(i));return e}function L(e,t,r){var i,a,o,n,s=e.style;return(r=r||it(e))&&(""!==(n=r.getPropertyValue(t)||r[t])||Fe(e)||(n=ge.style(e,t)),!le.pixelBoxStyles()&&rt.test(n)&&ot.test(t)&&(i=s.width,a=s.minWidth,o=s.maxWidth,s.minWidth=s.maxWidth=s.width=n,n=r.width,s.width=i,s.minWidth=a,s.maxWidth=o)),void 0!==n?n+"":n}function w(e,t){return{get:function(){return e()?void delete this.get:(this.get=t).apply(this,arguments)}}}function M(e){var t=ge.cssProps[e]||lt[e];return t||(e in st?e:lt[e]=function(e){for(var t=e[0].toUpperCase()+e.slice(1),r=nt.length;r--;)if((e=nt[r]+t)in st)return e}(e)||e)}function U(e,t,r){var i=ke.exec(t);return i?Math.max(0,i[2]-(r||0))+(i[3]||"px"):t}function k(e,t,r,i,a,o){var n="width"===t?1:0,s=0,l=0;if(r===(i?"border":"content"))return 0;for(;n<4;n+=2)"margin"===r&&(l+=ge.css(e,r+xe[n],!0,a)),i?("content"===r&&(l-=ge.css(e,"padding"+xe[n],!0,a)),"margin"!==r&&(l-=ge.css(e,"border"+xe[n]+"Width",!0,a))):(l+=ge.css(e,"padding"+xe[n],!0,a),"padding"!==r?l+=ge.css(e,"border"+xe[n]+"Width",!0,a):s+=ge.css(e,"border"+xe[n]+"Width",!0,a));return!i&&0<=o&&(l+=Math.max(0,Math.ceil(e["offset"+t[0].toUpperCase()+t.slice(1)]-o-l-s-.5))||0),l}function x(e,t,r){var i=it(e),a=(!le.boxSizingReliable()||r)&&"border-box"===ge.css(e,"boxSizing",!1,i),n=a,s=L(e,t,i),l="offset"+t[0].toUpperCase()+t.slice(1);if(rt.test(s)){if(!r)return s;s="auto"}return(!le.boxSizingReliable()&&a||!le.reliableTrDimensions()&&o(e,"tr")||"auto"===s||!parseFloat(s)&&"inline"===ge.css(e,"display",!1,i))&&e.getClientRects().length&&(a="border-box"===ge.css(e,"boxSizing",!1,i),(n=l in e)&&(s=e[l])),(s=parseFloat(s)||0)+k(e,t,r||(a?"border":"content"),n,i,s)+"px"}function G(e,t,r,i,a){return new G.prototype.init(e,t,r,i,a)}function F(){gt&&(!1===ue.hidden&&e.requestAnimationFrame?e.requestAnimationFrame(F):e.setTimeout(F,ge.fx.interval),ge.fx.tick())}function H(){return e.setTimeout(function(){ht=void 0}),ht=Date.now()}function V(e,t){var r,i=0,a={height:e};for(t=t?1:0;i<4;i+=2-t)a["margin"+(r=xe[i])]=a["padding"+r]=e;return t&&(a.opacity=a.width=e),a}function Y(e,t,r){for(var i,a=(B.tweeners[t]||[]).concat(B.tweeners["*"]),o=0,n=a.length;o<n;o++)if(i=a[o].call(r,t,e))return i}function B(e,t,r){var i,a,o=0,n=B.prefilters.length,s=ge.Deferred().always(function(){delete l.elem}),l=function(){if(a)return!1;for(var t=ht||H(),r=Math.max(0,c.startTime+c.duration-t),i=1-(r/c.duration||0),o=0,n=c.tweens.length;o<n;o++)c.tweens[o].run(i);return s.notifyWith(e,[c,i,r]),i<1&&n?r:(n||s.notifyWith(e,[c,1,0]),s.resolveWith(e,[c]),!1)},c=s.promise({elem:e,props:ge.extend({},t),opts:ge.extend(!0,{specialEasing:{},easing:ge.easing._default},r),originalProperties:t,originalOptions:r,startTime:ht||H(),duration:r.duration,tweens:[],createTween:function(t,r){var i=ge.Tween(e,c.opts,t,r,c.opts.specialEasing[t]||c.opts.easing);return c.tweens.push(i),i},stop:function(t){var r=0,i=t?c.tweens.length:0;if(a)return this;for(a=!0;r<i;r++)c.tweens[r].run(1);return t?(s.notifyWith(e,[c,1,0]),s.resolveWith(e,[c,t])):s.rejectWith(e,[c,t]),this}}),d=c.props;for((!function(e,t){var r,i,a,o,n;for(r in e)if(a=t[i=h(r)],o=e[r],Array.isArray(o)&&(a=o[1],o=e[r]=o[0]),r!==i&&(e[i]=o,delete e[r]),(n=ge.cssHooks[i])&&"expand"in n)for(r in o=n.expand(o),delete e[i],o)r in e||(e[r]=o[r],t[r]=a);else t[i]=a}(d,c.opts.specialEasing));o<n;o++)if(i=B.prefilters[o].call(c,e,d,c.opts))return ce(i.stop)&&(ge._queueHooks(c.elem,c.opts.queue).stop=i.stop.bind(i)),i;return ge.map(d,Y,c),ce(c.opts.start)&&c.opts.start.call(e,c),c.progress(c.opts.progress).done(c.opts.done,c.opts.complete).fail(c.opts.fail).always(c.opts.always),ge.fx.timer(ge.extend(l,{elem:e,anim:c,queue:c.opts.queue})),c}function q(e){return(e.match(Se)||[]).join(" ")}function j(e){return e.getAttribute&&e.getAttribute("class")||""}function W(e){return Array.isArray(e)?e:"string"==typeof e&&e.match(Se)||[]}function $(e,t,r,a){var o;if(Array.isArray(t))ge.each(t,function(t,i){r||Rt.test(e)?a(e,i):$(e+"["+("object"==typeof i&&null!=i?t:"")+"]",i,r,a)});else if(r||"object"!==i(t))a(e,t);else for(o in t)$(e+"["+o+"]",t[o],r,a)}function K(e){return function(t,r){"string"!=typeof t&&(r=t,t="*");var i,a=0,o=t.toLowerCase().match(Se)||[];if(ce(r))for(;i=o[a++];)"+"===i[0]?(i=i.slice(1)||"*",(e[i]=e[i]||[]).unshift(r)):(e[i]=e[i]||[]).push(r)}}function z(e,t,r,i){function a(s){var l;return o[s]=!0,ge.each(e[s]||[],function(e,s){var c=s(t,r,i);return"string"!=typeof c||n||o[c]?n?!(l=c):void 0:(t.dataTypes.unshift(c),a(c),!1)}),l}var o={},n=e===Ht;return a(t.dataTypes[0])||!o["*"]&&a("*")}function Q(e,t){var r,i,a=ge.ajaxSettings.flatOptions||{};for(r in t)void 0!==t[r]&&((a[r]?e:i||(i={}))[r]=t[r]);return i&&ge.extend(!0,e,i),e}var X=[],J=Object.getPrototypeOf,Z=X.slice,ee=X.flat?function(e){return X.flat.call(e)}:function(e){return X.concat.apply([],e)},te=X.push,re=X.indexOf,ie={},ae=ie.toString,oe=ie.hasOwnProperty,ne=oe.toString,se=ne.call(Object),le={},ce=function(e){return"function"==typeof e&&"number"!=typeof e.nodeType},de=function(e){return null!=e&&e===e.window},ue=e.document,pe={type:!0,src:!0,nonce:!0,noModule:!0},he="3.5.1",ge=function(e,t){return new ge.fn.init(e,t)};ge.fn=ge.prototype={jquery:he,constructor:ge,length:0,toArray:function(){return Z.call(this)},get:function(e){return null==e?Z.call(this):e<0?this[e+this.length]:this[e]},pushStack:function(e){var t=ge.merge(this.constructor(),e);return t.prevObject=this,t},each:function(e){return ge.each(this,e)},map:function(e){return this.pushStack(ge.map(this,function(t,r){return e.call(t,r,t)}))},slice:function(){return this.pushStack(Z.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},even:function(){return this.pushStack(ge.grep(this,function(e,t){return(t+1)%2}))},odd:function(){return this.pushStack(ge.grep(this,function(e,t){return t%2}))},eq:function(e){var t=this.length,r=+e+(e<0?t:0);return this.pushStack(0<=r&&r<t?[this[r]]:[])},end:function(){return this.prevObject||this.constructor()},push:te,sort:X.sort,splice:X.splice},ge.extend=ge.fn.extend=function(){var e,t,r,i,a,o,n=arguments[0]||{},s=1,l=arguments.length,c=!1;for("boolean"==typeof n&&(c=n,n=arguments[s]||{},s++),"object"==typeof n||ce(n)||(n={}),s===l&&(n=this,s--);s<l;s++)if(null!=(e=arguments[s]))for(t in e)i=e[t],"__proto__"!==t&&n!==i&&(c&&i&&(ge.isPlainObject(i)||(a=Array.isArray(i)))?(r=n[t],o=a&&!Array.isArray(r)?[]:a||ge.isPlainObject(r)?r:{},a=!1,n[t]=ge.extend(c,o,i)):void 0!==i&&(n[t]=i));return n},ge.extend({expando:"jQuery"+(he+Math.random()).replace(/\D/g,""),isReady:!0,error:function(e){throw new Error(e)},noop:function(){},isPlainObject:function(e){var t,r;return!(!e||"[object Object]"!==ae.call(e)||(t=J(e))&&("function"!=typeof(r=oe.call(t,"constructor")&&t.constructor)||ne.call(r)!==se))},isEmptyObject:function(e){var t;for(t in e)return!1;return!0},globalEval:function(e,t,i){r(e,{nonce:t&&t.nonce},i)},each:function(e,t){var r,i=0;if(a(e))for(r=e.length;i<r&&!1!==t.call(e[i],i,e[i]);i++);else for(i in e)if(!1===t.call(e[i],i,e[i]))break;return e},makeArray:function(e,t){var r=t||[];return null!=e&&(a(Object(e))?ge.merge(r,"string"==typeof e?[e]:e):te.call(r,e)),r},inArray:function(e,t,r){return null==t?-1:re.call(t,e,r)},merge:function(e,t){for(var r=+t.length,i=0,a=e.length;i<r;i++)e[a++]=t[i];return e.length=a,e},grep:function(e,t,r){for(var i=[],a=0,o=e.length,n=!r;a<o;a++)!t(e[a],a)!==n&&i.push(e[a]);return i},map:function(e,t,r){var i,o,n=0,s=[];if(a(e))for(i=e.length;n<i;n++)null!=(o=t(e[n],n,r))&&s.push(o);else for(n in e)null!=(o=t(e[n],n,r))&&s.push(o);return ee(s)},guid:1,support:le}),"function"==typeof Symbol&&(ge.fn[Symbol.iterator]=X[Symbol.iterator]),ge.each("Boolean Number String Function Array Date RegExp Object Error Symbol".split(" "),function(e,t){ie["[object "+t+"]"]=t.toLowerCase()});var fe=function(e){function t(e,t,r,i){var a,o,n,s,l,c,d,p=t&&t.ownerDocument,g=t?t.nodeType:9;if(r=r||[],"string"!=typeof e||!e||1!==g&&9!==g&&11!==g)return r;if(!i&&(N(t),t=t||D,w)){if(11!==g&&(l=Ie.exec(e)))if(a=l[1]){if(9===g){if(!(n=t.getElementById(a)))return r;if(n.id===a)return r.push(n),r}else if(p&&(n=p.getElementById(a))&&x(t,n)&&n.id===a)return r.push(n),r}else{if(l[2])return X.apply(r,t.getElementsByTagName(e)),r;if((a=l[3])&&v.getElementsByClassName&&t.getElementsByClassName)return X.apply(r,t.getElementsByClassName(a)),r}if(v.qsa&&!j[e+" "]&&(!M||!M.test(e))&&(1!==g||"object"!==t.nodeName.toLowerCase())){if(d=e,p=t,1===g&&(ce.test(e)||le.test(e))){for((p=Ee.test(e)&&u(t.parentNode)||t)===t&&v.scope||((s=t.getAttribute("id"))?s=s.replace(be,Te):t.setAttribute("id",s=G)),o=(c=S(e)).length;o--;)c[o]=(s?"#"+s:":scope")+" "+h(c[o]);d=c.join(",")}try{return X.apply(r,p.querySelectorAll(d)),r}catch(t){j(e,!0)}finally{s===G&&t.removeAttribute("id")}}}return _(e.replace(ne,"$1"),t,r,i)}function r(){var e=[];return function t(r,i){return e.push(r+" ")>b.cacheLength&&delete t[e.shift()],t[r+" "]=i}}function i(e){return e[G]=!0,e}function a(e){var t=D.createElement("fieldset");try{return!!e(t)}catch(e){return!1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function o(e,t){for(var r=e.split("|"),i=r.length;i--;)b.attrHandle[r[i]]=t}function n(e,t){var r=t&&e,i=r&&1===e.nodeType&&1===t.nodeType&&e.sourceIndex-t.sourceIndex;if(i)return i;if(r)for(;r=r.nextSibling;)if(r===t)return-1;return e?1:-1}function s(e){return function(t){return"input"===t.nodeName.toLowerCase()&&t.type===e}}function l(e){return function(t){var r=t.nodeName.toLowerCase();return("input"===r||"button"===r)&&t.type===e}}function c(e){return function(t){return"form"in t?t.parentNode&&!1===t.disabled?"label"in t?"label"in t.parentNode?t.parentNode.disabled===e:t.disabled===e:t.isDisabled===e||t.isDisabled!==!e&&Se(t)===e:t.disabled===e:"label"in t&&t.disabled===e}}function d(e){return i(function(t){return t=+t,i(function(r,i){for(var a,o=e([],r.length,t),n=o.length;n--;)r[a=o[n]]&&(r[a]=!(i[a]=r[a]))})})}function u(e){return e&&"undefined"!=typeof e.getElementsByTagName&&e}function p(){}function h(e){for(var t=0,r=e.length,i="";t<r;t++)i+=e[t].value;return i}function g(e,t,r){var i=t.dir,a=t.next,o=a||i,n=r&&"parentNode"===o,s=V++;return t.first?function(t,r,a){for(;t=t[i];)if(1===t.nodeType||n)return e(t,r,a);return!1}:function(t,r,l){var c,d,u,p=[H,s];if(l){for(;t=t[i];)if((1===t.nodeType||n)&&e(t,r,l))return!0}else for(;t=t[i];)if(1===t.nodeType||n)if(d=(u=t[G]||(t[G]={}))[t.uniqueID]||(u[t.uniqueID]={}),a&&a===t.nodeName.toLowerCase())t=t[i]||t;else{if((c=d[o])&&c[0]===H&&c[1]===s)return p[2]=c[2];if((d[o]=p)[2]=e(t,r,l))return!0}return!1}}function f(e){return 1<e.length?function(t,r,i){for(var a=e.length;a--;)if(!e[a](t,r,i))return!1;return!0}:e[0]}function m(e,t,r,i,a){for(var o,n=[],s=0,l=e.length,c=null!=t;s<l;s++)(o=e[s])&&(r&&!r(o,i,a)||(n.push(o),c&&t.push(s)));return n}function I(e,r,a,o,n,s){return o&&!o[G]&&(o=I(o)),n&&!n[G]&&(n=I(n,s)),i(function(i,s,l,c){var d,u,p,h=[],g=[],f=s.length,I=i||function(e,r,i){for(var a=0,o=r.length;a<o;a++)t(e,r[a],i);return i}(r||"*",l.nodeType?[l]:l,[]),E=!e||!i&&r?I:m(I,h,e,l,c),y=a?n||(i?e:f||o)?[]:s:E;if(a&&a(E,y,l,c),o)for(d=m(y,g),o(d,[],l,c),u=d.length;u--;)(p=d[u])&&(y[g[u]]=!(E[g[u]]=p));if(i){if(n||e){if(n){for(d=[],u=y.length;u--;)(p=y[u])&&d.push(E[u]=p);n(null,y=[],d,c)}for(u=y.length;u--;)(p=y[u])&&-1<(d=n?Z(i,p):h[u])&&(i[d]=!(s[d]=p))}}else y=m(y===s?y.splice(f,y.length):y),n?n(null,s,y,c):X.apply(s,y)})}function E(e){for(var t,r,i,a=e.length,o=b.relative[e[0].type],n=o||b.relative[" "],s=o?1:0,l=g(function(e){return e===t},n,!0),c=g(function(e){return-1<Z(t,e)},n,!0),d=[function(e,r,i){var a=!o&&(i||r!==A)||((t=r).nodeType?l(e,r,i):c(e,r,i));return t=null,a}];s<a;s++)if(r=b.relative[e[s].type])d=[g(f(d),r)];else{if((r=b.filter[e[s].type].apply(null,e[s].matches))[G]){for(i=++s;i<a&&!b.relative[e[i].type];i++);return I(1<s&&f(d),1<s&&h(e.slice(0,s-1).concat({value:" "===e[s-2].type?"*":""})).replace(ne,"$1"),r,s<i&&E(e.slice(s,i)),i<a&&E(e=e.slice(i)),i<a&&h(e))}d.push(r)}return f(d)}var y,v,b,T,P,S,C,_,A,O,R,N,D,L,w,M,U,k,x,G="sizzle"+1*new Date,F=e.document,H=0,V=0,Y=r(),B=r(),q=r(),j=r(),W=function(e,t){return e===t&&(R=!0),0},$={}.hasOwnProperty,K=[],z=K.pop,Q=K.push,X=K.push,J=K.slice,Z=function(e,t){for(var r=0,i=e.length;r<i;r++)if(e[r]===t)return r;return-1},ee="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",te="[\\x20\\t\\r\\n\\f]",re="(?:\\\\[\\da-fA-F]{1,6}"+te+"?|\\\\[^\\r\\n\\f]|[\\w-]|[^\0-\\x7f])+",ie="\\["+te+"*("+re+")(?:"+te+"*([*^$|!~]?=)"+te+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+re+"))|)"+te+"*\\]",ae=":("+re+")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|"+ie+")*)|.*)\\)|)",oe=new RegExp(te+"+","g"),ne=new RegExp("^"+te+"+|((?:^|[^\\\\])(?:\\\\.)*)"+te+"+$","g"),se=new RegExp("^"+te+"*,"+te+"*"),le=new RegExp("^"+te+"*([>+~]|"+te+")"+te+"*"),ce=new RegExp(te+"|>"),de=new RegExp(ae),ue=new RegExp("^"+re+"$"),pe={ID:new RegExp("^#("+re+")"),CLASS:new RegExp("^\\.("+re+")"),TAG:new RegExp("^("+re+"|[*])"),ATTR:new RegExp("^"+ie),PSEUDO:new RegExp("^"+ae),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+te+"*(even|odd|(([+-]|)(\\d*)n|)"+te+"*(?:([+-]|)"+te+"*(\\d+)|))"+te+"*\\)|)","i"),bool:new RegExp("^(?:"+ee+")$","i"),needsContext:new RegExp("^"+te+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+te+"*((?:-\\d)?\\d*)"+te+"*\\)|)(?=[^-]|$)","i")},he=/HTML$/i,ge=/^(?:input|select|textarea|button)$/i,fe=/^h\d$/i,me=/^[^{]+\{\s*\[native \w/,Ie=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,Ee=/[+~]/,ye=new RegExp("\\\\[\\da-fA-F]{1,6}"+te+"?|\\\\([^\\r\\n\\f])","g"),ve=function(e,t){var r="0x"+e.slice(1)-65536;return t||(r<0?String.fromCharCode(r+65536):String.fromCharCode(r>>10|55296,1023&r|56320))},be=/([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,Te=function(e,t){return t?"\0"===e?"�":e.slice(0,-1)+"\\"+e.charCodeAt(e.length-1).toString(16)+" ":"\\"+e},Pe=function(){N()},Se=g(function(e){return!0===e.disabled&&"fieldset"===e.nodeName.toLowerCase()},{dir:"parentNode",next:"legend"});try{X.apply(K=J.call(F.childNodes),F.childNodes),K[F.childNodes.length].nodeType}catch(e){X={apply:K.length?function(e,t){Q.apply(e,J.call(t))}:function(e,t){for(var r=e.length,i=0;e[r++]=t[i++];);e.length=r-1}}}for(y in v=t.support={},P=t.isXML=function(e){var t=e.namespaceURI,r=(e.ownerDocument||e).documentElement;return!he.test(t||r&&r.nodeName||"HTML")},N=t.setDocument=function(e){var t,r,i=e?e.ownerDocument||e:F;return i!=D&&9===i.nodeType&&i.documentElement&&(L=(D=i).documentElement,w=!P(D),F!=D&&(r=D.defaultView)&&r.top!==r&&(r.addEventListener?r.addEventListener("unload",Pe,!1):r.attachEvent&&r.attachEvent("onunload",Pe)),v.scope=a(function(e){return L.appendChild(e).appendChild(D.createElement("div")),"undefined"!=typeof e.querySelectorAll&&!e.querySelectorAll(":scope fieldset div").length}),v.attributes=a(function(e){return e.className="i",!e.getAttribute("className")}),v.getElementsByTagName=a(function(e){return e.appendChild(D.createComment("")),!e.getElementsByTagName("*").length}),v.getElementsByClassName=me.test(D.getElementsByClassName),v.getById=a(function(e){return L.appendChild(e).id=G,!D.getElementsByName||!D.getElementsByName(G).length}),v.getById?(b.filter.ID=function(e){var t=e.replace(ye,ve);return function(e){return e.getAttribute("id")===t}},b.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&w){var r=t.getElementById(e);return r?[r]:[]}}):(b.filter.ID=function(e){var t=e.replace(ye,ve);return function(e){var r="undefined"!=typeof e.getAttributeNode&&e.getAttributeNode("id");return r&&r.value===t}},b.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&w){var r,i,a,o=t.getElementById(e);if(o){if((r=o.getAttributeNode("id"))&&r.value===e)return[o];for(a=t.getElementsByName(e),i=0;o=a[i++];)if((r=o.getAttributeNode("id"))&&r.value===e)return[o]}return[]}}),b.find.TAG=v.getElementsByTagName?function(e,t){return"undefined"!=typeof t.getElementsByTagName?t.getElementsByTagName(e):v.qsa?t.querySelectorAll(e):void 0}:function(e,t){var r,i=[],a=0,o=t.getElementsByTagName(e);if("*"===e){for(;r=o[a++];)1===r.nodeType&&i.push(r);return i}return o},b.find.CLASS=v.getElementsByClassName&&function(e,t){if("undefined"!=typeof t.getElementsByClassName&&w)return t.getElementsByClassName(e)},U=[],M=[],(v.qsa=me.test(D.querySelectorAll))&&(a(function(e){var t;L.appendChild(e).innerHTML="<a id='"+G+"'></a><select id='"+G+"-\r\\' msallowcapture=''><option selected=''></option></select>",e.querySelectorAll("[msallowcapture^='']").length&&M.push("[*^$]="+te+"*(?:''|\"\")"),e.querySelectorAll("[selected]").length||M.push("\\["+te+"*(?:value|"+ee+")"),e.querySelectorAll("[id~="+G+"-]").length||M.push("~="),(t=D.createElement("input")).setAttribute("name",""),e.appendChild(t),e.querySelectorAll("[name='']").length||M.push("\\["+te+"*name"+te+"*="+te+"*(?:''|\"\")"),e.querySelectorAll(":checked").length||M.push(":checked"),e.querySelectorAll("a#"+G+"+*").length||M.push(".#.+[+~]"),e.querySelectorAll("\\\f"),M.push("[\\r\\n\\f]")}),a(function(e){e.innerHTML="<a href='' disabled='disabled'></a><select disabled='disabled'><option/></select>";var t=D.createElement("input");t.setAttribute("type","hidden"),e.appendChild(t).setAttribute("name","D"),e.querySelectorAll("[name=d]").length&&M.push("name"+te+"*[*^$|!~]?="),2!==e.querySelectorAll(":enabled").length&&M.push(":enabled",":disabled"),L.appendChild(e).disabled=!0,2!==e.querySelectorAll(":disabled").length&&M.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),M.push(",.*:")})),(v.matchesSelector=me.test(k=L.matches||L.webkitMatchesSelector||L.mozMatchesSelector||L.oMatchesSelector||L.msMatchesSelector))&&a(function(e){v.disconnectedMatch=k.call(e,"*"),k.call(e,"[s!='']:x"),U.push("!=",ae)}),M=M.length&&new RegExp(M.join("|")),U=U.length&&new RegExp(U.join("|")),t=me.test(L.compareDocumentPosition),x=t||me.test(L.contains)?function(e,t){var r=9===e.nodeType?e.documentElement:e,i=t&&t.parentNode;return e===i||!(!i||1!==i.nodeType||!(r.contains?r.contains(i):e.compareDocumentPosition&&16&e.compareDocumentPosition(i)))}:function(e,t){if(t)for(;t=t.parentNode;)if(t===e)return!0;return!1},W=t?function(e,t){if(e===t)return R=!0,0;var r=!e.compareDocumentPosition-!t.compareDocumentPosition;return r||(1&(r=(e.ownerDocument||e)==(t.ownerDocument||t)?e.compareDocumentPosition(t):1)||!v.sortDetached&&t.compareDocumentPosition(e)===r?e==D||e.ownerDocument==F&&x(F,e)?-1:t==D||t.ownerDocument==F&&x(F,t)?1:O?Z(O,e)-Z(O,t):0:4&r?-1:1)}:function(e,t){if(e===t)return R=!0,0;var r,i=0,a=e.parentNode,o=t.parentNode,s=[e],l=[t];if(!a||!o)return e==D?-1:t==D?1:a?-1:o?1:O?Z(O,e)-Z(O,t):0;if(a===o)return n(e,t);for(r=e;r=r.parentNode;)s.unshift(r);for(r=t;r=r.parentNode;)l.unshift(r);for(;s[i]===l[i];)i++;return i?n(s[i],l[i]):s[i]==F?-1:l[i]==F?1:0}),D},t.matches=function(e,r){return t(e,null,null,r)},t.matchesSelector=function(e,r){if(N(e),v.matchesSelector&&w&&!j[r+" "]&&(!U||!U.test(r))&&(!M||!M.test(r)))try{var i=k.call(e,r);if(i||v.disconnectedMatch||e.document&&11!==e.document.nodeType)return i}catch(e){j(r,!0)}return 0<t(r,D,null,[e]).length},t.contains=function(e,t){return(e.ownerDocument||e)!=D&&N(e),x(e,t)},t.attr=function(e,t){(e.ownerDocument||e)!=D&&N(e);var r=b.attrHandle[t.toLowerCase()],i=r&&$.call(b.attrHandle,t.toLowerCase())?r(e,t,!w):void 0;return void 0!==i?i:v.attributes||!w?e.getAttribute(t):(i=e.getAttributeNode(t))&&i.specified?i.value:null},t.escape=function(e){return(e+"").replace(be,Te)},t.error=function(e){throw new Error("Syntax error, unrecognized expression: "+e)},t.uniqueSort=function(e){var t,r=[],i=0,a=0;if(R=!v.detectDuplicates,O=!v.sortStable&&e.slice(0),e.sort(W),R){for(;t=e[a++];)t===e[a]&&(i=r.push(a));for(;i--;)e.splice(r[i],1)}return O=null,e},T=t.getText=function(e){var t,r="",i=0,a=e.nodeType;if(a){if(1===a||9===a||11===a){if("string"==typeof e.textContent)return e.textContent;for(e=e.firstChild;e;e=e.nextSibling)r+=T(e)}else if(3===a||4===a)return e.nodeValue}else for(;t=e[i++];)r+=T(t);return r},(b=t.selectors={cacheLength:50,createPseudo:i,match:pe,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(ye,ve),e[3]=(e[3]||e[4]||e[5]||"").replace(ye,ve),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||t.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&t.error(e[0]),e},PSEUDO:function(e){var t,r=!e[6]&&e[2];return pe.CHILD.test(e[0])?null:(e[3]?e[2]=e[4]||e[5]||"":r&&de.test(r)&&(t=S(r,!0))&&(t=r.indexOf(")",r.length-t)-r.length)&&(e[0]=e[0].slice(0,t),e[2]=r.slice(0,t)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(ye,ve).toLowerCase();return"*"===e?function(){return!0}:function(e){return e.nodeName&&e.nodeName.toLowerCase()===t}},CLASS:function(e){var t=Y[e+" "];return t||(t=new RegExp("(^|"+te+")"+e+"("+te+"|$)"))&&Y(e,function(e){return t.test("string"==typeof e.className&&e.className||"undefined"!=typeof e.getAttribute&&e.getAttribute("class")||"")})},ATTR:function(e,r,i){return function(a){var o=t.attr(a,e);return null==o?"!="===r:!r||(o+="","="===r?o===i:"!="===r?o!==i:"^="===r?i&&0===o.indexOf(i):"*="===r?i&&-1<o.indexOf(i):"$="===r?i&&o.slice(-i.length)===i:"~="===r?-1<(" "+o.replace(oe," ")+" ").indexOf(i):"|="===r&&(o===i||o.slice(0,i.length+1)===i+"-"))}},CHILD:function(e,t,r,i,a){var o="nth"!==e.slice(0,3),n="last"!==e.slice(-4),s="of-type"===t;return 1===i&&0===a?function(e){return!!e.parentNode}:function(t,r,l){var c,d,u,p,h,g,f=o!==n?"nextSibling":"previousSibling",m=t.parentNode,I=s&&t.nodeName.toLowerCase(),E=!l&&!s,y=!1;if(m){if(o){for(;f;){for(p=t;p=p[f];)if(s?p.nodeName.toLowerCase()===I:1===p.nodeType)return!1;g=f="only"===e&&!g&&"nextSibling"}return!0}if(g=[n?m.firstChild:m.lastChild],n&&E){for(y=(h=(c=(d=(u=(p=m)[G]||(p[G]={}))[p.uniqueID]||(u[p.uniqueID]={}))[e]||[])[0]===H&&c[1])&&c[2],p=h&&m.childNodes[h];p=++h&&p&&p[f]||(y=h=0)||g.pop();)if(1===p.nodeType&&++y&&p===t){d[e]=[H,h,y];break}}else if(E&&(y=h=(c=(d=(u=(p=t)[G]||(p[G]={}))[p.uniqueID]||(u[p.uniqueID]={}))[e]||[])[0]===H&&c[1]),!1===y)for(;(p=++h&&p&&p[f]||(y=h=0)||g.pop())&&((s?p.nodeName.toLowerCase()!==I:1!==p.nodeType)||!++y||(E&&((d=(u=p[G]||(p[G]={}))[p.uniqueID]||(u[p.uniqueID]={}))[e]=[H,y]),p!==t)););return(y-=a)===i||y%i==0&&0<=y/i}}},PSEUDO:function(e,r){var a,o=b.pseudos[e]||b.setFilters[e.toLowerCase()]||t.error("unsupported pseudo: "+e);return o[G]?o(r):1<o.length?(a=[e,e,"",r],b.setFilters.hasOwnProperty(e.toLowerCase())?i(function(e,t){for(var i,a=o(e,r),n=a.length;n--;)e[i=Z(e,a[n])]=!(t[i]=a[n])}):function(e){return o(e,0,a)}):o}},pseudos:{not:i(function(e){var t=[],r=[],a=C(e.replace(ne,"$1"));return a[G]?i(function(e,t,r,i){for(var o,n=a(e,null,i,[]),s=e.length;s--;)(o=n[s])&&(e[s]=!(t[s]=o))}):function(e,i,o){return t[0]=e,a(t,null,o,r),t[0]=null,!r.pop()}}),has:i(function(e){return function(r){return 0<t(e,r).length}}),contains:i(function(e){return e=e.replace(ye,ve),function(t){return-1<(t.textContent||T(t)).indexOf(e)}}),lang:i(function(e){return ue.test(e||"")||t.error("unsupported lang: "+e),e=e.replace(ye,ve).toLowerCase(),function(t){var r;do if(r=w?t.lang:t.getAttribute("xml:lang")||t.getAttribute("lang"))return(r=r.toLowerCase())===e||0===r.indexOf(e+"-");while((t=t.parentNode)&&1===t.nodeType);return!1}}),target:function(t){var r=e.location&&e.location.hash;return r&&r.slice(1)===t.id},root:function(e){return e===L},focus:function(e){return e===D.activeElement&&(!D.hasFocus||D.hasFocus())&&!!(e.type||e.href||~e.tabIndex)},enabled:c(!1),disabled:c(!0),checked:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&!!e.checked||"option"===t&&!!e.selected},selected:function(e){return e.parentNode&&e.parentNode.selectedIndex,!0===e.selected},empty:function(e){for(e=e.firstChild;e;e=e.nextSibling)if(e.nodeType<6)return!1;return!0},parent:function(e){return!b.pseudos.empty(e)},header:function(e){return fe.test(e.nodeName)},input:function(e){return ge.test(e.nodeName)},button:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&"button"===e.type||"button"===t},text:function(e){var t;return"input"===e.nodeName.toLowerCase()&&"text"===e.type&&(null==(t=e.getAttribute("type"))||"text"===t.toLowerCase())},first:d(function(){return[0]}),last:d(function(e,t){return[t-1]}),eq:d(function(e,t,r){return[r<0?r+t:r]}),even:d(function(e,t){for(var r=0;r<t;r+=2)e.push(r);return e}),odd:d(function(e,t){for(var r=1;r<t;r+=2)e.push(r);return e}),lt:d(function(e,t,r){for(var i=r<0?r+t:t<r?t:r;0<=--i;)e.push(i);return e}),gt:d(function(e,t,r){for(var i=r<0?r+t:r;++i<t;)e.push(i);return e})}}).pseudos.nth=b.pseudos.eq,{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})b.pseudos[y]=s(y);for(y in{submit:!0,reset:!0})b.pseudos[y]=l(y);return p.prototype=b.filters=b.pseudos,b.setFilters=new p,S=t.tokenize=function(e,r){var i,a,o,n,s,l,c,d=B[e+" "];if(d)return r?0:d.slice(0);for(s=e,l=[],c=b.preFilter;s;){for(n in i&&!(a=se.exec(s))||(a&&(s=s.slice(a[0].length)||s),l.push(o=[])),i=!1,(a=le.exec(s))&&(i=a.shift(),o.push({value:i,type:a[0].replace(ne," ")}),s=s.slice(i.length)),b.filter)!(a=pe[n].exec(s))||c[n]&&!(a=c[n](a))||(i=a.shift(),o.push({value:i,type:n,matches:a}),s=s.slice(i.length));if(!i)break}return r?s.length:s?t.error(e):B(e,l).slice(0)},C=t.compile=function(e,r){var a,o,n,s,l,c,d=[],u=[],p=q[e+" "];
- if(!p){for(r||(r=S(e)),a=r.length;a--;)(p=E(r[a]))[G]?d.push(p):u.push(p);(p=q(e,(o=u,s=0<(n=d).length,l=0<o.length,c=function(e,r,i,a,c){var d,u,p,h=0,g="0",f=e&&[],I=[],E=A,y=e||l&&b.find.TAG("*",c),v=H+=null==E?1:Math.random()||.1,T=y.length;for(c&&(A=r==D||r||c);g!==T&&null!=(d=y[g]);g++){if(l&&d){for(u=0,r||d.ownerDocument==D||(N(d),i=!w);p=o[u++];)if(p(d,r||D,i)){a.push(d);break}c&&(H=v)}s&&((d=!p&&d)&&h--,e&&f.push(d))}if(h+=g,s&&g!==h){for(u=0;p=n[u++];)p(f,I,r,i);if(e){if(0<h)for(;g--;)f[g]||I[g]||(I[g]=z.call(a));I=m(I)}X.apply(a,I),c&&!e&&0<I.length&&1<h+n.length&&t.uniqueSort(a)}return c&&(H=v,A=E),f},s?i(c):c))).selector=e}return p},_=t.select=function(e,t,r,i){var a,o,n,s,l,c="function"==typeof e&&e,d=!i&&S(e=c.selector||e);if(r=r||[],1===d.length){if(2<(o=d[0]=d[0].slice(0)).length&&"ID"===(n=o[0]).type&&9===t.nodeType&&w&&b.relative[o[1].type]){if(!(t=(b.find.ID(n.matches[0].replace(ye,ve),t)||[])[0]))return r;c&&(t=t.parentNode),e=e.slice(o.shift().value.length)}for(a=pe.needsContext.test(e)?0:o.length;a--&&(n=o[a],!b.relative[s=n.type]);)if((l=b.find[s])&&(i=l(n.matches[0].replace(ye,ve),Ee.test(o[0].type)&&u(t.parentNode)||t))){if(o.splice(a,1),!(e=i.length&&h(o)))return X.apply(r,i),r;break}}return(c||C(e,d))(i,t,!w,r,!t||Ee.test(e)&&u(t.parentNode)||t),r},v.sortStable=G.split("").sort(W).join("")===G,v.detectDuplicates=!!R,N(),v.sortDetached=a(function(e){return 1&e.compareDocumentPosition(D.createElement("fieldset"))}),a(function(e){return e.innerHTML="<a href='#'></a>","#"===e.firstChild.getAttribute("href")})||o("type|href|height|width",function(e,t,r){if(!r)return e.getAttribute(t,"type"===t.toLowerCase()?1:2)}),v.attributes&&a(function(e){return e.innerHTML="<input/>",e.firstChild.setAttribute("value",""),""===e.firstChild.getAttribute("value")})||o("value",function(e,t,r){if(!r&&"input"===e.nodeName.toLowerCase())return e.defaultValue}),a(function(e){return null==e.getAttribute("disabled")})||o(ee,function(e,t,r){var i;if(!r)return!0===e[t]?t.toLowerCase():(i=e.getAttributeNode(t))&&i.specified?i.value:null}),t}(e);ge.find=fe,ge.expr=fe.selectors,ge.expr[":"]=ge.expr.pseudos,ge.uniqueSort=ge.unique=fe.uniqueSort,ge.text=fe.getText,ge.isXMLDoc=fe.isXML,ge.contains=fe.contains,ge.escapeSelector=fe.escape;var me=function(e,t,r){for(var i=[],a=void 0!==r;(e=e[t])&&9!==e.nodeType;)if(1===e.nodeType){if(a&&ge(e).is(r))break;i.push(e)}return i},Ie=function(e,t){for(var r=[];e;e=e.nextSibling)1===e.nodeType&&e!==t&&r.push(e);return r},Ee=ge.expr.match.needsContext,ye=/^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i;ge.filter=function(e,t,r){var i=t[0];return r&&(e=":not("+e+")"),1===t.length&&1===i.nodeType?ge.find.matchesSelector(i,e)?[i]:[]:ge.find.matches(e,ge.grep(t,function(e){return 1===e.nodeType}))},ge.fn.extend({find:function(e){var t,r,i=this.length,a=this;if("string"!=typeof e)return this.pushStack(ge(e).filter(function(){for(t=0;t<i;t++)if(ge.contains(a[t],this))return!0}));for(r=this.pushStack([]),t=0;t<i;t++)ge.find(e,a[t],r);return 1<i?ge.uniqueSort(r):r},filter:function(e){return this.pushStack(n(this,e||[],!1))},not:function(e){return this.pushStack(n(this,e||[],!0))},is:function(e){return!!n(this,"string"==typeof e&&Ee.test(e)?ge(e):e||[],!1).length}});var ve,be=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/;(ge.fn.init=function(e,t,r){var i,a;if(!e)return this;if(r=r||ve,"string"==typeof e){if(!(i="<"===e[0]&&">"===e[e.length-1]&&3<=e.length?[null,e,null]:be.exec(e))||!i[1]&&t)return!t||t.jquery?(t||r).find(e):this.constructor(t).find(e);if(i[1]){if(t=t instanceof ge?t[0]:t,ge.merge(this,ge.parseHTML(i[1],t&&t.nodeType?t.ownerDocument||t:ue,!0)),ye.test(i[1])&&ge.isPlainObject(t))for(i in t)ce(this[i])?this[i](t[i]):this.attr(i,t[i]);return this}return(a=ue.getElementById(i[2]))&&(this[0]=a,this.length=1),this}return e.nodeType?(this[0]=e,this.length=1,this):ce(e)?void 0!==r.ready?r.ready(e):e(ge):ge.makeArray(e,this)}).prototype=ge.fn,ve=ge(ue);var Te=/^(?:parents|prev(?:Until|All))/,Pe={children:!0,contents:!0,next:!0,prev:!0};ge.fn.extend({has:function(e){var t=ge(e,this),r=t.length;return this.filter(function(){for(var e=0;e<r;e++)if(ge.contains(this,t[e]))return!0})},closest:function(e,t){var r,i=0,a=this.length,o=[],n="string"!=typeof e&&ge(e);if(!Ee.test(e))for(;i<a;i++)for(r=this[i];r&&r!==t;r=r.parentNode)if(r.nodeType<11&&(n?-1<n.index(r):1===r.nodeType&&ge.find.matchesSelector(r,e))){o.push(r);break}return this.pushStack(1<o.length?ge.uniqueSort(o):o)},index:function(e){return e?"string"==typeof e?re.call(ge(e),this[0]):re.call(this,e.jquery?e[0]:e):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(e,t){return this.pushStack(ge.uniqueSort(ge.merge(this.get(),ge(e,t))))},addBack:function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}}),ge.each({parent:function(e){var t=e.parentNode;return t&&11!==t.nodeType?t:null},parents:function(e){return me(e,"parentNode")},parentsUntil:function(e,t,r){return me(e,"parentNode",r)},next:function(e){return s(e,"nextSibling")},prev:function(e){return s(e,"previousSibling")},nextAll:function(e){return me(e,"nextSibling")},prevAll:function(e){return me(e,"previousSibling")},nextUntil:function(e,t,r){return me(e,"nextSibling",r)},prevUntil:function(e,t,r){return me(e,"previousSibling",r)},siblings:function(e){return Ie((e.parentNode||{}).firstChild,e)},children:function(e){return Ie(e.firstChild)},contents:function(e){return null!=e.contentDocument&&J(e.contentDocument)?e.contentDocument:(o(e,"template")&&(e=e.content||e),ge.merge([],e.childNodes))}},function(e,t){ge.fn[e]=function(r,i){var a=ge.map(this,t,r);return"Until"!==e.slice(-5)&&(i=r),i&&"string"==typeof i&&(a=ge.filter(i,a)),1<this.length&&(Pe[e]||ge.uniqueSort(a),Te.test(e)&&a.reverse()),this.pushStack(a)}});var Se=/[^\x20\t\r\n\f]+/g;ge.Callbacks=function(e){var t,r;e="string"==typeof e?(t=e,r={},ge.each(t.match(Se)||[],function(e,t){r[t]=!0}),r):ge.extend({},e);var a,o,n,s,l=[],c=[],d=-1,u=function(){for(s=s||e.once,n=a=!0;c.length;d=-1)for(o=c.shift();++d<l.length;)!1===l[d].apply(o[0],o[1])&&e.stopOnFalse&&(d=l.length,o=!1);e.memory||(o=!1),a=!1,s&&(l=o?[]:"")},p={add:function(){return l&&(o&&!a&&(d=l.length-1,c.push(o)),function t(r){ge.each(r,function(r,a){ce(a)?e.unique&&p.has(a)||l.push(a):a&&a.length&&"string"!==i(a)&&t(a)})}(arguments),o&&!a&&u()),this},remove:function(){return ge.each(arguments,function(e,t){for(var r;-1<(r=ge.inArray(t,l,r));)l.splice(r,1),r<=d&&d--}),this},has:function(e){return e?-1<ge.inArray(e,l):0<l.length},empty:function(){return l&&(l=[]),this},disable:function(){return s=c=[],l=o="",this},disabled:function(){return!l},lock:function(){return s=c=[],o||a||(l=o=""),this},locked:function(){return!!s},fireWith:function(e,t){return s||(t=[e,(t=t||[]).slice?t.slice():t],c.push(t),a||u()),this},fire:function(){return p.fireWith(this,arguments),this},fired:function(){return!!n}};return p},ge.extend({Deferred:function(t){var r=[["notify","progress",ge.Callbacks("memory"),ge.Callbacks("memory"),2],["resolve","done",ge.Callbacks("once memory"),ge.Callbacks("once memory"),0,"resolved"],["reject","fail",ge.Callbacks("once memory"),ge.Callbacks("once memory"),1,"rejected"]],i="pending",a={state:function(){return i},always:function(){return o.done(arguments).fail(arguments),this},catch:function(e){return a.then(null,e)},pipe:function(){var e=arguments;return ge.Deferred(function(t){ge.each(r,function(r,i){var a=ce(e[i[4]])&&e[i[4]];o[i[1]](function(){var e=a&&a.apply(this,arguments);e&&ce(e.promise)?e.promise().progress(t.notify).done(t.resolve).fail(t.reject):t[i[0]+"With"](this,a?[e]:arguments)})}),e=null}).promise()},then:function(t,i,a){function o(t,r,i,a){return function(){var s=this,d=arguments,u=function(){var e,u;if(!(t<n)){if((e=i.apply(s,d))===r.promise())throw new TypeError("Thenable self-resolution");u=e&&("object"==typeof e||"function"==typeof e)&&e.then,ce(u)?a?u.call(e,o(n,r,l,a),o(n,r,c,a)):(n++,u.call(e,o(n,r,l,a),o(n,r,c,a),o(n,r,l,r.notifyWith))):(i!==l&&(s=void 0,d=[e]),(a||r.resolveWith)(s,d))}},p=a?u:function(){try{u()}catch(e){ge.Deferred.exceptionHook&&ge.Deferred.exceptionHook(e,p.stackTrace),n<=t+1&&(i!==c&&(s=void 0,d=[e]),r.rejectWith(s,d))}};t?p():(ge.Deferred.getStackHook&&(p.stackTrace=ge.Deferred.getStackHook()),e.setTimeout(p))}}var n=0;return ge.Deferred(function(e){r[0][3].add(o(0,e,ce(a)?a:l,e.notifyWith)),r[1][3].add(o(0,e,ce(t)?t:l)),r[2][3].add(o(0,e,ce(i)?i:c))}).promise()},promise:function(e){return null!=e?ge.extend(e,a):a}},o={};return ge.each(r,function(e,t){var n=t[2],s=t[5];a[t[1]]=n.add,s&&n.add(function(){i=s},r[3-e][2].disable,r[3-e][3].disable,r[0][2].lock,r[0][3].lock),n.add(t[3].fire),o[t[0]]=function(){return o[t[0]+"With"](this===o?void 0:this,arguments),this},o[t[0]+"With"]=n.fireWith}),a.promise(o),t&&t.call(o,o),o},when:function(e){var t=arguments.length,r=t,i=Array(r),a=Z.call(arguments),o=ge.Deferred(),n=function(e){return function(r){i[e]=this,a[e]=1<arguments.length?Z.call(arguments):r,--t||o.resolveWith(i,a)}};if(t<=1&&(d(e,o.done(n(r)).resolve,o.reject,!t),"pending"===o.state()||ce(a[r]&&a[r].then)))return o.then();for(;r--;)d(a[r],n(r),o.reject);return o.promise()}});var Ce=/^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;ge.Deferred.exceptionHook=function(t,r){e.console&&e.console.warn&&t&&Ce.test(t.name)&&e.console.warn("jQuery.Deferred exception: "+t.message,t.stack,r)},ge.readyException=function(t){e.setTimeout(function(){throw t})};var _e=ge.Deferred();ge.fn.ready=function(e){return _e.then(e).catch(function(e){ge.readyException(e)}),this},ge.extend({isReady:!1,readyWait:1,ready:function(e){(!0===e?--ge.readyWait:ge.isReady)||(ge.isReady=!0)!==e&&0<--ge.readyWait||_e.resolveWith(ue,[ge])}}),ge.ready.then=_e.then,"complete"===ue.readyState||"loading"!==ue.readyState&&!ue.documentElement.doScroll?e.setTimeout(ge.ready):(ue.addEventListener("DOMContentLoaded",u),e.addEventListener("load",u));var Ae=function(e,t,r,a,o,n,s){var l=0,c=e.length,d=null==r;if("object"===i(r))for(l in o=!0,r)Ae(e,t,l,r[l],!0,n,s);else if(void 0!==a&&(o=!0,ce(a)||(s=!0),d&&(s?(t.call(e,a),t=null):(d=t,t=function(e,t,r){return d.call(ge(e),r)})),t))for(;l<c;l++)t(e[l],r,s?a:a.call(e[l],l,t(e[l],r)));return o?e:d?t.call(e):c?t(e[0],r):n},Oe=/^-ms-/,Re=/-([a-z])/g,Ne=function(e){return 1===e.nodeType||9===e.nodeType||!+e.nodeType};g.uid=1,g.prototype={cache:function(e){var t=e[this.expando];return t||(t={},Ne(e)&&(e.nodeType?e[this.expando]=t:Object.defineProperty(e,this.expando,{value:t,configurable:!0}))),t},set:function(e,t,r){var i,a=this.cache(e);if("string"==typeof t)a[h(t)]=r;else for(i in t)a[h(i)]=t[i];return a},get:function(e,t){return void 0===t?this.cache(e):e[this.expando]&&e[this.expando][h(t)]},access:function(e,t,r){return void 0===t||t&&"string"==typeof t&&void 0===r?this.get(e,t):(this.set(e,t,r),void 0!==r?r:t)},remove:function(e,t){var r,i=e[this.expando];if(void 0!==i){if(void 0!==t){r=(t=Array.isArray(t)?t.map(h):(t=h(t))in i?[t]:t.match(Se)||[]).length;for(;r--;)delete i[t[r]]}(void 0===t||ge.isEmptyObject(i))&&(e.nodeType?e[this.expando]=void 0:delete e[this.expando])}},hasData:function(e){var t=e[this.expando];return void 0!==t&&!ge.isEmptyObject(t)}};var De=new g,Le=new g,we=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,Me=/[A-Z]/g;ge.extend({hasData:function(e){return Le.hasData(e)||De.hasData(e)},data:function(e,t,r){return Le.access(e,t,r)},removeData:function(e,t){Le.remove(e,t)},_data:function(e,t,r){return De.access(e,t,r)},_removeData:function(e,t){De.remove(e,t)}}),ge.fn.extend({data:function(e,t){var r,i,a,o=this[0],n=o&&o.attributes;if(void 0===e){if(this.length&&(a=Le.get(o),1===o.nodeType&&!De.get(o,"hasDataAttrs"))){for(r=n.length;r--;)n[r]&&0===(i=n[r].name).indexOf("data-")&&(i=h(i.slice(5)),f(o,i,a[i]));De.set(o,"hasDataAttrs",!0)}return a}return"object"==typeof e?this.each(function(){Le.set(this,e)}):Ae(this,function(t){var r;return o&&void 0===t?void 0!==(r=Le.get(o,e))?r:void 0!==(r=f(o,e))?r:void 0:void this.each(function(){Le.set(this,e,t)})},null,t,1<arguments.length,null,!0)},removeData:function(e){return this.each(function(){Le.remove(this,e)})}}),ge.extend({queue:function(e,t,r){var i;if(e)return t=(t||"fx")+"queue",i=De.get(e,t),r&&(!i||Array.isArray(r)?i=De.access(e,t,ge.makeArray(r)):i.push(r)),i||[]},dequeue:function(e,t){t=t||"fx";var r=ge.queue(e,t),i=r.length,a=r.shift(),o=ge._queueHooks(e,t);"inprogress"===a&&(a=r.shift(),i--),a&&("fx"===t&&r.unshift("inprogress"),delete o.stop,a.call(e,function(){ge.dequeue(e,t)},o)),!i&&o&&o.empty.fire()},_queueHooks:function(e,t){var r=t+"queueHooks";return De.get(e,r)||De.access(e,r,{empty:ge.Callbacks("once memory").add(function(){De.remove(e,[t+"queue",r])})})}}),ge.fn.extend({queue:function(e,t){var r=2;return"string"!=typeof e&&(t=e,e="fx",r--),arguments.length<r?ge.queue(this[0],e):void 0===t?this:this.each(function(){var r=ge.queue(this,e,t);ge._queueHooks(this,e),"fx"===e&&"inprogress"!==r[0]&&ge.dequeue(this,e)})},dequeue:function(e){return this.each(function(){ge.dequeue(this,e)})},clearQueue:function(e){return this.queue(e||"fx",[])},promise:function(e,t){var r,i=1,a=ge.Deferred(),o=this,n=this.length,s=function(){--i||a.resolveWith(o,[o])};for("string"!=typeof e&&(t=e,e=void 0),e=e||"fx";n--;)(r=De.get(o[n],e+"queueHooks"))&&r.empty&&(i++,r.empty.add(s));return s(),a.promise(t)}});var Ue=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,ke=new RegExp("^(?:([+-])=|)("+Ue+")([a-z%]*)$","i"),xe=["Top","Right","Bottom","Left"],Ge=ue.documentElement,Fe=function(e){return ge.contains(e.ownerDocument,e)},He={composed:!0};Ge.getRootNode&&(Fe=function(e){return ge.contains(e.ownerDocument,e)||e.getRootNode(He)===e.ownerDocument});var Ve=function(e,t){return"none"===(e=t||e).style.display||""===e.style.display&&Fe(e)&&"none"===ge.css(e,"display")},Ye={};ge.fn.extend({show:function(){return I(this,!0)},hide:function(){return I(this)},toggle:function(e){return"boolean"==typeof e?e?this.show():this.hide():this.each(function(){Ve(this)?ge(this).show():ge(this).hide()})}});var Be,qe,je=/^(?:checkbox|radio)$/i,We=/<([a-z][^\/\0>\x20\t\r\n\f]*)/i,$e=/^$|^module$|\/(?:java|ecma)script/i;Be=ue.createDocumentFragment().appendChild(ue.createElement("div")),(qe=ue.createElement("input")).setAttribute("type","radio"),qe.setAttribute("checked","checked"),qe.setAttribute("name","t"),Be.appendChild(qe),le.checkClone=Be.cloneNode(!0).cloneNode(!0).lastChild.checked,Be.innerHTML="<textarea>x</textarea>",le.noCloneChecked=!!Be.cloneNode(!0).lastChild.defaultValue,Be.innerHTML="<option></option>",le.option=!!Be.lastChild;var Ke={thead:[1,"<table>","</table>"],col:[2,"<table><colgroup>","</colgroup></table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],_default:[0,"",""]};Ke.tbody=Ke.tfoot=Ke.colgroup=Ke.caption=Ke.thead,Ke.th=Ke.td,le.option||(Ke.optgroup=Ke.option=[1,"<select multiple='multiple'>","</select>"]);var ze=/<|&#?\w+;/,Qe=/^key/,Xe=/^(?:mouse|pointer|contextmenu|drag|drop)|click/,Je=/^([^.]*)(?:\.(.+)|)/;ge.event={global:{},add:function(e,t,r,i,a){var o,n,s,l,c,d,u,p,h,g,f,m=De.get(e);if(Ne(e))for(r.handler&&(r=(o=r).handler,a=o.selector),a&&ge.find.matchesSelector(Ge,a),r.guid||(r.guid=ge.guid++),(l=m.events)||(l=m.events=Object.create(null)),(n=m.handle)||(n=m.handle=function(t){return"undefined"!=typeof ge&&ge.event.triggered!==t.type?ge.event.dispatch.apply(e,arguments):void 0}),c=(t=(t||"").match(Se)||[""]).length;c--;)h=f=(s=Je.exec(t[c])||[])[1],g=(s[2]||"").split(".").sort(),h&&(u=ge.event.special[h]||{},h=(a?u.delegateType:u.bindType)||h,u=ge.event.special[h]||{},d=ge.extend({type:h,origType:f,data:i,handler:r,guid:r.guid,selector:a,needsContext:a&&ge.expr.match.needsContext.test(a),namespace:g.join(".")},o),(p=l[h])||((p=l[h]=[]).delegateCount=0,u.setup&&!1!==u.setup.call(e,i,g,n)||e.addEventListener&&e.addEventListener(h,n)),u.add&&(u.add.call(e,d),d.handler.guid||(d.handler.guid=r.guid)),a?p.splice(p.delegateCount++,0,d):p.push(d),ge.event.global[h]=!0)},remove:function(e,t,r,i,a){var o,n,s,l,c,d,u,p,h,g,f,m=De.hasData(e)&&De.get(e);if(m&&(l=m.events)){for(c=(t=(t||"").match(Se)||[""]).length;c--;)if(h=f=(s=Je.exec(t[c])||[])[1],g=(s[2]||"").split(".").sort(),h){for(u=ge.event.special[h]||{},p=l[h=(i?u.delegateType:u.bindType)||h]||[],s=s[2]&&new RegExp("(^|\\.)"+g.join("\\.(?:.*\\.|)")+"(\\.|$)"),n=o=p.length;o--;)d=p[o],!a&&f!==d.origType||r&&r.guid!==d.guid||s&&!s.test(d.namespace)||i&&i!==d.selector&&("**"!==i||!d.selector)||(p.splice(o,1),d.selector&&p.delegateCount--,u.remove&&u.remove.call(e,d));n&&!p.length&&(u.teardown&&!1!==u.teardown.call(e,g,m.handle)||ge.removeEvent(e,h,m.handle),delete l[h])}else for(h in l)ge.event.remove(e,h+t[c],r,i,!0);ge.isEmptyObject(l)&&De.remove(e,"handle events")}},dispatch:function(e){var t,r,i,a,o,n,s=new Array(arguments.length),l=ge.event.fix(e),c=(De.get(this,"events")||Object.create(null))[l.type]||[],d=ge.event.special[l.type]||{};for(s[0]=l,t=1;t<arguments.length;t++)s[t]=arguments[t];if(l.delegateTarget=this,!d.preDispatch||!1!==d.preDispatch.call(this,l)){for(n=ge.event.handlers.call(this,l,c),t=0;(a=n[t++])&&!l.isPropagationStopped();)for(l.currentTarget=a.elem,r=0;(o=a.handlers[r++])&&!l.isImmediatePropagationStopped();)l.rnamespace&&!1!==o.namespace&&!l.rnamespace.test(o.namespace)||(l.handleObj=o,l.data=o.data,void 0!==(i=((ge.event.special[o.origType]||{}).handle||o.handler).apply(a.elem,s))&&!1===(l.result=i)&&(l.preventDefault(),l.stopPropagation()));return d.postDispatch&&d.postDispatch.call(this,l),l.result}},handlers:function(e,t){var r,i,a,o,n,s=[],l=t.delegateCount,c=e.target;if(l&&c.nodeType&&!("click"===e.type&&1<=e.button))for(;c!==this;c=c.parentNode||this)if(1===c.nodeType&&("click"!==e.type||!0!==c.disabled)){for(o=[],n={},r=0;r<l;r++)void 0===n[a=(i=t[r]).selector+" "]&&(n[a]=i.needsContext?-1<ge(a,this).index(c):ge.find(a,this,null,[c]).length),n[a]&&o.push(i);o.length&&s.push({elem:c,handlers:o})}return c=this,l<t.length&&s.push({elem:c,handlers:t.slice(l)}),s},addProp:function(e,t){Object.defineProperty(ge.Event.prototype,e,{enumerable:!0,configurable:!0,get:ce(t)?function(){if(this.originalEvent)return t(this.originalEvent)}:function(){if(this.originalEvent)return this.originalEvent[e]},set:function(t){Object.defineProperty(this,e,{enumerable:!0,configurable:!0,writable:!0,value:t})}})},fix:function(e){return e[ge.expando]?e:new ge.Event(e)},special:{load:{noBubble:!0},click:{setup:function(e){var t=this||e;return je.test(t.type)&&t.click&&o(t,"input")&&C(t,"click",b),!1},trigger:function(e){var t=this||e;return je.test(t.type)&&t.click&&o(t,"input")&&C(t,"click"),!0},_default:function(e){var t=e.target;return je.test(t.type)&&t.click&&o(t,"input")&&De.get(t,"click")||o(t,"a")}},beforeunload:{postDispatch:function(e){void 0!==e.result&&e.originalEvent&&(e.originalEvent.returnValue=e.result)}}}},ge.removeEvent=function(e,t,r){e.removeEventListener&&e.removeEventListener(t,r)},ge.Event=function(e,t){return this instanceof ge.Event?(e&&e.type?(this.originalEvent=e,this.type=e.type,this.isDefaultPrevented=e.defaultPrevented||void 0===e.defaultPrevented&&!1===e.returnValue?b:T,this.target=e.target&&3===e.target.nodeType?e.target.parentNode:e.target,this.currentTarget=e.currentTarget,this.relatedTarget=e.relatedTarget):this.type=e,t&&ge.extend(this,t),this.timeStamp=e&&e.timeStamp||Date.now(),this[ge.expando]=!0,void 0):new ge.Event(e,t)},ge.Event.prototype={constructor:ge.Event,isDefaultPrevented:T,isPropagationStopped:T,isImmediatePropagationStopped:T,isSimulated:!1,preventDefault:function(){var e=this.originalEvent;this.isDefaultPrevented=b,e&&!this.isSimulated&&e.preventDefault()},stopPropagation:function(){var e=this.originalEvent;this.isPropagationStopped=b,e&&!this.isSimulated&&e.stopPropagation()},stopImmediatePropagation:function(){var e=this.originalEvent;this.isImmediatePropagationStopped=b,e&&!this.isSimulated&&e.stopImmediatePropagation(),this.stopPropagation()}},ge.each({altKey:!0,bubbles:!0,cancelable:!0,changedTouches:!0,ctrlKey:!0,detail:!0,eventPhase:!0,metaKey:!0,pageX:!0,pageY:!0,shiftKey:!0,view:!0,char:!0,code:!0,charCode:!0,key:!0,keyCode:!0,button:!0,buttons:!0,clientX:!0,clientY:!0,offsetX:!0,offsetY:!0,pointerId:!0,pointerType:!0,screenX:!0,screenY:!0,targetTouches:!0,toElement:!0,touches:!0,which:function(e){var t=e.button;return null==e.which&&Qe.test(e.type)?null!=e.charCode?e.charCode:e.keyCode:!e.which&&void 0!==t&&Xe.test(e.type)?1&t?1:2&t?3:4&t?2:0:e.which}},ge.event.addProp),ge.each({focus:"focusin",blur:"focusout"},function(e,t){ge.event.special[e]={setup:function(){return C(this,e,P),!1},trigger:function(){return C(this,e),!0},delegateType:t}}),ge.each({mouseenter:"mouseover",mouseleave:"mouseout",pointerenter:"pointerover",pointerleave:"pointerout"},function(e,t){ge.event.special[e]={delegateType:t,bindType:t,handle:function(e){var r,i=e.relatedTarget,a=e.handleObj;return i&&(i===this||ge.contains(this,i))||(e.type=a.origType,r=a.handler.apply(this,arguments),e.type=t),r}}}),ge.fn.extend({on:function(e,t,r,i){return S(this,e,t,r,i)},one:function(e,t,r,i){return S(this,e,t,r,i,1)},off:function(e,t,r){var i,a;if(e&&e.preventDefault&&e.handleObj)return i=e.handleObj,ge(e.delegateTarget).off(i.namespace?i.origType+"."+i.namespace:i.origType,i.selector,i.handler),this;if("object"==typeof e){for(a in e)this.off(a,t,e[a]);return this}return!1!==t&&"function"!=typeof t||(r=t,t=void 0),!1===r&&(r=T),this.each(function(){ge.event.remove(this,e,r,t)})}});var Ze=/<script|<style|<link/i,et=/checked\s*(?:[^=]|=\s*.checked.)/i,tt=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g;ge.extend({htmlPrefilter:function(e){return e},clone:function(e,t,r){var i,a,o,n,s,l,c,d=e.cloneNode(!0),u=Fe(e);if(!(le.noCloneChecked||1!==e.nodeType&&11!==e.nodeType||ge.isXMLDoc(e)))for(n=E(d),i=0,a=(o=E(e)).length;i<a;i++)s=o[i],l=n[i],"input"===(c=l.nodeName.toLowerCase())&&je.test(s.type)?l.checked=s.checked:"input"!==c&&"textarea"!==c||(l.defaultValue=s.defaultValue);if(t)if(r)for(o=o||E(e),n=n||E(d),i=0,a=o.length;i<a;i++)R(o[i],n[i]);else R(e,d);return 0<(n=E(d,"script")).length&&y(n,!u&&E(e,"script")),d},cleanData:function(e){for(var t,r,i,a=ge.event.special,o=0;void 0!==(r=e[o]);o++)if(Ne(r)){if(t=r[De.expando]){if(t.events)for(i in t.events)a[i]?ge.event.remove(r,i):ge.removeEvent(r,i,t.handle);r[De.expando]=void 0}r[Le.expando]&&(r[Le.expando]=void 0)}}}),ge.fn.extend({detach:function(e){return D(this,e,!0)},remove:function(e){return D(this,e)},text:function(e){return Ae(this,function(e){return void 0===e?ge.text(this):this.empty().each(function(){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||(this.textContent=e)})},null,e,arguments.length)},append:function(){return N(this,arguments,function(e){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||_(this,e).appendChild(e)})},prepend:function(){return N(this,arguments,function(e){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var t=_(this,e);t.insertBefore(e,t.firstChild)}})},before:function(){return N(this,arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this)})},after:function(){return N(this,arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this.nextSibling)})},empty:function(){for(var e,t=0;null!=(e=this[t]);t++)1===e.nodeType&&(ge.cleanData(E(e,!1)),e.textContent="");return this},clone:function(e,t){return e=null!=e&&e,t=null==t?e:t,this.map(function(){return ge.clone(this,e,t)})},html:function(e){return Ae(this,function(e){var t=this[0]||{},r=0,i=this.length;if(void 0===e&&1===t.nodeType)return t.innerHTML;if("string"==typeof e&&!Ze.test(e)&&!Ke[(We.exec(e)||["",""])[1].toLowerCase()]){e=ge.htmlPrefilter(e);try{for(;r<i;r++)1===(t=this[r]||{}).nodeType&&(ge.cleanData(E(t,!1)),t.innerHTML=e);t=0}catch(e){}}t&&this.empty().append(e)},null,e,arguments.length)},replaceWith:function(){var e=[];return N(this,arguments,function(t){var r=this.parentNode;ge.inArray(this,e)<0&&(ge.cleanData(E(this)),r&&r.replaceChild(t,this))},e)}}),ge.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(e,t){ge.fn[e]=function(e){for(var r,i=[],a=ge(e),o=a.length-1,n=0;n<=o;n++)r=n===o?this:this.clone(!0),ge(a[n])[t](r),te.apply(i,r.get());return this.pushStack(i)}});var rt=new RegExp("^("+Ue+")(?!px)[a-z%]+$","i"),it=function(t){var r=t.ownerDocument.defaultView;return r&&r.opener||(r=e),r.getComputedStyle(t)},at=function(e,t,r){var i,a,o={};for(a in t)o[a]=e.style[a],e.style[a]=t[a];for(a in i=r.call(e),t)e.style[a]=o[a];return i},ot=new RegExp(xe.join("|"),"i");!function(){function t(){if(d){c.style.cssText="position:absolute;left:-11111px;width:60px;margin-top:1px;padding:0;border:0",d.style.cssText="position:relative;display:block;box-sizing:border-box;overflow:scroll;margin:auto;border:1px;padding:1px;width:60%;top:1%",Ge.appendChild(c).appendChild(d);var t=e.getComputedStyle(d);i="1%"!==t.top,l=12===r(t.marginLeft),d.style.right="60%",n=36===r(t.right),a=36===r(t.width),d.style.position="absolute",o=12===r(d.offsetWidth/3),Ge.removeChild(c),d=null}}function r(e){return Math.round(parseFloat(e))}var i,a,o,n,s,l,c=ue.createElement("div"),d=ue.createElement("div");d.style&&(d.style.backgroundClip="content-box",d.cloneNode(!0).style.backgroundClip="",le.clearCloneStyle="content-box"===d.style.backgroundClip,ge.extend(le,{boxSizingReliable:function(){return t(),a},pixelBoxStyles:function(){return t(),n},pixelPosition:function(){return t(),i},reliableMarginLeft:function(){return t(),l},scrollboxSize:function(){return t(),o},reliableTrDimensions:function(){var t,r,i,a;return null==s&&(t=ue.createElement("table"),r=ue.createElement("tr"),i=ue.createElement("div"),t.style.cssText="position:absolute;left:-11111px",r.style.height="1px",i.style.height="9px",Ge.appendChild(t).appendChild(r).appendChild(i),a=e.getComputedStyle(r),s=3<parseInt(a.height),Ge.removeChild(t)),s}}))}();var nt=["Webkit","Moz","ms"],st=ue.createElement("div").style,lt={},ct=/^(none|table(?!-c[ea]).+)/,dt=/^--/,ut={position:"absolute",visibility:"hidden",display:"block"},pt={letterSpacing:"0",fontWeight:"400"};ge.extend({cssHooks:{opacity:{get:function(e,t){if(t){var r=L(e,"opacity");return""===r?"1":r}}}},cssNumber:{animationIterationCount:!0,columnCount:!0,fillOpacity:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,gridArea:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnStart:!0,gridRow:!0,gridRowEnd:!0,gridRowStart:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{},style:function(e,t,r,i){if(e&&3!==e.nodeType&&8!==e.nodeType&&e.style){var a,o,n,s=h(t),l=dt.test(t),c=e.style;if(l||(t=M(s)),n=ge.cssHooks[t]||ge.cssHooks[s],void 0===r)return n&&"get"in n&&void 0!==(a=n.get(e,!1,i))?a:c[t];"string"==(o=typeof r)&&(a=ke.exec(r))&&a[1]&&(r=m(e,t,a),o="number"),null!=r&&r==r&&("number"!==o||l||(r+=a&&a[3]||(ge.cssNumber[s]?"":"px")),le.clearCloneStyle||""!==r||0!==t.indexOf("background")||(c[t]="inherit"),n&&"set"in n&&void 0===(r=n.set(e,r,i))||(l?c.setProperty(t,r):c[t]=r))}},css:function(e,t,r,i){var a,o,n,s=h(t);return dt.test(t)||(t=M(s)),(n=ge.cssHooks[t]||ge.cssHooks[s])&&"get"in n&&(a=n.get(e,!0,r)),void 0===a&&(a=L(e,t,i)),"normal"===a&&t in pt&&(a=pt[t]),""===r||r?(o=parseFloat(a),!0===r||isFinite(o)?o||0:a):a}}),ge.each(["height","width"],function(e,t){ge.cssHooks[t]={get:function(e,r,i){if(r)return!ct.test(ge.css(e,"display"))||e.getClientRects().length&&e.getBoundingClientRect().width?x(e,t,i):at(e,ut,function(){return x(e,t,i)})},set:function(e,r,i){var a,o=it(e),n=!le.scrollboxSize()&&"absolute"===o.position,s=(n||i)&&"border-box"===ge.css(e,"boxSizing",!1,o),l=i?k(e,t,i,s,o):0;return s&&n&&(l-=Math.ceil(e["offset"+t[0].toUpperCase()+t.slice(1)]-parseFloat(o[t])-k(e,t,"border",!1,o)-.5)),l&&(a=ke.exec(r))&&"px"!==(a[3]||"px")&&(e.style[t]=r,r=ge.css(e,t)),U(0,r,l)}}}),ge.cssHooks.marginLeft=w(le.reliableMarginLeft,function(e,t){if(t)return(parseFloat(L(e,"marginLeft"))||e.getBoundingClientRect().left-at(e,{marginLeft:0},function(){return e.getBoundingClientRect().left}))+"px"}),ge.each({margin:"",padding:"",border:"Width"},function(e,t){ge.cssHooks[e+t]={expand:function(r){for(var i=0,a={},o="string"==typeof r?r.split(" "):[r];i<4;i++)a[e+xe[i]+t]=o[i]||o[i-2]||o[0];return a}},"margin"!==e&&(ge.cssHooks[e+t].set=U)}),ge.fn.extend({css:function(e,t){return Ae(this,function(e,t,r){var i,a,o={},n=0;if(Array.isArray(t)){for(i=it(e),a=t.length;n<a;n++)o[t[n]]=ge.css(e,t[n],!1,i);return o}return void 0!==r?ge.style(e,t,r):ge.css(e,t)},e,t,1<arguments.length)}}),((ge.Tween=G).prototype={constructor:G,init:function(e,t,r,i,a,o){this.elem=e,this.prop=r,this.easing=a||ge.easing._default,this.options=t,this.start=this.now=this.cur(),this.end=i,this.unit=o||(ge.cssNumber[r]?"":"px")},cur:function(){var e=G.propHooks[this.prop];return e&&e.get?e.get(this):G.propHooks._default.get(this)},run:function(e){var t,r=G.propHooks[this.prop];return this.options.duration?this.pos=t=ge.easing[this.easing](e,this.options.duration*e,0,1,this.options.duration):this.pos=t=e,this.now=(this.end-this.start)*t+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),r&&r.set?r.set(this):G.propHooks._default.set(this),this}}).init.prototype=G.prototype,(G.propHooks={_default:{get:function(e){var t;return 1!==e.elem.nodeType||null!=e.elem[e.prop]&&null==e.elem.style[e.prop]?e.elem[e.prop]:(t=ge.css(e.elem,e.prop,""))&&"auto"!==t?t:0},set:function(e){ge.fx.step[e.prop]?ge.fx.step[e.prop](e):1!==e.elem.nodeType||!ge.cssHooks[e.prop]&&null==e.elem.style[M(e.prop)]?e.elem[e.prop]=e.now:ge.style(e.elem,e.prop,e.now+e.unit)}}}).scrollTop=G.propHooks.scrollLeft={set:function(e){e.elem.nodeType&&e.elem.parentNode&&(e.elem[e.prop]=e.now)}},ge.easing={linear:function(e){return e},swing:function(e){return.5-Math.cos(e*Math.PI)/2},_default:"swing"},ge.fx=G.prototype.init,ge.fx.step={};var ht,gt,ft,mt,It=/^(?:toggle|show|hide)$/,Et=/queueHooks$/;ge.Animation=ge.extend(B,{tweeners:{"*":[function(e,t){var r=this.createTween(e,t);return m(r.elem,e,ke.exec(t),r),r}]},tweener:function(e,t){ce(e)?(t=e,e=["*"]):e=e.match(Se);for(var r,i=0,a=e.length;i<a;i++)r=e[i],B.tweeners[r]=B.tweeners[r]||[],B.tweeners[r].unshift(t)},prefilters:[function(e,t,r){var i,a,o,n,s,l,c,d,u="width"in t||"height"in t,p=this,h={},g=e.style,f=e.nodeType&&Ve(e),m=De.get(e,"fxshow");for(i in r.queue||(null==(n=ge._queueHooks(e,"fx")).unqueued&&(n.unqueued=0,s=n.empty.fire,n.empty.fire=function(){n.unqueued||s()}),n.unqueued++,p.always(function(){p.always(function(){n.unqueued--,ge.queue(e,"fx").length||n.empty.fire()})})),t)if(a=t[i],It.test(a)){if(delete t[i],o=o||"toggle"===a,a===(f?"hide":"show")){if("show"!==a||!m||void 0===m[i])continue;f=!0}h[i]=m&&m[i]||ge.style(e,i)}if((l=!ge.isEmptyObject(t))||!ge.isEmptyObject(h))for(i in u&&1===e.nodeType&&(r.overflow=[g.overflow,g.overflowX,g.overflowY],null==(c=m&&m.display)&&(c=De.get(e,"display")),"none"===(d=ge.css(e,"display"))&&(c?d=c:(I([e],!0),c=e.style.display||c,d=ge.css(e,"display"),I([e]))),("inline"===d||"inline-block"===d&&null!=c)&&"none"===ge.css(e,"float")&&(l||(p.done(function(){g.display=c}),null==c&&(d=g.display,c="none"===d?"":d)),g.display="inline-block")),r.overflow&&(g.overflow="hidden",p.always(function(){g.overflow=r.overflow[0],g.overflowX=r.overflow[1],g.overflowY=r.overflow[2]})),l=!1,h)l||(m?"hidden"in m&&(f=m.hidden):m=De.access(e,"fxshow",{display:c}),o&&(m.hidden=!f),f&&I([e],!0),p.done(function(){for(i in f||I([e]),De.remove(e,"fxshow"),h)ge.style(e,i,h[i])})),l=Y(f?m[i]:0,i,p),i in m||(m[i]=l.start,f&&(l.end=l.start,l.start=0))}],prefilter:function(e,t){t?B.prefilters.unshift(e):B.prefilters.push(e)}}),ge.speed=function(e,t,r){var i=e&&"object"==typeof e?ge.extend({},e):{complete:r||!r&&t||ce(e)&&e,duration:e,easing:r&&t||t&&!ce(t)&&t};return ge.fx.off?i.duration=0:"number"!=typeof i.duration&&(i.duration in ge.fx.speeds?i.duration=ge.fx.speeds[i.duration]:i.duration=ge.fx.speeds._default),
- null!=i.queue&&!0!==i.queue||(i.queue="fx"),i.old=i.complete,i.complete=function(){ce(i.old)&&i.old.call(this),i.queue&&ge.dequeue(this,i.queue)},i},ge.fn.extend({fadeTo:function(e,t,r,i){return this.filter(Ve).css("opacity",0).show().end().animate({opacity:t},e,r,i)},animate:function(e,t,r,i){var a=ge.isEmptyObject(e),o=ge.speed(t,r,i),n=function(){var t=B(this,ge.extend({},e),o);(a||De.get(this,"finish"))&&t.stop(!0)};return n.finish=n,a||!1===o.queue?this.each(n):this.queue(o.queue,n)},stop:function(e,t,r){var i=function(e){var t=e.stop;delete e.stop,t(r)};return"string"!=typeof e&&(r=t,t=e,e=void 0),t&&this.queue(e||"fx",[]),this.each(function(){var t=!0,a=null!=e&&e+"queueHooks",o=ge.timers,n=De.get(this);if(a)n[a]&&n[a].stop&&i(n[a]);else for(a in n)n[a]&&n[a].stop&&Et.test(a)&&i(n[a]);for(a=o.length;a--;)o[a].elem!==this||null!=e&&o[a].queue!==e||(o[a].anim.stop(r),t=!1,o.splice(a,1));!t&&r||ge.dequeue(this,e)})},finish:function(e){return!1!==e&&(e=e||"fx"),this.each(function(){var t,r=De.get(this),i=r[e+"queue"],a=r[e+"queueHooks"],o=ge.timers,n=i?i.length:0;for(r.finish=!0,ge.queue(this,e,[]),a&&a.stop&&a.stop.call(this,!0),t=o.length;t--;)o[t].elem===this&&o[t].queue===e&&(o[t].anim.stop(!0),o.splice(t,1));for(t=0;t<n;t++)i[t]&&i[t].finish&&i[t].finish.call(this);delete r.finish})}}),ge.each(["toggle","show","hide"],function(e,t){var r=ge.fn[t];ge.fn[t]=function(e,i,a){return null==e||"boolean"==typeof e?r.apply(this,arguments):this.animate(V(t,!0),e,i,a)}}),ge.each({slideDown:V("show"),slideUp:V("hide"),slideToggle:V("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(e,t){ge.fn[e]=function(e,r,i){return this.animate(t,e,r,i)}}),ge.timers=[],ge.fx.tick=function(){var e,t=0,r=ge.timers;for(ht=Date.now();t<r.length;t++)(e=r[t])()||r[t]!==e||r.splice(t--,1);r.length||ge.fx.stop(),ht=void 0},ge.fx.timer=function(e){ge.timers.push(e),ge.fx.start()},ge.fx.interval=13,ge.fx.start=function(){gt||(gt=!0,F())},ge.fx.stop=function(){gt=null},ge.fx.speeds={slow:600,fast:200,_default:400},ge.fn.delay=function(t,r){return t=ge.fx&&ge.fx.speeds[t]||t,r=r||"fx",this.queue(r,function(r,i){var a=e.setTimeout(r,t);i.stop=function(){e.clearTimeout(a)}})},ft=ue.createElement("input"),mt=ue.createElement("select").appendChild(ue.createElement("option")),ft.type="checkbox",le.checkOn=""!==ft.value,le.optSelected=mt.selected,(ft=ue.createElement("input")).value="t",ft.type="radio",le.radioValue="t"===ft.value;var yt,vt=ge.expr.attrHandle;ge.fn.extend({attr:function(e,t){return Ae(this,ge.attr,e,t,1<arguments.length)},removeAttr:function(e){return this.each(function(){ge.removeAttr(this,e)})}}),ge.extend({attr:function(e,t,r){var i,a,o=e.nodeType;if(3!==o&&8!==o&&2!==o)return"undefined"==typeof e.getAttribute?ge.prop(e,t,r):(1===o&&ge.isXMLDoc(e)||(a=ge.attrHooks[t.toLowerCase()]||(ge.expr.match.bool.test(t)?yt:void 0)),void 0!==r?null===r?void ge.removeAttr(e,t):a&&"set"in a&&void 0!==(i=a.set(e,r,t))?i:(e.setAttribute(t,r+""),r):a&&"get"in a&&null!==(i=a.get(e,t))?i:null==(i=ge.find.attr(e,t))?void 0:i)},attrHooks:{type:{set:function(e,t){if(!le.radioValue&&"radio"===t&&o(e,"input")){var r=e.value;return e.setAttribute("type",t),r&&(e.value=r),t}}}},removeAttr:function(e,t){var r,i=0,a=t&&t.match(Se);if(a&&1===e.nodeType)for(;r=a[i++];)e.removeAttribute(r)}}),yt={set:function(e,t,r){return!1===t?ge.removeAttr(e,r):e.setAttribute(r,r),r}},ge.each(ge.expr.match.bool.source.match(/\w+/g),function(e,t){var r=vt[t]||ge.find.attr;vt[t]=function(e,t,i){var a,o,n=t.toLowerCase();return i||(o=vt[n],vt[n]=a,a=null!=r(e,t,i)?n:null,vt[n]=o),a}});var bt=/^(?:input|select|textarea|button)$/i,Tt=/^(?:a|area)$/i;ge.fn.extend({prop:function(e,t){return Ae(this,ge.prop,e,t,1<arguments.length)},removeProp:function(e){return this.each(function(){delete this[ge.propFix[e]||e]})}}),ge.extend({prop:function(e,t,r){var i,a,o=e.nodeType;if(3!==o&&8!==o&&2!==o)return 1===o&&ge.isXMLDoc(e)||(t=ge.propFix[t]||t,a=ge.propHooks[t]),void 0!==r?a&&"set"in a&&void 0!==(i=a.set(e,r,t))?i:e[t]=r:a&&"get"in a&&null!==(i=a.get(e,t))?i:e[t]},propHooks:{tabIndex:{get:function(e){var t=ge.find.attr(e,"tabindex");return t?parseInt(t,10):bt.test(e.nodeName)||Tt.test(e.nodeName)&&e.href?0:-1}}},propFix:{for:"htmlFor",class:"className"}}),le.optSelected||(ge.propHooks.selected={get:function(e){var t=e.parentNode;return t&&t.parentNode&&t.parentNode.selectedIndex,null},set:function(e){var t=e.parentNode;t&&(t.selectedIndex,t.parentNode&&t.parentNode.selectedIndex)}}),ge.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){ge.propFix[this.toLowerCase()]=this}),ge.fn.extend({addClass:function(e){var t,r,i,a,o,n,s,l=0;if(ce(e))return this.each(function(t){ge(this).addClass(e.call(this,t,j(this)))});if((t=W(e)).length)for(;r=this[l++];)if(a=j(r),i=1===r.nodeType&&" "+q(a)+" "){for(n=0;o=t[n++];)i.indexOf(" "+o+" ")<0&&(i+=o+" ");a!==(s=q(i))&&r.setAttribute("class",s)}return this},removeClass:function(e){var t,r,i,a,o,n,s,l=0;if(ce(e))return this.each(function(t){ge(this).removeClass(e.call(this,t,j(this)))});if(!arguments.length)return this.attr("class","");if((t=W(e)).length)for(;r=this[l++];)if(a=j(r),i=1===r.nodeType&&" "+q(a)+" "){for(n=0;o=t[n++];)for(;-1<i.indexOf(" "+o+" ");)i=i.replace(" "+o+" "," ");a!==(s=q(i))&&r.setAttribute("class",s)}return this},toggleClass:function(e,t){var r=typeof e,i="string"===r||Array.isArray(e);return"boolean"==typeof t&&i?t?this.addClass(e):this.removeClass(e):ce(e)?this.each(function(r){ge(this).toggleClass(e.call(this,r,j(this),t),t)}):this.each(function(){var t,a,o,n;if(i)for(a=0,o=ge(this),n=W(e);t=n[a++];)o.hasClass(t)?o.removeClass(t):o.addClass(t);else void 0!==e&&"boolean"!==r||((t=j(this))&&De.set(this,"__className__",t),this.setAttribute&&this.setAttribute("class",t||!1===e?"":De.get(this,"__className__")||""))})},hasClass:function(e){var t,r,i=0;for(t=" "+e+" ";r=this[i++];)if(1===r.nodeType&&-1<(" "+q(j(r))+" ").indexOf(t))return!0;return!1}});var Pt=/\r/g;ge.fn.extend({val:function(e){var t,r,i,a=this[0];return arguments.length?(i=ce(e),this.each(function(r){var a;1===this.nodeType&&(null==(a=i?e.call(this,r,ge(this).val()):e)?a="":"number"==typeof a?a+="":Array.isArray(a)&&(a=ge.map(a,function(e){return null==e?"":e+""})),(t=ge.valHooks[this.type]||ge.valHooks[this.nodeName.toLowerCase()])&&"set"in t&&void 0!==t.set(this,a,"value")||(this.value=a))})):a?(t=ge.valHooks[a.type]||ge.valHooks[a.nodeName.toLowerCase()])&&"get"in t&&void 0!==(r=t.get(a,"value"))?r:"string"==typeof(r=a.value)?r.replace(Pt,""):null==r?"":r:void 0}}),ge.extend({valHooks:{option:{get:function(e){var t=ge.find.attr(e,"value");return null!=t?t:q(ge.text(e))}},select:{get:function(e){var t,r,i,a=e.options,n=e.selectedIndex,s="select-one"===e.type,l=s?null:[],c=s?n+1:a.length;for(i=n<0?c:s?n:0;i<c;i++)if(((r=a[i]).selected||i===n)&&!r.disabled&&(!r.parentNode.disabled||!o(r.parentNode,"optgroup"))){if(t=ge(r).val(),s)return t;l.push(t)}return l},set:function(e,t){for(var r,i,a=e.options,o=ge.makeArray(t),n=a.length;n--;)((i=a[n]).selected=-1<ge.inArray(ge.valHooks.option.get(i),o))&&(r=!0);return r||(e.selectedIndex=-1),o}}}}),ge.each(["radio","checkbox"],function(){ge.valHooks[this]={set:function(e,t){if(Array.isArray(t))return e.checked=-1<ge.inArray(ge(e).val(),t)}},le.checkOn||(ge.valHooks[this].get=function(e){return null===e.getAttribute("value")?"on":e.value})}),le.focusin="onfocusin"in e;var St=/^(?:focusinfocus|focusoutblur)$/,Ct=function(e){e.stopPropagation()};ge.extend(ge.event,{trigger:function(t,r,i,a){var o,n,s,l,c,d,u,p,h=[i||ue],g=oe.call(t,"type")?t.type:t,f=oe.call(t,"namespace")?t.namespace.split("."):[];if(n=p=s=i=i||ue,3!==i.nodeType&&8!==i.nodeType&&!St.test(g+ge.event.triggered)&&(-1<g.indexOf(".")&&(g=(f=g.split(".")).shift(),f.sort()),c=g.indexOf(":")<0&&"on"+g,(t=t[ge.expando]?t:new ge.Event(g,"object"==typeof t&&t)).isTrigger=a?2:3,t.namespace=f.join("."),t.rnamespace=t.namespace?new RegExp("(^|\\.)"+f.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,t.result=void 0,t.target||(t.target=i),r=null==r?[t]:ge.makeArray(r,[t]),u=ge.event.special[g]||{},a||!u.trigger||!1!==u.trigger.apply(i,r))){if(!a&&!u.noBubble&&!de(i)){for(l=u.delegateType||g,St.test(l+g)||(n=n.parentNode);n;n=n.parentNode)h.push(n),s=n;s===(i.ownerDocument||ue)&&h.push(s.defaultView||s.parentWindow||e)}for(o=0;(n=h[o++])&&!t.isPropagationStopped();)p=n,t.type=1<o?l:u.bindType||g,(d=(De.get(n,"events")||Object.create(null))[t.type]&&De.get(n,"handle"))&&d.apply(n,r),(d=c&&n[c])&&d.apply&&Ne(n)&&(t.result=d.apply(n,r),!1===t.result&&t.preventDefault());return t.type=g,a||t.isDefaultPrevented()||u._default&&!1!==u._default.apply(h.pop(),r)||!Ne(i)||c&&ce(i[g])&&!de(i)&&((s=i[c])&&(i[c]=null),ge.event.triggered=g,t.isPropagationStopped()&&p.addEventListener(g,Ct),i[g](),t.isPropagationStopped()&&p.removeEventListener(g,Ct),ge.event.triggered=void 0,s&&(i[c]=s)),t.result}},simulate:function(e,t,r){var i=ge.extend(new ge.Event,r,{type:e,isSimulated:!0});ge.event.trigger(i,null,t)}}),ge.fn.extend({trigger:function(e,t){return this.each(function(){ge.event.trigger(e,t,this)})},triggerHandler:function(e,t){var r=this[0];if(r)return ge.event.trigger(e,t,r,!0)}}),le.focusin||ge.each({focus:"focusin",blur:"focusout"},function(e,t){var r=function(e){ge.event.simulate(t,e.target,ge.event.fix(e))};ge.event.special[t]={setup:function(){var i=this.ownerDocument||this.document||this,a=De.access(i,t);a||i.addEventListener(e,r,!0),De.access(i,t,(a||0)+1)},teardown:function(){var i=this.ownerDocument||this.document||this,a=De.access(i,t)-1;a?De.access(i,t,a):(i.removeEventListener(e,r,!0),De.remove(i,t))}}});var _t=e.location,At={guid:Date.now()},Ot=/\?/;ge.parseXML=function(t){var r;if(!t||"string"!=typeof t)return null;try{r=(new e.DOMParser).parseFromString(t,"text/xml")}catch(e){r=void 0}return r&&!r.getElementsByTagName("parsererror").length||ge.error("Invalid XML: "+t),r};var Rt=/\[\]$/,Nt=/\r?\n/g,Dt=/^(?:submit|button|image|reset|file)$/i,Lt=/^(?:input|select|textarea|keygen)/i;ge.param=function(e,t){var r,i=[],a=function(e,t){var r=ce(t)?t():t;i[i.length]=encodeURIComponent(e)+"="+encodeURIComponent(null==r?"":r)};if(null==e)return"";if(Array.isArray(e)||e.jquery&&!ge.isPlainObject(e))ge.each(e,function(){a(this.name,this.value)});else for(r in e)$(r,e[r],t,a);return i.join("&")},ge.fn.extend({serialize:function(){return ge.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var e=ge.prop(this,"elements");return e?ge.makeArray(e):this}).filter(function(){var e=this.type;return this.name&&!ge(this).is(":disabled")&&Lt.test(this.nodeName)&&!Dt.test(e)&&(this.checked||!je.test(e))}).map(function(e,t){var r=ge(this).val();return null==r?null:Array.isArray(r)?ge.map(r,function(e){return{name:t.name,value:e.replace(Nt,"\r\n")}}):{name:t.name,value:r.replace(Nt,"\r\n")}}).get()}});var wt=/%20/g,Mt=/#.*$/,Ut=/([?&])_=[^&]*/,kt=/^(.*?):[ \t]*([^\r\n]*)$/gm,xt=/^(?:GET|HEAD)$/,Gt=/^\/\//,Ft={},Ht={},Vt="*/".concat("*"),Yt=ue.createElement("a");Yt.href=_t.href,ge.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:_t.href,type:"GET",isLocal:/^(?:about|app|app-storage|.+-extension|file|res|widget):$/.test(_t.protocol),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":Vt,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/\bxml\b/,html:/\bhtml/,json:/\bjson\b/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":JSON.parse,"text xml":ge.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(e,t){return t?Q(Q(e,ge.ajaxSettings),t):Q(ge.ajaxSettings,e)},ajaxPrefilter:K(Ft),ajaxTransport:K(Ht),ajax:function(t,r){function i(t,r,i,s){var c,p,h,v,b,T=r;d||(d=!0,l&&e.clearTimeout(l),a=void 0,n=s||"",P.readyState=0<t?4:0,c=200<=t&&t<300||304===t,i&&(v=function(e,t,r){for(var i,a,o,n,s=e.contents,l=e.dataTypes;"*"===l[0];)l.shift(),void 0===i&&(i=e.mimeType||t.getResponseHeader("Content-Type"));if(i)for(a in s)if(s[a]&&s[a].test(i)){l.unshift(a);break}if(l[0]in r)o=l[0];else{for(a in r){if(!l[0]||e.converters[a+" "+l[0]]){o=a;break}n||(n=a)}o=o||n}if(o)return o!==l[0]&&l.unshift(o),r[o]}(g,P,i)),!c&&-1<ge.inArray("script",g.dataTypes)&&(g.converters["text script"]=function(){}),v=function(e,t,r,i){var a,o,n,s,l,c={},d=e.dataTypes.slice();if(d[1])for(n in e.converters)c[n.toLowerCase()]=e.converters[n];for(o=d.shift();o;)if(e.responseFields[o]&&(r[e.responseFields[o]]=t),!l&&i&&e.dataFilter&&(t=e.dataFilter(t,e.dataType)),l=o,o=d.shift())if("*"===o)o=l;else if("*"!==l&&l!==o){if(!(n=c[l+" "+o]||c["* "+o]))for(a in c)if((s=a.split(" "))[1]===o&&(n=c[l+" "+s[0]]||c["* "+s[0]])){!0===n?n=c[a]:!0!==c[a]&&(o=s[0],d.unshift(s[1]));break}if(!0!==n)if(n&&e.throws)t=n(t);else try{t=n(t)}catch(e){return{state:"parsererror",error:n?e:"No conversion from "+l+" to "+o}}}return{state:"success",data:t}}(g,v,P,c),c?(g.ifModified&&((b=P.getResponseHeader("Last-Modified"))&&(ge.lastModified[o]=b),(b=P.getResponseHeader("etag"))&&(ge.etag[o]=b)),204===t||"HEAD"===g.type?T="nocontent":304===t?T="notmodified":(T=v.state,p=v.data,c=!(h=v.error))):(h=T,!t&&T||(T="error",t<0&&(t=0))),P.status=t,P.statusText=(r||T)+"",c?I.resolveWith(f,[p,T,P]):I.rejectWith(f,[P,T,h]),P.statusCode(y),y=void 0,u&&m.trigger(c?"ajaxSuccess":"ajaxError",[P,g,c?p:h]),E.fireWith(f,[P,T]),u&&(m.trigger("ajaxComplete",[P,g]),--ge.active||ge.event.trigger("ajaxStop")))}"object"==typeof t&&(r=t,t=void 0),r=r||{};var a,o,n,s,l,c,d,u,p,h,g=ge.ajaxSetup({},r),f=g.context||g,m=g.context&&(f.nodeType||f.jquery)?ge(f):ge.event,I=ge.Deferred(),E=ge.Callbacks("once memory"),y=g.statusCode||{},v={},b={},T="canceled",P={readyState:0,getResponseHeader:function(e){var t;if(d){if(!s)for(s={};t=kt.exec(n);)s[t[1].toLowerCase()+" "]=(s[t[1].toLowerCase()+" "]||[]).concat(t[2]);t=s[e.toLowerCase()+" "]}return null==t?null:t.join(", ")},getAllResponseHeaders:function(){return d?n:null},setRequestHeader:function(e,t){return null==d&&(e=b[e.toLowerCase()]=b[e.toLowerCase()]||e,v[e]=t),this},overrideMimeType:function(e){return null==d&&(g.mimeType=e),this},statusCode:function(e){var t;if(e)if(d)P.always(e[P.status]);else for(t in e)y[t]=[y[t],e[t]];return this},abort:function(e){var t=e||T;return a&&a.abort(t),i(0,t),this}};if(I.promise(P),g.url=((t||g.url||_t.href)+"").replace(Gt,_t.protocol+"//"),g.type=r.method||r.type||g.method||g.type,g.dataTypes=(g.dataType||"*").toLowerCase().match(Se)||[""],null==g.crossDomain){c=ue.createElement("a");try{c.href=g.url,c.href=c.href,g.crossDomain=Yt.protocol+"//"+Yt.host!=c.protocol+"//"+c.host}catch(e){g.crossDomain=!0}}if(g.data&&g.processData&&"string"!=typeof g.data&&(g.data=ge.param(g.data,g.traditional)),z(Ft,g,r,P),d)return P;for(p in(u=ge.event&&g.global)&&0==ge.active++&&ge.event.trigger("ajaxStart"),g.type=g.type.toUpperCase(),g.hasContent=!xt.test(g.type),o=g.url.replace(Mt,""),g.hasContent?g.data&&g.processData&&0===(g.contentType||"").indexOf("application/x-www-form-urlencoded")&&(g.data=g.data.replace(wt,"+")):(h=g.url.slice(o.length),g.data&&(g.processData||"string"==typeof g.data)&&(o+=(Ot.test(o)?"&":"?")+g.data,delete g.data),!1===g.cache&&(o=o.replace(Ut,"$1"),h=(Ot.test(o)?"&":"?")+"_="+At.guid++ +h),g.url=o+h),g.ifModified&&(ge.lastModified[o]&&P.setRequestHeader("If-Modified-Since",ge.lastModified[o]),ge.etag[o]&&P.setRequestHeader("If-None-Match",ge.etag[o])),(g.data&&g.hasContent&&!1!==g.contentType||r.contentType)&&P.setRequestHeader("Content-Type",g.contentType),P.setRequestHeader("Accept",g.dataTypes[0]&&g.accepts[g.dataTypes[0]]?g.accepts[g.dataTypes[0]]+("*"!==g.dataTypes[0]?", "+Vt+"; q=0.01":""):g.accepts["*"]),g.headers)P.setRequestHeader(p,g.headers[p]);if(g.beforeSend&&(!1===g.beforeSend.call(f,P,g)||d))return P.abort();if(T="abort",E.add(g.complete),P.done(g.success),P.fail(g.error),a=z(Ht,g,r,P)){if(P.readyState=1,u&&m.trigger("ajaxSend",[P,g]),d)return P;g.async&&0<g.timeout&&(l=e.setTimeout(function(){P.abort("timeout")},g.timeout));try{d=!1,a.send(v,i)}catch(e){if(d)throw e;i(-1,e)}}else i(-1,"No Transport");return P},getJSON:function(e,t,r){return ge.get(e,t,r,"json")},getScript:function(e,t){return ge.get(e,void 0,t,"script")}}),ge.each(["get","post"],function(e,t){ge[t]=function(e,r,i,a){return ce(r)&&(a=a||i,i=r,r=void 0),ge.ajax(ge.extend({url:e,type:t,dataType:a,data:r,success:i},ge.isPlainObject(e)&&e))}}),ge.ajaxPrefilter(function(e){var t;for(t in e.headers)"content-type"===t.toLowerCase()&&(e.contentType=e.headers[t]||"")}),ge._evalUrl=function(e,t,r){return ge.ajax({url:e,type:"GET",dataType:"script",cache:!0,async:!1,global:!1,converters:{"text script":function(){}},dataFilter:function(e){ge.globalEval(e,t,r)}})},ge.fn.extend({wrapAll:function(e){var t;return this[0]&&(ce(e)&&(e=e.call(this[0])),t=ge(e,this[0].ownerDocument).eq(0).clone(!0),this[0].parentNode&&t.insertBefore(this[0]),t.map(function(){for(var e=this;e.firstElementChild;)e=e.firstElementChild;return e}).append(this)),this},wrapInner:function(e){return ce(e)?this.each(function(t){ge(this).wrapInner(e.call(this,t))}):this.each(function(){var t=ge(this),r=t.contents();r.length?r.wrapAll(e):t.append(e)})},wrap:function(e){var t=ce(e);return this.each(function(r){ge(this).wrapAll(t?e.call(this,r):e)})},unwrap:function(e){return this.parent(e).not("body").each(function(){ge(this).replaceWith(this.childNodes)}),this}}),ge.expr.pseudos.hidden=function(e){return!ge.expr.pseudos.visible(e)},ge.expr.pseudos.visible=function(e){return!!(e.offsetWidth||e.offsetHeight||e.getClientRects().length)},ge.ajaxSettings.xhr=function(){try{return new e.XMLHttpRequest}catch(e){}};var Bt={0:200,1223:204},qt=ge.ajaxSettings.xhr();le.cors=!!qt&&"withCredentials"in qt,le.ajax=qt=!!qt,ge.ajaxTransport(function(t){var r,i;if(le.cors||qt&&!t.crossDomain)return{send:function(a,o){var n,s=t.xhr();if(s.open(t.type,t.url,t.async,t.username,t.password),t.xhrFields)for(n in t.xhrFields)s[n]=t.xhrFields[n];for(n in t.mimeType&&s.overrideMimeType&&s.overrideMimeType(t.mimeType),t.crossDomain||a["X-Requested-With"]||(a["X-Requested-With"]="XMLHttpRequest"),a)s.setRequestHeader(n,a[n]);r=function(e){return function(){r&&(r=i=s.onload=s.onerror=s.onabort=s.ontimeout=s.onreadystatechange=null,"abort"===e?s.abort():"error"===e?"number"!=typeof s.status?o(0,"error"):o(s.status,s.statusText):o(Bt[s.status]||s.status,s.statusText,"text"!==(s.responseType||"text")||"string"!=typeof s.responseText?{binary:s.response}:{text:s.responseText},s.getAllResponseHeaders()))}},s.onload=r(),i=s.onerror=s.ontimeout=r("error"),void 0!==s.onabort?s.onabort=i:s.onreadystatechange=function(){4===s.readyState&&e.setTimeout(function(){r&&i()})},r=r("abort");try{s.send(t.hasContent&&t.data||null)}catch(e){if(r)throw e}},abort:function(){r&&r()}}}),ge.ajaxPrefilter(function(e){e.crossDomain&&(e.contents.script=!1)}),ge.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/\b(?:java|ecma)script\b/},converters:{"text script":function(e){return ge.globalEval(e),e}}}),ge.ajaxPrefilter("script",function(e){void 0===e.cache&&(e.cache=!1),e.crossDomain&&(e.type="GET")}),ge.ajaxTransport("script",function(e){var t,r;if(e.crossDomain||e.scriptAttrs)return{send:function(i,a){t=ge("<script>").attr(e.scriptAttrs||{}).prop({charset:e.scriptCharset,src:e.url}).on("load error",r=function(e){t.remove(),r=null,e&&a("error"===e.type?404:200,e.type)}),ue.head.appendChild(t[0])},abort:function(){r&&r()}}});var jt,Wt=[],$t=/(=)\?(?=&|$)|\?\?/;ge.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=Wt.pop()||ge.expando+"_"+At.guid++;return this[e]=!0,e}}),ge.ajaxPrefilter("json jsonp",function(t,r,i){var a,o,n,s=!1!==t.jsonp&&($t.test(t.url)?"url":"string"==typeof t.data&&0===(t.contentType||"").indexOf("application/x-www-form-urlencoded")&&$t.test(t.data)&&"data");if(s||"jsonp"===t.dataTypes[0])return a=t.jsonpCallback=ce(t.jsonpCallback)?t.jsonpCallback():t.jsonpCallback,s?t[s]=t[s].replace($t,"$1"+a):!1!==t.jsonp&&(t.url+=(Ot.test(t.url)?"&":"?")+t.jsonp+"="+a),t.converters["script json"]=function(){return n||ge.error(a+" was not called"),n[0]},t.dataTypes[0]="json",o=e[a],e[a]=function(){n=arguments},i.always(function(){void 0===o?ge(e).removeProp(a):e[a]=o,t[a]&&(t.jsonpCallback=r.jsonpCallback,Wt.push(a)),n&&ce(o)&&o(n[0]),n=o=void 0}),"script"}),le.createHTMLDocument=((jt=ue.implementation.createHTMLDocument("").body).innerHTML="<form></form><form></form>",2===jt.childNodes.length),ge.parseHTML=function(e,t,r){return"string"!=typeof e?[]:("boolean"==typeof t&&(r=t,t=!1),t||(le.createHTMLDocument?((i=(t=ue.implementation.createHTMLDocument("")).createElement("base")).href=ue.location.href,t.head.appendChild(i)):t=ue),o=!r&&[],(a=ye.exec(e))?[t.createElement(a[1])]:(a=v([e],t,o),o&&o.length&&ge(o).remove(),ge.merge([],a.childNodes)));var i,a,o},ge.fn.load=function(e,t,r){var i,a,o,n=this,s=e.indexOf(" ");return-1<s&&(i=q(e.slice(s)),e=e.slice(0,s)),ce(t)?(r=t,t=void 0):t&&"object"==typeof t&&(a="POST"),0<n.length&&ge.ajax({url:e,type:a||"GET",dataType:"html",data:t}).done(function(e){o=arguments,n.html(i?ge("<div>").append(ge.parseHTML(e)).find(i):e)}).always(r&&function(e,t){n.each(function(){r.apply(this,o||[e.responseText,t,e])})}),this},ge.expr.pseudos.animated=function(e){return ge.grep(ge.timers,function(t){return e===t.elem}).length},ge.offset={setOffset:function(e,t,r){var i,a,o,n,s,l,c=ge.css(e,"position"),d=ge(e),u={};"static"===c&&(e.style.position="relative"),s=d.offset(),o=ge.css(e,"top"),l=ge.css(e,"left"),("absolute"===c||"fixed"===c)&&-1<(o+l).indexOf("auto")?(n=(i=d.position()).top,a=i.left):(n=parseFloat(o)||0,a=parseFloat(l)||0),ce(t)&&(t=t.call(e,r,ge.extend({},s))),null!=t.top&&(u.top=t.top-s.top+n),null!=t.left&&(u.left=t.left-s.left+a),"using"in t?t.using.call(e,u):("number"==typeof u.top&&(u.top+="px"),"number"==typeof u.left&&(u.left+="px"),d.css(u))}},ge.fn.extend({offset:function(e){if(arguments.length)return void 0===e?this:this.each(function(t){ge.offset.setOffset(this,e,t)});var t,r,i=this[0];return i?i.getClientRects().length?(t=i.getBoundingClientRect(),r=i.ownerDocument.defaultView,{top:t.top+r.pageYOffset,left:t.left+r.pageXOffset}):{top:0,left:0}:void 0},position:function(){if(this[0]){var e,t,r,i=this[0],a={top:0,left:0};if("fixed"===ge.css(i,"position"))t=i.getBoundingClientRect();else{for(t=this.offset(),r=i.ownerDocument,e=i.offsetParent||r.documentElement;e&&(e===r.body||e===r.documentElement)&&"static"===ge.css(e,"position");)e=e.parentNode;e&&e!==i&&1===e.nodeType&&((a=ge(e).offset()).top+=ge.css(e,"borderTopWidth",!0),a.left+=ge.css(e,"borderLeftWidth",!0))}return{top:t.top-a.top-ge.css(i,"marginTop",!0),left:t.left-a.left-ge.css(i,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){for(var e=this.offsetParent;e&&"static"===ge.css(e,"position");)e=e.offsetParent;return e||Ge})}}),ge.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(e,t){var r="pageYOffset"===t;ge.fn[e]=function(i){return Ae(this,function(e,i,a){var o;return de(e)?o=e:9===e.nodeType&&(o=e.defaultView),void 0===a?o?o[t]:e[i]:void(o?o.scrollTo(r?o.pageXOffset:a,r?a:o.pageYOffset):e[i]=a)},e,i,arguments.length)}}),ge.each(["top","left"],function(e,t){ge.cssHooks[t]=w(le.pixelPosition,function(e,r){if(r)return r=L(e,t),rt.test(r)?ge(e).position()[t]+"px":r})}),ge.each({Height:"height",Width:"width"},function(e,t){ge.each({padding:"inner"+e,content:t,"":"outer"+e},function(r,i){ge.fn[i]=function(a,o){var n=arguments.length&&(r||"boolean"!=typeof a),s=r||(!0===a||!0===o?"margin":"border");return Ae(this,function(t,r,a){var o;return de(t)?0===i.indexOf("outer")?t["inner"+e]:t.document.documentElement["client"+e]:9===t.nodeType?(o=t.documentElement,Math.max(t.body["scroll"+e],o["scroll"+e],t.body["offset"+e],o["offset"+e],o["client"+e])):void 0===a?ge.css(t,r,s):ge.style(t,r,a,s)},t,n?a:void 0,n)}})}),ge.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(e,t){ge.fn[t]=function(e){return this.on(t,e)}}),ge.fn.extend({bind:function(e,t,r){return this.on(e,null,t,r)},unbind:function(e,t){return this.off(e,null,t)},delegate:function(e,t,r,i){return this.on(t,e,r,i)},undelegate:function(e,t,r){return 1===arguments.length?this.off(e,"**"):this.off(t,e||"**",r)},hover:function(e,t){return this.mouseenter(e).mouseleave(t||e)}}),ge.each("blur focus focusin focusout resize scroll click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup contextmenu".split(" "),function(e,t){ge.fn[t]=function(e,r){return 0<arguments.length?this.on(t,null,e,r):this.trigger(t)}});var Kt=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;ge.proxy=function(e,t){var r,i,a;if("string"==typeof t&&(r=e[t],t=e,e=r),ce(e))return i=Z.call(arguments,2),(a=function(){return e.apply(t||this,i.concat(Z.call(arguments)))}).guid=e.guid=e.guid||ge.guid++,a},ge.holdReady=function(e){e?ge.readyWait++:ge.ready(!0)},ge.isArray=Array.isArray,ge.parseJSON=JSON.parse,ge.nodeName=o,ge.isFunction=ce,ge.isWindow=de,ge.camelCase=h,ge.type=i,ge.now=Date.now,ge.isNumeric=function(e){var t=ge.type(e);return("number"===t||"string"===t)&&!isNaN(e-parseFloat(e))},ge.trim=function(e){return null==e?"":(e+"").replace(Kt,"")},"function"==typeof define&&define.amd&&define("jquery",[],function(){return ge});var zt=e.jQuery,Qt=e.$;return ge.noConflict=function(t){return e.$===ge&&(e.$=Qt),t&&e.jQuery===ge&&(e.jQuery=zt),ge},"undefined"==typeof t&&(e.jQuery=e.$=ge),ge}),define("spinner",["knockout","imagesloaded"],function(e,t){"use strict";function r(){var e=this;e.spinnerId="cc-spinner",e.spinnerContainer="cc-spinner",e.spinnerCSS="cc-spinner-css",e.spinnerTimeOutId=null,e.create=function(t){return e.time=(new Date).getTime(),e.parent=t.parent,e.selector=t.selector?t.selector:t.parent,e.centerOn=t.centerOn,e.posTop=t.posTop?t.posTop:"50%",e.posLeft=t.posLeft?t.posLeft:"44%",e.loadingText=t.loadingText?t.loadingText:"Loading...",e.processingText=t.processingText,e.processingPosTop=t.processingPosTop?t.processingPosTop:"5%",e.textWidth=t.textWidth?t.textWidth:"100%",!!e.parent&&("body"===e.parent&&(e.centerOn&&0!==$(e.centerOn).length?(e.posTop=$(e.centerOn).height()/2-27+$(e.centerOn).position().top+"px",e.processingPosTop=$(e.centerOn).height()/2-54+$(e.centerOn).position().top+"px",e.posLeft=$(e.centerOn).width()/2-27+$(e.centerOn).position().left+"px"):(e.posTop=$(window).height()/2-27+"px",e.processingPosTop=$(window).height()/2-54+"px",e.posLeft=$(window).width()/2-27+"px")),void(0===$(e.selector).find("."+e.spinnerContainer).not(".cc-spinner-exclude").length&&(e.buildCSS(e.selector,e.posTop,e.posLeft),t.createWithTimeout&&e.setDestroyTimeoutWithId(t.parent,t.waitTime,t.callBackFn,t.context))))},e.buildCSS=function(t,r,i){var a,o;a=$("<div />").attr({id:e.spinnerId,class:e.spinnerContainer}),o=$("<div />").attr({class:e.spinnerCSS,style:"top:"+r+";left:"+i});for(var n=1;n<13;n++)$(o).append($("<div />").attr({class:e.spinnerCSS+"-"+n}));e.processingText?$(a).prepend($("<div/>").css("padding-top",e.processingPosTop).append($('<span class="center-block"/>').css("width",e.textWidth).text(e.processingText))):$(o).prepend($('<span class="ie-show">').text(e.loadingText)),$(a).append(o),"body"===t?$(t).prepend(a):$(t).append(a)},e.loadCheck=function(t,r){var i=e.parent,a=e.selector;r&&(i=r.parent?r.parent:r.parent,a=r.selector?r.selector:i),(t||0==t)&&(0===$(a).find("."+e.spinnerContainer).length&&e.buildCSS(a,e.posTop,e.posLeft),$(i+" img")?$(i+" img").imagesLoaded(function(){0!==$(a).find("."+e.spinnerContainer).not(".cc-spinner-exclude").length&&e.destroy(t,i,a)}):e.destroy(t,i,a))},e.destroy=function(t,r,i){var a,o,i=i?i:e.parent,r=r?r:e.parent;e.spinnerContainer;a=e.time+250-(new Date).getTime(),$(r).children().length===t?a>0?o=setTimeout(e.destroyWithoutDelay,a):e.destroyWithoutDelay(i):t&&null!==t?setTimeout(e.destroy,1):a>0?o=setTimeout(e.destroyWithoutDelay(i),a):e.destroyWithoutDelay(i)},e.destroyWithoutDelay=function(t){var r=t?t:e.selector,i=e.spinnerContainer;$(r).find("."+i).remove()},e.createWithTimeout=function(t,r,i,a){t.waitTime=r,t.callBackFn=i,t.context=a,t.createWithTimeout=!0,e.create(t)},e.destroyAndClearTimeout=function(t,r){e.destroyWithoutDelay(),null!=e.spinnerTimeOutId&&clearTimeout(e.spinnerTimeOutId),null!=t&&t.call(r)},e.destroyAndClearCreateTimeout=function(t){e.destroyWithoutDelay(t),null!=e.spinnerTimeOutId&&clearTimeout(e.spinnerTimeOutId)},e.setDestroyTimeout=function(t,r,i){e.spinnerTimeOutId=setTimeout(function(){e.destroyWithoutDelay(),null!=r&&r.call(i)},t)},e.createAndReturnWithTimeout=function(t,r,i,a){return e.create(t),e.setDestroyTimeout(r,i,a),e.spinnerTimeOutId},e.destroyAndClearTimeoutWithId=function(t,r,i,a){e.destroyWithoutDelay(t),null!=r&&clearTimeout(r),null!=i&&i.call(a)},e.setDestroyTimeoutWithId=function(t,r,i,a){e.spinnerTimeOutId=setTimeout(function(){e.destroyWithoutDelay(t),null!=i&&i.call(a)},r)}}return new r}),define("pubsubImpl",["jquery"],function(){"use strict";function e(){this.topics={}}return e.prototype.topic=function(e){var t,r=e&&this.topics[e],i="unique";return r||(/\.memory/.test(e)&&(i+=" memory"),t=$.Callbacks(i),window.pubsubevents=t,r={publish:t.fire,publishWith:t.fireWith,subscribe:t.add,unsubscribe:t.remove},e&&(this.topics[e]=r)),r},e}),define("pubsub",["pubsubImpl","jquery"],function(e){"use strict";var t={REGISTER_SUBMIT:"register.submit",REGISTER_SUCCESS:"register.success",REGISTER_FAILURE:"register.failure",CART_ADD:"cart.add",CART_REMOVE:"cart.remove",CART_UPDATE_QUANTITY:"cart.updatequantity",CART_READY:"cart.ready",CART_UPDATED:"cart.updated",CART_UPDATED_PENDING_PAYMENT:"cart.updated.pendingpayment",CART_ADD_SUCCESS:"cart.add.success",CART_UPDATE_SUCCESS:"cart.update.success",CART_PRICE_COMPLETE:"cart.price.complete",CART_PRICING_BLOCKED:"cart.pricing.blocked",CART_EDIT_ADD_ON:"cart.edit.add.on",CART_SAVE_ADD_ON:"cart.save.add.on",CART_DELETE_ADD_ON:"cart.delete.add.on",CART_EDIT_ADD_ONS_AT_CART:"cart.edit.add.ons.at.cart",CART_SAVE_ADD_ONS_AT_CART:"cart.save.add.ons.at.cart",REFRESH_USER_CART:"cart.refresh",REMOVE_INVALID_ITEMS:"cart.remove.invalid.items",CART_REMOVE_SUCCESS:"cart.remove.success",CART_UPDATE_QUANTITY_SUCCESS:"cart.updatequantity.success",MINI_CART_SHOW:"mini.cart.show",MINI_CART_HIDE:"mini.cart.hide",USER_LOAD_CART:"user.cart.load",CART_ADD_SUCCESS_CPQ:"cart.add.success.cpq",CART_CHILD_ITEM_SELECTED:"cart.child.item.selected",CART_DETAILS_CHILD_ITEM_SELECTED:"cart.details.child.item.selected",CART_PRICE_SUCCESS:"cart.price.success",CART_LOADED:"cart.loaded",CART_LOADED_FOR_PROFILE:"cart.loaded.for.profile",DEFERRED_CART_LOAD:"deferred.cart.load.memory",SHIPPING_GROUP_REMOVE_SUCCESS:"cart.item.shipping.group.remove.success",PAGE_VIEW_CHANGED:"page.view.changed",PAGE_CONTEXT_CHANGED:"page.context.changed",PAGE_CHANGED:"page.changed.memory",PAGE_READY:"page.ready.memory",PAGE_METADATA_CHANGED:"page.metadata.changed",PAGE_LAYOUT_LOADED:"page.layout.loaded.memory",PAGE_LAYOUT_SERVER_ERROR:"page.layout.server.error",PAGE_LAYOUT_UPDATED:"page.layout.updated.memory",PAGE_PARAMETERS_CHANGED:"page.parameters.changed",PAGE_PARAMETERS:"page.parameters.memory",PAGE_PAGINATION_CHANGE:"page.pagination.change.memory",PAGE_PAGINATION_CALCULATED:"page.pagination.calculated.memory",RECORD_PAGINATION_PAGE_CHANGE:"record.pagination.page.changed",UPDATE_HASH_CHANGES:"update.hash.changes.memory",HISTORY_PUSH_STATE:"history.push.state.memory",REGION_METADATA_CHANGED:"region.metadata.changed.memory",AUTH_LOGIN_SUBMIT:"auth.login.submit",AUTH_LOGIN_SUCCESS:"auth.login.success",AUTH_LOGIN_FAILURE:"auth.login.failure",AUTH_LOGOUT_SUBMIT:"auth.logout.submit",AUTH_LOGOUT_SUCCESS:"auth.logout.success",
- AUTH_LOGOUT_FAILURE:"auth.logout.failure",AUTH_REQUEST_FAILURE:"auth.request.failure",USER_CREATION_FAILURE:"user.creation.failure.memory",USER_LOGIN_SUCCESSFUL:"user.login.successful",USER_LOGIN_FAILURE:"user.login.failure",SAML_LOGIN_SUCCESSFUL:"user.saml.login.successful.memory",SAML_LOGIN_FAILURE:"user.saml.login.failure.memory",OPENID_LOGIN_SUCCESSFUL:"user.openid.login.successful.memory",OPENID_LOGIN_FAILURE:"user.openid.login.failure.memory",USER_LOGOUT_SUCCESSFUL:"user.logout.successful",USER_LOGOUT_FAILURE:"user.logout.failure",USER_REGISTRATION_SUBMIT:"user.registration.submit",USER_LOGOUT_SUBMIT:"user.logout.submit",USER_LOGIN_SUBMIT:"user.login.submit",USER_LOGIN_CANCEL:"user.login.cancel",USER_LOAD_SHIPPING:"user.load.shipping",USER_PROFILE_LOADED:"user.profile.loaded",USER_PROFILE_UPDATE_SUCCESSFUL:"user.profile.update.successful.memory",USER_PROFILE_PASSWORD_UPDATE_SUCCESSFUL:"user.profile.pwd.update.successful",USER_PROFILE_PASSWORD_UPDATE_FAILURE:"user.profile.pwd.update.failure",USER_PROFILE_UPDATE_FAILURE:"user.profile.update.failure.memory",USER_PROFILE_UPDATE_SUBMIT:"user.profile.update.submit",USER_PROFILE_UPDATE_CANCEL:"user.profile.update.cancel",USER_PROFILE_UPDATE_INVALID:"user.profile.update.invalid",USER_PROFILE_UPDATE_NOCHANGE:"user.profile.update.nochange",USER_PROFILE_ADDRESSES_REMOVED:"user.profile.addresses.removed",USER_AUTO_LOGIN_SUCCESSFUL:"user.auto.login.successful",USER_ACCOUNT_CREATION_MESSAGE:"user.account.creation.message",AUTO_LOGIN_AND_GET_USER_DATA_SUCCESSFUL:"auto.login.and.get.user.data.successful",USER_AUTO_LOGIN_FAILURE:"user.auto.login.failure.memory",USER_PROFILE_PASSWORD_UPDATE:"user.profile.password.update",USER_UNAUTHORIZED:"user.unauthorized.memory",USER_SESSION_EXPIRED:"user.session.expired.memory",USER_SESSION_VALID:"user.session.validated.memory",USER_SESSION_RESET:"user.session.reset",USER_PROFILE_SESSION_RESET:"user.profile.session.reset",USER_CLEAR_CART:"user.clear.cart",USER_RESET_PASSWORD_FAILURE:"user.reset.password.failure",USER_RESET_PASSWORD_SUCCESS:"user.reset.password.success",USER_PASSWORD_EXPIRED:"user.password.expired",USER_PASSWORD_GENERATED:"user.password.generated",USER_NETWORK_ERROR:"user.network.error",USER_LOCALE_NOT_SUPPORTED:"user.locale.not.supported",UPDATE_USER_LOCALE_NOT_SUPPORTED_ERROR:"update.user.locale.not.supported.error.memory",DISCARD_ADDRESS_CHANGES:"discard.address.changes",USER_LOYALTY_DETAILS_UPDATED:"user.loyalty.details.updated",PURCHASE_LIST_FETCH_SUCCESS:"purchase.list.fetch.success",FETCH_PURCHASE_LIST_AFTER_DELETE:"fetch.purchase.list.after.delete",ADD_TO_PURCHASE_LIST:"add.to.purchase.list",PRODUCT_ADDED_TO_PURCHASE_LIST_SUCCESS:"product.added.to.purchase.list.success",ADD_ITEM_TO_PURCHASE_LIST:"add.item.to.purchase.list",PRODUCT_VIEWED:"product.viewed.memory",SKU_SELECTED:"sku.selected",PRODUCTS_PER_ROW_CHANGES:"products.per.row.changed",UPDATE_FOCUS:"update.focus.memory",UPDATE_LISTING_FOCUS:"update.listing.focus.memory",ITEM_TRIGGER_RECONFIGURE:"item.trigger.reconfigure",CHECKOUT_BILLING_ADDRESS:"checkout.billing.address",CHECKOUT_SHIPPING_ADDRESS:"checkout.shipping.address",CHECKOUT_SHIPPING_ADDRESS_UPDATED:"checkout.shipping.address.updated",PAYPAL_SHIPPING_ADDRESS_ALTERED:"paypal.shipping.address.altered",ADD_NEW_CHECKOUT_SHIPPING_ADDRESS:"add.new.checkout.shipping.address",CART_SHIPPING_ADDRESS_UPDATED:"cart.shipping.address.updated",USER_SELECTED_SHIPPING_ADDRESS_UPDATED:"user.selected.shipping.address.updated",BILLING_ADDRESS_POPULATED:"billing.address.populated.memory",SHIPPING_ADDRESS_POPULATED:"shipping.address.populated.memory",PAYPAL_CHECKOUT_SHIPPING_ADDRESS:"paypal.checkout_shipping_address",EXTERNAL_CHECKOUT_BILLING_ADDRESS:"external.checkout_billing_address",LOADED_ORDER_SHIPPING_ADDRESS:"loaded.order.shipping.address.memory",GET_INITIAL_ORDER_FAIL:"order.retrieval.fail",WEB_CHECKOUT_SHIPPING_ADDRESS:"web.checkout.shipping.address",CHECKOUT_SAVE_SHIPPING_ADDRESS:"checkout.save.shipping.address",LOAD_ORDER_RESET_ADDRESS:"load.order.reset.address",CONTINUE_TO_PAYPAL:"continue.to.paypal",PAYPAL_EMAIL_VALIDATION:"paypal.email.validation",CHECKOUT_SHIPPING_ADDRESS_INVALID:"checkout.shipping.address.invalid",CHECKOUT_SHIPPING_METHOD:"checkout.shipping.method",PAYPAL_CHECKOUT_SHIPPING_METHOD_VALUE:"paypal.checkout.shipping.method.value",PAYPAL_CHECKOUT_NO_SHIPPING_METHOD:"paypal.checkout.no.shipping.method",CHECKOUT_RESET_SHIPPING_METHOD:"checkout.reset.shipping.method",CHECKOUT_EMAIL_ADDRESS:"checkout.email.address.memory",CHECKOUT_VALIDATE_NOW:"checkout.validate.now",CHECKOUT_NOT_VALID:"checkout.not.valid",CHECKOUT_PAYMENT_DETAILS:"checkout.payment.details",CHECKOUT_REGISTER_USER:"checkout.register.user",CHECKOUT_USER_LOCALE:"checkout.user.locale",ORDER_CREATE:"order.create",ORDER_CREATED:"order.created",ORDER_CREATED_INITIAL:"order.created.initial",ORDER_RETRIEVED_INITIAL:"order.retrieved.initial",ORDER_COMPLETED:"order.completed",ORDER_SUBMISSION_FAIL:"order.submission.fail",ORDER_SUBMISSION_SUCCESS:"order.submission.success",ORDER_AUTHORIZE_PAYMENT:"order.payment.auth.memory",ORDER_SECONDARY_INFO_LOADED:"order.secondary.info.loaded.memory",ORDER_PRICING_FAILED:"order.pricing.failed",ORDER_PRICING_SUCCESS:"order.pricing.success",DESTROY_SHIPPING_METHODS_SPINNER:"destroy_shipping_methods_spinner",DESTROY_SHIPPING_OPTIONS_SPINNER:"destroy.shipping.options.spinner",DESTROY_SHOPPING_CART_SPINNER:"destroy.shopping.cart.spinner",ORDERS_GET_HISTORY_FAILED:"orders.getOrderHistory.failed",ORDERS_GET_PENDING_APPROVAL_LIST_FAILED:"orders.getPendingApprovalList.failed",POPULATE_SHIPPING_METHODS:"populate.shipping.methods",PAYMENT_AUTH_SUCCESS:"payment.auth.success",PAYMENT_AUTH_DECLINED:"payment.auth.declined",PAYMENT_AUTH_TIMED_OUT:"payment.auth.timedout",PAYMENT_GET_AUTH_RESPONSE:"payment.auth.getresponse",PAYMENTS_DISABLED:"payments.disabled",PAYULATAM_WEB_CHECKOUT:"payulatam.web.checkout",SAVE_CART_BEFORE_REFRESH:"save.cart.before.refresh",CYBERSOURCE_PA_CHALLENGE_CODE_REQUIRED:"cybersource.pa.challenge.code.required",SCHEDULE_ORDERS_LIST_FAILED:"scheduleorders.scheduleOrderList.failed",SCHEDULED_ORDER_SUBMISSION_SUCCESS:"scheduledorder.submission.success",SCHEDULED_ORDER_LOAD_SCUCCESS:"scheduledorder.load.success",SCHEDULED_ORDER_LOAD_ERROR:"scheduledorder.load.error",ADD_TO_QUICK_ORDER:"quick.order.add.item",REFRESH_ORDER_DETAILS:"refresh.order.details",APPROVE_ORDER_DETAILS_SUCCESS:"approve.order.details.success",REJECT_ORDER_SUCCESS:"reject.order.success",SCHEDULED_ORDER_LOAD_SUCCESS_AGENT:"scheduled.order.load.success.agent",REREQUEST_REJECT_QUOTE_ORDER_SUCCESS:"rerequest.reject.quote.order.success",SEARCH_CREATE:"search.create",SEARCH_CREATE_CATEGORY_LISTING:"search.create.listing",SEARCH_RESULTS_UPDATED:"search.results.updated.memory",SEARCH_RESULTS_FOR_CATEGORY_UPDATED:"search.results.category.updated.memory",SEARCH_TYPEAHEAD:"search.typeahead",SEARCH_TYPEAHEAD_UPDATED:"search.typeahead.updated",SEARCH_TYPEAHEAD_CANCEL:"search.typeahead.cancel",SEARCH_TERM:"search.terms.memory",SEARCH_FAILED_TO_PERFORM:"search.failed.memory",OVERLAYED_GUIDEDNAVIGATION_HIDE:"overlayed.guidednavigation.hide",OVERLAYED_GUIDEDNAVIGATION_SHOW:"overlayed.guidednavigation.show",OVERLAYED_GUIDEDNAVIGATION_CLEAR:"guidednavigation.clear.memory",COUPON_ADD_CLEAR_INPUT:"add.coupon.clearInput",COUPON_APPLY_SUCCESSFUL:"add.coupon.successful",COUPON_DELETE_SUCCESSFUL:"delete.coupon.successful",GIFTCARD_UPDATE_FROM_CART:"giftcard.updateGiftCards",UPDATE_AMOUNT_REMAINING:"giftcard.update.amountRemaining",GIFTCARD_PRICING_FAILED:"giftcard.pricing.failed",GIFTCARD_REAPPLY_PINS:"giftcard.reapply.pins",SHOW_GIFT_CARD_ERROR_PANEL:"giftcard.error.panel",UPDATE_AMOUNT_REMAINING_PENDING_PAYMENT:"giftcard.update.amountRemainingPendingPayment",ADMIN_CONTENT_LANGUAGE_CHANGED:"admin.content.language.changed",ADMIN_USER_UPDATE:"admin.user.update",ADMIN_AUTH_API_UNAUTHORIZED:"admin.auth.api-unauthorized",ADMIN_AUTH_SSO_REFRESH:"admin.auth.sso-refresh",ADMIN_AUTH_SSO_SUCCESS:"admin.auth.sso-refresh-success",ADMIN_AUTH_SSO_FAILURE:"admin.auth.sso-refresh-failure",PRODUCT_EDIT:"catalog.product.edit",PRODUCT_EDIT_CREATE_PERSIST:"catalog.product.persist",PRODUCT_EDIT_CREATE_SUCCESS:"catalog.product.success",PRODUCT_EDIT_CREATE_ERROR:"catalog.product.error",PRODUCT_FILTER_MODE:"catalog.product.filter.mode",PRODUCT_VIEW_UPDATE_REQUESTED:"catalog.view.updateRequested",PRODUCT_VIEW_UPDATED:"catalog.view.updated",PRODUCT_VIEW_CLEAR_DATA:"catalog.view.clearData",PRODUCT_VIEW_SET_DATA:"catalog.view.setData",PRODUCT_PRICE_CHANGED:"product.price.changed",PRODUCT_SKUS_UPDATED:"product.skus.updated",PRODUCT_LISTING_CONFIGS_UPDATED:"product.listingConfigs.updated",CATALOG_VIEW_MODE_CHANGED:"catalog.view.mode.changed",COLLECTION_EDIT:"catalog.collection.edit",COLLECTION_CREATE:"catalog.collection.create",COLLECTION_REFRESH_GRID:"catalog.collection.refresh.grid",COLLECTION_EDIT_CREATE_PERSIST:"catalog.collection.persist",COLLECTION_EDIT_CREATE_SUCCESS:"catalog.collection.editcreate.success",COLLECTION_DELETE_SUCCESS:"catalog.collection.delete.success",COLLECTION_EDIT_CREATE_ERROR:"catalog.collection.error",COLLECTION_REMOVE_PRODUCT:"catalog.collection.remove.product",COLLECTION_REORDER_PRODUCTS:"catalog.collection.reorder.products",COLLECTION_REORDER_PRODUCTS_SUCCESS:"catalog.collection.reorder.products.success",COLLECTION_REORDER_PRODUCTS_ERROR:"catalog.collection.reorder.products.error",COLLECTION_RELOAD_PRODUCTLIST:"catalog.collection.reload.productlist",COLLECTION_IMPORT:"catalog.category.import",COLLECTION_ADD_PRODUCTS_SUCCESS:"catalog.collection.add.products.success",PRODUCT_TO_CATEGORY_DROP:"catalog.product.category.drop",PRODUCT_DEFINITION_UPDATE:"catalog.product.definition.update",PRODUCT_SHOPPER_INPUT_DEFINITION_UPDATE:"catalog.product.shopperInput.definition.update",TYPE_PROPERTY_UPDATE:"property.definition.update",PRODUCT_SKU_DEFINITION_UPDATE:"catalog.product.sku.definition.update",LOCALE_AWARE_PRODUCT_DEFINITION_UPDATE:"catalog.product.localeAwareDefinition.update",LOCALE_AWARE_SHOPPER_INPUT_DEFINITION_UPDATE:"catalog.product.localeAwareShopperInputDefinition.update",LOCALE_AWARE_SKU_UPDATE:"catalog.product.localeAwareSku.update",PRODUCT_DEFINITION_UPDATE_PROPERTIES:"catalog.product.definition.update.properties",COLLECTION_DEFINITION_UPDATE:"catalog.collection.definition.update",PRODUCT_TYPE_EDIT_CREATE_PERSIST:"product.type.persist",PRODUCT_TYPE_EDIT_CREATE_SUCCESS:"product.type.success",PRODUCT_TYPE_EDIT_CREATE_ERROR:"product.type.error",PRODUCT_TYPE_UPDATE:"product.type.update",PRODUCT_TYPE_MANAGE_UPDATE:"product.type.manage.update",PRICE_LIST_GROUP_UPDATE:"price.list.group.update",ACCOUNTS_LIST_REFRESH:"accounts.list.refresh",CONTACTS_LIST_REFRESH:"contacts.list.refresh",CONTRACTS_LIST_REFRESH:"contracts.list.refresh",CONTACT_ROLE_CHANGED:"contact.role.changed",ACCOUNT_CONTACTS_LIST_REFRESH:"accounts.contacts.list.refresh",REFRESH_OVERLAY_FOR_CREATE:"refresh.overlay.for.create",REFRESH_OVERLAY_FOR_EDIT:"refresh.overlay.for.edit",REFRESH_ACCOUNT_ADDRESSES:"refresh.account.addresses",SEARCH_RESET:"account.name.reset",REGISTRATION_REQUESTS_LIST_REFRESH:"registration.requests.list.refresh",CONTACT_REQUESTS_LIST_REFRESH:"contact.requests.list.refresh",INVENTORY_REFRESH:"inventory.update",PROMOTION_EDIT:"marketing.promotion.edit",PROMOTION_CLONE:"marketing.promotion.clone",PROMOTION_SELECTION:"marketing.promotion.selection",PROMOTION_LIST_REFRESH:"marketing.promotion.listRefresh",PROMOTION_TEMPLATE_EDITOR_HIDE:"marketing.promotion.templateEditorHide",PROMOTION_TEMPLATE_EDITOR_SHOW:"marketing.promotion.templateEditorShow",PROMOTION_TEMPLATE_EDITOR_CHANGE_VALUE:"marketing.promotion.templateEditorChangeValue",RANKING_RULE_LIST_REFRESH:"search.ranking.listRefresh",FACET_RULE_LIST_REFRESH:"search.facets.listRefresh",STACKING_RULE_LOAD_CREATE:"marketing.stackingRule.loadCreate",STACKING_RULE_LIST_REFRESH:"marketing.stackingRule.listRefresh",AUDIENCE_LOAD_CREATE:"marketing.audience.loadCreate",AUDIENCE_LIST_REFRESH:"marketing.audience.listRefresh",VARIANT_AUDIENCE_LIST_REFRESH:"marketing.variantAudience.listRefresh",LAYOUT_EDIT:"sitestudio.layout.edit",LAYOUT_CLONE:"sitestudio.layout.clone",LAYOUT_EDIT_CREATE_PERSIST:"sitestudio.layout.persist",LAYOUT_EDIT_CREATE_SUCCESS:"sitestudio.layout.success",LAYOUT_EDIT_CREATE_ERROR:"sitestudio.layout.error",LAYOUT_DELETE_SUCCESS:"sitestudio.layout.delete.success",LAYOUT_DEFINITION_UPDATE:"sitestudio.layout.definition.update",LAYOUT_LIST_UPDATE:"sitestudio.layout.list.update",LAYOUT_LIST_HIDE:"sitestudio.layout.list.hide",LAYOUT_REFRESH_DISPLAY:"sitestudio.layout.refresh.display",LAYOUT_REFRESH_COMPLETE:"sitestudio.layout.refresh.complete",LAYOUT_WIDGET_LOADED:"sitestudio.layout.widget.loaded",LAYOUT_STACK_LOADED:"sitestudio.layout.stack.loaded",LAYOUT_SELECTED:"sitestudio.layout.selected",WIDGET_LAYOUT_EDIT:"sitestudio.widget.layout.edit.memory",WIDGET_LIBRARY_HIDE:"sitestudio.widget.library.hide",THEME_UPDATE:"sitestudio.theme.update",CODE_VIEW_MAXIMIZE:"sitestudio.codeview.maximize",CODE_VIEW_MINIMIZE:"sitestudio.codeview.minimize",ORGANIZE_MODE_STATE:"organize.state",STOP_ORGANIZE_MODE:"organize.stop",NOTIFICATION_ADD:"notification.message.add",NOTIFICATION_DELETE:"notification.message.delete",NOTIFICATION_TEMPLATE_ADD:"notification.template.add",ALL_COLLECTIONS_UPDATED:"catalog.allcollections.updated",EXCEPTION_HANDLER:"exception.handler",ONERROR_EXCEPTION_HANDLER:"onerror.exception.handler",LOADING_INDICATOR_ADD:"loading.indicator.add",ARIA_ANNOUNCEMENT_REQUESTED:"aria.announcement.requested",SHIPPING_METHODS_LOADED:"shipping.method.loaded",LOAD_SHIPPING_METHODS_FAILED:"load.shipping.methods.failed",SHIPPING_METHOD_SUCCESS:"shipping.method.success",SHIPPING_METHOD_EDIT:"shipping.method.edit",SHIPPING_METHOD_DEFINITION_UPDATE:"shipping.method.definition.update",RELOAD_SHIPPING_METHODS:"shipping.method.reload",NO_SHIPPING_METHODS:"no.shipping.methods.available",VERIFY_SHIPPING_METHODS:"verify.shipping.methods",INVALID_SHIPPING_METHOD:"invalid.shipping.method",SHIPPING_REGION_LOADED:"shipping.region.loaded",SHIPPING_REGION_SUCCESS:"shipping.region.success",SHIPPING_REGION_EDIT:"shipping.region.edit",SHIPPING_REGION_DEFINITION_UPDATE:"shipping.region.definition.update",RELOAD_SHIPPING_REGIONS:"shipping.region.reload",CATEGORY_GROUP_CHANGED:"category.group.changed",CATEGORY_UPDATED:"category.updated",CATEGORY_CRUMB_UPDATED:"send.category.memory",SHOPPINGCART_VALIDATE_NOW:"shoppingcart.validate.now",LOAD_CHECKOUT:"redirect.checkout.cart",ADMIN_CONTAINER_CONFIGURATION_LOADED:"admin.container.configuration.loaded",EXTERNAL_SERVICE_CONFIGURATION_LOADED:"external.service.configuration.loaded",EXTERNAL_SERVICE_EXPERIMENTS_SIGNON:"external.service.experiments.signon",SOCIAL_SPACE_ADD:"social.space.add",SOCIAL_SPACE_ADD_TO_SELECTED_SPACE:"social.space.add.selected",SOCIAL_SPACE_ADD_SUCCESS:"social.space.add.success",SOCIAL_SPACE_SELECTOR_ADD:"social.space.selector.add",SOCIAL_SPACE_PRODUCT_REMOVED:"social.space.product.removed",SOCIAL_SPACE_PRODUCT_MOVED:"social.space.product.moved",SOCIAL_SPACE_SELECT:"social.space.select",SOCIAL_SPACE_UNAVAILABLE:"social.space.unavailable",SOCIAL_SPACE_DELETED:"social.space.deleted",SOCIAL_SPACE_MEMBER_JOIN:"social.space.member.join",SOCIAL_SPACE_MEMBER_LEFT:"social.space.member.left",SOCIAL_SPACE_MODEL_MEMBERS_CHANGED:"social.space.model.members.changed",SOCIAL_SPACE_MEMBERS_INFO_CHANGED:"social.space.member.info.changed",SOCIAL_REFRESH_SPACES:"social.refresh.spaces",SOCIAL_CURRENT_USER:"social.current.user",SOCIAL_POST_MESSAGE:"social.space.post.message",SOCIAL_FACEBOOK_JS_READY:"social.facebook.js.ready",RECS_WANT_RECS:"recs.display.want.recs.memory",RECS_WHO_WANT_RECS:"recs.display.who.want.recs.memory",RECS_HAVE_RECS:"recs.display.have.recs.memory",RECS_RECOMMENDATIONS_CHANGED:"recs.display.recommendations.changed",ORDER_EDIT_POST_ACTION:"edit.order.post.action",ORDER_EDIT_INIT_ACTION:"edit.order.init.action",RETURN_CCI18N_RESOURCE_LOADED:"return.cci18n.resource.loaded",AGENT_UNSELECT_SHIPPING_METHOD:"shipping.unselect.price.order",AGENT_SELECT_ITEM_FOR_EXCHANGE:"agent.select.item.exchange",SEARCH_SELECTED:"search.selected",LOAD_DEFAULT_CATEGORY:"load.default.category",ON_CLOSE_PDP_MODAL:"on.close.pdp.modal",LOCALE_SET:"cc.locale.set",LOCALE_READY:"cc.locale.ready.memory",SUPPORTED_LOCALES_UPDATE:"supported.locales.update",PAGINATION_PAGE_CHANGE:"pagination.page.change",REPORTING_TIMEFRAME_UPDATED:"reporting.timeframe.updated",REPORTING_SELECTED_SUMMARY_METRIC:"reporting.selected.summaryMetric",REPORTING_FILTER_CHANGES:"reporting.filter.changes.memory",REPORTING_DATA_LOADED:"reporting.data.loaded.memory",REPORTING_MULTIPLE_DAYS_RANGE_SELECTED:"reporting.validdate.selected",REPORTING_SINGLE_DAY_RANGE_SELECTED:"reporting.invaliddate.selected",REPORTING_APPLIED_USER_SELECTIONS_UPDATED:"reporting.applied.user.selections.updated",REPORTING_CURRENCY_LOADED:"reporting.currency.loaded",REPORTING_RESET_FILTERS:"reporting.reset.filters",COLLECTION_SELECTION_CHANGED:"collection.selection.changed",GWP_QUALIFIED_MESSAGE:"gwp.qualified.message",GWP_INVALIDATED_MESSAGE:"gwp.invalidated.message",GWP_CLEAR_QUALIFIED_MESSAGE:"gwp.clear.qualified.message",PLACE_HOLDER_REMOVE:"place.holder.remove",GET_GIFT_CHOICES_SUCCESSFUL:"get.gift.choices.successful",GET_GIFT_CHOICES_FAILURE:"get.gift.choices.failure",GIFT_CHOICES_NOT_AVAILABLE:"gift.choices.not.available",GWP_FAILURE_MESSAGE:"gwp.failure.message",GUIDED_SEARCH_INDEX_FIELDS_REFRESH:"guided.search.index.fields.refresh",ADD_PRODUCTS_TAB_TO_PRICE_GROUP:"add.products.tab.to.price.group",ADD_NEW_NAVIGATION:"add.new.navigation",UPDATE_NAVIGATION:"update.navigation",REMOVE_NAVIGATION:"remove.navigation",NAVIGATE_TO_INTERCEPTED_LINK:"go.to.intercepted.link",SET_IS_NEW_FLAG:"set.is.new.flag",PRICE_GROUP_LIST_REFRESH:"price.groups.list.refresh",DELEGATED_CONTACTS_LIST_FAILED:"delegated.contacts.list.failed",UPDATE_STOREFRONT_ROLE_SUCCESS:"update.storefront.role.success",CART_DELETE_SUCCESS:"cart.delete.success",CART_DELETE_ERROR:"cart.delete.error",MULTICART_LISTING_ERROR:"multicart.listing.error",ACCOUNT_LOGO_ITEM_IMAGE_DELETED:"account.logo.item.image.deleted",DEFAULT_ACCOUNT_MODIFIED:"default.account.modified",SHOPPER_CONTEXT_LOAD_ERROR:"shopper.context.load.failed",OPTION_DATA_RECEIVED:"option.data.received",PUBLISH_START:"publish.start",ACTIVE_WORKSET_CHANGED:"active.workset.changed",ACTIVE_WORKSET_INVALID:"active.workset.invalid",SITE_ADDED:"site.added",SITE_SELECTION_RESET:"site.selection.reset",SITE_SELECTION_CHANGED:"site.selection.changed",USER_PRODUCT_NOTIFICATION_SUCCESS:"user.product.notification.success",USER_PRODUCT_NOTIFICATION_FAILED:"user.product.notification.failed",APPLICATION_CHANGED:"application.changed",LOGIN_VERIFICATION_REQUIRED:"login.verification.required",USER_MFA_LOGIN_SUBMIT:"user.mfa.login.submit",RESEND_VERIFICATION_CODE:"resend.verification.code",USER_MFA_LOGIN_FAILURE:"user.mfa.login.failure"},r=new e;return r.topicNames=t,$.Topic=r.topic.bind(r),r}),define("xDomainProxy",["jquery"],function(e){"use strict";function t(e){var t=this;t.profileType=e}return t.POST="POST",t.GET="GET",t.DELETE="DELETE",t.METHOD="method",t.URL="url",t.DATA="data",t.SUCCESS="success",t.FAILURE="failure",t.HEADERS="headers",t.CONTENT_TYPE="Content-Type",t.ACCEPT="Accept",t.TEXT_PLAIN="text/plain",t.APPLICATION_JSON="application/json",t.JSON="json",t.ETAG="ETag",t.ETAG_PROPERTY="___etag___",t.LAST_PUBLISHED_TIME="LastPublishedTime",t.LAST_PUBLISHED_TIME_PROPERTY="lastPublishedTime",t.XSTATEDATA="X-OCStateData",t.STATEDATA_PROPERTY="__stateData__",t.AMPERSAND="&",t.EQUALS="=",t.DOUBLE_SLASH="//",t.SLASH="/",t.EMPTY_STRING="",t.PROTOCOL_SEP="://",t.COLON=":",t.QUESTION_MARK="?",t.SPACE=" ",t.SEMICOLON=";",t.DASH="-",t.CURLY_BRACES="{}",t.PERIOD=".",t.OAUTH_VALIDATION_TOKEN_PARAM="validation_token",t.EXPIRES_IN_PARAM="expires_in",t.OAUTH_ACCESS_TOKEN_PARAM="access_token",t.OAUTH_REFRESH_TOKEN_PARAM="refresh_token",t.LOGIN_SERVICE_PATH="/ccstoreui/v1/login/",t.ADMIN_LOGIN_SERVICE_PATH="/ccadminui/v1/mfalogin/",t.AGENT_LOGIN_SERVICE_PATH="/ccagentui/v1/login/",t.OPENID_LOGIN_SERVICE_PATH="/ccstoreui/v1/openid/sso/",t.GRANT_TYPE_PARAM="grant_type",t.PASSWORD_GRANT_TYPE_VALUE="password",t.USERNAME_PARAM="username",t.PASSWORD_PARAM="password",t.TOTP_CODE_PARAM="totp_code",t.SAML_GRANT_TYPE_VALUE="saml_credentials",t.SAML_RESPONSE_PARAM="saml_response",t.RELAY_STATE="relay_state",t.VALIDATION_GRANT_TYPE_VALUE="validation",t.REMEMBER_DEVICE_PARAM="remember_device",t.FINGERPRINT_PARAM="fingerprint",t.OPENID_GRANT_TYPE_VALUE="openid_credentials",t.OPENID_CODE_PARAM="authz_code",t.OPENID_CODE_VERIFIER_PARAM="code_verifier",t.AUTH_HEADER_NAME="Authorization",t.AUTH_HEADER_PREFIX="Bearer ",t.PROFILE_TYPE_HEADER_NAME="X-CCProfileType",t.ASSET_LANGUAGE_HEADER_NAME="X-CCAsset-Language",t.PRICE_LIST_GROUP_ID="X-CCPriceListGroup",t.ORGANIZATION_ID="X-CCOrganization",t.AGENT_CONTEXT="X-CCAgentContext",t.VIEWPORT_HEADER_NAME="X-CCViewport",t.SITE_ID="x-ccsite",t.AUDIENCE_HEADER_NAME="X-CCAudience",t.VISIT_ID="X-CCVisitId",t.VISITOR_ID="X-CCVisitorId",t.METERING_MODE_HEADER_NAME="X-CC-MeteringMode",t.NON_METERED_HEADER_VALUE="CC-NonMetered",t.PREVIEW_DATE="x-CCDate",t.WORKSET="X-CC-Workset",t.prototype.init=function(){var e=this;e.targetMap={login:function(t,r,i){e.loginRequest(t.user,t.password,r,i)},auth:function(t,r,i){e.request(t.url,t.data,r,i,t.method,t.clientProps)},noauth:function(t,r,i){e.request(t.url,t.data,r,i,t.method)}}},t.prototype.loginRequest=function(e,t,r,i,a){this.mfaLoginRequest(e,t,null,r,i,a)},t.prototype.mfaLoginRequest=function(e,r,i,a,o,n){var s=this,l={};l[t.USERNAME_PARAM]=e,l[t.PASSWORD_PARAM]=r,i&&(l[t.TOTP_CODE_PARAM]=i),l[t.GRANT_TYPE_PARAM]=t.PASSWORD_GRANT_TYPE_VALUE,s.loginRequestInternal(l,a,o,n)},t.prototype.samlLoginRequest=function(e,r,i,a,o){var n=this,s={};s[t.SAML_RESPONSE_PARAM]=e,s[t.RELAY_STATE]=o,s[t.GRANT_TYPE_PARAM]=t.SAML_GRANT_TYPE_VALUE,n.loginRequestInternal(s,r,i,a)},t.prototype.openIdLoginRequest=function(e,r,i,a,o){var n=this,s={};s[t.OPENID_CODE_PARAM]=e,s[t.OPENID_CODE_VERIFIER_PARAM]=r,s[t.GRANT_TYPE_PARAM]=t.OPENID_GRANT_TYPE_VALUE,n.loginRequestInternal(s,i,a,o)},t.prototype.verifyLogin=function(e,r,i,a,o,n,s){var l=this,c={};c[t.TOTP_CODE_PARAM]=e,c[t.REMEMBER_DEVICE_PARAM]=r,c[t.FINGERPRINT_PARAM]=s,c[t.OAUTH_VALIDATION_TOKEN_PARAM]=n,c[t.GRANT_TYPE_PARAM]=t.VALIDATION_GRANT_TYPE_VALUE,l.loginRequestInternal(c,i,a,o)},t.prototype.loginRequestInternal=function(r,i,a,o){var n=this,s=t.LOGIN_SERVICE_PATH;"admin"==n.profileType||"adminUI"==n.profileType?s=t.ADMIN_LOGIN_SERVICE_PATH:"agent"!=n.profileType&&"agentUI"!=n.profileType||(s=t.AGENT_LOGIN_SERVICE_PATH);var l={};l[t.GRANT_TYPE_PARAM]=r[t.GRANT_TYPE_PARAM],r[t.GRANT_TYPE_PARAM]==t.PASSWORD_GRANT_TYPE_VALUE?(l[t.USERNAME_PARAM]=r[t.USERNAME_PARAM],l[t.PASSWORD_PARAM]=r[t.PASSWORD_PARAM],r[t.TOTP_CODE_PARAM]&&null!==r[t.TOTP_CODE_PARAM]&&(l[t.TOTP_CODE_PARAM]=r[t.TOTP_CODE_PARAM])):r[t.GRANT_TYPE_PARAM]==t.SAML_GRANT_TYPE_VALUE?(l[t.SAML_RESPONSE_PARAM]=r[t.SAML_RESPONSE_PARAM],l[t.RELAY_STATE]=r[t.RELAY_STATE]):r[t.GRANT_TYPE_PARAM]==t.VALIDATION_GRANT_TYPE_VALUE?(l[t.TOTP_CODE_PARAM]=r[t.TOTP_CODE_PARAM],l[t.REMEMBER_DEVICE_PARAM]=r[t.REMEMBER_DEVICE_PARAM],l[t.OAUTH_VALIDATION_TOKEN_PARAM]=r[t.OAUTH_VALIDATION_TOKEN_PARAM],r[t.FINGERPRINT_PARAM]&&l[t.REMEMBER_DEVICE_PARAM]&&(l[t.FINGERPRINT_PARAM]=r[t.FINGERPRINT_PARAM])):r[t.GRANT_TYPE_PARAM]==t.OPENID_GRANT_TYPE_VALUE&&(s=t.OPENID_LOGIN_SERVICE_PATH,l[t.OPENID_CODE_PARAM]=r[t.OPENID_CODE_PARAM],l[t.OPENID_CODE_VERIFIER_PARAM]=r[t.OPENID_CODE_VERIFIER_PARAM],l[t.RELAY_STATE]=r[t.RELAY_STATE]);var c=function(e){var t=e.data;i(t)},d=function(e){var t=e.jqXHR.responseText;t&&(t=JSON.parse(t)),a(t)},u=null,p=!1;if(o&&(p=o.suppressProfileType),n.profileType&&!p&&(u={},u[t.PROFILE_TYPE_HEADER_NAME]=n.profileType),o&&o[t.SITE_ID]&&(u||(u={}),u[t.SITE_ID]=o[t.SITE_ID]),o&&o.tokenSecret){u||(u={});var h=t.AUTH_HEADER_PREFIX+o.tokenSecret;u[t.AUTH_HEADER_NAME]=h}o&&o[t.VISITOR_ID]&&(u||(u={}),u[t.VISITOR_ID]=o[t.VISITOR_ID]),o&&o[t.VISIT_ID]&&(u||(u={}),u[t.VISIT_ID]=o[t.VISIT_ID]);var g={type:t.POST,dataType:t.JSON,url:s,data:l,processData:!0,success:function(e,t,r){c({data:e,textStatus:t,jqXHR:r})},error:function(e,t,r){d({jqXHR:e,textStatus:t,errorThrown:r})}};r[t.GRANT_TYPE_PARAM]==t.OPENID_GRANT_TYPE_VALUE&&(g.contentType=t.APPLICATION_JSON,g.processData=!1,g.data=JSON.stringify(l)),u&&(g.headers=u),e.ajax(g)},t.prototype.request=function(r,i,a,o,n,s,l,c,d){var u=this,p=r;p=encodeURI(p);var h=n;h||(h=t.GET);var g=null;i&&(h===t.GET||h===t.DELETE?p=t.addQueryParams(p,i,!0):g=JSON.stringify(i)),d&&(p=t.addQueryParams(p,d,!0)),h===t.GET&&(p=t.fixIECaching(p));var f=function(e){var r=e.data,i=e.jqXHR.getResponseHeader(t.ETAG),o=e.jqXHR.getResponseHeader(t.XSTATEDATA);i&&r&&(i=i.replace(/["]+/g,""),r[t.ETAG_PROPERTY]=i),o&&r&&(r[t.STATEDATA_PROPERTY]=o);var n=e.jqXHR.getResponseHeader(t.LAST_PUBLISHED_TIME);r&&n&&(r[t.LAST_PUBLISHED_TIME_PROPERTY]=Number(n)),a(r)},m=function(e){var r=e.jqXHR.status,i=e.jqXHR.responseText,a=e.jqXHR.getResponseHeader(t.XSTATEDATA);if(i)try{i=JSON.parse(i)}catch(e){i={}}a&&i&&(i[t.STATEDATA_PROPERTY]=a),o(i,r)},I={dataType:t.JSON,contentType:t.APPLICATION_JSON,type:h,url:p,processData:!1,success:function(e,t,r){f({data:e,textStatus:t,jqXHR:r})},error:function(e,t,r){m({jqXHR:e,textStatus:t,errorThrown:r})},beforeSend:c},E=null,y=!1;if(s&&(y=s.suppressProfileType),u.profileType&&!y&&(E={},E[t.PROFILE_TYPE_HEADER_NAME]=u.profileType),l){E||(E={});for(var v in l)l.hasOwnProperty(v)&&(l[v]instanceof Object?E[v]=JSON.stringify(l[v]):E[v]=l[v])}if(s&&s.tokenSecret){E||(E={});var b=t.AUTH_HEADER_PREFIX+s.tokenSecret;E[t.AUTH_HEADER_NAME]=b}g&&(I.data=g),E&&(I.headers=E),e.ajax(I)},t.parseQueryParams=function(e){if(null===e)return null;for(var r=e.split(t.AMPERSAND),i={},a=0;a<r.length;a++){var o=r[a].split(t.EQUALS);i[o[0]]=o[1]}return i},t.addQueryParams=function(e,t,r){if(!e)return null;if(!t)return e;var i=Object.keys(t);if(i&&0===i.length)return e;var a=e,o=!0;a.indexOf("?")!==-1&&(o=!1);for(var n=0;n<i.length;n++){var s=i[n],l=t[i[n]];r&&(s=encodeURIComponent(s),l=encodeURIComponent(l));var c=s+"="+l,d="&";o&&(d="?",o=!1),a+=d+c}return a},t.getTimestamp=function(e){var t=new Date/1e3,r=parseInt(e,10),i=t+r;return parseInt(+i,10)},t.convertUrl=function(e){if(null!=e&&e.charAt(0)!=t.SLASH)return[e];var r=t.urlPathPortionOnly(e),i=r.split(t.SLASH);if(1==i.length)return[t.SLASH];i[0]||(i=i.slice(1));var a=new Array(i.length+1);a[0]=t.SLASH,a[1]=i[0];for(var o=1;o<i.length;o++)a[o+1]=t.SLASH+i[o];return a},t.urlNoProtocolOrQueryParams=function(e){if(null==e)return null;var r=e.split(t.QUESTION_MARK),i=null;return i=r.length>1?r[0]:e,r=i.split(t.PROTOCOL_SEP),r.length>1&&(i=r[1]),i},t.urlPathPortionOnly=function(e){var r=t.urlNoProtocolOrQueryParams(e);return r.substring(0,1)!==t.SLASH&&(r=t.removeBeforeFirstSlash(r)),r},t.urlHostnamePortPortionOnly=function(e){var r=t.urlNoProtocolOrQueryParams(e);if(r.substring(0,1)==t.SLASH)return null;var i=r.split(t.SLASH);return i[0]},t.urlHostnameOnly=function(e){var r=t.urlHostnamePortPortionOnly(e),i=r&&r.split(t.COLON);return i?i[0]:null},t.urlProtocolOnly=function(e){var r=e.split(t.PROTOCOL_SEP);return r[0]},t.removeBeforeFirstSlash=function(e){var r=e.split(t.SLASH),i=e.substring(r[0].length);return i},t.fixIECaching=function(e){return e},t.insertAuthHeadersAsQueryParams=function(e,t,r){return uri},t.parseClaimsFromAccessToken=function(e){if(!e)return null;var r=e.split(t.PERIOD),i=r[1],a=t.decodeBase64(i),o=JSON.parse(a);return o},t.decodeBase64=function(e){var t,r,i,a,o={},n=0,s=0,l="",c=String.fromCharCode,d=e.length,u="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(t=0;t<64;t++)o[u.charAt(t)]=t;for(i=0;i<d;i++)for(r=o[e.charAt(i)],n=(n<<6)+r,s+=6;s>=8;)((a=n>>>(s-=8)&255)||i<d-2)&&(l+=c(a));return l},t}),define("storageApi",["knockout","xDomainProxy"],function(e,t){"use strict";function r(){if(r.singleInstance)throw new Error("Cannot instantiate more than one StorageApi, use getInstance()");var e=this;e.data={},e.validSyncSessionKeyPrefixes=["oauth_token_secret"];try{e.storage=window.localStorage,e.sessionStorage=window.sessionStorage}catch(e){}if(e.sessionStorageSupported=!1,e.localStorageSupported=!1,e.isIE=function(){return!(!navigator.userAgent.match(/Trident/)&&!navigator.userAgent.match(/Edge/))},e.isIE())try{e.sessionStorage=window.localStorage}catch(e){}e.url=t.urlHostnamePortPortionOnly(document.URL),e.isSessionStorageSynced=!1,e.hasLocalStorageSupport=function(){try{var t=new Date,r="test-"+t.toUTCString();e.storage.setItem(r,r);var i=e.storage.getItem(r);if(r===i)return e.storage.removeItem(r),!0}catch(e){}return!1},e.hasSessionStorageSupport=function(){if(e.isIE())return!1;try{var t=new Date,r="test-"+t.toUTCString();e.sessionStorage.setItem(r,r);var i=e.sessionStorage.getItem(r);if(r===i)return e.sessionStorage.removeItem(r),!0}catch(e){}return!1},e.localStorageSupported=e.hasLocalStorageSupport(),e.saveToLocalStorage=function(t,r){try{e.storage.setItem(t,r);var i={};return i[t]=r,!0}catch(e){}return!1},e.readFromLocalStrorage=function(t){try{return e.storage.getItem(t)}catch(e){}return null},e.saveToSessionStorage=function(t,r){try{e.sessionStorage.setItem(t,r);var i={};return i[t]=r,window.localStorage.setItem("sendSessionStorage",JSON.stringify(i)),!0}catch(e){}return!1},e.readFromSessionStorage=function(t){try{var r=e.sessionStorage.getItem(t);return r}catch(e){}return null},e.hasCookiesSupport=function(){try{return window.navigator&&window.navigator.cookieEnabled}catch(e){return!1}},e.saveToCookies=function(e,t,r){try{var i=new Date;i.setTime(i.getTime()+24*r*60*60*1e3);var a="; expires="+i.toUTCString(),o="; path=/";return document.cookie=e+"="+t+a+o,!0}catch(e){}return!1},e.saveToSessionCookies=function(e,t){try{var r="; path=/";return document.cookie=e+"="+t+r,!0}catch(e){}return!1},e.readFromCookies=function(e){try{var t=null;if(""!==document.cookie){var r=document.cookie.split("; ");if(void 0!==r)for(var i=0;i<r.length;i++){var a=r[i].split("="),o=a[0],n=a[1];if(o==e){t=n;break}}}return t}catch(e){}return null},e.saveToMemory=function(t,r){r=e.encodeData(r),e.data[t]=r},e.readFromMemory=function(t){return e.data.hasOwnProperty(t)?e.decodeData(e.data[t]):null},e.removeFromMemory=function(t){e.data[t]="",delete e.data[t]},e.removeItem=function(t){try{var r=null;return e.localStorageSupported&&(r=e.readFromLocalStrorage(t)),r?(e.saveToLocalStorage(t,""),e.storage.removeItem(t)):e.hasCookiesSupport()&&e.readFromCookies(t)?e.saveToCookies(t,"",-1):e.removeFromMemory(t),!0}catch(e){}return!1},e.setItem=function(t,r){try{var i=!1;return e.localStorageSupported&&(i=e.saveToLocalStorage(t,r)),!i&&e.hasCookiesSupport()&&(r=e.encodeData(r),i=e.saveToCookies(t,r,365)),i||saveToMemory(t,r),!0}catch(e){}return!1},e.getItem=function(t){var r=null;return e.localStorageSupported&&(r=e.readFromLocalStrorage(t)),!r&&e.hasCookiesSupport()&&(r=e.decodeData(e.readFromCookies(t))),null===r&&(r=e.readFromMemory(t)),r},e.removeSessionItem=function(t){try{var r=null;return e.sessionStorageSupported&&(r=e.readFromSessionStrorage(t)),r?(e.saveToSessionStorage(t,""),e.sessionStorage.removeItem(t)):e.removeSessionCookieItem(t),!0}catch(e){}return!1},e.setSessionItem=function(t,r){try{var i=!1;return e.sessionStorageSupported&&(i=e.saveToSessionStorage(t,r)),i||e.setSessionCookieItem(t,r),!0}catch(e){}return!1},e.getSessionItem=function(t){var r=null;return e.sessionStorageSupported&&(r=e.readFromSessionStrorage(t)),null===r&&(r=e.getSessionCookieItem(t)),r},e.removeSessionCookieItem=function(t){e.hasCookiesSupport()&&e.readFromCookies(t)?e.saveToSessionCookies(t,""):(e.data[t]="",delete e.data[t])},e.setSessionCookieItem=function(t,r){var i=!1;r=e.encodeData(r),e.hasCookiesSupport()&&(i=e.saveToSessionCookies(t,r)),i||(e.data[t]=r)},e.getSessionCookieItem=function(t){var r=null;return e.hasCookiesSupport()&&(r=e.decodeData(e.readFromCookies(t))),
- null===r&&(r=e.decodeData(e.data[t])),r},e.encodeData=function(e){try{e&&(e=encodeURIComponent(JSON.stringify(e)))}catch(e){}return e},e.decodeData=function(e){try{if(e)return e=JSON.parse(decodeURIComponent(e))}catch(e){}return null},e.initSyncing=function(r){if(!e.localStorageSupported||!e.sessionStorageSupported)return void(r&&r());var i=function(i){i||(i=window.event);var a=t.urlHostnamePortPortionOnly(i.url);if(a==e.url&&i.newValue)if("getSessionStorage"==i.key){var o=JSON.stringify(e.sessionStorage);window.localStorage.setItem("sendSessionStorage",o)}else if("sendSessionStorage"==i.key){var o=JSON.parse(i.newValue);for(var n in o){for(var s=!1,l=0;l<e.validSyncSessionKeyPrefixes.length&&0==s;l++){var c=e.validSyncSessionKeyPrefixes[l];0===n.lastIndexOf(c,0)&&(s=!0)}s&&e.sessionStorage.setItem(n,o[n])}r&&!e.isSessionStorageSynced&&r(),e.isSessionStorageSynced=!0}};window.addEventListener?window.addEventListener("storage",i,!1):window.attachEvent("onstorage",i);var a=new Date,o="test-"+a.toUTCString();try{window.localStorage.setItem("getSessionStorage",o)}catch(e){}}}return r.getInstance=function(){return r.singleInstance||(r.singleInstance=new r),r.singleInstance},r}),define("viewportHelper",["jquery","knockout","ccConstants"],function(e,t,r){"use strict";function i(){if(i.singleInstance)throw new Error("Cannot instantiate more than one ViewportHelper, use getInstance()");var r=this;return this.viewportMode=t.observable(null),this.viewportDesignation=t.observable(null),this.layoutViewports=t.observable(null),this.setViewport(e(window)[0].innerWidth||e(window).width()),e(window).resize(function(){r.setViewport(e(window)[0].innerWidth||e(window).width())}),this}return i.XS_CLASS="col-xs-",i.SM_CLASS="col-sm-",i.MD_CLASS="col-md-",i.LG_CLASS="col-lg-",i.XS_OFFSET="col-xs-offset-",i.SM_OFFSET="col-sm-offset-",i.MD_OFFSET="col-md-offset-",i.LG_OFFSET="col-lg-offset-",i.prototype.setViewport=function(e){e>=r.VIEWPORT_LARGE_DESKTOP_LOWER_WIDTH?this.viewportMode()!==r.LARGE_DESKTOP_VIEW&&(this.viewportMode(r.LARGE_DESKTOP_VIEW),this.viewportDesignation(r.VIEWPORT_LARGE)):e>r.VIEWPORT_TABLET_UPPER_WIDTH&&e<r.VIEWPORT_LARGE_DESKTOP_LOWER_WIDTH?this.viewportMode()!==r.DESKTOP_VIEW&&(this.viewportMode(r.DESKTOP_VIEW),this.viewportDesignation(r.VIEWPORT_MEDIUM)):e>=r.VIEWPORT_TABLET_LOWER_WIDTH&&e<=r.VIEWPORT_TABLET_UPPER_WIDTH?this.viewportMode()!==r.TABLET_VIEW&&(this.viewportMode(r.TABLET_VIEW),this.viewportDesignation(r.VIEWPORT_SMALL)):this.viewportMode()!==r.PHONE_VIEW&&(this.viewportMode(r.PHONE_VIEW),this.viewportDesignation(r.VIEWPORT_XS))},i.prototype.getWidthClass=function(e,t){var a=i.SM_CLASS,o=i.SM_OFFSET;return!e||""===e||isNaN(e)?"":(this.layoutViewports&&null!=this.layoutViewports()&&""!==this.layoutViewports()&&(this.layoutViewports().toLowerCase().indexOf(r.VIEWPORT_XS.toLowerCase())!==-1?(a=i.XS_CLASS,o=i.XS_OFFSET):this.layoutViewports().toLowerCase().indexOf(r.VIEWPORT_SMALL.toLowerCase())!==-1?(a=i.SM_CLASS,o=i.SM_OFFSET):this.layoutViewports().toLowerCase().indexOf(r.VIEWPORT_MEDIUM.toLowerCase())!==-1?(a=i.MD_CLASS,o=i.MD_OFFSET):this.layoutViewports().toLowerCase().indexOf(r.VIEWPORT_LARGE.toLowerCase())!==-1&&(a=i.LG_CLASS,o=i.LG_OFFSET)),a+=e,t&&""!==t&&!isNaN(t)&&(a+=" "+o+t),a)},i.getInstance=function(){return i.singleInstance||(i.singleInstance=new i),i.singleInstance},i.getInstance()}),define("ccStoreConfiguration",["knockout"],function(e){"use strict";function t(){if(t.prototype.singleInstance)throw new Error("Cannot instantiate more than one CCStoreConfiguration. Use getInstance() method");var e=this;e.getEndpointConfiguration=function(e){var t=this;if(void 0!==e&&null!==e){var r=e.endpoint,i=t.endpointConfiguarationMap[r];if(null!==i){var a=e.identifier,o=i[a];return o}}}}return t.setAddressMaxLengths=function(e,r,i,a,o,n,s){e&&e>0&&e<254&&(t.ADDRESS_ALIAS_MAXIMUM_LENGTH=e),r&&r>0&&r<254&&(t.ADDRESS_FIRSTNAME_MAXIMUM_LENGTH=r),i&&i>0&&i<254&&(t.ADDRESS_LASTNAME_MAXIMUM_LENGTH=i),a&&a>0&&a<254&&(t.ADDRESS_ADDRESS1_MAXIMUM_LENGTH=a),o&&o>0&&o<254&&(t.ADDRESS_ADDRESS2_MAXIMUM_LENGTH=o),n&&n>0&&n<254&&(t.ADDRESS_ADDRESS3_MAXIMUM_LENGTH=n),s&&s>0&&s<254&&(t.ADDRESS_CITY_MAXIMUM_LENGTH=s)},t.prototype.filterMap={getCollection:{megaMenuNavigation:{ccFilterConfigKey:"categoryNavData"},categoryNavigation:{ccFilterConfigKey:"categoryNavData"}},listProducts:{productListingData:{ccFilterConfigKey:"PLPData"},collectionWidget:{ccFilterConfigKey:"collectionData"},getProductData:{ccFilterConfigKey:"productData"},getProductDataAndRedirect:{ccFilterConfigKey:"productData"},listProductsForAddons:{ccFilterConfigKey:"addonProductsData"}}},t.prototype.endpointConfiguarationMap={listSkus:{skuListing:{preFilter:!1,skipExclude:!1}}},t.prototype.updateEndpointConfiguration=function(e){var t=this;if(null!=e&&e.constructor===Object)for(var r=Object.keys(e),i=0;i<r.length;i++)t.endpointConfiguarationMap[r[i]]=e[r[i]]},t.prototype.largeCart=void 0,t.prototype.placeAsyncOrder=!1,t.prototype.isCVVRequiredForSavedCards=e.observable(!0),t.prototype.allowSavingCards=e.observable(!1),t.prototype.priorityList=["endpoint","page","identifier"],t.prototype.filterEnabled=!1,t.prototype.enablePrioritizedLoading=!(!window.clientConfigData||!window.clientConfigData.prioritizedLoading||"true"!=window.clientConfigData.prioritizedLoading),t.prototype.batchSizeForProdAndSkuData=200,t.prototype.threshholdSizeForStockStatusData=200,t.prototype.largeCartConfig={suppressClientCartValidations:!1,suppressClientCartValidationsInCheckout:!1,suppressPageChangeValidations:!1,enableOptimizedUpdatesofItems:!1},t.prototype.resetShippingGroupRelationships=!0,t.prototype.allowSiteSwitchingOnProduction=e.observable(!1),t.prototype.skipLoadingProductTypes=!(!window.clientConfigData||!window.clientConfigData.skipLoadingProductTypes||"true"!=window.clientConfigData.skipLoadingProductTypes),t.prototype.allowVirtualShippingGroup=!(!window.clientConfigData||!window.clientConfigData.allowVirtualShippingGroup||"true"!=window.clientConfigData.allowVirtualShippingGroup),t.prototype.lazilyLoadImages=!(!window.clientConfigData||!window.clientConfigData.loadImagesLazily||"true"!=window.clientConfigData.loadImagesLazily),t.prototype.multiFactorAuthenticationEnabled=!1,t.prototype.delayBeforeLoadingOutOfFocusImages=window.clientConfigData&&window.clientConfigData.delayBeforeLoadingOutOfFocusImages?Number(window.clientConfigData.delayBeforeLoadingOutOfFocusImages):-1,t.prototype.transientCartEnabled=e.observable(!1),t.prototype.getFilterToUse=function(e){var t=this;if(t.filterEnabled&&null!=e&&e.constructor===Object){for(var r=Object.keys(e).length,i=t.filterMap,a="",o=null,n=0;n<t.priorityList.length;n++)if(a=t.priorityList[n],e[a]){if(r--,o=i[e[a]],null!=o&&o.constructor===Object&&o.ccFilterConfigKey&&0==r)return o.ccFilterConfigKey;if(null!=o&&o.constructor===Object)i=o;else{if(null!=o||!i.default)return null!=o&&0!=r||!i.ccFilterConfigKey?null:i.ccFilterConfigKey;if(o=i.default,o.constructor===Object&&o.ccFilterConfigKey&&0==r)return o.ccFilterConfigKey;if(o.constructor!==Object)return null!=o&&0!=r||!i.ccFilterConfigKey?null:i.ccFilterConfigKey;i=o}}if(null!=o&&o.constructor===Object&&o.ccFilterConfigKey)return o.ccFilterConfigKey}return null},t.prototype.enableFilter=function(){this.filterEnabled=!0},t.prototype.disableFilter=function(){this.filterEnabled=!1},t.prototype.updateFiltersToUse=function(e){var t=this;if(null!=e&&e.constructor===Object)for(var r=Object.keys(e),i=0;i<r.length;i++)t.filterMap[r[i]]=e[r[i]]},t.prototype.replaceAllFiltersToUse=function(e){var t=this;null!=e&&e.constructor===Object&&(t.filterMap=e)},t.prototype.addDataToPriorityList=function(e){var t=this;if(null!=e&&e.constructor===Array)for(var r=0;r<e.length;r++)t.priorityList.push(e[r])},t.prototype.replacePriorityList=function(e){var t=this;null!=e&&e.constructor===Array&&(t.priorityList=e)},t.prototype.layoutIdsRendered=[],t.prototype.layoutsRenderedArraySize=15,t.prototype.refreshAfter=e.observable(600),t.prototype.isFreshPageLoad=void 0,t.prototype.enableLayoutsRenderedForLayout=!1,t.prototype.getLayoutIdsRendered=function(){return this.layoutIdsRendered},t.prototype.storeLayoutIdsRendered=function(e){var t=this;e&&e.layout&&null!=e.layout&&t.layoutIdsRendered.indexOf(e.layout)==-1&&(t.layoutIdsRendered.length==t.layoutsRenderedArraySize&&t.layoutIdsRendered.shift(),t.layoutIdsRendered.push(e.layout))},t.prototype.enableSpinnerOnPageLoad=!1,t.prototype.discardPageScopedCallResponses=!1,t.prototype.pageScopedCalls=["getlayout","getPage","getCollection","search"],t.prototype.getPageScopedCalls=function(){return this.pageScopedCalls},t.prototype.addPageScopedCalls=function(e){for(var t=0;t<e.length;t++){var r=e[t];this.pageScopedCalls.indexOf(r)==-1&&this.pageScopedCalls.push(r)}},t.prototype.removePageScopedCalls=function(e){for(var t=0;t<e.length;t++){var r=e[t],i=this.pageScopedCalls.indexOf(r);i>-1&&this.pageScopedCalls.splice(i,1)}},t.prototype.enableQueueingSimultaneousCalls=!1,t.prototype.queueableCalls=[],t.prototype.getQueueableCalls=function(){return this.queueableCalls},t.prototype.addQueueableCalls=function(e){for(var t=0;t<e.length;t++){var r=e[t];this.queueableCalls.indexOf(r)==-1&&this.queueableCalls.push(r)}},t.prototype.removeQueueableCalls=function(e){for(var t=0;t<e.length;t++){var r=e[t],i=this.queueableCalls.indexOf(r);i>-1&&this.queueableCalls.splice(i,1)}},t.prototype.isLargeCart=function(e){var t=this;return t.largeCart},t.prototype.isPlaceAsyncOrder=function(e){return this.placeAsyncOrder},t.prototype.isVirtualShippingGroup=function(){var e=this;return e.assetable===!0||e.shippable===!1},t.getInstance=function(){return t.singleInstance||(t.singleInstance=new t),t.singleInstance},t}),define("ccRestClientConstructor",["xDomainProxy","ccConstants","jquery","pubsub","storageApi","viewportHelper","ccStoreConfiguration"],function(e,t,r,i,a,o,n){"use strict";function s(a,o){var l=this;l.profileId=null,l.profileRoles=null,l.tokenSecret=null,l.refreshTokenSecret=null,l.ssoTokenSecret=null,l.endpointRegistry=null,l.loggedIn=!1,l.verificationRequired=!1,l.tokenCookieEnabled=!1,l.initComplete=!1,l.initCompleteCallbacks=[],l.initCompleteCallbacksDone=!1,l.storageSyncCallbacks=[],l.storageSyncDone=!1,l.loginUpdateCallbacks=[],l.logoutUpdateCallbacks=[],l.loginAdminUpdateCallbacks=[],l.logoutAdminUpdateCallbacks=[],l.publishInProgressHandler=null,l.iframeLoadCompleteCallbacks=[],l.initIframeLoadComplete=!1,l.initIframeLoadCompleteDone=!1,l.profileType=a,l.previewMode=!1,l.allowSiteSwitchingOnProduction=!1,l.initFailed=!1,l.disableLoginErrorRedirect=!1,l.commonErrorCallback=o,l.url=e.urlHostnamePortPortionOnly(document.URL),l.urlProtocol=e.urlProtocolOnly(document.URL),l.NULL=s.NULL,l.currentRequestId=0,l.storeRequestWasMade=!1,l.etagCache=[],l.storeConfiguration=n.getInstance(),l.handleSessionExpiry=function(){r.Topic(i.topicNames.USER_SESSION_EXPIRED).publish()},l.isRefreshRequired=!1,l.lastPublishedTimeStamp=null,l.isNotStore=!(!window.isPreviewMode&&l.profileType==t.PROFILE_TYPE_STOREFRONT),window.isPreviewMode&&(l.previewMode=!0),l.external=!1,l.activeWorksetId=null,l.requestHeaderAuditInfo={},l.generateVerifier=function(){for(var e=Math.floor(86*Math.random())+43,t="",r=0;e>r;r++)t+=s.OPENID_CODE_VERIFIER_BASE[Math.floor(Math.random()*s.OPENID_CODE_VERIFIER_BASE.length)];return t},l.getVerifier=function(){return this.getStoredValue(s.OPENID_CODE_CHALLENGE)}}return s.NULL="cc-rest-null",s.LOCAL_STORAGE_TOKEN="oauth_token_secret",s.LOCAL_STORAGE_REFRESH_TOKEN="oauth_fresh_token_secret",s.LOCAL_STORAGE_LAST_UPDATE="oauth_last_update",s.LOCAL_STORAGE_EXPIRES=";expires=",s.LOCAL_STORAGE_LIFE_DAYS=1,s.TOKEN_FRESH_TIME=36e5,s.HTTP_UNAUTHORIZED_ERROR="401",s.DELETE="delete",s.ADMIN_LOGOUT_SERVICE_PATH="/ccadminui/v1/logout",s.ADMIN_REFRESH_SERVICE_PATH="/ccadminui/v1/refresh",s.ADMIN_ENDPOINT_REGISTRY_SERVICE_PATH="/ccadminui/v1/registry",s.ADMIN_VERIFY_SERVICE_PATH="/ccadminui/v1/verify",s.ADMIN_LOGIN_SCREEN_URL="/occs-admin",s.LOGOUT_SERVICE_PATH="/ccstoreui/v1/logout",s.REFRESH_SERVICE_PATH="/ccstoreui/v1/refresh",s.ENDPOINT_REGISTRY_SERVICE_PATH="/ccstoreui/v1/registry",s.VERIFY_SERVICE_PATH="/ccstoreui/v1/verify",s.SAML_AUTHN_REQUEST_SERVICE_URL="samlAuthnRequest",s.AGENT_LOGOUT_SERVICE_PATH="/ccagentui/v1/logout",s.AGENT_REFRESH_SERVICE_PATH="/ccagentui/v1/refresh",s.AGENT_ENDPOINT_REGISTRY_SERVICE_PATH="/ccagentui/v1/registry",s.AGENT_VERIFY_SERVICE_PATH="/ccagentui/v1/verify",s.AGENT_LOGIN_SCREEN_URL="/occs-agent",s.LOCAL_STORAGE_LOGIN_KEY="cc.login.update.",s.LOCAL_STORAGE_LOGOUT_KEY="cc.logout.update.",s.INPUT_ELEMENT="input",s.IFRAME_ELEMENT="iframe",s.ZERO="0",s.IFRAME_STYLE="width: 0; height: 0; border: none;",s.IFRAME_NAME="https_iframe",s.ID_ATTRIBUTE="id",s.NAME_ATTRIBUTE="name",s.WIDTH_ATTRIBUTE="width",s.HEIGHT_ATTRIBUTE="height",s.BORDER_ATTRIBUTE="border",s.STYLE_ATTRIBUTE="style",s.SRC_ATTRIBUTE="src",s.MAX_INT=4294967295,s.LOCALE_HINT="localeHint",s.HINT_BROWSER="browser",s.HINT_ASSET_LANGUAGE_OPTIONAL="assetLanguageOptional",s.HINT_ASSET_LANGUAGE_REQUIRED="assetLanguageRequired",s.BEFORE_SEND_NOT_SUPPORTED="Before-send callback not supported for proxy requests.",s.LAST_PUBLISHED_TIME_STAMP="lastPublishedTimeStamp",s.OPENID_AUTHZ_CODE_REQUEST_PATH="/ccstoreui/v1/openid/authzCodeRequest",s.OPENID_SSO_PATH="/ccstoreui/v1/openid/sso",s.OPENID_LOGOUT_REQUEST_PATH="/ccstoreui/v1/openid/logoutRequest",s.OPENID_CODE_CHALLENGE="code_challenge",s.OPENID_CODE_VERIFIER_BASE="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-._~",s.prototype.initProxy=function(){var t=this;t.proxy=new e(t.profileType)},s.prototype.registerInitFailCallback=function(e){var t=this;t.initFailCallback=e,t.initFailed&&t.initFailCallback()},s.prototype.registerStorageSyncCallback=function(e){var t=this;t.storageSyncDone?e():t.storageSyncCallbacks.push(e)},s.prototype.registerInitCallback=function(e){var t=this;t.initComplete?e():t.initCompleteCallbacks.push(e)},s.prototype.registerLoginUpdateCallback=function(e){var t=this;t.loginUpdateCallbacks.push(e)},s.prototype.execLoginUpdateCallbacks=function(){for(var e=this,t=0;t<e.loginUpdateCallbacks.length;t++)e.loginUpdateCallbacks[t]()},s.prototype.registerLogoutUpdateCallback=function(e){var t=this;t.logoutUpdateCallbacks.push(e)},s.prototype.registerLoginAdminUpdateCallback=function(e){var t=this;t.loginAdminUpdateCallbacks.push(e)},s.prototype.registerLogoutAdminUpdateCallback=function(e){var t=this;t.logoutAdminUpdateCallbacks.push(e)},s.prototype.setTokenCookieEnabled=function(e){var t=this;t.tokenCookieEnabled=e},s.prototype.init=function(e,t,r){var i=this;i.reloadStoredValueAuth();var a=function(){i.initPart2(e,t,r)};i.requestTokenCookieEnabledFlag(a,a)},s.prototype.initPart2=function(e,t,r){var i=this,a=function(){i.initPart3(e,t,r)};i.initProxy(),i.tokenCookieEnabled?i.refresh(a,a):a()},s.prototype.initPart3=function(e,t,r){var i=this,o=function(){for(var a=0;a<i.storageSyncCallbacks.length;a++)i.storageSyncCallbacks[a]();i.storageSyncDone=!0,i.initPart4(e,t,r)};a.getInstance().initSyncing(function(){i.reloadStoredValueAuth(),i.proxy&&!i.tokenCookieEnabled?i.refresh(o,o):o()})},s.prototype.initPart4=function(e,r,i){var a=this;a.reloadStoredValueAuth(),a.registerAsLoginLogoutEventListener();var o=function(){if(!a.initCompleteCallbacksDone){a.initComplete=!0;for(var e=0;e<a.initCompleteCallbacks.length;e++)a.initCompleteCallbacks[e]();a.initCompleteCallbacks.length=0,a.initCompleteCallbacksDone=!0}},n=function(){o()};window.urlLocale?a.setStoredValue(t.LOCAL_STORAGE_USER_CONTENT_LOCALE,window.urlLocale):a.profileType!==t.PROFILE_TYPE_ADMIN&&a.clearStoredValue(t.LOCAL_STORAGE_USER_CONTENT_LOCALE);var s=function(e){e=e.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");var t=new RegExp("[\\?&]"+e+"=([^&#]*)"),r=t.exec(location.search);return null===r?"":decodeURIComponent(r[1].replace(/\+/g," "))};if(a.previewMode||a.allowSiteSwitchingOnProduction){var l=s(t.URL_SITE_PARAM);l?a.setStoredValue(t.LOCAL_STORAGE_SITE_ID,l):a.clearStoredValue(t.LOCAL_STORAGE_SITE_ID)}else window.siteId&&a.setStoredValue(t.LOCAL_STORAGE_SITE_ID,window.siteId);var c=function(){if(null==a.endpointRegistry){var e=function(e){a.initProxy(),n()},t=function(e){var t=JSON.parse(e);"401"==t.status&&a.redirectToAdminLoginScreen(),null!=a.initFailCallback&&a.initFailCallback(),a.initFailed=!0};a.requestEndpointRegistry(e,t)}else n()},d=function(){if(a.profileType==t.PROFILE_TYPE_STOREFRONT&&!a.previewMode){var e=function(e){"401"==e.status&&a.redirectToAdminLoginScreen()};a.request(t.ENDPOINT_GET_MERCHANT_TIMEZONE,{},function(e){},e)}};if(e){if(i){var u=i;"string"==typeof i&&(u=JSON.parse(i)),a.endpointRegistry=u.endpointMap,a.setTokenCookieEnabled(u.tokenCookieEnabled),a.profileType==t.PROFILE_TYPE_STOREFRONT&&a.initializeLastPublishedTimeStamp()}window.isPreviewMode&&(a.previewMode=window.isPreviewMode),a.initProxy(),n()}else c(),r||d()},s.prototype.login=function(e,t,r,i){var a={user:e,password:t};this.loginInternal(a,r,i)},s.prototype.registerUserWithAutoLogin=function(a,o,n,l){var c=this,d=function(t){var r=!c.loggedIn;c.removeValidationTokenDetails(),c.tokenSecret=t[e.OAUTH_ACCESS_TOKEN_PARAM],c.parseAndStoreClaims(),c.storeToken(c.tokenSecret),c.loggedIn=!0,n(t),r&&c.execLoginUpdateCallbacks()},u=function(e){c.loggedIn=!1,e?l(e):r.Topic(i.topicNames.USER_NETWORK_ERROR).publish([{message:"failure"}])};c.previewMode?c.resetAdminPreviewToken():c.clearSessionStoredValue(s.LOCAL_STORAGE_TOKEN,t.PROFILE_TYPE_LAYOUT_PREVIEW),c.request(a,o,d,u)},s.prototype.mfaLogin=function(e,t,r,i,a){var o={user:e,password:t,totp_code:r};this.loginInternal(o,i,a)},s.prototype.samlLogin=function(e,t,r,i){var a=this,o={samlResponse:e,relayState:i};a.loginInternal(o,t,r)},s.prototype.openIdLogin=function(e,t,r){var i=this,a={authz_code:e,code_verifier:i.getVerifier()};i.loginInternal(a,t,r)},s.prototype.verifyLogin=function(t,r,i,o,n){var s=this,l={token:a.getInstance().getItem(e.OAUTH_VALIDATION_TOKEN_PARAM),totp_code:t,remember_device:r,fingerprint:n};s.loginInternal(l,i,o)},s.prototype.loginInternal=function(o,n,l){var c=this,d=function(r){var i=!c.loggedIn,o=r[e.OAUTH_VALIDATION_TOKEN_PARAM];if(c.removeValidationTokenDetails(),o){var s=new Date,l=s.setSeconds(s.getSeconds()+r[e.EXPIRES_IN_PARAM]);a.getInstance().setItem(t.VALIDATION_TOKEN_EXPIRATION_TIME,l),a.getInstance().setItem(e.OAUTH_VALIDATION_TOKEN_PARAM,o),c.verificationRequired=!0}else{c.tokenSecret=r[e.OAUTH_ACCESS_TOKEN_PARAM],c.parseAndStoreClaims(),c.storeToken(c.tokenSecret);var d=r[e.OAUTH_REFRESH_TOKEN_PARAM];d&&(c.refreshTokenSecret=d,c.storeRefreshToken(c.refreshTokenSecret)),c.loggedIn=!0,c.verificationRequired=!1}n(c.verificationRequired),i&&c.execLoginUpdateCallbacks()},u=function(e){c.loggedIn=!1,e?l(e):r.Topic(i.topicNames.USER_NETWORK_ERROR).publish([{message:"failure"}])},p={};c.previewMode?(c.resetAdminPreviewToken(),p.tokenSecret=c.tokenSecret):c.clearSessionStoredValue(s.LOCAL_STORAGE_TOKEN,t.PROFILE_TYPE_LAYOUT_PREVIEW),c.updateHeaderWithVisitData(p),p=c.updateHeaderWithSiteId(p,!1,!0,null),null!=o.samlResponse?c.doSamlLogin(o.samlResponse,d,u,p,o.relayState):null!=o.remember_device?c.doVerifyLogin(o.totp_code,o.remember_device,d,u,p,o.token,o.fingerprint):null!=o.authz_code?c.doOpenIdLogin(o.authz_code,o.code_verifier,d,u,p):o.totp_code&&null!==o.totp_code?c.doMFALogin(o.user,o.password,o.totp_code,d,u,p):c.doLogin(o.user,o.password,d,u,p)},s.prototype.doLogin=function(e,t,r,i,a){var o=this;o.proxy.loginRequest(e,t,r,i,a)},s.prototype.doMFALogin=function(e,t,r,i,a,o){var n=this;n.proxy.mfaLoginRequest(e,t,r,i,a,o)},s.prototype.doSamlLogin=function(e,t,r,i,a){var o=this;o.proxy.samlLoginRequest(e,t,r,i,a)},s.prototype.doVerifyLogin=function(e,t,r,i,a,o,n){var s=this;s.proxy.verifyLogin(e,t,r,i,a,o,n)},s.prototype.doOpenIdLogin=function(e,t,r,i,a){this.proxy.openIdLoginRequest(e,t,r,i,a)},s.prototype.generateSamlAuthnRequest=function(e,t){var r=this;r.request(s.SAML_AUTHN_REQUEST_SERVICE_URL,{},e,t,null,null,null,null,null,{encode:!0})},s.prototype.logout=function(r,i){var a=this,o=s.LOGOUT_SERVICE_PATH;a.profileType==t.PROFILE_TYPE_ADMIN?o=s.ADMIN_LOGOUT_SERVICE_PATH:a.profileType==t.PROFILE_TYPE_AGENT&&(o=s.AGENT_LOGOUT_SERVICE_PATH);var n=function(){a.clearStoredValues(),a.clearValues(),a.loggedIn=!1,a.resetAdminPreviewToken(),a.verificationRequired=!1},l=function(e){n(),r()},c=function(e){n(),i(e)};a.authenticatedRequest(o,{},l,c,e.POST)},s.prototype.verify=function(r,i){var a=this,o=function(){var e=!a.loggedIn;a.loggedIn=!0,r(),e&&a.execLoginUpdateCallbacks()},n=function(e){a.clearStoredValues(),a.clearValues(),a.resetAdminPreviewToken(),i(e)},l=s.VERIFY_SERVICE_PATH;a.profileType==t.PROFILE_TYPE_ADMIN?l=s.ADMIN_VERIFY_SERVICE_PATH:a.profileType==t.PROFILE_TYPE_AGENT&&(l=s.AGENT_VERIFY_SERVICE_PATH),a.tokenSecret?a.authenticatedRequest(l,{},o,n,e.POST):n()},s.prototype.refresh=function(r,i){var a=this,o=s.REFRESH_SERVICE_PATH;a.profileType==t.PROFILE_TYPE_ADMIN||a.profileType==t.PROFILE_TYPE_LAYOUT_PREVIEW?o=s.ADMIN_REFRESH_SERVICE_PATH:a.profileType==t.PROFILE_TYPE_AGENT&&(o=s.AGENT_REFRESH_SERVICE_PATH);var n=function(t){a.tokenSecret=t[e.OAUTH_ACCESS_TOKEN_PARAM],a.parseAndStoreClaims();var i=t[e.OAUTH_REFRESH_TOKEN_PARAM];i&&(a.refreshTokenSecret=i,a.storeRefreshToken(a.refreshTokenSecret));var o=!a.loggedIn;a.loggedIn=!0,a.storeToken(a.tokenSecret),r(t),o&&a.execLoginUpdateCallbacks()},l=function(e){e&&(a.handleSessionExpiry(),a.clearStoredValues(),a.clearValues(),a.resetAdminPreviewToken()),i(e)};if(a.ssoTokenSecret=null,a.external&&a.tokenSecret){var c=this.readToken();c||(a.clearStoredValues(),a.clearValues())}if(a.tokenSecret)if(a.refreshTokenSecret){var d={refresh_token:a.refreshTokenSecret};a.authenticatedRequest(o,d,n,l,e.POST,!1,!0)}else a.authenticatedRequest(o,{},n,l,e.POST,!1,!0);else a.tokenCookieEnabled?a.authenticatedRequest(o,{},n,l,e.POST,!1,!0):l()},s.prototype.registerAsLoginLogoutEventListener=function(){var r=this,i=function(i){i||(i=window.event);var a=e.urlHostnamePortPortionOnly(i.url);if(a==r.url)if(i.key==r.getStoredValueName(s.LOCAL_STORAGE_TOKEN)){var o=!1;if(i.newValue&&(o=!0,r.tokenSecret=i.newValue,r.parseAndStoreClaims()),o){r.loggedIn=!0;for(var n=0;n<r.loginUpdateCallbacks.length;n++)r.loginUpdateCallbacks[n]()}else{r.clearValues();for(var l=0;l<r.logoutUpdateCallbacks.length;l++)r.logoutUpdateCallbacks[l]()}}else if(r.previewMode&&i.key==r.getStoredValueName(s.LOCAL_STORAGE_TOKEN,t.PROFILE_TYPE_ADMIN))if(!i.newValue&&i.oldValue)for(var l=0;l<r.logoutAdminUpdateCallbacks.length;l++)r.logoutAdminUpdateCallbacks[l]();else for(var n=0;n<r.loginAdminUpdateCallbacks.length;n++)r.loginAdminUpdateCallbacks[n]()};window.addEventListener?window.addEventListener("storage",i,!1):window.attachEvent("onstorage",i)},s.prototype.reloadStoredValueAuth=function(){var e=this.readToken();if(e){this.tokenSecret=e,this.parseAndStoreClaims(),this.checkPreviewWhenLoggedIn();var t=this.readRefreshToken();return t&&(this.refreshTokenSecret=t),this.ssoTokenSecret=null,!0}return this.resetAdminPreviewToken()},s.prototype.checkPreviewWhenLoggedIn=function(){return this.resetAdminPreviewToken(!0)},s.prototype.resetAdminPreviewToken=function(e){var r=this;e=e&&"boolean"==typeof e;var i=r.getStoredValueName(s.LOCAL_STORAGE_TOKEN,t.PROFILE_TYPE_ADMIN),o=r.getSessionStoredValue(i);return!(!o||r.profileType!=t.PROFILE_TYPE_STOREFRONT&&r.profileType!=t.PROFILE_TYPE_LAYOUT_PREVIEW||!r.isNotStore)&&(e||(r.tokenSecret=o),r.previewMode||(r.registerLoginAdminUpdateCallback(function(){r.resetAdminPreviewToken()}),r.registerLogoutAdminUpdateCallback(function(){r.clearStoredValues(),r.clearValues(),r.loggedIn=!1,a.getInstance().removeItem("user"),r.redirectToAdminLoginScreen()})),r.previewMode=!0,!0)},s.prototype.getAjaxConfig=function(e,t,r,i,a,o,n,s,l){var c=null,d=function(e,t){return t.beforeSend=l,c=t,!1};return this.request(e,t,r,i,a,o,n,s,d),c},s.prototype.runningRequests={},s.prototype.queuedRequests={},s.prototype.request=function(e,t,r,i,a,o,n,s,l,c){var d=this,u=function(e,t,r,i,a,o,n,s,l,c){this.url=e,this.data=t,this.successCallback=r,this.errorCallback=i,this.param1=a,this.param2=o,this.param3=n,this.param4=s,this.beforeSendCallback=l,this.scope=c};if(d.storeConfiguration.enableQueueingSimultaneousCalls&&d.storeConfiguration.getQueueableCalls().indexOf(e)>-1){var p=new u(e,t,r,i,a,o,n,s,l,c);if(d.runningRequests.hasOwnProperty(e))d.queuedRequests[e]=p;else{d.runningRequests[e]=p;var h=function(t){p.successCallback&&"function"==typeof p.successCallback&&p.successCallback(t),delete d.runningRequests[e];var r=d.queuedRequests[e];r&&(d.request(r.url,r.data,r.successCallback,r.errorCallback,r.param1,r.param2,r.param3,r.param4,r.beforeSendCallback,r.scope),delete d.queuedRequests[e])},g=function(t){p.errorCallback&&"function"==typeof p.errorCallback&&p.errorCallback(t),delete d.runningRequests[e];var r=d.queuedRequests[e];r&&(d.request(r.url,r.data,r.successCallback,r.errorCallback,r.param1,r.param2,r.param3,r.param4,r.beforeSendCallback,r.scope),delete d.queuedRequests[e])};d.performRequest(p.url,p.data,h,g,p.param1,p.param2,p.param3,p.param4,p.beforeSendCallback,p.scope)}}else d.performRequest(e,t,r,i,a,o,n,s,l,c)},s.prototype.performRequest=function(e,r,i,a,o,n,s,l,c,d){var u=!0;this.profileType==t.PROFILE_TYPE_ADMIN&&(u=!1),this.requestWithSite(e,u,r,i,a,o,n,s,l,c,null,d)},s.prototype.requestWithSite=function(i,o,l,c,d,u,p,h,g,f,m,I){var E=this,y=function(){var y=E.registryLookup(i),v="GET",b=!1,T=i,P={};null!=y&&(b=y.authRequired,v=y.method,null!=T&&T.charAt(0)!=e.SLASH&&(T=y.url)),T=E.insertParamsIntoUri(T,[u,p,h,g]);var S=!1,C="global";E.storeConfiguration.discardPageScopedCallResponses&&E.storeConfiguration.getPageScopedCalls().indexOf(i)&&(C="page");var _=r.extend(!0,{},window.location),A=function(r){if(r&&r[e.ETAG_PROPERTY])try{var i=JSON.parse(e.decodeBase64(r[e.ETAG_PROPERTY]));if(i&&i.user&&(r.etag_lastModifiedBy=i.user),E.etagCache[T]){var o=JSON.parse(e.decodeBase64(E.etagCache[T])),s=o.version||0;i.version>s&&(E.etagCache[T]=r[e.ETAG_PROPERTY])}else E.etagCache[T]=r[e.ETAG_PROPERTY]}catch(e){console.log("ETAG parse error: ",e)}if(r&&r[e.LAST_PUBLISHED_TIME_PROPERTY]){var l=r[e.LAST_PUBLISHED_TIME_PROPERTY];if(null!=E.lastPublishedTimeStamp&&E.lastPublishedTimeStamp<l){var d=a.getInstance().getItem(t.LAST_REFRESH_TIME);if(n.getInstance().refreshAfter()&&0!=n.getInstance().refreshAfter()&&null!=d){var u=n.getInstance().refreshAfter(),p=new Date(d);p.setSeconds(p.getSeconds()+u);var h=new Date;(h.toDateString()!==p.toDateString()||h.toDateString()===p.toDateString()&&h.getTime()>p.getTime())&&(E.lastPublishedTimeStamp=l,a.getInstance().setItem(t.LAST_REFRESH_TIME,new Date),E.isRefreshRequired=!0)}else E.lastPublishedTimeStamp=l,a.getInstance().setItem(t.LAST_REFRESH_TIME,new Date),E.isRefreshRequired=!0}}var g=window.location.href,f=_.href;"global"!=C&&g!=f||c&&"function"==typeof c&&c(r)};if(!b&&E.loggedIn&&(b=!0),P=E.updateHeaderWithLocaleHint(y),P=E.updateHeaderWithPriceListGroupId(P),P=E.updateHeaderWithSelectedOrganization(P),P=E.updateHeaderWithAgentContext(P),P=E.updateHeaderWithViewport(P),P=E.updateHeaderWithShopperContext(P),P=E.updateHeaderWithSiteId(P,!1,o,m),P=E.updateHeaderWithMeteringData(P),E.isNotStore&&(P=E.updateHeaderWithWorkset(P)),E.previewMode&&(P=E.updateHeaderWithAudience(P),P=E.updateHeaderWithDate(P)),null!=y&&"PUT"===y.method&&E.etagCache[T]&&(P[e.ETAG]=E.etagCache[T],delete E.etagCache[T],y.useOptimisticLock&&(P["If-Match"]=P[e.ETAG])),1==b){var O=function(e){if(e)if(E.profileType==t.PROFILE_TYPE_AGENT){if(e.errorCode===t.ERRORCODE_INVALID_SITE_ID)return localStorage.clear(),window.location.assign("/occs-agent/agentError"),!1;e.status==s.HTTP_UNAUTHORIZED_ERROR&&(E.clearStoredValues(),E.clearValues(),E.handleSessionExpiry())}else if(e.status!=s.HTTP_UNAUTHORIZED_ERROR&&e.errorCode!==t.ERRORCODE_INVALID_SITE_ID||(E.clearStoredValues(),E.clearValues(),E.handleSessionExpiry()),e.errorCode===t.ERRORCODE_INVALID_SITE_ID)return localStorage.clear(),window.location.reload(!0),!1;d&&"function"==typeof d&&d(e)};E.authenticatedRequest(T,l,A,O,v,S,null,P,f,I)}else E.unauthenticatedRequest(T,l,A,d,v,null,P,f,I)};E.registerInitCallback(y)},s.prototype.updateHeaderWithLocaleHint=function(i,a,o){var n=r.extend({},a),l=o||!1;if(!i)return n;if(!l&&n[e.ASSET_LANGUAGE_HEADER_NAME])return n;var c=i[s.LOCALE_HINT];if(!c)return n;var d;if(c===s.HINT_ASSET_LANGUAGE_OPTIONAL||c===s.HINT_ASSET_LANGUAGE_REQUIRED){var u=JSON.parse(this.getStoredValue(t.LOCAL_STORAGE_USER_CONTENT_LOCALE));u&&u[0]?d=u[0].name:c===s.HINT_ASSET_LANGUAGE_REQUIRED&&(d="en")}return d&&d.length>0&&(n[e.ASSET_LANGUAGE_HEADER_NAME]=d),n},s.prototype.updateHeaderWithPriceListGroupId=function(i,a){var o=r.extend({},i),n=a||!1;if(!n&&o[e.PRICE_LIST_GROUP_ID])return o;var s;return s="string"==typeof this.getStoredValue(t.LOCAL_STORAGE_PRICELISTGROUP_ID)?JSON.parse(this.getStoredValue(t.LOCAL_STORAGE_PRICELISTGROUP_ID)):this.getStoredValue(t.LOCAL_STORAGE_PRICELISTGROUP_ID),s&&(o[e.PRICE_LIST_GROUP_ID]=s),o},s.prototype.updateHeaderWithSelectedOrganization=function(i,o){var n=this,s=r.extend({},i),l=o||!1;if(!l&&s[e.ORGANIZATION_ID])return s;var c;return c="string"==typeof n.getStoredValue(t.LOCAL_STORAGE_ORGANIZATION_ID)?JSON.parse(n.getStoredValue(t.LOCAL_STORAGE_ORGANIZATION_ID)):n.getStoredValue(t.LOCAL_STORAGE_ORGANIZATION_ID),n.profileType===t.PROFILE_TYPE_AGENT&&(c=a.getInstance().readFromMemory(t.LOCAL_STORAGE_ORGANIZATION_ID)),c&&(s[e.ORGANIZATION_ID]=c),s},s.prototype.updateHeaderWithAgentContext=function(i,o){var n=r.extend({},i),s=o||!1;if(!s&&n[e.AGENT_CONTEXT])return n;var l=a.getInstance().readFromMemory(t.LOCAL_STORAGE_AGENT_CONTEXT);return"string"==typeof l&&(l=JSON.parse(l)),l&&(n[e.AGENT_CONTEXT]=l),n},s.prototype.updateHeaderWithAudience=function(t){var i=r.extend({},t),a=decodeURIComponent(this.getStoredValue("audience"));return i[e.AUDIENCE_HEADER_NAME]=a,i},s.prototype.updateHeaderWithDate=function(t){var i=r.extend({},t),a=this.getStoredValue("date");if(null!=a){var o=decodeURIComponent(a);i[e.PREVIEW_DATE]=o}return i},s.prototype.updateHeaderWithViewport=function(t,i){var a=r.extend({},t),n=i||!1;if(!n&&a[e.VIEWPORT_HEADER_NAME])return a;var s=o.viewportDesignation();return s&&(a[e.VIEWPORT_HEADER_NAME]=s),a},s.prototype.updateHeaderWithShopperContext=function(i,o){var n=this,s=r.extend({},i),l=o||!1;if(!l&&s[e.XSTATEDATA])return s;if(n.profileType==t.PROFILE_TYPE_STOREFRONT||n.profileType==t.PROFILE_TYPE_AGENT){var c;c=a.getInstance().getItem(t.LOCAL_STORAGE_SHOPPER_CONTEXT),c&&(s[e.XSTATEDATA]=c)}return s},s.prototype.updateHeaderWithSiteId=function(i,o,n,s){var l=this,c=r.extend({},i),d=o||!1,u=n||!1;if(!d&&c[e.SITE_ID])return c;var p;return(l.allowSiteSwitchingOnProduction||l.previewMode||u)&&(p=s?s:!l.previewMode&&window.siteId?window.siteId:l.getStoredValue(t.LOCAL_STORAGE_SITE_ID),p&&(c[e.SITE_ID]=p)),l.profileType===t.PROFILE_TYPE_AGENT&&(p=a.getInstance().readFromMemory(t.LOCAL_STORAGE_SITE_ID),p&&(c[e.SITE_ID]=p)),c},s.prototype.updateHeaderWithMeteringData=function(t){return t[e.METERING_MODE_HEADER_NAME]=e.NON_METERED_HEADER_VALUE,t},s.prototype.updateHeaderWithWorkset=function(i){var a=this,o=r.extend({},i);if(a.activeWorksetId)o[e.WORKSET]=a.activeWorksetId;else{var n=t.DEFAULT_WORKSET_ID,s=a.getStoredValue(t.ACTIVE_WORKSET_ID);s&&(n=s),o[e.WORKSET]=n,a.setActiveWorksetId(n)}return o},s.prototype._setActiveWorksetId=function(e){var r=this;if(e){var i=r.activeWorksetId;r.activeWorksetId=e,r.setStoredValue(t.ACTIVE_WORKSET_ID,e);var a=new Object;return a.previousWorksetId=i,a.activeWorksetId=r.activeWorksetId,a}},s.prototype.setActiveWorksetId=function(e,t){if(this.activeWorksetId!==e){var a=this._setActiveWorksetId(e);t||r.Topic(i.topicNames.ACTIVE_WORKSET_CHANGED).publish(a)}},s.prototype.updateHeaderWithVisitData=function(r){var i=window.OracleUnifiedVisit,a=null,o=null;return i&&i.visitId&&i.visitorId&&(a=i.visitId(),o=i.visitorId()),
- a||o||window.visitorId&&window.visitId&&(o=window.visitorId,a=window.visitId),o||(o=window.localStorage.getItem(t.VISITOR_ID)),a&&(r[e.VISIT_ID]=a),o&&(r[e.VISITOR_ID]=o),r},s.prototype.requestWithoutAssetLocale=function(t,r,i,a,o,n,l,c){var d=this,u=function(){var u,p,h=d.registryLookup(t),g="GET",f=!1,m=t;null!=h&&(f=h.authRequired,g=h.method,null!=m&&m.charAt(0)!=e.SLASH&&(m=h.url)),m=d.insertParamsIntoUri(m,[o,n,l,c]);var I=!1,E=function(e){i(e)};if(!f&&d.loggedIn&&(f=!0),u=d.updateHeaderWithLocaleHint(h),u=d.updateHeaderWithViewport(u),u=d.updateHeaderWithMeteringData(u),p=h[s.LOCALE_HINT],p&&p!==s.HINT_ASSET_LANGUAGE_OPTIONAL||delete u[e.ASSET_LANGUAGE_HEADER_NAME],1==f){var y=function(e){e&&e.status==s.HTTP_UNAUTHORIZED_ERROR&&(d.clearStoredValues(),d.clearValues(),d.handleSessionExpiry()),a(e)};d.authenticatedRequest(m,r,E,y,g,I,null,u)}else d.unauthenticatedRequest(m,r,E,a,g,null,u)};d.registerInitCallback(u)},s.prototype.authenticatedRequest=function(e,t,r,i,a,o,n,s,l,c){var d=this;d.storeRequestWasMade=!0;var u=e;if(s||(s={}),s=d.updateHeaderWithVisitData(s),s=d.updateHeaderWithSiteId(s,!1,!0,null),d.external&&d.tokenSecret){var p=this.readToken();p||d.clearValues()}var h={};d.tokenCookieEnabled&&d.loggedIn?h.tokenSecret=null:h.tokenSecret=d.tokenSecret;var g=function(e){var t=e;null!=t&&t.items&&t.autoWrap&&(t=t.items),r(t)},f=function(e,t){d.previewMode&&401==t&&!n&&d.redirectToAdminLoginScreen(),null!=d.commonErrorCallback&&h.tokenSecret===d.tokenSecret&&d.commonErrorCallback(e,t),i(e,t),null==d.publishInProgressHandler||null==e||"81400"!==e.errorCode&&"31030"!==e.errorCode||u==d.endpointRegistry.createWorkset.url||d.publishInProgressHandler(e)};d.requestHeaderAuditInfo=s,d.doAuthRequest(e,t,g,f,h,a,o,s,l,c)},s.prototype.doAuthRequest=function(e,t,r,i,a,o,n,s,l,c){var d=this;d.proxy.request(e,t,r,i,o,a,s,l,c)},s.prototype.unauthenticatedRequest=function(e,t,r,i,a,o,n,s,l){var c=this;c.storeRequestWasMade=!0,n||(n={}),n=c.updateHeaderWithVisitData(n);var d=function(e){var t=e;null!=t&&t.items&&t.autoWrap&&(t=t.items),r(t)},u=function(e,t){null!=c.commonErrorCallback&&c.commonErrorCallback(e,t),i&&"function"==typeof i&&i(e,t)};c.requestHeaderAuditInfo=n,c.proxy.request(e,t,d,u,a,null,n,s,l)},s.prototype.requestEndpointRegistry=function(i,a){var o=this,n=function(e){o.endpointRegistry=e.endpointMap,o.setTokenCookieEnabled(e.tokenCookieEnabled),o.profileType==t.PROFILE_TYPE_STOREFRONT&&o.initializeLastPublishedTimeStamp(),i(e)},l=function(e){a(e)},c=s.ENDPOINT_REGISTRY_SERVICE_PATH;o.profileType==t.PROFILE_TYPE_ADMIN?c=s.ADMIN_ENDPOINT_REGISTRY_SERVICE_PATH:o.profileType==t.PROFILE_TYPE_AGENT&&(c=s.AGENT_ENDPOINT_REGISTRY_SERVICE_PATH);var d=null,u={dataType:e.JSON,type:e.GET,url:c,processData:!1,success:function(e,t,r){n(e)},error:function(e,t,r){var i=e.responseText;if(""!==i)try{i=JSON.parse(i)}catch(e){}l(e.responseText)}};o.profileType&&!o.previewMode&&(d={},d[e.PROFILE_TYPE_HEADER_NAME]=o.profileType),o.tokenSecret&&(null==d&&(d={}),d[e.AUTH_HEADER_NAME]=e.AUTH_HEADER_PREFIX+o.tokenSecret),null==d&&(d={}),o.updateHeaderWithVisitData(d),d&&(u.headers=d),r.ajax(u)},s.prototype.requestTokenCookieEnabledFlag=function(i,a){var o=this,n=function(e){o.setTokenCookieEnabled(e.tokenCookieEnabled),i(e)},l=function(e){a(e)},c=s.ENDPOINT_REGISTRY_SERVICE_PATH;o.profileType==t.PROFILE_TYPE_ADMIN?c=s.ADMIN_ENDPOINT_REGISTRY_SERVICE_PATH:o.profileType==t.PROFILE_TYPE_AGENT&&(c=s.AGENT_ENDPOINT_REGISTRY_SERVICE_PATH),c+="?fields=tokenCookieEnabled";var d={dataType:e.JSON,type:e.GET,url:c,processData:!1,success:function(e,t,r){n(e)},error:function(e,t,r){var i=e.responseText;if(""!==i)try{i=JSON.parse(i)}catch(e){}l(e.responseText)}};r.ajax(d)},s.prototype.initializeLastPublishedTimeStamp=function(){var e=this,t=function(t){t&&t.hasOwnProperty(s.LAST_PUBLISHED_TIME_STAMP)&&(e.lastPublishedTimeStamp=t[s.LAST_PUBLISHED_TIME_STAMP])},r=function(e){};e.request("getLastPublishedTime",null,t,r)},s.prototype.registryLookup=function(t){var r=this;if(null==this.endpointRegistry)return null;var i=e.convertUrl(t);if(null==i)return null;for(var a=null,o=i.length;o>0&&null==a;o--){var n=null,s=i.slice(0,o);if(n=s.join(e.EMPTY_STRING),a=r.endpointRegistry[n],null==a)for(var l=0;l<s.length&&null==a;l++){for(var c=0;c<l;c++){var d=s.length-1-c;1==d?s[d]=e.CURLY_BRACES:s[d]=e.SLASH+e.CURLY_BRACES}n=s.join(e.EMPTY_STRING),a=r.endpointRegistry[n]}}return a},s.prototype.insertParamsIntoUri=function(t,r){for(var i=t,a=0;a<r.length;a++)r[a]&&(i=i.replace(e.CURLY_BRACES,r[a]));return i},s.prototype.getStoredValueName=function(t,r){var i=this,a=r;return a||(a=i.profileType),a?t+e.DASH+a:t},s.prototype.storeToken=function(e,t,r){var i=this,a=r;if(void 0==a&&(a=!0),i.tokenCookieEnabled)if(i.tokenSecret=e,a&&!i.loggedIn){var o=function(){null!=t&&t()};i.refresh(o,o)}else null!=t&&t();else{var n=i.getStoredValueName(s.LOCAL_STORAGE_TOKEN);i.setSessionStoredValue(n,e),null!=t&&t()}},s.prototype.storeRefreshToken=function(e){var t=this;if(t.tokenCookieEnabled)return void(t.refreshTokenSecret=e);var r=t.getStoredValueName(s.LOCAL_STORAGE_REFRESH_TOKEN);t.setSessionStoredValue(r,e)},s.prototype.readToken=function(){var e=this;if(e.tokenCookieEnabled)return e.tokenSecret;var t=e.getStoredValueName(s.LOCAL_STORAGE_TOKEN),r=null;return r=e.getSessionStoredValue(t)},s.prototype.getSSOToken=function(e){var r=this;r.external?null!=r.ssoTokenSecret?e():r.request(t.ENDPOINT_SSO_GET_TOKEN,{},function(t){r.ssoTokenSecret=t.token,e()},function(t){console.log("Unable to retrieve SSO token."),r.ssoTokenSecret=null,e()}):e()},s.prototype.readSSOToken=function(){var e=this;return e.external?e.ssoTokenSecret:e.readToken()},s.prototype.readRefreshToken=function(){var e=this;if(e.tokenCookieEnabled)return e.refreshTokenSecret;var t=e.getStoredValueName(s.LOCAL_STORAGE_REFRESH_TOKEN),r=null;return r=e.getSessionStoredValue(t)},s.prototype.clearStoredValues=function(){var e=this;e.clearSessionStoredValue(s.LOCAL_STORAGE_TOKEN),e.clearSessionStoredValue(s.LOCAL_STORAGE_REFRESH_TOKEN),e.profileType!==t.PROFILE_TYPE_LAYOUT_PREVIEW&&e.clearSessionStoredValue(s.LOCAL_STORAGE_TOKEN,t.PROFILE_TYPE_LAYOUT_PREVIEW),e.profileType!==t.PROFILE_TYPE_STOREFRONT&&e.clearSessionStoredValue(s.LOCAL_STORAGE_TOKEN,t.PROFILE_TYPE_STOREFRONT),e.clearStoredValue(t.LOCAL_STORAGE_ORGANIZATION_ID),e.clearStoredValue("role")},s.prototype.clearValues=function(){var e=this;e.tokenSecret=null,e.refreshTokenSecret=null,e.ssoTokenSecret=null,e.profileId=null,e.loggedIn=!1,e.external=!1},s.prototype.setStoredValue=function(e,t){var r=this,i=r.getStoredValueName(e);try{a.getInstance().setItem(i,t)}catch(e){}},s.prototype.getStoredValue=function(e){var t=this,r=t.getStoredValueName(e),i=null;try{i=a.getInstance().getItem(r)}catch(e){}return i},s.prototype.clearStoredValue=function(e){var t=this.getStoredValueName(e);void 0!==t&&null!==t&&a.getInstance().removeItem(t)},s.prototype.setSessionStoredValue=function(e,t){try{a.getInstance().setSessionItem(e,t)}catch(e){}},s.prototype.getSessionStoredValue=function(e){var t=null;try{t=a.getInstance().getSessionItem(e)}catch(e){}return t},s.prototype.clearSessionStoredValue=function(e,t){var r=this.getStoredValueName(e,t);void 0!==r&&null!==r&&a.getInstance().removeSessionItem(r)},s.prototype.parseAndStoreClaims=function(){var r=this,i=e.parseClaimsFromAccessToken(r.tokenSecret);null!=i&&(r.profileId=i[t.TOKEN_PROFILEID_PROPERTY],null==r.profileId&&(r.profileId=i[t.TOKEN_IDCS_PROFILEID_PROPERTY]),r.profileLogin=i[t.TOKEN_SUBJECT_PROPERTY],r.profileRoles=i[t.TOKEN_ROLES_PROPERTY])},s.prototype.insertAuthHeadersAsQueryParams=function(e,t){return e},s.prototype.redirectToAdminLoginScreen=function(){var e=this;e.disableLoginErrorRedirect||(window.top!==window.self&&e.profileType==t.PROFILE_TYPE_LAYOUT_PREVIEW?window.top.location.href=s.ADMIN_LOGIN_SCREEN_URL:document.location.href=s.ADMIN_LOGIN_SCREEN_URL)},s.prototype.generateAuthUrl=function(t,r,i){var a,o=this,n=o.registryLookup(t),s=t;return null!=n&&(a=n.authRequired,s=n.url),s=o.insertParamsIntoUri(s,r),s=e.addQueryParams(s,i),a&&(s=o.insertAuthHeadersAsQueryParams(s,!0)),s},s.prototype.getURLParameter=function(e){var t=document.location.search;if(t&&""!==t){var r,i=(t.split("?")[0],[]),a=t.split("?")[1];if(""!==a){i=a.split("&");for(var o=i.length-1;o>=0;o-=1)if(r=i[o].split("=")[0],r===e)return i[o].split("=")[1]}}return null},s.prototype.removeValidationTokenDetails=function(){a.getInstance().removeItem(t.VALIDATION_TOKEN_EXPIRATION_TIME),a.getInstance().removeItem(t.VALIDATION_TOKEN)},s.prototype.generateOpenIDAuthRequest=function(e,t){var r=this,i=r.generateVerifier();r.setStoredValue(s.OPENID_CODE_CHALLENGE,i);var a={login_prompt:!0,code_challenge:i};r.authenticatedRequest(s.OPENID_AUTHZ_CODE_REQUEST_PATH,a,e,t,"GET",null,null)},s.prototype.generateOpenIDLogoutRequest=function(e,t){var r=this;r.authenticatedRequest(s.OPENID_LOGOUT_REQUEST_PATH,{},e,t,"GET",null,null)},s}),define("ccRestClient",["ccRestClientConstructor","ccConstants","pubsub","ccStoreConfiguration"],function(e,t,r,i){"use strict";var a=function(e,i){(0==i||i<100||i>600)&&!e&&$.Topic(r.topicNames.USER_NETWORK_ERROR).publish([{message:"failure"}]),i==t.HTTP_UNAUTHORIZED_ERROR&&$.Topic(r.topicNames.USER_SESSION_EXPIRED).publish()},o=t.PROFILE_TYPE_STOREFRONT;window.CCStorefrontPreviewMode===!0?o=t.PROFILE_TYPE_LAYOUT_PREVIEW:window.isAgentApplication===!0&&(o=t.PROFILE_TYPE_AGENT);var n=new e(o,a);n.allowSiteSwitchingOnProduction=i.getInstance().allowSiteSwitchingOnProduction(),i.getInstance().allowSiteSwitchingOnProduction.subscribe(function(){n.allowSiteSwitchingOnProduction=i.getInstance().allowSiteSwitchingOnProduction()}),window.endpointRegistry?n.init(!0,!window.isPreviewMode,window.endpointRegistry):n.init(!1,!window.isPreviewMode);try{delete window.isPreviewMode,delete window.endpointRegistry}catch(e){window.isPreviewMode=void 0,window.endpointRegistry=void 0}return n}),define("profiletools",["ccRestClient","knockout","pubsub"],function(e,t,r){"use strict";function i(){var t=this;return t.restApi=e,$.Topic(r.topicNames.REGISTER_SUBMIT).subscribe(this.register),this}return i.prototype.login=function(e,t,r,i){var a=this;a.restApi.login(e,t,function(){r()},function(e){i(e)})},i.prototype.logout=function(){},i.prototype.register=function(e){var i,a,o;i=t.utils.unwrapObservable(e.email),a=t.utils.unwrapObservable(e.password),o=t.utils.unwrapObservable(e.confirmPassword),i&&a?a!==o?$.Topic(r.topicNames.REGISTER_FAILURE).publishWith(this,[{message:"Passwords do not match."}]):$.Topic(r.topicNames.REGISTER_SUCCESS).publishWith(this,[{message:"success"}]):$.Topic(r.topicNames.REGISTER_FAILURE).publishWith(this,[{message:"You must include at least a username and password."}])},i}),define("shared/arrays-poly",[],function(){Array.prototype.find||Object.defineProperty(Array.prototype,"find",{value:function(e){if(null==this)throw new TypeError('"this" is null or not defined');var t=Object(this),r=t.length>>>0;if("function"!=typeof e)throw new TypeError("predicate must be a function");for(var i=arguments[1],a=0;a<r;){var o=t[a];if(e.call(i,o,a,t))return o;a++}}}),Array.prototype.includes||Object.defineProperty(Array.prototype,"includes",{value:function(e,t){function r(e,t){return e===t||"number"==typeof e&&"number"==typeof t&&isNaN(e)&&isNaN(t)}if(null==this)throw new TypeError('"this" is null or not defined');var i=Object(this),a=i.length>>>0;if(0===a)return!1;for(var o=0|t,n=Math.max(o>=0?o:a-Math.abs(o),0);n<a;){if(r(i[n],e))return!0;n++}return!1}})}),!function(e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define("i18nextBackend",[],e):("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).i18nextHttpBackend=e()}(function(){return function e(t,r,i){function a(n,s){if(!r[n]){if(!t[n]){var l="function"==typeof require&&require;if(!s&&l)return l(n,!0);if(o)return o(n,!0);throw(l=new Error("Cannot find module '"+n+"'")).code="MODULE_NOT_FOUND",l}l=r[n]={exports:{}},t[n][0].call(l.exports,function(e){return a(t[n][1][e]||e)},l,l.exports,e,t,r,i)}return r[n].exports}for(var o="function"==typeof require&&require,n=0;n<i.length;n++)a(i[n]);return a}({1:[function(e,t,r){!function(i){!function(){var a;"function"==typeof fetch&&(void 0!==i&&i.fetch?a=i.fetch:"undefined"!=typeof window&&window.fetch&&(a=window.fetch)),void 0===e||"undefined"!=typeof window&&void 0!==window.document||((a=a||e("cross-fetch")).default&&(a=a.default),r.default=a,t.exports=r.default)}.call(this)}.call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"cross-fetch":5}],2:[function(e,t,r){"use strict";function i(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function a(){return{loadPath:"/locales/{{lng}}/{{ns}}.json",addPath:"/locales/add/{{lng}}/{{ns}}",allowMultiLoading:!1,parse:function(e){return JSON.parse(e)},stringify:JSON.stringify,parsePayload:function(e,t,r){return i=r||"",(r=t)in(t={})?Object.defineProperty(t,r,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[r]=i,t;var i},request:u.default,reloadInterval:"undefined"==typeof window&&36e5,customHeaders:{},queryStringParams:{},crossDomain:!1,withCredentials:!1,overrideMimeType:!1,requestOptions:{mode:"cors",credentials:"same-origin",cache:"default"}}}function o(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{};!function(e){if(!(e instanceof o))throw new TypeError("Cannot call a class as a function")}(this),this.services=e,this.options=t,this.allOptions=r,this.type="backend",this.init(e,t,r)}Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var n,s,l,c,d=e("./utils.js"),u=(n=e("./request.js"))&&n.__esModule?n:{default:n},p=(s=o,(l=[{key:"init",value:function(e){var t=this,r=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},i=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{};this.services=e,this.options=(0,d.defaults)(r,this.options||{},a()),this.allOptions=i,this.services&&this.options.reloadInterval&&setInterval(function(){return t.reload()},this.options.reloadInterval)}},{key:"readMulti",value:function(e,t,r){this._readAny(e,e,t,t,r)}},{key:"read",value:function(e,t,r){this._readAny([e],e,[t],t,r)}},{key:"_readAny",value:function(e,t,r,i,a){var o=this,n=this.options.loadPath;"function"==typeof this.options.loadPath&&(n=this.options.loadPath(e,r)),(n=(0,d.makePromise)(n)).then(function(n){n=o.services.interpolator.interpolate(n,{lng:e.join("+"),ns:r.join("+")}),o.loadUrl(n,a,t,i)})}},{key:"loadUrl",value:function(e,t,r,i){var a=this;this.options.request(this.options,e,void 0,function(o,n){if(n&&(500<=n.status&&n.status<600||!n.status))return t("failed loading "+e+"; status code: "+n.status,!0);if(n&&400<=n.status&&n.status<500)return t("failed loading "+e+"; status code: "+n.status,!1);if(!n&&o&&o.message&&-1<o.message.indexOf("Failed to fetch"))return t("failed loading "+e+": "+o.message,!0);if(o)return t(o,!1);var s,l;try{s="string"==typeof n.data?a.options.parse(n.data,r,i):n.data}catch(t){l="failed parsing "+e+" to json"}return l?t(l,!1):void t(null,s)})}},{key:"create",value:function(e,t,r,i,a){var o,n,s,l,c=this;this.options.addPath&&("string"==typeof e&&(e=[e]),o=this.options.parsePayload(t,r,i),n=0,s=[],l=[],e.forEach(function(r){var i=c.options.addPath;"function"==typeof c.options.addPath&&(i=c.options.addPath(r,t)),r=c.services.interpolator.interpolate(i,{lng:r,ns:t}),c.options.request(c.options,r,o,function(t,r){n+=1,s.push(t),l.push(r),n===e.length&&a&&a(s,l)})}))}},{key:"reload",value:function(){var e,t=this,r=this.services,i=r.backendConnector,a=r.languageUtils,o=r.logger,n=i.language;n&&"cimode"===n.toLowerCase()||(e=[],(r=function(t){a.toResolveHierarchy(t).forEach(function(t){e.indexOf(t)<0&&e.push(t)})})(n),this.allOptions.preload&&this.allOptions.preload.forEach(r),e.forEach(function(e){t.allOptions.ns.forEach(function(t){i.read(e,t,"read",null,null,function(r,a){r&&o.warn("loading namespace ".concat(t," for language ").concat(e," failed"),r),!r&&a&&o.log("loaded namespace ".concat(t," for language ").concat(e),a),i.loaded("".concat(e,"|").concat(t),r,a)})})}))}}])&&i(s.prototype,l),c&&i(s,c),o);p.type="backend",r.default=p,t.exports=r.default},{"./request.js":3,"./utils.js":4}],3:[function(e,t,r){!function(i){!function(){"use strict";function a(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,r=new WeakMap;return(a=function(e){return e?r:t})(e)}function o(e){return(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})(e)}function n(e,t){if(t&&"object"===o(t)){var r,i="";for(r in t)i+="&"+encodeURIComponent(r)+"="+encodeURIComponent(t[r]);if(!i)return e;e=e+(-1!==e.indexOf("?")?"&":"?")+i.slice(1)}return e}Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var s,l,c,d=e("./utils.js"),u=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!==o(e)&&"function"!=typeof e)return{default:e};if(t=a(t),t&&t.has(e))return t.get(e);var r,i={},n=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(r in e){var s;"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&((s=n?Object.getOwnPropertyDescriptor(e,r):null)&&(s.get||s.set)?Object.defineProperty(i,r,s):i[r]=e[r])}return i.default=e,t&&t.set(e,i),i}(e("./getFetch.js"));"function"==typeof fetch&&(void 0!==i&&i.fetch?s=i.fetch:"undefined"!=typeof window&&window.fetch&&(s=window.fetch)),d.hasXMLHttpRequest&&(void 0!==i&&i.XMLHttpRequest?l=i.XMLHttpRequest:"undefined"!=typeof window&&window.XMLHttpRequest&&(l=window.XMLHttpRequest)),"function"==typeof ActiveXObject&&(void 0!==i&&i.ActiveXObject?c=i.ActiveXObject:"undefined"!=typeof window&&window.ActiveXObject&&(c=window.ActiveXObject)),"function"!=typeof(s=s||!u||l||c?s:u.default||u)&&(s=void 0),u=function(e,t,r,i){return"function"==typeof r&&(i=r,r=void 0),i=i||function(){},s?function(e,t,r,i){e.queryStringParams&&(t=n(t,e.queryStringParams));var a=(0,d.defaults)({},"function"==typeof e.customHeaders?e.customHeaders():e.customHeaders);r&&(a["Content-Type"]="application/json"),s(t,(0,d.defaults)({method:r?"POST":"GET",body:r?e.stringify(r):void 0,headers:a},"function"==typeof e.requestOptions?e.requestOptions(r):e.requestOptions)).then(function(e){return e.ok?void e.text().then(function(t){i(null,{status:e.status,data:t})}).catch(i):i(e.statusText||"Error",{status:e.status})}).catch(i)}(e,t,r,i):d.hasXMLHttpRequest||"function"==typeof ActiveXObject?function(e,t,r,i){r&&"object"===o(r)&&(r=n("",r).slice(1)),e.queryStringParams&&(t=n(t,e.queryStringParams));try{var a=l?new l:new c("MSXML2.XMLHTTP.3.0");a.open(r?"POST":"GET",t,1),e.crossDomain||a.setRequestHeader("X-Requested-With","XMLHttpRequest"),a.withCredentials=!!e.withCredentials,r&&a.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),a.overrideMimeType&&a.overrideMimeType("application/json");var s=e.customHeaders;if(s="function"==typeof s?s():s)for(var d in s)a.setRequestHeader(d,s[d]);a.onreadystatechange=function(){3<a.readyState&&i(400<=a.status?a.statusText:null,{status:a.status,data:a.responseText})},a.send(r)}catch(e){console&&console.log(e)}}(e,t,r,i):void 0},r.default=u,t.exports=r.default}.call(this)}.call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./getFetch.js":1,"./utils.js":4}],4:[function(e,t,r){"use strict";function i(e){return(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})(e)}Object.defineProperty(r,"__esModule",{value:!0}),r.defaults=function(e){return a.call(o.call(arguments,1),function(t){if(t)for(var r in t)void 0===e[r]&&(e[r]=t[r])}),e},r.hasXMLHttpRequest=function(){return"function"==typeof XMLHttpRequest||"object"===("undefined"==typeof XMLHttpRequest?"undefined":i(XMLHttpRequest))},r.makePromise=function(e){return function(e){return!!e&&"function"==typeof e.then}(e)?e:Promise.resolve(e)};var r=[],a=r.forEach,o=r.slice},{}],5:[function(e,t,r){},{}]},{},[2])(2)}),define("ccLogger",[],function(){"use strict";function e(){}return e.prototype.info=function(e,t){"undefined"!=typeof console&&(void 0!==t&&null!==t?console.info("(INFO) "+e,t):console.info("(INFO) "+e))},e.prototype.debug=function(e,t){"undefined"!=typeof console&&(console.debug||"undefined"==typeof console.log||(console.debug=console.log),"undefined"!==t&&null!==t?console.debug("(DEBUG) "+e,t):console.debug("(DEBUG) "+e))},e.prototype.warn=function(e,t){"undefined"!=typeof console&&(void 0!==t&&null!==t?console.warn("(WARN) "+e,t):console.warn("(WARN) "+e))},e.prototype.error=function(e,t){"undefined"!=typeof console&&(void 0!==t&&null!==t?console.error("(ERROR) "+e,t):console.error("(ERROR) "+e))},new e}),define("ccDate",["moment","ccConstants","ccLogger"],function(e,t,r){"use strict";function i(){}return i.prototype.DEFAULT_DATE_FORMAT="MM-DD-YYYY HH:mm:ss.SSS",i.prototype.init=function(e){e!=t.DEFAULT_LANG&&(requirejs.s.contexts._.nextTick=function(e){e()},require(["momentLangs/"+e.toLowerCase()],function(){},function(t){r.warn("No language file found for locale "+e)}),requirejs.s.contexts._.nextTick=requirejs.nextTick)},i.prototype.formats={time:"LT",short:"L",medium:"LL",long:"LLL",full:"LLLL",default:"LL"},i.prototype.getDateFormat=function(t){return t?e.localeData()._longDateFormat[this.formats[t]]:e.localeData()._longDateFormat[this.formats.default]},i.prototype.setDateToTimeZone=function(t,r){var i,a,o="";return!!t&&(a=new Date,i=a.toString().split(" ")[5].split("T")[1],r&&(t=t.slice(0,19)+i),o=e(t).format())},i.prototype.formatDateForEndpoint=function(t,r){var i;return!!t&&(i=r?e(t).format():e(t))},i.prototype.dateTimeFormatter=function(t,r,i){var a,o="";return!!t&&(r?o+=r:o=i&&this.formats[i]?this.formats[i]:this.formats.default,a=e(t).format(o))},i.prototype.formatDateAndTime=function(t,r,i,a){var o=this,n="";if(!t)return"";i?n+=i:n=a&&this.formats[a]?this.formats[a]:this.formats.default;var s=null;return r?(e(t,r).isValid()||(t=e(t).format(r)),t=e(t,r).format(o.DEFAULT_DATE_FORMAT),s=e(t,o.DEFAULT_DATE_FORMAT)):s=e(t),s.format(n)},i.prototype.parseDateAndTime=function(t,r){var i=null;return t&&r?i=e(t,r):""},new i}),define("CCi18n",["shared/arrays-poly","i18next","i18nextBackend","pubsub","ccDate","ccRestClient","ccConstants"],function(e,t,r,i,a,o,n){"use strict";function s(){var e,t,r,i=[];if(this.languageSet=!1,this.languageSetComplete=!1,this.initialized=!1,this.initComplete=!1,this.localeDeferred=$.Deferred(),this.initDeferred=$.Deferred(),t=$(":root").attr("lang")){var a=t.replace("-","_").split("_");a=this.normalizeLocale(a),e=a.join("-")}if(r=$(":root").data("accepted-langs")){for(var o=r.split(","),n=!1,s=0;s<o.length;s++){var l=o[s].replace("_","-");l=l.replace("_#",""),l!==t&&("zh-CN"===l&&(l="zh-Hans"),"zh-TW"===l&&(l="zh-Hant"),i.push(l),"en"===l&&(n=!0))}n||i.push("en")}this.i18nOptions={lng:e,compatibilityJSON:"v1",compatibilityAPI:"v1",preload:["en"],fallbackLng:i.length>1?i:"en",ns:["ns.common","ns.ccformats"],defaultNs:["ns.common"],contextSeparator:":",debug:!1,useLocalStorage:!1,useCookie:!1,returnNull:!0,returnEmptyString:!0,appendNamespaceToMissingKey:!0,joinArrays:"\n",interpolation:{prefix:"__",suffix:"__",unescapeSuffix:"HTML",escapeValue:!1,nestingPrefix:"$t(",nestingSuffix:")"},backend:{loadPath:"locales/__lng__/__ns__.json",addPath:"locales/__lng__/__ns__.json"}}}return s.prototype.normalizeLocale=function(e){return 3==e.length&&""===e[1]&&(e.splice(1,1),e[1]=e[1].replace("#","")),"zh"===e[0]&&"CN"===e[1]&&(e[1]="Hans"),"zh"===e[0]&&"TW"===e[1]&&(e[1]="Hant"),e},s.prototype.init=function(e,a){this.initialized=!0;var o=this;t.use(r).init(e,function(e){o.initComplete=!0,a&&a.apply(e),$.Topic(i.topicNames.LOCALE_READY).publish(e)})},s.prototype.deferInit=function(e,a){return this.initDeferred.done(function(o,n){$.extend(e,o),t.use(r).init(e,function(e){a&&a.apply(e),n&&n.apply(e),$.Topic(i.topicNames.LOCALE_READY).publish(e)})}),this.initDeferred.promise()},s.prototype.loadNamespace=function(e,r,i){t.loadNamespaces("ns."+e,function(){var a=r;r?a.returnObjects=!0:a={returnObjects:!0};var o=t.t("ns."+e+":resources",a);i(o)})},s.prototype.t=t.t.bind(t),s.prototype.addResourceBundle=function(e,r,i,a,o){t.addResourceBundle(e,r,i,a,o)},s.prototype.setLocale=function(e,r){var o=function(o){a.init(e),e!==t.language&&t.setLng(e,function(t){$.Topic(i.topicNames.LOCALE_SET).publish(e),r&&r.apply(t)})};this.initialized||this.initDeferred.isResolved?o():(this.initDeferred.resolve({fallbackLng:e,lng:e},r),this.localeDeferred.done(o))},s.prototype.setLocaleOnce=function(e,t){var r=e.replace("-","_").split("_");if("zh"===r[0]&&(r=this.normalizeLocale(r),e=r.join("-")),this.languageSet)this.languageSetComplete?t&&t.call(this):this.localeDeferred.done(t);else{var i=this;this.setLocale(e,function(e){t&&t.apply(this,e),i.languageSetComplete=!0,i.localeDeferred.resolve()}),this.languageSet=!0}},s.prototype.loadResources=function(e,t,r,i){var a={};a.locale=e;var s=function(e){if(e.hasOwnProperty(n.RESOURCES_KEY)){var t={};t.resources=e[n.RESOURCES_KEY],i(null,t)}else l(e)},l=function(e){o.commonErrorCallback(e,e.status),e.hasOwnProperty(n.ERRORS_KEY)&&i(e[n.ERRORS_KEY],null)};o.request(n.ENDPOINT_RESOURCES_GET_BUNDLE,a,s,l,t)},s.prototype.getLanguagesToResolveHierarchy=function(e){var r=t.services.languageUtils.toResolveHierarchy(e);return r},s.prototype.ajax=function(e,t,r){var i=e.match(/\/(ns\..*)\?locale=(.*)/),a=i[1],s=i[2],l={};l.locale=s;var c=function(e){if(e.hasOwnProperty(n.RESOURCES_KEY)){var t={};t.resources=e[n.RESOURCES_KEY],r(JSON.stringify(t),{status:200})}else d(e)},d=function(e){o.commonErrorCallback(e,e.status),e.hasOwnProperty(n.ERRORS_KEY)&&r(e[n.ERRORS_KEY],{status:e.status})};o.request(n.ENDPOINT_RESOURCES_GET_BUNDLE,l,c,d,a)},s.prototype.ajax=function(e,t,r,i){var a=t.match(/\/(ns\..*)\?locale=(.*)/),s=a[1],l=a[2],c={};c.locale=l;var d=function(e){if(e.hasOwnProperty(n.RESOURCES_KEY)){var t={};t.resources=e[n.RESOURCES_KEY];var r={};r.status=200,r.data=t,i(null,r)}else u(e)},u=function(e){o.commonErrorCallback(e,e.status),e.hasOwnProperty(n.ERRORS_KEY)&&i(e[n.ERRORS_KEY],{status:e.status})};o.request(n.ENDPOINT_RESOURCES_GET_BUNDLE,c,d,u,s)},new s}),define("ccPasswordValidator",["knockout","CCi18n"],function(e,t){"use strict";function r(){}return r.prototype.LOWER_CASE_LETTERS="abcdefghijklmnopqrstuvwxyz",r.prototype.UPPER_CASE_LETTERS="ABCDEFGHIJKLMNOPQRSTUVWXYZ",r.prototype.NUMBER_LIST="0123456789",r.prototype.SYMBOLS_LIST="~!@#$%^&*()_-+={}[]|:;<>,./?",r.prototype.embeddedAssistance="",r.prototype.validate=function(e,t,r,i){var a=this;if(!r)return!0;var o=r.useMinPasswordLength,n=r.minPasswordLength,s=r.cannotUseUsername,l=r.useMixedCase,c=r.useNumber,d=r.useSymbol,u=r.allowedSymbols,p=(r.cannotUsePreviousPasswords,r.numberOfPreviousPasswords,!1);null!=e&&void 0!=e&&""!=e||(p=!0);var h,g=!1;"true"==o&&e.length<n&&(g=!0),"true"==s&&""!=t&&e.toLowerCase()===t.toLowerCase()&&(g=!0),"true"==c&&(h=a.checkAgainst(e,a.NUMBER_LIST),h||(g=!0)),"true"==d&&(h=a.checkAgainst(e,u),h||(g=!0)),"true"==l&&(h=a.hasMixedCase(e),h||(g=!0));var f=!1;return g?(f=!1,a.embeddedAssistance=a.getAllEmbeddedAssistance(r,i)):(a.embeddedAssistance="",f=!0),!!p||f},r.prototype.getAllEmbeddedAssistance=function(e,r){var i=e.useMinPasswordLength,a=e.minPasswordLength,o=e.cannotUseUsername,n=e.useMixedCase,s=e.useNumber,l=e.useSymbol,c=e.allowedSymbols,d=e.cannotUsePreviousPasswords,u=(e.numberOfPreviousPasswords,t.t("ns.common:resources.embeddedAssistancePreText")),p=!1;return"true"==i&&(u+=" "+t.t("ns.common:resources.embeddedAssistanceMinPasswordLengthText",{min:a}),p=!0),"true"==o&&(u+=1==p?", ":" ",u+=t.t("ns.common:resources.embeddedAssistanceCannotUseUsernameText"),p=!0),"true"==s&&(u+=1==p?", ":" ",u+=t.t("ns.common:resources.embeddedAssistanceUseNumber"),p=!0),"true"==l&&(u+=1==p?", ":" ",u+=t.t("ns.common:resources.embeddedAssistanceUseSymbol",{chars:c}),p=!0),"true"==n&&(u+=1==p?", ":" ",u+=t.t("ns.common:resources.embeddedAssistanceUseMixedCase"),p=!0),1==r&&"true"==d&&(u+=1==p?", ":" ",u+=t.t("ns.common:resources.embeddedAssistanceNotInPreviousNPasswords"),p=!0),u+="."},r.prototype.hasMixedCase=function(e){var t=this,r=!1;if(null==e)return!1;for(var i=!1,a=!1,o=0;o<e.length;o++){var n=e.charAt(o);t.LOWER_CASE_LETTERS.lastIndexOf(n)!=-1&&(i=!0),t.UPPER_CASE_LETTERS.lastIndexOf(n)!=-1&&(a=!0)}return i&&a&&(r=!0),r},r.prototype.checkAgainst=function(e,t){var r=!1;if(null==e)return!1;if(0==t.length)return!0;for(var i=0;i<e.length;i++){var a=e.charAt(i);t.lastIndexOf(a)!=-1&&(r=!0)}return r},new r}),define("ccKoValidateRules",["knockout","jqueryui","koValidate","ccPasswordValidator"],function(e,t,r,i){"use strict";e.validation.rules.creditcard={validator:function(t,r){if(!r)return!1;if(!(r.iin&&r.length&&e.isObservable(r.iin)&&e.isObservable(r.length)))return!1;var i=r.iin(),a=r.length();if(!i||!a||""===i||""===a)return!1;if(!t||""===t)return"0"===a;var o=t,n=new RegExp("^("+i+")");if(!o.match(n))return!1;for(var s=a.split("|"),l="",c=0;c<s.length;c++)0!==c&&(l+="|"),l+="^[0-9]{"+s[c]+"}$";var d=new RegExp(l);if(!o.match(d))return!1;var u=function(e){for(var t=0,r=e.length,i=1;i<=r;i++){var a=parseInt(e[r-i],10);i%2==0&&(a*=2,a>9&&(a-=9)),t+=a}return t%10==0};return!!u(o)},message:"Card Number is invalid."},e.validation.rules.cvv={validator:function(t,r){if(!r)return!1;var i=0;if(i=e.isObservable(r)?r():r,i=parseInt(i,10),!t||""===t)return 0===i;var a=new RegExp("^[0-9]{"+i+"}$");return!!t.match(a)},message:"Card CVV is invalid."};var a=e.observable(!0),o=e.observable(!0);e.validation.rules.startmonth={validator:function(t,r){if(!r||!e.isObservable(r))return!1;if(!t||""===t)return!0;var i=t,o=new RegExp("^((0[1-9])|(1[0-2]))$");if(!i.match(o))return!1;if(!r())return!0;var n=new Date,s=n.getUTCFullYear(),l=n.getUTCMonth();return parseInt(r(),10)===s&&parseInt(i,10)>++l?(a(!1),!1):(a(!0),!0)},message:"Start Month is invalid."},e.validation.rules.startyear={validator:function(e){return!e||""===e||a()},message:"Start Year is invalid."},e.validation.rules.importFileName={validator:function(e){var t=[".csv"];return new RegExp("("+t.join("|").replace(/\./g,"\\.")+")$").test(e)},message:"invalid file extension."},e.validation.rules.mediaZipFileName={validator:function(e){var t=[".zip"];return new RegExp("("+t.join("|").replace(/\./g,"\\.")+")$").test(e)}},e.validation.rules.endmonth={validator:function(e,t){if(!e||""===e)return!0;var r=e,i=new RegExp("^((0[1-9])|(1[0-2]))$");if(!r.match(i))return!1;if(!t)return!0;var a=new Date,n=a.getUTCFullYear(),s=a.getUTCMonth();return parseInt(t,10)===n&&parseInt(r,10)<++s?(o(!1),!1):(o(!0),!0)},message:"End Month is invalid."},e.validation.rules.endyear={validator:function(e){return!e||""===e||o()},message:"End Year is invalid."},e.validation.rules.observablePattern={validator:function(t,r){if(!r)return!1;var i="";if(i=e.isObservable(r)?r():r,!i||""===i)return!1;if(!t||""===t)return!0;var a=new RegExp(i);return!!t.match(a)},message:"Observable Pattern Match Failed."},e.validation.rules.alphaNumeric={validator:function(e){return!e||e.match(/^[A-Za-z0-9(\s)]+$/)},message:"Field may only contain alphanumeric characters"},e.validation.rules.bool={validator:function(e){return e===!0||!e},message:"Value must be true or false"},e.validation.rules.alphaNumericWithSeperators={validator:function(e){return!e||e.match(/^[A-Za-z0-9_\-\s]+$/)},message:"Field may only contain alphanumeric characters and -, spaces, or _"},e.validation.rules.alphaNumericNoSpacesWithSeperators={
- validator:function(e){return!e||e.match(/^[A-Za-z0-9_\-]+$/)},message:"Field may only contain alphanumeric characters and - or _"},e.validation.rules.alphaNumericNoSpacesNoDashesWithSeperators={validator:function(e){return!e||e.match(/^[A-Za-z0-9_]+$/)},message:"Field may only contain alphanumeric characters and _"},e.validation.rules.alphaNumericNoSpacesNoDashesWithSeperators={validator:function(e){return!e||e.match(/^[A-Za-z0-9_]+$/)},message:"Field may only contain alphanumeric characters and _"},e.validation.rules.restrictSlashCharacters={validator:function(e){return!e||!e.match(/[\/\\]+/)},message:"Field may not contain forwardslash or backslash."},e.validation.rules.alphaNumericNoSpaces={validator:function(e){return!e||e.match(/^[A-Za-z0-9]+$/)},message:"Field may only contain alphanumeric characters and no spaces"},e.validation.rules.cartPicker={validator:function(e){if(!e)return!0;var t,r=e.length;for(t=0;t<r;t++){var i=parseInt(e[t].quantity,10);if(""!=e[t].productId){if(isNaN(i)||i<=0||i>=100)return!1}else if(""!=e[t].quantity)return!1}var a=0,o=[],n={};for(t=0;t<r;t++)""!=e[t].productId&&(n[e[t].productId]=0,a+=1);for(t in n)o.push(t);return!(a>o.length)},message:"Please ensure each item has a quantity specified"},e.validation.rules.cartPickerUniqueProducts={validator:function(e){if(!e)return!0;var t,r=e.length,i=0,a=[],o={};for(t=0;t<r;t++)""!=e[t].productId&&(o[e[t].productId]=0,i+=1);for(t in o)a.push(t);return!(i>a.length)},message:"Please ensure there are no Duplicate product IDs"},e.validation.rules.price={validator:function(e,t){return!t||(null===e||"undefined"==typeof e||""===e||/^\d*\.?\d+$/.test(e))},message:"Please enter a valid price"},e.validation.rules.laterDate={validator:function(e,t){var r,i,a;return!!e&&(r=new Date(e),i=new Date,a=i-r,a<0)},message:"Please enter a proper date"},e.validation.rules.url={validator:function(e,t){if("boolean"==typeof t&&!t)return!0;if(t instanceof Object&&t.validate&&t.validate===!1)return!0;var r=!1;t instanceof Object&&t.protocolOptional&&(r=t.protocolOptional);var i=/^(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!-\/]))?$/,a=/^(ftp|http|https)?:\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!-\/]))?$/;if(e){for(var o=e.split("\n"),n=[],s=0;s<o.length;s++)for(var l=o[s].split(","),c=0;c<l.length;c++)n.push(l[c]);for(var d=/^(ftp|http|https):\/\//,u=/:\/\//,p=0;p<n.length;p++)if(!r||u.test(n[p].trim())||d.test(n[p].trim())){if(!a.test(n[p].trim()))return!1}else if(!i.test(n[p].trim()))return!1;return!0}return!0},message:"Please enter a valid URL"},e.validation.rules.absoluteOrRelativeURL={validator:function(e,t){if(!t)return!0;var r=/^(?:(?:https?|ftp):\/\/)(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)(?:\.(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)*(?:\.(?:[a-z\u00a1-\uffff]{2,}))?\.?)(?::\d{2,5})?(?:[/?#]\S*)?$/i,i=/^\/\S*$/i;return!e||!(!r.test(e)&&!i.test(e))},message:"Please enter a valid URL"},e.validation.rules.number={validator:function(e,t){return!t||(null===e||"undefined"==typeof e||""===e||t&&/^-?\d*\.?\d+$/.test(e))},message:"Please enter a number"},e.validation.rules.match={getValue:function(e){return"function"==typeof e?e():e},validator:function(e,t){return e===this.getValue(t)},message:"Values must match"},e.validation.rules.propertyIdAlreadyInUse={validator:function(e,t){var r;if(t&&e&&t.createProperty()&&t.existingPropertyids())for(var i=(t.existingPropertyids,0),a=t.existingPropertyids().length;i<a;++i)if(t.existingPropertyids()[i]&&(r=t.existingPropertyids()[i].id,r&&e.toLowerCase()===r.toLowerCase()))return!1;return!0},message:"Property Id is already in use"},e.validation.rules.propertyNameAlreadyInUse={validator:function(e,t){var r;if(t&&e&&t.existingPropertyName())for(var i=(t.existingPropertyName,0),a=t.existingPropertyName().length;i<a;++i)if(t.existingPropertyName()[i]&&(r=t.existingPropertyName()[i].displayName))if(t.createProperty()){if(e.toLowerCase()===r.toLowerCase())return!1}else if(""!=t.prevPropertyName()&&null!=t.prevPropertyName()&&e.toLowerCase()!==t.prevPropertyName().toLowerCase()&&e.toLowerCase()===r.toLowerCase())return!1;return!0},message:"Property Name is already in use"},e.validation.rules.password={validator:function(t,r){var a=r.login(),o=r.policies(),n=r.observable,s=r.includePreviousNPasswordRule(),l=i.validate(t,a,o,s);return n.embeddedAssistance=e.observable(i.embeddedAssistance),l},message:"The password entered does not comply with the password policy"},e.validation.rules.uniqueTrimmed={validator:function(t,r){return e.validation.rules.unique.validator(t.trim(),r)}},e.validation.rules.uniqueTrimmedCaseInsensitive={validator:function(t,r){return!t||e.validation.rules.uniqueTrimmed.validator(t.toLowerCase(),r)}},e.validation.rules.maxItemQuantity={validator:function(e,t){if(t&&e){if(t.orderableQuantity&&t.totalQuantity&&t.totalQuantity(!0)>t.orderableQuantity)return!1;if(t.orderLimit&&t.orderLimit<t.totalQuantity(!1))return!1;if("number"==typeof t&&e>t)return!1;if(t.childItems)for(var r=0;r<t.childItems.length;r++){var i=t.childItems[r].productId;if(t.totalQuantity&&t.totalQuantity(!1,i)>t.childItems[r].orderableQuantity)return!1}}return!0}},e.validation.registerExtenders()}),define("pageLayout/simple-cache",["knockout"],function(e){"use strict";function t(){return this.cache={},this}return t.prototype.set=function(e,t,r){var i;this.cache[e]?i=this.cache[e]:(i={},this.cache[e]=i),i[t]=r},t.prototype.get=function(e,t){var r;return this.cache[e]&&(r=this.cache[e][t],r||null===r||r===!1)?{result:r,hit:!0}:{result:null,hit:!1}},t.prototype.flush=function(){this.cache={}},t}),define("navigation",["jquery","crossroads","hasher","pubsub","storageApi","ccConstants","ccRestClient"],function(e,t,r,i,a,o,n){"use strict";function s(){var t,s=this,l=e.Deferred();e.Topic(i.topicNames.USER_UNAUTHORIZED).subscribe(function(e){s.loginHandlerPage=s.getPath(),l.done(function(){t(e)})}),s.setHash=function(e){r.setHash(e)},s.getHash=function(){return r.getHash()},s.setLoginHandler=function(e){t=e,l.resolve()},s.checkLogin=function(e){if(e.indexOf("?loggedIn=false")>-1){var r=e.indexOf("page=")+5,i=decodeURIComponent(e.substr(r));i.indexOf("&")>-1&&(i=i.substr(0,i.indexOf("&"))),i="/"===i.charAt(0)?i:"/"+i;var a=[{message:"success",linkToRedirect:i}];"/"==e.charAt(0)?s.loginHandlerPage=e.substr(1,e.indexOf("?")-1):s.loginHandlerPage=e.substr(0,e.indexOf("?")-1),l.done(function(){t(a)})}},s.goTo=function(t,r,a){var l=s.getPathWithLocale(t),c=n.profileType==o.PROFILE_TYPE_AGENT?window.applicationContextPath:"";if(c.length>0&&0!=l.indexOf(c)&&(l=c+l),r)e.Topic(i.topicNames.HISTORY_PUSH_STATE).publish(l);else if(window.history&&window.history.pushState)a?window.history.replaceState(null,"",l):window.history.pushState(null,"",l),e.Topic(i.topicNames.HISTORY_PUSH_STATE).publish(l),s.checkLogin&&s.checkLogin(t);else{var d=s.getBaseURL()+("/"===l.charAt(0)?l:"/"+l);window.location.assign(d)}},s.getPath=function(){var e=window.location.pathname;return"/"===e.charAt(0)&&(e=e.substr(1)),e},s.getRelativePath=function(){var e=window.location.pathname;return"/"!==e.charAt(0)&&(e="/"+e),e},s.isPathEqualTo=function(e){if(e){var t=s.getPathWithoutLocale(),r=s.getPathWithoutLocale(e);return t="/"===t.charAt(0)?t.substr(1):t,r="/"===r.charAt(0)?r.substr(1):r,0===t.indexOf(r)}return!1},s.getQueryString=function(){return window.location.search},s.getBaseURL=function(){window.location.origin||(window.location.origin=window.location.protocol+"//"+window.location.hostname+(window.location.port?":"+window.location.port:""));var e=window.siteBaseURLPath;return e&&"/"!==e?"/"===e.substr(0,1)?window.location.origin+e:window.location.origin+"/"+e:window.location.origin},s.getPathWithoutLocale=function(e){var t=e?e:window.location.pathname+window.location.search;if(t=s.getPathWithoutSiteBasePath(t),window.urlLocale){var r=JSON.parse(window.urlLocale)[0].name,i=t.split("/");if(i.length>=2)for(var a=0;a<i.length;a++)i[a]===r&&(t=t==="/"+i[a]?"/":t.replace("/"+i[a]+"/","/"))}return t},s.getPathWithoutSiteBasePath=function(e){var t=e?e:window.location.pathname+window.location.search,r=!1,i=window.siteBaseURLPath?window.siteBaseURLPath.split("/"):[];return"/"===t.substr(0,1)&&(r=!0),t=t.split("/").filter(function(e,t){return!(t<i.length)||e!==i[t]}).join("/"),r&&"/"!==t.substr(0,1)&&(t="/"+t),t},s.getPathWithoutApplicationContext=function(e){var t=e;if(window.applicationContextPath&&window.applicationContextPath.length>0){var r=window.applicationContextPath;t=t.replace(r,"")}return t},s.getPathWithoutFacebookContext=function(e){var t=e?e:window.location.pathname+window.location.search;if(window.FacebookCanvas){var r=t.split("/");r.length>=2&&"facebook"==r[1]&&(t=t.replace("/"+r[1],"/wishlist"))}return t},s.getPathWithoutStateContext=function(e){var t=new URLSearchParams(window.location.search),r=t.get("state");return r&&(e=r,window.history.pushState(null,"",r)),e},s.getPathWithoutContext=function(e){return e=s.getPathWithoutApplicationContext(e),e=s.getPathWithoutLocale(e),e=s.getPathWithoutFacebookContext(e),e=s.getPathWithoutStateContext(e)},s.getPathWithLocale=function(e){var t=e?e:window.location.pathname+window.location.search;if(window.urlLocale){var r=JSON.parse(window.urlLocale)[0].name;t="/"===t.charAt(0)?t:"/"+t,t.indexOf("/"+r)===-1&&(t.indexOf("/")===-1&&(t="/"+t),t="/"+r+t)}var i=window.siteBaseURLPath;return n.profileType!==o.PROFILE_TYPE_AGENT&&i&&t.substr(0,i.length)!==i?i+t:t},s.getLocaleBasedUrl=function(e){var t=window.siteBaseURLPath,r=s.getPathWithoutLocale(),i="";return i="/"!==t?s.getBaseURL()+"/"+e+r.replace(t,""):s.getBaseURL()+"/"+e+r},s.doLogin=function(e,t){if(s.getPathWithoutLocale().indexOf("?loggedIn=false")<0){var r=t?t:window.location.pathname;if(1!=a.getInstance().readFromMemory(o.CC_IS_SSO_LOGIN_UNDER_PROGRESS)&&1!=a.getInstance().readFromMemory(o.CC_IS_OPENID_LOGIN_UNDER_PROGRESS)){if(1==a.getInstance().readFromMemory(o.CC_IS_SSO_LOGIN_FAILURE)||1==a.getInstance().readFromMemory(o.CC_IS_OPENID_LOGIN_FAILURE))return;r=r+"?loggedIn=false&page="+encodeURIComponent(e),s.goTo(r)}}},s.cancelLogin=function(){s.goTo(window.location.pathname)}}return new s}),define("pageLayout/rest-adapter",["jquery","knockout","ccRestClient","ccConstants","pageLayout/simple-cache","navigation"],function(e,t,r,i,a,o){"use strict";function n(e){return this.basePath=e,this.cache=new a,this.cacheLoaders={},this.registerCacheLoader(l,this.defaultCacheLoader),this}var s=r,l="__default__";return n.prototype.restToDataTypes={widget:"widget",widgetDefinition:"widgetDefinition",layout:"layout",cart:"product",productList:"product",categoryList:"category"},n.prototype.defaultCacheLoader=function(e,t,r,i){for(var a=0;a<i.length;a++)r[a]&&r[a].id&&i[a]===r[a].id&&e.set(t,i[a],r[a])},n.prototype.registerCacheLoader=function(e,t){this.cacheLoaders[e]=t},n.prototype.getCacheLoader=function(e){return this.cacheLoaders[e]},n.prototype.reassembleDataFromCache=function(e,t){for(var r=this,i=[],a=0;a<t.length;a++)i.push(r.cache.get(e,t[a]).result);return i},n.prototype.cachedRootCategories=function(e,t){},n.prototype.cachedLoadJSON=function(e,t,r,i,a){var o,n,s=this,c=this.restToDataTypes[e],d=function(r){var a,o;o=s.getCacheLoader(e),o||(o=s.getCacheLoader(l)),c&&(n instanceof Array?n instanceof Array&&(o(s.cache,c,r,n),a=s.reassembleDataFromCache(c,t)):(o(s.cache,c,r,[n]),a=r)),i(a)};if(t instanceof Array){n=[];for(var u=0;u<t.length;u++)o=s.cache.get(c,t[u]),o.hit||n.push(t[u]);if(!(n.length>0))return s.reassembleDataFromCache(c,t);this.loadJSON(e,n,r,d,a)}else n=t,o=s.cache.get(c,t),o.hit?i(o.result):this.loadJSON(e,n,r,d,a)},n.prototype.loadJSON=function(t,r,a,n,l){var c,d,u;switch(e.isFunction(a)&&(l=n,n=a,a=null),t){case"widget":c="../shared/widget/"+r+"/non-dist/data/widget.json";break;case"widgetDefinition":c="../shared/widget/"+r+"/non-dist/data/widget.json"}if(c)return void e.ajax({url:c,dataType:"json",type:"GET",success:n,error:l});d={};var p=null,h=!1;switch(t){case"layout":c=i.ENDPOINT_PAGES_GET_PAGE,p=r,d=a;break;case"cart":if(!r||"object"!=typeof r||r.length<1)throw"Error with getting cart";a&&(d=a),d[i.CATALOG]=r[0],d[i.PRODUCT_IDS]=r[1],r[2]&&(d[i.INCLUDE_HISTORICAL]=r[2]),r[3]&&(d[i.STORE_PRICELISTGROUP_ID]=r[3]),r[4]&&(d[i.FIELDS_QUERY_PARAM]=r[4]),r[5]&&(d[i.INCLUDE_CKILD_SKUS_LISTING_IDS]=r[5]),c=i.ENDPOINT_PRODUCTS_LIST_PRODUCTS;break;case"getCurrentProfileOrder":a&&(d=a),c=i.ENDPOINT_GET_PROFILE_ORDER,u="price";break;case i.ENDPOINT_ORDERS_SEARCH:a&&(d=a),c=i.ENDPOINT_ORDERS_SEARCH;break;case"getStockStatus":a&&(d=a),p=r[1],d[i.SKU_ID]=r[0],d[i.CATALOG]=r[2],c=i.ENDPOINT_GET_PRODUCT_AVAILABILITY;break;case i.ENDPOINT_GET_INITIAL_ORDER:p=r,d=a,c=i.ENDPOINT_GET_INITIAL_ORDER;break;case"getStockStatuses":d[i.PRODUCTS_PARAM]=a.products,d[i.CATALOG]=a.catalogId,a.filterKey&&a.filterKey.length>0&&(d[i.FILTER_KEY]=a.filterKey),a.locationIds&&null!==a.locationIds&&""!==a.locationIds&&(d[i.LOCATION_IDS]=a.locationIds),a.includeDefaultLocationInventory&&null!==a.includeDefaultLocationInventory&&(d[i.INCLUDE_DEFAULT_INVENTORY_LOCATION]=a.includeDefaultLocationInventory),c=i.ENDPOINT_PRODUCTS_AVAILABILITY;break;case i.ENDPOINT_GET_PRODUCT_PRICES:p=r,a&&(d[i.SKU_ID]=a),null!=a&&a.constructor===Object&&a.filterKey&&a.filterKey.length>0&&(d[i.FILTER_KEY]=a.filterKey),c=i.ENDPOINT_GET_PRODUCT_PRICES;break;case"orderPricing":d=a,c=i.ENDPOINT_ORDERS_PRICE_ORDER,d[i.CHECKOUT]=!0,u="price";break;case i.ENDPOINT_ORDERS_CREATE_ORDER:d=a,c=i.ENDPOINT_ORDERS_CREATE_ORDER,d[i.CHECKOUT]=!0,u="price";break;case"product":if(!r||"object"!=typeof r||r.length<=1)throw"Error with getting product";a&&(d=a),d[i.CATALOG]=r[1],c=i.ENDPOINT_PRODUCTS_GET_PRODUCT,p=r[0],u="product";break;case"productList":c=i.ENDPOINT_PRODUCTS_LIST_PRODUCTS,a&&(d=a),d[i.CATEGORY]=r,d[i.INCL_CHILDREN]=!0;break;case"categoryList":if(!r||"object"!=typeof r||r.length<=1)throw"Error with getting category list";a&&(d=a),d[i.CATALOG]=r[1],d[i.CATALOG_MAXLEVEL_PARAM]=r[2],d[i.EXPAND_QUERY_PARAM]="childCategories",r[3]?d[i.FIELDS_QUERY_PARAM]=r[3]:d.filterKey||(d[i.FIELDS_QUERY_PARAM]="childCategories(items)"),h=!0,c=i.ENDPOINT_COLLECTIONS_GET_COLLECTION,p=r[0];break;case i.ENDPOINT_SEARCH_SEARCH:d=a,c=i.ENDPOINT_SEARCH_SEARCH;break;case i.ENDPOINT_SEARCH_ASSEMBLER_PAGES:d=a,c=i.ENDPOINT_SEARCH_ASSEMBLER_PAGES,p=r;break;case"assembler":d=a,c=i.ENDPOINT_ASSEMBLE,p="assemble";break;case"paymentauthresponse":p=r,d=a,c=i.ENDPOINT_PAYMENT_GET_PAYMENT_AUTH_RESPONSE;break;case"paymentGroup":a&&(d=a),p=r,c=i.ENDPOINT_GET_PAYMENT_GROUP;break;case"getUser":a&&(d=a),c=i.ENDPOINT_GET_CURRENT_USER;break;case"updateProfile":p=r,d=a,c=i.ENDPOINT_UPDATE_PROFILE;break;case"changePassword":p=null,d=a,c=i.ENDPOINT_UPDATE_PROFILE;break;case"getAllOrdersForProfile":d=a,c=i.ENDPOINT_GET_ALL_ORDERS_FOR_PROFILE;break;case"getAllOrdersCountForProfile":d=a,null===d&&(d={}),d[i.COUNT_ONLY]=!0,c=i.ENDPOINT_GET_ALL_ORDERS_FOR_PROFILE;break;case"dynamicProperties":p=r,c=i.ENDPOINT_METADATA_GET_METADATA,d=a,null===d&&(d={}),d[i.DYNAMIC_ONLY]=!0;break;case"getItemType":p=r,c=i.ENDPOINT_GET_ITEM_TYPE,d=a,null===d&&(d={}),d[i.INCLUDE_BASE]=!1,d[i.PARENT]=r;break;case"sku":if(!r||"object"!=typeof r||r.length<1)throw"Error with getting sku";a&&(d=a),d[i.CATALOG]=r[0],d[i.SKU_IDS]=r[1],d[i.PROD_STATE]=r[2],r[3]&&(d[i.STORE_PRICELISTGROUP_ID]=r[3]),c=i.ENDPOINT_PRODUCTS_LIST_SKUS;break;case"getGiftWithPurchaseChoices":c=i.ENDPOINT_GET_GIFT_CHOICES,a&&(d=a),d[i.GIFT_WITH_PURCHASE_DETAIL]=r[0],d[i.GIFT_WITH_PURCHASE_TYPE]=r[1];break;case"scheduledOrder":d=a,p=r,c=i.ENDPOINT_GET_SCHEDULED_ORDER;break;case"scheduledOrders":d=a,c=i.ENDPOINT_LIST_SCHEDULED_ORDERS_BY_PROFILE;break;case"listMembers":d=a,c=i.ENDPOINT_LIST_CONTACTS_BY_ORGANIZATION}if(!c)throw"No REST target found for item type: "+t;s.request(c,d,function(e){if(n){var t=e;h&&(t=t.items),n(t,u)}},function(e){e.status==i.HTTP_NOT_FOUND?o.goTo("/404",!0,!0):l&&e&&l(e)},p)},n.prototype.persistCreate=function(t,r,a,o,n,l){var c,d={};switch(e.isFunction(o)&&(l=n,n=o,o=null),t){case i.ENDPOINT_ORDERS_PRICE_ORDER:d=a,c=i.ENDPOINT_ORDERS_PRICE_ORDER;break;case i.ENDPOINT_ORDERS_CREATE_ORDER:d=a,c=i.ENDPOINT_ORDERS_CREATE_ORDER;break;case i.ENDPOINT_CREATE_PROFILE:d=a,c=i.ENDPOINT_CREATE_PROFILE;break;case i.ENDPOINT_FORGOT_PASSWORD:d=a,c=i.ENDPOINT_FORGOT_PASSWORD;break;case i.ENDPOINT_UPDATE_EXPIRED_PASSWORD:d=a,c=i.ENDPOINT_UPDATE_EXPIRED_PASSWORD;break;case i.ENDPOINT_SHIPPING_METHODS_LIST_SHIPPING_METHODS:d=a,c=i.ENDPOINT_SHIPPING_METHODS_LIST_SHIPPING_METHODS;break;case"product":break;case"order":d=a,null!=o&&o.incomplete?(c=i.ENDPOINT_UPDATE_PROFILE_ORDER,o.allowMultipleCart?d[i.OP]=i.CREATE_NEW_OP:d[i.OP]=i.CREATE_OP):c=i.ENDPOINT_ORDERS_CREATE_ORDER;break;case"requestQuote":d=a,c=i.ENDPOINT_QUOTE_REQUEST;break;case"rejectQuote":d=a,c=i.ENDPOINT_QUOTE_REJECT;break;case"payment":d=a,c=i.ENDPOINT_PAYMENT_AUTH_PAYMENT,d[i.SITE_ID]=o;break;case"scheduledOrder":d=a,c=i.ENDPOINT_CREATE_SCHEDULED_ORDER;break;case"addPayments":d=a,c=i.ADD_ORDER_PAYMENTS;break;case i.ENDPOINT_PRODUCT_NOTIFY:d=a,c=i.ENDPOINT_PRODUCT_NOTIFY}if(!c)throw"No REST target found for item type: "+t;s.request(c,d,n,l)},n.prototype.persistUpdate=function(t,r,a,o,n,l){var c,d,u,p,h,g,f={};console.log(t);var m=null;switch(e.isFunction(o)&&(l=n,n=o,o=null),t){case"handleOrderAmendment":d={includeShippingGroups:o.includeShippingGroups},f=a,m=r,c=i.ENDPOINT_AMEND_ORDER;break;case"product":break;case"order":f=a,c=i.ENDPOINT_UPDATE_PROFILE_ORDER,f[i.OP]=i.UPDATE_OP;break;case"updateOrder":f=a,m=r,c=i.ENDPOINT_UPDATE_ORDER;break;case"createOrder":f=a,m=r,c=i.ENDPOINT_ORDERS_CREATE_ORDER;break;case"scheduledOrder":f=a,m=r,c=i.ENDPOINT_UPDATE_SCHEDULED_ORDER;break;case"updateOrganization":f=a,m=r,c=i.ENDPOINT_UPDATE_ORGANIZATION}if(!c)throw"No REST target found for item type: "+t;s.request(c,f,n,l,m,u,p,h,g,d)},n.prototype.persistRemove=function(t,r,a,o,n){var l,c={},d=null;switch(e.isFunction(a)&&(n=o,o=a,a=null),t){case"product":break;case"order":l=i.ENDPOINT_REMOVE_PROFILE_INCOMPLETE_ORDER;break;case"scheduledOrder":l=i.ENDPOINT_DELETE_SCHEDULED_ORDER,d=r}if(!l)throw"No REST target found for item type: "+t;s.request(l,c,o,n,d)},n}),define("pageLayout/api-builder",["knockout"],function(e){"use strict";return{regionBuilder:function(e,t){},widgetBuilder:function(e,t){e.prototype.getCurrent=function(e){var r=t.viewModelBuilder[e];return r?r.scope?t.contextHandler.get(e,r.scope):t.contextHandler.get(e,"page"):t.contextHandler.get(e)},e.prototype.setCurrent=function(e,r){var i=t.viewModelBuilder[e];i?i.scope?t.contextHandler.set(e,r,i.scope):t.contextHandler.set(e,r,"page"):t.contextHandler.set(e,r)},e.prototype.listen=function(e,r){t.contextHandler.listen(e,r)},e.prototype.load=function(e,r,i,a,o,n){t.load(e,r,i,a,o,n)},e.prototype.update=function(e,r,i,a,o,n,s){t.update(e,r,i,a,o,n,s)},e.prototype.create=function(e,r,i,a,o,n,s){t.create(e,r,i,a,o,n,s)},e.prototype.remove=function(e,r,i,a,o,n){t.remove(e,r,i,a,o,n)}}}}),define("ccNavState",["module","knockout","pubsub","ccConstants","navigation"],function(e,t,r,i,a){"use strict";function o(){var e=this;e.statusCode=t.observable(),e.referrer=t.observable(),e.slug=t.observable(),e.pageId=t.observable(),e.pageNumber=t.observable(),e.pageContext=t.observable(),e.route=t.observable(),$.Topic(r.topicNames.PAGE_VIEW_CHANGED).subscribe(function(t){t.pageId!=i.HTTP_NOT_FOUND?(e.statusCode(i.HTTP_OK),e.referrer(a.getPathWithLocale()),e.pageId(t.pageId),e.slug(t.seoslug),e.pageContext(t.contextId),e.pageNumber(t.pageNumber)):e.statusCode(i.HTTP_NOT_FOUND)})}return function(){var t;return null!=o.prototype._singleInstance?t=o.prototype._singleInstance:(t=new o,t.statusCode(e.config().statusCode),t.referrer(e.config().referrer),t.slug(e.config().slug),t.pageId(e.config().pageid),t.pageNumber(e.config().pageNumber),t.pageContext(e.config().pageContext),o.prototype._singleInstance=t),t}()}),define("routing",["jquery","crossroads","pubsub","ccConstants","navigation","ccNavState"],function(e,t,r,i,a,o){"use strict";function n(){function n(e,t){return e&&(e="/"===e.charAt(0)?e.substr(1):e),t&&(t="/"===t.charAt(0)?t.substr(1):t),e===t}function g(t,i,o){"/"==t&&(t=window.isAgentApplication?"agentHome":"home"),t="/"===t.charAt(0)?t.substr(1):t;var c=!1;t=a.getPathWithoutLocale(t),n(s,t)&&o&&(c=!0),e.Topic(r.topicNames.PAGE_PAGINATION_CHANGE).publish({page:o,paginationOnly:c},[{message:"success"}]),i&&y.shouldDecode(t)&&(i=decodeURIComponent(i));var d={path:t,parameters:i,page:o,paginationOnly:c};c?l!==i&&e.Topic(r.topicNames.PAGE_PARAMETERS_CHANGED).publish(d):y.handleViewChanged(d),s=t,l=i,p=!0}function f(e,t,r){g(e,r,t)}function m(e){o.route(e),h[e]||(h[e]={pageNumber:t.addRoute(e+"/{pageNumber}",null,800),pageNumberParameters:t.addRoute(e+"/{pageNumber}?{parameters}",null,850)},h[e].pageNumber.matched.add(function(t){f(e,t)}),h[e].pageNumberParameters.matched.add(function(t,r){f(e,t,r)}))}function I(e,t){if("category"===e.data.page.pageId){var r=e.data.page.category.route;m(r)}}function E(){var t=window.location.pathname;if("200"===o.statusCode()&&o.pageNumber()&&o.pageNumber()>1){var n="",s=t.split("/"),l=s[s.length-1];if(l===o.pageNumber()){for(var c=0;c<s.length-1;c++)""!==s[c]&&(n=n+"/"+s[c]);n=a.getPathWithoutContext(n),m(n)}}window.location.search!=i.URL_SERVERSIDE&&(t+=window.location.search),"404"===o.statusCode()&&(t="/404"),e.Topic(r.topicNames.HISTORY_PUSH_STATE).publish(t),a.checkLogin&&a.checkLogin(t)}var y=this,v=t.parse;return t.parse=function(t,i){for(var o=t,n=!0,s=0;s<u.length;s++)if(t&&t.indexOf(u[s])!==-1){n=!1;break}n&&(o=y.uriEncodeQueryString(t));var l=a.getPath(),c={oldHash:l,newHash:o};e.Topic(r.topicNames.UPDATE_HASH_CHANGES).publish(c),o=a.getPathWithoutContext(o),v.call(this,o,i)},e.Topic(r.topicNames.HISTORY_PUSH_STATE).subscribe(y.historyPushed.bind(y)),c=t.addRoute("{path*}",null,500),c.matched.add(g),d=t.addRoute("{path*}?{parameters}",null,600),d.matched.add(g),e.Topic(r.topicNames.PAGE_LAYOUT_LOADED).subscribe(I),window.history&&window.history.pushState&&window.addEventListener("popstate",function(e){t.parse(location.pathname+location.search)}),E(),y}var s=null,l=null,c=null,d=null,u=["searchresults"],p=!1,h={};return n.prototype.uriEncodeQueryString=function(e){if(!e)return null;var t=e,r={};if(e.indexOf("?")!=-1){for(var i=e.split("?"),a=i[1].split("&"),o="",n=0;n<a.length;n++){var s=a[n].split("=");r[s[0]]=encodeURIComponent(s[1])}var l=!1;for(var c in r){var d=r[c];l&&(o+="&"),o+=c+"="+d,l=!0}t=i[0]+"?"+o}return t},n.prototype.historyPushed=function(e){t.parse(e)},n.prototype.handleViewChanged=function(t){e.Topic(r.topicNames.PAGE_VIEW_CHANGED).publish(t)},n.prototype.handleParametersChanged=function(t){e.Topic(r.topicNames.PAGE_PARAMETERS_CHANGED).publish(t)},n.prototype.shouldDecode=function(e){for(var t=!0,r=0;r<u.length;r++)if(u[r].indexOf(e)!==-1){t=!1;break}return t},n}),define("ccEETagProcessor",["pubsub","ccConstants","ccRestClient","jquery"],function(e,t,r,i){"use strict";function a(){}return a.prototype.excludedPages=[],a.prototype.location="",a.prototype.ccMetricsLocation="",a.prototype.configurations={},a.prototype.eeid=0,a.prototype.enabled=!0,a.prototype.tagLoaded=!1,a.prototype.metricsLoaded=!1,a.prototype.layoutId="",a.prototype.ccMetricsTracker={},a.prototype.init=function(){var a=this;a.enabled&&(a.deferred=i.Deferred(),r.request(t.ENDPOINT_GET_EE_PAGE_TAG_DATA,null,a.updateEETagDataSuccess.bind(a),a.updateEETagDataFail.bind(a)),i.Topic(e.topicNames.PAGE_READY).subscribe(function(e){""==a.location?a.deferred.done(function(){a.pageReady(e)}):a.pageReady(e)}),i.Topic(e.topicNames.PAGE_LAYOUT_LOADED).subscribe(a.setLayout.bind(a)),i.Topic(e.topicNames.PAGE_METADATA_CHANGED).subscribe(a.setLayout.bind(a)),i.Topic(e.topicNames.PAGE_VIEW_CHANGED).subscribe(a.pageChanged.bind(a)),i.Topic(e.topicNames.PAGE_CONTEXT_CHANGED).subscribe(a.pageChanged.bind(a)),i.Topic(e.topicNames.PAGE_PARAMETERS_CHANGED).subscribe(a.pageChanged.bind(a)))},a.prototype.updateEETagDataSuccess=function(e){var t=this;t.location=e.location,t.excludedPages=e.excludedPages,t.eeid=e.eeid,t.configurations=e.configurations,t.ccMetricsLocation=e.ccMetricsUrl,t.deferred.resolve()},a.prototype.updateEETagDataFail=function(t){i.Topic(e.topicNames.PAGE_READY).unsubscribe(self.pageReady.bind(self)),i.Topic(e.topicNames.PAGE_VIEW_CHANGED).unsubscribe(self.pageChanged.bind(self)),i.Topic(e.topicNames.PAGE_CONTEXT_CHANGED).unsubscribe(self.pageChanged.bind(self)),i.Topic(e.topicNames.PAGE_PARAMETERS_CHANGED).unsubscribe(self.pageChanged.bind(self)),i.Topic(e.topicNames.PAGE_LAYOUT_LOADED).unsubscribe(self.setLayout.bind(self)),i.Topic(e.topicNames.PAGE_METADATA_CHANGED).unsubscribe(self.setLayout.bind(self))},a.prototype.pageReady=function(e){var t=this;t.excludedPages.indexOf(e.pageId)==-1&&t.location&&(t.tagLoaded?window.ATGSvcs&&(ATGSvcs.setCfg&&ATGSvcs.setCfg("layoutId",t.layoutId),ATGSvcs.ee&&ATGSvcs.ee.reset()):(require([t.location],function(){if(window.ATGSvcs){window.OracleUnifiedVisit&&OracleUnifiedVisit.eeid&&ATGSvcs.setEXPID?(ATGSvcs.setEEID&&ATGSvcs.setEEID(OracleUnifiedVisit.eeid),ATGSvcs.setEXPID(t.eeid)):ATGSvcs.setEEID&&ATGSvcs.setEEID(t.eeid);for(var e in t.configurations)ATGSvcs.setCfg&&ATGSvcs.setCfg(e,t.configurations[e]);ATGSvcs.setCfg&&ATGSvcs.setCfg("layoutId",t.layoutId),ATGSvcs.ee&&ATGSvcs.ee.reset()}}),t.tagLoaded=!0)),t.excludedPages.indexOf(e.pageId)==-1&&t.ccMetricsLocation&&!t.metricsLoaded&&(require([t.ccMetricsLocation],function(e){t.ccMetricsTracker=e}),t.metricsLoaded=!0)},a.prototype.pageChanged=function(e){var t=this;"undefined"!=typeof window.ATGSvcs&&window.ATGSvcs&&t.excludedPages.indexOf(e.pageId)>-1&&(ATGSvcs.stopRules&&ATGSvcs.stopRules(),delete window.ATGSvcs,require.undef(t.location),t.tagLoaded=!1),t.ccMetricsLocation&&t.excludedPages.indexOf(e.pageId)>-1&&(t.ccMetricsTracker.ccMetricUnhook&&t.ccMetricsTracker.ccMetricUnhook(),require.undef(t.ccMetricsLocation),t.metricsLoaded=!1)},a.prototype.setLayout=function(e,t){var r=this;r.layoutId=e.layout()},new a}),define("addThis",["ccConstants","ccRestClient"],function(e,t){"use strict";function r(){var r=0,i=setInterval(function(){var a=addthis.user.interests();if(void 0!==a&&void 0!==a.length&&a.length>0||100==r){clearInterval(i);var o={};o.interests=addthis.user.interests(),t.request(e.ENDPOINT_SAVE_ADDTHIS_INTERESTS,o,function(e){},function(e){})}r++},100)}window.addthis&&void 0!==window.addthis.user&&void 0!==window.addthis.user.ready&&addthis.user.ready(r)}),define("notifications",["jquery","knockout","ccConstants","CCi18n","pubsub"],function(e,t,r,i,a){"use strict";function o(){var o,n,s=this,l=0,c=65;s.enabled=!0,s.publishAccessibleMessages=!1,s.CLOSE_BUTTON_HTML='<a href="#cc-notification-close-button" class="close cc-notification-close pull-right" data-dismiss="alert"><i class="fa fa-times-circle"></i><span class="cc-reader-text">Close notification</span></a>',s.notify=function(t,r){if(s.enabled||r)if(Array.isArray(t))e.each(t,function(e,t){if(null===t.style)throw"Notification type unknown";s.notifyBuild(t)});else{if(null===t.style)throw"Notification type unknown";s.notifyBuild(t)}},s.growlSuccess=function(t,r){Array.isArray(t)?e.each(t,function(e,r){r.style="growl",r.status="success",r.close=!0,r.fade=!0,r.header=t.header||i.t("ns.common:resources.successText")}):(t.style="growl",t.status="success",t.close=!0,t.fade=!0,t.header=t.header||i.t("ns.common:resources.successText")),s.notify(t,r)},s.growlError=function(t,r){Array.isArray(t)?e.each(t,function(e,r){r.style="growl",r.status="error",r.close=!0,r.fade=!0,r.header=t.header||i.t("ns.common:resources.errorText")}):(t.style="growl",t.status="error",t.close=!0,t.fade=!0,t.header=t.header||i.t("ns.common:resources.errorText")),s.notify(t,r)},s.growlRestError=function(e,t,r){var i;e.errors&&e.errors.length>0&&(e.errors[0].message&&(t.message=e.errors[0].message),e.errors[0].errorCode&&(i=e.errors[0].errorCode)),t.code=e.errorCode||i||" ",s.growlError(t,r)},s.inlineError=function(t,r){Array.isArray(t)?e.each(t,function(e,t){t.style="inline",t.status="error",t.close=!1,t.fade=!1}):(t.style="inline",t.status="error",t.close=!1,t.fade=!1),s.notify(t,r)},s.inlineConfirm=function(t,r){Array.isArray(t)?e.each(t,function(e,t){t.style="inline",t.status="confirm",t.curtain=!0,t.close=!1,t.fade=!1}):(t.style="inline",t.status="confirm",t.curtain=!0,t.close=!1,t.fade=!1),s.notify(t,r)},s.growlInfo=function(t,r){Array.isArray(t)?e.each(t,function(e,t){t.style="growl",t.status="info",t.close=!0,t.fade=!0,t.header=this.header||i.t("ns.common:resources.warningText")}):(t.style="growl",t.status="info",t.close=!0,t.fade=!0,t.header=this.header||i.t("ns.common:resources.warningText")),s.notify(t,r)},s.okCancel=function(e,t){e.style="inline",e.status="confirm",e.curtain=!0,e.close?e.actionOptionsFocus=1:e.close=!1,e.fade=!1,e.actionOptions=[{actionOption1:[{text:e.okButtonText||i.t("ns.common:resources.okText"),classes:this.PRIMARY_BUTTON_CLASS,callback:e.okCallback}],actionOption2:[{text:e.cancelButtonText||i.t("ns.common:resources.cancelText"),classes:this.BUTTON_CLASS,callback:e.cancelCallback}]}],s.notify(e,t)},s.continueConfirm=function(e,t){e.style="inline",e.status="confirm",e.curtain=!0,e.close=!1,e.fade=!1,e.actionOptions=[{actionOption1:[{text:i.t("ns.common:resources.continueText"),action:"",classes:"btn cc-btn-primary"}]}],s.notify(e,t)},s.unsavedChangesConfirm=function(e,t){e.header=i.t("ns.common:resources.unsavedChangesHeaderText"),e.message=i.t("ns.common:resources.unsavedChangesMsgText"),e.okButtonText=e.okButtonText||i.t("ns.common:resources.saveChangesText"),e.cancelButtonText=i.t("ns.common:resources.discardChangesText"),e.okCallback=e.okCallback||e.saveCallback,e.cancelCallback=e.cancelCallback||e.discardCallback,s.okCancel(e,t)},s.clearNotifications=function(t){0!==e(t).find(".cc-notification").length&&e(t).find(".cc-notification").remove()},s.emptyNotifications=function(t){e(t).empty()},s.emptyGrowlMessages=function(){e(".cc-notification-growl").remove()},s.notifyID=function(e){var t="cc-notification-"+e+"-";return t+l},s.notifyBuild=function(i){var o,l,c,d="alert cc-notification ",u="",p="",h="",g="",f=0,m="",I=0,E="",y=!1;if(e("#cc-notification-aria-message").remove(),d+="cc-notification-"+i.style+" ",i.status&&""!==i.status&&(d+="alert-"+i.status),c=i.customNotificationID&&""!==i.customNotificationID?i.customNotificationID:s.notifyID(i.style),o=e("<div />").attr({id:c,class:d}),i.close&&e(o).append(s.CLOSE_BUTTON_HTML),i.header&&(e(o).append(e("<div />").attr({class:"cc-notification-header"}).html(e("<div />").text(i.header).html())),m+=i.header+" "),i.message&&(E="cc-notification-message"+(i.header?"":" cc-notification-message-only"),"string"!=typeof i.message?e.each(i.message,function(t,r){e(o).append(e("<div />").attr("class",E).html(e("<div />").text(r).html())),m+=r}):(e(o).append(e("<div />").attr("class",E).html(e("<div />").text(i.message).html())),m+=i.message)),i.template){var v=s.parseTemplateUrl(i.template),b=e("<div/>").attr("data-bind",'template: {name: "'+v.name+'", templateUrl: "'+v.url+'"}');e(o).append(b),t.applyBindings(i.templateData,b.get(0))}if(i.actionOptions&&(y=s.hasCallbacks(i.actionOptions[0]),l=e("<div />").attr("class","cc-notification-actions"),"inline"===i.style&&i.curtain===!0&&(e(o).addClass("cc-notification-with-curtain"),p="$('.cc-curtain').remove();",h="$(this).closest('.cc-notification-inline').remove();$('body').removeClass('no-scroll');",h+="if($('.cc-notification-outer').length > 0) {$('.cc-notification-outer').remove();}",i.modal===!0&&e(i.id).parent(".modal").on("hidden",function(){e(".cc-curtain").remove()})),e.each(i.actionOptions[0],function(t,r){g="",r[0].onCloseFocus&&(g="$('"+r[0].onCloseFocus+"').notificationsSetFocus();");
- var i="";r[0].readerText&&(i=r[0].readerText),y?e(l).append(e("<button />").attr({id:"cc-notification-actionbutton-"+t,class:"cc-notification-actionbutton-class "+r[0].classes}).attr("data-bind","makeAccess: {readerText: "+i+"}").text(r[0].text)):e(l).append(e("<button />").attr({class:r[0].classes,onClick:h+p+g+r[0].action}).attr("data-bind","makeAccess: {readerText: "+i+"}").text(r[0].text))}),e(o).append(l)),i.formErrors){var T,P,S=e("<div />").attr("class","cc-notification-errorFields").append(e("<ul />"));e.each(i.formErrors,function(t,r){u="$('#"+r.formId+"').notificationsSetFocus()",i.focusFunction?S.append(e("<li />").append(e("<a />").attr({href:"javascript:void(0);"}).text(r.label).on("click",function(){i.focusFunction(r.formId)}))):1===e("#"+r.formId).parents(".tab-pane").length?(P=e("#"+r.formId).parents(".tab-pane"),1===e("#"+P[0].id).closest(".modal").length?T=e("#"+P[0].id).closest(".modal").find(".cc-alta-nav-tabs a[href='#"+P[0].id+"']").parent():(T=e("#tab-"+P[0].id),0===T.length&&(T=e("#"+P[0].id).closest(".panel").find(".cc-alta-nav-tabs a[href='#"+P[0].id+"']").parent())),S.append(e("<li />").append(e("<a />").attr({href:"javascript:void(0);",onClick:"$('#"+T[0].id+" a').tab('show');$('#"+r.formId+"').notificationsSetFocus()"}).text(r.label)))):S.append(e("<li />").append(e("<a />").attr({href:"javascript:void(0);",onClick:"$('#"+r.formId+"').notificationsSetFocus()"}).text(r.label))),m+=" "+r.label}),e(o).append(S)}if(s.publishAccessibleMessages){var C="error"===i.status||"danger"===i.status||"confirm"===i.status;e.Topic(a.topicNames.ARIA_ANNOUNCEMENT_REQUESTED).publish(m,C)}else e("body").prepend(e("<div />").attr({id:"cc-notification-aria-message",class:"cc-reader-text",role:"alert","aria-relevant":"additions removals","aria-live":"assertive"}).text(m));if("inline"==i.style?i.curtain===!0?(e(o).addClass("cc-inline-curtain"),n=e("<div />").attr({class:"cc-notification-outer"}),e(i.id).prepend(e(n).append(e(o)))):e(i.id).hasClass("oj-tabs")?e(i.id).children("div").each(function(){e(this).prepend(e(o).clone(!0))}):e(i.id).prepend(e(o)):"growl"==i.style&&(e("body").append(e(o)),s.notifyTop(),e(o).bind("closed",function(){setTimeout(function(){s.notifyTop()},100);s.notifyFocus()})),e(".cc-notification-close").on("click",function(){var t=e(".cc-notification-outer");if(e("body").hasClass("no-scroll")&&e("body").removeClass("no-scroll"),e(".cc-curtain")&&e(".cc-curtain").remove(),t){var r=t.parent();e(".cc-notification-outer").remove(),e(r).find(":tabbable").first().focus()}i.closeHandler&&i.closeHandler()}),y&&e.each(i.actionOptions[0],function(t,r){var a=e("#cc-notification-actionbutton-"+t);a&&a.on("click",function(){"inline"===i.style&&i.curtain===!0&&(e(this).closest(".cc-notification-inline").remove(),e(this).closest(".cc-notification-growl").remove(),e("body").removeClass("no-scroll"),e(".cc-notification-outer").length>0&&e(".cc-notification-outer").remove(),e(".cc-curtain").remove()),r[0].onCloseFocus&&e(r[0].onCloseFocus).notificationsSetFocus(),s.cleanUp(),r[0].callback&&r[0].callback()})}),i.fade!==!1){var _=r.NOTIFICATION_FADE_DEFAULT;i.fade!==!0&&(_=i.fade);var A=r.NOTIFICATION_DELAY_DEFAULT;i.delay&&(A=i.delay),e(o).delay(A).fadeOut(_,s.doFade),e(o).mouseenter(function(){e(this).stop(!0,!0)}),e(o).mouseleave(function(){e(this).fadeOut(_,s.doFade)})}i.curtain===!0&&("inline"===i.style?0!==e(i.id).parents(".modal-content").length?e(i.id).parents(".modal-content").append(e("<div />").attr("class","cc-curtain fade in")):(e(i.id).append(e("<div />").attr("class","cc-curtain fade in").attr("style","z-index:1042")),window.scrollTo(0,e(i.id).offset().top),window.setTimeout(function(){e("body").addClass("no-scroll")},0)):e("body").append(e("<div />").attr("class","modal-backdrop fade in")),I=e(".cc-notification-with-curtain :tabbable"),f=I.length,I.each(function(t){e(this).on("keydown",function(t){if(9===t.keyCode){var r;t.shiftKey?(r=parseInt(I.index(e(this)),10)-1,r<0&&(t.preventDefault(),I[f-1].focus())):(r=parseInt(I.index(e(this)),10)+1,r===f&&(t.preventDefault(),I[0].focus()))}})}),i.actionOptionsFocus?e(I[i.actionOptionsFocus]).focus():e(I[0]).focus())},s.doFade=function(){e(this).remove(),e("#notification-info").text("");setTimeout(function(){s.notifyTop()},100);s.notifyFocus()},s.notifyTop=function(){o=e("body").children(".cc-notification-growl"),o.length>=0&&e.each(o,function(t,r){t>0&&(c+=30),e(r).css("top",c),c+=e(r).height()}),c=65},s.notifyFocus=function(){e("#CC-Oracle-Nav UL.nav.nav-pills LI A:first").focus()},s.parseTemplateUrl=function(e){for(""!==infuser.defaults.templateSuffix&&e.indexOf(".")>=0&&(e=e.substring(0,e.lastIndexOf(".")));0===e.indexOf("/");)e=e.substring(1);return{url:e.substring(0,e.lastIndexOf("/")),name:e.substring(e.lastIndexOf("/")+1)}},s.cleanUp=function(){var t=e(".cc-notification-actionbutton-class");t&&t.off("click");var r=e(".cc-notification-close");r&&r.off("click")},s.hasCallbacks=function(t){var r=!1;return e.each(t,function(e,t){t[0].callback&&(r=!0)}),r},s.overlayId="#cc-overlay-clone",s.createNotificationOverlay=function(){var t=e('div[id$="_layer_overlay"]');if(t){var r=t.clone();r.attr("id","cc-overlay-clone"),r.css("opacity","1"),r.css("background","none"),e("#__oj_zorder_container").append(r),r.zIndex(r.zIndex()+1)}},s.destroyNotificationOverlay=function(){var t=e("#cc-overlay-clone");t&&t.length>0&&t.remove()}}return e.fn.notificationsSetFocus=function(){this.is(":visible")?this.focus():this.triggerHandler("focus"),this.data&&this.data().select2&&this.select2("open")},o.prototype.PRIMARY_BUTTON_CLASS="btn cc-btn-primary pull-right",o.prototype.DEFAULT_BUTTON_CLASS="btn btn-default",o.prototype.BUTTON_CLASS="btn",new o}),define("ccOAuthTimeout",["ccConstants","jquery","pubsub","notifications","CCi18n"],function(e,t,r,i,a){"use strict";function o(o){var n=!0,s=null,l=e.TOKEN_WARNING_TIMEOUT,c=null,d=null,u=null,p="cc-warn-session-timeout-alert",h="cc-expire-session-alert",g=function(){t.Topic(r.topicNames.USER_SESSION_VALID).publish(),o.storeRequestWasMade=!1,n=!1,T()},f=function(){var t=function(e){};o.loggedIn&&(n||o.storeRequestWasMade)&&o.refresh(function(t){var r=t.expires_in;if(r){var i=1e3*r-e.TOKEN_EXPIRED_MESSAGE_TIMEOUT;l=Math.max(i,e.TOKEN_REFRESH_INTERVAL+1e4)}g()},t)},m=function(){o.loggedIn&&null==s&&(s=setInterval(f,e.TOKEN_REFRESH_INTERVAL))},I=function(){s&&(clearInterval(s),s=null)},E=function(){if(u=t(document.activeElement),u.is("iframe"))try{u=t(document.activeElement.contentWindow.document.activeElement)}catch(e){}},y=function(){o.profileType==e.PROFILE_TYPE_ADMIN&&0==t(".cc-notification").length&&(E(),i.notify([{style:"inline",id:"#cc-message-center",customNotificationID:p,status:"confirm",curtain:!0,close:!1,fade:!1,header:a.t("ns.common:resources.sessionTimeoutHeader"),message:a.t("ns.common:resources.sessionTimeoutMessage"),actionOptions:[{actionOption1:[{text:a.t("ns.common:resources.sessionExtendText"),action:"",classes:"btn cc-submit-changes-btn cc-btn-primary"}]}]}]),t("button","#"+p).each(function(){var e=this.onclick.bind(this);t(this).prop("onclick",null).on("click",function(){C(),f(),u&&u.focus(),e instanceof Function&&e()})}),t("#"+p).closest("div.cc-notification-outer").next("div.cc-curtain").on("click",function(){t("button","#"+p).focus()}),S())},v=function(){t("#"+p).closest("div.cc-notification-outer").next("div.cc-curtain").addBack().remove()},b=function(){o.profileType==e.PROFILE_TYPE_ADMIN&&t("#"+p).length&&(v(),i.notify([{style:"inline",id:"#cc-message-center",customNotificationID:h,status:"confirm",curtain:!0,close:!1,fade:!1,header:a.t("ns.common:resources.sessionExpiryHeader"),message:a.t("ns.common:resources.sessionExpiryMessage"),actionOptions:[{actionOption1:[{text:a.t("ns.common:resources.loginLinkText"),action:"",classes:"btn cc-submit-changes-btn cc-btn-primary"}]}]}]),t("button","#"+h).each(function(){t(this).prop("onclick",null).on("click",function(){if(o.external&&window.idcsEnabled)window.location="sso-logout.jsp";else{var e=o.redirectToAdminLoginScreen.bind(o);o.logout(e,e)}})}),t("#"+h).closest("div.cc-notification-outer").next("div.cc-curtain").on("click",function(){t("button","#"+h).focus()}))},T=function(){o.profileType==e.PROFILE_TYPE_ADMIN&&(P(),c=setTimeout(y,l))},P=function(){c&&(clearTimeout(c),c=null)},S=function(){o.profileType==e.PROFILE_TYPE_ADMIN&&(C(),d=setTimeout(b,e.TOKEN_EXPIRED_MESSAGE_TIMEOUT))},C=function(){d&&(clearTimeout(d),d=null)},_=function(){t("html").off(".cctimer"),o.loggedIn&&(m(),o.profileType==e.PROFILE_TYPE_ADMIN?(T(),t("html").on("keyup.cctimer mouseup.cctimer",function(){n=!0}),o.registerLoginUpdateCallback(function(){C(),v(),g()}),o.registerLogoutUpdateCallback(function(){t("button","#"+h).trigger("click")})):o.profileType==e.PROFILE_TYPE_LAYOUT_PREVIEW&&parent.$&&t("html").on("keyup.cctimer mouseup.cctimer",function(e){parent.$("html",parent.document).trigger(e)}))},A=function(){I(),P(),C(),t("html").off(".cctimer")};o.registerInitCallback(_),t.Topic(r.topicNames.AUTH_LOGIN_SUCCESS).subscribe(_),t.Topic(r.topicNames.AUTH_LOGOUT_SUCCESS).subscribe(A),t.Topic(r.topicNames.USER_LOGIN_SUCCESSFUL).subscribe(_),t.Topic(r.topicNames.USER_AUTO_LOGIN_SUCCESSFUL).subscribe(_),t.Topic(r.topicNames.USER_LOGOUT_SUCCESSFUL).subscribe(A),t.Topic(r.topicNames.USER_SESSION_EXPIRED).subscribe(A),o.profileType==e.PROFILE_TYPE_LAYOUT_PREVIEW&&t.Topic(r.topicNames.PAGE_READY).subscribe(_)}return o}),"undefined"==typeof jQuery)throw new Error("Bootstrap's JavaScript requires jQuery");+function(e){"use strict";function t(){var e=document.createElement("bootstrap"),t={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"};for(var r in t)if(void 0!==e.style[r])return{end:t[r]};return!1}e.fn.emulateTransitionEnd=function(t){var r=!1,i=this;e(this).one(e.support.transition.end,function(){r=!0});var a=function(){r||e(i).trigger(e.support.transition.end)};return setTimeout(a,t),this},e(function(){e.support.transition=t()})}(jQuery),+function(e){"use strict";var t='[data-dismiss="alert"]',r=function(r){e(r).on("click",t,this.close)};r.prototype.close=function(t){function r(){o.trigger("closed.bs.alert").remove()}var i=e(this),a=i.attr("data-target");a||(a=i.attr("href"),a=a&&a.replace(/.*(?=#[^\s]*$)/,"")),a="#"===a?[]:a;var o=e(document).find(a);t&&t.preventDefault(),o.length||(o=i.hasClass("alert")?i:i.parent()),o.trigger(t=e.Event("close.bs.alert")),t.isDefaultPrevented()||(o.removeClass("in"),e.support.transition&&o.hasClass("fade")?o.one(e.support.transition.end,r).emulateTransitionEnd(150):r())};var i=e.fn.alert;e.fn.alert=function(t){return this.each(function(){var i=e(this),a=i.data("bs.alert");a||i.data("bs.alert",a=new r(this)),"string"==typeof t&&a[t].call(i)})},e.fn.alert.Constructor=r,e.fn.alert.noConflict=function(){return e.fn.alert=i,this},e(document).on("click.bs.alert.data-api",t,r.prototype.close)}(jQuery),+function(e){"use strict";var t=function(r,i){this.$element=e(r),this.options=e.extend({},t.DEFAULTS,i),this.isLoading=!1};t.DEFAULTS={loadingText:"loading..."},t.prototype.setState=function(t){var r="disabled",i=this.$element,a=i.is("input")?"val":"html",o=i.data();t+="Text",o.resetText||i.data("resetText",i[a]()),i[a](o[t]||this.options[t]),setTimeout(e.proxy(function(){"loadingText"==t?(this.isLoading=!0,i.addClass(r).attr(r,r)):this.isLoading&&(this.isLoading=!1,i.removeClass(r).removeAttr(r))},this),0)},t.prototype.toggle=function(){var e=!0,t=this.$element.closest('[data-toggle="buttons"]');if(t.length){var r=this.$element.find("input");"radio"==r.prop("type")&&(r.prop("checked")&&this.$element.hasClass("active")?e=!1:t.find(".active").removeClass("active")),e&&r.prop("checked",!this.$element.hasClass("active")).trigger("change")}e&&this.$element.toggleClass("active")};var r=e.fn.button;e.fn.button=function(r){return this.each(function(){var i=e(this),a=i.data("bs.button"),o="object"==typeof r&&r;a||i.data("bs.button",a=new t(this,o)),"toggle"==r?a.toggle():r&&a.setState(r)})},e.fn.button.Constructor=t,e.fn.button.noConflict=function(){return e.fn.button=r,this},e(document).on("click.bs.button.data-api","[data-toggle^=button]",function(t){var r=e(t.target);r.hasClass("btn")||(r=r.closest(".btn")),r.button("toggle"),t.preventDefault()})}(jQuery),+function(e){"use strict";var t=function(t,r){this.$element=e(t),this.$indicators=this.$element.find(".carousel-indicators"),this.options=r,this.paused=this.sliding=this.interval=this.$active=this.$items=null,"hover"==this.options.pause&&this.$element.on("mouseenter",e.proxy(this.pause,this)).on("mouseleave",e.proxy(this.cycle,this))};t.DEFAULTS={interval:5e3,pause:"hover",wrap:!0},t.prototype.cycle=function(t){return t||(this.paused=!1),this.interval&&clearInterval(this.interval),this.options.interval&&!this.paused&&(this.interval=setInterval(e.proxy(this.next,this),this.options.interval)),this},t.prototype.getActiveIndex=function(){return this.$active=this.$element.find(".item.active"),this.$items=this.$active.parent().children(),this.$items.index(this.$active)},t.prototype.to=function(t){var r=this,i=this.getActiveIndex();if(!(t>this.$items.length-1||t<0))return this.sliding?this.$element.one("slid.bs.carousel",function(){r.to(t)}):i==t?this.pause().cycle():this.slide(t>i?"next":"prev",e(this.$items[t]))},t.prototype.pause=function(t){return t||(this.paused=!0),this.$element.find(".next, .prev").length&&e.support.transition&&(this.$element.trigger(e.support.transition.end),this.cycle(!0)),this.interval=clearInterval(this.interval),this},t.prototype.next=function(){if(!this.sliding)return this.slide("next")},t.prototype.prev=function(){if(!this.sliding)return this.slide("prev")},t.prototype.slide=function(t,r){var i=this.$element.find(".item.active"),a=r||i[t](),o=this.interval,n="next"==t?"left":"right",s="next"==t?"first":"last",l=this;if(!a.length){if(!this.options.wrap)return;a=this.$element.find(".item")[s]()}if(a.hasClass("active"))return this.sliding=!1;var c=e.Event("slide.bs.carousel",{relatedTarget:a[0],direction:n});return this.$element.trigger(c),c.isDefaultPrevented()?void 0:(this.sliding=!0,o&&this.pause(),this.$indicators.length&&(this.$indicators.find(".active").removeClass("active"),this.$element.one("slid.bs.carousel",function(){var t=e(l.$indicators.children()[l.getActiveIndex()]);t&&t.addClass("active")})),e.support.transition&&this.$element.hasClass("slide")?(a.addClass(t),a[0].offsetWidth,i.addClass(n),a.addClass(n),i.one(e.support.transition.end,function(){a.removeClass([t,n].join(" ")).addClass("active"),i.removeClass(["active",n].join(" ")),l.sliding=!1,setTimeout(function(){l.$element.trigger("slid.bs.carousel")},0)}).emulateTransitionEnd(1e3*i.css("transition-duration").slice(0,-1))):(i.removeClass("active"),a.addClass("active"),this.sliding=!1,this.$element.trigger("slid.bs.carousel")),o&&this.cycle(),this)};var r=e.fn.carousel;e.fn.carousel=function(r){return this.each(function(){var i=e(this),a=i.data("bs.carousel"),o=e.extend({},t.DEFAULTS,i.data(),"object"==typeof r&&r),n="string"==typeof r?r:o.slide;a||i.data("bs.carousel",a=new t(this,o)),"number"==typeof r?a.to(r):n?a[n]():o.interval&&a.pause().cycle()})},e.fn.carousel.Constructor=t,e.fn.carousel.noConflict=function(){return e.fn.carousel=r,this},e(document).on("click.bs.carousel.data-api","[data-slide], [data-slide-to]",function(t){var r=e(this),i=r.attr("href");i&&(i=i.replace(/.*(?=#[^\s]+$)/,""));var a=r.attr("data-target")||i,o=e(document).find(a),n=e.extend({},o.data(),r.data()),s=r.attr("data-slide-to");s&&(n.interval=!1),o.carousel(n),(s=r.attr("data-slide-to"))&&o.data("bs.carousel").to(s),t.preventDefault()}),e(window).on("load",function(){e('[data-ride="carousel"]').each(function(){var t=e(this);t.carousel(t.data())})})}(jQuery),+function(e){"use strict";var t=function(r,i){this.$element=e(r),this.options=e.extend({},t.DEFAULTS,i),this.transitioning=null,this.options.parent&&(this.$parent=e(this.options.parent)),this.options.toggle&&this.toggle()};t.DEFAULTS={toggle:!0},t.prototype.dimension=function(){var e=this.$element.hasClass("width");return e?"width":"height"},t.prototype.show=function(){if(!this.transitioning&&!this.$element.hasClass("in")){var t=e.Event("show.bs.collapse");if(this.$element.trigger(t),!t.isDefaultPrevented()){var r=this.$parent&&this.$parent.find("> .panel > .in");if(r&&r.length){var i=r.data("bs.collapse");if(i&&i.transitioning)return;r.collapse("hide"),i||r.data("bs.collapse",null)}var a=this.dimension();this.$element.removeClass("collapse").addClass("collapsing")[a](0),this.transitioning=1;var o=function(){this.$element.removeClass("collapsing").addClass("collapse in")[a]("auto"),this.transitioning=0,this.$element.trigger("shown.bs.collapse")};if(!e.support.transition)return o.call(this);var n=e.camelCase(["scroll",a].join("-"));this.$element.one(e.support.transition.end,e.proxy(o,this)).emulateTransitionEnd(350)[a](this.$element[0][n])}}},t.prototype.hide=function(){if(!this.transitioning&&this.$element.hasClass("in")){var t=e.Event("hide.bs.collapse");if(this.$element.trigger(t),!t.isDefaultPrevented()){var r=this.dimension();this.$element[r](this.$element[r]())[0].offsetHeight,this.$element.addClass("collapsing").removeClass("collapse").removeClass("in"),this.transitioning=1;var i=function(){this.transitioning=0,this.$element.trigger("hidden.bs.collapse").removeClass("collapsing").addClass("collapse")};return e.support.transition?void this.$element[r](0).one(e.support.transition.end,e.proxy(i,this)).emulateTransitionEnd(350):i.call(this)}}},t.prototype.toggle=function(){this[this.$element.hasClass("in")?"hide":"show"]()};var r=e.fn.collapse;e.fn.collapse=function(r){return this.each(function(){var i=e(this),a=i.data("bs.collapse"),o=e.extend({},t.DEFAULTS,i.data(),"object"==typeof r&&r);!a&&o.toggle&&"show"==r&&(r=!r),a||i.data("bs.collapse",a=new t(this,o)),"string"==typeof r&&a[r]()})},e.fn.collapse.Constructor=t,e.fn.collapse.noConflict=function(){return e.fn.collapse=r,this},e(document).on("click.bs.collapse.data-api","[data-toggle=collapse]",function(t){var r,i=e(this),a=i.attr("data-target")||t.preventDefault()||(r=i.attr("href"))&&r.replace(/.*(?=#[^\s]+$)/,""),o=e(a),n=o.data("bs.collapse"),s=n?"toggle":i.data(),l=i.attr("data-parent"),c=l&&e(l);n&&n.transitioning||(c&&c.find('[data-toggle=collapse][data-parent="'+l+'"]').not(i).addClass("collapsed"),i[o.hasClass("in")?"addClass":"removeClass"]("collapsed")),o.collapse(s)})}(jQuery),+function(e){"use strict";function t(t){e(i).remove(),e(a).each(function(){var i=r(e(this)),a={relatedTarget:this};i.hasClass("open")&&(i.trigger(t=e.Event("hide.bs.dropdown",a)),t.isDefaultPrevented()||i.removeClass("open").trigger("hidden.bs.dropdown",a))})}function r(t){var r=t.attr("data-target");r||(r=t.attr("href"),r=r&&/#[A-Za-z]/.test(r)&&r.replace(/.*(?=#[^\s]*$)/,""));var i=r&&e(document).find(r);return i&&i.length?i:t.parent()}var i=".dropdown-backdrop",a="[data-toggle=dropdown]",o=function(t){e(t).on("click.bs.dropdown",this.toggle)};o.prototype.toggle=function(i){var a=e(this);if(!a.is(".disabled, :disabled")){var o=r(a),n=o.hasClass("open");if(t(),!n){"ontouchstart"in document.documentElement&&!o.closest(".navbar-nav").length&&e('<div class="dropdown-backdrop"/>').insertAfter(e(this)).on("click",t);var s={relatedTarget:this};if(o.trigger(i=e.Event("show.bs.dropdown",s)),i.isDefaultPrevented())return;o.toggleClass("open").trigger("shown.bs.dropdown",s),a.focus()}return!1}},o.prototype.keydown=function(t){if(/(38|40|27)/.test(t.keyCode)){var i=e(this);if(t.preventDefault(),t.stopPropagation(),!i.is(".disabled, :disabled")){var o=r(i),n=o.hasClass("open");if(!n||n&&27==t.keyCode)return 27==t.which&&o.find(a).focus(),i.click();var s=" li:not(.divider):visible a",l=o.find("[role=menu]"+s+", [role=listbox]"+s);if(l.length){var c=l.index(l.filter(":focus"));38==t.keyCode&&c>0&&c--,40==t.keyCode&&c<l.length-1&&c++,~c||(c=0),l.eq(c).focus()}}}};var n=e.fn.dropdown;e.fn.dropdown=function(t){return this.each(function(){var r=e(this),i=r.data("bs.dropdown");i||r.data("bs.dropdown",i=new o(this)),"string"==typeof t&&i[t].call(r)})},e.fn.dropdown.Constructor=o,e.fn.dropdown.noConflict=function(){return e.fn.dropdown=n,this},e(document).on("click.bs.dropdown.data-api",t).on("click.bs.dropdown.data-api",".dropdown form",function(e){e.stopPropagation()}).on("click.bs.dropdown.data-api",a,o.prototype.toggle).on("keydown.bs.dropdown.data-api",a+", [role=menu], [role=listbox]",o.prototype.keydown)}(jQuery),+function(e){"use strict";var t=function(t,r){this.options=r,this.$element=e(t),this.$backdrop=this.isShown=null,this.options.remote&&this.$element.find(".modal-content").load(this.options.remote,e.proxy(function(){this.$element.trigger("loaded.bs.modal")},this))};t.DEFAULTS={backdrop:!0,keyboard:!0,show:!0},t.prototype.toggle=function(e){return this[this.isShown?"hide":"show"](e)},t.prototype.show=function(t){var r=this,i=e.Event("show.bs.modal",{relatedTarget:t});this.$element.trigger(i),this.isShown||i.isDefaultPrevented()||(this.isShown=!0,this.escape(),this.$element.on("click.dismiss.bs.modal",'[data-dismiss="modal"]',e.proxy(this.hide,this)),this.backdrop(function(){var i=e.support.transition&&r.$element.hasClass("fade");r.$element.parent().length||r.$element.appendTo(document.body),r.$element.show().scrollTop(0),i&&r.$element[0].offsetWidth,r.$element.addClass("in").attr("aria-hidden",!1),r.enforceFocus();var a=e.Event("shown.bs.modal",{relatedTarget:t});i?r.$element.find(".modal-dialog").one(e.support.transition.end,function(){r.$element.focus().trigger(a)}).emulateTransitionEnd(300):r.$element.focus().trigger(a)}))},t.prototype.hide=function(t){t&&t.preventDefault(),t=e.Event("hide.bs.modal"),this.$element.trigger(t),this.isShown&&!t.isDefaultPrevented()&&(this.isShown=!1,this.escape(),e(document).off("focusin.bs.modal"),this.$element.removeClass("in").attr("aria-hidden",!0).off("click.dismiss.bs.modal"),e.support.transition&&this.$element.hasClass("fade")?this.$element.one(e.support.transition.end,e.proxy(this.hideModal,this)).emulateTransitionEnd(300):this.hideModal())},t.prototype.enforceFocus=function(){e(document).off("focusin.bs.modal").on("focusin.bs.modal",e.proxy(function(e){this.$element[0]===e.target||this.$element.has(e.target).length||this.$element.focus()},this))},t.prototype.escape=function(){this.isShown&&this.options.keyboard?this.$element.on("keyup.dismiss.bs.modal",e.proxy(function(e){27==e.which&&this.hide()},this)):this.isShown||this.$element.off("keyup.dismiss.bs.modal")},t.prototype.hideModal=function(){var e=this;this.$element.hide(),this.backdrop(function(){e.removeBackdrop(),e.$element.trigger("hidden.bs.modal")})},t.prototype.removeBackdrop=function(){this.$backdrop&&this.$backdrop.remove(),this.$backdrop=null},t.prototype.backdrop=function(t){var r=this.$element.hasClass("fade")?"fade":"";if(this.isShown&&this.options.backdrop){var i=e.support.transition&&r;if(this.$backdrop=e('<div class="modal-backdrop '+r+'" />').appendTo(document.body),this.$element.on("click.dismiss.bs.modal",e.proxy(function(e){e.target===e.currentTarget&&("static"==this.options.backdrop?this.$element[0].focus.call(this.$element[0]):this.hide.call(this))},this)),i&&this.$backdrop[0].offsetWidth,this.$backdrop.addClass("in"),!t)return;i?this.$backdrop.one(e.support.transition.end,t).emulateTransitionEnd(150):t()}else!this.isShown&&this.$backdrop?(this.$backdrop.removeClass("in"),e.support.transition&&this.$element.hasClass("fade")?this.$backdrop.one(e.support.transition.end,t).emulateTransitionEnd(150):t()):t&&t()};var r=e.fn.modal;e.fn.modal=function(r,i){return this.each(function(){var a=e(this),o=a.data("bs.modal"),n=e.extend({},t.DEFAULTS,a.data(),"object"==typeof r&&r);o||a.data("bs.modal",o=new t(this,n)),"string"==typeof r?o[r](i):n.show&&o.show(i)})},e.fn.modal.Constructor=t,e.fn.modal.noConflict=function(){return e.fn.modal=r,this},e(document).on("click.bs.modal.data-api",'[data-toggle="modal"]',function(t){var r=e(this),i=r.attr("href"),a=r.attr("data-target")||i&&i.replace(/.*(?=#[^\s]+$)/,""),o=e(document).find(a),n=o.data("bs.modal")?"toggle":e.extend({remote:!/#/.test(i)&&i},o.data(),r.data());r.is("a")&&t.preventDefault(),o.modal(n,this).one("hide",function(){r.is(":visible")&&r.focus()})}),e(document).on("show.bs.modal",".modal",function(){e(document.body).addClass("modal-open")}).on("hidden.bs.modal",".modal",function(){e(document.body).removeClass("modal-open")})}(jQuery),+function(e){"use strict";function t(t,r){var i=t.nodeName.toLowerCase();if(e.inArray(i,r)!==-1)return e.inArray(i,a)===-1||Boolean(t.nodeValue.match(s)||t.nodeValue.match(l));for(var o=e(r).filter(function(e,t){return t instanceof RegExp}),n=0,c=o.length;n<c;n++)if(i.match(o[n]))return!0;return!1}function r(r,i,a){if(0===r.length)return r;if(a&&"function"==typeof a)return a(r);if(!document.implementation||!document.implementation.createHTMLDocument)return r;var o=document.implementation.createHTMLDocument("sanitization");o.body.innerHTML=r;for(var n=e.map(i,function(e,t){return t}),s=e(o.body).find("*"),l=0,c=s.length;l<c;l++){var d=s[l],u=d.nodeName.toLowerCase();if(e.inArray(u,n)!==-1)for(var p=e.map(d.attributes,function(e){return e}),h=[].concat(i["*"]||[],i[u]||[]),g=0,f=p.length;g<f;g++)t(p[g],h)||d.removeAttribute(p[g].nodeName);else d.parentNode.removeChild(d)}return o.body.innerHTML}var i=["sanitize","whiteList","sanitizeFn"],a=["background","cite","href","itemtype","longdesc","poster","src","xlink:href"],o=/^aria-[\w-]*$/i,n={"*":["class","dir","id","lang","role",o],a:["target","href","title","rel"],area:[],b:[],br:[],col:[],code:[],div:[],em:[],hr:[],h1:[],h2:[],h3:[],h4:[],h5:[],h6:[],i:[],img:["src","alt","title","width","height"],li:[],ol:[],p:[],pre:[],s:[],small:[],span:[],sub:[],sup:[],strong:[],u:[],ul:[]},s=/^(?:(?:https?|mailto|ftp|tel|file):|[^&:/?#]*(?:[/?#]|$))/gi,l=/^data:(?:image\/(?:bmp|gif|jpeg|jpg|png|tiff|webp)|video\/(?:mpeg|mp4|ogg|webm)|audio\/(?:mp3|oga|ogg|opus));base64,[a-z0-9+/]+=*$/i,c=function(e,t){this.type=this.options=this.enabled=this.timeout=this.hoverState=this.$element=null,this.init("tooltip",e,t)};c.DEFAULTS={animation:!0,placement:"top",selector:!1,template:'<div class="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>',trigger:"hover focus",title:"",delay:0,html:!1,container:!1,sanitize:!0,sanitizeFn:null,whiteList:n},c.prototype.init=function(t,r,i){this.enabled=!0,this.type=t,this.$element=e(r),this.options=this.getOptions(i);for(var a=this.options.trigger.split(" "),o=a.length;o--;){var n=a[o];if("click"==n)this.$element.on("click."+this.type,this.options.selector,e.proxy(this.toggle,this));else if("manual"!=n){var s="hover"==n?"mouseenter":"focusin",l="hover"==n?"mouseleave":"focusout";this.$element.on(s+"."+this.type,this.options.selector,e.proxy(this.enter,this)),this.$element.on(l+"."+this.type,this.options.selector,e.proxy(this.leave,this))}}this.options.selector?this._options=e.extend({},this.options,{trigger:"manual",selector:""}):this.fixTitle()},c.prototype.getDefaults=function(){return c.DEFAULTS},c.prototype.getOptions=function(t){var a=this.$element.data();for(var o in a)a.hasOwnProperty(o)&&e.inArray(o,i)!==-1&&delete a[o];return t=e.extend({},this.getDefaults(),a,t),t.delay&&"number"==typeof t.delay&&(t.delay={show:t.delay,hide:t.delay}),t.sanitize&&(t.template=r(t.template,t.whiteList,t.sanitizeFn)),t},c.prototype.getDelegateOptions=function(){var t={},r=this.getDefaults();return this._options&&e.each(this._options,function(e,i){r[e]!=i&&(t[e]=i)}),t},c.prototype.enter=function(t){var r=t instanceof this.constructor?t:e(t.currentTarget)[this.type](this.getDelegateOptions()).data("bs."+this.type);return clearTimeout(r.timeout),r.hoverState="in",r.options.delay&&r.options.delay.show?void(r.timeout=setTimeout(function(){"in"==r.hoverState&&r.show()},r.options.delay.show)):r.show()},c.prototype.leave=function(t){var r=t instanceof this.constructor?t:e(t.currentTarget)[this.type](this.getDelegateOptions()).data("bs."+this.type);return clearTimeout(r.timeout),r.hoverState="out",r.options.delay&&r.options.delay.hide?void(r.timeout=setTimeout(function(){"out"==r.hoverState&&r.hide()},r.options.delay.hide)):r.hide()},c.prototype.show=function(){var t=e.Event("show.bs."+this.type);if(this.hasContent()&&this.enabled){if(this.$element.trigger(t),t.isDefaultPrevented())return;var r=this,i=this.tip();this.setContent(),this.options.animation&&i.addClass("fade");var a="function"==typeof this.options.placement?this.options.placement.call(this,i[0],this.$element[0]):this.options.placement,o=/\s?auto?\s?/i,n=o.test(a);n&&(a=a.replace(o,"")||"top"),i.detach().css({top:0,left:0,display:"block"}).addClass(a),this.options.container?i.appendTo(this.options.container):i.insertAfter(this.$element);var s=this.getPosition(),l=i[0].offsetWidth,c=i[0].offsetHeight;if(n){var d=this.$element.parent(),u=a,p=document.documentElement.scrollTop||document.body.scrollTop,h="body"==this.options.container?window.innerWidth:d.outerWidth(),g="body"==this.options.container?window.innerHeight:d.outerHeight(),f="body"==this.options.container?0:d.offset().left;a="bottom"==a&&s.top+s.height+c-p>g?"top":"top"==a&&s.top-p-c<0?"bottom":"right"==a&&s.right+l>h?"left":"left"==a&&s.left-l<f?"right":a,i.removeClass(u).addClass(a)}var m=this.getCalculatedOffset(a,s,l,c);this.applyPlacement(m,a),this.hoverState=null;var I=function(){r.$element.trigger("shown.bs."+r.type)};e.support.transition&&this.$tip.hasClass("fade")?i.one(e.support.transition.end,I).emulateTransitionEnd(150):I()}},c.prototype.applyPlacement=function(t,r){var i,a=this.tip(),o=a[0].offsetWidth,n=a[0].offsetHeight,s=parseInt(a.css("margin-top"),10),l=parseInt(a.css("margin-left"),10);isNaN(s)&&(s=0),isNaN(l)&&(l=0),t.top=t.top+s,t.left=t.left+l,e.offset.setOffset(a[0],e.extend({using:function(e){a.css({top:Math.round(e.top),left:Math.round(e.left)})}},t),0),a.addClass("in");var c=a[0].offsetWidth,d=a[0].offsetHeight;if("top"==r&&d!=n&&(i=!0,t.top=t.top+n-d),/bottom|top/.test(r)){var u=0;t.left<0&&(u=t.left*-2,t.left=0,a.offset(t),c=a[0].offsetWidth,d=a[0].offsetHeight),this.replaceArrow(u-o+c,c,"left")}else this.replaceArrow(d-n,d,"top");i&&a.offset(t)},c.prototype.replaceArrow=function(e,t,r){this.arrow().css(r,e?50*(1-e/t)+"%":"")},c.prototype.setContent=function(){var e=this.tip(),t=this.getTitle();this.options.html?(this.options.sanitize&&(t=r(t,this.options.whiteList,this.options.sanitizeFn)),e.find(".tooltip-inner").html(t)):e.find(".tooltip-inner").text(t),e.removeClass("fade in top bottom left right")},c.prototype.hide=function(){function t(){"in"!=r.hoverState&&i.detach(),r.$element.trigger("hidden.bs."+r.type)}var r=this,i=this.tip(),a=e.Event("hide.bs."+this.type);if(this.$element.trigger(a),!a.isDefaultPrevented())return i.removeClass("in"),e.support.transition&&this.$tip.hasClass("fade")?i.one(e.support.transition.end,t).emulateTransitionEnd(150):t(),this.hoverState=null,this},c.prototype.fixTitle=function(){var e=this.$element;(e.attr("title")||"string"!=typeof e.attr("data-original-title"))&&e.attr("data-original-title",e.attr("title")||"").attr("title","")},c.prototype.hasContent=function(){return this.getTitle()},c.prototype.getPosition=function(){var t=this.$element[0];return e.extend({},"function"==typeof t.getBoundingClientRect?t.getBoundingClientRect():{width:t.offsetWidth,height:t.offsetHeight},this.$element.offset())},c.prototype.getCalculatedOffset=function(e,t,r,i){return"bottom"==e?{top:t.top+t.height,left:t.left+t.width/2-r/2}:"top"==e?{top:t.top-i,left:t.left+t.width/2-r/2}:"left"==e?{top:t.top+t.height/2-i/2,left:t.left-r}:{top:t.top+t.height/2-i/2,left:t.left+t.width}},c.prototype.getTitle=function(){var e,t=this.$element,r=this.options;return e=t.attr("data-original-title")||("function"==typeof r.title?r.title.call(t[0]):r.title)},c.prototype.tip=function(){return this.$tip=this.$tip||e(this.options.template);
- },c.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".tooltip-arrow")},c.prototype.validate=function(){this.$element[0].parentNode||(this.hide(),this.$element=null,this.options=null)},c.prototype.enable=function(){this.enabled=!0},c.prototype.disable=function(){this.enabled=!1},c.prototype.toggleEnabled=function(){this.enabled=!this.enabled},c.prototype.toggle=function(t){var r=t?e(t.currentTarget)[this.type](this.getDelegateOptions()).data("bs."+this.type):this;r.tip().hasClass("in")?r.leave(r):r.enter(r)},c.prototype.destroy=function(){clearTimeout(this.timeout),this.hide().$element.off("."+this.type).removeData("bs."+this.type)},c.prototype.sanitizeHtml=function(e){return r(e,this.options.whiteList,this.options.sanitizeFn)};var d=e.fn.tooltip;e.fn.tooltip=function(t){return this.each(function(){var r=e(this),i=r.data("bs.tooltip"),a="object"==typeof t&&t;(i||"destroy"!=t)&&(i||r.data("bs.tooltip",i=new c(this,a)),"string"==typeof t&&i[t]())})},e.fn.tooltip.Constructor=c,e.fn.tooltip.noConflict=function(){return e.fn.tooltip=d,this}}(jQuery),+function(e){"use strict";var t=function(e,t){this.init("popover",e,t)};if(!e.fn.tooltip)throw new Error("Popover requires tooltip.js");t.DEFAULTS=e.extend({},e.fn.tooltip.Constructor.DEFAULTS,{placement:"right",trigger:"click",content:"",template:'<div class="popover"><div class="arrow"></div><h3 class="popover-title"></h3><div class="popover-content"></div></div>'}),t.prototype=e.extend({},e.fn.tooltip.Constructor.prototype),t.prototype.constructor=t,t.prototype.getDefaults=function(){return t.DEFAULTS},t.prototype.setContent=function(){var e=this.tip(),t=this.getTitle(),r=this.getContent();if(this.options.html){var i=typeof r;this.options.sanitize&&(t=this.sanitizeHtml(t),"string"===i&&(r=this.sanitizeHtml(r))),e.find(".popover-title").html(t),e.find(".popover-content")["string"===i?"html":"append"](r)}else e.find(".popover-title").text(t),e.find(".popover-content").text(r);e.removeClass("fade top bottom left right in"),e.find(".popover-title").html()||e.find(".popover-title").hide()},t.prototype.hasContent=function(){return this.getTitle()||this.getContent()},t.prototype.getContent=function(){var e=this.$element,t=this.options;return e.attr("data-content")||("function"==typeof t.content?t.content.call(e[0]):t.content)},t.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".arrow")},t.prototype.tip=function(){return this.$tip||(this.$tip=e(this.options.template)),this.$tip};var r=e.fn.popover;e.fn.popover=function(r){return this.each(function(){var i=e(this),a=i.data("bs.popover"),o="object"==typeof r&&r;(a||"destroy"!=r)&&(a||i.data("bs.popover",a=new t(this,o)),"string"==typeof r&&a[r]())})},e.fn.popover.Constructor=t,e.fn.popover.noConflict=function(){return e.fn.popover=r,this}}(jQuery),+function(e){"use strict";function t(r,i){var a,o=e.proxy(this.process,this);this.$element=e(e(r).is("body")?window:r),this.$body=e("body"),this.$scrollElement=this.$element.on("scroll.bs.scroll-spy.data-api",o),this.options=e.extend({},t.DEFAULTS,i),this.selector=(this.options.target||(a=e(r).attr("href"))&&a.replace(/.*(?=#[^\s]+$)/,"")||"")+" .nav li > a",this.offsets=e([]),this.targets=e([]),this.activeTarget=null,this.refresh(),this.process()}t.DEFAULTS={offset:10},t.prototype.refresh=function(){var t=this.$element[0]==window?"offset":"position";this.offsets=e([]),this.targets=e([]);var r=this;this.$body.find(this.selector).map(function(){var i=e(this),a=i.data("target")||i.attr("href"),o=/^#./.test(a)&&e(a);return o&&o.length&&o.is(":visible")&&[[o[t]().top+(!e.isWindow(r.$scrollElement.get(0))&&r.$scrollElement.scrollTop()),a]]||null}).sort(function(e,t){return e[0]-t[0]}).each(function(){r.offsets.push(this[0]),r.targets.push(this[1])})},t.prototype.process=function(){var e,t=this.$scrollElement.scrollTop()+this.options.offset,r=this.$scrollElement[0].scrollHeight||this.$body[0].scrollHeight,i=r-this.$scrollElement.height(),a=this.offsets,o=this.targets,n=this.activeTarget;if(t>=i)return n!=(e=o.last()[0])&&this.activate(e);if(n&&t<=a[0])return n!=(e=o[0])&&this.activate(e);for(e=a.length;e--;)n!=o[e]&&t>=a[e]&&(!a[e+1]||t<=a[e+1])&&this.activate(o[e])},t.prototype.activate=function(t){this.activeTarget=t,e(this.selector).parentsUntil(this.options.target,".active").removeClass("active");var r=this.selector+'[data-target="'+t+'"],'+this.selector+'[href="'+t+'"]',i=e(r).parents("li").addClass("active");i.parent(".dropdown-menu").length&&(i=i.closest("li.dropdown").addClass("active")),i.trigger("activate.bs.scrollspy")};var r=e.fn.scrollspy;e.fn.scrollspy=function(r){return this.each(function(){var i=e(this),a=i.data("bs.scrollspy"),o="object"==typeof r&&r;a||i.data("bs.scrollspy",a=new t(this,o)),"string"==typeof r&&a[r]()})},e.fn.scrollspy.Constructor=t,e.fn.scrollspy.noConflict=function(){return e.fn.scrollspy=r,this},e(window).on("load",function(){e('[data-spy="scroll"]').each(function(){var t=e(this);t.scrollspy(t.data())})})}(jQuery),+function(e){"use strict";var t=function(t){this.element=e(t)};t.prototype.show=function(){var t=this.element,r=t.closest("ul:not(.dropdown-menu)"),i=t.data("target");if(i||(i=t.attr("href"),i=i&&i.replace(/.*(?=#[^\s]*$)/,"")),!t.parent("li").hasClass("active")){var a=r.find(".active:last a")[0],o=e.Event("show.bs.tab",{relatedTarget:a});if(t.trigger(o),!o.isDefaultPrevented()){var n=e(document).find(i);this.activate(t.parent("li"),r),this.activate(n,n.parent(),function(){t.trigger({type:"shown.bs.tab",relatedTarget:a})})}}},t.prototype.activate=function(t,r,i){function a(){o.removeClass("active").find("> .dropdown-menu > .active").removeClass("active"),t.addClass("active"),n?(t[0].offsetWidth,t.addClass("in")):t.removeClass("fade"),t.parent(".dropdown-menu")&&t.closest("li.dropdown").addClass("active"),i&&i()}var o=r.find("> .active"),n=i&&e.support.transition&&o.hasClass("fade");n?o.one(e.support.transition.end,a).emulateTransitionEnd(150):a(),o.removeClass("in")};var r=e.fn.tab;e.fn.tab=function(r){return this.each(function(){var i=e(this),a=i.data("bs.tab");a||i.data("bs.tab",a=new t(this)),"string"==typeof r&&a[r]()})},e.fn.tab.Constructor=t,e.fn.tab.noConflict=function(){return e.fn.tab=r,this},e(document).on("click.bs.tab.data-api",'[data-toggle="tab"], [data-toggle="pill"]',function(t){t.preventDefault(),e(this).tab("show")})}(jQuery),+function(e){"use strict";var t=function(r,i){this.options=e.extend({},t.DEFAULTS,i),this.$window=e(window).on("scroll.bs.affix.data-api",e.proxy(this.checkPosition,this)).on("click.bs.affix.data-api",e.proxy(this.checkPositionWithEventLoop,this)),this.$element=e(r),this.affixed=this.unpin=this.pinnedOffset=null,this.checkPosition()};t.RESET="affix affix-top affix-bottom",t.DEFAULTS={offset:0},t.prototype.getPinnedOffset=function(){if(this.pinnedOffset)return this.pinnedOffset;this.$element.removeClass(t.RESET).addClass("affix");var e=this.$window.scrollTop(),r=this.$element.offset();return this.pinnedOffset=r.top-e},t.prototype.checkPositionWithEventLoop=function(){setTimeout(e.proxy(this.checkPosition,this),1)},t.prototype.checkPosition=function(){if(this.$element.is(":visible")){var r=e(document).height(),i=this.$window.scrollTop(),a=this.$element.offset(),o=this.options.offset,n=o.top,s=o.bottom;"top"==this.affixed&&(a.top+=i),"object"!=typeof o&&(s=n=o),"function"==typeof n&&(n=o.top(this.$element)),"function"==typeof s&&(s=o.bottom(this.$element));var l=!(null!=this.unpin&&i+this.unpin<=a.top)&&(null!=s&&a.top+this.$element.height()>=r-s?"bottom":null!=n&&i<=n&&"top");if(this.affixed!==l){this.unpin&&this.$element.css("top","");var c="affix"+(l?"-"+l:""),d=e.Event(c+".bs.affix");this.$element.trigger(d),d.isDefaultPrevented()||(this.affixed=l,this.unpin="bottom"==l?this.getPinnedOffset():null,this.$element.removeClass(t.RESET).addClass(c).trigger(e.Event(c.replace("affix","affixed"))),"bottom"==l&&this.$element.offset({top:r-s-this.$element.height()}))}}};var r=e.fn.affix;e.fn.affix=function(r){return this.each(function(){var i=e(this),a=i.data("bs.affix"),o="object"==typeof r&&r;a||i.data("bs.affix",a=new t(this,o)),"string"==typeof r&&a[r]()})},e.fn.affix.Constructor=t,e.fn.affix.noConflict=function(){return e.fn.affix=r,this},e(window).on("load",function(){e('[data-spy="affix"]').each(function(){var t=e(this),r=t.data();r.offset=r.offset||{},r.offsetBottom&&(r.offset.bottom=r.offsetBottom),r.offsetTop&&(r.offset.top=r.offsetTop),t.affix(r)})})}(jQuery),define("bootstrap",["jquery"],function(){}),define("ccImageZoom",["spinner"],function(e){"use strict";function t(){window.requestAnimFrame=function(){return window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||function(e){return window.setTimeout(e,1e3/60)}}(),window.cancelAnimFrame=window.cancelAnimationFrame||window.mozCancelAnimationFrame||function(e){clearTimeout(e)},this.framesPerSecond=60,this.spinner=e,this.usingSpinner=!0,this.spinnerDelay=200,this.zoomDelay=800,this.smallImageClass="ccz-small",this.magnifierClass="ccz-magnifier",this.fullImageClass="ccz-full",this.flyoutClass="ccz-flyout",this.magnifierPercent=.45,this.flyoutSpacing=0,this.element=null,this.flyout=null,this.flyoutEnabled=!0,this.flyoutScaling=.8,this.magnifierEnabled=!1,this.magnifierPercentEased=.25,this.smallImageUrl=null,this.smallImageUrls=null,this.fullImageUrl=null,this.fullImageUrls=null,this.errorImageUrl=null,this.imageMetadataDefault=null,this.imageMetadatas=[],this.fullImage=null,this.smallIamge=null,this.jqBackgroundImage=null,this.loading=!1,this.imgMetadata=null,this.magnifierMin=.1,this.magnifierMax=.9,this.magnifierVelocity=.02,this.dampingFactor=12,this.magnifierBorderWidth=2,this.zoomCurtainClassName="ccz-zoom-curtain",this.magnifierBackgroundClassName="ccz-magnifier-background",this.lastTouchDistance=0,this.currentMx=0,this.currentMy=0,this.xp=0,this.yp=0,this.offsetMagnifier=!1,this.replaceImageAtIndex=!0;var t=this;this.handleMouseWheel=function(e){e=window.event||e,e.preventDefault&&e.preventDefault();var r=Math.max(-1,Math.min(1,e.wheelDelta||-e.detail||e.deltaY)),i=Math.max(t.magnifierMin,Math.min(t.magnifierMax,t.magnifierPercent+t.magnifierVelocity*r));return t.magnifierPercent=i,!1},this.handleMouseMove=function(e){if(!t.loading){if(t.imageLoadFailed||t.fullImageUrl.indexOf(t.errorImageUrl)!=-1)return;if(e.preventDefault(),0===e.type.indexOf("touch")){var a=e.touches||e.originalEvent.touches;if(a.length>1){var o=Math.sqrt((a[0].pageX-a[1].pageX)*(a[0].pageX-a[1].pageX)+(a[0].pageY-a[1].pageY)*(a[0].pageY-a[1].pageY));t.lastTouchDistance=o}r=a[0].pageX,i=a[0].pageY}else r=e.pageX||r,i=e.pageY||i;t.magnify_offset||(t.magnify_offset=$(t.element).offset());var n=r-t.magnify_offset.left,s=i-t.magnify_offset.top;if(t.magnifierEnabled)t.currentMx=n,t.currentMy=s;else{var l=t.jqSmallImage.width(),c=t.jqSmallImage.height(),d=t.getMagnifierWidth(),u=t.getMagnifierHeight(),p=l-d/2,h=d/2,g=c-u/2,f=u/2;t.currentMx=t.constrainValue(h,p,n),t.currentMy=t.constrainValue(f,g,s)}(n>Math.round($(t.element).width())||s>Math.round($(t.element).height())||n<0||s<0)&&t.handleMouseLeave()}},this.handleMouseLeave=function(){var e=this;clearTimeout(e.zoomTimeout),e.cancelRedraw(e),$("."+e.zoomCurtainClassName).hide(),$("."+e.magnifierBackgroundClassName).hide(),$(e.element).css({cursor:"auto"}),e.jqMagnifier.fadeOut(100),e.flyoutEnabled&&e.jqFlyout.fadeOut(100)},this.isIE=function(){return!(!navigator.userAgent.match(/Trident/)&&!navigator.userAgent.match(/Edge/))},this.handleMouseEnter=function(){var e=this;e.loading||(void 0==e.jqFlyout.find("img").attr("src")&&(e.jqFlyout.find("img").attr("src",e.fullImageUrl),$.when(e.loadImage(e.fullImageUrl)).done(function(t){e.jqFullImage.attr("src",t.src)}).fail(function(t){e.imageLoadFailed=!0,e.jqFullImage.attr("src",e.errorImageUrl)})),e.magnify_offset=$(e.element).offset(),e.fullImageUrl.indexOf(e.errorImageUrl)!=-1||e.imageLoadFailed||(e.zoomTimeout=setTimeout(function(){e.magnify_offset=$(e.element).offset(),e.isIE()?$(e.element).css({cursor:"pointer"}):$(e.element).css({cursor:"zoom-in"}),e.magnifierBackgroundImage(),e.jqZoomCurtain?e.jqZoomCurtain.fadeIn(100):e.jqZoomCurtain=e.addCurtain(e.element),e.flyoutEnabled&&e.setFlyoutSizeAndPosition(),e.jqMagnifier.fadeIn(500),e.flyoutEnabled&&e.jqFlyout.fadeIn(500),e.timeoutid=e.scheduleRedraw(e)},e.zoomDelay)))}}var r,i;return t.prototype.registerMouseWheel=function(e){var t=this,r=t.jqMagnifier[0],i="onwheel"in document.createElement("div")?"wheel":void 0!==document.onmousewheel?"mousewheel":"DOMMouseScroll";r.addEventListener?r.addEventListener(i,t.handleMouseWheel,!1):r.attachEvent("onmousewheel",t.handleMouseWheel)},t.prototype.getMagnifierWidth=function(){var e=this,t=e.getFlyoutDimensions(),r=t.width*e.magnifierPercentEased;return r},t.prototype.getMagnifierHeight=function(){var e=this,t=e.getFlyoutDimensions(),r=t.width*e.magnifierPercentEased,i=e.flyoutEnabled?t.height*e.magnifierPercentEased:r;return i},t.prototype.getPositionMagnifierCss=function(){var e=this,t=e.jqSmallImage.width(),r=e.jqSmallImage.height(),i=e.getMagnifierWidth(),a=e.getMagnifierHeight(),o=e.offsetMagnifier?1:2,n=e.offsetMagnifier?25:0,s=e.currentMx+2*n-i/o,l=e.currentMy-n-a/o,c=e.currentMx/t,d=e.currentMy/r;e.magnifierEnabled||(s=e.constrainValue(e.magnifierBorderWidth,t-i,s),l=e.constrainValue(e.magnifierBorderWidth,r-a,l));var u=s*-1,p=l*-1;e.magnifierEnabled&&(u=(c*e.jqBackgroundImage.width()-i/2)*-1,p=(d*e.jqBackgroundImage.height()-a/2)*-1);return{css:{width:i,height:a,left:s-e.magnifierBorderWidth,top:l-e.magnifierBorderWidth},background:{left:u,top:p}}},t.prototype.getPositionFlyoutCss=function(){var e=this,t=(e.getFlyoutDimensions(),e.jqSmallImage.width()),r=e.jqSmallImage.height(),i=t/e.magnifierPercentEased,a=r/e.magnifierPercentEased,o=e.xp/t,n=e.yp/r,s=o*i-e.jqFlyout.width()/2,l=n*a-e.jqFlyout.height()/2;return e.magnifierEnabled||(s=e.constrainValue(0,i-e.jqFlyout.width(),s),l=e.constrainValue(0,a-e.jqFlyout.height(),l)),{left:-s,top:-l,width:i,height:a}},t.prototype.positionMagnifier=function(){var e=this,t=e.getPositionMagnifierCss();e.jqMagnifier.css(t.css),$("."+e.magnifierBackgroundClassName).css(t.background)},t.prototype.positionFlyout=function(){var e=this,t=e.getPositionFlyoutCss();e.jqFullImage.css(t)},t.prototype.getFlyoutDimensions=function(){var e=this,t=e.jqSmallImage.width()*e.flyoutScaling,r=e.jqSmallImage.height()*e.flyoutScaling;return{width:t,height:r}},t.prototype.setFlyoutSizeAndPosition=function(){var e=this,t=e.getFlyoutDimensions(),r=e.jqSmallImage.width()+e.flyoutSpacing+"px";e.jqFlyout.css({width:t.width,height:t.height,top:"0px",left:r})},t.prototype.magnifierBackgroundImage=function(){var e=this,t=e.magnifierEnabled?e.fullImageUrl:e.smallImageUrl;if(null!==e.jqBackgroundImage)return e.jqBackgroundImage.attr("src")!=t&&$(e.jqBackgroundImage).attr("src",t),e.jqBackgroundImage.css({width:e.jqSmallImage.width(),height:e.jqSmallImage.height()}),void e.jqBackgroundImage.show();var r=$("<img class='"+e.magnifierBackgroundClassName+"'/>");e.magnifierEnabled?r.css({position:"absolute"}):r.css({position:"absolute","max-height":"none","max-width":"none",width:e.jqSmallImage.width(),height:e.jqSmallImage.height()}),$(r).attr("src",t),e.imgMetadata&&($(r).attr("title",e.imgMetadata.title),$(r).attr("alt",e.imgMetadata.alttext)),e.jqBackgroundImage=r,e.jqMagnifier.append(r)},t.prototype.addCurtain=function(e){var t=this,r=$("<div class='"+t.zoomCurtainClassName+"'></div>");return r.css({display:"block",position:"absolute",top:"0px",left:"0px",width:"100%",height:"100%","background-color":"rgb(255,255,255)",opacity:0}),$(t.element).append(r),r.animate({opacity:.25},100),r},t.prototype.loadImage=function(e){var t=function(t){function r(){o.onload=null,o.onerror=null,o.onabort=null}function i(){r(),t.resolve(o)}function a(){r(),t.reject(o)}var o=new Image;o.src=e,o.onload=i,o.onerror=a,o.onabort=a};return $.Deferred(t).promise()},t.prototype.constrainValue=function(e,t,r){return Math.max(e,Math.min(t,r))},t.prototype.cancelRedraw=function(e){cancelAnimFrame(e.timeoutid)},t.prototype.scheduleRedraw=function(e){e.timeoutid&&e.cancelRedraw(e),function t(){e.timeoutid=requestAnimFrame(t),e.xp+=(e.currentMx-e.xp)/e.dampingFactor,e.yp+=(e.currentMy-e.yp)/e.dampingFactor,e.magnifierPercentEased+=(e.magnifierPercent-e.magnifierPercentEased)/e.dampingFactor,e.flyoutEnabled&&e.positionFlyout(),e.positionMagnifier()}()},t.prototype.presentImageAtIndex=function(e){var t,r=this;r.smallImageUrl=r.smallImageUrls()[e],r.fullImageUrl=r.fullImageUrls()[e],r.imgMetadata={alttext:r.smallImageUrl,title:r.smallImageUrl},r.imageMetadatas&&r.imageMetadatas.length>0?r.imgMetadata=$.extend(r.imgMetadata,r.imageMetadataDefault,r.imageMetadatas[e]):r.imgMetadata=$.extend(r.imgMetadata,r.imageMetadataDefault),r.imageLoadFailed=!1,r.loading=!0,r.jqSmallImage.fadeTo(200,0,function(){r.jqFlyout.find("img").removeAttr("src"),r.usingSpinner&&(t=setTimeout(function(){r.spinner.create({parent:r.element})},r.spinnerDelay)),r.replaceImageAtIndex&&(r.jqSmallImage.attr("src",r.smallImageUrl),r.imgMetadata&&(r.jqSmallImage.attr("alt",r.imgMetadata.alttext),r.jqSmallImage.attr("title",r.imgMetadata.title))),r.imgMetadata&&(r.jqFullImage.attr("title",r.imgMetadata.title),r.jqFullImage.attr("alt",r.imgMetadata.alttext)),$.when(r.loadImage(r.smallImageUrl)).done(function(e){r.jqSmallImage.fadeTo(200,1)}).fail(function(e){r.imageLoadFailed=!0,r.jqSmallImage.fadeTo(200,1),r.jqSmallImage.attr("src",r.errorImageUrl)}).always(function(){r.usingSpinner&&(r.loading=!1,clearTimeout(t),r.spinner.destroyAndClearTimeout())})})},t.prototype.start=function(){var e=this,t="10px",r="",i="";if(e.imageLoadFailed=!1,e.jqSmallImage=$(e.element).find("."+e.smallImageClass),e.jqFullImage=$(e.element).find("."+e.fullImageClass),e.jqFlyout=$(e.element).find("."+e.flyoutClass),e.jqMagnifier=$(e.element).find("."+e.magnifierClass),e.smallImageUrls&&"function"==typeof e.smallImageUrls?(r=e.smallImageUrls()[0],i=e.smallImageUrls()[0]):e.smallImageUrls&&"object"==typeof e.smallImageUrls&&e.smallImageUrls instanceof Array?(r=e.smallImageUrls[0],i=e.smallImageUrls[0]):e.smallImageUrls&&(r=e.smallImageUrls,i=e.smallImageUrls),e.imgMetadata={alttext:r,title:i},e.imageMetadatas&&e.imageMetadatas.length>0?e.imgMetadata=$.extend(e.imgMetadata,e.imageMetadataDefault,e.imageMetadatas[0]):e.imgMetadata=$.extend(e.imgMetadata,e.imageMetadataDefault),e.jqMagnifier.length||(e.jqMagnifier=$("<div></div>"),e.jqMagnifier.addClass(e.magnifierClass),$(e.element).append(e.jqMagnifier)),!e.jqFlyout.length&&e.flyoutEnabled){e.jqFlyout=$("<div></div>"),e.jqFlyout.css({display:"none"}),e.jqFlyout.addClass(e.flyoutClass);var a=$("<img></img>");a.css({"max-width":"none"}),a.addClass(e.fullImageClass),a.on("error",function(){e.imageLoadFailed=!0}),e.jqFlyout.append(a),e.jqFullImage=a,e.imgMetadata&&(e.jqFullImage.attr("title",e.imgMetadata.title),e.jqFullImage.attr("alt",e.imgMetadata.alttext)),$(e.element).append(e.jqFlyout)}if(e.index&&(e.subHandle=e.index.subscribe(function(t){e.presentImageAtIndex(t)}),$(e.element).on("remove",function(){e.subHandle&&e.subHandle.dispose()})),e.flyoutEnabled||(t="100%"),e.element){e.registerMouseWheel(),$(e.element).css({position:"relative",display:"inline-block"}),e.jqFullImage.css({position:"absolute"}),e.jqSmallImage.css({display:"block","-webkit-touch-callout":"none"});var o={background:"#DDD",border:"1px solid #FFF","box-shadow":"0 0 15px rgba(0,0,0,0.5)",display:"none",overflow:"hidden",position:"absolute","z-index":"99"};e.jqFlyout.css(o);var n=e.magnifierBorderWidth+"px solid rgb(125,125,125)",s={position:"absolute","border-radius":t,display:"none","z-index":"98",overflow:"hidden","background-repeat":"no-repeat",border:n};e.jqMagnifier.css(s);var l=e.element;$(l).bind("touchstart",function(t){t.preventDefault(),e.magnifierEnabled&&(e.offsetMagnifier=!0),e.handleMouseEnter(),e.handleMouseMove(t)}),$(l).bind("touchend",function(t){e.handleMouseLeave(),e.offsetMagnifier=!1}),$(l).bind("touchmove",e.handleMouseMove),$(l).mousemove(e.handleMouseMove),$(l).mouseenter(function(){e.handleMouseEnter()}),$(l).mouseleave(function(){e.handleMouseLeave()})}},t}),define("ccNumber",["CCi18n"],function(e){"use strict";function t(){}return t.prototype.formatNumber=function(t,r,i){var a="ns.ccformats:resources.numberformat",o=e.t(a);o&&o!==a||(o="000,000,000.00");for(var n="",s=-1,l="",c=0,d=o.length-1;d>=0;d--)if(isNaN(parseInt(o[d],10))&&s==-1)s=c,n=o[d];else{if(s>-1&&isNaN(parseInt(o[d],10))){l=o[d];break}c++}return isNaN(i)||(s=i),this.formatNumberFromData(t,s,n,l,r)},t.prototype.formatNumberFromData=function(e,t,r,i,a){if(""===e)return"";if(isNaN(e))return"";if(0==jQuery.trim(e).length)return"";var o="";o=parseFloat(e).toFixed(t).toString(),a||(o=parseFloat(o).toString());var n=parseFloat(o)>=0?"":"-",s="",l=parseFloat(o)>=0?Math.floor(parseFloat(o)):Math.ceil(parseFloat(o));l=Math.abs(l);var c=o.indexOf(".")>-1;return c===!0&&(s=o.substring(o.indexOf(".")+1,o.length)),o="",""!==s&&(o=r+s),o=n+l.toString().replace(/\B(?=(\d{3})+(?!\d))/g,i)+o},new t}),define("ccLazyImages",["knockout","pubsub","ccConstants"],function(e,t,r){"use strict";function i(){var t,i,a,o=this,n=200,s=new Array,l=!1,c=!1;o.THROTTLE_TIMEOUT=100,o.throttle=function(e,t){var r=null;return function(){r||(r=setTimeout(function(){e(),r=null},t))}},o.observeLazyImage=function(e,r){e.dataset.lazyLoading=!0;var n=0===s.length;s.indexOf(e)==-1&&s.push(e),t?t.observe(e):n&&(document.addEventListener("scroll",o.checkForLazyImagesToLoad),window.addEventListener("resize",o.checkForLazyImagesToLoad),window.addEventListener("orientationchange",o.checkForLazyImagesToLoad),i&&i.observe(document,{attributes:!0,childList:!0,characterData:!0,subtree:!0})),n&&r>0&&(a=setInterval(o.loadOutOfFocusImages,1e3*r))},o.unobserveLazyImage=function(e){e.dataset.lazyLoading=!1,s=s.filter(function(t){return t!=e}),t?t.unobserve(e):0===s.length&&(document.removeEventListener("scroll",o.checkForLazyImagesToLoad),window.removeEventListener("resize",o.checkForLazyImagesToLoad),window.removeEventListener("orientationchange",o.checkForLazyImagesToLoad),i&&i.disconnect()),0==s.length&&clearInterval(a)},o.setupLazyLoadStyling=function(t,r){var i,a,o;i=e.utils.unwrapObservable(r.lazyLoadingImageClass),i||(i="ccLazyLoad"),t.classList.add(i),t.dataset.lazyLoadingImageClass=i,a=e.utils.unwrapObservable(r.lazyLoadedImageClass),a||(a="ccLazyLoaded"),t.dataset.lazyLoadedImageClass=a,o=e.utils.unwrapObservable(r.lazyLoadingParentClass),o||(o="ccLazyLoad-background"),t.parentElement.classList.add(o),t.dataset.lazyLoadingParentClass=o},o.resetLazyLoadStyling=function(e){e.dataset.lazyLoadingParentClass&&e.parentElement.classList.remove(e.dataset.lazyLoadingParentClass),e.dataset.lazyLoadingImageClass&&e.classList.remove(e.dataset.lazyLoadingImageClass),e.dataset.lazyLoadedImageClass&&e.classList.add(e.dataset.lazyLoadedImageClass)},o.loadLazyImage=function(e){var t=e.dataset.defaultErrorSrc;t||(t=r.SITE_DEFAULT_NO_IMAGE_URL);var i=e.dataset.errorSrc,a=i;a||(a=t);var n=e.dataset.errorAlt,s=e.dataset.onerror;e.onload=function(){o.resetLazyLoadStyling(e)},e.onerror=function(){o.resetLazyLoadStyling(e),e.srcset&&e.removeAttribute("srcset"),e.sizes&&e.removeAttribute("sizes");var i=new Image;i.onload=function(){e.src=a,s&&s(e),e.onerror=""},i.onerror=function(){var i=new Image;i.onload=function(){e.src=i.src,s&&s(e),e.onerror=""},i.onerror=function(){e.src=r.SITE_DEFAULT_NO_IMAGE_URL,s&&s(e),e.onerror=""},i.src=t},i.src=a,n&&(e.alt=n)},e.dataset.alt&&(e.alt=e.dataset.alt),e.dataset.title&&(e.title=e.dataset.title),e.dataset.lazyLoading=!1,e.dataset.srcset&&(e.srcset=e.dataset.srcset),e.dataset.sizes&&(e.sizes=e.dataset.sizes),e.dataset.src&&(e.src=e.dataset.src)},o.checkForLazyImagesToLoad=function(){l===!1&&(l=!0,setTimeout(function(){s.length>0&&s.forEach(function(e){o.isImageVisible(e,e.dataset.src)?(o.loadLazyImage(e),o.unobserveLazyImage(e)):document.body.contains(e)||o.unobserveLazyImage(e)}),l=!1},n))},o.checkForIntersection=function(e){if(e.isIntersecting||e.intersectionRatio>0){var t=e.target;o.loadLazyImage(t),o.unobserveLazyImage(t)}},o.reportImageRect=function(e,t){var r=window.innerHeight||document.documentElement.clientHeight;console.debug("Window height="+r+" image: top="+t.top+" bottom="+t.bottom+" height="+t.height+" for image "+e)},o.isImageVisible=function(e,t){var r=e.getBoundingClientRect();window.innerHeight||document.documentElement.clientHeight;return r.top<=window.innerHeight&&r.bottom>0},o.loadOutOfFocusImages=function(){c===!1&&(c=!0,setTimeout(function(){s.length>0&&s.forEach(function(e){document.body.contains(e)&&e.src!==e.dataset.src?(o.unobserveLazyImage(e),o.loadLazyImage(e)):document.body.contains(e)||o.unobserveLazyImage(e)}),c=!1},n))},"IntersectionObserver"in window&&"IntersectionObserverEntry"in window&&"intersectionRatio"in window.IntersectionObserverEntry.prototype&&"isIntersecting"in window.IntersectionObserverEntry.prototype&&navigator.userAgent.indexOf("Edge")===-1?t=new IntersectionObserver(function(e,t){e.forEach(function(e){o.checkForIntersection(e)})}):(l=!1,this.checkForLazyImagesToLoad=this.throttle(this.checkForLazyImagesToLoad,this.THROTTLE_TIMEOUT),"MutationObserver"in window&&(i=new MutationObserver(o.checkForLazyImagesToLoad)))}return new i}),define("koExtensions",["knockout","CCi18n","ccDate","ccImageZoom","ccNumber","ccConstants","moment","ccLazyImages","jqueryui","bootstrapDatePicker","bootstrapTimePicker","spectrumColorPicker","bootstrap","chosen"],function(e,t,r,i,a,o,n,s){"use strict";function l(){function e(e,r){for(var i=0,a=r.length;i<a;i+=1)if(t(e,r[i]))return i;return-1}function t(e,t){return e===t||void 0!==e&&void 0!==t&&(null!==e&&null!==t&&(e.constructor===String?e+""==t+"":t.constructor===String&&t+""==e+""))}window.Select2.class.multi.prototype.skipDuplicateCheck=!0,window.Select2.class.multi.prototype.updateSelection=function(t){var r=[],i=[],a=this;window.Select2.class.multi.prototype.skipDuplicateCheck||($(t).each(function(){e(a.id(this),r)<0&&(r.push(a.id(this)),i.push(this))}),t=i),this.selection.find(".select2-search-choice").remove(),$(t).each(function(){a.addSelectedChoice(this)}),a.postprocessResults()},window.Select2.class.multi.prototype.setVal=function(t){var r;this.select?this.select.val(t):(r=[],window.Select2.class.multi.prototype.skipDuplicateCheck||($(t).each(function(){e(this,r)<0&&r.push(this)}),this.opts.element.val(0===r.length?"":r.join(this.opts.separator))))}}e.bindingHandlers.select2={prependLabel:function(e){if($(e)[0].labels&&$(e)[0].labels.length>0){var t=$(" <span></span>").attr("class","cc-reader-text").html($(e)[0].labels[0].innerHTML);$(e).select2("container").find(".select2-chosen:first-child").prepend(t)}},init:function(r,i,a){var o,n,s,l,c=i(),d=a(),u=d.lookupKey;l=e.bindingHandlers.select2,void 0!==c.ccFormatInputTooShortKey&&null!==c.ccFormatInputTooShortKey||(c.ccFormatInputTooShortKey="ns.common:resources.select2FormatInputTooShort"),void 0!==c.ccFormatInputTooLongKey&&null!==c.ccFormatInputTooLongKey||(c.ccFormatInputTooLongKey="ns.common:resources.select2FormatInputTooLong"),void 0!==c.ccFormatSelectionTooBigKey&&null!==c.ccFormatSelectionTooBigKey||(c.ccFormatSelectionTooBigKey="ns.common:resources.select2SelectionTooBig"),void 0!==c.ccFormatNoMatches&&null!==c.ccFormatNoMatches||(c.ccFormatNoMatches=t.t("ns.common:resources.select2FormatNoMatches")),void 0!==c.ccFormatLoadMore&&null!==c.ccFormatLoadMore||(c.ccFormatLoadMore=t.t("ns.common:resources.select2LoadMore")),void 0!==c.ccFormatSearching&&null!==c.ccFormatSearching||(c.ccFormatSearching=t.t("ns.common:resources.select2Searching")),void 0!==c.ccPlaceholderAdjustWidth&&null!==c.ccPlaceholderAdjustWidth||(c.ccPlaceholderAdjustWidth=!0),c.formatInputTooShort=function(e,r){var i=r-e.length,a=t.t(c.ccFormatInputTooShortKey,{numberUnder:i});return a},c.formatInputTooLong=function(e,r){var i=e.length-r,a=t.t(c.ccFormatInputTooLongKey,{numberOver:i});return a},c.formatSelectionTooBig=function(e){var r=t.t(c.ccFormatSelectionTooBigKey,{limit:e});return r},c.formatNoMatches=function(){return c.ccFormatNoMatches},c.formatLoadMore=function(e){return c.ccFormatLoadMore},c.formatSearching=function(){return c.ccFormatSearching},$(r).select2(c),$(r).select2("container").find(".select2-search-choice-close").each(function(e,r){$(r).html('<span class="cc-reader-text">'+t.t("ns.common:resources.removeText")+"</span>").attr("tabindex",0)}),$(r).select2("container").find(".select2-choices").attr("aria-label",t.t("ns.common:resources.ariaSelectedOptionsText")),$(".select2-results").attr("aria-label",t.t("ns.common:resources.ariaAvailableOptionsText")),"undefined"!=typeof d.select2.placeholder&&$(r).attr("placeholder",d.select2.placeholder),"undefined"!=typeof d.select2.ccEnabled&&$(r).select2("enable",e.utils.unwrapObservable(d.select2.ccEnabled));var p,h,g,f=!1;u&&(p=e.utils.unwrapObservable(d.value),$(r).select2("data",e.utils.arrayFirst(c.data.results,function(e){return e[u]===p}))),e.utils.domNodeDisposal.addDisposeCallback(r,function(){$(r).select2("destroy")}),p=a().value,h=a().valueUpdated,f=a().isPreselect,g=a().selectedOptions,p&&p.isModified&&p.isModified.subscribe(function(e){e&&$(r).prop("required")&&!p.isValid()?$($(r).select2("container")).addClass("invalid"):$($(r).select2("container")).removeClass("invalid")}),p&&p.subscribe(function(e){$(r).prop("required")&&!p.isValid()?$($(r).select2("container")).addClass("invalid"):$($(r).select2("container")).removeClass("invalid")}),o=!1,h?(f&&g&&h(g),$(r).on("change",function(){o||(o=!0,h($(r).val()),o=!1)})):p&&e.isObservable(p)&&$(r).on("change",function(){o||(o=!0,p($(r).val()),o=!1)}),p&&e.isObservable(p)&&$(r).on("select2-blur",function(e){$(r).val(p()).trigger("change")}),$(r).on("select2-open select2-close",function(e){d.select2.ccHideDrop&&$(".select2-drop").toggleClass("cc-select2-hideResults")}),$(r).on("change",function(e){$(r).select2("container").find(".select2-search-choice-close").each(function(e,r){$(r).html('<span class="cc-reader-text">'+t.t("ns.common:resources.removeText")+"</span>").attr("tabindex",0)}),r.selectedOptions&&r.selectedOptions[0]&&r.selectedOptions[0].label&&$(r).select2("container").find(".select2-chosen").attr("title",r.selectedOptions[0].label),l.prependLabel(r)}),"undefined"!=typeof d.select2.placeholder&&d.select2.ccPlaceholderAdjustWidth&&(n=$("<div></div>").attr({id:"cc-select2-placeholder-tester"}).text(d.select2.placeholder),$("body").append(n),s=$("#cc-select2-placeholder-tester").width()+30,$("body").remove("#cc-select2-placeholder-tester"),$(r).prev(".select2-container").find(".select2-input").attr("placeholder",d.select2.placeholder).css({"min-width":s+"px","max-width":s+"px"}))},update:function(t,r,i,a){var o,n=i(),s=r(),l=n.select2.initializeDataQuery,c=s.valueUpdated;if(o=e.bindingHandlers.select2,o.prependLabel(t),l){var d=i().value,u=$(t).select2("data");d&&e.isObservable(d)&&(d()&&u&&0===u.length?l(d(),function(e){$(t).select2("data",e),d.valueHasMutated(),d.isModified(!1)},s.includeInvalidItems,u):d()?d()&&u&&u.length>0&&c&&c(u):u&&u.length>0?($(t).select2("data",[]),d.valueHasMutated(),d.isModified(!1)):c&&c([]))}t.selectedOptions&&t.selectedOptions[0]&&t.selectedOptions[0].label&&$(t).select2("container").find(".select2-chosen").attr("title",t.selectedOptions[0].label)}},e.bindingHandlers.select2Tags={init:function(e,r,i){var a,o,n=r();if(void 0!==n.ccFormatNoMatches&&null!==n.ccFormatNoMatches||(n.ccFormatNoMatches=t.t("ns.common:resources.select2FormatNoMatches")),a=n.ccTagOptions?n.ccTagOptions:null,n.formatNoMatches=function(){return n.ccFormatNoMatches},n.createSearchChoice=function(r){return o=!0,$.each($(e).select2("container").find(".select2-search-choice"),function(e,t){$.trim($(t).text().toLowerCase())==$.trim(r.toLowerCase())&&(o=!1)}),o?{id:$.trim(r),text:$.trim(r)}:void window.setTimeout(function(e){$(".select2-no-results").text(t.t("ns.common:resources.select2NoDuplicateText"));
- },0)},l(),$(e).select2(n).on("select2-removing",function(t){$.each($(e).select2("container").find(".cc-select2-locked"),function(e,r){$.trim($(r).text())==t.val&&t.preventDefault()})}),$(e).on("change",function(r){$(e).select2("container").find(".select2-search-choice-close").each(function(e,r){$(r).html('<span class="cc-reader-text">'+t.t("ns.common:resources.removeText")+"</span>").attr("tabindex",0)})}),window.Select2.class.multi.prototype.skipDuplicateCheck=!1,a&&(a.lockExisting&&$.each($(e).select2("container").find("ul.select2-choices li.select2-search-choice"),function(e,t){$(t).addClass("cc-select2-locked")}),a.disabled&&$(e).select2("enable",!1),a.sortable)){var s=$(e).select2("container").find("ul.select2-choices").sortable({connectWith:"ul.select2-choices",items:".sorting-initialize",containment:"parent",start:function(){$(e).select2("onSortStart")},update:function(){$(e).select2("onSortEnd")}});s.find(".select2-search-choice").one("mouseenter",function(){$(this).addClass("sorting-initialize"),s.sortable("refresh")})}},update:function(e,t,r,i,a){}},e.bindingHandlers.onRender={init:function(e,t,r,i,a){var o=t();"function"==typeof o&&o(e,i)}},function(){var e,t,r,i,a=200,o=300,n=100,s=200;i=function(e){0===$(e.target).closest(".popover").length&&t()},t=function(){e&&(e.data("bs.popover").tip().off("keydown"),e.popover("destroy"),e=null,$(document).off("click",i),$(document).off("focusin",i))},r=function(e,t){var r,i,l,c;return c=$(window),r=t.top-c.scrollTop(),i=t.left-c.scrollLeft(),r<n||r<s&&"top"===e?l="bottom":(r>c.height()-n||r>c.height()-s&&"bottom"===e)&&(l="top"),i<a||i<o&&"left"===e?l="right":(i>c.width()-a||i>c.width()-o&&"right"===e)&&(l="left"),l||e}}(),function(){var t,r,i,a=552,n=null;e.bindingHandlers.modal={init:function(s,l,c){var d,u,p,h,g,f,m,I,E,y,v,b,T,P,S=null,C="cc-modal-focus-out-active",_=l().focusFallback?l().focusFallback.split(","):null;u=$(window),d=$(s),p=d.find(".modal-body");var A=!!u[0].chrome&&!!u[0].chrome.webstore;T=function(){$(s).on("keydown.modal.cc",":text",function(e){var t=e.which||e.charCode||e.keyCode;if(27==t)return!1})},P=function(){$(s).off("keydown.modal.cc",":text")},h=function(){var e,t=0;$("body").prepend($("<div></div>").attr("id","cc-modalTester"));var r=!1;d.find(".modal-content").children().each(function(){this===p[0]||r||$(this).clone().appendTo("#cc-modalTester"),$(this).hasClass("modal-footer")&&(r=!0)}),t=$("#cc-modalTester").outerHeight(),$("#cc-modalTester").remove(),e=u.width()>767?.11*u.height():11,p.css({"max-height":Math.max(128,u.height()-t-e)})},g=function(e){$(e).find(".cc-focus-target").length>0?$.inArray($(e).find(".cc-focus-target")[0],$(e).find(":tabbable"))===-1?void 0!==$(e).find(".cc-focus-target :tabbable")[0]&&$(e).find(".cc-focus-target :tabbable")[0].focus():$(e).find(".cc-focus-target")[0].focus():$(e).find(":tabbable")[0]&&$(e).find(":tabbable")[0].focus()},E=function(e){1===d.has(document.activeElement).length&&(S=!0,$(document.activeElement).addClass(C))},y=function(e){S=!1,$("."+C).removeClass(C)},v=function(e){S&&e.preventDefault(),$("."+C).focus().removeClass(C)},b=function(e){S=!1},d.on("focusin",function(e){e.stopPropagation()}),d.on("show.bs.modal",function(e){$(e.target).hasClass("modal")&&(d.data("alreadyOpen")!==!0&&(d.data("alreadyOpen",!0),setTimeout(function(){d.data("bs.modal").$backdrop.css({"z-index":a-10}),d.css({"z-index":a}),t=a,a+=20,h()},1)),u.resize(h),$("body").addClass("no-scroll"),f=!0,1===$(e.relatedTarget).length&&(m=$(e.relatedTarget),m.addClass(o.MODAL_CLOSE_FOCUS),m.attr("id")&&(I=m.attr("id"))))}),d.on("shown.bs.modal",function(e){g(d),A&&(d.on("focusout",E),d.on("focus mousedown",b),d.on("keyup.dismiss.bs.modal",y),d.find("button, a").on("click",b),d.on("hide.bs.modal",v)),T()}),d.on("hide.bs.modal",function(){d.find(".modal-body").scrollTop(0)}),d.on("hidden.bs.modal",function(e){if($(e.target).hasClass("modal")){if(a-=20,r=a-20,f=!1,i=0,n=null,d.data("alreadyOpen",!1),P(),u.off("resize",h),A&&(d.off("focusout",E),d.off("focus mousedown",b),d.off("keyup.dismiss.bs.modal",y),d.find("button, a").off("click",b),d.off("hide.bs.modal",v)),S=null,d.find(".cc-curtain")&&d.find(".cc-curtain").remove(),$(s).css("left","0px"),0===$("body .modal.in").length){setTimeout(function(){$("body").removeClass("no-scroll")},0);var t=null;null!==_&&$.each(_,function(e,r){if(0!==$(r).length)return t=r,!1}),0!==$(o.MODAL_CLOSE_FOCUS_CLASS).length?($(o.MODAL_CLOSE_FOCUS_CLASS).focus(),$(o.MODAL_CLOSE_FOCUS_CLASS).removeClass(o.MODAL_CLOSE_FOCUS)):$("#"+I).length>0?$("#"+I).focus():null!==t&&window.setTimeout(function(){$(t).focus()},10)}$.each($(".modal"),function(e,t){"block"===$(t).css("display")&&$(t).css("z-index")>i&&(i=$(t).css("z-index"),n=$(t))}),g(n)}}),e.utils.domNodeDisposal.addDisposeCallback(s,function(){d.modal("hide")})}}}(),e.bindingHandlers.datepicker={init:function(t,r,i){var a=i().dpOptions||{},o=a.language?a.language:"en",n=e.bindingHandlers.datepicker;o&&"en"!==o?require(["bootstrapDatePickerLocales/bootstrap-datepicker."+o],function(e){n.loadDatePicker.call(n,t,r,i,a)},function(e){var s;s=o.indexOf("-")!==-1?o.split("-")[0]:"en",require(["bootstrapDatePickerLocales/bootstrap-datepicker."+s],function(e){n.loadDatePicker.call(n,t,r,i,a)},function(e){n.loadDatePicker.call(n,t,r,i,a)})}):n.loadDatePicker.call(n,t,r,i,a)},loadDatePicker:function(t,i,a,o){var n,s,l,c,d,u,p,h=1===$(t).parents(".modal").length;h?(n="",s=$(t).parents(".tab-pane")?$(t).parents(".tab-pane"):$(t).parents(".modal-body")):n=$(t).closest(".row")[0].nextElementSibling;var g=e.utils.unwrapObservable(a().format);!g&&o.format||(o.format=r.getDateFormat(g?g:"short").toLowerCase()),$(t).datepicker(o).on("show",function(e){$.each($("body .datepicker.dropdown-menu"),function(t,r){void 0!==$(r).attr("style")&&"none"!=$(r).css("style")&&null!==n&&$(r).css({position:"absolute",top:"35px",left:"0px"}).appendTo($(e.target).parent())}),c=$(t).parents(".form-group").position().top+$(t).parents(".form-group").outerHeight(!0),d=c+240,h?(l=s.height(),d>l&&(u=d-l,s.css({height:l+u+"px"})),p=$(t).parents(".modal-body").scrollTop()+$(t).closest(".form-group").offsetParent().position().top,-$(t).parents(".modal-body").scrollTop($(t).closest(".form-group").position().top+p)):(l=$(t).parents(".form-group").offsetParent().outerHeight(!0),d>l&&(u=d-l,$(t).parents(".form-group").offsetParent().css({})))}).on("changeDate",function(e){var r=i();r(e.date),$(t).datepicker("setValue",e.date)}).on("dphide",function(){h?s.css({height:"auto"}):$(t).parents(".form-group").offsetParent().css({height:"auto"})}),e.utils.domNodeDisposal.addDisposeCallback(t,function(){$(t).datepicker("remove")})},update:function(t,r,i){var a=e.utils.unwrapObservable(i().value);if(a){var o=new Date(a);isNaN(o)||(i().value(o),$(t).datepicker("setDate",new Date(o.getTime()+6e4*o.getTimezoneOffset())))}}},e.bindingHandlers.timepicker={init:function(t,r,i){var a,o=i().Options||{};$(t).timepicker(o).on("show.timepicker",function(e){$(t).timepicker("setDefaultTime","current")}),$(t).timepicker(o).on("focus.timepicker",function(e){$(t).timepicker("showWidget")}),a=e.utils.unwrapObservable(r()),$(t).timepicker(o).on("changeTime.timepicker",function(e){var t=r();t(e.time.value)}),e.utils.domNodeDisposal.addDisposeCallback(t,function(){$(t).timepicker("remove")})}},e.bindingHandlers.spectrum={init:function(r,i,a){var o=a().defaultSettings||{};o.cancelTextKey&&(o.cancelText=t.t("ns.common:resources."+o.cancelTextKey)),o.chooseTextKey&&(o.chooseText=t.t("ns.common:resources."+o.chooseTextKey));var n="#000000",s=function(){var e=$(r).spectrum("get");"function"==typeof e.toHex&&(n="#"+e.toHex());var t=i();n!==t()&&t(n)},l=function(e,t){for(var r=e+"";r.length<t;)r="0"+r;return r};o.hide=s,o.clickoutFiresChange=!0;var c="spectrum-input";if(r.id)c=r.id+"-spectrum-input";else{var d=new Date;c=l(d.getFullYear(),4)+l(d.getMonth()+1,2)+l(d.getDay(),2)+l(d.getHours(),2)+l(d.getMinutes(),2)+l(d.getSeconds(),2)+l(d.getMilliseconds(),3)+"-spectrum-input"}var u="class-"+c;o.className=u,$(r).spectrum(o);var p=$("<label>Color</label>",{htmlFor:c});p.attr("for",c),p.attr("class","cc-reader-text"),p.text(t.t("ns.common:resources.colorPickerInputLabel"));var h=$("."+u),g=h.find(".sp-cancel"),f=h.find(".sp-choose"),m=h.find(".sp-input-container");m.prepend(p);var I=h.find(".sp-input");I.attr("id",c);var E=e.utils.unwrapObservable(i());$(r).spectrum("set",E),e.utils.registerEventHandler(r,"change",s);var y=$(r).next(".sp-replacer");y.removeAttr("tabindex");var v=$("<a></a>",{href:"#"});y.wrap(v),e.utils.domNodeDisposal.addDisposeCallback(r,function(){var e=$(r).spectrum("get");"function"==typeof e.toHex&&(n="#"+e.toHex()),$(r).spectrum("destroy")}),v=$(r).next("a"),g.click(function(){return v.focus(),!0}),f.click(function(){return v.focus(),!0}),v.click(function(){var e=r.disabled;if(!e){var t=$(r).spectrum("container");t.appendTo(v),$(r).spectrum("toggle")}return!1})},update:function(t,r){var i=e.utils.unwrapObservable(r());$(t).spectrum("set",i)}},e.bindingHandlers.slider={init:function(t,r,i){var a=i().sliderOptions||{},o=e.utils.unwrapObservable(r());a.value=o,a.change=function(e,t){var i=r();i(t.value)},a.liveUpdate&&(a.slide=a.change),$(t).slider(a),e.utils.domNodeDisposal.addDisposeCallback(t,function(){$(t).slider("destroy")}),e.utils.registerEventHandler(t,"slidestop",function(e,t){var i=r();i(t.value)})},update:function(t,r,i){var a=i().sliderOptions||{},o=e.utils.unwrapObservable(r());isNaN(o)&&(o=a.defaultValue||0),$(t).slider("value",o),$(t).slider("option",i().sliderOptions)}},e.bindingHandlers.chosen={truncate:function(e){var t,r,i;t=$(".chosen-container").find("span").outerWidth(!0)+5,r=$(".chosen-container").width(),t>r&&e&&(i=$(".chosen-container").find("span").html().split(e),i.length>1&&$(".chosen-container").find("span").text("... "+e+" "+i[i.length-1]))},addAccessibility:function(e){var r=e.find("a.search-choice-close");$.each(r,function(){0===$(this).find(".cc-reader-text").length&&($(this).append($("<span></span>").attr("class","cc-reader-text").text(t.t("ns.common:resources.removeText"))),$(this).attr("tabindex","0"),$(this).on("keyup",function(t){13===t.keyCode&&($(this).trigger("click"),$(e.find(".search-field input")).focus())}))})},init:function(r,i,a,o,n){var s,l,c,d,u,p,h,g,f=e.utils.unwrapObservable(i()),m=!!f.allSelectedMessage&&f.allSelectedMessage;e.bindingHandlers.options.init(r,function(){return f.values},a,o,n),c=e.bindingHandlers.chosen,$(r).addClass("chosen-select"),$(r).chosen(f.options).trigger("chosen:ready"),d=$(r).next(),h=$(r).attr("id")+"-search-field",g=$(r).attr("data-placeholder")?$(r).attr("data-placeholder"):t.t("ns.common:resources.chosenSearchFieldDefaultLabel"),u=d.find(".search-field"),p=$("<label></label>").attr("class","cc-reader-text").attr("for",h).text(g),u.find("input").attr("id",h),u.prepend(p),$(r).chosen().change(function(){c.addAccessibility(d)}),$(r).on("chosen:showing_dropdown",function(){window.setTimeout(function(){0===d.find("li.active-result").length?m?d.find(".chosen-results").append($("<li></li>").attr("class","cc-chosen-message").html(m)):d.find(".chosen-drop").addClass("hide"):($(".cc-chosen-message").remove(),d.find(".chosen-drop").removeClass("hide"))},0)});var I=r.id+"-search";$(".chosen-search input").attr("id",I),l=a().value,s=!1,l&&e.isObservable(l)&&$(r).on("change",function(){s||(s=!0,l($(r).val()),s=!1)}),f.truncate&&$(r).on("change",c.truncate.bind(c,f.truncate))},update:function(t,r,i,a,o){var n,s,l,c=e.utils.unwrapObservable(r());$(".chosen-results").attr("tabindex","0"),l=$(t).next(),e.bindingHandlers.options.update(t,function(){return c.values},i,a,o),s=e.bindingHandlers.chosen,i().value?$(t).val(e.utils.unwrapObservable(i().value)):i().selectedOptions&&$(t).val(e.utils.unwrapObservable(i().selectedOptions)),$(t).trigger("chosen:updated"),s.addAccessibility(l),c.truncate&&(n=$(t).parents(".modal").attr("id")?"#"+$(t).parents(".modal").attr("id"):"",n?$(n).on("shown.bs.modal",function(){s.truncate(c.truncate)}):s.truncate(c.truncate))}},e.bindingHandlers.scrollAffix={update:function(t,r){var i,a,o,n,s,l,c,d,u=e.utils.unwrapObservable(r());a=e.utils.unwrapObservable(u.scrollDistance),o=e.utils.unwrapObservable(u.affixPos),n=e.utils.unwrapObservable(u.affixWidth)?e.utils.unwrapObservable(u.affixWidth):null,s=e.utils.unwrapObservable(u.affixMatchElm),l=e.utils.unwrapObservable(u.adjust),c=e.utils.unwrapObservable(u.adjustPos)?e.utils.unwrapObservable(u.adjustPos):null,i=function(){if(d=null,$(window).width()<="992")return $(t).parent().css({"min-height":"auto"}),$(t).css({position:"",top:"",width:""}),void 0!==l&&$(l).css({"margin-top":"auto"}),!1;if(n)d=n;else{if("undefined"===s||"none"===$(s).css("display"))return!1;d=$(s).outerWidth(!0)}$(window).scrollTop()>a&&null!==d?($(t).css({position:"fixed",top:o,width:d}),$(t).addClass("cc-scrollAffix"),void 0!==l&&$(l).css({"margin-top":c})):($(t).parent().css({"min-height":"auto"}),$(t).css({position:"",top:"",width:""}),$(t).removeClass("cc-scrollAffix"),void 0!==l&&$(l).css({"margin-top":"auto"}))},$(window).scroll(i),$(window).resize(i),e.utils.domNodeDisposal.addDisposeCallback(t,function(){$(window).off("scroll",i),$(window).off("resize",i)})}},e.bindingHandlers.currency={update:function(t,r,i,o,n){var s=e.utils.unwrapObservable(r()),l=parseFloat(s.price),c=s.currencyObj.symbol,d=s.nullReplace,u=s.prependNull,p=s.prependSymbol,h=s.currencyObj.fractionalDigits,g=null;if(p&&(c=p+" "+c),!l&&0!==l||isNaN(parseFloat(l)))$(t).text((c&&u?c:"")+(d?d:""));else{c.match(/^[0-9a-zA-Z]+$/)&&(c+=" ");var f=(l+"e").split("e"),s=Math.round(f[0]+"e"+(+f[1]+h));f=(s+"e").split("e"),l=+(f[0]+"e"+(+f[1]-h)),g=a.formatNumber(l,!0,h);var m=g.charAt(0);"-"===m||"+"===m?$(t).text(m+c+g.slice(1)):$(t).text(c+g)}}},e.bindingHandlers.imageSource={init:function(t,r){var i,a,o,n=!1,s=e.utils.unwrapObservable(r());"object"==typeof s&&"IMG"===t.nodeName&&(s.cacheBust&&(n=e.utils.unwrapObservable(s.cacheBust)),i=e.utils.unwrapObservable(s.src),n&&(i=d(i)),a=e.utils.unwrapObservable(s.errorSrc),i&&a&&(o=new Image,o.src=a))},update:function(t,r,i,a,n){var l,c,u,p,h,g,f,m,I,E=!1,y=!1,v=-1,b=e.utils.unwrapObservable(r());if("object"==typeof b&&"IMG"===t.nodeName){b.cacheBust&&(E=e.utils.unwrapObservable(b.cacheBust)),p=e.utils.unwrapObservable(b.src),l=e.utils.unwrapObservable(b.imageType),l||(l="small");var T=[function(e,t){var r;return e.productImages&&e.productImages.length>0&&(r=e.productImages[0].url),r},function(e,t){return e.url},function(e,t){var r,i=p[t+"Image"];return i&&(r=i.url),r},function(e,t){var r;return p instanceof Object&&p[t]&&(r=p[t]),r},function(e,t){var r,i,a,o;return i=e.childSKUs,i&&(r=i[0],r&&(a=r[t+"Image"],a&&(o=a.url))),o},function(e,t){if("string"==typeof e)return e}];if(p)for(;!u&&T.length;)u=T.shift().call(this,p,l);else u=b.errorSrc,y=!1;E&&(u=d(u)),h=e.utils.unwrapObservable(b.errorSrc),g=e.utils.unwrapObservable(b.alt),f=e.utils.unwrapObservable(b.errorAlt),m=e.utils.unwrapObservable(b.onerror);var P=n.$masterViewModel,S=e.utils.unwrapObservable(b.disableLazyImageLoading);return S||!P||!P.storeConfiguration||P.storeConfiguration.lazilyLoadImages!==!0||"prerenderReady"in window||u===h||s.isImageVisible(t,u)||(y=!0),y&&(I=e.utils.unwrapObservable(b.initialSrc),I||(I=h?h:o.SITE_DEFAULT_NO_IMAGE_URL),P.storeConfiguration.delayBeforeLoadingOutOfFocusImages&&(v=P.storeConfiguration.delayBeforeLoadingOutOfFocusImages)),h?void(u?(c=new Image,c.onload=function(){t.alt=g?g:"",y?(m&&(t.dataset.onerror=m),f&&(t.dataset.errorAlt=f),h&&(t.dataset.errorSrc=h),t.dataset.src=u,s.setupLazyLoadStyling(t,b),s.observeLazyImage(t,v),t.src=I):t.src=u},c.onerror=function(){if(y){var e=new Image;e.onload=function(){t.dataset.errorSrc=h,m&&(t.dataset.onerror=m),f&&(t.dataset.errorAlt=f),t.dataset.src=u,s.setupLazyLoadStyling(t,b),s.observeLazyImage(t,v),t.src=h},e.onerror=function(){t.src=h,f&&(t.alt=f),m&&m(t)},e.src=h}else t.src=h,t.alt=f?f:"",m&&m(t)},c.src=y?I:u):(t.src=h,f?t.alt=f:g?t.alt=g:t.alt="",m&&m(t))):(y?(m&&(t.dataset.onerror=m),f&&(t.dataset.errorAlt=f),t.dataset.src=u,s.setupLazyLoadStyling(t,b),s.observeLazyImage(t,v),t.src=I):t.src=u,void(t.alt=g?g:""))}}};var c=0;e.bindingHandlers.makeAccess={init:function(r,i){var a,o,n,s=e.utils.unwrapObservable(i());a=$('<span class="cc-reader-text"></span>'),s.readerText?a.text(e.utils.unwrapObservable(s.readerText)):s.readerResource&&a.text(t.t(e.utils.unwrapObservable(s.readerResource))),s.cssContent&&"on"==s.cssContent&&(o=$(r).text(),n="cc-make-access-"+c++,$("<style>").text("."+n+':after {content: "'+o+'"}').appendTo("head"),$(r).empty().addClass(n)),$(r).prepend(a)},update:function(r,i){var a=e.utils.unwrapObservable(i());a.readerText?$(r).children(".cc-reader-text").text(e.utils.unwrapObservable(a.readerText)):a.readerResource&&$(r).children(".cc-reader-text").text(t.t(e.utils.unwrapObservable(a.readerResource)))}},e.bindingHandlers.hover={init:function(e,t){},update:function(t,r,i,a,o){var n,s,l,c,d,u=e.utils.unwrapObservable(r());if(n=t.ko_hoverClassValue)if(Array.isArray(n))for(s=0;s<n.length;s+=1)$(t).removeClass(n[s]);else if("object"==typeof n)for(l in n)n.hasOwnProperty(l)&&$(t).removeClass(n[l]);else $(t).removeClass(n);if("object"==typeof u){if("undefined"!=typeof u.if&&!e.utils.unwrapObservable(u.if))return void $(t).hover(function(){},function(){});c=e.utils.unwrapObservable(u.start),d=e.utils.unwrapObservable(u.stop),t.ko__hoverClassValue=e.utils.unwrapObservable(u.class),$(t).hover(function(e){var t,r;if(r=this.ko_hoverClassValue)if(Array.isArray(r))for(s=0;s<r.length;s+=1)$(this).addClass(r[s]);else if("Object"==typeof r)for(t in r)r.hasOwnProperty(t)&&$(this).addClass(r[l]);else $(this).addClass(r);c&&c(a,e)},function(e){var t,r,i;if(r=this.ko_hoverClassValue){if(Array.isArray(r))for(t=0;t<r.length;t+=1)$(this).removeClass(r[t]);else if("Object"==typeof r)for(i in r)r.hasOwnProperty(i)&&$(this).removeClass(r[i]);else $(this).removeClass(r);d&&d(a,e)}})}}},e.bindingHandlers.background={init:function(e,t){},update:function(t,r){var i,a,o,n=e.utils.unwrapObservable(r());if("object"==typeof n){if(i=e.utils.unwrapObservable(n.image),!i)return void $(t).css("background-image","");a="",o=".png",n.extension&&(o=e.utils.unwrapObservable(n.extension),"."!==a.charAt(0)&&(o="."+o)),n.path&&(a=e.utils.unwrapObservable(n.path)||"",a.length>0&&"/"!==a.charAt(a.length-1)&&(a+="/")),$(t).css("background-image","url("+a+i+o+")")}else n?$(t).css("background-image","url("+n+")"):$(t).css("background-image","")}},e.bindingHandlers.draggable={init:function(t,r,i,a,o){var n=e.utils.unwrapObservable(r());if("object"==typeof n){if("undefined"!=typeof n.destroy&&e.utils.unwrapObservable(n.destroy))return;$(t).draggable(n).data("viewModel",a),"undefined"==typeof n.enabled||e.utils.unwrapObservable(n.enabled)||$(t).draggable("disable"),"undefined"!=typeof n.selectable&&e.utils.unwrapObservable(n.selectable)?$(t).enableSelection():$(t).disableSelection()}else $(t).draggable().data("viewModel",a),n?$(t).draggable("enable"):$(t).draggable("disable")},update:function(t,r,i,a,o){var n=e.utils.unwrapObservable(r());if("object"==typeof n){if("undefined"!=typeof n.destroy&&e.utils.unwrapObservable(n.destroy))return void($(t).draggable&&$(t).draggable("destroy"));"undefined"!=typeof n.enabled&&(e.utils.unwrapObservable(n.enabled)?$(t).draggable("enable"):$(t).draggable("disable")),"undefined"!=typeof n.selectable&&e.utils.unwrapObservable(n.selectable)?$(t).enableSelection():$(t).disableSelection(),$(t).draggable("option",n)}else n?$(t).draggable("enable"):$(t).draggable("disable")}},e.bindingHandlers.droppable={init:function(t,r,i,a,o){var n=e.utils.unwrapObservable(r());if("object"==typeof n){if("undefined"!=typeof n.destroy&&e.utils.unwrapObservable(n.destroy))return;$(t).droppable(n).data("viewModel",a),"undefined"==typeof n.enabled||e.utils.unwrapObservable(n.enabled)||$(t).droppable("disable")}else"function"==typeof n&&$(t).droppable({drop:n}).data("viewModel",a)},update:function(t,r,i,a,o){var n=e.utils.unwrapObservable(r());if("object"==typeof n){if("undefined"!=typeof n.destroy&&e.utils.unwrapObservable(n.destroy))return void($(t).droppable&&$(t).droppable("destroy"));$(t).droppable?$(t).droppable("option",n):$(t).droppable(n).data("viewModel",a),"undefined"!=typeof n.enabled&&(e.utils.unwrapObservable(n.enabled)?$(t).droppable("enable"):$(t).droppable("disable"))}else"function"==typeof n&&$(t).droppable({drop:n}).data("viewModel",a)}},e.bindingHandlers.selectable={init:function(t,r,i,a,o){var n=e.utils.unwrapObservable(r());if("object"==typeof n){if("undefined"!=typeof n.destroy&&e.utils.unwrapObservable(n.destroy))return;$(t).selectable(n).data("viewModel",a),"undefined"==typeof n.enabled||e.utils.unwrapObservable(n.enabled)||$(t).selectable("disable"),"undefined"!=typeof n.selectable&&e.utils.unwrapObservable(n.selectable)?$(t).enableSelection():$(t).disableSelection()}else $(t).selectable().data("viewModel",a),n?$(t).selectable("enable"):$(t).selectable("disable")},update:function(t,r,i,a,o){var n=e.utils.unwrapObservable(r());if("object"==typeof n){if("undefined"!=typeof n.destroy&&e.utils.unwrapObservable(n.destroy))return void($(t).selectable&&$(t).selectable("destroy"));"undefined"!=typeof n.enabled&&(e.utils.unwrapObservable(n.enabled)?$(t).selectable("enable"):$(t).selectable("disable")),"undefined"!=typeof n.selectable&&e.utils.unwrapObservable(n.selectable)?$(t).enableSelection():$(t).disableSelection(),$(t).selectable("option",n)}else n?$(t).selectable("enable"):$(t).selectable("disable")}},e.bindingHandlers.slide={init:function(t,r){var i=e.utils.unwrapObservable(r());$(t).toggle(i)},update:function(t,r){var i=e.utils.unwrapObservable(r());i?$(t).slideDown():$(t).slideUp()}},e.bindingHandlers.fade={init:function(t,r){var i=e.utils.unwrapObservable(r());$(t).toggle(i)},update:function(t,r){var i=e.utils.unwrapObservable(r());i?$(t).fadeIn("slow"):$(t).fadeOut("slow")}},e.bindingHandlers.radio={init:function(t,r,i,a,o){var n,s,l,c;if(c=r(),!e.isWriteableObservable(c))throw"You must pass an observable or writeable computed";s=$(t),n=s.hasClass("btn")?s:$(".btn",s),l=i(),n.each(function(){var t,r,i;return r=this,t=$(r),i=l.radioValue||t.attr("data-value")||t.attr("value")||t.text(),t.on("click",function(){c(e.utils.unwrapObservable(i))}),e.computed({disposeWhenNodeIsRemoved:r,read:function(){t.toggleClass("active",c()===e.utils.unwrapObservable(i))}})})}},e.bindingHandlers.checkbox={init:function(t,r,i,a,o){var n,s;if(s=r(),!e.isWriteableObservable(s))throw"You must pass an observable or writeable computed";n=$(t),n.on("click",function(){s(!s())}),e.computed({disposeWhenNodeIsRemoved:t,read:function(){n.toggleClass("active",s())}})}},e.bindingHandlers.modalTabbingContraint={init:function(e,t,r,i,a){var o,n,s,l;o=function(t,r){return n=$(e).find(":tabbable"),r==$(n)[0]&&9===t.keyCode&&t.shiftKey?(t.preventDefault(),$(n[n.length-1]).focus(),!1):r!=$(n)[n.length-1]||9!==t.keyCode||t.shiftKey?void 0:(t.preventDefault(),$(n[0]).focus(),!1)},$(e).on("shown.bs.modal",function(){n=$(e).find(":tabbable"),s=$(e).find(":disabled"),l=$(e).find(":hidden"),$.each(n,function(e,t){$(t).on("keydown",function(e){o(e,t)})}),$.each(s,function(e,t){$(t).on("keydown",function(e){o(e,t)})}),$.each(l,function(e,t){$(t).on("keydown",function(e){o(e,t)})})})}},e.bindingHandlers.imageZoom={init:function(t,r){function a(t,r){if(t)for(var i=t.length-1;i>=0;i-=1){var a=e.utils.unwrapObservable(n[t[i]]);"undefined"!=typeof a&&null!==a&&(r[t[i]]=a)}}var o=new i;o.element=t;var n=e.utils.unwrapObservable(r());a(["smallImageUrl","fullImageUrl","imageMetadataDefault","fullImageClass","smallImageClass","magnifierClass","flyoutClass","magnifierPercent","flyoutEnabled","magnifierEnabled","spinnerDelay","replaceImageAtIndex","errorImageUrl"],o),o.index=n.index,o.smallImageUrls=n.smallImageUrls,o.fullImageUrls=n.fullImageUrls,o.imageMetadatas=n.imageMetadatas,o.start()},update:function(e,t,r,i,a){}};var d=function(e){var t="bust="+(new Date).getTime();return e+=e.indexOf("?")!==-1?e.indexOf("?")!==e.length-1?"&"+t:t:"?"+t};e.bindingHandlers.productImageSource={getNoImageSiteSetting:function(t){for(var r=null,i=0;i<t.$parents.length;i++)if(e.isObservable(t.$parents[i].site)){r=e.unwrap(t.$parents[i].site().noImageSrc);break}return r},init:function(t,r,i,a,o){var n,s,l,c,d,u=e.utils.unwrapObservable(r());"object"==typeof u&&"IMG"===t.nodeName&&(n=e.utils.unwrapObservable(u.src),s=e.utils.unwrapObservable(u.errorSrc),l=e.bindingHandlers.productImageSource.getNoImageSiteSetting(o),c=l&&l.length>0?l:s,n&&c&&(d=new Image,d.src=c))},update:function(t,r,i,a,n){var l,c,d,u,p,h,g,f,m,I,E,y,v,b,T="",P=!1,S=-1,C=e.utils.unwrapObservable(r());if("object"==typeof C&&"IMG"===t.nodeName){if(d=e.utils.unwrapObservable(C.src),l=e.utils.unwrapObservable(C.imageType),l||(l="medium"),d){switch(l){case"full":c=e.utils.unwrapObservable(d.primaryFullImageURL);break;case"large":c=e.utils.unwrapObservable(d.primaryLargeImageURL);break;case"medium":c=e.utils.unwrapObservable(d.primaryMediumImageURL);break;case"small":c=e.utils.unwrapObservable(d.primarySmallImageURL);break;case"thumb":c=e.utils.unwrapObservable(d.primaryThumbImageURL);break;default:c=e.utils.unwrapObservable(d.primaryMediumImageURL)}E=e.utils.unwrapObservable(C.outputFormat),y=e.utils.unwrapObservable(C.quality),v=e.utils.unwrapObservable(C.alphaChannelColor),E&&(T="&"+o.IMAGE_OUTPUT_FORMAT+"="+E),y&&(T=T+"&"+o.IMAGE_QUALITY+"="+y),v&&(T=T+"&"+o.IMAGE_ALPHA_CHANNEL_COLOR+"="+v),c&&T&&(c+=T)}else c=C.errorSrc;g=e.utils.unwrapObservable(d.primaryImageAltText),f=e.utils.unwrapObservable(d.primaryImageTitle),u=e.utils.unwrapObservable(C.errorSrc),p=e.bindingHandlers.productImageSource.getNoImageSiteSetting(n),h=p&&p.length>0?p:u;var _=n.$masterViewModel,A=e.utils.unwrapObservable(C.disableLazyImageLoading);return A||!_||!_.storeConfiguration||_.storeConfiguration.lazilyLoadImages!==!0||"prerenderReady"in window||c===h||s.isImageVisible(t,c)||(P=!0),P&&(b=e.utils.unwrapObservable(C.initialSrc),b=h?h:o.SITE_DEFAULT_NO_IMAGE_URL,_.storeConfiguration.delayBeforeLoadingOutOfFocusImages&&(S=_.storeConfiguration.delayBeforeLoadingOutOfFocusImages)),c!==u&&c!==o.SITE_DEFAULT_NO_IMAGE_URL||(c=h,P=!1),g||(g=e.utils.unwrapObservable(C.alt)),f||(f=e.utils.unwrapObservable(C.title)),m=e.utils.unwrapObservable(C.errorAlt),I=e.utils.unwrapObservable(C.onerror),h?void(c?(g&&(t.alt=g),f&&(t.title=f),t.onerror=function(){var e=new Image;e.onload=function(){t.src=h,I&&I(t),t.onerror=""},e.onerror=function(){var e=new Image;e.onload=function(){t.src=e.src,I&&I(t),t.onerror=""},e.onerror=function(){t.src="/img/no-image.jpg",I&&I(t),t.onerror=""},e.src=u},e.src=h,m&&(t.alt=m)},P?(t.dataset.errorSrc=h,t.dataset.defaultErrorSrc=u,I&&(t.dataset.onerror=I),m&&(t.dataset.errorAlt=m),t.dataset.src=c,s.setupLazyLoadStyling(t,C),s.observeLazyImage(t,S),t.src=b):t.src=c):(t.src=h,m?t.alt=m:g&&(t.alt=g),I&&I(t))):(P?(I&&(t.dataset.onerror=I),m&&(t.dataset.errorAlt=m),t.dataset.src=c,s.setupLazyLoadStyling(t,C),s.observeLazyImage(t,S),t.src=b):t.src=c,g&&(t.alt=g),void(f&&(t.title=f)))}}},e.bindingHandlers.carouselSwipe={init:function(e,t,r){var i=$(e);r().Options||{};i.unbind("swipeleft"),i.unbind("swiperight"),i.carousel.interval=!1,i.on("swipeleft",function(e){i.carousel("next"),i.carousel({interval:!1})}),i.on("swiperight",function(e){i.carousel("prev"),i.carousel({interval:!1})})}},e.bindingHandlers.tabTrap={constrain:function(e){var t,r=$(e).find(":tabbable");r.length;r.each(function(r){var i;$(this).hasClass("cc-tab-trapped")||($(this).addClass("cc-tab-trapped"),$(this).on("keydown",function(r){t=$(e).find(":tabbable"),9===r.keyCode&&(r.shiftKey?(i=parseInt(t.index($(this)),10)-1,i<0&&(r.preventDefault(),t[t.length-1].focus())):(i=parseInt(t.index($(this)),10)+1,i===t.length&&(r.preventDefault(),t[0].focus())))}))})}},e.bindingHandlers.ccForm={init:function(e,t){var r=$(e),i=t().action,a=["INPUT","SELECT"];r.on("keydown",function(e){if("13"==e.which&&a.indexOf(e.target.tagName)!==-1)return"function"==typeof i?i():"string"==typeof i&&$(i).trigger("click"),!1})}},e.bindingHandlers.ccValidation={init:function(e,t,r){},update:function(t,r,i){e.bindingHandlers.validationMessage.update(t,r,i),e.isObservable(r().error)?$("#cc-aria-announce").text(r().error()):$("#cc-aria-announce").text(r().error)}},e.bindingHandlers.image={init:function(t,r){var i,a,o,n=!1,s=e.utils.unwrapObservable(r());"object"==typeof s&&"IMG"===t.nodeName&&(s.cacheBust&&(n=e.utils.unwrapObservable(s.cacheBust)),i=e.utils.unwrapObservable(s.src),n&&(i=d(i)),a=e.utils.unwrapObservable(s.errorSrc),i&&a&&(o=new Image,o.src=a))},update:function(t,r,i,a,n){var l,c,u,p,h,g,f,m=!1,I=!1,E=-1,y=e.utils.unwrapObservable(r());if("object"==typeof y&&"IMG"===t.nodeName){c=e.utils.unwrapObservable(y.src),c||(c=y.errorSrc),y.cacheBust&&(m=e.utils.unwrapObservable(y.cacheBust)),m&&(c=d(c)),u=e.utils.unwrapObservable(y.errorSrc),p=e.utils.unwrapObservable(y.alt),h=e.utils.unwrapObservable(y.errorAlt),g=e.utils.unwrapObservable(y.onerror);var v=n.$masterViewModel,b=e.utils.unwrapObservable(y.disableLazyImageLoading);return b||!v||!v.storeConfiguration||v.storeConfiguration.lazilyLoadImages!==!0||"prerenderReady"in window||c===u||s.isImageVisible(t,c)||(I=!0),I&&(f=e.utils.unwrapObservable(y.initialSrc),f||(f=u?u:o.SITE_DEFAULT_NO_IMAGE_URL),v.storeConfiguration.delayBeforeLoadingOutOfFocusImages&&(E=v.storeConfiguration.delayBeforeLoadingOutOfFocusImages)),u?void(c?(l=new Image,l.onload=function(){t.alt=p?p:"",I?(g&&(t.dataset.onerror=g),h&&(t.dataset.errorAlt=h),u&&(t.dataset.errorSrc=u),t.dataset.src=c,s.setupLazyLoadStyling(t,y),s.observeLazyImage(t,E),t.src=f):t.src=c},l.onerror=function(){if(I){var e=new Image;e.onload=function(){t.dataset.errorSrc=u,g&&(t.dataset.onerror=g),h&&(t.dataset.errorAlt=h),t.dataset.src=c,s.setupLazyLoadStyling(t,y),s.observeLazyImage(t,E),t.src=u},e.onerror=function(){t.src=u,h&&(t.alt=h),g&&g(t)},e.src=u}else t.src=u,t.alt=h?h:"",g&&g(t)},l.src=I?f:c):(t.src=u,h?t.alt=h:p?t.alt=p:t.alt="",g&&g(t))):(I?(g&&(t.dataset.onerror=g),h&&(t.dataset.errorAlt=h),t.dataset.src=c,s.setupLazyLoadStyling(t,y),s.observeLazyImage(t,E),t.src=f):t.src=c,void(t.alt=p?p:""))}}},e.bindingHandlers.handleFocusin={init:function(t,r,i){var a=e.utils.unwrapObservable(r()),o=a.applyClass?a.applyClass:"cc-showhidden",n=a.applyTo;$(t).on("focusin mouseover",function(e){$(t).find(n).addClass(o)}).on("focusout mouseout",function(e){$.contains(t,document.activeElement)||$(t).find(n).removeClass(o)})}}}),!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define("promise",t):e.ES6Promise=t()}(this,function(){"use strict";function e(e){var t=typeof e;return null!==e&&("object"===t||"function"===t)}function t(e){return"function"==typeof e}function r(e){B=e}function i(e){q=e}function a(){return function(){return process.nextTick(c)}}function o(){return"undefined"!=typeof Y?function(){Y(c)}:l()}function n(){var e=0,t=new $(c),r=document.createTextNode("");return t.observe(r,{characterData:!0}),function(){r.data=e=++e%2}}function s(){var e=new MessageChannel;return e.port1.onmessage=c,function(){return e.port2.postMessage(0)}}function l(){var e=setTimeout;return function(){return e(c,1)}}function c(){for(var e=0;e<V;e+=2){var t=Q[e],r=Q[e+1];t(r),Q[e]=void 0,Q[e+1]=void 0}V=0}function d(){try{var e=Function("return this")().require("vertx");return Y=e.runOnLoop||e.runOnContext,o()}catch(e){return l()}}function u(e,t){var r=this,i=new this.constructor(h);void 0===i[J]&&D(i);var a=r._state;if(a){var o=arguments[a-1];q(function(){return O(a,i,o,r._result)})}else C(r,i,e,t);return i}function p(e){var t=this;if(e&&"object"==typeof e&&e.constructor===t)return e;var r=new t(h);return b(r,e),r}function h(){}function g(){return new TypeError("You cannot resolve a promise with itself")}function f(){return new TypeError("A promises callback cannot return that same promise.");
- }function m(e){try{return e.then}catch(e){return re.error=e,re}}function I(e,t,r,i){try{e.call(t,r,i)}catch(e){return e}}function E(e,t,r){q(function(e){var i=!1,a=I(r,t,function(r){i||(i=!0,t!==r?b(e,r):P(e,r))},function(t){i||(i=!0,S(e,t))},"Settle: "+(e._label||" unknown promise"));!i&&a&&(i=!0,S(e,a))},e)}function y(e,t){t._state===ee?P(e,t._result):t._state===te?S(e,t._result):C(t,void 0,function(t){return b(e,t)},function(t){return S(e,t)})}function v(e,r,i){r.constructor===e.constructor&&i===u&&r.constructor.resolve===p?y(e,r):i===re?(S(e,re.error),re.error=null):void 0===i?P(e,r):t(i)?E(e,r,i):P(e,r)}function b(t,r){t===r?S(t,g()):e(r)?v(t,r,m(r)):P(t,r)}function T(e){e._onerror&&e._onerror(e._result),_(e)}function P(e,t){e._state===Z&&(e._result=t,e._state=ee,0!==e._subscribers.length&&q(_,e))}function S(e,t){e._state===Z&&(e._state=te,e._result=t,q(T,e))}function C(e,t,r,i){var a=e._subscribers,o=a.length;e._onerror=null,a[o]=t,a[o+ee]=r,a[o+te]=i,0===o&&e._state&&q(_,e)}function _(e){var t=e._subscribers,r=e._state;if(0!==t.length){for(var i=void 0,a=void 0,o=e._result,n=0;n<t.length;n+=3)i=t[n],a=t[n+r],i?O(r,i,a,o):a(o);e._subscribers.length=0}}function A(e,t){try{return e(t)}catch(e){return re.error=e,re}}function O(e,r,i,a){var o=t(i),n=void 0,s=void 0,l=void 0,c=void 0;if(o){if(n=A(i,a),n===re?(c=!0,s=n.error,n.error=null):l=!0,r===n)return void S(r,f())}else n=a,l=!0;r._state!==Z||(o&&l?b(r,n):c?S(r,s):e===ee?P(r,n):e===te&&S(r,n))}function R(e,t){try{t(function(t){b(e,t)},function(t){S(e,t)})}catch(t){S(e,t)}}function N(){return ie++}function D(e){e[J]=ie++,e._state=void 0,e._result=void 0,e._subscribers=[]}function L(){return new Error("Array Methods must be provided an Array")}function w(e){return new ae(this,e).promise}function M(e){var t=this;return new t(H(e)?function(r,i){for(var a=e.length,o=0;o<a;o++)t.resolve(e[o]).then(r,i)}:function(e,t){return t(new TypeError("You must pass an array to race."))})}function U(e){var t=this,r=new t(h);return S(r,e),r}function k(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}function x(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}function G(){var e=void 0;if("undefined"!=typeof global)e=global;else if("undefined"!=typeof self)e=self;else try{e=Function("return this")()}catch(e){throw new Error("polyfill failed because global object is unavailable in this environment")}var t=e.Promise;if(t){var r=null;try{r=Object.prototype.toString.call(t.resolve())}catch(e){}if("[object Promise]"===r&&!t.cast)return}e.Promise=oe}var F=void 0;F=Array.isArray?Array.isArray:function(e){return"[object Array]"===Object.prototype.toString.call(e)};var H=F,V=0,Y=void 0,B=void 0,q=function(e,t){Q[V]=e,Q[V+1]=t,V+=2,2===V&&(B?B(c):X())},j="undefined"!=typeof window?window:void 0,W=j||{},$=W.MutationObserver||W.WebKitMutationObserver,K="undefined"==typeof self&&"undefined"!=typeof process&&"[object process]"==={}.toString.call(process),z="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel,Q=new Array(1e3),X=void 0;X=K?a():$?n():z?s():void 0===j&&"function"==typeof require?d():l();var J=Math.random().toString(36).substring(2),Z=void 0,ee=1,te=2,re={error:null},ie=0,ae=function(){function e(e,t){this._instanceConstructor=e,this.promise=new e(h),this.promise[J]||D(this.promise),H(t)?(this.length=t.length,this._remaining=t.length,this._result=new Array(this.length),0===this.length?P(this.promise,this._result):(this.length=this.length||0,this._enumerate(t),0===this._remaining&&P(this.promise,this._result))):S(this.promise,L())}return e.prototype._enumerate=function(e){for(var t=0;this._state===Z&&t<e.length;t++)this._eachEntry(e[t],t)},e.prototype._eachEntry=function(e,t){var r=this._instanceConstructor,i=r.resolve;if(i===p){var a=m(e);if(a===u&&e._state!==Z)this._settledAt(e._state,t,e._result);else if("function"!=typeof a)this._remaining--,this._result[t]=e;else if(r===oe){var o=new r(h);v(o,e,a),this._willSettleAt(o,t)}else this._willSettleAt(new r(function(t){return t(e)}),t)}else this._willSettleAt(i(e),t)},e.prototype._settledAt=function(e,t,r){var i=this.promise;i._state===Z&&(this._remaining--,e===te?S(i,r):this._result[t]=r),0===this._remaining&&P(i,this._result)},e.prototype._willSettleAt=function(e,t){var r=this;C(e,void 0,function(e){return r._settledAt(ee,t,e)},function(e){return r._settledAt(te,t,e)})},e}(),oe=function(){function e(t){this[J]=N(),this._result=this._state=void 0,this._subscribers=[],h!==t&&("function"!=typeof t&&k(),this instanceof e?R(this,t):x())}return e.prototype.catch=function(e){return this.then(null,e)},e.prototype.finally=function(e){var r=this,i=r.constructor;return t(e)?r.then(function(t){return i.resolve(e()).then(function(){return t})},function(t){return i.resolve(e()).then(function(){throw t})}):r.then(e,e)},e}();return oe.prototype.then=u,oe.all=w,oe.race=M,oe.resolve=p,oe.reject=U,oe._setScheduler=r,oe._setAsap=i,oe._asap=q,oe.polyfill=G,oe.Promise=oe,oe}),define("ojs/ojlogger",[],function(){"use strict";var e={LEVEL_NONE:0,LEVEL_ERROR:1,LEVEL_WARN:2,LEVEL_INFO:3,LEVEL_LOG:4,_METHOD_ERROR:"error",_METHOD_WARN:"warn",_METHOD_INFO:"info",_METHOD_LOG:"log"};return e._defaultOptions={level:e.LEVEL_ERROR,writer:null},e._options=e._defaultOptions,e.error=function(t,r){e._write(e.LEVEL_ERROR,e._METHOD_ERROR,arguments)},e.info=function(t,r){e._write(e.LEVEL_INFO,e._METHOD_INFO,arguments)},e.warn=function(t,r){e._write(e.LEVEL_WARN,e._METHOD_WARN,arguments)},e.log=function(t,r){e._write(e.LEVEL_LOG,e._METHOD_LOG,arguments)},e.option=function(t,r){var i,a,o={};if(0===arguments.length){for(a=Object.keys(e._options),i=0;i<a.length;i++)o[a[i]]=e._options[a[i]];return o}if("string"==typeof t&&void 0===r)return void 0===e._options[t]?null:e._options[t];if("string"==typeof t)e._options[t]=r;else{var n=t;for(a=Object.keys(n),i=0;i<a.length;i++)e.option(a[i],n[a[i]])}},e._write=function(t,r,i){if(!(e.option("level")<t)){var a=e._getWriter();null!=a&&(1===i.length&&i[0]instanceof Function&&(i=[i[0]()]),a[r]&&a[r].apply?a[r].apply(a,i):a[r]&&(a[r]=Function.prototype.bind.call(a[r],a),e._write(t,r,i)))}},e._getWriter=function(){var t=null;return e.option("writer")?t=e.option("writer"):"undefined"!=typeof window&&void 0!==window.console&&(t=window.console),t},e}),define("ojs/ojcore-base",["require","promise","ojs/ojlogger"],function(e,t,r){"use strict";t.polyfill();var i={};"undefined"!=typeof window?i=window:"undefined"!=typeof self&&(i=self);var a=i.oj,o={version:"7.3.0",revision:"2020-05-08_15-46-09",noConflict:function(){i.oj=a}};i.oj=o,o.Assert={},o.Assert.forceDebug=function(){o.Assert.DEBUG=!0},o.Assert.clearDebug=function(){o.Assert.DEBUG=!1},o.Assert.isDebug=function(){return!0===o.Assert.DEBUG},o.Assert.assert=function(e,t){if(o.Assert.DEBUG&&!e){var r=t||"";if(arguments.length>2){r+="(";for(var i=2;i<arguments.length;i+=1)r+=arguments[i];r+=")"}o.Assert.assertionFailed(r,1)}},o.Assert.failedInAbstractFunction=function(){o.Assert.DEBUG&&o.Assert.assertionFailed("Abstract function called",1)},o.Assert.assertPrototype=function(e,t,r){if(o.Assert.DEBUG){var i=t.prototype;null!=e?(o.Assert.assertType(t,"function",null,1,!1),Object.prototype.isPrototypeOf.call(i,e)||o.Assert.assertionFailed("object '"+e+"' doesn't match prototype "+i,1,r)):o.Assert.assertionFailed("null object doesn't match prototype "+i,1,r)}},o.Assert.assertPrototypeOrNull=function(e,t,r){if(o.Assert.DEBUG&&null!=e){o.Assert.assertType(t,"function",null,1,!1);var i=t.prototype;Object.prototype.isPrototypeOf.call(i,e)||o.Assert.assertionFailed("object '"+e+"' doesn't match prototype "+i,1,r)}},o.Assert.assertPrototypes=function(e,t,r,i){if(o.Assert.DEBUG){var a=t.prototype,n=r.prototype,s=Object.prototype.isPrototypeOf;s.call(a,e)||s.call(n,e)||o.Assert.assertionFailed("object '"+e+"' doesn't match prototype "+a+" or "+n,1,i)}},o.Assert.assertDomNodeOrNull=function(e,t){o.Assert.DEBUG&&e&&void 0===e.nodeType&&o.Assert.assertionFailed(e+" is not a DOM Node",t+1)},o.Assert.assertDomNode=function(e,t){o.Assert.DEBUG&&(e&&void 0!==e.nodeType||o.Assert.assertionFailed(e+" is not a DOM Node",t+1))},o.Assert.assertDomElement=function(e,t){o.Assert.DEBUG&&(o.Assert.assertDomNode(e,1),1!==e.nodeType?o.Assert.assertionFailed(e+" is not a DOM Element",1):t&&e.nodeName!==t&&o.Assert.assertionFailed(e+" is not a "+t+" Element",1))},o.Assert.assertDomElementOrNull=function(e,t){o.Assert.DEBUG&&null!=e&&(o.Assert.assertDomNode(e,1),1!==e.nodeType?o.Assert.assertionFailed(e+" is not a DOM Element",1):t&&e.nodeName!==t&&o.Assert.assertionFailed(e+" is not a "+t+" Element",1))},o.Assert.assertType=function(e,t,r,i,a){if(o.Assert.DEBUG&&!(null==e&&a||typeof e===t)){var n=e+" is not of type "+t;r&&(n=r+n),i||(i=0),o.Assert.assertionFailed(n,i+1)}},o.Assert.assertObject=function(e,t){o.Assert.DEBUG&&o.Assert.assertType(e,"object",t,1,!1)},o.Assert.assertObjectOrNull=function(e,t){o.Assert.DEBUG&&o.Assert.assertType(e,"object",t,1,!0)},o.Assert.assertNonEmptyString=function(e,t){o.Assert.DEBUG&&(o.Assert.assertType(e,"string",t,1,!1),o.Assert.assert(e.length>0,"empty string"))},o.Assert.assertString=function(e,t){o.Assert.DEBUG&&o.Assert.assertType(e,"string",t,1,!1)},o.Assert.assertStringOrNull=function(e,t){o.Assert.DEBUG&&o.Assert.assertType(e,"string",t,1,!0)},o.Assert.assertFunction=function(e,t){o.Assert.DEBUG&&o.Assert.assertType(e,"function",t,1,!1)},o.Assert.assertFunctionOrNull=function(e,t){o.Assert.DEBUG&&o.Assert.assertType(e,"function",t,1,!0)},o.Assert.assertBoolean=function(e,t){o.Assert.DEBUG&&o.Assert.assertType(e,"boolean",t,1,!1)},o.Assert.assertNumber=function(e,t){o.Assert.DEBUG&&o.Assert.assertType(e,"number",t,1,!1)},o.Assert.assertNumberOrNull=function(e,t){o.Assert.DEBUG&&o.Assert.assertType(e,"number",t,1,!0)},o.Assert.assertArray=function(e,t){o.Assert.DEBUG&&(Array.isArray(e)||(void 0===t&&(t=e+" is not an array"),o.Assert.assertionFailed(t,1)))},o.Assert.assertArrayOrNull=function(e,t){o.Assert.DEBUG&&null!=e&&(Array.isArray(e)||(void 0===t&&(t=e+" is not an array"),o.Assert.assertionFailed(t,1)))},o.Assert.assertNonNumeric=function(e,t){o.Assert.DEBUG&&(isNaN(e)||(void 0===t&&(t=e+" is convertible to a number"),o.Assert.assertionFailed(t,1)))},o.Assert.assertNumeric=function(e,t){o.Assert.DEBUG&&isNaN(e)&&(void 0===t&&(t=e+" is not convertible to a number"),o.Assert.assertionFailed(t,1))},o.Assert.assertInSet=function(e,t,r){if(null==e||void 0===t[e.toString()]){if(void 0===r){for(var i=" is not in set: {",a=Object.keys(t),n=0;n<a.length;n++)i+=a[n],i+=",";r=e+(i+="}")}o.Assert.assertionFailed(r,1)}},o.Assert.assertionFailed=function(e,t,r){t||(t=0);var i="Assertion";throw r&&(i+=" ("+r+")"),i+=" failed: ",void 0!==e&&(i+=e),new Error(i)};var n,s,l,c,d,u,p=i.__oj_Assert_DEBUG;void 0!==p&&(o.Assert.DEBUG=p),o.CollectionUtils={},o.CollectionUtils.copyInto=function(e,t,r,i,a){return o.CollectionUtils._copyIntoImpl(e,t,r,i,a,0)},o.CollectionUtils.isPlainObject=function(e){if(null!==e&&"object"==typeof e)try{var t=Object.prototype.hasOwnProperty;if(e.constructor&&t.call(e.constructor.prototype,"isPrototypeOf"))return!0}catch(e){}return!1},o.CollectionUtils._copyIntoImpl=function(e,t,r,i,a,n){var s;if(null==a&&(a=Number.MAX_VALUE),e&&t&&e!==t)for(var l=Object.keys(t),c=0;c<l.length;c++){var d=l[c];s=r?r(d):d;var u=t[d],p=!1;if(i&&n<a){var h=e[s];o.CollectionUtils.isPlainObject(u)&&(null==h||o.CollectionUtils.isPlainObject(h))&&(p=!0,e[s]=h||{},o.CollectionUtils._copyIntoImpl(e[s],u,r,!0,a,n+1))}p||(e[s]=u)}return e},o.Object=function(){this.Init()},o.Object.superclass=null,o.Object._typeName="oj.Object",o.Object._GET_FUNCTION_NAME_REGEXP=/function\s+([\w$][\w$\d]*)\s*\(/,o.Object.prototype={},o.Object.prototype.constructor=o.Object,o.Object.createSubclass=function(e,t,r){o.Assert.assertFunction(e),o.Assert.assertFunctionOrNull(t),o.Assert.assertStringOrNull(r),void 0===t&&(t=o.Object),o.Assert.assert(e!==t,"Class can't extend itself");var i=o.Object._tempSubclassConstructor;i.prototype=t.prototype,e.prototype=new i,e.prototype.constructor=e,e.superclass=t.prototype,r&&(e._typeName=r)},o.Object.copyPropertiesForClass=function(e,t){o.Assert.assertFunction(e),o.Assert.assert(null!=t,"source object cannot be null");for(var r=Object.keys(t),i=0;i<r.length;i++){var a=r[i];e.prototype[a]=t[a]}},o.Object._tempSubclassConstructor=function(){},o.Object.prototype.getClass=function(e){if(void 0===e)e=this;else if(null===e)return null;return e.constructor},o.Object.prototype.clone=function(){var e=new this.constructor;return o.CollectionUtils.copyInto(e,this),e},o.Object.prototype.toString=function(){return this.toDebugString()},o.Object.prototype.toDebugString=function(){return this.getTypeName()+" Object"},o.Object.getTypeName=function(e){o.Assert.assertFunction(e);var t=e._typeName;if(null==t){var r=e.toString(),i=o.Object._GET_FUNCTION_NAME_REGEXP.exec(r);t=i?i[1]:"anonymous",e._typeName=t}return t},o.Object.prototype.getTypeName=function(){return o.Object.getTypeName(this.constructor)},o.Object.prototype.Init=function(){o.Assert.isDebug()&&o.Assert.assert(this.getTypeName,"Not an oj.Object");var e=this.constructor;e._initialized||o.Object._initClasses(e)},o.Object.ensureClassInitialization=function(e){o.Assert.assertFunction(e),e._initialized||o.Object._initClasses(e)},o.Object.prototype.equals=function(e){return this===e},o.Object.createCallback=function(e,t){return o.Assert.assertFunction(t),t.bind(e)},o.Object._initClasses=function(e){o.Assert.isDebug()&&(o.Assert.assertFunction(e),o.Assert.assert(!e._initialized)),e._initialized=!0;var t=e.superclass;if(t){var r=t.constructor;r&&!r._initialized&&o.Object._initClasses(r)}var i=e.InitClass;i&&i.call(e)},o.Object.compareValues=function(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(null===e||null===t)return!1;if(e.constructor===t.constructor){if(Array.isArray(e))return o.Object._compareArrayValues(e,t);if(e.constructor===Object)return o.Object.__innerEquals(e,t);if(e.valueOf&&"function"==typeof e.valueOf)return e.valueOf()===t.valueOf()}return!1},o.Object._compareArrayValues=function(e,t){if(e.length!==t.length)return!1;for(var r=0,i=e.length;r<i;r++)if(!o.Object.compareValues(e[r],t[r]))return!1;return!0},o.Object._compareIdIndexObject=function(e,t){if("number"==typeof e&&"number"==typeof t||"string"==typeof e&&"string"==typeof t)return e===t;if("object"==typeof e&&"object"==typeof t){if(e.id&&t.id)return!(e.id!==t.id||e.index&&t.index&&e.index!==t.index);if(e.index&&t.index)return e.index===t.index}return!1},o.Object._compareArrayIdIndexObject=function(e,t){if(!e)return!t||0===t.length;if(!t)return!e||0===e.length;if(e.length!==t.length)return!1;for(var r=0;r<e.length;r++){for(var i=!1,a=0;a<t.length;a++)if(o.Object._compareIdIndexObject(e[r],t[a])){i=!0;break}if(!i)return!1}return!0},o.Object.__innerEquals=function(e,t){if(e===t)return!0;if(!(e instanceof Object&&t instanceof Object))return!1;if(e.constructor!==t.constructor)return!1;var r,i,a=Object.prototype.hasOwnProperty,n=Object.keys(e);for(i=0;i<n.length;i++)if(r=n[i],a.call(e,r)){if(!a.call(t,r))return!1;if(e[r]!==t[r]){if("object"!=typeof e[r])return!1;if(!o.Object.__innerEquals(e[r],t[r]))return!1}}var s=Object.keys(t);for(i=0;i<s.length;i++)if(r=s[i],a.call(t,r)&&!a.call(e,r))return!1;return 0!==n.length||0!==s.length||JSON.stringify(e)===JSON.stringify(t)},o.Object.isEmpty=function(e){var t;if(null==e)return!0;for(t in e)if(e.hasOwnProperty(t))return!1;return!0},o.__isAmdLoaderPresent=function(){return"function"==typeof define&&define.amd},o.__getRequirePromise=function(e,t){return o.__isAmdLoaderPresent()?new Promise(function(r,i){t([e],r,i)}):null},o.StringUtils={},o.StringUtils._TRIM_ALL_RE=/^\s*|\s*$/g,o.StringUtils.isEmpty=function(e){return null===e||0===o.StringUtils.trim(e).length},o.StringUtils.isEmptyOrUndefined=function(e){return!(void 0!==e&&!o.StringUtils.isEmpty(e))},o.StringUtils.isString=function(e){return null!==e&&("string"==typeof e||e instanceof String)},o.StringUtils.trim=function(e){return o.StringUtils.isString(e)?e.replace(o.StringUtils._TRIM_ALL_RE,""):e},o.StringUtils.hashCode=function(e){var t=0;if(0===e.length)return t;for(var r=0;r<e.length;r++)t=(t<<5)-t+e.charCodeAt(r),t&=t;return t},String.prototype.startsWith||(String.prototype.startsWith=function(e,t){return t=t||0,this.substr(t,e.length)===e}),String.prototype.endsWith||(String.prototype.endsWith=function(e,t){var r=this.toString();("number"!=typeof t||!isFinite(t)||Math.floor(t)!==t||t>r.length)&&(t=r.length),t-=e.length;var i=r.lastIndexOf(e,t);return-1!==i&&i===t}),o.AgentUtils=function(){},o.AgentUtils.BROWSER={IE:"ie",FIREFOX:"firefox",SAFARI:"safari",CHROME:"chrome",EDGE:"edge",UNKNOWN:"unknown"},o.AgentUtils.ENGINE={TRIDENT:"trident",WEBKIT:"webkit",GECKO:"gecko",BLINK:"blink",EDGE_HTML:"edgehtml",UNKNOWN:"unknown"},o.AgentUtils.OS={WINDOWS:"Windows",SOLARIS:"Solaris",MAC:"Mac",UNKNOWN:"Unknown",ANDROID:"Android",IOS:"IOS",WINDOWSPHONE:"WindowsPhone",LINUX:"Linux"},o.AgentUtils.DEVICETYPE={PHONE:"phone",TABLET:"tablet",OTHERS:"others"},o.AgentUtils.getAgentInfo=function(e){o.StringUtils.isEmptyOrUndefined(e)&&(e=navigator.userAgent),e=e.toLowerCase();var t=o.StringUtils.hashCode(e),r=o.AgentUtils._currAgentInfo;if(r&&r.hashCode===t)return{os:r.os,browser:r.browser,browserVersion:r.browserVersion,deviceType:r.deviceType,engine:r.engine,engineVersion:r.engineVersion,hashCode:r.hashCode};var i=o.AgentUtils.OS.UNKNOWN,a=o.AgentUtils.BROWSER.UNKNOWN,n=0,s=o.AgentUtils.DEVICETYPE.OTHERS,l=o.AgentUtils.ENGINE.UNKNOWN,c=0;return e.indexOf("iphone")>-1||e.indexOf("ipad")>-1?i=o.AgentUtils.OS.IOS:e.indexOf("mac")>-1?i=o.AgentUtils.OS.MAC:e.indexOf("sunos")>-1?i=o.AgentUtils.OS.SOLARIS:e.indexOf("android")>-1?i=o.AgentUtils.OS.ANDROID:e.indexOf("linux")>-1?i=o.AgentUtils.OS.LINUX:e.indexOf("windows phone")>-1?i=o.AgentUtils.OS.WINDOWSPHONE:e.indexOf("win")>-1&&(i=o.AgentUtils.OS.WINDOWS),i===o.AgentUtils.OS.ANDROID?s=e.indexOf("mobile")>-1?o.AgentUtils.DEVICETYPE.PHONE:o.AgentUtils.DEVICETYPE.TABLET:i===o.AgentUtils.OS.IOS&&(s=e.indexOf("iphone")>-1?o.AgentUtils.DEVICETYPE.PHONE:o.AgentUtils.DEVICETYPE.TABLET),e.indexOf("msie")>-1?(a=o.AgentUtils.BROWSER.IE,n=o.AgentUtils._parseFloatVersion(e,/msie (\d+[.]\d+)/),e.indexOf("trident")&&(l=o.AgentUtils.ENGINE.TRIDENT,c=o.AgentUtils._parseFloatVersion(e,/trident\/(\d+[.]\d+)/))):e.indexOf("trident")>-1?(a=o.AgentUtils.BROWSER.IE,n=o.AgentUtils._parseFloatVersion(e,/rv:(\d+[.]\d+)/),e.indexOf("trident")&&(l=o.AgentUtils.ENGINE.TRIDENT,c=o.AgentUtils._parseFloatVersion(e,/trident\/(\d+[.]\d+)/))):e.indexOf("edge")>-1?(a=o.AgentUtils.BROWSER.EDGE,n=c=o.AgentUtils._parseFloatVersion(e,/edge\/(\d+[.]\d+)/),l=o.AgentUtils.ENGINE.EDGE_HTML):e.indexOf("chrome")>-1?(a=o.AgentUtils.BROWSER.CHROME,(n=o.AgentUtils._parseFloatVersion(e,/chrome\/(\d+[.]\d+)/))>=28?(l=o.AgentUtils.ENGINE.BLINK,c=n):(l=o.AgentUtils.ENGINE.WEBKIT,c=o.AgentUtils._parseFloatVersion(e,/applewebkit\/(\d+[.]\d+)/))):e.indexOf("safari")>-1?(a=o.AgentUtils.BROWSER.SAFARI,n=o.AgentUtils._parseFloatVersion(e,/version\/(\d+[.]\d+)/),l=o.AgentUtils.ENGINE.WEBKIT,c=o.AgentUtils._parseFloatVersion(e,/applewebkit\/(\d+[.]\d+)/)):e.indexOf("firefox")>-1&&(a=o.AgentUtils.BROWSER.FIREFOX,n=o.AgentUtils._parseFloatVersion(e,/rv:(\d+[.]\d+)/),l=o.AgentUtils.ENGINE.GECKO,c=o.AgentUtils._parseFloatVersion(e,/gecko\/(\d+)/)),r={hashCode:t,os:i,browser:a,browserVersion:n,deviceType:s,engine:l,engineVersion:c},o.AgentUtils._currAgentInfo=r,{os:r.os,browser:r.browser,browserVersion:r.browserVersion,deviceType:r.deviceType,engine:r.engine,engineVersion:r.engineVersion,hashCode:r.hashCode}},o.AgentUtils._parseFloatVersion=function(e,t){var r=e.match(t);if(r){var i=r[1];if(i)return parseFloat(i)}return 0},n=/(^array)|(\|array)/,s=/(^object)|(\|object)/,l=/\s*\[[^]*\]\s*/,c=/\s*\{[^]*\}\s*/,d=/^(?:\{\{)([^]+)(?:\}\})$/,u=/^(?:\[\[)([^]+)(?:\]\])$/,o.__AttributeUtils={},o.__AttributeUtils.getExpressionInfo=function(e){var t={};if(e){var r=e.trim(),i=d.exec(r);(i=i?i[1]:null)||(t.downstreamOnly=!0,i=(i=u.exec(r))?i[1]:null),t.expr=i}return t},o.__AttributeUtils.attributeToPropertyName=function(e){return e.toLowerCase().replace(/-(.)/g,function(e,t){return t.toUpperCase()})},o.__AttributeUtils.propertyNameToAttribute=function(e){return e.replace(/([A-Z])/g,function(e){return"-"+e.toLowerCase()})},o.__AttributeUtils.eventTypeToEventListenerProperty=function(e){return"on"+e.substr(0,1).toUpperCase()+e.substr(1)},o.__AttributeUtils.eventListenerPropertyToEventType=function(e){return/^on[A-Z]/.test(e)?e.substr(2,1).toLowerCase()+e.substr(3):null},o.__AttributeUtils.propertyNameToChangeEventType=function(e){return e+"Changed"},o.__AttributeUtils.eventTriggerToEventType=function(e){return"oj"+e.substr(0,1).toUpperCase()+e.substr(1)},o.__AttributeUtils.coerceValue=function(e,t,r,i){if(!i)throw new Error("Unable to parse "+t+"='"+r+"' for "+e+" with id "+e.id+" . This attribute only supports data bound values. Check the API doc for supported types");var a=i.toLowerCase(),d=l.test(r),u=c.test(r);if(n.test(a)&&d||s.test(a)&&u||"any"===a&&(d||u))try{return JSON.parse(r)}catch(i){throw new Error("Unable to parse "+t+"='"+r+"' for "+e.tagName+" with id "+e.id+" to a JSON Object. Check the value for correct JSON syntax, e.g. double quoted strings. "+i)}else{if("boolean"===a)return o.__AttributeUtils.coerceBooleanValue(e,t,r,i);if("number"===a){if(!isNaN(r))return Number(r)}else if(-1!==i.split("|").indexOf("string")||"any"===a)return r}throw new Error("Unable to parse "+t+"='"+r+"' for "+e+" with id "+e.id+" to a "+i+".")},o.__AttributeUtils.coerceBooleanValue=function(e,t,r,i){if(null==r||"true"===r||""===r||r.toLowerCase()===t)return!0;if("false"===r)return!1;throw new Error("Unable to parse "+t+"='"+r+"' for "+e+" with id "+e.id+" to a "+i+".")},"undefined"!=typeof window&&window.Element&&!Element.prototype.closest&&(Element.prototype.closest=function(e){var t,r=(this.document||this.ownerDocument).querySelectorAll(e),i=this;do for(t=r.length;--t>=0&&r.item(t)!==i;);while(t<0&&(i=i.parentElement));return i}),o.ElementUtils={isValidCustomElementName:function(e){var t=new Set(["annotation-xml","color-profile","font-face","font-face-src","font-face-uri","font-face-format","font-face-name","missing-glyph"]).has(e),r=/^[a-z][.0-9_a-z]*-[-.0-9_a-z]*$/.test(e);return!t&&r&&!e.startsWith("oj-bind-",0)}},o.EventSource=function(){this.Init()},o.Object.createSubclass(o.EventSource,o.Object,"oj.EventSource"),o.EventSource.prototype.Init=function(){this._eventHandlers=[],o.EventSource.superclass.Init.call(this)},o.EventSource.prototype.on=function(e,t){for(var r=!1,i=0;i<this._eventHandlers.length;i++)if(this._eventHandlers[i].eventType===e&&this._eventHandlers[i].eventHandlerFunc===t){r=!0;break}r||this._eventHandlers.push({eventType:e,eventHandlerFunc:t})},o.EventSource.prototype.off=function(e,t){for(var r=this._eventHandlers.length-1;r>=0;r--)if(this._eventHandlers[r].eventType===e&&this._eventHandlers[r].eventHandlerFunc===t){this._eventHandlers.splice(r,1);break}},o.EventSource.prototype.handleEvent=function(e,t){for(var r=0;r<this._eventHandlers.length;r++){var i=this._eventHandlers[r];if(i.eventType===e&&!1===i.eventHandlerFunc.apply(this,Array.prototype.slice.call(arguments).slice(1)))return!1}return!0},o.KeyUtils={},o.KeyUtils.equals=function(e,t){return o.Object.compareValues(e,t)},function(){function e(e,t){t=t||{bubbles:!1,cancelable:!1,detail:void 0};var r=document.createEvent("CustomEvent");return r.initCustomEvent(e,t.bubbles,t.cancelable,t.detail),r}if("undefined"!=typeof window){var t;if((t=document.createEvent("Event")).initEvent("foo",!0,!0),t.preventDefault(),!t.defaultPrevented){var r=Event.prototype.preventDefault;Event.prototype.preventDefault=function(){this.cancelable&&(r.call(this),Object.defineProperty(this,"defaultPrevented",{get:function(){return!0},configurable:!0}))}}"function"!=typeof window.CustomEvent&&(e.prototype=Object.getPrototypeOf(new e("bogusEvent")),window.CustomEvent=e)}}(),function(){function e(e){var i=e.data;if(i&&"oj-setImmediate"===i.message){var a=i.id,o=r.get(a);if(t(a),o){var n=o.callback,s=o.args;n.apply(window,s)}}}function t(t){r&&(r.delete(t),r.size<1&&(window.removeEventListener("message",e),r=null))}var r,i;"undefined"!=typeof window&&!window.setImmediate&&window.postMessage&&(window.setImmediate=function(){var t=arguments[0],a=Array.prototype.slice.call(arguments,1);"function"!=typeof t&&(t=new Function(t.toString()));var o=(isNaN(i)&&(i=0),i+=1);return r||(r=new Map),r.set(o,{callback:t,args:a}),1===r.size&&window.addEventListener("message",e),window.postMessage({id:o,message:"oj-setImmediate"},"*"),o},window.clearImmediate=t)}(),function(){if("undefined"!=typeof window&&!window.__extends){var e,t=this&&this.__extends||(e=Object.setPrototypeOf,function(t,r){function i(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(i.prototype=r.prototype,new i)});window.__extends=t}}(),"undefined"!=typeof window&&(window.Symbol?(window.Symbol.asyncIterator||(window.Symbol.asyncIterator="asyncIterator"),window.Symbol.iterator||(window.Symbol.iterator="iterator")):(window.Symbol={},window.Symbol.asyncIterator="asyncIterator",window.Symbol.iterator="iterator")),function(){function e(e){var r=new t;return e&&e.forEach(r.add,r),r}if("undefined"!=typeof window&&0===new window.Set([0]).size){var t=window.Set;e.prototype=t.prototype,e.prototype.constructor=e,window.Set=e}}();var h=i.__ojCheckpointManager;return o.CHECKPOINT_MANAGER={},o.CHECKPOINT_MANAGER.startCheckpoint=function(e,t){h&&h.startCheckpoint(e,t)},o.CHECKPOINT_MANAGER.endCheckpoint=function(e){h&&h.endCheckpoint(e)},o.CHECKPOINT_MANAGER.getRecord=function(e){return h?h.getRecord(e):void 0},o.CHECKPOINT_MANAGER.matchRecords=function(e){return h?h.matchRecords(e):[]},o.CHECKPOINT_MANAGER.dump=function(e){r.info(function(){for(var t="Checkpoint Records:",r=o.CHECKPOINT_MANAGER.matchRecords(e),i=0;i<r.length;i++){var a=r[i];t=t+"\n"+a.name;var n=a.description;null!=n&&(t=t+" ("+n+")"),t=(t+=":\n")+"start: "+a.start+"\tduration: "+a.duration}return t})},o}),define("ojs/ojcontext",["ojs/ojcore-base","ojs/ojlogger"],function(e,t){"use strict";e.BusyContext=function(e){this.Init(e)},e.Object.createSubclass(e.BusyContext,e.Object,"oj.BusyContext"),e.BusyContext._defaultTimeout=Number.NaN,e.BusyContext.setDefaultTimeout=function(t){isNaN(t)||(e.BusyContext._defaultTimeout=t)},e.BusyContext.prototype.Init=function(t){e.BusyContext.superclass.Init.call(this),this._hostNode=t,this._statesMap=new Map,this._mediator={getMasterWhenReadyPromise:function(){return this._masterWhenReadyPromise||(this._masterWhenReadyPromise=new Promise(this._captureWhenReadyPromiseResolver.bind(this))),this._masterWhenReadyPromise},resolveMasterWhenReadyPromise:function(){this._masterWhenReadyPromiseResolver&&this._masterWhenReadyPromiseResolver(!0),this._masterWhenReadyPromise=null,this._masterWhenReadyPromiseResolver=null,this._masterWhenReadyPromiseRejecter=null},rejectMasterWhenReadyPromise:function(e){this._masterWhenReadyPromiseRejecter&&this._masterWhenReadyPromiseRejecter(e),this._masterWhenReadyPromise=null,this._masterWhenReadyPromiseRejecter=null,this._masterWhenReadyPromiseResolver=null},getSlaveTimeoutPromise:function(e,t,r){var i,a=new Promise(function(e,a){i=window.setTimeout(function(){a(t())},r)});return this._slaveTimeoutPromiseTimers.push(i),Promise.race([e,a]).then(this._clearAllSlaveTimeouts.bind(this))},getNextTickPromise:function(){return this._nextTickPromise||(this._nextTickPromise=new Promise(function(e){window.setImmediate(function(){this._nextTickPromise=null,e(!0)}.bind(this))}.bind(this))),this._nextTickPromise},_clearAllSlaveTimeouts:function(){var e=this._slaveTimeoutPromiseTimers;this._slaveTimeoutPromiseTimers=[];for(var t=0;t<e.length;t++)window.clearTimeout(e[t]);return!0},_captureWhenReadyPromiseResolver:function(e,t){this._masterWhenReadyPromiseResolver=e,this._masterWhenReadyPromiseRejecter=t},_slaveTimeoutPromiseTimers:[]}},e.BusyContext._log=function(r){if(t.option("level")===t.LEVEL_LOG){t.log(">> Busy states: %d",r.size);var i=e.BusyContext._values(r);i.length>0&&t.log(i.join("\n"))}},e.BusyContext._values=function(e){var t=[];return e.forEach(function(e){t.push(e)}),t},e.BusyContext.prototype.addBusyState=function(r){t.log("BusyContext.addBusyState: start scope='%s'",this._getDebugScope());var i=this._statesMap,a=new e.BusyState(r[e.BusyContext._DESCRIPTION]);return t.log(">> "+a),i.set(a.id,a),this._addBusyStateToParent(),t.log("BusyContext.addBusyState: end scope='%s'",this._getDebugScope()),this._removeBusyState.bind(this,a)},e.BusyContext.prototype.dump=function(r){t.info("BusyContext.dump: start scope='%s' %s",this._getDebugScope(),r||"");var i=this._statesMap;t.info(">> Busy states: %d",i.size);var a=e.BusyContext._values(i);a.length>0&&t.info(a.join("\n")),t.info("BusyContext.dump: start scope='%s' %s",this._getDebugScope(),r||"")},e.BusyContext.prototype.getBusyStates=function(){var t=this._statesMap;return e.BusyContext._values(t)},e.BusyContext.prototype.clear=function(){t.log("BusyContext.clear: start scope='%s'",this._getDebugScope());for(var r=this._statesMap,i=e.BusyContext._values(r),a=0;a<i.length;a++){var o=i[a];try{this._removeBusyState(o)}catch(e){t.log("BusyContext.clear: %o",e)}Object.defineProperty(o,e.BusyContext._OJ_RIP,{value:!0,enumerable:!1})}t.log("BusyContext.clear: end scope='%s'",this._getDebugScope())},e.BusyContext.prototype.whenReady=function(r){var i=this._getDebugScope();t.log("BusyContext.whenReady: start, scope='%s', timeout=%d",i,r);var a=this._statesMap,o=this._mediator,n=o.getNextTickPromise(),s=e.BusyContext._BOOTSTRAP_MEDIATOR.whenReady(),l=Promise.all([n,s]).then(function(){t.log("BusyContext.whenReady: bootstrap mediator ready scope=%s",i);try{e.BusyContext._deliverThrottledUpdates()}catch(e){throw t.error("Fatal exception delivering binding updates: %o",e),e}return 0!==a.size||this._waitingOnNextTickBusynessEval?(t.log("BusyContext.whenReady: busy states returning master scope=%s",i),o.getMasterWhenReadyPromise()):(t.log("BusyContext.whenReady: resolved no busy states scope=%s",i),!0)}.bind(this));return isNaN(r)&&!isNaN(e.BusyContext._defaultTimeout)&&(r=e.BusyContext._defaultTimeout),isNaN(r)||(l=o.getSlaveTimeoutPromise(l,function(){var o,n="whenReady timeout of "+r+"ms expired ";e.BusyContext._log(a);var s=e.BusyContext._values(a);return(o=e.BusyContext._BOOTSTRAP_MEDIATOR.isReady()?new Error(n+"with the following busy states: "+s.join(", ")):new Error(n+'while the application is loading. Busy state enabled by setting the "window.oj_whenReady = true;" global variable. Application bootstrap busy state is released by calling "oj.Context.getPageContext().getBusyContext().applicationBootstrapComplete();".')).busyStates=s,t.log("BusyContext.whenReady: rejected scope='%s'\n%s",i,o.message),o},r)),t.log("BusyContext.whenReady: end scope='%s'",this._getDebugScope()),l},e.BusyContext.prototype.isReady=function(){t.log("BusyContext.isReady: start scope='%s'",this._getDebugScope());var r=!1;if(e.BusyContext._BOOTSTRAP_MEDIATOR.isReady()&&!this._waitingOnNextTickBusynessEval){var i=this._statesMap;r=0===i.size,e.BusyContext._log(i)}return t.log("BusyContext.isReady: end scope='%s'",this._getDebugScope()),r},e.BusyContext.prototype._removeBusyState=function(r){var i=this._getDebugScope();t.log("BusyContext._removeBusyState: start scope='%s'",i);var a=this._statesMap;if(r[e.BusyContext._OJ_RIP])t.log("Busy state has been forcefully resolved via clear:\n"+r);else{if(!a.delete(r.id))throw new Error("Busy state has already been resolved:\n"+r);t.log("BusyContext._removeBusyState: resolving busy state:\n"+r),0!==a.size||this._waitingOnNextTickBusynessEval||(this._waitingOnNextTickBusynessEval=!0,window.setImmediate(this._evalBusyness.bind(this))),
- t.log("BusyContext._removeBusyState: end scope='%s'",i)}},e.BusyContext.prototype._evalBusyness=function(){var r=this._getDebugScope();t.log("BusyContext._evalBusyness: begin scope='%s'",r);try{e.BusyContext._deliverThrottledUpdates()}catch(e){return t.error("Fatal exception delivering binding updates: %o",e),this._mediator.rejectMasterWhenReadyPromise(e),void(this._waitingOnNextTickBusynessEval=!1)}var i=this._statesMap,a=this._mediator;this._waitingOnNextTickBusynessEval=!1,0===i.size?(t.log("BusyContext._evalBusyness: resolving whenReady promises"),a.resolveMasterWhenReadyPromise(),this._resolveBusyStateForParent()):e.BusyContext._log(i),t.log("BusyContext._evalBusyness: end scope='%s'",r)},e.BusyContext.prototype.applicationBootstrapComplete=function(){var r=this._getDebugScope();t.log("BusyContext.applicationBootstrapComplete: begin scope='%s'",r),e.BusyContext._BOOTSTRAP_MEDIATOR.notifyComplete(),t.log("BusyContext.applicationBootstrapComplete: end scope='%s'",r)},e.BusyContext.prototype._getParentBusyContext=function(){if(this._hostNode){var t=e.Context.getContext(e.Context.getParentElement(this._hostNode));if(t)return t.getBusyContext()}return null},e.BusyContext.prototype._addBusyStateToParent=function(){if(!this._parentNotified){this._parentNotified=!0;var t=this._getParentBusyContext();if(t){var r={};r[e.BusyContext._DESCRIPTION]=this._getCompoundDescription.bind(this),this._parentResolveCallback=t.addBusyState(r)}}},e.BusyContext.prototype._resolveBusyStateForParent=function(){this._parentNotified=!1,this._parentResolveCallback&&(this._parentResolveCallback(),this._parentResolveCallback=null)},e.BusyContext.prototype._getCompoundDescription=function(){return"["+e.BusyContext._values(this._statesMap).join(", ")+"]"},e.BusyContext.prototype._getDebugScope=function(){function e(e){var t="undefined";if(e)if(e.id&&e.id.length>0)t="#"+e.id;else{t=e.nodeName,e.hasAttribute("data-oj-context")&&(t+="[data-oj-context]");var r=e.getAttribute("class");r&&(t+="."+r.split(" ").join("."))}return t}return this._debugScope||(this._hostNode?this._debugScope=e(this._hostNode.parentElement)+" > "+e(this._hostNode):this._debugScope="page"),this._debugScope},e.BusyContext.prototype.toString=function(){var e="Busy Context: [scope=";return e+=this._getDebugScope(),e+=" states="+this._getCompoundDescription()+"]"},e.BusyContext._deliverThrottledUpdates=function(){e.ComponentBinding&&e.ComponentBinding.deliverChanges()},e.BusyContext._DESCRIPTION="description",e.BusyContext._OJ_RIP="__ojRip",e.BusyContext._BOOTSTRAP_MEDIATOR=new function(){var e,t,r;"undefined"!=typeof window&&(e=window.oj_whenReady),this.whenReady=function(){return t||(t=e?new Promise(function(e){r=e}):Promise.resolve(!0))},this.isReady=function(){return!e},this.notifyComplete=function(){r?window.setImmediate(function(){e=!1,r(!0),r=null}):e=!1}},e.BusyState=function(t){this._description=t,this._addedWaitTs=e.BusyState._getTs(),this._id=this._addedWaitTs.toString(36)+"_"+Math.random().toString(36)},Object.defineProperties(e.BusyState.prototype,{id:{get:function(){return this._id},enumerable:!0},description:{get:function(){if(this._description)return this._description instanceof Function?this._description():this._description.toString()},enumerable:!0}}),e.BusyState.prototype.toString=function(){var t="Busy state: [description=",r=this.description;return null!==r&&(t+=r),t+=", elapsed="+(e.BusyState._getTs()-this._addedWaitTs)+"]"},e.BusyState._getTs=function(){return window.performance?window.performance.now():(new Date).getTime()};var r=function(e){this.Init(e)};return e.Object.createSubclass(r,e.Object,"oj.Context"),r.prototype.Init=function(e){r.superclass.Init.call(this),this._node=e},r.getContext=function(e){for(;e;){var t=e[r._OJ_CONTEXT_INSTANCE];if(t)return t;if(e.hasAttribute(r._OJ_CONTEXT_ATTRIBUTE))return t=new r(e),Object.defineProperty(e,r._OJ_CONTEXT_INSTANCE,{value:t}),t;e=r.getParentElement(e)}return r.getPageContext()},r.getPageContext=function(){return r._pageContext||(r._pageContext=new r),r._pageContext},r.prototype.getBusyContext=function(){return this._busyContext||(this._busyContext=new e.BusyContext(this._node)),this._busyContext},r.setBusyContextDefaultTimeout=function(t){e.BusyContext.setDefaultTimeout(t)},r._OJ_CONTEXT_ATTRIBUTE="data-oj-context",r._OJ_CONTEXT_INSTANCE="__ojContextInstance",r._OJ_SURROGATE_ATTR="data-oj-surrogate-id",r.getParentElement=function(e){if(e&&e.hasAttribute(r._OJ_SURROGATE_ATTR)){var t=document.getElementById(e.getAttribute(r._OJ_SURROGATE_ATTR));if(t)return t.parentElement}return e.parentElement},r}),!function(){"use strict";function e(e,t,r,i,a,o,n){if(t[e]||(e=e.replace(/^zh-(Hans|Hant)-([^-]+)$/,"zh-$2")),t[e]){if(r.push(e),!0===t[e]||1===t[e]){var s=n?n+e:e;i.push(a+s+"/"+o)}return!0}return!1}function t(e){return"object"==typeof e}function r(e,i){for(var a=Object.keys(i),o=0;o<a.length;o++){var n=a[o];null==e[n]?e[n]=i[n]:t(i[n])&&t(e[n])&&r(e[n],i[n])}}var i=/(^.*(^|\/)nls(\/|$))([^/]*)\/?([^/]*)/;define("ojL10n",["module"],function(t){var a=t.config?t.config():{};return{version:"2.0.1+",load:function(t,o,n,s){var l;(s=s||{}).locale&&(a.locale=s.locale);var c,d,u,p,h,g,f,m,I,E,y,v=i.exec(t),b=v[1],T=v[5],P=[],S={},C="";v[5]?(l=(b=v[1])+T,c=v[4]):(l=t,T=v[4],c=a.locale,"undefined"!=typeof document?(c||(c=s.isBuild?"root":document.documentElement.lang)||(c=void 0===navigator?"root":navigator.systemLanguage||navigator.language||navigator.userLanguage||"root"),a.locale=c):c="root"),d=function(e){var t,r=e.toLowerCase().split(/-|_/),i=[r[0]],a=1;for(t=1;t<r.length;t++){var o=r[t],n=o.length;if(1===n)break;switch(a){case 1:if(a=2,4===n){i.push(o.charAt(0).toUpperCase()+o.slice(1));break}case 2:a=3,i.push(o.toUpperCase());break;default:i.push(o)}}return function(e){if(!("zh"!==e[0]||e.length>1&&4===e[1].length)){var t="Hans",r=e.length>1?e[1]:null;"TW"!==r&&"MO"!==r&&"HK"!==r||(t="Hant"),e.splice(1,0,t)}}(i),i}(c),p=a.noOverlay,h=a.defaultNoOverlayLocale;var _=a.localePrefix;for((I=a.merge)&&(g=I[b+T])&&(v=i.exec(g),f=v[1],m=v[4]),E=[],u=0;u<d.length;u++)C+=(C?"-":"")+d[u],E.push(C);s.isBuild?(P.push(l),g&&P.push(g),o(P,function(){n()})):("query"===a.includeLocale&&(l=o.toUrl(l+".js"),l+=(-1===l.indexOf("?")?"?":"&")+"loc="+c),y=[l],g&&y.push(g),o(y,function(t,i){var a=[],s=function(t,r,i){for(var o=p||!0===t.__noOverlay,n=h||t.__defaultNoOverlayLocale,s=!1,l=E.length-1;l>=0&&(!s||!o);l--)s=e(E[l],t,a,P,r,i,_);var c=1===E.length&&"root"===E[0];o&&(c||!s)&&n&&e(n,t,a,P,r,i,_),c||e("root",t,a,P,r,i,_)};s(t,b,T);var l=a.length;i&&s(i,f,m),o(P,function(){var e=function(e,t,i,n,s){for(var l=t;l<i&&a[l];l++){var c=a[l],d=_?_+c:c,u=e[c];!0!==u&&1!==u||(u=o(n+d+"/"+s)),r(S,u||{})}};e(i,l,a.length,f,m),e(t,0,l,b,T),S._ojLocale_=d.join("-"),n(S)})}))}}})}(),define("ojtranslations/nls/ojtranslations",{root:{"oj-message":{fatal:"Fatal",error:"Error",warning:"Warning",info:"Info",confirmation:"Confirmation","compact-type-summary":"{0}: {1}"},"oj-converter":{summary:"Value is not in the expected format.",detail:"Enter a value in the expected format.","plural-separator":", ",hint:{summary:"Example: {exampleValue}",detail:"Enter a value in the same format as this example: '{exampleValue}'.","detail-plural":"Enter a value in the same format as these examples: '{exampleValue}'."},optionHint:{detail:"An accepted value for option '{propertyName}' is '{propertyValueValid}'.","detail-plural":"Accepted values for option '{propertyName}' are '{propertyValueValid}'."},optionTypesMismatch:{summary:"A value for the option '{requiredPropertyName}' is required when the option '{propertyName}' is set to '{propertyValue}'."},optionTypeInvalid:{summary:"A value of the expected type was not provided for option '{propertyName}'."},optionOutOfRange:{summary:"Value {propertyValue} is out of range for the option '{propertyName}'."},optionValueInvalid:{summary:"An invalid value '{propertyValue}' was specified for the option '{propertyName}'."},number:{decimalFormatMismatch:{summary:"'{value}' is not in the expected number format."},shortLongUnsupportedParse:{summary:"'short' and 'long' are not supported for converter parsing.",detail:"Change component to readonly. readonly fields do not call the converter's parse function."},currencyFormatMismatch:{summary:"'{value}' is not in the expected currency format."},percentFormatMismatch:{summary:"'{value}' is not in the expected percent format."},invalidNumberFormat:{summary:"The provided value '{value}' is not a valid number.",detail:"Please provide valid number."}},color:{invalidFormat:{summary:"Invalid color format.",detail:"Invalid color format option specification."},invalidSyntax:{summary:"Invalid color specification.",detail:"Color specification does not conform to CSS3 standard."}},datetime:{datetimeOutOfRange:{summary:"Value '{value}' is out of range for the '{propertyName}'.",detail:"Enter a value between '{minValue}' and '{maxValue}'.",hour:"hour",minute:"minute",second:"second",millisec:"millisec",month:"month",day:"day",year:"year","month name":"month name",weekday:"weekday"},dateFormatMismatch:{summary:"'{value}' is not in the expected date format."},invalidTimeZoneID:{summary:"Invalid timezone id {timeZoneID} provided."},nonExistingTime:{summary:"The input time does not exist because it falls during the transition to daylight saving time."},missingTimeZoneData:{summary:"TimeZone data is missing. Please call require 'ojs/ojtimezonedata' in order to load the TimeZone data."},timeFormatMismatch:{summary:"'{value}' is not in the expected time format."},datetimeFormatMismatch:{summary:"'{value}' is not in the expected date and time format."},dateToWeekdayMismatch:{summary:"Day '{date}' does not fall on a '{weekday}'.",detail:"Enter a weekday that corresponds with the date."},invalidISOString:{invalidRangeSummary:"The value '{value}' is out of range for the '{propertyName}' field in the ISO 8601 string '{isoStr}'.",summary:"The provided '{isoStr}' is not a valid ISO 8601 string.",detail:"Please provide valid ISO 8601 string."}}},"oj-validator":{length:{hint:{min:"Enter {min} or more characters.",max:"Enter {max} or fewer characters.",inRange:"Enter {min} or more characters, up to a maximum of {max}.",exact:"Enter {length} characters."},messageDetail:{tooShort:"Enter {min} or more characters, not fewer.",tooLong:"Enter {max} or fewer characters, not more."},messageSummary:{tooShort:"There are too few characters.",tooLong:"There are too many characters."}},range:{number:{hint:{min:"Enter a number greater than or equal to {min}.",max:"Enter a number less than or equal to {max}.",inRange:"Enter a number between {min} and {max}.",exact:"Enter the number {num}."},messageDetail:{rangeUnderflow:"The number must be greater than or equal to {min}.",rangeOverflow:"The number must be less than or equal to {max}.",exact:"The number must be {num}."},messageSummary:{rangeUnderflow:"The number is too low.",rangeOverflow:"The number is too high."}},datetime:{hint:{min:"Enter a date and time on or after {min}.",max:"Enter a date and time on or before {max}.",inRange:"Enter a date and time between {min} and {max}."},messageDetail:{rangeUnderflow:"Date and time must be on or later than {min}.",rangeOverflow:"Date and time must be on or sooner than {max}."},messageSummary:{rangeUnderflow:"Date and time is earlier than the minimum date and time.",rangeOverflow:"Date and time is later than the maximum date and time."}},date:{hint:{min:"Enter a date on or after {min}.",max:"Enter a date on or before {max}.",inRange:"Enter a date between {min} and {max}."},messageDetail:{rangeUnderflow:"Date must be on or later than {min}.",rangeOverflow:"Date must be on or sooner than {max}."},messageSummary:{rangeUnderflow:"Date is earlier than the minimum date.",rangeOverflow:"Date is later than the maximum date."}},time:{hint:{min:"Enter a time on or after {min}.",max:"Enter a time on or before {max}.",inRange:"Enter a time between {min} and {max}."},messageDetail:{rangeUnderflow:"Time must be on or later than {min}.",rangeOverflow:"Time must be on or sooner than {max}."},messageSummary:{rangeUnderflow:"Time is earlier than the minimum time.",rangeOverflow:"Time is later than the maximum time."}}},restriction:{date:{messageSummary:"Date {value} is of a disabled entry.",messageDetail:"Date {value} should not be of a disabled entry."}},regExp:{summary:"Format is incorrect.",detail:"Value '{value}' must match this pattern: '{pattern}'."},required:{summary:"Value is required.",detail:"You must enter a value."}},"oj-ojEditableValue":{loading:"Loading"},"oj-ojInputDate":{done:"Done",cancel:"Cancel",prevText:"Prev",nextText:"Next",currentText:"Today",weekHeader:"Wk",tooltipCalendar:"Select Date.",tooltipCalendarTime:"Select Date Time.",tooltipCalendarDisabled:"Select Date Disabled.",tooltipCalendarTimeDisabled:"Select Date Time Disabled.",picker:"Picker",weekText:"Week",datePicker:"Date Picker",inputHelp:"Press Key down or Key up for access to Calendar.",inputHelpBoth:"Press Key down or Key up for access to Calendar and Shift + Key down or Shift Key up for access to time drop down.",dateTimeRange:{hint:{min:"",max:"",inRange:""},messageDetail:{rangeUnderflow:"",rangeOverflow:""},messageSummary:{rangeUnderflow:"",rangeOverflow:""}},dateRestriction:{hint:"",messageSummary:"",messageDetail:""}},"oj-ojInputTime":{cancelText:"Cancel",okText:"OK",currentTimeText:"Now",hourWheelLabel:"Hour",minuteWheelLabel:"Minute",ampmWheelLabel:"AMPM",tooltipTime:"Select Time.",tooltipTimeDisabled:"Select Time Disabled.",inputHelp:"Press Key down or Key up for access to time drop down.",dateTimeRange:{hint:{min:"",max:"",inRange:""},messageDetail:{rangeUnderflow:"",rangeOverflow:""},messageSummary:{rangeUnderflow:"",rangeOverflow:""}}},"oj-inputBase":{required:{hint:"",messageSummary:"",messageDetail:""},regexp:{messageSummary:"",messageDetail:""}},"oj-ojInputPassword":{regexp:{messageDetail:"Value must match this pattern: '{pattern}'."}},"oj-ojFilmStrip":{labelAccFilmStrip:"Displaying page {pageIndex} of {pageCount}",labelAccArrowNextPage:"Select Next to display next page",labelAccArrowPreviousPage:"Select Previous to display previous page",tipArrowNextPage:"Next",tipArrowPreviousPage:"Previous"},"oj-ojDataGrid":{accessibleSortAscending:"{id} sorted in ascending order",accessibleSortDescending:"{id} sorted in descending order",accessibleActionableMode:"Enter actionable mode.",accessibleNavigationMode:"Enter navigation mode, press F2 to enter edit or actionable mode.",accessibleEditableMode:"Enter editable mode, press escape to navigate outside the data grid.",accessibleSummaryExact:"This is a data grid with {rownum} rows and {colnum} columns",accessibleSummaryEstimate:"This is a data grid with unknown number of rows and columns",accessibleSummaryExpanded:"There are currently {num} rows expanded",accessibleRowExpanded:"Row expanded",accessibleRowCollapsed:"Row collapsed",accessibleRowSelected:"Row {row} selected",accessibleColumnSelected:"Column {column} selected",accessibleStateSelected:"selected",accessibleMultiCellSelected:"{num} cells selected",accessibleColumnSpanContext:"{extent} wide",accessibleRowSpanContext:"{extent} high",accessibleRowContext:"Row {index}",accessibleColumnContext:"Column {index}",accessibleRowHeaderContext:"Row Header {index}",accessibleColumnHeaderContext:"Column Header {index}",accessibleRowEndHeaderContext:"Row End Header {index}",accessibleColumnEndHeaderContext:"Column End Header {index}",accessibleRowHeaderLabelContext:"Row Header Label {level}",accessibleColumnHeaderLabelContext:"Column Header Label {level}",accessibleRowEndHeaderLabelContext:"Row End Header Label {level}",accessibleColumnEndHeaderLabelContext:"Column End Header Label {level}",accessibleLevelContext:"Level {level}",accessibleRangeSelectModeOn:"Add selected range of cells mode on.",accessibleRangeSelectModeOff:"Add selected range of cells mode off.",accessibleFirstRow:"You have reached the first row.",accessibleLastRow:"You have reached the last row.",accessibleFirstColumn:"You have reached the first column",accessibleLastColumn:"You have reached the last column.",accessibleSelectionAffordanceTop:"Top selection handle.",accessibleSelectionAffordanceBottom:"Bottom selection handle.",msgFetchingData:"Fetching Data...",msgNoData:"No items to display.",labelResize:"Resize",labelResizeWidth:"Resize Width",labelResizeHeight:"Resize Height",labelSortRow:"Sort Row",labelSortRowAsc:"Sort Row Ascending",labelSortRowDsc:"Sort Row Descending",labelSortCol:"Sort Column",labelSortColAsc:"Sort Column Ascending",labelSortColDsc:"Sort Column Descending",labelCut:"Cut",labelPaste:"Paste",labelEnableNonContiguous:"Enable Non-Contiguous Selection",labelDisableNonContiguous:"Disable Non-Contiguous Selection",labelResizeDialogSubmit:"OK"},"oj-ojRowExpander":{accessibleLevelDescription:"Level {level}",accessibleRowDescription:"Level {level}, Row {num} of {total}",accessibleRowExpanded:"Row expanded",accessibleRowCollapsed:"Row collapsed",accessibleStateExpanded:"expanded",accessibleStateCollapsed:"collapsed"},"oj-ojListView":{msgFetchingData:"Fetching Data...",msgNoData:"No items to display.",msgItemsAppended:"{count} items appended to the end.",indexerCharacters:"A|B|C|D|E|F|G|H|I|J|K|L|M|N|O|P|Q|R|S|T|U|V|W|X|Y|Z",accessibleReorderTouchInstructionText:"Double tap and hold. Wait for the sound then drag to rearrange.",accessibleReorderBeforeItem:"Before {item}",accessibleReorderAfterItem:"After {item}",accessibleReorderInsideItem:"Into {item}",accessibleNavigateSkipItems:"Skipping {numSkip} items",labelCut:"Cut",labelCopy:"Copy",labelPaste:"Paste",labelPasteBefore:"Paste Before",labelPasteAfter:"Paste After"},"oj-_ojLabel":{tooltipHelp:"Help",tooltipRequired:"Required"},"oj-ojLabel":{tooltipHelp:"Help",tooltipRequired:"Required"},"oj-ojInputNumber":{required:{hint:"",messageSummary:"",messageDetail:""},numberRange:{hint:{min:"",max:"",inRange:"",exact:""},messageDetail:{rangeUnderflow:"",rangeOverflow:"",exact:""},messageSummary:{rangeUnderflow:"",rangeOverflow:""}},tooltipDecrement:"Decrement",tooltipIncrement:"Increment"},"oj-ojTable":{labelAccSelectionAffordanceTop:"Top selection handle",labelAccSelectionAffordanceBottom:"Bottom selection handle",labelEnableNonContiguousSelection:"Enable Non-Contiguous Selection",labelDisableNonContiguousSelection:"Disable Non-Contiguous Selection",labelResize:"Resize",labelResizePopupSubmit:"OK",labelResizePopupSpinner:"Resize Column",labelSelectRow:"Select Row",labelEditRow:"Edit Row",labelSelectAndEditRow:"Select And Edit Row",labelSelectColumn:"Select Column",labelSort:"Sort",labelSortAsc:"Sort Ascending",labelSortDsc:"Sort Descending",msgFetchingData:"Fetching Data...",msgNoData:"No data to display.",msgInitializing:"Initializing...",msgColumnResizeWidthValidation:"Width value must be an integer.",msgScrollPolicyMaxCountSummary:"Exceeded maximum rows for table scrolling.",msgScrollPolicyMaxCountDetail:"Please reload with smaller data set.",msgStatusSortAscending:"{0} sorted in ascending order.",msgStatusSortDescending:"{0} sorted in descending order."},"oj-ojTabs":{labelCut:"Cut",labelPasteBefore:"Paste Before",labelPasteAfter:"Paste After",labelRemove:"Remove",labelReorder:"Reorder",removeCueText:"Removable"},"oj-ojCheckboxset":{readonlyNoValue:"",required:{hint:"",messageSummary:"",messageDetail:""}},"oj-ojRadioset":{readonlyNoValue:"",required:{hint:"",messageSummary:"",messageDetail:""}},"oj-ojSelect":{required:{hint:"",messageSummary:"",messageDetail:""},searchField:"Search field",noMatchesFound:"No matches found",oneMatchesFound:"One match found",moreMatchesFound:"{num} matches found",filterFurther:"More results available, please filter further."},"oj-ojSwitch":{SwitchON:"On",SwitchOFF:"Off"},"oj-ojCombobox":{required:{hint:"",messageSummary:"",messageDetail:""},noMatchesFound:"No matches found",oneMatchesFound:"One match found",moreMatchesFound:"{num} matches found",filterFurther:"More results available, please filter further."},"oj-ojInputSearch":{required:{hint:"",messageSummary:"",messageDetail:""},noMatchesFound:"No matches found",oneMatchesFound:"One match found",moreMatchesFound:"{num} matches found"},"oj-ojTree":{stateLoading:"Loading...",labelNewNode:"New Node",labelMultiSelection:"Multiple Selection",labelEdit:"Edit",labelCreate:"Create",labelCut:"Cut",labelCopy:"Copy",labelPaste:"Paste",labelPasteAfter:"Paste After",labelPasteBefore:"Paste Before",labelRemove:"Remove",labelRename:"Rename",labelNoData:"No data"},"oj-ojPagingControl":{labelAccPaging:"Pagination",labelAccPageNumber:"Page {pageNum} content loaded",labelAccNavFirstPage:"First Page",labelAccNavLastPage:"Last Page",labelAccNavNextPage:"Next Page",labelAccNavPreviousPage:"Previous Page",labelAccNavPage:"Page",labelLoadMore:"Show More...",labelLoadMoreMaxRows:"Reached Maximum Limit of {maxRows} rows",labelNavInputPage:"Page",labelNavInputPageMax:"of {pageMax}",fullMsgItemRange:"{pageFrom}-{pageTo} of {pageMax} items",fullMsgItemRangeAtLeast:"{pageFrom}-{pageTo} of at least {pageMax} items",fullMsgItemRangeApprox:"{pageFrom}-{pageTo} of approx {pageMax} items",msgItemRangeNoTotal:"{pageFrom}-{pageTo} items",fullMsgItem:"{pageTo} of {pageMax} items",fullMsgItemAtLeast:"{pageTo} of at least {pageMax} items",fullMsgItemApprox:"{pageTo} of approx {pageMax} items",msgItemNoTotal:"{pageTo} items",msgItemRangeCurrent:"{pageFrom}-{pageTo}",msgItemRangeCurrentSingle:"{pageFrom}",msgItemRangeOf:"of",msgItemRangeOfAtLeast:"of at least",msgItemRangeOfApprox:"of approx.",msgItemRangeItems:"items",tipNavInputPage:"Go To Page",tipNavPageLink:"Go To Page {pageNum}",tipNavNextPage:"Next",tipNavPreviousPage:"Previous",tipNavFirstPage:"First",tipNavLastPage:"Last",pageInvalid:{summary:"The page value entered is invalid.",detail:"Please enter a value greater than 0."},maxPageLinksInvalid:{summary:"Value for maxPageLinks is invalid.",detail:"Please enter a value greater than 4."}},"oj-ojMasonryLayout":{labelCut:"Cut",labelPasteBefore:"Paste Before",labelPasteAfter:"Paste After"},"oj-panel":{labelAccButtonExpand:"Expand",labelAccButtonCollapse:"Collapse",labelAccButtonRemove:"Remove",labelAccFlipForward:"Flip forward",labelAccFlipBack:"Flip back",tipDragToReorder:"Drag to reorder",labelAccDragToReorder:"Drag to reorder, context menu available"},"oj-ojChart":{labelDefaultGroupName:"Group {0}",labelSeries:"Series",labelGroup:"Group",labelDate:"Date",labelValue:"Value",labelTargetValue:"Target",labelX:"X",labelY:"Y",labelZ:"Z",labelPercentage:"Percentage",labelLow:"Low",labelHigh:"High",labelOpen:"Open",labelClose:"Close",labelVolume:"Volume",labelQ1:"Q1",labelQ2:"Q2",labelQ3:"Q3",labelMin:"Min",labelMax:"Max",labelOther:"Other",tooltipPan:"Pan",tooltipSelect:"Marquee select",tooltipZoom:"Marquee zoom",componentName:"Chart"},"oj-dvtBaseGauge":{componentName:"Gauge"},"oj-ojDiagram":{promotedLink:"{0} link",promotedLinks:"{0} links",promotedLinkAriaDesc:"Indirect",componentName:"Diagram"},"oj-ojGantt":{componentName:"Gantt",accessibleDurationDays:"{0} days",accessibleDurationHours:"{0} hours",accessibleTaskInfo:"Start time is {0}, end time is {1}, duration is {2}",accessibleMilestoneInfo:"Time is {0}",accessibleRowInfo:"Row {0}",accessibleTaskTypeMilestone:"Milestone",accessibleTaskTypeSummary:"Summary",accessiblePredecessorInfo:"{0} predecessors",accessibleSuccessorInfo:"{0} successors",accessibleDependencyInfo:"Dependency type {0}, connects {1} to {2}",startStartDependencyAriaDesc:"start to start",startFinishDependencyAriaDesc:"start to finish",finishStartDependencyAriaDesc:"finish to start",finishFinishDependencyAriaDesc:"finish to finish",tooltipZoomIn:"Zoom In",tooltipZoomOut:"Zoom Out",labelLevel:"Level",labelRow:"Row",labelStart:"Start",labelEnd:"End",labelDate:"Date",labelBaselineStart:"Baseline Start",labelBaselineEnd:"Baseline End",labelBaselineDate:"Baseline Date",labelLabel:"Label",labelProgress:"Progress",labelMoveBy:"Move By",labelResizeBy:"Resize By",taskMoveInitiated:"Task move initiated",taskResizeEndInitiated:"Task resize end initiated",taskResizeStartInitiated:"Task resize start initiated",taskMoveSelectionInfo:"{0} others selected",taskResizeSelectionInfo:"{0} others selected",taskMoveInitiatedInstruction:"Use the arrow keys to move",taskResizeInitiatedInstruction:"Use the arrow keys to resize",taskMoveFinalized:"Task move finalized",taskResizeFinalized:"Task resize finalized",taskMoveCancelled:"Task move cancelled",taskResizeCancelled:"Task resize cancelled",taskResizeStartHandle:"Task resize start handle",taskResizeEndHandle:"Task resize end handle"},"oj-ojLegend":{componentName:"Legend",tooltipExpand:"Expand",tooltipCollapse:"Collapse"},"oj-ojNBox":{highlightedCount:"{0}/{1}",labelOther:"Other",labelGroup:"Group",labelSize:"Size",labelAdditionalData:"Additional Data",componentName:"{0} Box"},"oj-ojPictoChart":{componentName:"Picture Chart"},"oj-ojSparkChart":{componentName:"Chart"},"oj-ojSunburst":{labelColor:"Color",labelSize:"Size",tooltipExpand:"Expand",tooltipCollapse:"Collapse",componentName:"Sunburst"},"oj-ojTagCloud":{componentName:"Tag Cloud"},"oj-ojThematicMap":{componentName:"Thematic Map",areasRegion:"Areas",linksRegion:"Links",markersRegion:"Markers"},"oj-ojTimeAxis":{componentName:"Time Axis"},"oj-ojTimeline":{componentName:"Timeline",accessibleItemDesc:"Description is {0}.",accessibleItemEnd:"End time is {0}.",accessibleItemStart:"Start time is {0}.",accessibleItemTitle:"Title is {0}.",labelSeries:"Series",tooltipZoomIn:"Zoom In",tooltipZoomOut:"Zoom Out",labelStart:"Start",labelEnd:"End",labelDate:"Date",labelTitle:"Title",labelDescription:"Description"},"oj-ojTreemap":{labelColor:"Color",labelSize:"Size",tooltipIsolate:"Isolate",tooltipRestore:"Restore",componentName:"Treemap"},"oj-dvtBaseComponent":{labelScalingSuffixThousand:"K",labelScalingSuffixMillion:"M",labelScalingSuffixBillion:"B",labelScalingSuffixTrillion:"T",labelScalingSuffixQuadrillion:"Q",labelInvalidData:"Invalid data",labelNoData:"No data to display",labelClearSelection:"Clear Selection",labelDataVisualization:"Data Visualization",stateSelected:"Selected",stateUnselected:"Unselected",stateMaximized:"Maximized",stateMinimized:"Minimized",stateExpanded:"Expanded",stateCollapsed:"Collapsed",stateIsolated:"Isolated",stateHidden:"Hidden",stateVisible:"Visible",stateDrillable:"Drillable",labelAndValue:"{0}: {1}",labelCountWithTotal:"{0} of {1}"},"oj-ojNavigationList":{defaultRootLabel:"Navigation List",hierMenuBtnLabel:"Hierarchical Menu button",selectedLabel:"selected",previousIcon:"Previous",msgFetchingData:"Fetching Data...",msgNoData:"No items to display.",overflowItemLabel:"More",accessibleReorderTouchInstructionText:"Double tap and hold. Wait for the sound then drag to rearrange.",accessibleReorderBeforeItem:"Before {item}",accessibleReorderAfterItem:"After {item}",labelCut:"Cut",labelPasteBefore:"Paste Before",labelPasteAfter:"Paste After",labelRemove:"Remove",removeCueText:"Removable"},"oj-ojSlider":{noValue:"ojSlider has no value",maxMin:"Max must not be less than or equal to min",valueRange:"Value must be within min to max range",optionNum:"{option} option is not a number",invalidStep:"Invalid step; step must be > 0"},"oj-ojDialog":{labelCloseIcon:"Close"},"oj-ojPopup":{ariaLiveRegionInitialFocusFirstFocusable:"Entering pop-up. Press F6 to navigate between the pop-up and associated control.",ariaLiveRegionInitialFocusNone:"Pop-up opened. Press F6 to navigate between the pop-up and associated control.",ariaLiveRegionInitialFocusFirstFocusableTouch:"Entering pop-up. Pop-up can be closed by navigating to the last link within the pop-up.",ariaLiveRegionInitialFocusNoneTouch:"Pop-up opened. Navigate to the next link to establish focus within the pop-up.",ariaFocusSkipLink:"Double tap to navigate to the open pop-up.",ariaCloseSkipLink:"Double tap to close the open pop-up."},"oj-ojRefresher":{ariaRefreshLink:"Activate link to refresh content",ariaRefreshingLink:"Refreshing content",ariaRefreshCompleteLink:"Refresh complete"},"oj-ojSwipeActions":{ariaShowStartActionsDescription:"Show start actions",ariaShowEndActionsDescription:"Show end actions",ariaHideActionsDescription:"Hide actions"},"oj-ojIndexer":{indexerCharacters:"A|B|C|D|E|F|G|H|I|J|K|L|M|N|O|P|Q|R|S|T|U|V|W|X|Y|Z",indexerOthers:"#",ariaDisabledLabel:"No matching group header",ariaOthersLabel:"number",ariaInBetweenText:"Between {first} and {second}",ariaKeyboardInstructionText:"Press enter to select value.",ariaTouchInstructionText:"Double tap and hold to enter gesture mode, then drag up or down to adjust value."},"oj-ojMenu":{labelCancel:"Cancel",ariaFocusSkipLink:"Focus is within the menu, double tap or swipe to move focus to the first menu item."},"oj-ojColorSpectrum":{labelHue:"Hue",labelOpacity:"Opacity",labelSatLum:"Saturation/Luminance",labelThumbDesc:"Color spectrum four way slider."},"oj-ojColorPalette":{labelNone:"None"},"oj-ojColorPicker":{labelSwatches:"Swatches",labelCustomColors:"Custom Colors",labelPrevColor:"Previous Color",labelDefColor:"Default Color",labelDelete:"Delete",labelDeleteQ:"Delete?",labelAdd:"Add",labelAddColor:"Add color",labelMenuHex:"HEX",labelMenuRgba:"RGBa",labelMenuHsla:"HSLa",labelSliderHue:"Hue",labelSliderSaturation:"Saturation",labelSliderSat:"Sat",labelSliderLightness:"Lightness",labelSliderLum:"Luminosity",labelSliderAlpha:"Alpha",labelOpacity:"Opacity",labelSliderRed:"Red",labelSliderGreen:"Green",labelSliderBlue:"Blue"},"oj-ojFilePicker":{dropzoneText:"Drop files here or click to upload"},"oj-ojProgressbar":{ariaIndeterminateProgressText:"In Progress"},"oj-ojMessage":{labelCloseIcon:"Close",categories:{error:"Error",warning:"Warning",info:"Information",confirmation:"Confirmation"}},"oj-ojMessages":{labelLandmark:"Messages",ariaLiveRegion:{navigationFromKeyboard:"Entering messages region. Press F6 to navigate back to prior focused element.",navigationToTouch:"Messages region has new messages. Use the voice-over rotor to navigate to the messages landmark.",navigationToKeyboard:"Messages region has new messages. Press F6 to navigate to the most recent message region.",newMessage:"Message category {category}. {summary}."}}},ar:1,"ar-XB":1,cs:1,da:1,de:1,el:1,"en-XA":1,"en-XC":1,es:1,et:1,fi:1,fr:1,"fr-CA":1,he:1,hr:1,hu:1,it:1,ja:1,ko:1,lt:1,lv:1,nl:1,no:1,pl:1,pt:1,"pt-PT":1,ro:1,ru:1,sk:1,sl:1,sr:1,"sr-Latn":1,sv:1,th:1,tr:1,"zh-Hans":1,"zh-Hant":1}),define("ojs/ojconfig",["require","ojs/ojcore-base","ojL10n!ojtranslations/nls/ojtranslations"],function(e,t,r){"use strict";var i={getDeviceType:function(){return t.AgentUtils.getAgentInfo().deviceType},getLocale:function(){if(t.__isAmdLoaderPresent()){t.Assert.assert(void 0!==r,"ojtranslations module must be defined");var e=r._ojLocale_;return"root"===e?"en":e}var a=i._locale;return null==a&&((a=document.documentElement.lang)||(a=void 0===navigator?"en":(navigator.language||navigator.userLanguage||"en").toLowerCase()),a=a.toLowerCase(),i._locale=a),a},setLocale:function(a,o){if(t.__isAmdLoaderPresent()){var n="ojL10n!ojtranslations/nls/",s=[n+a+"/ojtranslations"],l=0;if(t.LocaleData&&(s.push(n+a+"/localeElements"),t.TimezoneData)){var c=t.TimezoneData.__getBundleNames();l=c.length,c.forEach(function(e){s.push(n+a+e)})}e(s,function(e,i){r=e,i&&t.LocaleData.__updateBundle(i);for(var a=0;a<l;a++){var n=arguments[a+2];t.TimezoneData.__mergeIntoLocaleElements(n)}o&&o()})}else i._locale=a,o&&o()},getResourceUrl:function(e){if(null==e||/^\/|:/.test(e))return e;var t=i._resourceBaseUrl;null==t&&(t=i._getOjBaseUrl()||"");var r=t.length;return t+(0===r||"/"===t.charAt(r-1)?"":"/")+e},setResourceBaseUrl:function(e){i._resourceBaseUrl=e},setAutomationMode:function(e){i._automationMode=e},getAutomationMode:function(){return i._automationMode},getVersionInfo:function(){var e="Oracle JET Version: "+t.version+"\n";e+="Oracle JET Revision: "+t.revision+"\n";var r="undefined"!=typeof window;return r&&window.navigator&&(e+="Browser: "+window.navigator.userAgent+"\n",e+="Browser Platform: "+window.navigator.platform+"\n"),$&&($.fn&&(e+="jQuery Version: "+$.fn.jquery+"\n"),
- $.ui&&$.ui.version&&(e+="jQuery UI Version: "+$.ui.version+"\n")),t.ComponentBinding&&(e+="Knockout Version: "+t.ComponentBinding.__getKnockoutVersion()+"\n"),r&&window.require&&(e+="Require Version: "+window.require.version+"\n"),e},logVersionInfo:function(){console.log(i.getVersionInfo())},_getOjBaseUrl:function(){var r=null;return t.__isAmdLoaderPresent()&&(r=e.toUrl("ojs/_foo_").replace(/[^/]*$/,"../")),r},__getTemplateEngine:function(){if(!i._templateEnginePromise){if(!t.__isAmdLoaderPresent())throw new Error("JET Template engine cannot be loaded with an AMD loader");i._templateEnginePromise=new Promise(function(t,r){e(["./ojtemplateengine"],t,r)})}return i._templateEnginePromise},getConfigBundle:function(){return r},getExpressionEvaluator:function(){return i._expressionEvaluator},setExpressionEvaluator:function(e){if(i._expressionEvaluator)throw new Error("JET Expression evaluator can't be set more than once.");i._expressionEvaluator=e}};return i}),define("ojs/ojresponsiveutils",["ojs/ojlogger"],function(e){"use strict";var t=function(){};return t.SCREEN_RANGE={SM:"sm",MD:"md",LG:"lg",XL:"xl",XXL:"xxl"},t.FRAMEWORK_QUERY_KEY={SM_UP:"sm-up",MD_UP:"md-up",LG_UP:"lg-up",XL_UP:"xl-up",XXL_UP:"xxl-up",SM_ONLY:"sm-only",MD_ONLY:"md-only",LG_ONLY:"lg-only",XL_ONLY:"xl-only",MD_DOWN:"md-down",LG_DOWN:"lg-down",XL_DOWN:"xl-down",HIGH_RESOLUTION:"high-resolution"},(t._RANGE={})[t.SCREEN_RANGE.SM]=0,t._RANGE[t.SCREEN_RANGE.MD]=1,t._RANGE[t.SCREEN_RANGE.LG]=2,t._RANGE[t.SCREEN_RANGE.XL]=3,t._RANGE[t.SCREEN_RANGE.XXL]=4,t._getMediaQueryFromClass=function(e){var t=document.getElementsByClassName(e).item(0);return null===t&&((t=document.createElement("meta")).className=e,document.head.appendChild(t)),window.getComputedStyle(t).getPropertyValue("font-family").replace(/^[/\\'"]+|(;\s?})+|[/\\'"]+$/g,"")},t.getFrameworkQuery=function(r){var i=t._getMediaQueryFromClass("oj-mq-"+r);return"null"===i?(e.warn("Framework query not found. Please check that the value of the theming variable$includeResponsiveMediaQueryClasses is set to true, if itis set to false the media queries are not sent down to the browser."),null):i},t.compare=function(e,r){var i=t._RANGE[e],a=t._RANGE[r];if(null==i)throw new Error("size1 param "+e+" illegal, please use one of the screen size constants like oj.ResponsiveUtils.SCREEN_RANGE.MD");if(null==a)throw new Error("size2 param "+r+" illegal, please use one of the screen size constants like oj.ResponsiveUtils.SCREEN_RANGE.MD");return i-a},t}),define("ojs/ojthemeutils",["ojs/ojlogger"],function(e){"use strict";var t=function(){};return t.getThemeName=function(){return(t.parseJSONFromFontFamily("oj-theme-json")||{}).name},t.getThemeTargetPlatform=function(){return(t.parseJSONFromFontFamily("oj-theme-json")||{}).targetPlatform},t.clearCache=function(){this._cache=null},t.parseJSONFromFontFamily=function(t){null==this._cache&&(this._cache={},this._null_cache_value={},this._headfontstring=window.getComputedStyle(document.head).getPropertyValue("font-family"));var r=this._cache[t];if(r===this._null_cache_value)return null;if(null!=r)return r;var i=document.createElement("meta");i.className=t,document.head.appendChild(i);var a=window.getComputedStyle(i).getPropertyValue("font-family");if(null!=a)if(a===this._headfontstring)e.warn("parseJSONFromFontFamily: When the selector ",t," is applied the font-family read off the dom element is ",a,". The parent dom elment has the same font-family value."," This is interpreted to mean that no value was sent down for selector ",t,". Null will be returned.");else{var o=a.replace(/^['"]+|\s+|\\|(;\s?})+|['"]$/g,"");if(o)try{r=JSON.parse(o)}catch(a){var n=o.indexOf(","),s=!1;if(n>-1){o=o.substring(n+2);try{r=JSON.parse(o),s=!0}catch(e){}}if(!1===s)throw e.error("Error parsing json for selector "+t+".\nString being parsed is "+o+". Error is:\n",a),document.head.removeChild(i),a}}return document.head.removeChild(i),this._cache[t]=null==r?this._null_cache_value:r,r},t}),define("ojs/ojtimerutils",[],function(){"use strict";function e(){}var t={};return e.prototype.getPromise=function(){},e.prototype.clear=function(){},t.getTimer=function(e){return new t._TimerImpl(e)},t._TimerImpl=function(e){function t(e){a=null,i(e)}var r,i,a;this.getPromise=function(){return r},this.clear=function(){window.clearTimeout(a),a=null,t(!1)},r="undefined"==typeof window?Promise.reject():new Promise(function(r){i=r,a=window.setTimeout(t.bind(null,!0),e)})},t}),define("ojs/ojtranslation",["ojs/ojcore-base","ojs/ojconfig"],function(e,t){"use strict";var r={setBundle:function(e){r._bundle=e},getResource:function(e){return r._getResourceString(e)},applyParameters:function(e,t){return null==e?null:r._format(e,t)},getTranslatedString:function(e,t){var i=r._getResourceString(e);if(null==i)return e;var a={};return arguments.length>2?a=Array.prototype.slice.call(arguments,1):2===arguments.length&&("object"==typeof(a=arguments[1])||a instanceof Array||(a=[a])),r.applyParameters(i,a)},getComponentTranslations:function(e){var t=r._getBundle()[e];if(null==t)return{};for(var i={},a=Object.keys(t),o=0;o<a.length;o++){var n=a[o];i[n]=t[n]}return i},_getResourceString:function(t){var i=t?t.split("."):[],a=r._getBundle();e.Assert.assertObject(a);for(var o=0;o<i.length&&a;o++)a=a[i[o]];return a||null},_format:function(e,t){var r,i,a=e.length,o=[],n=null,s=!1,l=!1,c=!1,d=!1;for(i=0;i<a;i++){var u=e.charAt(i),p=!1;if(s)p=!0,s=!1;else switch(u){case"$":s=!0;break;case"{":d||(l||(r=!1,n=[]),l=!0);break;case"}":if(l&&n.length>0){var h=t[n.join("")];o.push(void 0===h?"null":h)}l=!1;break;case"[":l||(c?d=!0:c=!0);break;case"]":d?d=!1:c=!1;break;default:p=!0}p&&(l?","===u||" "===u?r=!0:r||n.push(u):d||o.push(u))}return o.join("")},_getBundle:function(){var i=r._bundle;if(i)return i;if(e.__isAmdLoaderPresent()){var a=t.getConfigBundle();return e.Assert.assert(void 0!==a,"ojtranslations module must be defined"),a}return{}}};return r}),define("ojs/ojcore",["require","ojs/ojcore-base","ojs/ojcontext","ojs/ojconfig","ojs/ojlogger","ojs/ojresponsiveutils","ojs/ojthemeutils","ojs/ojtimerutils","ojs/ojtranslation"],function(e,t,r,i,a,o,n,s,l){"use strict";return t.Logger=a,t.Context=r,t.Config=i,t.ResponsiveUtils=o,t.ThemeUtils=n,t.TimerUtils=s,t.Translations=l,t}),define("numberFormatHelper",["ojs/ojcore"],function(){"use strict";function e(){}return e.prototype.formatNumber=function(e,t,r){var t,i,a,o;a=oj.Validation.converterFactory(oj.ConverterFactory.CONVERTER_TYPE_NUMBER);var n={style:r,minimumIntegerDigits:1,minimumFractionDigits:t,maximumFractionDigits:t,useGrouping:!0};return o=a.createConverter(n),i=o.format(e)},new e}),define("currencyHelper",["knockout","ccRestClient","ccConstants","numberFormatHelper","pubsub"],function(e,t,r,i,a){"use strict";function o(){return this.currencyObject=e.observable(null),this.currencyMapObject=e.observable(null),this.setFractionalDigits=e.observable(null),this.currencies=e.observableArray([]),this.currenciesLoaded=!1,this.priceListGroups=e.observableArray([]),this.defaultPriceListGroup=null,this.priceListGroupsLoaded=!1,this.getCurrencyMapCurrenciesBinding=this.getCurrencyMapCurrencies.bind(this),$.Topic(a.topicNames.PRICE_LIST_GROUP_UPDATE).subscribe(this.getCurrencyMapCurrenciesBinding),$.Topic(a.topicNames.ADMIN_CONTENT_LANGUAGE_CHANGED).subscribe(this.getCurrencyMapCurrenciesBinding),this}return o.prototype.DECIMAL_NUMBER_FORMAT="decimal",o.prototype.getCurrency=function(e,i){var a=r.ENDPOINT_CURRENCIES_LIST_CURRENCIES,o={};null==e&&(e=this.getCurrencySuccess.bind(this)),null==i&&(i=this.getCurrencyError.bind(this)),t.request(a,o,e,i)},o.prototype.getCurrencySuccess=function(e){this.currencyObject(e.selectedCurrency),this.checkCurrencySymbol()},o.prototype.getCurrencyError=function(e){throw"Not Implemented"},o.prototype.getCurrencies=function(e){var i=r.ENDPOINT_CURRENCIES_LIST_CURRENCIES,a={sort:"currencyCode:asc"};t.request(i,a,e,this.getCurrenciesError.bind(this))},o.prototype.getCurrenciesError=function(e){throw"Not Implemented"},o.prototype.getPriceListGroups=function(e){var i=r.ENDPOINT_LIST_PRICE_LIST_GROUPS,a={includeDeleted:"true"};t.request(i,a,e,this.getPriceListGroupsError.bind(this))},o.prototype.getPriceListGroupsError=function(e){throw"Not Implemented"},o.prototype.getPLGCurrencies=function(e){this.getCurrencies(function(t){this.currencies(t.items),this.currenciesLoaded=!0,this.priceListGroupsLoaded&&this.formatCurrenciesForList(e)}.bind(this)),this.getPriceListGroups(function(t){this.priceListGroups(t.items),this.defaultPriceListGroup=t.defaultPriceListGroup,this.priceListGroupsLoaded=!0,this.currenciesLoaded&&this.formatCurrenciesForList(e)}.bind(this))},o.prototype.formatCurrenciesForList=function(e){var t,r,i=this.priceListGroups(),a=[];e:for(t=0;t<i.length;t++){var o={};for(o.repositoryId=i[t].currency.repositoryId,o.currencyCode=i[t].currency.currencyCode,r=0;r<a.length;r++)if(a[r].repositoryId===i[t].currency.repositoryId)continue e;for(o.selectListDisplayName=i[t].currency.currencyCode+" - "+i[t].currency.displayName,o.fractionalDigits=i[t].currency.fractionalDigits,o.repositoryId===this.defaultPriceListGroup.locale&&(o.isDefault=!0),r=0;r<this.currencies().length;r++)this.currencies()[r].currencyCode===i[t].currency.currencyCode&&(o.selectListDisplayName=i[t].currency.currencyCode+" - "+this.currencies()[r].displayName);a.push(o)}a.sort(function(e,t){return e.selectListDisplayName.localeCompare(t.selectListDisplayName)}),e(a)},o.prototype.checkCurrencySymbol=function(){this.currencyObject().symbol.match(/^[0-9a-zA-Z]+$/)&&(this.currencyObject().symbol=this.currencyObject().symbol+" ")},o.prototype.handleFractionalDigits=function(e,t){var r;if(r="number"==typeof t?t:this.currencyObject()?this.currencyObject().fractionalDigits:2,null===e||""===e)return e;var i=(e+"e").split("e"),a=Math.round(i[0]+"e"+(+i[1]+r));return i=(a+"e").split("e"),e=+(i[0]+"e"+(+i[1]-r)),e.toString()},o.prototype.handleFractionalDigitsAndLocale=function(e){var t;return t=null!==this.setFractionalDigits()?this.setFractionalDigits():this.currencyObject()?this.currencyObject().fractionalDigits:2,null==e||""===e?e:e=i.formatNumber(e,t,this.DECIMAL_NUMBER_FORMAT)},o.prototype.getCurrencyMapCurrencies=function(){var e={};e.defaultFirst=!0,t.request(r.ENDPOINT_LIST_PRICE_LIST_GROUPS,e,this.getCurrencyMapCurrenciesSuccess.bind(this),this.getCurrencyMapCurrenciesError.bind(this))},o.prototype.getCurrencyMapCurrenciesSuccess=function(e){e.defaultPriceListGroupId=e.defaultPriceListGroup.id,$.each(e.items,function(t){e.items[t].isDefaultPriceListGroup=e.items[t].id===e.defaultPriceListGroup.id}),this.currencyMapObject(e)},o.prototype.getCurrencyMapCurrenciesError=function(e){},new o}),define("profileHelper",["knockout","ccConstants"],function(e,t){"use strict";function r(){return this.profileData=e.observable(null),this.allowedActions=e.observableArray(null),this.pageAccesskeys={home:[t.DASHBOARD_TAB,t.DASHBOARD_MINI_TAB],catalog:[t.CATALOG_TAB],"price-groups":[t.CATALOG_TAB],"price-group":[t.CATALOG_TAB],marketing:[t.MARKETING_TAB],reporting:[t.REPORTS_TAB],media:[t.MEDIA_TAB],search:[t.SEARCH_TAB],accounts:[t.ACCOUNTS_TAB_AND_B2B_ENABLED],contacts:[t.ACCOUNTS_TAB_AND_B2B_ENABLED],design:[t.DESIGN_TAB],code:[t.DESIGN_TAB],publish:[t.WORKSETS_ACCESS],settings:[t.SETTINGS_TAB,t.SETTINGS_LIMITED_TAB],inventory:[t.CATALOG_TAB],css:[t.DESIGN_TAB],theme:[t.DESIGN_TAB],layout:[t.DESIGN_TAB]},this.restrictedSubTabAccess={emailSettings:[t.SETTINGS_TAB],webAPI:[t.SETTINGS_TAB],accessControl:[t.SETTINGS_TAB],extensions:[t.SETTINGS_TAB],abandonedCartSettings:[t.SETTINGS_TAB],storeEndpointSettings:[t.SETTINGS_TAB]},this.tourNavigationData={home:{url:t.HOME_PAGE},catalog:{url:t.AGENT_CATALOG_PAGE_CONTEXT},marketing:{url:t.MARKETING_PAGE},reporting:{url:t.REPORTING_PAGE},media:{url:t.MEDIA_PAGE},search:{url:t.SEARCH_PAGE},accounts:{url:t.ACCOUNTS_PAGE,lastStop:!1},design:{url:t.DESIGN_PAGE},code:{url:t.CODE_PAGE},publish:{url:t.PUBLISH_PAGE},serviceOperations:{url:t.SERVICE_OPERATIONS_PAGE},settings:{url:t.SETTINGS_SHIPPINGMETHODS_PAGE,lastStop:!1}},this}return r.prototype.isAuthorized=function(e){var t=this;if(e){var r=[];if($.isArray(e)?r=e:r.push(e),t.allowedActions&&t.allowedActions().length>0&&$(t.allowedActions()).filter(r).length>0)return!0}return!1},r.prototype.isAuthorizedForPage=function(e){var t=this,r=t.pageAccesskeys[e];if("undefined"!=typeof r&&null!==r)return t.isAuthorized(r)},r.prototype.isAuthorizedForSubTab=function(e){if(!e)return!0;var t=this,r=t.restrictedSubTabAccess[e];return"undefined"==typeof r||null===r||t.isAuthorized(r)},r.prototype.nextAuthorizedPage=function(e){if(e){var t=this,r=e.split("/");if(r&&(e=r[0]&&r[0].length>0?r[0]:r[1]),"undefined"==typeof e||null===e)return;var i=!1;for(var a in t.pageAccesskeys)if(t.pageAccesskeys.hasOwnProperty(a)&&(a===e&&(i=!0),i)){var o=t.pageAccesskeys[a];if(t.isAuthorized(o))return t.tourNavigationData[a]}return null}},new r}),define("ccKoExtensions",["knockout","jqueryui","currencyHelper","CCi18n","ccDate","ccNumber","profileHelper","ccLogger","pubsub","ccConstants","i18next","navigation","ccLazyImages"],function(e,t,r,i,a,o,n,s,l,c,d,u,p){"use strict";var h=c.ALLOW_HASHBANG,g=!1;window.history&&window.history.pushState&&(g=!0);var f=e.utils.parseHtmlFragment("<meta name=robots content=noindex>");!function(){var t,r,i,a,o=!0,n=200,s=300,l=100,c=200;a=function(e){0===$(e.target).closest(".popover").length&&t()},o=function(e,t){var r,i,a,o;return o=$(window),r=t.top-o.scrollTop(),i=t.left-o.scrollLeft(),r<l||r<c&&"top"===e?a="bottom":(r>o.height()-l||r>o.height()-c&&"bottom"===e)&&(a="top"),i<n||i<s&&"left"===e?a="right":(i>o.width()-n||i>o.width()-s&&"right"===e)&&(a="left"),a||e},t=function(){i&&(i.data("bs.popover").tip().off("keydown"),i.popover("destroy"),i=null,$(document).off("click",a),$(document).off("focusin",a))},r=function(r,o,n,s){var l,c=$(r);c.popover(o),l=c.data("bs.popover").tip(),l.hasClass("in")?(t(),c.filter(":focusable").length>0?c.focus():c.find(":focusable").focus()):(t(),l.css("z-index",n.zIndex),l.css("min-height",n.minHeight),l.css("min-width",n.minWidth),l.children(".popover-content").attr("data-bind","template: {name: '"+n.name+"', templateUrl: '"+n.templateUrl+"', afterRender: registerCallbacks}"),l.keydown(function(e){27!==e.which&&13!==e.which||t()}),window.setTimeout(function(){$(document).click(a),$(document).focusin(a)},1),c.popover("show"),i=c,e.cleanNode(l[0]),e.applyBindingsToDescendants(s,l[0]))},e.bindingHandlers.infoPopover={init:function(a,n,s,l){var c,d,u,p,h=n(),g=h.model||l,f=e.bindingHandlers.tabTrap;i=!1,d={html:!0,trigger:h.trigger||"click",content:"<div class='"+h.class+"'></div>",container:h.container||"body",placement:h.placement||"bottom",title:h.title?"<strong>"+h.title+"</strong><a id='cc-popover-close' href='#' class='pull-right cc-close-link' data-bind='click: close'><i class='fa fa-times'></i></a>":""},p=h.focusOn||"",c=$(a),u={model:h.model||l,close:function(){return t(),c.filter(":focusable").length>0||c.find(":focusable").focus(),!1},registerCallbacks:function(e){if($(e).find(p).focus(),f.constrain($(".popover.in")),Array.isArray(h.callbacks))for(var r=0;r<h.callbacks.length;r++){var i=h.callbacks[r];$(i.elementId).on(i.eventType,function(){t(),i.callback()})}}},c.click(function(e){e.preventDefault(),d.placement=o(h.placement,c.offset()),g.hasOwnProperty("popoverCallbackFunction")?g.beforePopupRender(r.bind(self,a,d,h,u),t.bind(self)):(r(a,d,h,u),c.data("bs.popover").tip().draggable())}),"hover"==d.trigger&&(c.mouseenter(function(e){$(a).data("bs.popover",null),d.placement=o(h.placement,c.offset()),r(a,d,h,u),c.data("bs.popover").tip().css("pointer-events","none")}),c.mouseleave(function(e){t()}))}}}(),e.bindingHandlers.inTabFlow={update:function(t,r){var i=e.utils.unwrapObservable(r());"A"==$(t).prop("tagName")?$(t).attr("tabindex",i?0:-1):$(t).find(":input").attr("tabindex",i?0:-1)}},e.bindingHandlers.validatableValue={init:function(t,r,i,a,o){var n=r(),s=o.$parent.ignoreBlur;if($(t).blur(function(){return!(!s||!s())||void(n.isModified&&e.isObservable(n.isModified)&&n.isModified(!0))}),n.rules&&e.isObservable(n.rules))for(var l=n.rules().length,c=0;c<l;++c)if("required"===n.rules()[c].rule){n.rules()[c].params===!0&&$(t).attr("required","required");break}e.bindingHandlers.value.init(t,r,i,a,o)},update:function(t,r,i,a,o){e.bindingHandlers.value.update(t,r,i,a,o)}},e.bindingHandlers.validatableTarget={init:function(t,r,i,a,o){var n=r();$(t).blur(function(){n.isModified&&e.isObservable(n.isModified)&&n.isModified(!0)})}},e.bindingHandlers.ccLink={init:function(t,r,i,a,o){t.addEventListener("click",function(e){var r={usingCCLink:!0};if($(t).trigger("click.cc.unsaved",r),r.preventDefault)e.stopImmediatePropagation();else{var i=t.pathname+t.search;i&&window.location.pathname!==i&&u.goTo(i)}return e.preventDefault(),!1},!1);var n,s=e.utils.unwrapObservable(r()),l=s;if(s){if("string"==typeof s){var d=null,p=s;if(a.links)d=a;else{n=o.$parents;for(var g=0;g<n.length;g++)if(n[g].links){d=n[g];break}}d&&(l=d.links()[p])}if(l){var f="";l.url?f=l.url:l.route&&(f=l.route);var m=o.$masterViewModel;m&&m.isPreview&&!m.isPreview()&&m.storeConfiguration.allowSiteSwitchingOnProduction&&m.storeConfiguration.allowSiteSwitchingOnProduction()&&window.siteIdOnURL&&window.siteIdOnURL.length>0&&(f+=f.indexOf("?")==-1?"?"+c.URL_SITE_PARAM+"="+encodeURIComponent(window.siteIdOnURL):"&"+c.URL_SITE_PARAM+"="+encodeURIComponent(window.siteIdOnURL));var I=f;h&&(I="#!"+f);var E="";if(!window.isAgentApplication&&window.siteBaseURLPath&&"/"!==window.siteBaseURLPath?E=window.siteBaseURLPath:window.applicationContextPath&&"/"!==window.applicationContextPath&&(E=window.applicationContextPath),window.urlLocale){var y=JSON.parse(window.urlLocale)[0].name;E+="/"+y}$(t).prop("href",E+f),0===$(t).children().length&&""==$.trim($(t).text())&&(l.displayName?$(t).text(l.displayName):$(t).text(window.location.href+I))}}}},e.bindingHandlers.ccNavigation={update:function(t,r,i,a,o){var n=e.utils.unwrapObservable(r());$(t).on("click.cc.nav",function(e){var r=t.pathname+t.search,i={usingCCLink:!0};return $(t).trigger("click.cc.unsaved",i),"prevent"==n||i.preventDefault||u.goTo(r),e.preventDefault(),e.stopImmediatePropagation(),!1})}},e.bindingHandlers.triggerMessage={update:function(t,r){var i=r();if(i.triggerFired&&e.isObservable(i.triggerFired)){var a=function(){return i.triggerFired()?i.triggerMessage:null},o=function(){return!!i.triggerFired()};e.bindingHandlers.text.update(t,a),e.bindingHandlers.visible.update(t,o)}}},e.bindingHandlers.widgetLocaleText={update:function(e,t,r,i,a){var o,n,s=t();if(i.translate)n=i;else for(var l=a.$parents,c=0;c<l.length;c++)if(l[c].translate){n=l[c];break}"string"==typeof s?o=n.translate(s,null,!0):"object"==typeof s&&void 0!=s.value&&(o=n.translate(s.value,s.params,!0,s.custom)),o&&("string"==typeof s||"object"==typeof s&&"innerText"==s.attr?$(e).text(o):"object"==typeof s&&void 0!=s.attr&&$(e).attr(s.attr,o))}},e.bindingHandlers.disabled={update:function(t,r,i,a,o){var n,s,l=!1,c=r();if("boolean"==typeof c?l=e.utils.unwrapObservable(c):"object"==typeof c&&void 0!=c.condition&&(l=e.utils.unwrapObservable(c.condition),void 0!=c.click&&(n=e.utils.unwrapObservable(c.click)),void 0!=c.link&&(s=function(){return e.utils.unwrapObservable(c.link)})),l){$(t).off("click.handler");var d=$(t).prop("tagName");"A"==d&&$(t).attr("href","#"),$(t).on("click.handler",function(e){return e.stopImmediatePropagation(),!1}),$(t).addClass("disabled")}else $(t).removeClass("disabled"),$(t).off("click.handler"),n&&$(t).on("click.handler",function(){var e=n.bind(a);return e(),!1}),s&&e.bindingHandlers.ccLink.init(t,s,i,a,o)}},e.bindingHandlers.ccDate={update:function(t,r,i,o,n){var s=r(),l=e.utils.unwrapObservable(s),c=e.utils.unwrapObservable(l.date),d=e.utils.unwrapObservable(l.format),u=e.utils.unwrapObservable(l.returnedType),p=e.utils.unwrapObservable(l.returnedDate);p=a.formatDateAndTime(c,d,u,p),$(t).text(p)}},e.bindingHandlers.ccResizeImage={getNoImageSiteSetting:function(t){for(var r=null,i=0;i<t.$parents.length;i++)if(e.isObservable(t.$parents[i].site)){r=e.unwrap(t.$parents[i].site().noImageSrc);break}return r},init:function(t,r,i,a,o){var n,s,l,c,d,u=e.utils.unwrapObservable(r());"object"==typeof u&&"IMG"===t.nodeName&&(n=e.utils.unwrapObservable(u.src),s=e.utils.unwrapObservable(u.errorSrc),l=e.bindingHandlers.productImageSource.getNoImageSiteSetting(o),c=l&&l.length>0?l:s,n&&c&&(d=new Image,d.src=c))},update:function(t,r,i,a,o){var n,s,l,d,u,h,g,f,m,I,E,y,v,b="",T=!1,P=-1,S=e.utils.unwrapObservable(r()),C=c.DEFAULT_IMG_SIZE_FOR_VIEWPORT,_=["xsmall","small","medium","large"],A=function(e){if(e){var t=e.split(",");return 2==t.length&&(!isNaN(t[0])&&!isNaN(t[1]))}return!1},O=function(){var t=document.createElement("img"),r="srcset"in t,i="sizes"in t,a=S.isSrcSetEnabled&&e.utils.unwrapObservable(S.isSrcSetEnabled);return r&&i&&a},R=function(){var t="",r=e.utils.unwrapObservable(S.outputFormat),i=e.utils.unwrapObservable(S.quality),a=e.utils.unwrapObservable(S.alphaChannelColor);return r&&(t="&"+c.IMAGE_OUTPUT_FORMAT+"="+r),i&&(t=t+"&"+c.IMAGE_QUALITY+"="+i),a&&(t=t+"&"+c.IMAGE_ALPHA_CHANNEL_COLOR+"="+a),t},N=function(t,r,i){var a="";S[t+"_img"]?a=e.utils.unwrapObservable(S[t+"_img"]):i&&(a=w(i,r.imageHeight,r.imageWidth));var o=R();o&&(0===a.indexOf(c.ENDPOINT_IMAGES+"?source=")?a+=o:a=c.ENDPOINT_IMAGES+"?source="+a+o);C[t].width;if(a&&r.imageWidth)return a=a+" "+r.imageWidth+"w"},D=function(t){var r,i={},a=t?t:$(window)[0].innerWidth||$(window).width();"large"==a||a>=c.VIEWPORT_LARGE_DESKTOP_LOWER_WIDTH?(i.imageHeight=C.large.height,i.imageWidth=C.large.width,i.minWidth=C.large.minWidth,r="large"):"medium"==a||a>c.VIEWPORT_TABLET_UPPER_WIDTH&&a<c.VIEWPORT_LARGE_DESKTOP_LOWER_WIDTH?(i.imageHeight=C.medium.height,i.imageWidth=C.medium.width,i.minWidth=C.medium.minWidth,i.maxWidth=C.medium.maxWidth,r="medium"):"small"==a||a>=c.VIEWPORT_TABLET_LOWER_WIDTH&&a<=c.VIEWPORT_TABLET_UPPER_WIDTH?(i.imageHeight=C.small.height,i.imageWidth=C.small.width,i.minWidth=C.small.minWidth,i.maxWidth=C.small.maxWidth,r="small"):(i.imageHeight=C.xsmall.height,i.imageWidth=C.xsmall.width,i.maxWidth=C.xsmall.maxWidth,r="xsmall");var o=!1;switch(r){case"large":A(e.utils.unwrapObservable(S.large))&&(i.imageHeight=S.large.split(",")[0],i.imageWidth=S.large.split(",")[1],o=!0);break;case"medium":A(e.utils.unwrapObservable(S.medium))&&(i.imageHeight=S.medium.split(",")[0],i.imageWidth=S.medium.split(",")[1],o=!0);break;case"small":A(e.utils.unwrapObservable(S.small))&&(i.imageHeight=S.small.split(",")[0],i.imageWidth=S.small.split(",")[1],o=!0);break;case"xsmall":A(e.utils.unwrapObservable(S.xsmall))&&(i.imageHeight=S.xsmall.split(",")[0],i.imageWidth=S.xsmall.split(",")[1],o=!0)}if(!o)if(A(e.utils.unwrapObservable(S.size)))i.imageHeight=S.size.split(",")[0],i.imageWidth=S.size.split(",")[1];else if(e.utils.unwrapObservable(S.size))switch(e.utils.unwrapObservable(S.size)){case"large":A(e.utils.unwrapObservable(S.large))?(i.imageHeight=S.large.split(",")[0],i.imageWidth=S.large.split(",")[1],o=!0):(i.imageHeight=C.large.height,i.imageWidth=C.large.width);break;case"medium":A(e.utils.unwrapObservable(S.medium))?(i.imageHeight=S.medium.split(",")[0],i.imageWidth=S.medium.split(",")[1],o=!0):(i.imageHeight=C.medium.height,i.imageWidth=C.medium.width);break;case"small":A(e.utils.unwrapObservable(S.small))?(i.imageHeight=S.small.split(",")[0],i.imageWidth=S.small.split(",")[1],o=!0):(i.imageHeight=C.small.height,i.imageWidth=C.small.width);break;case"xsmall":A(e.utils.unwrapObservable(S.xsmall))?(i.imageHeight=S.xsmall.split(",")[0],i.imageWidth=S.xsmall.split(",")[1],o=!0):(i.imageHeight=C.xsmall.height,i.imageWidth=C.xsmall.width)}return i},L=function(e){if(e){var t=e.minWidth,r=e.maxWidth,i=e.imageWidth,a="";t&&(a="(min-width:"+t+"px)");var o="";return r&&(o="(max-width:"+r+"px)"),a&&o&&i?a+" and "+o+" "+i+"px":a&&i?a+" "+i+"px":o&&i?o+" "+i+"px":""}},w=function(e,t,r){if(e.indexOf(c.ENDPOINT_IMAGES+"?source=")>-1){var i=/height=[0-9]+/i;e.search(i)&&(e=e.replace(i,"height="+t));var a=/width=[0-9]+/i;return e.search(a)&&(e=e.replace(a,"width="+r)),e}return c.ENDPOINT_IMAGES+"?source="+e+"&height="+t+"&width="+r};if("object"==typeof S&&"IMG"===t.nodeName){var M=D();I=M.imageHeight,E=M.imageWidth;var U=!S.setMinHeightBeforeImageLoad||!e.utils.unwrapObservable(S.isSetMinHeightBeforeImageLoad)||e.utils.unwrapObservable(S.isSetMinHeightBeforeImageLoad);if(t.parentNode&&U){var k=t.parentNode;if("cc_img__resize_wrapper"!==k.getAttribute("id")){var x=document.createElement("div");t.onload=function(){if(x.style.minHeight="0px",this.src.indexOf(u)>-1&&O()&&!this.dataset.lazyLoading){for(var e="",r="",i=0;i<_.length;i++){var a=D(_[i]),o=N(_[i],a,u);o&&e.indexOf(o)<0&&(e=e?e+","+o:o);var n=L(a);n&&(r=r?r+","+n:n)}!e||void 0!==t.srcset&&t.srcset===e||(t.srcset=e),!r||void 0!==t.sizes&&t.sizes===r||(t.sizes=r)}},x.style.maxWidth="100%",x.style.minHeight=I+"px",x.style.height="100%";var G=e.utils.unwrapObservable(S.id);G?x.setAttribute("id","cc_img__resize_wrapper-"+G):x.setAttribute("id","cc_img__resize_wrapper"),k.replaceChild(x,t),x.appendChild(t)}}b=R(),s=e.utils.unwrapObservable(S.source),s?(n=O()?s:w(s,I,E),b&&(n+=b)):n=S.errorSrc,l=e.utils.unwrapObservable(S.errorSrc),null!=l&&0!=l.length||(l=c.SITE_DEFAULT_NO_IMAGE_URL),d=e.bindingHandlers.ccResizeImage.getNoImageSiteSetting(o),u=d&&d.length>0?d:l,s=encodeURI(s),0==s.indexOf(c.SITE_DEFAULT_NO_IMAGE_URL)&&(n=u,s=u),h||(h=e.utils.unwrapObservable(S.alt)),g||(g=e.utils.unwrapObservable(S.title)),f=e.utils.unwrapObservable(S.errorAlt),m=e.utils.unwrapObservable(S.onerror);var F=o.$masterViewModel,H=e.utils.unwrapObservable(S.disableLazyImageLoading);if(H||!F||!F.storeConfiguration||F.storeConfiguration.lazilyLoadImages!==!0||"prerenderReady"in window||s===u||p.isImageVisible(t,n)||(T=!0),T&&(y=e.utils.unwrapObservable(S.initialSrc),y?(v=O()?y:w(y,I,E),b&&(v+=b)):y=S.errorSrc?S.errorSrc:u,y=encodeURI(y),0==y.indexOf(c.SITE_DEFAULT_NO_IMAGE_URL)&&(v=u,y=u),F.storeConfiguration.delayBeforeLoadingOutOfFocusImages&&(P=F.storeConfiguration.delayBeforeLoadingOutOfFocusImages)),n){if(h&&(t.alt=h),g&&(t.title=g),t.onerror=function(){var e=new Image;e.onload=function(){t.src=u,t.srcset&&t.removeAttribute("srcset"),t.sizes&&t.removeAttribute("sizes"),m&&m(t),t.onerror=""},e.onerror=function(){var e=new Image;e.onload=function(){t.src=e.src,t.srcset&&t.removeAttribute("srcset"),t.sizes&&t.removeAttribute("sizes"),m&&m(t),t.onerror=""},e.onerror=function(){t.src=c.SITE_DEFAULT_NO_IMAGE_URL,t.srcset&&t.removeAttribute("srcset"),t.sizes&&t.removeAttribute("sizes"),m&&m(t),t.onerror=""},e.src=l},n===u&&(u=u===d?l:c.SITE_DEFAULT_NO_IMAGE_URL),e.src=u,f&&(t.alt=f)},T?(t.dataset.errorSrc=u,t.dataset.defaultErrorSrc=l,m&&(t.dataset.onerror=m),f&&(t.dataset.errorAlt=f),p.setupLazyLoadStyling(t,S),t.dataset.src=n,p.observeLazyImage(t,P),t.src=v):t.src=n,O()&&n!==u){for(var V="",Y="",B=0;B<_.length;B++){var q=D(_[B]),j=N(_[B],q,s);j&&V.indexOf(j)<0&&(V=V?V+","+j:j);var W=L(q);W&&(Y=Y?Y+","+W:W)}V&&(T?t.dataset.srcset=V:t.srcset=V),Y&&(T?t.dataset.sizes=Y:t.sizes=Y)}if(T&&O()&&v!==u){for(var K="",z="",B=0;B<_.length;B++){var q=D(_[B]),j=N(_[B],q,y);j&&K.indexOf(j)<0&&(K=K?K+","+j:j);var W=L(q);W&&(z=z?z+","+W:W)}K&&(t.srcset=K),z&&(t.sizes=z)}}else t.src=u,f?t.alt=f:h&&(t.alt=h),m&&m(t)}}},e.bindingHandlers.ccNumber={update:function(t,r,i,a,n){var s=r(),l=e.utils.unwrapObservable(s),c=null;c=o.formatNumber(l),$(t).text(c)}},e.bindingHandlers.setContextVariable={update:function(t,r,i,a,o){var n=e.utils.unwrapObservable(r());o["$"+n.name]=e.utils.unwrapObservable(n.value)}},e.virtualElements.allowedBindings.setContextVariable=!0,e.bindingHandlers.element={init:function(t,r,i,a,o){var n=e.utils.unwrapObservable(r()),l=a.jsPath()+"/";for(var c in a.elementsJs)if(n===c&&a.elementsJs.hasOwnProperty(c)){var d=a.elementsJs[c]();if(null!==d){var u="widget/",p=d.indexOf(u)+u.length;d.substring(0,p-1),d.lastIndexOf(".");require({baseUrl:l},[d],function(e){"function"==typeof e?e():e.hasOwnProperty("onLoad")&&"function"==typeof e.onLoad&&e.onLoad(a);var t=e.elementName;a.hasOwnProperty(t)?s.warn("Element name "+t+" is same as existing property"):a[t]=e,a.elements[t]=e,a.initialized()&&a.initialized.valueHasMutated()})}}return{controlsDescendantBindings:!0}},update:function(t,r,i,a,o){var n,s,l=e.utils.unwrapObservable(r());if(l){if("string"==typeof l)n=l;else{if("object"!=typeof l||void 0==l.type)return;n=l.type,void 0!=l.id&&(s=l.id)}s&&""!==s||(s=i().id&&""!==i().id?i().id:"id");var c=o.$data.id&&o.$data.id()?o.$data.id():"",d=o.$data.typeId&&o.$data.typeId()?o.$data.typeId():"",u={};u.type=n,u.fullType=d+"-"+n,u.id=s,u.textId="text."+s,u.elementId=c+"-"+n+"-"+s,u.styles="",""!==s&&o.$elementConfig&&(u.config=o.$elementConfig[s],u.config&&u.config.font&&(u.styles=u.config.font.styles||"",u.config.font.styles.display&&"block"===u.config.font.styles.display&&u.config.padding&&(u.config.padding.paddingTop>0||u.config.padding.paddingBottom>0||u.config.padding.paddingLeft>0||u.config.padding.paddingRight>0)&&(u.styles.padding=u.config.padding.paddingTop+"px "+u.config.padding.paddingRight+"px "+u.config.padding.paddingBottom+"px "+u.config.padding.paddingLeft+"px"))),$(t).attr("id",u.elementId),""!=u.styles&&$(t).css(u.styles),o.$elementInstance=u;var p={};p.name=u.fullType,p.data=a,p.url="",e.bindingHandlers.template.update(t,function(){return p},i,a,o)}}},e.bindingHandlers.addTemplate={update:function(t,r,i,a,o){var n=e.utils.unwrapObservable(r());"string"==typeof n&&$(n).not("text").each(function(){var e=this.id;e&&""!==e&&0==$("body").find("#"+e).length&&$("body").append(this)})}},e.virtualElements.allowedBindings.addTemplate=!0,e.bindingHandlers.previewBar={update:function(t,r,i,a,o){var n=e.utils.unwrapObservable(r());if(n&&o.$data.previewBar){var s=o.$data.previewBar,l=s.cssPath,c=s.templateUrl,d=s.templateName;$("link[href='"+l+"']").length||$('<link href="'+l+'" rel="stylesheet">').appendTo("head");var u={};u.name=d,u.data=a,u.templateUrl=c,u.afterRender=s.attachEventHandlers,$.when(s.ojLoaded).done(function(){e.bindingHandlers.template.update(t,function(){return u},i,a,o)})}}},e.virtualElements.allowedBindings.previewBar=!0,e.bindingHandlers.noIndexMeta={update:function(t,r,i,a,o){var n=e.utils.unwrapObservable(r());n?e.virtualElements.setDomNodeChildren(t,f):e.virtualElements.emptyNode(t)}},e.virtualElements.allowedBindings.noIndexMeta=!0,e.bindingHandlers.embeddedAssistance={init:function(t,r,i,a,o){var n=r();n.subscribe(function(){e.bindingHandlers.embeddedAssistance.update(t,r,i,a,o)})},update:function(t,r,i,a,o){var n=r();n.extend({validatable:!0});var s=!1,l=!1;s=n.isModified()&&n().length>0,l=n.isValid();var c=function(){return s?l?null:n.embeddedAssistance:null},d=function(){return!!s&&!l};e.bindingHandlers.text.update(t,c),e.bindingHandlers.visible.update(t,d)}},e.extenders.propertyWatch=function(t,r){var i=r&&r.throttle?r.throttle:100;return t.initialState=e.observable(e.toJSON(t)),t.resetWatch=function(){t.initialState(e.toJSON(t))},t.hasChanged=e.computed(function(){var r=t.initialState()!==e.toJSON(t);return r&&t.resetWatch(),r}).extend({notify:"always",throttle:i}).extend({notify:"always"}),t},e.extenders.trigger=function(t,r){return t.triggerSet=!1,t.triggerValue=null,t.triggerMessage="",t.triggerFired=e.observable(!1),r&&(r.value&&(t.triggerValue=r.value,t.triggerSet=!0),r.message&&(t.triggerMessage=r.message)),t.trigger=function(e){t()===t.triggerValue?t.triggerFired(!0):t.triggerFired(!1)},t.clearTrigger=function(){t.triggerFired(!1)},t.triggerSet&&t.subscribe(t.trigger),t},e.bindingHandlers.accessControl={init:function(t,r,i){var a=i().accessControl,o=a.defaultAction?a.defaultAction:c.HIDE;n.isAuthorized(a.accessKey)?o===c.SHOW&&($(t).hide(),e.virtualElements.emptyNode(t)):o===c.SHOW||($(t).hide(),e.virtualElements.emptyNode(t))}},e.virtualElements.allowedBindings.accessControl=!0,e.showMoreArray=function(t,r){
- var i=e.observableArray(t);return i.limit=r,i.showAll=e.observable(!1),i.showButton=i().length>i.limit,i.toggleShowAll=function(){i.showAll(!i.showAll())},i.display=e.computed(function(){return i.showAll()||!i.showButton?i():i().slice(0,i.limit)},i),i},e.bindingHandlers.agentBar={update:function(t,r,i,a,o){var n=e.utils.unwrapObservable(r());if(n){var s=(o.$data,"/shared/css/agent-bar.css");$("link[href='"+s+"']").length||$('<link href="'+s+'" rel="stylesheet">').appendTo("head");var l={};l.name="agent-bar.template",l.data=a,l.templateUrl="/shared/templates",e.bindingHandlers.template.update(t,function(){return l},i,a,o)}}},e.virtualElements.allowedBindings.agentBar=!0,e.extenders.numeric=function(t,r){var i=e.computed({read:t,write:function(e){var i=/^-?[0-9]+([.][0-9]+)?$/,a=i.test(e);if(t(e),a){var o=t(),n=Math.pow(10,r),s=isNaN(e)?0:+e,l=Math.round(s*n)/n;l!==o?t(l):e!==o&&t.notifySubscribers(t())}}}).extend({notify:"always"});return i(t()),i},e.bindingHandlers.fireChange={update:function(e,t,r){var i=r();if(null!=i.value&&(!$(e).data("previousVal")||$(e).data("previousVal")!=i.value)){i.event.change();var a=i.value;$(e).data("previousVal",a)}}}}),define("ccKoErrorWrapper",["knockout","ccLogger","ccRestClient"],function(e,t,r){"use strict";function i(r){return function(){try{return r.apply(this,arguments)}catch(r){t.error(r);var i=arguments[0],a=e.contextFor($(i)[0]).$root;if(a&&a.isPreview&&a.isPreview()){var o=$(i).parents(".widget-container,.stack-container");o.length>0&&(o.find(".stack-template,.displayTemplate").addClass("error"),o.find("div.display-error").show(),o.find("span.error-msg").first().text(r.message));var n=$(i).prev("div.sf-display-error");0==n.length&&(n=$(i).parents().prev("div.sf-display-error")),n.length>0&&(n.show(),n.find("span.sf-error-msg").text(r.message),n.next("div").addClass("sf-error"))}}}}var a,o=["attr","css","template","text","style","value"];if(r.previewMode)for(a in o){var n=o[a];if(e.bindingHandlers[n]&&e.bindingHandlers[n].update){var s=e.bindingHandlers[n].update;e.bindingHandlers[n].update=i(s)}}}),define("shared/store-loader",["knockout","koMapping","koExternalTemplate","bootstrap","koExtensions","ccKoExtensions","ccKoValidateRules","ccKoErrorWrapper"],function(e,t){"use strict";$.uiBackCompat=!1,infuser.defaults.templateSuffix=".template",e.mapping=t,Function.prototype.bind||(Function.prototype.bind=function(e){if("function"!=typeof this)throw new TypeError("Function.prototype.bind - what is trying to be bound is not callable");var t=Array.prototype.slice.call(arguments,1),r=this,i=function(){},a=function(){return r.apply(this instanceof i&&e?this:e,t.concat(Array.prototype.slice.call(arguments)))};return i.prototype=this.prototype,a.prototype=new i,a})}),define("ccResourceLoader",["module","ccLogger"],function(e,t){function r(e){var t=e.indexOf(a),r=e.indexOf(o);if(r==-1&&(r=e.indexOf(n)),t>-1&&r>-1)return e.substring(t,r)}function i(){function a(e,t){i.moduleUrls[e]=t}function o(e){return i.moduleUrls[e]}function n(t,o,n){var s=e.config();o(s.jsUrls,function(){for(var e=arguments,o=0;o<e.length;o++){var l=e[o];l&&(i.modules.push(l),l.onLoad&&l.onLoad());var c=r(s.jsUrls[o]);a(c,s.jsUrls[o])}n(t)})}function l(e,r,i){var a=o(e);a?r([a],function(e){i(e)},function(r){t.error("Module "+e+" could not be loaded :"+r),i()}):(t.warn(" Url for Module "+e+" was not found."),i())}var c=this;i.moduleUrls={},i.modules=[],c.load=function(t,r,i,a){e.config();a.isBuild?i():t==s?n(t,r,i):l(t,r,i)},c.callAppLevelJsMethod=function(e,t){for(var r=0;r<i.modules.length;r++){var a=i.modules[r];e in a&&"function"==typeof a[e]&&a[e].apply(a,t)}}}var a="global",o=".min.js",n=".js",s="APPLICATION_JS";return new i}),!function(e,t,r){"function"==typeof define&&define.amd?define("jquerymswipe",["jquery"],function(i){return r(i,e,t),i.mobile}):r(e.jQuery,e,t)}(this,document,function(e,t,r,i){var a,o;!function(e,t,r,i){function a(e){for(;e&&void 0!==e.originalEvent;)e=e.originalEvent;return e}function o(t){for(var r,i,a={};t;){r=e.data(t,b);for(i in r)r[i]&&(a[i]=a.hasVirtualBinding=!0);t=t.parentNode}return a}function n(){M=!0}function s(){M=!1}function l(){c(),O=setTimeout(function(){O=0,G=0,L.length=0,w=!1,n()},e.vmouse.resetTimerDuration)}function c(){O&&(clearTimeout(O),O=0)}function d(t,r,o){var n;return(o&&o[t]||!o&&function(t,r){for(var i;t;){if((i=e.data(t,b))&&(!r||i[r]))return t;t=t.parentNode}return null}(r.target,t))&&(n=function(t,r){var o,n,s,l,c,d,u,p,h,g=t.type;if((t=e.Event(t)).type=r,o=t.originalEvent,n=C,g.search(/^(mouse|click)/)>-1&&(n=_),o)for(u=n.length;u;)t[l=n[--u]]=o[l];if(g.search(/mouse(down|up)|click/)>-1&&!t.which&&(t.which=1),-1!==g.search(/^touch/)&&(g=(s=a(o)).touches,c=s.changedTouches,d=g&&g.length?g[0]:c&&c.length?c[0]:i))for(p=0,h=P.length;p<h;p++)t[l=P[p]]=d[l];return t}(r,t),e(r.target).trigger(n)),n}function u(t){var r,i=e.data(t.target,T);w||G&&G===i||(r=d("v"+t.type,t))&&(r.isDefaultPrevented()&&t.preventDefault(),r.isPropagationStopped()&&t.stopPropagation(),r.isImmediatePropagationStopped()&&t.stopImmediatePropagation())}function p(t){var r,i,n,l=a(t).touches;l&&1===l.length&&(i=o(r=t.target)).hasVirtualBinding&&(G=x++,e.data(r,T,G),c(),s(),D=!1,n=a(t).touches[0],R=n.pageX,N=n.pageY,d("vmouseover",t,i),d("vmousedown",t,i))}function h(e){M||(D||d("vmousecancel",e,o(e.target)),D=!0,l())}function g(t){if(!M){var r=a(t).touches[0],i=D,n=e.vmouse.moveDistanceThreshold,s=o(t.target);(D=D||Math.abs(r.pageX-R)>n||Math.abs(r.pageY-N)>n)&&!i&&d("vmousecancel",t,s),d("vmousemove",t,s),l()}}function f(e){if(!M){n();var t,r,i=o(e.target);d("vmouseup",e,i),D||(t=d("vclick",e,i))&&t.isDefaultPrevented()&&(r=a(e).changedTouches[0],L.push({touchID:G,x:r.clientX,y:r.clientY}),w=!0),d("vmouseout",e,i),D=!1,l()}}function m(t){var r,i=e.data(t,b);if(i)for(r in i)if(i[r])return!0;return!1}function I(){}function E(t){var r=t.substr(1);return{setup:function(){m(this)||e.data(this,b,{}),e.data(this,b)[t]=!0,A[t]=(A[t]||0)+1,1===A[t]&&k.bind(r,u),e(this).bind(r,I),U&&(A.touchstart=(A.touchstart||0)+1,1===A.touchstart&&k.bind("touchstart",p).bind("touchend",f).bind("touchmove",g).bind("scroll",h))},teardown:function(){--A[t],A[t]||k.unbind(r,u),U&&(--A.touchstart,A.touchstart||k.unbind("touchstart",p).unbind("touchmove",g).unbind("touchend",f).unbind("scroll",h));var i=e(this),a=e.data(this,b);a&&(a[t]=!1),i.unbind(r,I),m(this)||i.removeData(b)}}}var y,v,b="virtualMouseBindings",T="virtualTouchID",P="clientX clientY pageX pageY screenX screenY".split(" "),S="vmouseover vmousedown vmousemove vmouseup vclick vmouseout vmousecancel".split(" "),C="altKey bubbles cancelable ctrlKey currentTarget detail eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),_=e.event.props?e.event.props.concat(C):C,A={},O=0,R=0,N=0,D=!1,L=[],w=!1,M=!1,U="addEventListener"in r,k=e(r),x=1,G=0;for(e.vmouse={moveDistanceThreshold:10,clickDistanceThreshold:10,resetTimerDuration:1500},v=0;v<S.length;v++)e.event.special[S[v]]=E(S[v]);U&&r.addEventListener("click",function(t){var r,i,a,o,n,s=L.length,l=t.target;if(s)for(r=t.clientX,i=t.clientY,y=e.vmouse.clickDistanceThreshold,a=l;a;){for(o=0;o<s;o++)if(n=L[o],a===l&&Math.abs(n.x-r)<y&&Math.abs(n.y-i)<y||e.data(a,T)===n.touchID)return t.preventDefault(),void t.stopPropagation();a=a.parentNode}},!0)}(e,0,r),e.mobile={},o={touch:"ontouchend"in r},(a=e).mobile.support=a.mobile.support||{},a.extend(a.support,o),a.extend(a.mobile.support,o),function(e,t,i){function a(t,r,a,o){var n=a.type;a.type=r,o?e.event.trigger(a,i,t):e.event.dispatch.call(t,a),a.type=n}var o=e(r),n=e.mobile.support.touch,s="touchmove scroll",l=n?"touchstart":"mousedown",c=n?"touchend":"mouseup",d=n?"touchmove":"mousemove";e.each("touchstart touchmove touchend tap taphold swipe swipeleft swiperight scrollstart scrollstop".split(" "),function(t,r){e.fn[r]=function(e){return e?this.bind(r,e):this.trigger(r)},e.attrFn&&(e.attrFn[r]=!0)}),e.event.special.scrollstart={enabled:!0,setup:function(){function t(e,t){a(o,(r=t)?"scrollstart":"scrollstop",e)}var r,i,o=this;e(o).bind(s,function(a){e.event.special.scrollstart.enabled&&(r||t(a,!0),clearTimeout(i),i=setTimeout(function(){t(a,!1)},50))})},teardown:function(){e(this).unbind(s)}},e.event.special.tap={tapholdThreshold:750,emitTapOnTaphold:!0,setup:function(){var t=this,r=e(t),i=!1;r.bind("vmousedown",function(n){function s(){clearTimeout(d)}function l(){s(),r.unbind("vclick",c).unbind("vmouseup",s),o.unbind("vmousecancel",l)}function c(e){l(),i||u!==e.target?i&&e.preventDefault():a(t,"tap",e)}if(i=!1,n.which&&1!==n.which)return!1;var d,u=n.target;r.bind("vmouseup",s).bind("vclick",c),o.bind("vmousecancel",l),d=setTimeout(function(){e.event.special.tap.emitTapOnTaphold||(i=!0),a(t,"taphold",e.Event("taphold",{target:u}))},e.event.special.tap.tapholdThreshold)})},teardown:function(){e(this).unbind("vmousedown").unbind("vclick").unbind("vmouseup"),o.unbind("vmousecancel")}},e.event.special.swipe={scrollSupressionThreshold:30,durationThreshold:1e3,horizontalDistanceThreshold:30,verticalDistanceThreshold:30,getLocation:function(e){var r=t.pageXOffset,i=t.pageYOffset,a=e.clientX,o=e.clientY;return 0===e.pageY&&Math.floor(o)>Math.floor(e.pageY)||0===e.pageX&&Math.floor(a)>Math.floor(e.pageX)?(a-=r,o-=i):(o<e.pageY-i||a<e.pageX-r)&&(a=e.pageX-r,o=e.pageY-i),{x:a,y:o}},start:function(t){var r=t.originalEvent.touches?t.originalEvent.touches[0]:t,i=e.event.special.swipe.getLocation(r);return{time:(new Date).getTime(),coords:[i.x,i.y],origin:e(t.target)}},stop:function(t){var r=t.originalEvent.touches?t.originalEvent.touches[0]:t,i=e.event.special.swipe.getLocation(r);return{time:(new Date).getTime(),coords:[i.x,i.y]}},handleSwipe:function(t,r,i,o){if(r.time-t.time<e.event.special.swipe.durationThreshold&&Math.abs(t.coords[0]-r.coords[0])>e.event.special.swipe.horizontalDistanceThreshold&&Math.abs(t.coords[1]-r.coords[1])<e.event.special.swipe.verticalDistanceThreshold){var n=t.coords[0]>r.coords[0]?"swipeleft":"swiperight";return a(i,"swipe",e.Event("swipe",{target:o,swipestart:t,swipestop:r}),!0),a(i,n,e.Event(n,{target:o,swipestart:t,swipestop:r}),!0),!0}return!1},eventInProgress:!1,setup:function(){var t,r=this,i=e(r),a={};(t=e.data(this,"mobile-events"))||(t={length:0},e.data(this,"mobile-events",t)),t.length++,t.swipe=a,a.start=function(t){if(!e.event.special.swipe.eventInProgress){e.event.special.swipe.eventInProgress=!0;var i,n=e.event.special.swipe.start(t),s=t.target,l=!1;a.move=function(t){n&&!t.isDefaultPrevented()&&(i=e.event.special.swipe.stop(t),l||(l=e.event.special.swipe.handleSwipe(n,i,r,s))&&(e.event.special.swipe.eventInProgress=!1),Math.abs(n.coords[0]-i.coords[0])>e.event.special.swipe.scrollSupressionThreshold&&t.preventDefault())},a.stop=function(){l=!0,e.event.special.swipe.eventInProgress=!1,o.off(d,a.move),a.move=null},o.on(d,a.move).one(c,a.stop)}},i.on(l,a.start)},teardown:function(){var t,r;(t=e.data(this,"mobile-events"))&&(r=t.swipe,delete t.swipe,t.length--,0===t.length&&e.removeData(this,"mobile-events")),r&&(r.start&&e(this).off(l,r.start),r.move&&o.off(d,r.move),r.stop&&o.off(c,r.stop))}},e.each({scrollstop:"scrollstart",taphold:"tap",swipeleft:"swipe.left",swiperight:"swipe.right"},function(t,r){e.event.special[t]={setup:function(){e(this).bind(r,e.noop)},teardown:function(){e(this).unbind(r)}}})}(e,this)}),require.config({baseUrl:"js",packages:["packageAce",{name:"packageAce",location:"/shared/js/libs/ace",main:"ace"}],shim:{jqueryui:{deps:["jquery"]},jquerymobile:{deps:["jquery"]},jquery:{deps:[],exports:"$"},trafficCop:{deps:["jquery"]},infuser:{deps:["jquery","trafficCop"]},spectrumColorPicker:{deps:["jquery"]},bootstrapDatePicker:{deps:["jquery"]},bootstrapTimePicker:{deps:["jquery"]},bootstrap:{deps:["jquery"]},bstypeahead:{deps:["jquery"]},chosen:{deps:["jquery"]},imagesloaded:{deps:["jquery"]},facebook:{exports:"FB"}},paths:{jqueryui:"/shared/js/libs/jquery-ui-1.13.2.custom.min",jquerymswipe:"/shared/js/libs/jquery.mobile.swipe-1.4.5.min",i18next:"/shared/js/libs/i18next-21.3.2.min",i18nextBackend:"/shared/js/libs/i18nextHttpBackend-1.3.1",chosen:"/shared/js/libs/chosen.jquery-1.8.7.min",koMapping:"/shared/js/libs/knockout.mapping-2.4.1.min",koValidate:"/shared/js/libs/knockout.validation-2.0.3",trafficCop:"/shared/js/libs/TrafficCop-modified",infuser:"/shared/js/libs/infuser",bootstrap:"/shared/js/libs/bootstrap.3.1.1",bootstrapDatePicker:"/shared/js/libs/bootstrap-datepicker",bootstrapDatePickerLocales:"/shared/js/libs/locales",bootstrapTimePicker:"/shared/js/libs/bootstrap-timepicker",bootstrapSlider:"/shared/js/libs/bootstrap-slider",spectrumColorPicker:"/shared/js/libs/spectrum-1.8.0",bstypeahead:"/shared/js/libs/bootstrap3-typeahead",crossroads:"/shared/js/libs/crossroads.min",hasher:"/shared/js/libs/hasher-1.2.0",ccURLPatterns:"/shared/js/ccLibs/cc-url-patterns",moment:"/shared/js/libs/moment-2.29.4",momentLangs:"/shared/js/libs/moment",ccStoreConfiguration:"/shared/js/ccLibs/cc-store-configuration-1.0",profiletools:"/shared/js/ccLibs/profile-tools-1.0",ccConstants:"/shared/js/ccLibs/cc-constants",koExtensions:"/shared/js/ccLibs/ko-extensions",storageApi:"/shared/js/ccLibs/cc-storage-api-1.0",ccOAuthTimeout:"/shared/js/ccLibs/cc-oauth-timeout",ccRestClientConstructor:"/shared/js/ccLibs/cc-rest-client-1.0",ccRestClient:"/shared/js/ccLibs/storefront-rest-client",addThis:"/shared/js/ccLibs/addThis",ociApm:"/shared/js/ccLibs/ociApm",koExternalTemplate:"/shared/js/ccLibs/koExternalTemplateEngine-amd-2.0.5-modified",ccKoExtensions:"/shared/js/ccLibs/cc-ko-extensions",ccKoOjExtensions:"/shared/js/ccLibs/cc-ko-oj-extensions",ccKoErrorWrapper:"/shared/js/ccLibs/cc-ko-error-wrapper",xDomainProxy:"/shared/js/ccLibs/xdomain-proxy",pubsub:"/shared/js/ccLibs/pubsub-1.0",pubsubImpl:"/shared/js/ccLibs/pubsub-impl",routing:"/shared/js/ccLibs/routing-3.0",notifier:"/shared/js/ccLibs/notifier-1.0",notifications:"/shared/js/ccLibs/notifications-1.0",storeKoExtensions:"/shared/js/ccLibs/store-ko-extensions",ccLogger:"/shared/js/ccLibs/ccLogger-1.0",CCi18n:"/shared/js/ccLibs/cc-i18n",ccKoValidateRules:"/shared/js/ccLibs/cc-ko-validate-rules",paginated:"/shared/js/ccLibs/paginated",ccPaginated:"/shared/js/ccLibs/cc-paginated",spinner:"/shared/js/ccLibs/spinner-1.0",placeholderPatch:"/shared/js/ccLibs/cc-placeholder",imagesloaded:"/shared/js/libs/imagesloaded.pkgd-4.1.4",ccDate:"/shared/js/ccLibs/cc-date-format-1.0",ccNumber:"/shared/js/ccLibs/cc-number-format-1.0",ccPasswordValidator:"/shared/js/ccLibs/cc-password-validator",swmRestClientConstructor:"/shared/js/ccLibs/swm-rest-client-1.0",swmRestClient:"/shared/js/ccLibs/swm-storefront-rest-client",swmKoValidateRules:"/shared/js/ccLibs/swm-ko-validate-rules",ccResourceLoader:"/shared/js/ccLibs/cc-resource-loader",navigation:"/shared/js/ccLibs/cc-navigation-1.0",ccNavState:"/shared/js/ccLibs/cc-nav-state",facebook:"/shared/js/ccLibs/load-facebookjs-error-handler-1.0",facebookjs:"/shared/js/ccLibs/facebook_sdk",pinitjs:"/shared/js/ccLibs/pinit_sdk",imageZoom:"/shared/js/ccLibs/image-zoom",ccImageZoom:"/shared/js/ccLibs/cc-image-zoom-2.0",pageViewTracker:"/shared/js/ccLibs/pageViewTracker-1.0",currencyHelper:"/shared/js/ccLibs/currency-helper",profileHelper:"/shared/js/ccLibs/profile-helper",ccEETagProcessor:"/shared/js/ccLibs/cc-ee-tag-processor-1.0",viewportHelper:"/shared/js/ccLibs/viewport-helper",parentOrganisation:"/shared/js/ccLibs/parentOrganisation",ccClientErrorCodes:"/shared/js/ccLibs/cc-client-error-codes",sfExceptionHandler:"/shared/js/ccLibs/sf-exception-handler",ccStoreServerLogger:"/shared/js/ccLibs/cc-store-server-logger-1.0",ccStoreUtils:"/shared/js/ccLibs/cc-store-utils-1.0",dateTimeUtils:"/shared/js/ccLibs/date-time-utils",numberFormatHelper:"/shared/js/ccLibs/number-format-helper",ccStoreConfiguration:"/shared/js/ccLibs/cc-store-configuration-1.0",ccLazyImages:"/shared/js/ccLibs/cc-lazy-images",hammerjs:"/js/oraclejet/js/libs/hammer/hammer-2.0.8.min",jquery:"/js/oraclejet/js/libs/jquery/jquery-3.5.1.min","jqueryui-amd":"/js/oraclejet/js/libs/jquery/jqueryui-amd-1.12.1.min",knockout:"/js/oraclejet/js/libs/knockout/knockout-3.5.0",ojdnd:"/js/oraclejet/js/libs/dnd-polyfill/dnd-polyfill-1.0.0.min",ojs:"/js/oraclejet/js/libs/oj/v7.3.0/min",ojL10n:"/js/oraclejet/js/libs/oj/v7.3.0/ojL10n",ojtranslations:"/js/oraclejet/js/libs/oj/v7.3.0/resources",ojswitch:"/js/oraclejet/js/libs/oj/v7.3.0/min/ojswitch",promise:"/js/oraclejet/js/libs/es6-promise/es6-promise.min",signals:"/js/oraclejet/js/libs/js-signals/signals.min",template:"/js/oraclejet/js/libs/require/text",customElements:"/js/oraclejet/js/libs/webcomponents/custom-elements.min",pageLayout:"/shared/js/pageLayout",viewModels:"/shared/js/viewModels",shared:"/shared/js"},waitSeconds:45});var paths={layoutContainer:"pageLayout/layout-container"};if("function"==typeof configurePaths&&configurePaths(paths),"undefined"==typeof container)var container;var requiredDependencies=[];window.storeLibsPath?requiredDependencies.push(window.storeLibsPath):requiredDependencies.push("shared/store-libs"),window.clientConfigData&&"true"==window.clientConfigData.loadOjDependentBindings&&(window.ccKoOjExtensionsPath?requiredDependencies.push(window.ccKoOjExtensionsPath):requiredDependencies.push("ccKoOjExtensions")),require(requiredDependencies,function(){require(["jquery","ccConstants","spinner","pubsub","profiletools","knockout","koValidate","ccKoValidateRules",paths.layoutContainer,"pageLayout/rest-adapter","storageApi","pageLayout/api-builder","routing","CCi18n","ccDate","ccEETagProcessor","ccRestClient","addThis","ccOAuthTimeout","viewportHelper","shared/store-loader","ccResourceLoader!APPLICATION_JS","jquerymswipe","ccLazyImages"],function(e,t,r,i,a,o,n,s,l,c,d,u,p,h,g,f,m,I,E,y,v,b){"use strict";function T(e,t){m.samlLogin(e,P,S,t)}function P(t){e.Topic(i.topicNames.SAML_LOGIN_SUCCESSFUL).publish()}function S(t){e.Topic(i.topicNames.SAML_LOGIN_FAILURE).publishWith(self,[t])}function C(t){e.Topic(i.topicNames.OPENID_LOGIN_SUCCESSFUL).publish()}function _(t){e.Topic(i.topicNames.OPENID_LOGIN_FAILURE).publishWith(self,[t])}function A(){e.Topic(i.topicNames.CART_LOADED).unsubscribe(A),T(getSamlResponse(),getRelayState())}function O(e){m.openIdLogin(e,C,_)}function R(){e.Topic(i.topicNames.CART_LOADED).unsubscribe(R),O(getOpenIdCode())}function N(){m.storeToken(getAgentAuthToken()),m.setStoredValue("cc-agent-redirect-url",getAgentRedirectUrl());var e=getAgentOrganizationIdValue(),t=getAgentPriceListGroupValue();m.setStoredValue("occs_organization_id",e?JSON.stringify(e):null),m.setStoredValue("occs_pricelistgroup_id",t?JSON.stringify(t):null),window.location.assign(window.location.href)}function D(){var e=function(){var e=getAdditionalFormData();e&&m.setStoredValue("cc-additional-form-data",JSON.stringify(e)),window.location.assign("/")};m.storeToken(k,e)}if(container===t.CONTAINER_DESIGN_STUDIO){var L=!1,w=!1;e.Topic(i.topicNames.PAGE_CHANGED).subscribe(function(){L||w||(r.createWithTimeout({parent:"body",posTop:"200px"},1e4,function(){e(".modal-backdrop").remove()}),e(".cc-spinner").css("z-index","20000"),L=!0),w=!1}),e.Topic(i.topicNames.PAGE_READY).subscribe(function(){L?(r.destroyWithoutDelay("body"),L=!1,w=!1):w=!0}),f.enabled=!1}var M;if("function"==typeof getSamlResponse&&null!=getSamlResponse()&&getSamlResponse().length>0?M=A:"function"==typeof getOpenIdCode&&null!=getOpenIdCode()&&getOpenIdCode().length>0&&(M=R),"undefined"!=typeof M){M===R?d.getInstance().saveToMemory(t.CC_IS_OPENID_LOGIN_UNDER_PROGRESS,!0):d.getInstance().saveToMemory(t.CC_IS_SSO_LOGIN_UNDER_PROGRESS,!0);var U=m.getSessionStoredValue("SSO_RETURN_URL");null==U&&(U="/"),window.history.replaceState(null,"",U),e.Topic(i.topicNames.CART_LOADED).subscribe(M)}"function"==typeof getAgentAuthToken&&null!=getAgentAuthToken()&&getAgentAuthToken().length>0&&m.registerInitCallback(N);var k=null;"function"==typeof getOAuthToken&&null!=getOAuthToken()&&getOAuthToken().length>0&&(k=getOAuthToken()),null!=k&&m.registerInitCallback(D);var x=new c("/ccstore/v1/"),G="/",F=new l(x,G),H=new F.LayoutViewModel;new p,new E(m);F.masterViewModel(H),f.init(),infuser.defaults.templateSuffix="";var V={};V.errorsAsTitle=!1,V.insertMessages=!1,V.decorateElement=!0,V.errorElementClass="invalid",o.validation.init(V);var Y={compatibilityJSON:"v1",compatibilityAPI:"v1",appendNamespaceToMissingKey:!0,returnNull:!0,returnEmptyString:!0,joinArrays:"\n",namespaces:["ns.common","ns.ccformats"],ns:["ns.common","ns.ccformats"],defaultNS:["ns.common"],fallbackLng:["en"],useLocalStorage:!1,useCookie:!1,debug:!1,contextSeparator:":",resGetPath:"/ccstoreui/v1/resources/__ns__?locale=__lng__",interpolation:{prefix:"__",suffix:"__",unescapeSuffix:"HTML",escapeValue:!1,nestingPrefix:"$t(",nestingSuffix:")"},backend:{request:h.ajax,loadPath:"/ccstoreui/v1/resources/__ns__?locale=__lng__",addPath:"/ccstoreui/v1/resources/__ns__?locale=__lng__"}};h.deferInit(Y,function(){H.previewMessage(h.t("ns.common:resources.previewMessage")),H.oboShopperName(h.t("ns.common:resources.fullName",{firstName:H.data.global.user.firstName,lastName:H.data.global.user.lastName})),H.sharedWidgetMessage(h.t("ns.common:resources.sharedWidget")),H.oboShopperMessage(h.t("ns.common:resources.shoppingAsText")),H.displayErrorMessage(h.t("ns.common:resources.displayError")),""==H.pageChangeMessage()&&(H.dataForPageChangeMessage().page.category?H.pageChangeMessage(h.t("ns.common:resources.categoryPageLoadedText",{collection:H.dataForPageChangeMessage().page.category.displayName})):H.dataForPageChangeMessage().page.product?H.pageChangeMessage(h.t("ns.common:resources.productPageLoadedText",{product:H.dataForPageChangeMessage().page.product.displayName})):"userSpacesPage"===H.dataForPageChangeMessage().page.repositoryId?H.pageChangeMessage(h.t("ns.common:resources.wishlistPageLoadedText")):"searchResultsPage"!=H.dataForPageChangeMessage().repositoryId&&H.pageChangeMessage(h.t("ns.common:resources.pageLoadedText",{page:H.dataForPageChangeMessage().page.repositoryId})))});var B=window.location.protocol+"//"+window.location.host,q=function(e,t){var r;if(e.canonicalRoute){var i=e.canonicalRoute;o.isObservable(i)&&(i=o.utils.unwrapObservable(i)),r=B+i}H.canonicalRoute(r),H.agentReturnUrl=m.getStoredValue("cc-agent-redirect-url"),H.alternates(e.alternates),H.nextPageNo(null),H.prevPageNo(null),H.currPageNo(""),H.paginationDone(!1),H.pageType=e.data.page.pageType,H.isObo(null!=H.data.global.agentId)},j=function(e){H.nextPageNo(e.nextPageNo),H.prevPageNo(e.prevPageNo),H.currPageNo(e.currPageNo),H.paginationDone()!==!0?H.paginationDone(!0):H.paginationDone.valueHasMutated()},W=function(e){H.title(e.title()),H.keywords(e.keywords()),H.description(e.description()),H.metaTags(e.metaTags()),H.isPreview(e.isPreview()),H.noindex(e.noindex()),y.layoutViewports(e.viewports?e.viewports():"")};e.Topic(i.topicNames.PAGE_LAYOUT_UPDATED).subscribe(q),e.Topic(i.topicNames.PAGE_PAGINATION_CALCULATED).subscribe(j),e.Topic(i.topicNames.PAGE_METADATA_CHANGED).subscribe(W),H.name=o.observable("Master View Model"),H.itemBeforeRemove=function(t,r,i){e(t).remove()},H.itemAfterAdd=function(e,t,r){},H.afterRender=function(e,t){},u.widgetBuilder(F.WidgetViewModel,F),u.regionBuilder(F.RegionViewModel,F),F.WidgetViewModel.prototype.profileTools=new a,o.applyBindings(H,document.getElementById("oracle-cc")),"function"==typeof waitForRenderComplete&&waitForRenderComplete(o,F,H)})}),define("js/main",function(){}),define("ccStoreUtils",["knockout","ccConstants"],function(e,t){"use strict";function r(){}return r.prototype.fromJS=function(t,r,i,a,o,n){var s=[];if(i)for(var l in t)s.push(l);if(!i&&a&&a.length>0)for(var l in t)t[l]instanceof Object&&!(t[l]instanceof Array)&&s.push(l);var c={copy:s,observe:a,ignore:o,include:n};e.mapping.fromJS(t,c,r)},r.prototype.getEntityCountLimitInGetRequest=function(e,t){return e<t?e:-1},r.prototype.getHashCode=function(e){var t,r,i=0;if("string"!=typeof e||0===e.length)return i;for(t=0;t<e.length;t++)r=e.charCodeAt(t),i=(i<<5)-i+r,i|=0;return i},r.prototype.getVisitorId=function(){var e=window.OracleUnifiedVisit,r=null;return e&&e.visitorId&&(r=e.visitorId()),r||window.visitorId&&(r=window.visitorId),r||(r=window.localStorage.getItem(t.VISITOR_ID)),r},r.prototype.getVisitId=function(){var e=window.OracleUnifiedVisit,t=null;return e&&e.visitId&&(t=e.visitId()),t||window.visitId&&(t=window.visitId),t},new r}),define("shared/ccLibs/cc-store-utils-1.0",function(){}),define("pageLayout/data",["knockout"],function(e){"use strict";function t(){}return t}),define("pageLayout/layout",["jquery","knockout","ccConstants","ccStoreConfiguration"],function(e,t,r,i){"use strict";function a(){var a=this;this.MAX_ROW_COLUMNS=12,this.layoutName=t.observable(),this.regions=t.observableArray([]),this.title=t.observable(),this.keywords=t.observable(),this.description=t.observable(),this.metaTags=t.observable(),this.isPreview=t.observable(),this.isObo=t.observable(!1),this.oboShopperName=t.observable(),this.previewMessage=t.observable(),this.oboShopperMessage=t.observable(),this.sharedWidgetMessage=t.observable(),this.displayErrorMessage=t.observable(),this.pageType="",this.storeConfiguration=i.getInstance(),this.containPage=t.observable(!0),this.containHeader=t.observable(!1),this.containMain=t.observable(!1),this.containFooter=t.observable(!1),this.pageChangeMessage=t.observable(""),this.dataForPageChangeMessage=t.observable(),this.headerRows=t.observableArray().extend({deferred:!0}),this.bodyRows=t.observableArray().extend({deferred:!0}),this.footerRows=t.observableArray().extend({deferred:!0}),this.canonicalRoute=t.observable(),this.alternates=t.observableArray(),this.prevPageNo=t.observable(),this.nextPageNo=t.observable(),this.currPageNo=t.observable(""),this.supportedLocales=t.observableArray().extend({deferred:!0}),this.paginationDone=t.observable(!1),this.noindex=t.observable(!1);var o=["/checkout","/cart","/wishlist_settings","/searchresults","/nosearchresults","/confirmation","/error","/signup","/profile","/orderhistory","/orderdetails","/payment","/wishlist"];this.contentItemId=t.observable(),this.contentURL=t.observable();var n=[window.location.protocol,"//",window.location.host].join("").toLowerCase(),s=function(e){for(var t=document.head.querySelectorAll('[rel="'+e+'"]'),r=t.length,i=0;i<r;i++)document.head.removeChild(t[i])},l=function(e){var t="canonical";if(!e||0==e.toLowerCase().indexOf(n)){if(!e||o.indexOf(e.substring(n.length).toLowerCase())>=0)return void s(t);a.paginationDone()&&(e+=a.currPageNo());var r=document.head.querySelectorAll('[rel="'+t+'"]'),i=r.length;if(i>1&&s(t),1===i)r[0].href!==e&&(r[0].href=e);else{var l=document.createElement("link");l.rel=t,l.href=e,document.head.appendChild(l)}}};return this.paginationDone.subscribe(function(){a.canonicalRoute.valueHasMutated()}),this.canonicalRoute.subscribe(l),this.headerRegions=t.observableArray(),this.bodyRegions=t.observableArray(),this.footerRegions=t.observableArray(),this.buildRows=function(){var e=this.headerRegions(),i=this.bodyRegions(),a=this.footerRegions();this.headerRegions([]),this.bodyRegions([]),this.footerRegions([]);for(var o,n=0;n<this.regions().length;n++)o=this.regions()[n],t.unwrap(o.type)===r.REGION_TYPE_HEADER&&this.headerRegions.push(this.regions()[n]),t.unwrap(o.type)&&t.unwrap(o.type)!==r.REGION_TYPE_BODY||this.bodyRegions.push(this.regions()[n]),t.unwrap(o.type)===r.REGION_TYPE_FOOTER&&this.footerRegions.push(this.regions()[n]);this.calculateRows.call(this.headerRows,this.headerRegions(),e),this.calculateRows.call(this.bodyRows,this.bodyRegions(),i),this.calculateRows.call(this.footerRows,this.footerRegions(),a)},this.calculateRows=function(e,r){var i,o=this,n={},s=0,l=[];if(e.length===r.length){for(var c=!0,d=0;d<e.length;d++)if(e[d].id()!==r[d].id()||e[d].width()!==r[d].width()){c=!1;break}if(c)return}if(t.isObservable(o)&&void 0!==o.removeAll){l=o(),l.splice(0,l.length),n.regions=t.observableArray().extend({deferred:!0});for(var d=0;d<e.length;d++)i=e[d],(s==a.MAX_ROW_COLUMNS||s+i.width()>a.MAX_ROW_COLUMNS)&&(l.push(n),n={},n.regions=t.observableArray().extend({deferred:!0}),s=0),n.regions.push(i),s+=i.width();l.push(n),o.valueHasMutated()}},this.subscribeArrayChanged=function(r,i,a){if(t.isObservable(r)){var o=r.peek();r.subscribe(function(t){var r=o;o=e.extend(!0,[],t),i.call(a,t,r)})}},this.hasWidgetType=function(e){var t;if(a.regions())for(var r=0;r<a.regions().length;r++)if(t=a.regions()[r],t.widgets().length)for(var i=0;i<a.regions().length;i++){var o=t.widgets()[i].typeId();if(o===e)return!0}return!1},this.formatHreflang=function(e){var r="";return e?(r=t.utils.unwrapObservable(e),r.replace(/_/g,"-")):r},this}return a}),define("pageLayout/region",["jquery","knockout","viewportHelper","pubsub"],function(e,t,r,i){"use strict";function a(){var a=this;return a.regions=t.observableArray(),a.widgets=t.observableArray(),a.width=t.observable(),a.offset=t.observable(),a.name=t.observable("defaultName"),a.metadata=t.observable(),a.cssClass=t.observable(),a.similarRegions=new Object,a.widthClass=t.computed(function(){var e=r.getWidthClass(a.width(),a.offset());return a.cssClass()&&(e+=" "+a.cssClass()),e},a),a.globalWidgetsOnly=t.computed(function(){for(var e=0;e<a.widgets().length;e++)if(!a.widgets()[e].global())return!1;return!0},a),a.nextTab=function(){return a.validateWidgets()},a.previousTab=function(){return!0},a.validateWidgets=function(){var e=!0;for(var t in a.widgets())a.widgets()[t].checkForValidation()||(e=!1);return e},a.handleMetadata=function(){var r=a.metadata();if(r&&e.isPlainObject(r)&&!e.isEmptyObject(r)){var o=t.toJS(a.metadata);e.Topic(i.topicNames.REGION_METADATA_CHANGED).publish(o)}},this}return a}),define("notifier",["knockout","pubsub","jquery"],function(e,t,r){"use strict";function i(t,r,i,a,o,n){var s=this;s.id=e.observable(t),s.text=e.observable(r),s.type=e.observable(i),s.dismissable=e.observable(a),s.scrollToMessage=e.observable(o),s.alertClass=e.computed(function(){return"alert alert-"+s.type()}),s.messageStyle=e.observable(n)}function a(){var a=this;a.messageStyle=e.observable(""),a.types={SUCCESS:"success",WARNING:"warning",INFO:"info",ERROR:"error"},a.sendMessage=function(e,o,n,s,l){var c=new i(e,o,n,s,l,a.messageStyle());r.Topic(t.topicNames.NOTIFICATION_ADD).publishWith(c,[{message:"success"}])},a.sendError=function(e,t,r){a.sendMessage(e,t,a.types.ERROR,!0,r)},a.sendWarning=function(e,t,r){a.sendMessage(e,t,a.types.WARNING,!0,r)},a.sendSuccess=function(e,t,r){a.sendMessage(e,t,a.types.SUCCESS,!0,r)},a.sendInfo=function(e,t,r){a.sendMessage(e,t,a.types.INFO,!0,r)};var o={};return a.sendMessageToPage=function(e,t,i,n,s,l){o[n]||(o[n]=r.Deferred()),o[n].done(function(){setTimeout(function(){a.sendMessage(e,t,l,s,i)},300),o[n]=null})},r.Topic(t.topicNames.PAGE_LAYOUT_UPDATED).subscribe(function(e,t){t.pageId&&o[t.pageId]&&o[t.pageId].resolve()}),a.sendErrorToPage=function(e,t,r,i,o){a.sendMessageToPage(e,t,r,i,!!o,a.types.ERROR)},a.sendWarningToPage=function(e,t,r,i,o){a.sendMessageToPage(e,t,r,i,o,a.types.WARNING)},a.sendSuccessToPage=function(e,t,r,i,o){a.sendMessageToPage(e,t,r,i,o,a.types.SUCCESS)},a.sendInfoToPage=function(e,t,r,i,o){a.sendMessageToPage(e,t,r,i,o,a.types.INFO)},a.sendTemplateMessage=function(e,a,o,n,s,l){var c=new i(e,o,n,s,l);r.Topic(t.topicNames.NOTIFICATION_TEMPLATE_ADD).publish(c,a,o)},a.sendTemplateError=function(e,t,r,i){a.sendTemplateMessage(e,t,r,a.types.ERROR,!1,i)},a.sendTemplateWarning=function(e,t,r,i){a.sendTemplateMessage(e,t,r,a.types.WARNING,!0,i)},a.sendTemplateSuccess=function(e,t,r,i){a.sendTemplateMessage(e,t,r,a.types.SUCCESS,!0,i)},a.sendTemplateInfo=function(e,t,r,i){a.sendTemplateMessage(e,t,r,a.types.INFO,!0,i)},a.clearMessage=function(e,a){var o=new i(e,"",a,!1,!1);r.Topic(t.topicNames.NOTIFICATION_DELETE).publishWith(o,[{message:"success"}])},a.clearError=function(e){a.clearMessage(e,a.types.ERROR)},a.clearWarning=function(e){a.clearMessage(e,a.types.WARNING)},a.clearSuccess=function(e){a.clearMessage(e,a.types.SUCCESS)},a.clearInfo=function(e){
- a.clearMessage(e,a.types.INFO)},a}return new a}),define("viewModels/messageHandler",["knockout","pubsub","notifier","notifications","jquery"],function(e,t,r,i,a){"use strict";function o(){var d=this;if(o.singleInstance)throw new Error("Cannot instantiate more than one MessageHandler, use getInstance()");return d.message=e.observable(),d.messageFlag=e.observable(),d.errorMsgs=Array(),d.warnMsgs=Array(),d.successMsgs=Array(),d.infoMsgs=Array(),d.pageId="",d.scrollIfNeccessary=function(e,t){if(e.scrollToMessage()){var r=a(t);r&&r.offset()&&a("html, body").animate({scrollTop:r.offset().top},1e3)}},d.updateMessages=function(){for(var e=this,t=0;t<e.errorMsgs.length;t++)if(e.errorMsgs[t].pageId==e.pageId)return e.message(e.errorMsgs[t]),void(e.messageFlag()||(i.notify([{style:e.message()&&"growl"===e.message().messageStyle()?"growl":"inline",status:"error",id:"#CC-messages",close:e.message().dismissable(),fade:!(!e.message()||"growl"!==e.message().messageStyle()),message:e.message().text()}]),a(".cc-notification-message").addClass("container"),e.messageFlag(!0),e.scrollIfNeccessary(e.message(),"#CC-messages")));for(var t=0;t<e.warnMsgs.length;t++)if(e.warnMsgs[t].pageId==e.pageId)return e.message(e.warnMsgs[t]),void(e.messageFlag()||(i.notify([{style:e.message()&&"growl"===e.message().messageStyle()?"growl":"inline",status:"warning",id:"#CC-messages",close:e.message().dismissable(),fade:!(!e.message()||"growl"!==e.message().messageStyle()),message:e.message().text()}]),a(".cc-notification-message").addClass("container"),e.messageFlag(!0),e.scrollIfNeccessary(e.message(),"#CC-messages")));for(var t=0;t<e.successMsgs.length;t++)if(e.successMsgs[t].pageId==e.pageId)return e.message(e.successMsgs[t]),void(e.messageFlag()||(i.notify([{style:e.message()&&"growl"===e.message().messageStyle()?"growl":"inline",status:"success",id:"#CC-messages",close:e.message().dismissable(),fade:!(!e.message()||"growl"!==e.message().messageStyle()),message:e.message().text()}]),a(".cc-notification-message").addClass("container"),e.messageFlag(!0),e.scrollIfNeccessary(e.message(),"#CC-messages")));for(var t=0;t<e.infoMsgs.length;t++)if(e.infoMsgs[t].pageId==e.pageId)return e.message(e.infoMsgs[t]),void(e.messageFlag()||(i.notify([{style:e.message()&&"growl"===e.message().messageStyle()?"growl":"inline",status:"info",id:"#CC-messages",close:e.message().dismissable(),fade:!(!e.message()||"growl"!==e.message().messageStyle()),message:e.message().text()}]),a(".cc-notification-message").addClass("container"),e.messageFlag(!0),e.scrollIfNeccessary(e.message(),"#CC-messages")));e.messageFlag(!1),i.emptyNotifications("#CC-messages"),e.message(null)},d.addMessage=function(e,r){var o=e.id();if(d.messageFlag()&&null!=d.message()){if(d.message().id()==o&&d.message().text()==e.text())return;i.emptyNotifications("#CC-messages"),a.Topic(t.topicNames.NOTIFICATION_DELETE).publishWith(d.message(),[{message:"success"}])}for(var n=0;n<r.length;n++)r[n].id()==o&&r[n].text(e.text());e.pageId=d.pageId,r.push(e),d.messageFlag(!1),d.updateMessages(),a(".close.cc-notification-close").on("click",function(){d.removeCurrentMessage(e)})},d.removeCurrentMessage=function(e){d.messageFlag()&&null!=d.message()&&d.message().id()==e.id()&&(a.Topic(t.topicNames.NOTIFICATION_DELETE).publishWith(e,[{message:"success"}]),d.messageFlag(!1),i.emptyNotifications("#CC-messages"),d.message(null))},d.removeMessage=function(e,t){for(var r=e.id(),i=0;i<t.length;i++)if(t[i].id()==r){t.splice(i,1),d.removeCurrentMessage(e);break}d.updateMessages()},d.removeAllMessages=function(){d.errorMsgs=[],d.warnMsgs=[],d.successMsgs=[],d.infoMsgs=[],d.updateMessages()},d.addMessageHandler=function(e){var t=this,i=t.type();switch(i){case r.types.ERROR:d.addMessage(t,d.errorMsgs);break;case r.types.WARNING:d.addMessage(t,d.warnMsgs);break;case r.types.SUCCESS:d.addMessage(t,d.successMsgs);break;case r.types.INFO:d.addMessage(t,d.infoMsgs)}},d.deleteMessageHandler=function(e){var t=this,i=t.type();switch(i){case r.types.ERROR:d.removeMessage(t,d.errorMsgs);break;case r.types.WARNING:d.removeMessage(t,d.warnMsgs);break;case r.types.SUCCESS:d.removeMessage(t,d.successMsgs);break;case r.types.INFO:d.removeMessage(t,d.infoMsgs)}},d.pageContextHandler=function(e){var t="";e&&e.pageId&&(t=e.pageId,e.contextId&&(t+="-"+e.contextId),d.pageId=t,d.removeAllMessages())},void 0!=n&&a.Topic(t.topicNames.NOTIFICATION_ADD).unsubscribe(n),n=d.addMessageHandler,void 0!=s&&a.Topic(t.topicNames.NOTIFICATION_DELETE).unsubscribe(s),s=d.deleteMessageHandler,void 0!=l&&a.Topic(t.topicNames.PAGE_VIEW_CHANGED).unsubscribe(l),l=d.pageContextHandler,void 0!=c&&a.Topic(t.topicNames.PAGE_VIEW_CHANGED).unsubscribe(c),c=d.removeAllMessages,a.Topic(t.topicNames.NOTIFICATION_ADD).subscribe(n),a.Topic(t.topicNames.NOTIFICATION_DELETE).subscribe(s),a.Topic(t.topicNames.PAGE_VIEW_CHANGED).subscribe(l),a.Topic(t.topicNames.USER_LOGOUT_SUCCESSFUL).subscribe(c),d.messageFlag(!1),d}var n,s,l,c;return o.getInstance=function(){return o.singleInstance||(o.singleInstance=new o,i.emptyNotifications("#CC-messages")),o.singleInstance},o}),define("pageLayout/widget",["knockout","CCi18n","ccDate","ccNumber","pubsub","ccConstants","viewModels/messageHandler","jquery","navigation"],function(e,t,r,i,a,o,n,s,l){"use strict";function c(r){function i(r){var i,a;if(n.localeResources)for(var o in n.localeResources){var l=e.toJS(n.localeResources[o].resources);n.customTranslations()&&(i=e.toJS(n.customTranslations()),a=n.mergeTextSnippetResources(l,i)),t.addResourceBundle(o,n.localeResources[o].namespace(),{resources:l});var c=t.t("ns."+n.i18nresources()+":resources",{returnObjects:!0,interpolation:{prefix:"##",suffix:"##"}});s.extend(c,a),n.resources(c)}n.customTranslations()&&!n.resources()&&(i=e.toJS(n.customTranslations()),n.resources(i)),n.resources()&&n.resourcesLoaded&&n.resourcesLoaded(n)}var n=this;return this.basePath=r,this.initialized=e.observable(!1),this.occPrioritizedDisplay=e.observable(!1),this.deferredInit=s.Deferred(),this.id=e.observable(),this.typeId=e.observable(),this.rootPath=e.observable(),this.imagePath=e.observable(),this.templatePath=e.observable(),this.jsPath=e.observable(),this.i18nresources=e.observable(),this.resources=e.observable(),this.locale=e.observable(),this.customTranslations=e.observable(),this.widgetId=e.observable(),this.numberOnPage=e.observable(),this.isPreview=e.observable(),this.elements={},this.isShared=e.computed(function(){var e;return e=!!(this.numberOnPage&&this.numberOnPage()>1)||!!(this.pageIds&&this.pageIds().length>1)},this),this.contextDataLoaded=e.observable(!1),this.pageReady=function(){this.contextDataLoaded(!0),this.links&&l.isPathEqualTo(this.links().checkout.route)&&(s("#CC-headermodalpane").modal("hide"),s("body").removeClass("modal-open"),s(".modal-backdrop").remove())},s.Topic(a.topicNames.PAGE_READY).subscribe(n.pageReady.bind(n)),this.historyStack=[],this.prevHistoryLength=0,this.newHistoryLength=0,this.updateHistoryStackArray=function(e){var t;if(1===history.length)try{window.sessionStorage.removeItem(o.SESSION_STORAGE_HISTORY_STACK)}catch(e){}try{t=window.sessionStorage.getItem(o.SESSION_STORAGE_HISTORY_STACK)}catch(e){}if(t&&!n.historyStack.length&&(n.historyStack=JSON.parse(t)),n.prevHistoryLength=n.newHistoryLength,n.newHistoryLength=history.length,void 0!=e.oldHash&&n.links&&n.links().hasOwnProperty(404)){if(n.historyStack.length){var r=n.historyStack[n.historyStack.length-1];e.newHash===r.oldHash&&e.oldHash===r.newHash&&n.prevHistoryLength===n.newHistoryLength?n.historyStack.pop():n.historyStack[n.historyStack.length-1].oldHash==e.oldHash&&n.historyStack[n.historyStack.length-1].newHash==e.newHash||n.historyStack[n.historyStack.length-1].newHash!=e.oldHash||n.historyStack.push(e)}else n.historyStack.push(e);try{window.sessionStorage.setItem(o.SESSION_STORAGE_HISTORY_STACK,JSON.stringify(n.historyStack))}catch(e){}}},s.Topic(a.topicNames.UPDATE_HASH_CHANGES).subscribe(n.updateHistoryStackArray),this.mergeTextSnippetResources=function(e,t){var r={};if(e&&"object"==typeof e&&t&&"object"==typeof t)for(var i in t)t.hasOwnProperty(i)&&(i.indexOf(".")===-1?e[i]=t[i]:r[i]=t[i]);return r},this.localeSubscription=this.locale.subscribe(function(e){var r=this;t.setLocaleOnce(e.replace("_","-"),function(){r.localeSubscription.dispose(),r.deferUntilAllPropertiesSet(r,function(){i(r.i18nresources())})})},this),this.typeId.subscribe(function(e){this.rootPath(this.basePath+"widget/"+e),this.imagePath(this.rootPath()+"/images"),this.jsPath(this.rootPath()+"/js"),this.widgetId(e)},this),this.absoluteUrl=function(e){var t=e;return this.assetMappings&&(t=this.assetMappings[e]),t},this.templateAbsoluteUrl=function(e){var t=e;return this.assetMappings&&(t=this.assetMappings[e]()),t},this.notificationTemplateUrl=function(e){var t="/templates/";return t+=e+".template",this.absoluteUrl(t)()},this.redirectToLocalizedURL=function(e,t){var r=l.getLocaleBasedUrl(e);window.location.assign(r)},this.translate=function(e,r,i,a){var o="",s=e,l="";if(n.resources()){if(a&&null!=n.resources()[a]&&"null"!=n.resources()[a])return n.resources()[a];if(n.resources()[e]&&(o=n.resources()[e],o.indexOf("__")===-1))return o}return r?r.defaultValue&&(s=r.defaultValue,r.defaultValue=void 0):r={},void 0===i&&(i=!0),o="",n.i18nresources()&&""!==n.i18nresources()&&(l="ns."+n.i18nresources()+":resources."+e,o=t.t(l,r)),o===l&&(i?(r.defaultValue=s,o=t.t("ns.common:resources."+e,r)):o=s),o},this}return c.prototype.allPropertiesSet=function(e){e.deferredInit.resolveWith(e)},c.prototype.deferUntilAllPropertiesSet=function(e,t){e.deferredInit.done(t)},c.prototype.requiresRefresh=function(e){return!(!this.pageIds()||!e.pageIds()||this.pageIds().length===e.pageIds().length)},c.prototype.isActiveOnPage=function(e){return!(!this.global||!this.global())||!(!e||this.pageIds().indexOf(e.pageRepositoryId)==-1)},c.prototype.maybeFireBeforeAppearExtJSDeferred=function(e){return function(t,r){this.maybeFireBeforeAppear(t,r,e)}},c.prototype.maybeFireBeforeAppear=function(e,t,r){if(t||(t=this),t.isActiveOnPage(e)){var i=s.Deferred();if(i.done(function(e){t.hasBeforeAppear()&&t.beforeAppear(e),r&&r.done(function(){t.callExtJSBeforeAppear(t)})}),t.initialized())i.resolveWith(t,[e]);else var a=t.initialized.subscribe(function(r){r&&(i.resolveWith(t,[e]),a.dispose())})}},c.prototype.callExtJSBeforeAppear=function(e){e.__cc__extjs&&e.__cc__extjs.beforeAppear&&"function"==typeof e.__cc__extjs.beforeAppear&&e.__cc__extjs.beforeAppear.call(e)},c.prototype.hasBeforeAppear=function(){var e=!1;return"beforeAppear"in this&&"function"==typeof this.beforeAppear&&(e=!0),e},c.prototype.ccDate=function(e,t,i,a){return r.formatDateAndTime(e,t,i,a)},c.prototype.ccNumber=function(e){return i.formatNumber(e)},c.prototype.formatPrice=function(e,t){e=e.toFixed(t);var r=e.split("."),a=i.formatNumber(r[0],!0);return 0===t?a=a.substring(0,a.length-3):(a=a.substring(0,a.length-2),a+=r[1]),a},c.prototype.messageBox=n.getInstance(),c.prototype.checkForValidation=function(){return!this.validate||this.validate()},c}),define("storeKoExtensions",["knockout","jqueryui","notifier","ccLogger","ccLazyImages","ccConstants","koValidate"],function(e,t,r,i,a,o,n){"use strict";e.extenders.notify=function(t,a){if(t.isValid&&e.isObservable(t.isValid)&&t.isModified&&e.isObservable(t.isModified)){var o="",n="An error has occurred.";if(a&&(a.id?(o=a.id,a.message&&(n=a.message)):""!==a.toString()&&(o=a.toString())),""===o)throw i.error("Notify ID not set"),new Error("Notify ID not set.");t.notify=function(e){t.isValid()||!t.isModified()?r.clearError(o):r.sendError(o,n)},t.clearError=function(){r.clearError(o)},t.isModified.subscribe(t.notify),t.isValid.subscribe(t.notify)}return t},e.bindingHandlers.productVariantImageSource={getNoImageSiteSetting:function(t){for(var r=null,i=0;i<t.$parents.length;i++)if(e.isObservable(t.$parents[i].site)){r=e.unwrap(t.$parents[i].site().noImageSrc);break}return r},init:function(t,r,i,a,o){var n,s,l,c,d,u=e.utils.unwrapObservable(r());"object"==typeof u&&"IMG"===t.nodeName&&(n=e.utils.unwrapObservable(u.src),s=e.utils.unwrapObservable(u.errorSrc),l=e.bindingHandlers.productVariantImageSource.getNoImageSiteSetting(o),c=l&&l.length>0?l:s,n&&c&&(d=new Image,d.src=c))},update:function(t,r,i,n,s){var l,c,d,u,p,h,g,f,m,I,E,y,v=!1,b=-1,T=e.utils.unwrapObservable(r());if("object"==typeof T&&"IMG"===t.nodeName){if(u=e.utils.unwrapObservable(T.src),l=e.utils.unwrapObservable(T.imageType),l||(l="medium"),u)switch(l){case"full":d=e.utils.unwrapObservable(u.childSKUs&&u.childSKUs.length>0&&u.childSKUs[0].primaryFullImageURL?u.childSKUs[0].primaryFullImageURL:u.primaryFullImageURL);break;case"large":d=e.utils.unwrapObservable(u.childSKUs&&u.childSKUs.length>0&&u.childSKUs[0].primaryLargeImageURL?u.childSKUs[0].primaryLargeImageURL:u.primaryLargeImageURL);break;case"medium":d=e.utils.unwrapObservable(u.childSKUs&&u.childSKUs.length>0&&u.childSKUs[0].primaryMediumImageURL?u.childSKUs[0].primaryMediumImageURL:u.primaryMediumImageURL);break;case"small":d=e.utils.unwrapObservable(u.childSKUs&&u.childSKUs.length>0&&u.childSKUs[0].primarySmallImageURL?u.childSKUs[0].primarySmallImageURL:u.primarySmallImageURL);break;case"thumb":d=e.utils.unwrapObservable(u.childSKUs&&u.childSKUs.length>0&&u.childSKUs[0].primaryThumbImageURL?u.childSKUs[0].primaryThumbImageURL:u.primaryThumbImageURL);break;default:d=e.utils.unwrapObservable(u.childSKUs&&u.childSKUs.length>0&&u.childSKUs[0].primaryMediumImageURL?u.childSKUs[0].primaryMediumImageURL:u.primaryMediumImageURL)}else d=T.errorSrc;f=e.utils.unwrapObservable(u.primaryImageAltText),m=e.utils.unwrapObservable(u.primaryImageTitle),p=e.utils.unwrapObservable(T.errorSrc),h=e.bindingHandlers.productImageSource.getNoImageSiteSetting(s),g=h&&h.length>0?h:p;var P=s.$masterViewModel,S=e.utils.unwrapObservable(T.disableLazyImageLoading);if(S||!P||!P.storeConfiguration||P.storeConfiguration.lazilyLoadImages!==!0||"prerenderReady"in window||d===g||a.isImageVisible(t,d)||(v=!0),v&&(y=e.utils.unwrapObservable(T.initialSrc),y||(y=g?g:o.SITE_DEFAULT_NO_IMAGE_URL),P.storeConfiguration.delayBeforeLoadingOutOfFocusImages&&(b=P.storeConfiguration.delayBeforeLoadingOutOfFocusImages)),d!==p&&d!==o.SITE_DEFAULT_NO_IMAGE_URL||(d=g,v=!1),h&&h.length>0){var C=new Image;C.onerror=function(){g=p},C.src=h}return f||(f=e.utils.unwrapObservable(T.alt)),m||(m=e.utils.unwrapObservable(T.title)),I=e.utils.unwrapObservable(T.errorAlt),E=e.utils.unwrapObservable(T.onerror),g?void(d?(c=new Image,c.onload=function(){v?(t.dataset.errorSrc=g,t.dataset.defaultErrorSrc=p,E&&(t.dataset.onerror=E),I&&(t.dataset.errorAlt=I),t.dataset.src=d,a.setupLazyLoadStyling(t,T),a.observeLazyImage(t,b),t.src=y):t.src=d,f&&(t.alt=f),m&&(t.title=m)},c.onerror=function(){if(v){var e=new Image;e.onload=function(){t.dataset.errorSrc=g,t.dataset.defaultErrorSrc=p,E&&(t.dataset.onerror=E),I&&(t.dataset.errorAlt=I),t.dataset.src=d,a.setupLazyLoadStyling(t,T),a.observeLazyImage(t,b),t.src=g},e.onerror=function(){t.src=g,I&&(t.alt=I),E&&E(t)},e.src=g}else t.src=g,I&&(t.alt=I),E&&E(t);E&&E(t)},c.src=y&&v?y:d):(t.src=g,I?t.alt=I:f&&(t.alt=f),E&&E(t))):(t.alt=f?f:"",v?(E&&(t.dataset.onerror=E),I&&(t.dataset.errorAlt=I),t.dataset.src=d,a.setupLazyLoadStyling(t,T),a.observeLazyImage(t,b),t.src=y):t.src=d,void(f&&(t.alt=f)))}}}}),define("pageViewTracker",["knockout","ccRestClient","ccConstants","storageApi"],function(e,t,r,i){"use strict";function a(t){var r=this;r.pageViews=e.observable(t)}function o(){var o=this;return this.tenantId=e.observable(),this.visitId=e.observable(),this.visitorId=e.observable(),this.visitDetailsChanged=e.observable(!1),o.createPageViewEvent=function(e){var t=new a(e);return t},o.getVisitorId=function(){return i.getInstance().getItem(r.VISITOR_ID)},o.getVisitId=function(){return i.getInstance().getItem(r.VISIT_ID)},o.handleVisitDetails=function(){var e=this;if(e.visitorId||e.visitId){var t=e.getVisitorId(),r=e.getVisitId();t&&t==e.visitorId()||(e.visitorId(t),e.visitDetailsChanged(!0)),r&&r==e.visitId()||(e.visitId(r),e.visitDetailsChanged(!0)),e.visitDetailsChanged()&&(e.persistVisitDetails(e.visitorId(),e.visitId()),e.visitDetailsChanged(!1))}},o.persistVisitDetails=function(e,i){var a={};a[r.VISITOR_ID]=e,a[r.VISIT_ID]=i;var o=r.ENDPOINT_SAVE_VISIT_DETAILS,n=function(e){},s=function(e){};t.request(o,a,n,s)},o.recordPageChange=function(e){var i={pageViews:e.pageViews()},a=r.ENDPOINT_RECORD_PAGEVIEWS_COUNT,o=function(e){},n=function(e){};t.request(a,i,o,n)},o}return new o}),define("pageLayout/currency",["jquery","ccConstants","ccRestClient"],function(e,t,r){"use strict";function i(){if(i.singleInstance)throw new Error("Cannot instantiate more than one CurrencyViewModel, use getInstance()");var a=this;return a.siteCurrenciesLoaded=e.Deferred(),a.availableCurrencies=[],a.currencyMap={},a.setAvailableCurrencies=function(){a.availableCurrencies.forEach(function(e){a.currencyMap[e.currencyCode]=e}),a.siteCurrenciesLoaded.resolve()},a.fetchCurrenciesSuccess=function(e){e?a.availableCurrencies=e.items:a.availableCurrencies=[],a.setAvailableCurrencies()},a.fetchCurrenciesFailure=function(){console.log("currencies loading failed")},a.getCurrency=function(e){return a.currencyMap[e]},a.fetchCurrencies=function(){var e=t.ENDPOINT_CURRENCIES_LIST_CURRENCIES,i={};r.request(e,i,a.fetchCurrenciesSuccess,a.fetchCurrenciesFailure)}(),this}return i.getInstance=function(){return i.singleInstance||(i.singleInstance=new i),i.singleInstance},i}),define("pageLayout/site",["knockout","ccRestClient","ccConstants","jquery","storageApi","pageViewTracker","pageLayout/currency"],function(e,t,r,i,a,o,n){"use strict";function s(a,o,l){if(s.singleInstance)throw new Error("Cannot instantiate more than one SiteViewModel, use getInstance(pAdapter, data, pParams)");var c=this;c.currencyViewModel=n.getInstance(),c.selectedPriceListGroup=e.observable(o?o.priceListGroup.defaultPriceListGroup:null),c.activePriceListGroups=e.observableArray([]),c.siteSecondaryCurrency=e.observable(null),c.siteSecondaryCurrencyCode=null,c.priceListGroupDeferred=i.Deferred(),c.selectedPriceListGroup()&&c.priceListGroupDeferred.resolve(),c.exchangeRate=e.observable(null),c.payShippingInSecondaryCurrency=e.observable(!1),c.payTaxInSecondaryCurrency=e.observable(!1),c.allowAlternateCurrency=e.observable(!1),c.siteLoadedDeferred=i.Deferred(),c.siteSecondaryInfoLoaded=i.Deferred();var d="/img/no-image.jpg";return o&&o.siteInfo&&o.siteInfo.noimage&&(d=o.siteInfo.noimage),c.getCurrency=function(e){return c.currencyViewModel.currencyMap[e]},c.setSiteSecondaryCurrency=function(){c.siteSecondaryCurrency(c.getCurrency(c.siteSecondaryCurrencyCode))},i.when(c.currencyViewModel.siteCurrenciesLoaded,c.siteSecondaryInfoLoaded).done(function(){c.setSiteSecondaryCurrency(),c.siteLoadedDeferred.resolve()}),c.noImageSrc=e.observable(d),null!=o&&t.request(r.ENDPOINT_SITES_GET_SITE,{},function(e){c.siteSecondaryCurrencyCode=e.secondaryCurrency,c.exchangeRate(e.exchangeRate?e.exchangeRate:null),c.payShippingInSecondaryCurrency(!!e.payShippingInSecondaryCurrency&&e.payShippingInSecondaryCurrency),c.payTaxInSecondaryCurrency(!!e.payTaxInSecondaryCurrency&&e.payTaxInSecondaryCurrency),c.allowAlternateCurrency(!!e.allowAlternateCurrency&&e.allowAlternateCurrency),c.siteSecondaryInfoLoaded.resolve()},function(e){console.log("site failed")},o.siteInfo.id),c.updateSiteSecondaryCurrencyCode=function(e){e&&e!=c.siteSecondaryCurrencyCode&&(c.siteSecondaryCurrencyCode=e,c.setSiteSecondaryCurrency())},c}return s.prototype.getCurrentLocale=function(){var e=t.getStoredValue(r.LOCAL_STORAGE_USER_CONTENT_LOCALE);return null!=e?JSON.parse(e)[0].name:i(":root").attr("lang")},s.prototype.setContextData=function(e){var i=this;for(var a in e)i[a]=e[a];if(i.selectedPriceListGroup()||e.priceListGroup){for(var o=!1,n=JSON.parse(t.getStoredValue(r.LOCAL_STORAGE_PRICELISTGROUP_ID)),s=0;s<i.priceListGroup.activePriceListGroups.length;s++)if(n&&n==i.priceListGroup.activePriceListGroups[s].id){i.selectedPriceListGroup(i.priceListGroup.activePriceListGroups[s]),o=!0;break}e.priceListGroup&&!o&&i.selectedPriceListGroup(e.priceListGroup.defaultPriceListGroup),"pending"===i.priceListGroupDeferred.state()&&i.priceListGroupDeferred.resolve()}e.priceListGroup&&i.activePriceListGroups(e.priceListGroup.activePriceListGroups),e&&e.hasOwnProperty("siteInfo")&&e.siteInfo.hasOwnProperty("noimage")&&i.noImageSrc(e.siteInfo.noimage?e.siteInfo.noimage:"/img/no-image.jpg")},s.initializeVisitorService=function(e){e&&e.visitorServiceHost&&e.tenantId&&e.oracleUnifiedVisitHost&&(s.setupVisitorServiceObject(e,window),require([e.oracleUnifiedVisitHost]))},s.setupVisitorServiceObject=function(e,i){var n=navigator.userAgent.toLowerCase(),s=n.indexOf("iemobile")>-1,l=n.indexOf("safari")>-1&&n.indexOf("chrome")==-1&&!s,c=!s&&(n.indexOf("iphone")>-1||n.indexOf("ipad")>-1||n.indexOf("ipod")>-1),d=l||c;i.OracleUnifiedVisit={accountId:e.tenantId+"_"+e.siteInfo.id,host:e.visitorServiceHost,handle:function(){window.ATGSvcs&&ATGSvcs.visitIDsLoaded&&ATGSvcs.visitIDsLoaded(),a.getInstance().setItem(r.VISITOR_ID,window.OracleUnifiedVisit.visitorId()),a.getInstance().setItem(r.VISIT_ID,window.OracleUnifiedVisit.visitId()),o.handleVisitDetails()},handleVisitor:function(e,i){d&&t.request(r.ENDPOINT_UPDATE_VISITOR_INFO,{infoName:e,infoDomain:i},function(e){},function(e){})}}},s.getInstance=function(e,t,r){return s.singleInstance||(s.singleInstance=new s(e,t,r),s.initializeVisitorService(t)),t&&s.singleInstance.setContextData(t),s.singleInstance},s}),define("viewModels/dynamicProperty",["knockout","koValidate","ccKoValidateRules","storeKoExtensions","CCi18n","ccDate","ccConstants","ccRestClient"],function(e,t,r,i,a,o,n,s){"use strict";function l(){var t=this;t.id=e.observable(),t.label=e.observable(),t.type=e.observable(),t.uiEditorType=e.observable(),t.default=e.observable(null),t.required=e.observable(!1),t.length=e.observable(),t.name=e.observable(),t.validationPattern=e.observable(),t.promptText=e.observable(),t.internalOnly=e.observable(!1),t.externalShopperContext=e.observable("false"),t.values=[],t.value=e.observable(),t.value.extend({required:!1}),t.isValid=function(){return void 0===t.value()||null===t.value()?!t.required():void 0===t.value.isValid||t.value.isValid()},t.validateNow=function(){return void 0!==t.value.isModified&&t.value.isModified(!0),t.isValid()},t.reset=function(){t.value(null),t.value.isModified(!1)},t.initializeMetadata=function(e,r){t.id(e.id),t.label(e.label),t.name(e.name),t.validationPattern(e.validationPattern),null!=e.promptText&&t.promptText(e.promptText),t.type(e.type),t.uiEditorType(e.uiEditorType),null!=e.default&&t.default(e.default),null!=e.internalOnly&&t.internalOnly(e.internalOnly),null!=e.externalShopperContext&&t.externalShopperContext(e.externalShopperContext),t.required(e.required),e.length&&t.length(e.length);var i={required:t.required()},o=a.t("ns.common:resources.dynamicPropertyRequired",{fieldName:t.label()});if(o&&(i.required={params:t.required(),message:o}),t.length()>0&&"checkbox"!==t.type()&&"number"!==t.type()&&"date"!=t.type()){var l=a.t("ns.common:resources.maxlengthValidationMsg",{maxLength:t.length(),fieldName:t.label()});l?i.maxLength={params:t.length(),message:l}:i.maxLength=t.length()}"float"!==t.type()&&"number"!=t.uiEditorType()||(i.number=!0,i.min=-99999999,i.max=99999999),"timestamp"!==t.type()&&"date"!=t.uiEditorType()||(i.date=!0),t.value.rules.remove(function(e){return"required"==e.rule}),t.value.extend(i),void 0!==t.value()&&null!==t.value()||null==t.default()||""===t.default()||t.value(t.default()),s.profileType!=n.PROFILE_TYPE_AGENT&&t.formatDate(),"checkbox"===t.type()&&t.value()!==!0&&t.value(!1),"enumerated"===t.type()&&(t.values=e.values)},t.formatDate=function(){if(!t.value())return t;if("date"===t.type()||"date"==t.uiEditorType()){var e=new Date(t.value());isNaN(e)||t.value(e.toISOString())}return t},t.getMetadata=function(){var e=new Object;return e.id=t.id(),e.label=t.label(),e.type=t.type(),e.uiEditorType=t.uiEditorType(),e.default=t.default(),e.required=t.required(),e.length=t.length(),e.name=t.name(),e.internalOnly=t.internalOnly(),e.externalShopperContext=t.externalShopperContext(),e.promptText=t.promptText(),e.values=t.values,e}}return l}),define("viewModels/dynamicPropertyMetaContainer",["knockout","viewModels/dynamicProperty","ccConstants"],function(e,t,r){"use strict";function i(){if(i.singleInstance)throw new Error("Cannot instantiate more than one DynamicPropertyMetaContainer view model, use getInstance()");var e=this;e.dynamicPropertyMetaCache={}}return i.prototype.intializeDynamicProperties=function(e,r){for(var i=this,a=[],o=0;o<e.length;o++){var n=new t;n.initializeMetadata(e[o],!0),a.push(n)}i.dynamicPropertyMetaCache[r]=a},i.prototype.createDynamicProperties=function(e,i){var a=[];if(e&&i==r.ADDRESS_TEXT)for(var o=0;o<e.length;o++){var n=new t;n.initializeMetadata(e[o].getMetadata(),!0),a.push(n)}return a},i.getInstance=function(){return i.singleInstance||(i.singleInstance=new i),i.singleInstance},i}),define("viewModels/addressTypesDataContainer",["knockout","ccConstants","ccRestClient"],function(e,t,r){"use strict";function i(){if(i.singleInstance)throw new Error("Cannot instantiate more than one AddressTypesDataContainer view model, use getInstance()");var t=this;t.availableAddressTypes=e.observableArray(),t.getAddressTypeList()}return i.prototype.getAddressTypeList=function(){var e=this,i=t.END_POINT_LIST_ADDRESS_TYPES;e.availableAddressTypes.removeAll();var a={};r.request(i,a,e.listAddressTypesSuccess.bind(e),e.listAddressTypesFailed.bind(e),t.END_POINT_LIST_ADDRESS_TYPES)},i.prototype.listAddressTypesSuccess=function(e){for(var t=[],r=this,i=e.items.length,a=0;a<i;a++)if(e.items[a].id){var o=e.items[a].displayName?e.items[a].displayName:e.items[a].id,n=e.items[a].id;t.push({label:o,value:n})}r.availableAddressTypes(t)},i.prototype.listAddressTypesFailed=function(e){},i.getInstance=function(){return i.singleInstance||(i.singleInstance=new i),i.singleInstance},i}),define("viewModels/address",["knockout","ccConstants","koValidate","ccKoValidateRules","storeKoExtensions","ccLogger","ccRestClient","viewModels/dynamicPropertyMetaContainer","ccStoreConfiguration","viewModels/dynamicProperty","viewModels/addressTypesDataContainer"],function(e,t,r,i,a,o,n,s,l,c,d){"use strict";function u(r,i,a,c,u){function p(e){var t=this,r=t.countriesList();t.country(e),t.selectedCountry(e);for(var i=r.length,a=0;a<i;a++)if(r[a].countryCode===e){if(!(r[a].regions.length>0))return t.computedState([]),t.stateList([]);t.computedState([]),t.stateList(r[a].regions);break}}var g=this;if(!r||""===r)throw o.error("Address ID not set"),new Error("Address ID not set");return g.alias=e.observable(""),g.prefix=e.observable(""),g.firstName=e.observable(""),g.middleName=e.observable(""),g.lastName=e.observable(""),g.suffix=e.observable(""),g.country=e.observable(""),g.postalCode=e.observable(""),g.address1=e.observable(""),g.address2=e.observable(""),g.address3=e.observable(""),g.city=e.observable(""),g.state=e.observable(""),g.county=e.observable(""),g.phoneNumber=e.observable(""),g.email=e.observable(),g.jobTitle=e.observable(""),g.companyName=e.observable(""),g.faxNumber=e.observable(""),g.addressType=e.observableArray([]),g.type=e.observable(""),g.repositoryId="",g.dynamicPropertyMetaInfo=s.getInstance(),g.addressTypeslist=d.getInstance(),g.isDefaultBillingAddress=e.observable(!1),g.isDefaultShippingAddress=e.observable(!1),g.availableAddressTypes=g.addressTypeslist.availableAddressTypes,g.availableAddressTypesIds=g.addressTypeslist.availableAddressTypesIds,g.predefinedAddressTypes=e.observableArray(),g.isTypeModified=e.observable(!1),g.computedDefaultBilling=e.computed(function(){return g.isDefaultBillingAddress()&&g.saveAddressTo()===t.ORDER_ACCOUNT},g),g.computedDefaultShipping=e.computed(function(){return g.isDefaultShippingAddress()&&g.saveAddressTo()===t.ORDER_ACCOUNT},g),g.postalCodePattern=e.observable(""),g.US_POSTAL_CODE_PATTERN="^[0-9]{5}([ -][0-9]{4})?$",g.CANADA_POSTAL_CODE_PATTERN="^[abceghjklmnprstvxyABCEGHJKLMNPRSTVXY]{1}[0-9]{1}[a-zA-Z]{1} *[0-9]{1}[a-zA-Z]{1}[0-9]{1}$",g.DEFAULT_POSTAL_CODE_PATTERN="^[0-9a-zA-Z]{1,}([ -][0-9a-zA-Z]{1,})?$",g.stateList=e.observableArray(),g.selectedCountry=e.observable(),g.selectedState=e.observable(),g.state_ISOCode=e.observable(),g.countriesList=e.observableArray(),g.countriesList(c),g.defaultCountryCode=e.observable(u),g.selectedAddressTypes=e.observableArray(),g.isDefaultAddress=e.observable(!1),g.saveToAccount=e.observable(!1),g.saveAddressTo=e.observable(t.PROFILE),g.invalidTracker=e.observable(),g.alias.extend({maxLength:{params:l.ADDRESS_ALIAS_MAXIMUM_LENGTH?l.ADDRESS_ALIAS_MAXIMUM_LENGTH:t.CYBERSOURCE_ALIAS_MAXIMUM_LENGTH,message:a.translate("maxlengthValidationMsg",{fieldName:a.translate("aliasText"),maxLength:l.ADDRESS_ALIAS_MAXIMUM_LENGTH?l.ADDRESS_ALIAS_MAXIMUM_LENGTH:t.CYBERSOURCE_ALIAS_MAXIMUM_LENGTH})}}),g.prefix.extend({required:!1}),g.firstName.extend({required:{params:!0,onlyIf:function(){return!g.saveToAccount()},message:a.translate("firstNameRequired")},maxLength:{params:l.ADDRESS_FIRSTNAME_MAXIMUM_LENGTH?l.ADDRESS_FIRSTNAME_MAXIMUM_LENGTH:t.CYBERSOURCE_FIRSTNAME_MAXIMUM_LENGTH,message:a.translate("maxlengthValidationMsg",{fieldName:a.translate("firstNameText"),maxLength:l.ADDRESS_FIRSTNAME_MAXIMUM_LENGTH?l.ADDRESS_FIRSTNAME_MAXIMUM_LENGTH:t.CYBERSOURCE_FIRSTNAME_MAXIMUM_LENGTH})}}),g.middleName.extend({required:!1}),g.lastName.extend({required:{params:!0,onlyIf:function(){return!g.saveToAccount()},message:a.translate("lastNameRequired")},maxLength:{params:l.ADDRESS_LASTNAME_MAXIMUM_LENGTH?l.ADDRESS_LASTNAME_MAXIMUM_LENGTH:t.CYBERSOURCE_LASTNAME_MAXIMUM_LENGTH,message:a.translate("maxlengthValidationMsg",{fieldName:a.translate("lastNameText"),maxLength:l.ADDRESS_LASTNAME_MAXIMUM_LENGTH?l.ADDRESS_LASTNAME_MAXIMUM_LENGTH:t.CYBERSOURCE_LASTNAME_MAXIMUM_LENGTH})}}),g.suffix.extend({required:!1}),g.state.extend({required:!1}),g.country.extend({required:{params:!0,message:a.translate("countryRequired")}}),g.address1.extend({maxLength:{params:l.ADDRESS_ADDRESS1_MAXIMUM_LENGTH?l.ADDRESS_ADDRESS1_MAXIMUM_LENGTH:t.CYBERSOURCE_ADDRESS_MAXIMUM_LENGTH,message:a.translate("maxlengthValidationMsg",{fieldName:a.translate("addressLine1Text"),maxLength:l.ADDRESS_ADDRESS1_MAXIMUM_LENGTH?l.ADDRESS_ADDRESS1_MAXIMUM_LENGTH:t.CYBERSOURCE_ADDRESS_MAXIMUM_LENGTH})}}),g.address2.extend({required:!1,maxLength:{params:l.ADDRESS_ADDRESS2_MAXIMUM_LENGTH?l.ADDRESS_ADDRESS2_MAXIMUM_LENGTH:t.CYBERSOURCE_ADDRESS_MAXIMUM_LENGTH,message:a.translate("maxlengthValidationMsg",{fieldName:a.translate("addressLine2Text"),maxLength:l.ADDRESS_ADDRESS2_MAXIMUM_LENGTH?l.ADDRESS_ADDRESS2_MAXIMUM_LENGTH:t.CYBERSOURCE_ADDRESS_MAXIMUM_LENGTH})}}),g.address3.extend({required:!1,maxLength:{params:l.ADDRESS_ADDRESS3_MAXIMUM_LENGTH?l.ADDRESS_ADDRESS3_MAXIMUM_LENGTH:t.CYBERSOURCE_ADDRESS_MAXIMUM_LENGTH,message:a.translate("maxlengthValidationMsg",{fieldName:a.translate("addressLine3Text"),maxLength:l.ADDRESS_ADDRESS3_MAXIMUM_LENGTH?l.ADDRESS_ADDRESS3_MAXIMUM_LENGTH:t.CYBERSOURCE_ADDRESS_MAXIMUM_LENGTH})}}),g.city.extend({maxLength:{params:l.ADDRESS_CITY_MAXIMUM_LENGTH?l.ADDRESS_CITY_MAXIMUM_LENGTH:t.CYBERSOURCE_CITY_MAXIMUM_LENGTH,message:a.translate("maxlengthValidationMsg",{fieldName:a.translate("cityText"),maxLength:l.ADDRESS_CITY_MAXIMUM_LENGTH?l.ADDRESS_CITY_MAXIMUM_LENGTH:t.CYBERSOURCE_CITY_MAXIMUM_LENGTH})}}),g.county.extend({required:!1,maxLength:{params:l.ADDRESS_CITY_MAXIMUM_LENGTH?l.ADDRESS_CITY_MAXIMUM_LENGTH:t.CYBERSOURCE_CITY_MAXIMUM_LENGTH,message:a.translate("maxlengthValidationMsg",{fieldName:a.translate("countyText"),maxLength:l.ADDRESS_CITY_MAXIMUM_LENGTH?l.ADDRESS_CITY_MAXIMUM_LENGTH:t.CYBERSOURCE_CITY_MAXIMUM_LENGTH})}}),g.addressType.extend({required:!1}),g.type.extend({required:{params:!0,onlyIf:function(){return g.saveToAccount()},message:a.translate("nickNameRequiredText")},maxLength:{params:t.ACCOUNT_NICKNAME_MAXIMUM_LENGTH,
- message:a.translate("maxlengthValidationMsg",{fieldName:a.translate("nickNamePlaceHolderText"),maxLength:t.ACCOUNT_NICKNAME_MAXIMUM_LENGTH})}}),g.postalCode.extend({maxLength:{params:t.CYBERSOURCE_POSTAL_CODE_MAXIMUM_LENGTH,message:a.translate("maxlengthValidationMsg",{fieldName:a.translate("zipCodeText"),maxLength:t.CYBERSOURCE_POSTAL_CODE_MAXIMUM_LENGTH})}}),g.phoneNumber.extend({maxLength:{params:t.CYBERSOURCE_PHONE_NUMBER_MAXIMUM_LENGTH,message:a.translate("maxlengthValidationMsg",{fieldName:a.translate("phoneNumberText"),maxLength:t.CYBERSOURCE_PHONE_NUMBER_MAXIMUM_LENGTH})}}),g.jobTitle.extend({required:!1}),g.companyName.extend({required:{params:!0,onlyIf:function(){return g.saveToAccount()},message:a.translate("companyNameRequiredText")}}),g.faxNumber.extend({required:!1}),g.isDefaultAddress.extend({required:!0}),g.isDefaultBillingAddress.extend({required:!0}),g.isDefaultShippingAddress.extend({required:!0}),g.dynamicProperties=e.observableArray([]),g.alias.isData=!0,g.prefix.isData=!0,g.firstName.isData=!0,g.middleName.isData=!0,g.lastName.isData=!0,g.suffix.isData=!0,g.country.isData=!0,g.postalCode.isData=!0,g.address1.isData=!0,g.address2.isData=!0,g.address3.isData=!0,g.city.isData=!0,g.state.isData=!0,g.county.isData=!0,g.phoneNumber.isData=!0,g.addressType.isData=!0,g.jobTitle.isData=!0,g.companyName.isData=!0,g.faxNumber.isData=!0,g.stateIsDropDown=e.computed(function(){return g.stateList().length>0},g),g.selectedCountry.subscribe(function(e){if(void 0===g.selectedCountry()||""===g.selectedCountry())g.country(""),g.postalCodePattern("");else if(g.countriesList()&&0!=g.countriesList().length)for(var r=0;r<g.countriesList().length;r++)g.countriesList()[r].countryCode==g.selectedCountry()&&g.country(g.countriesList()[r].displayName);else g.country(e);if(void 0!==g.selectedState()&&""!==g.selectedState()&&g.selectedState(null),g.stateList([]),g.countriesList())for(var r=0;r<g.countriesList().length;r++)g.countriesList()[r].countryCode===g.selectedCountry()&&(g.stateList(g.countriesList()[r].regions),g.selectedCountry()===t.UNITED_STATES?g.postalCodePattern(g.US_POSTAL_CODE_PATTERN):g.selectedCountry()===t.CANADA?g.postalCodePattern(g.CANADA_POSTAL_CODE_PATTERN):g.postalCodePattern(g.metadataPostalCodePattern?g.metadataPostalCodePattern:g.DEFAULT_POSTAL_CODE_PATTERN))}),g.computedAddressType=e.computed({read:function(){for(var e in this.predefinedAddressTypes())null!=this.predefinedAddressTypes()[e]&&void 0!=this.predefinedAddressTypes()[e]&&(this.predefinedAddressTypes()[e].repositoryId?this.selectedAddressTypes.push(this.predefinedAddressTypes()[e].repositoryId):this.selectedAddressTypes.push(this.predefinedAddressTypes()[e]));return this.selectedAddressTypes()},write:function(e){this.selectedAddressTypes(e)},owner:this}),g.computedCountry=e.computed({read:function(){var e=this.selectedCountry();return e?[e]:[]},write:function(e){1===e.length?(this.selectedCountry(e[0]),p.call(this,e[0])):this.selectedCountry(null)},owner:this}),g.computedState=e.computed({read:function(){var e=this.selectedState();return e?[e]:[]},write:function(e){1===e.length?(this.selectedState(e[0]),this.state(this.selectedState())):this.selectedState(null)},owner:this}),g.selectedState.subscribe(function(e){if(g.selectedState())if(g.stateList()&&0!=g.stateList().length){for(var t=0;t<g.stateList().length;t++)if(g.stateList()[t].abbreviation===g.selectedState()){g.state(g.stateList()[t].displayName),g.state_ISOCode(g.stateList()[t].regionCode);break}}else g.state(e);else g.state(""),g.state_ISOCode(""),g.selectedState("")}),g.postalCode.subscribe(function(e){}),g.applyExtendersInAddress=function(e){for(var r=this,i=r.dynamicPropertyMetaInfo.dynamicPropertyMetaCache[t.ENDPOINT_CONTACT_INFO_TYPE_WITH_BASE],a=[t.ORG_COUNTRY,t.PROFILE_FIRST_NAME,t.PROFILE_LAST_NAME,t.ORG_COMPANY_NAME],o=i.length,n=0;n<o;n++)a.indexOf(i[n].id())>-1?r.setPatternValidation(i[n].id(),i[n].validationPattern()):i[n].id()===t.ORG_ADDRESS_1?(r.address1.rules.remove(function(e){return e.rule==t.REQUIRED}),i[n].required()&&r.address1.extend({required:{params:!0,message:e.translate("addressLine1Required")}}),r.setPatternValidation(i[n].id(),i[n].validationPattern())):i[n].id()===t.ORG_CITY?(r.city.rules.remove(function(e){return e.rule==t.REQUIRED}),i[n].required()&&r.city.extend({required:{params:!0,message:e.translate("cityRequired")}}),r.setPatternValidation(i[n].id(),i[n].validationPattern())):i[n].id()===t.ORG_POSTAL_CODE?(r.postalCode.rules.remove(function(e){return e.rule==t.REQUIRED}),i[n].required()&&r.postalCode.extend({required:{params:!0,message:e.translate("zipCodeRequired")}}),null!==i[n].validationPattern()&&(r.metadataPostalCodePattern=i[n].validationPattern(),r.postalCode.extend({observablePattern:{params:r.postalCodePattern,onlyIf:function(){return""!=r.postalCodePattern()},message:e.translate("zipCodeInvalid")}}))):i[n].id()===t.ORG_PHONE_NUMBER?(r.phoneNumber.rules.remove(function(e){return e.rule==t.REQUIRED}),i[n].required()&&r.phoneNumber.extend({required:{params:!0,message:e.translate("phoneNumberRequiredText")}}),null!==i[n].validationPattern()&&r.phoneNumber.extend({pattern:{params:i[n].validationPattern(),message:e.translate("phoneNumberInvalid")}})):i[n].id()===t.ORG_STATE?(r.state.rules.remove(function(e){return e.rule==t.REQUIRED}),i[n].required()&&(r.state=r.state.extend({required:{params:!0,onlyIf:function(){return r.stateList().length>0},message:e.translate("stateRequired")}}))):(r[i[n].id()]&&r[i[n].id()].rules.remove(function(e){return e.rule==t.REQUIRED}),i[n].required()&&r[i[n].id()].extend({required:{params:!0,message:e.translate("requiredText",{label:e.translate(i[n].id()+"Text")})}}),r.setPatternValidation(i[n].id(),i[n].validationPattern()))},g.setPatternValidation=function(e,t){null!==t&&g[e].extend({observablePattern:{params:t,message:a.translate("invalidText",{label:a.translate(e+"Text")})}})},g.selectedAddressTypes.subscribe(function(e){g.availableAddressTypes();g.addressType([]);for(var t=g.availableAddressTypes().length,r=0;r<e.length;r++)for(var i=0;i<t;i++)g.availableAddressTypes()[i].value===e[r]&&(g.addressType.push(" "+g.availableAddressTypes()[i].label),g.isTypeModified(!0))}),g.compare=function(e){return g.alias()===e.alias()&&g.prefix()===e.prefix()&&g.firstName()===e.firstName()&&g.middleName()===e.middleName()&&g.lastName()===e.lastName()&&g.suffix()===e.suffix()&&g.address1()===e.address1()&&g.address2()===e.address2()&&g.address3()===e.address3()&&g.city()===e.city()&&g.state()===e.state()&&g.postalCode()===e.postalCode()&&g.country()===e.country()&&g.county()===e.county()&&g.phoneNumber()===e.phoneNumber()&&g.jobTitle()===e.jobTitle()&&g.companyName()===e.companyName()&&g.faxNumber()===e.faxNumber()&&g.isEqual(g.addressType(),e.addressType())},g.compareTo=function(e){return g.alias()===e.alias()&&g.address1()===e.address1()&&g.address2()===e.address2()&&g.address3()===e.address3()&&g.city()===e.city()&&g.state()===e.state()&&g.postalCode()===e.postalCode()&&g.country()===e.country()&&g.county()===e.county()&&g.phoneNumber()===e.phoneNumber()&&g.jobTitle()===e.jobTitle()&&g.companyName()===e.companyName()&&g.faxNumber()===e.faxNumber()&&g.isEqual(g.addressType(),e.addressType())},g.isModified=function(){return g.alias.isModified()||g.firstName.isModified()||g.lastName.isModified()||g.address1.isModified()||g.address2.isModified()||g.address3.isModified()||g.county.isModified()||g.city.isModified()||g.state.isModified()||g.postalCode.isModified()||g.phoneNumber.isModified()||g.country.isModified()||g.isDefaultAddress.isModified()||g.isDefaultBillingAddress.isModified()||g.isDefaultShippingAddress.isModified()||g.companyName.isModified()||g.isTypeModified()},g.isEmpty=function(){return""==g.alias()&&""==g.firstName()&&""==g.lastName()&&""==g.address1()&&""==g.address2()&&""==g.city()&&""==g.state()&&""==g.postalCode()&&null!=g.addressType()&&0===g.addressType().length},g.isValidForSelfRegistration=function(){return g.address1.isValid()&&g.address2.isValid()&&g.address3.isValid()&&g.city.isValid()&&g.state.isValid()&&g.postalCode.isValid()&&g.country.isValid()&&g.phoneNumber.isValid()&&g.companyName.isValid()},g.isValid=function(){var t=this;return t.alias.isValid()&&t.prefix.isValid()&&t.firstName.isValid()&&t.middleName.isValid()&&t.lastName.isValid()&&t.suffix.isValid()&&t.address1.isValid()&&t.address2.isValid()&&t.address3.isValid()&&t.city.isValid()&&t.state.isValid()&&t.postalCode.isValid()&&t.country.isValid()&&t.phoneNumber.isValid()&&t.jobTitle.isValid()&&t.companyName.isValid()&&t.faxNumber.isValid()&&(!e.isObservable(t.type)||t.type.isValid())},g.validateForShippingMethod=function(){return g.country.isValid()&&g.state.isValid()&&g.postalCode.isValid()},g.validateNow=function(){return g.alias.isModified(!0),g.prefix.isModified(!0),g.firstName.isModified(!0),g.middleName.isModified(!0),g.lastName.isModified(!0),g.suffix.isModified(!0),g.address1.isModified(!0),g.address2.isModified(!0),g.address3.isModified(!0),g.city.isModified(!0),g.state.isModified(!0),g.postalCode.isModified(!0),g.country.isModified(!0),g.county.isModified(!0),g.phoneNumber.isModified(!0),g.jobTitle.isModified(!0),g.companyName.isModified(!0),g.faxNumber.isModified(!0),e.isObservable(g.type)&&g.type.isModified(!0),g.isValid()},g.reset=function(){g.repositoryId="",g.alias(""),g.firstName(""),g.lastName(""),g.address1(""),g.address2(""),g.address3(""),g.city(""),g.county(""),g.selectedState(""),g.state(""),g.postalCode(""),g.selectedCountry(""),g.country(""),g.phoneNumber(""),g.companyName(""),g.type(""),g.addressType([]),g.email(null),g.isDefaultAddress(!1),g.isDefaultBillingAddress(!1),g.isDefaultShippingAddress(!1),g.alias.isModified(!1),g.companyName.isModified(!1),g.firstName.isModified(!1),g.lastName.isModified(!1),g.address1.isModified(!1),g.address2.isModified(!1),g.address3.isModified(!1),g.county.isModified(!1),g.city.isModified(!1),g.state.isModified(!1),g.postalCode.isModified(!1),g.country.isModified(!1),g.phoneNumber.isModified(!1),g.isDefaultAddress.isModified(!1),g.selectedCountry(g.defaultCountry()),e.isObservable(g.type)&&g.type.isModified(!1),g.isTypeModified(!1),g.resetDynamicProperties()},g.copyTo=function(t){var r={ignore:["invalidTracker","saveToAccount","saveAddressTo"]},i=e.mapping.toJS(g,r),a=JSON.stringify(i);return e.mapping.fromJS(JSON.parse(a),g.listOfCopyToIgnoreProperties(),t),t.alias(g.alias()||""),t.prefix(g.prefix()||""),t.firstName(g.firstName()||""),t.middleName(g.middleName()||""),t.lastName(g.lastName()||""),t.suffix(g.suffix()||""),t.address1(g.address1()||""),t.address2(g.address2()||""),t.address3(g.address3()||""),t.city(g.city()||""),t.postalCode(g.postalCode()||""),t.county(g.county()||""),t.email(e.utils.unwrapObservable(g.email)),t.selectedCountry(g.selectedCountry()),t.selectedState(g.selectedState()),t.addressType(g.addressType()),t.selectedAddressTypes(g.predefinedAddressTypes()),t.phoneNumber(g.phoneNumber()||""),t.jobTitle(g.jobTitle()||""),t.companyName(g.companyName()||""),t.faxNumber(g.faxNumber()||""),t.repositoryId=g.repositoryId,t.isDefaultAddress(g.isDefaultAddress()||!1),t.isDefaultBillingAddress(g.isDefaultBillingAddress()||!1),t.isDefaultShippingAddress(g.isDefaultShippingAddress()||!1),t.type(g.type()||""),t.__ko_mapping__.ignore=[],t},g.isEqual=function(e,t){var r=e.length,i=t.length;if(r!==i)return!1;for(var a=!0,o=0;o<r;o++)if(a=$.inArray(e[o],t)!==-1,!a)return a;return a},g.toJSON=function(){var t={ignore:["invalidTracker","saveToAccount","saveAddressTo","dynamicPropertyMetaInfo","addressTypeslist","countryList","stateList","stateIsDropDown","postalCodePattern","US_POSTAL_CODE_PATTERN","CANADA_POSTAL_CODE_PATTERN","DEFAULT_POSTAL_CODE_PATTERN","countriesList","metadataPostalCodePattern"],include:["address1","address2","address3","alias","city","companyName","country","countryName","county","faxNumber","firstName","isDefaultAddress","jobTitle","lastName","middleName","phoneNumber","postalCode","prefix","suffix","regionName","repositoryId","state","selectedState","selectedCountry","isDefaultBillingAddress","isDefaultShippingAddress","isDefaultAddress","toJSON","state_ISOCode","type"]},r=e.mapping.toJS(this,t);return r.email||(r.email=null),r.types=g.getFormattedAddressTypes(),delete r.availableAddressTypes,r},g.getFormattedAddressTypes=function(){var e=[],t=g.selectedAddressTypes();if(t&&void 0!=t&&0!=t.length)for(var r in t)t[r]&&e.push({id:t[r]});return e},g.listOfCopyToIgnoreProperties=function(){var e={ignore:["alias","prefix","firstName","lastName","middleName","suffix","address1","address2","address3","city","postalCode","county","email","selectedState","selectedCountry","phoneNumber","jobTitle","companyName","faxNumber","repositoryId","isDefaultAddress","isDefaultBillingAddress","isDefaultShippingAddress","type","computedCountry","computedState","dynamicProperties","selectedAddressTypes","computedAddressType"]};return e},g.listOfCopyFromIgnoreProperties=function(){var e={ignore:["address1","address2","address3","alias","city","companyName","country","countryName","county","faxNumber","firstName","isDefaultAddress","jobTitle","lastName","middleName","phoneNumber","postalCode","prefix","suffix","regionName","repositoryId","state","invalidTracker","computedCountry","computedState","dynamicProperties","addressType","computedAddressType"]};return e},g.copyFrom=function(t,r){g=this;var i,a=!1;if(e.mapping.fromJS(JSON.parse(JSON.stringify(t)),g.listOfCopyFromIgnoreProperties(),g),g.alias(t.alias||""),g.firstName(t.firstName||""),g.middleName(t.middleName||""),g.lastName(t.lastName||""),g.address1(t.address1||""),g.address2(t.address2||""),g.address3(t.address3||""),g.city(t.city||""),g.county(t.county||""),g.postalCode(t.postalCode||""),g.phoneNumber(t.phoneNumber||""),g.prefix(t.prefix||""),g.suffix(t.suffix||""),void 0!=t.types&&void 0!=t.types[0]&&g.predefinedAddressTypes(t.types||""),e.isObservable(g.email)&&g.email(t.email),g.repositoryId=t.repositoryId,t.selectedCountry?g.selectedCountry(t.selectedCountry):r&&0!=r.length?($.each(r,function(e,r){if(r.countryCode===t.country)return a=!0,g.selectedCountry(r.countryCode),i=r.regions,!1}),a===!1&&g.selectedCountry("")):g.selectedCountry(t.country),t.selectedState?g.selectedState(t.selectedState):i&&0!=i.length?$.each(i,function(e,r){if(r.abbreviation===t.state)return g.selectedState(r.abbreviation),g.state(r.displayName),g.state_ISOCode(r.regionCode),!1}):g.selectedState(t.state),t.selectedAddressTypes)g.selectedAddressTypes(t.selectedAddressTypes);else if(g.predefinedAddressTypes&&0!=g.predefinedAddressTypes().length){g.selectedAddressTypes=e.observableArray([]),g.addressType=e.observableArray([]);var o=g.availableAddressTypes().length;for(var n in g.predefinedAddressTypes()){var s=g.predefinedAddressTypes()[n].repositoryId;g.selectedAddressTypes.push(s);for(var l=0;l<o;l++)g.availableAddressTypes()[l].value===s&&g.addressType.push(g.availableAddressTypes()[l].label)}}else g.selectedAddressTypes=e.observableArray([]);g.jobTitle(t.jobTitle||""),g.companyName(t.companyName||""),g.faxNumber(t.faxNumber||""),g.isDefaultAddress(t.isDefaultAddress||!1),g.isDefaultBillingAddress(t.isDefaultBillingAddress||!1),g.isDefaultShippingAddress(t.isDefaultShippingAddress||!1),g.type(t.type||""),g.__ko_mapping__.ignore=[]},g.resetModified=function(){g.alias.isModified(!1),g.companyName.isModified(!1),g.firstName.isModified(!1),g.lastName.isModified(!1),g.address1.isModified(!1),g.address2.isModified(!1),g.city.isModified(!1),g.state.isModified(!1),g.postalCode.isModified(!1),g.country.isModified(!1),g.phoneNumber.isModified(!1),g.isDefaultAddress.isModified(!1),g.isDefaultBillingAddress.isModified(!1),g.isDefaultShippingAddress.isModified(!1),e.isObservable(g.type)&&g.type.isModified(!1),g.isTypeModified(!1)},g.defaultCountry=function(){if(g.countriesList()&&g.countriesList().length>0){if(null!==g.defaultCountryCode())for(var e in g.countriesList())if(g.defaultCountryCode()===g.countriesList()[e].countryCode)return g.defaultCountryCode();return g.countriesList()[0].countryCode}},g.selectedCountry(g.defaultCountry()),g.populateDynamicPropertiesMetaData=function(){var e=this,r={};r[t.PARENT]=t.ENDPOINT_CONTACT_INFO_TYPE,e.dynamicPropertyMetaInfo&&e.dynamicPropertyMetaInfo.dynamicPropertyMetaCache&&!e.dynamicPropertyMetaInfo.dynamicPropertyMetaCache.hasOwnProperty(t.ENDPOINT_CONTACT_INFO_TYPE)&&n.request(t.ENDPOINT_GET_ITEM_TYPE,r,function(r){e.dynamicPropertyMetaInfo.intializeDynamicProperties(r.specifications,t.ENDPOINT_CONTACT_INFO_TYPE)},function(e){},t.ENDPOINT_CONTACT_INFO_TYPE)},g.resetDynamicProperties=function(){var t=this;e.utils.arrayForEach(t.dynamicProperties(),function(e){e.reset(),void 0!==e.value()&&null!==e.value()||!e.default()||e.value(e.default())})},g.createAndInitialiseDynamicProperties=function(){var e=g.dynamicPropertyMetaInfo.dynamicPropertyMetaCache[t.ENDPOINT_CONTACT_INFO_TYPE];g.dynamicProperties.removeAll();var r=g.dynamicPropertyMetaInfo.createDynamicProperties(e,t.ADDRESS_TEXT);if(g.dynamicProperties(r),g.dynamicProperties().length>0)for(var i in g.dynamicProperties())g[g.dynamicProperties()[i].id()]=g.dynamicProperties()[i].value},g.createAndInitialiseDynamicProperties(),h.done(function(){g.applyExtendersInAddress(a)}),g}var p=t.ENDPOINT_GET_ITEM_TYPE,h=$.Deferred(),g={};return g[t.PARENT]=t.ENDPOINT_CONTACT_INFO_TYPE,g[t.INCLUDE_BASE]="true",n.request(p,g,function(e){s.getInstance().intializeDynamicProperties(e.base,t.ENDPOINT_CONTACT_INFO_TYPE_WITH_BASE),h.resolve()},function(e){},t.ENDPOINT_CONTACT_INFO_TYPE),u}),define("viewModels/shipping-group-relationship",["require","knockout","ccConstants","CCi18n","ccStoreConfiguration","ccStoreUtils","ccRestClient","ccDate","viewModels/address"],function(e){"use strict";function t(e,t){var n=this;t=t||0,n.catRefId=e.catRefId,n.productId=e.productId,n.childItems=e.childItems,n.assetable=e.assetable,n.shippable=e.shippable,n.allowVirtualShippingGroup=e.allowVirtualShippingGroup,n.isVirtualShippingGroup=e.isVirtualShippingGroup,n.quantity=r.observable(t),n.updatableQuantity=r.observable(t),n.stockStatus=r.observable(!0),e.availabilityDate&&r.isObservable(e.availabilityDate)?n.availabilityDate=r.observable(e.availabilityDate()):e.availabilityDate?n.availabilityDate=r.observable(e.availabilityDate):n.availabilityDate=r.observable(),n.stockState=r.observable(),e.stockState&&(r.isObservable(e.stockState)&&""!==e.stockState()?n.stockState(e.stockState()):r.isObservable(e.stockState)||""===e.stockState||n.stockState(e.stockState)),n.orderableQuantityMessage=r.observable(),n.shippingOptions=r.observableArray(),n.shippingAddress=r.observable(),n.shippingMethod=r.observable(),n.isPickupInStore=r.observable(),n.selectedStore=r.observable(),n.shippingGroupId=r.pureComputed(function(){var e=n.productId+n.catRefId+n.quantity();return n.shippingAddress&&null!=n.shippingAddress()&&(e+=n.shippingAddress()),n.shippingMethod&&null!=n.shippingMethod()&&(e+=n.shippingMethod()),n.selectedStore&&null!=n.selectedStore()?e+n.selectedStore().locationId:e},n).extend({deferred:!0}),n.detailedItemPriceInfo=e.detailedItemPriceInfo,r.isObservable(e.detailedItemPriceInfo)?n.detailedItemPriceInfoObservable=r.observableArray(e.detailedItemPriceInfo()):n.detailedItemPriceInfoObservable=r.observableArray(e.detailedItemPriceInfo),e.price&&r.isObservable(e.price)?n.price=r.observable(e.price()):n.price=r.observable(e.price),n.unitPrice=r.observable(e.unitPrice),n.availablePickupDate=r.observable(),n.preferredPickupDate=r.observable(),e.availablePickupDate&&(n.availablePickupDate=r.observable(e.availablePickupDate)),e.preferredPickupDate&&(n.preferredPickupDate=r.observable(e.preferredPickupDate)),n.firstName=r.observable(),n.middleName=r.observable(),n.lastName=r.observable(),n.phoneNumber=r.observable(),n.updatableQuantity.extend({required:{params:!0,message:a.t("ns.common:resources.quantityRequireMsg")},digit:{params:!0,message:a.t("ns.common:resources.quantityNumericMsg")},trigger:{value:"0",message:a.t("ns.common:resources.removeItemMsg")}}),n.firstName.extend({maxLength:{params:o.ADDRESS_FIRSTNAME_MAXIMUM_LENGTH?o.ADDRESS_FIRSTNAME_MAXIMUM_LENGTH:i.CYBERSOURCE_FIRSTNAME_MAXIMUM_LENGTH,message:a.t("ns.common:resources.maxlengthValidationMsg",{fieldName:a.t("ns.common:resources.firstNameText"),maxLength:o.ADDRESS_FIRSTNAME_MAXIMUM_LENGTH?o.ADDRESS_FIRSTNAME_MAXIMUM_LENGTH:i.CYBERSOURCE_FIRSTNAME_MAXIMUM_LENGTH})}}),n.lastName.extend({maxLength:{params:o.ADDRESS_LASTNAME_MAXIMUM_LENGTH?o.ADDRESS_LASTNAME_MAXIMUM_LENGTH:i.CYBERSOURCE_LASTNAME_MAXIMUM_LENGTH,message:a.t("ns.common:resources.maxlengthValidationMsg",{fieldName:a.t("ns.common:resources.lastNameText"),maxLength:o.ADDRESS_LASTNAME_MAXIMUM_LENGTH?o.ADDRESS_LASTNAME_MAXIMUM_LENGTH:i.CYBERSOURCE_LASTNAME_MAXIMUM_LENGTH})}}),n.phoneNumber.extend({pattern:{params:"^[0-9()+ -]+$",message:a.t("ns.common:resources.phoneNumberInvalid")},maxLength:{params:i.CYBERSOURCE_PHONE_NUMBER_MAXIMUM_LENGTH,message:a.t("ns.common:resources.maxlengthValidationMsg",{fieldName:a.t("ns.common:resources.phoneNumberText"),maxLength:i.CYBERSOURCE_PHONE_NUMBER_MAXIMUM_LENGTH})}}),n.addLimitsValidation=function(e,t,r,o,l,c){for(var d,u=n.quantity(),p=null,h=0;h<t.length;h++)n.productId===t[h].productId&&n.catRefId===t[h].catRefId&&(p=t[h]);if(null!==p){e.productData()&&e.productData().notForIndividualSale&&e.isThisGWPCommerceItemAndValid()&&p&&(p.orderLimit=n.quantity());var g="IN_STOCK"===p.stockStatus||"PREORDERABLE"===p.stockStatus||"BACKORDERABLE"===p.stockStatus;if(n.stockStatus(g),p&&(u=p.orderLimit,n.availabilityDate(p.availabilityDate)),n.updatableQuantity.rules.remove(function(e){return"max"==e.rule}),n.updatableQuantity.rules.remove(function(e){return"maxItemQuantity"==e.rule}),d=o?l:p.orderableQuantity,null!==d&&!isNaN(d)&&d>0){var f=a.t("ns.common:resources.insufficientStockMsg",{stockLimit:u&&u<d?u:d});n.updatableQuantity.extend({maxItemQuantity:{params:{orderableQuantity:d,totalQuantity:n.getItemQuantityInCart,orderLimit:u},message:f}})}else{var m=a.t("ns.common:resources.outOfStockMsg");n.updatableQuantity.extend({max:{params:0,message:m}})}var I="";s.profileType===i.PROFILE_TYPE_AGENT?I=n.getOrderableQuantityMessageForAgent(e,p,r,o,c):(r&&p&&null!==p&&p.inStockQuantity>0&&n.updatableQuantity()>p.inStockQuantity&&(p.backOrderableQuantity>0?I=a.t("ns.common:resources.partialBackOrderMsg",{stockLimit:p.inStockQuantity}):p.preOrderableQuantity>0&&(I=a.t("ns.common:resources.partialPreOrderMsg",{stockLimit:p.inStockQuantity}))),t&&n.stockState(p.stockStatus)),n.orderableQuantityMessage(I),n.updatableQuantity.isModified(!0)}},n.getOrderableQuantityMessageForAgent=function(e,t,r,o,n,s){var c,d=this,u="",p="IN_STOCK",h=t.inStockQuantity,g=t.backOrderableQuantity,f=t.preOrderableQuantity;c=s?e.quantity*s:e.updatableQuantity();var m=c<t.orderableQuantity?c:t.orderableQuantity,I=e.productId+":"+e.catRefId;if(o&&n[I]){g+=n[I].backOrderQuantity,f+=n[I].preOrderQuantity,h+=n[I].inStockQuantity;var E=m-h;E>0?E-g>0?(u=a.t("ns.common:resources.AgentPreorderableText",{stockLimit:a.t("ns.common:resources.asteriskSymbol")}),p=i.PREORDERABLE):(u=a.t("ns.common:resources.AgentBackorderableText",{stockLimit:a.t("ns.common:resources.asteriskSymbol")}),p=i.BACKORDERABLE):p="IN_STOCK"}else t.stockStatus&&m-h>0?g>0?(u=a.t("ns.common:resources.AgentBackorderableText",{stockLimit:a.t("ns.common:resources.asteriskSymbol")}),p=i.BACKORDERABLE):f>0&&(u=a.t("ns.common:resources.AgentPreorderableText",{stockLimit:a.t("ns.common:resources.asteriskSymbol")}),p=i.PREORDERABLE):t.stockStatus&&"BACKORDERABLE"===t.stockStatus?u=a.t("ns.common:resources.AgentBackorderableText",{stockLimit:a.t("ns.common:resources.asteriskSymbol")}):t.stockStatus&&"PREORDERABLE"===t.stockStatus&&(u=a.t("ns.common:resources.AgentPreorderableText",{stockLimit:a.t("ns.common:resources.asteriskSymbol")}));return d.stockState(p),d.availabilityDate(t.availabilityDate?l.dateTimeFormatter(t.availabilityDate,null,"medium"):""),u.trim()},n.addConfigurableStockValidation=function(e,t,o,l,c){for(var d,u=0,p=0,h=!1,g=null,f=null,m=0;m<e.length;m++)if(n.productId===e[m].productId&&n.catRefId===e[m].catRefId){if(d=o&&l[e[m].productId+":"+e[m].catRefId]?l[e[m].productId+":"+e[m].catRefId]:e[m].orderableQuantity,"IN_STOCK"===e[m].stockStatus||t&&("BACKORDERABLE"===e[m].stockStatus||"PREORDERABLE"===e[m].stockStatus)||s.profileType===i.PROFILE_TYPE_AGENT&&d>0)if(null!==d&&!isNaN(d)&&d>0){var I="";h=!0,g=e[m].availabilityDate,f=e[m].stockStatus,u=d,p=e[m].orderLimit,s.profileType===i.PROFILE_TYPE_AGENT?I=n.getOrderableQuantityMessageForAgent(n,e[m],t,o,c):t&&e[m].inStockQuantity>0&&n.updatableQuantity()>e[m].inStockQuantity&&(e[m].backOrderableQuantity>0?I=a.t("ns.common:resources.partialBackOrderMsg",{stockLimit:e[m].inStockQuantity}):e[m].preOrderableQuantity>0&&(I=a.t("ns.common:resources.partialPreOrderMsg",{stockLimit:e[m].inStockQuantity})))}else h=!1;else h=!1;break}if(n.childItems&&h)for(var m=0;m<n.childItems.length;m++){for(var E=n.childItems[m].productId,y=n.childItems[m].catRefId,v=r.utils.unwrapObservable(n.childItems[m].quantity),b=0,T=0;T<e.length;T++)if(E===e[T].productId&&y===e[T].catRefId){if(b=o&&l[E+":"+y]?l[E+":"+y]:e[T].orderableQuantity,"IN_STOCK"===e[T].stockStatus||t&&("BACKORDERABLE"===e[T].stockStatus||"PREORDERABLE"===e[T].stockStatus)||s.profileType===i.PROFILE_TYPE_AGENT&&b>0)if(null!==b&&!isNaN(b)&&b>0){var P=Math.floor(b/v);if(u=u>P?P:u,p=p>e[T].orderLimit?e[T].orderLimit:p,h=!0,s.profileType===i.PROFILE_TYPE_AGENT){var S=n.updatableQuantity();I=n.getOrderableQuantityMessageForAgent(n.childItems[m],e[T],t,o,c,S)}}else h=!1;else h=!1;break}if(!h)break}if(s.profileType!==i.PROFILE_TYPE_AGENT&&(n.availabilityDate(g),n.stockState(f)),n.stockStatus(h),n.orderableQuantityMessage(I),n.updatableQuantity.rules.remove(function(e){return"max"==e.rule}),n.updatableQuantity.rules.remove(function(e){return"maxItemQuantity"==e.rule}),h&&u>0){var C=a.t("ns.common:resources.insufficientStockMsg",{stockLimit:u>p?p:u});n.updatableQuantity.extend({maxItemQuantity:{params:{orderableQuantity:u,totalQuantity:n.getItemQuantityInCart,orderLimit:p,childItems:n.childItems},message:C}})}else{var _=a.t("ns.common:resources.configurableProductOutOfStockMsg");n.updatableQuantity.extend({max:{params:0,message:_}})}n.updatableQuantity.isModified(!0)}}var r=e("knockout"),i=e("ccConstants"),a=e("CCi18n"),o=e("ccStoreConfiguration"),n=e("ccStoreUtils"),s=e("ccRestClient"),l=e("ccDate"),c=e("viewModels/address");return t.prototype.update=function(e,t){var i=e.quantity();if(t&&(i+=this.quantity(),this.updatableQuantity(i)),this.quantity(i),this.price(e.price()),this.unitPrice(e.unitPrice()),this.detailedItemPriceInfo=e.detailedItemPriceInfo,r.isObservable(e.detailedItemPriceInfo)?this.detailedItemPriceInfoObservable(e.detailedItemPriceInfo()):this.detailedItemPriceInfoObservable(e.detailedItemPriceInfo),this.shippingAddress()&&null!==this.shippingAddress().postalCode&&void 0!==this.shippingAddress().postalCode&&!r.isObservable(this.shippingAddress().postalCode)){var a=this.createAddress(this.shippingAddress());a&&a.isValid&&a.isValid()&&e.shippingAddress()&&e.shippingAddress().isValid&&e.shippingAddress().isValid()&&(this.shippingAddress().country=e.shippingAddress().country(),this.shippingAddress().state=e.shippingAddress().state())}else this.shippingAddress()&&this.shippingAddress().isValid&&this.shippingAddress().isValid()&&e.shippingAddress()&&e.shippingAddress().isValid&&e.shippingAddress().isValid()&&(this.shippingAddress().country(e.shippingAddress().country()),this.shippingAddress().state(e.shippingAddress().state()))},t.prototype.populateUserDetails=function(e){e&&e.loggedIn()&&(this.firstName()||this.firstName(e.firstName()),this.lastName()||this.lastName(e.lastName()),!this.phoneNumber()&&e.contactShippingAddress&&this.phoneNumber(e.contactShippingAddress.phoneNumber))},t.prototype.hashCode=function(e){var t=this.productId+this.catRefId;if(e&&null!==e&&""!==e&&(t+=e),this.isPickupInStore()&&this.selectedStore()&&this.selectedStore().store)t+=this.selectedStore().store.locationId,this.availablePickupDate()&&(t+=this.availablePickupDate());else if(this.shippingAddress()&&this.shippingMethod()){if(null===this.shippingAddress().postalCode||void 0===this.shippingAddress().postalCode||r.isObservable(this.shippingAddress().postalCode))this.shippingAddress().isValid&&this.shippingAddress().isValid()&&(t+=this.shippingAddress().firstName()+this.shippingAddress().lastName()+this.shippingAddress().address1()+this.shippingAddress().city()+this.shippingAddress().selectedState()+this.shippingAddress().selectedCountry()+this.shippingAddress().postalCode());else{var i=this.createAddress(this.shippingAddress());i.isValid&&i.isValid()&&(t+=i.firstName()+i.lastName()+i.address1()+i.city()+i.selectedState()+i.selectedCountry()+i.postalCode())}t+=this.shippingMethod().value||this.shippingMethod().id||this.shippingMethod().repositoryId}return n.getHashCode(t)},t.prototype.createAddress=function(e){var t={translate:function(e,t){return a.t("ns.common:resources."+e,t)}},r=new c("split-shipping-address","",t,"","");return r.copyFrom(e,[]),r},t.prototype.generateKey=function(){var e=this.shippingAddress(),t=this.shippingMethod(),a=this.selectedStore(),o="";if(this.isPickupInStore())return o+=a.locationId,this.availablePickupDate&&null!==this.availablePickupDate&&r.isObservable(this.availablePickupDate)&&this.availablePickupDate()&&(o+=this.availablePickupDate()),o;if(this.allowVirtualShippingGroup&&(o+=this.isVirtualShippingGroup?i.VIRTUAL_SHIPPING_GROUP_TYPE:i.HARDGOOD_SHIPPING_GROUP_TYPE),e){var n;if(e.hasOwnProperty("toJSON"))n=e.toJSON();else{var s={ignore:["invalidTracker"]};n=r.mapping.toJSON(e,s)}var l=n.email;delete n.email,n.email=l,o+=JSON.stringify(n)}return t&&(t.repositoryId&&(o+=t.repositoryId),t.value&&(o+=t.value)),o},t.prototype.asMap=function(e){var t={},a=this.generateKey(),o={};if(this.commerceItemId)var n=this.catRefId+"_"+this.commerceItemId;else var n=this.catRefId;var s;if(this.shippingAddress())if(this.shippingAddress().hasOwnProperty("toJSON"))s=this.shippingAddress().toJSON();else{var l={ignore:["invalidTracker"]};s=r.mapping.toJS(this.shippingAddress(),l)}!e||!s||s.email&&s.email==e||(s.email=e);var c;this.shippingMethod()&&this.shippingMethod().repositoryId?c={value:this.shippingMethod().repositoryId}:this.shippingMethod()&&this.shippingMethod().value&&(c={value:this.shippingMethod().value});var d=this.selectedStore()?this.selectedStore().locationId:null;if(this.commerceItemId?o[n]={productId:this.productId,catRefId:this.catRefId,quantity:parseFloat(this.quantity(),10),childItems:this.childItems,commerceItemId:this.commerceItemId}:o[n]={productId:this.productId,catRefId:this.catRefId,childItems:this.childItems,quantity:parseFloat(this.quantity(),10)},this.isPickupInStore()){o[n].availablePickupDate=this.availablePickupDate(),o[n].preferredPickupDate=this.preferredPickupDate();var u=this.firstName(),p=this.lastName(),h=this.phoneNumber();t[a]={items:o,type:i.INSTORE_PICKUP,locationId:d,firstName:u,lastName:p,phoneNumber:h}}else this.allowVirtualShippingGroup&&this.isVirtualShippingGroup?t[a]={items:o,type:i.VIRTUAL_SHIPPING_GROUP_TYPE,shippingAddress:s,shippingMethod:{value:i.VIRTUAL_SHIPPING_GROUP_TYPE}}:t[a]={items:o,type:i.HARDGOOD_SHIPPING_GROUP_TYPE,shippingAddress:s,shippingMethod:c};return t},t.prototype.addQuantity=function(e){this.quantity(parseFloat(this.quantity())+parseFloat(e)),this.updatableQuantity(this.quantity())},t}),define("viewModels/cart-item-external-data",["knockout"],function(e){"use strict";function t(t){t=t||{},this.name=e.observable(t.name),this.actionCode=e.observable(t.actionCode),this.values=e.observable(t.values)}return t.prototype.toJSON=function(){var t=e.toJS(this);return t},t}),define("viewModels/cart-item",["require","knockout","pubsub","CCi18n","jquery","ccConstants","pageLayout/site","currencyHelper","koMapping","viewModels/shipping-group-relationship","viewModels/cart-item-external-data","ccStoreConfiguration","viewModels/address","ccRestClient","ccDate"],function(e){
- "use strict";function t(){return{productId:arguments[0],productData:arguments[1],quantity:arguments[2],catRefId:arguments[3],selectedOptions:arguments[4],currency:arguments[5],discountInfo:arguments[6],rawTotalPrice:arguments[7],externalPrice:arguments[8],externalPriceQuantity:arguments[9],configuratorId:arguments[10],childItems:arguments[11],commerceItemId:arguments[12],unpricedExternalMessage:arguments[13],externalData:arguments[14],actionCode:arguments[15],lineAttributes:arguments[16],backOrderQuantity:arguments[17],preOrderQuantity:arguments[18],externalRecurringCharge:arguments[19],externalRecurringChargeFrequency:arguments[20],externalRecurringChargeDuration:arguments[21],addOnItem:arguments[22],shopperInput:arguments[23],configurablePropertyId:arguments[24],configurationOptionId:arguments[25],selectedStore:arguments[26],shippingGroupRelationships:arguments[27]}}function r(e){var g=this;if(arguments.length>1&&"object"!=typeof arguments[0])return r.call(this,t.apply(void 0,arguments));e=e||{};var E=e.externalData||[],y=e.productData||{};if(g.productId=e.productId,g.productData=i.observable(e.productData),g.quantity=i.observable(e.quantity),g.repositoryId="",g.availabilityDate=i.observable(y.availabilityDate||null),g.catRefId=e.catRefId,g.itemTotal=i.observable(0),g.expanded=i.observable(!1),g.stockStatus=i.observable(!0),g.stockState=i.observable(y.stockState||""),g.orderableQuantityMessage=i.observable(),g.updatableQuantity=i.observable(e.quantity),g.commerceItemQuantity=i.observable(e.quantity),g.orderableQuantity=i.observable(),g.backOrderableQuantity=i.observable(e.backOrderQuantity),g.preOrderableQuantity=i.observable(e.preOrderQuantity),g.soldAsPackage=i.observable(e.soldAsPackage),g.assetable=y.assetable,g.shippable=y.shippable,g.allowVirtualShippingGroup=e.allowVirtualShippingGroup,g.isVirtualShippingGroup=e.isVirtualShippingGroup,g.selectedOptions=e.selectedOptions,g.selectedSkuProperties=[],g.discountInfo=i.observable(e.discountInfo),g.rawTotalPrice=i.observable(e.rawTotalPrice),g.detailedItemPriceInfo=i.observableArray(),g.detailedRecurringChargeInfo=i.observableArray(),g.overriddenPrice=i.observable(),g.priceOverrideReason=i.observable(),g.discountAmount=i.observable(0),g.isPriceOverridden=i.observable(),g.isUpdate=i.observable(!1),g.externalPrice=i.observable(e.externalPrice),g.externalPriceQuantity=i.observable(e.externalPriceQuantity),g.processed=!1,g.externalData=i.observableArray(E.map(function(e){return new p(e)})),g.addOnItem=!1,e.addOnItem&&(g.addOnItem=e.addOnItem),g.shopperInput=void 0,e.shopperInput&&(g.shopperInput=e.shopperInput),g.configurablePropertyId=void 0,e.configurablePropertyId&&(g.configurablePropertyId=e.configurablePropertyId),g.configurationOptionId=void 0,e.configurationOptionId&&(g.configurationOptionId=e.configurationOptionId),g.actionCode=i.observable(e.actionCode),g.externalRecurringCharge=i.observable(e.externalRecurringCharge),g.externalRecurringChargeFrequency=i.observable(e.externalRecurringChargeFrequency),g.externalRecurringChargeDuration=i.observable(e.externalRecurringChargeDuration),g.assetKey=i.observable(e.assetKey),g.rootAssetKey=i.observable(e.rootAssetKey),g.parentAssetKey=i.observable(e.parentAssetKey),g.serviceId=i.observable(e.serviceId),g.customerAccountId=i.observable(e.customerAccountId),g.billingAccountId=i.observable(e.billingAccountId),g.serviceAccountId=i.observable(e.serviceAccountId),g.billingProfileId=i.observable(e.billingProfileId),g.activationDate=i.observable(e.activationDate),g.deactivationDate=i.observable(e.deactivationDate),g.transactionDate=i.observable(e.transactionDate),g.isPersonalized=i.observable(!1),g.asset=i.observable(e.asset),e.shippingGroupRelationships&&e.shippingGroupRelationships.length>0)e.shippingGroupRelationships=n.map(e.shippingGroupRelationships,function(e,t){var r;if(e&&i.isObservable(e.quantity))return e.sgID=e.productId+e.catRefId+t,e;e.shippingAddress&&(r=g.getAddressObject(e.shippingAddress));var a=new u(e,e.quantity);if(a.sgID=a.productId+a.catRefId+t,e.selectedStore){if(a.selectedStore(e.selectedStore),a.isPickupInStore(!(!e.selectedStore||!e.selectedStore.store.locationId)),e.firstName&&a.firstName(e.firstName),e.lastName&&a.lastName(e.lastName),e.phoneNumber&&a.phoneNumber(e.phoneNumber),e.selectedStore.inventoryDetails&&e.selectedStore.inventoryDetails.length>0)for(var t=0;t<e.selectedStore.inventoryDetails.length;t++){var o=e.selectedStore.inventoryDetails[t];o.locationId===e.selectedStore.store.locationId&&a.availabilityDate(o.availabilityDate)}}else a.shippingAddress(r),a.shippingMethod(e.shippingMethod),a.isPickupInStore(!1),a.availabilityDate(g.availabilityDate());return a.price(e.price),a.unitPrice(e.unitPrice),a});else{e.shippingGroupRelationships=[];var v=new u(g,e.quantity);if(v.sgID=v.productId+v.catRefId+"0",e.selectedStore&&(v.selectedStore(e.selectedStore),e.hasOwnProperty("availablePickupDateTime")&&e.availablePickupDateTime&&v.availablePickupDate(e.availablePickupDateTime()),v.isPickupInStore(!(!e.selectedStore||!e.selectedStore.store.locationId)),e.selectedStore.inventoryDetails&&e.selectedStore.inventoryDetails.length>0))for(var b=0;b<e.selectedStore.inventoryDetails.length;b++){var T=e.selectedStore.inventoryDetails[b];T.locationId===e.selectedStore.store.locationId&&v.availabilityDate(T.availabilityDate)}e.shippingGroupRelationships.push(v)}if(g.shippingGroupRelationships=i.observableArray(e.shippingGroupRelationships),e.lineAttributes)for(var P=0;P<e.lineAttributes().length;P++)void 0===e.lineAttributes()[P].value()?g[e.lineAttributes()[P].id()]=i.observable(e.lineAttributes()[P].default()):g[e.lineAttributes()[P].id()]=i.observable(e.lineAttributes()[P].value());g.displayName=i.observable(y.displayName||""),e.configuratorId&&(g.configuratorId=e.configuratorId),g.childItems=e.childItems,g.invalid=!1,g.isGWPChoicesAvaliable=i.observable(!1),y.giftProductData&&(g.giftWithPurchaseSelections=[{giftWithPurchaseIdentifier:y.giftProductData.giftWithPurchaseIdentifier,promotionId:y.giftProductData.promotionId,giftWithPurchaseQuantity:y.giftProductData.giftWithPurchaseQuantity}]),g.commerceItemId=e.commerceItemId,g.updatableQuantity.extend({required:{params:!0,message:o.t("ns.common:resources.quantityRequireMsg")},digit:{params:!0,message:o.t("ns.common:resources.quantityNumericMsg")},trigger:{value:"0",message:o.t("ns.common:resources.removeItemMsg")}}),g.originalPrice=i.observable(0),g.currentPrice=i.observable(0),g.priceListGroupId=i.observable(l.getInstance().selectedPriceListGroup().id),g.priceChangedMessage=i.pureComputed(function(){return o.t("ns.common:resources.productPriceChanged",{originalPrice:c.handleFractionalDigits(g.externalPrice()?g.externalPrice():g.originalPrice(),e.currency?"":e.currency.fractionalDigits),currency:void 0===e.currency?"":e.currency.symbol})}),g.unpricedExternalMessage=i.observable(e.unpricedExternalMessage||""),g.isUnpricedError=i.observable(g.unpricedExternalMessage().length>0),g.unpricedErrorMessage=i.computed(function(){var e="";return e=g.childItems&&g.childItems.length>0?o.t("ns.common:resources.configurableProductNoPrice",{message:g.unpricedExternalMessage()}):o.t("ns.common:resources.noPrice")}),g.productPriceChanged=i.observable(!1),g.productPriceChanged.extend({trigger:{value:!0,message:g.priceChangedMessage}}),null==f&&h.getInstance().resetShippingGroupRelationships!==!1&&(f=n.Topic(a.topicNames.CART_UPDATE_QUANTITY_SUCCESS).subscribe(g.resetShippingGroupRelationships.bind(g))),g.setUnpricedError=function(e){g.isUnpricedError(!0),g.unpricedExternalMessage(e?e:"")},g.clearUnpricedError=function(){g.isUnpricedError(!1),g.unpricedExternalMessage("")},g.revertQuantity=function(){g.updatableQuantity(g.quantity())},g.removeSpaces=function(e){return e?e.replace(/\s+/g,"-"):""},g.optionText=function(e){for(var t=g.selectedOptions[e],r=e+1;r<g.selectedOptions.length;r++){var i=g.selectedOptions[r];if(i.optionValue)return o.t("ns.common:resources.optionHasNext",{optionName:t.optionName,optionValue:t.optionValue})}return o.t("ns.common:resources.optionLast",{optionName:t.optionName,optionValue:t.optionValue})},g.toJSON=function(){var e=d.defaultOptions().ignore;d.defaultOptions().ignore=["productData","itemTotal","updatableQuantity","productPriceChanged","originalPrice","priceChangedMessage","isGWPChoicesAvaliable","giftData","unpricedErrorMessage","unpricedExternalMessage","isUnpricedError","isPersonalized","currentPrice","shippingGroupRelationships","discountAmount","isPriceOverridden","isUpdate","processed"];var t=d.toJS(g);return d.defaultOptions().ignore=e,t},g.isThisGWPCommerceItemAndValid=function(){var e=g.giftWithPurchaseCommerceItemMarkers;return!!(e&&e.length>0)},g.addLimitsValidation=function(e,t,r,i,a,n,l){var c;if(g.productData()&&g.productData().notForIndividualSale&&g.isThisGWPCommerceItemAndValid()&&(r?r.orderLimit=g.quantity():c=g.quantity()),g.orderableQuantity=t,g.stockStatus(e),r&&(c=r.orderLimit,g.availabilityDate(r.availabilityDate)),g.updatableQuantity.rules.remove(function(e){return"max"==e.rule}),g.updatableQuantity.rules.remove(function(e){return"maxItemQuantity"==e.rule}),null!==t&&!isNaN(t)&&t>0){var d=o.t("ns.common:resources.insufficientStockMsg",{stockLimit:c&&c<t?c:t});g.updatableQuantity.extend({maxItemQuantity:{params:{orderableQuantity:t,totalQuantity:g.getItemQuantityInCart,orderLimit:c},message:d}})}else{var u=o.t("ns.common:resources.outOfStockMsg");g.updatableQuantity.extend({max:{params:0,message:u}})}var p="";m.profileType===s.PROFILE_TYPE_AGENT?p=g.getOrderableQuantityMessageForAgent(g,r,i,n,l):(i&&r&&r.inStockQuantity>0&&g.updatableQuantity()>r.inStockQuantity&&(r.backOrderableQuantity>0?p=o.t("ns.common:resources.partialBackOrderMsg",{stockLimit:r.inStockQuantity}):r.preOrderableQuantity>0&&(p=o.t("ns.common:resources.partialPreOrderMsg",{stockLimit:r.inStockQuantity}))),r&&g.stockState(r.stockStatus)),g.orderableQuantityMessage(p),g.updatableQuantity.isModified(!0),g.shippingGroupRelationships.extend({validation:[{validator:function(e){if(e)return!0},message:d}]}).isModified(!0)},g.getOrderableQuantityMessageForAgent=function(e,t,r,i,a,n){var l=this,c="",d="IN_STOCK",u=t.inStockQuantity,p=t.backOrderableQuantity,h=t.preOrderableQuantity,g=e.updatableQuantity()<t.orderableQuantity?e.updatableQuantity():t.orderableQuantity;n&&(g*=n);var f=e.productId+":"+e.catRefId;if(i&&a[f]){p+=a[f].backOrderQuantity,h+=a[f].preOrderQuantity,u+=a[f].inStockQuantity;var m=g-u;m>0?p>0?(c=o.t("ns.common:resources.AgentBackorderableText",{stockLimit:o.t("ns.common:resources.asteriskSymbol")}),d=s.BACKORDERABLE):h>0&&(c=o.t("ns.common:resources.AgentPreorderableText",{stockLimit:o.t("ns.common:resources.asteriskSymbol")}),d=s.PREORDERABLE):d="IN_STOCK"}else t.stockStatus&&g-u>0?p>0?(c=o.t("ns.common:resources.AgentBackorderableText",{stockLimit:o.t("ns.common:resources.asteriskSymbol")}),d=s.BACKORDERABLE):h>0&&(c=o.t("ns.common:resources.AgentPreorderableText",{stockLimit:o.t("ns.common:resources.asteriskSymbol")}),d=s.PREORDERABLE):t.stockStatus&&"BACKORDERABLE"===t.stockStatus?c=o.t("ns.common:resources.AgentBackorderableText",{stockLimit:o.t("ns.common:resources.asteriskSymbol")}):t.stockStatus&&"PREORDERABLE"===t.stockStatus&&(c=o.t("ns.common:resources.AgentPreorderableText",{stockLimit:o.t("ns.common:resources.asteriskSymbol")}));return l.stockState(d),l.availabilityDate(t.availabilityDate?I.dateTimeFormatter(t.availabilityDate,null,"medium"):""),c.trim()},g.addConfigurableStockValidation=function(e,t,r,a,n){for(var l=0,c=0,d=!1,u=null,p=null,h=0,f=0;f<e.length;f++)if(g.productId===e[f].productId&&g.catRefId===e[f].catRefId){if(h=r&&a&&a[e[f].productId+":"+e[f].catRefId]?a[e[f].productId+":"+e[f].catRefId]:e[f].orderableQuantity,"IN_STOCK"===e[f].stockStatus||t&&("BACKORDERABLE"===e[f].stockStatus||"PREORDERABLE"===e[f].stockStatus)||m.profileType===s.PROFILE_TYPE_AGENT&&h>0)if(null!==h&&!isNaN(h)&&h>0){var I="";d=!0,u=e[f].availabilityDate,p=e[f].stockStatus,l=h,c=e[f].orderLimit,m.profileType===s.PROFILE_TYPE_AGENT?I=g.getOrderableQuantityMessageForAgent(g,e[f],t,r,n):t&&e[f].inStockQuantity>0&&g.updatableQuantity()>e[f].inStockQuantity&&(e[f].backOrderableQuantity>0?I=o.t("ns.common:resources.partialBackOrderMsg",{stockLimit:e[f].inStockQuantity}):e[f].preOrderableQuantity>0&&(I=o.t("ns.common:resources.partialPreOrderMsg",{stockLimit:e[f].inStockQuantity})))}else d=!1;else d=!1;break}if(g.childItems&&d)for(var f=0;f<g.childItems.length;f++){for(var E=g.childItems[f].productId,y=g.childItems[f].catRefId,v=i.utils.unwrapObservable(g.childItems[f].quantity),b=0,T=0;T<e.length;T++)if(E===e[T].productId&&y===e[T].catRefId){if(b=r&&a&&a[E+":"+y]?a[E+":"+y]:e[T].orderableQuantity,"IN_STOCK"===e[T].stockStatus||t&&("BACKORDERABLE"===e[T].stockStatus||"PREORDERABLE"===e[T].stockStatus)||m.profileType===s.PROFILE_TYPE_AGENT&&b>0)if(null!==b&&!isNaN(b)&&b>0){var P=Math.floor(b/v);if(l=l>P?P:l,c=c>e[T].orderLimit?e[T].orderLimit:c,d=!0,m.profileType===s.PROFILE_TYPE_AGENT){var S=g.updatableQuantity();I=g.getOrderableQuantityMessageForAgent(g.childItems[f],e[T],t,r,n,S)}}else d=!1;else d=!1;break}if(!d)break}if(m.profileType!==s.PROFILE_TYPE_AGENT&&(g.availabilityDate(u),g.stockState(p)),g.stockStatus(d),g.orderableQuantityMessage(I),g.updatableQuantity.rules.remove(function(e){return"max"==e.rule}),g.updatableQuantity.rules.remove(function(e){return"maxItemQuantity"==e.rule}),d&&l>0){var C=o.t("ns.common:resources.insufficientStockMsg",{stockLimit:l>c?c:l});g.updatableQuantity.extend({maxItemQuantity:{params:{orderableQuantity:l,totalQuantity:g.getItemQuantityInCart,orderLimit:c,childItems:g.childItems},message:C}})}else{var _=o.t("ns.common:resources.configurableProductOutOfStockMsg");g.updatableQuantity.extend({max:{params:0,message:_}})}g.updatableQuantity.isModified(!0)},g.populateItemDynamicProperties=function(e){for(var t in e)g[t](e[t]())}}var i=e("knockout"),a=e("pubsub"),o=e("CCi18n"),n=e("jquery"),s=e("ccConstants"),l=e("pageLayout/site"),c=e("currencyHelper"),d=e("koMapping"),u=e("viewModels/shipping-group-relationship"),p=e("viewModels/cart-item-external-data"),h=e("ccStoreConfiguration"),g=e("viewModels/address"),f=null,m=e("ccRestClient"),I=e("ccDate");return r.prototype.canAddShippingGroupRelationship=function(e){var t=this.quantity()>this.shippingGroupRelationships().length;return e?t&&e.quantity()>1:t},r.prototype.getAddressObject=function(e){var t={translate:function(e,t){return o.t("ns.common:resources."+e,t)}},r=new g("split-shipping-address","",t,[],"");return r.copyFrom(e),r},r.prototype.addShippingGroupRelationship=function(e,t){if(this.canAddShippingGroupRelationship()){var r=new u(this,1);if(r.sgID=r.productId+r.catRefId+this.shippingGroupRelationships().length+"",this.detailedItemPriceInfo()[0]&&r.unitPrice(this.detailedItemPriceInfo()[0].detailedUnitPrice),e){var a=e.updatableQuantity.rules().filter(function(e){return"maxItemQuantity"==e.rule})[0];r.updatableQuantity.extend({maxItemQuantity:a})}if(t&&null!==t&&(r.getItemQuantityInCart=t.getUpdatableItemQuantityInCart.bind(t,t.items(),r.productId,r.catRefId,r),this.childItems?r.addConfigurableStockValidation(e.inventoryDetails?e.inventoryDetails:[],t.isPreOrderBackOrderEnabled):r.addLimitsValidation(this,e.inventoryDetails?e.inventoryDetails:[],t.isPreOrderBackOrderEnabled)),this.shippingGroupRelationships.push(r),e)e.addQuantity(-1);else{var o=i.utils.arrayFirst(this.shippingGroupRelationships(),function(e){return e.quantity()>1});o.addQuantity(-1)}}},r.prototype.removeShippingGroupRelationShip=function(e){this.shippingGroupRelationships().length>=1&&(this.shippingGroupRelationships.remove(e),this.updatableQuantity(this.quantity()-e.quantity()),this.itemTotal(this.itemTotal()-e.price()),n.Topic(a.topicNames.CART_UPDATE_QUANTITY).publishWith(this.productData(),[{message:"success",commerceItemId:this.commerceItemId,shippingGroup:e}]),n.Topic(a.topicNames.SHIPPING_GROUP_REMOVE_SUCCESS).publishWith(function(){}))},r.prototype.resetShippingGroupRelationships=function(e){var t=!!e&&e.createNewSGR,r=e?e.cartItem:void 0,a=e?e.prodData:void 0,o=e?e.shippingGroup:void 0;if(t&&r&&a){var n=new u(r,a.orderQuantity);if(i.isObservable(a.selectedStore)&&a.selectedStore()&&a.selectedStore().store.locationId){if(n.isPickupInStore(!0),n.selectedStore(a.selectedStore()),a.hasOwnProperty("availablePickupDateTime")&&a.availablePickupDateTime&&n.availablePickupDate(a.availablePickupDateTime()),a.selectedStore().inventoryDetails&&a.selectedStore().inventoryDetails.length>0)for(var s=0;s<a.selectedStore().inventoryDetails.length;s++){var l=a.selectedStore().inventoryDetails[s];l.locationId===a.selectedStore().store.locationId&&n.availabilityDate(l.availabilityDate)}n.stockState(a.stockState)}else n.isPickupInStore(!1);r.shippingGroupRelationships.push(n)}else if(o)parseInt(o.updatableQuantity())?o.quantity(o.updatableQuantity()):this.shippingGroupRelationships.remove(o);else if(e&&e.data&&e.data.shippingGroupRelationships&&e.data.shippingGroupRelationships().length>1){a=e.prodData;for(var c=0,d=e.data.updatableQuantity(),s=0;s<e.data.shippingGroupRelationships().length;s++)c+=parseInt(e.data.shippingGroupRelationships()[s].quantity());var p=d-c;if(p>0){var n=new u(e.data,p);if(i.isObservable(a.selectedStore)&&a.selectedStore()&&a.selectedStore().store.locationId){if(n.isPickupInStore(!0),n.selectedStore(a.selectedStore()),a.hasOwnProperty("availablePickupDateTime")&&a.availablePickupDateTime&&n.availablePickupDate(a.availablePickupDateTime()),a.selectedStore().inventoryDetails&&a.selectedStore().inventoryDetails.length>0)for(var s=0;s<a.selectedStore().inventoryDetails.length;s++){var l=a.selectedStore().inventoryDetails[s];l.locationId===a.selectedStore().store.locationId&&n.availabilityDate(l.availabilityDate)}n.stockState(a.stockState)}else n.isPickupInStore(!1);e.data.shippingGroupRelationships.push(n)}else if(p<0){p=Math.abs(p);for(var s=e.data.shippingGroupRelationships().length-1;s>=0&&p>0;s--)p>=e.data.shippingGroupRelationships()[s].quantity()?(p-=e.data.shippingGroupRelationships()[s].quantity(),e.data.shippingGroupRelationships().splice(s,1)):(c=e.data.shippingGroupRelationships()[s].quantity()-p,e.data.shippingGroupRelationships()[s].quantity(c),e.data.shippingGroupRelationships()[s].updatableQuantity(c),p=0)}}},r.prototype.isOnlineOnly=function(){var e=this;if(e.productData&&e.productData()&&null!==e.productData&&e.productData().childSKUs&&null!==e.productData().childSKUs&&e.productData().childSKUs.length>0){for(var t=0;t<e.productData().childSKUs.length;t++)if(e.productData().childSKUs[t].repositoryId===e.catRefId&&null!==e.productData().childSKUs[t].derivedOnlineOnly)return e.productData().childSKUs[t].derivedOnlineOnly;if(e.productData().onlineOnly)return e.productData().onlineOnly}return!1},r}),define("viewModels/promotionUpsellContainer",["knockout","ccRestClient","ccConstants"],function(e,t,r){"use strict";function i(){var t=this;if(i.singleInstance)throw new Error("Cannot instantiate more than one PromotionUpsellContainer. Use getInstance() method");return t.promotionUpsellMessages=e.observableArray(),t.isNonQualifiedMessagesRetrievalInProgress=!1,t.isNonQualifiedMessagesSubscribedToQuantity=!1,t}return i.getInstance=function(){return i.singleInstance||(i.singleInstance=new i),i.singleInstance},i.prototype.successFunc=function(e){var t=this;e&&e.promotionUpsellMessages&&t.populatePromotionUpsellMessages(e.promotionUpsellMessages),t.isNonQualifiedMessagesRetrievalInProgress=!1},i.prototype.errorFunc=function(e){var t=this;console.error("Unable to retrieve non-qualifier messages."),t.isNonQualifiedMessagesRetrievalInProgress=!1},i.prototype.clearPromotionUpsellMessages=function(){var e=this;null!=e.promotionUpsellMessages&&e.promotionUpsellMessages().length>0&&e.promotionUpsellMessages.removeAll()},i.prototype.getNonQualifiedMessages=function(){var e=this;if(!e.isNonQualifiedMessagesRetrievalInProgress){e.clearPromotionUpsellMessages();var i=r.GET_UPSELL_MESSAGES;e.isNonQualifiedMessagesRetrievalInProgress=!0;var a=new Object;t.request(i,a,e.successFunc.bind(this),e.errorFunc.bind(this))}},i.prototype.populatePromotionUpsellMessages=function(e){var t=this;if(t.clearPromotionUpsellMessages(),null!=e&&e.constructor===Array)for(var r=0;r<e.length;r++)t.promotionUpsellMessages.push(e[r])},i}),define("pageLayout/cart",["knockout","pubsub","notifier","notifications","storeKoExtensions","CCi18n","ccNumber","jquery","ccConstants","navigation","storageApi","pageLayout/site","viewModels/dynamicProperty","ccRestClient","viewModels/address","koMapping","ccStoreConfiguration","viewModels/cart-item","viewModels/shipping-group-relationship","viewModels/cart-item-external-data","currencyHelper","viewModels/promotionUpsellContainer","ccDate","ccStoreUtils"],function(e,t,r,i,a,o,n,s,l,c,d,u,p,h,g,f,m,I,E,y,v,b,T,P){"use strict";function S(r,a,n,d){if(S.singleInstance)throw new Error("Cannot instantiate more than one CartViewModel, use getInstance(pAdapter, pShoppingCartData)");var p=this;p.originalOrderPrice=e.observable(),p.cancelOrder=e.observable();var g=u.getInstance();p.currency=null,s.when(g.priceListGroupDeferred).done(function(){p.currency=g.selectedPriceListGroup().currency}),p.exchangeRate=e.observable(null),p.payShippingInSecondaryCurrency=e.observable(!1),p.payTaxInSecondaryCurrency=e.observable(!1),p.allowAlternateCurrency=e.observable(!1),p.secondaryCurrency=e.observable(null),p.showSecondaryShippingData=e.pureComputed(function(){return null!=p.secondaryCurrency()&&p.currency.currencyType===l.LOYALTY_POINTS_PAYMENT_TYPE&&p.payShippingInSecondaryCurrency()}),p.showSecondaryTaxData=e.pureComputed(function(){return null!=p.secondaryCurrency()&&p.currency.currencyType===l.LOYALTY_POINTS_PAYMENT_TYPE&&p.payTaxInSecondaryCurrency()}),p.isChargeTaxShippingInSecondaryCurrency=e.pureComputed(function(){return(p.payShippingInSecondaryCurrency()||p.payTaxInSecondaryCurrency())&&p.currency.currencyType===l.LOYALTY_POINTS_PAYMENT_TYPE}),p.setSecondaryCurrencyData=function(e,r,i,a,o){p.exchangeRate(r),p.payTaxInSecondaryCurrency(a),p.secondaryCurrency(e),p.payShippingInSecondaryCurrency(i),p.allowAlternateCurrency(o),s.Topic(t.topicNames.ORDER_SECONDARY_INFO_LOADED).publish(p)},p.user=n,p.promotionUpsellContainer=b.getInstance(),p.deferLoadCart=s.Deferred(),p.deferLoadCartForUser=function(){p.user()&&(p.deferLoadCart.resolve(),f.dispose())};var f=null;if(p.user)var f=p.user.subscribe(p.deferLoadCartForUser);p.userActionPending=e.observable(!1),p.cartValidationPending=e.observable(!1),p.hardPricing=!1,p.cartPricedBeforeRefreshCallbackForLargeCart=[],p.isDirty=e.observable(!1),p.callPriceBeforeShippingMethods=!1,p.updatedFromRepository=!1,p.adapter=r,p.errors=e.observableArray([]),p.items=e.observableArray([]),p.allItems=e.observableArray([]),p.coupons=e.observableArray([]),p.orderItems=e.observableArray([]),p.orderCreationDate=e.observable(),p.orderCurrency={},p.couponMultiPromotions=e.observableArray([]),p.claimedCouponMultiPromotions=e.observableArray([]),p.numberOfItems=e.observable(0),p.total=e.observable(0),p.totalWithoutTax=e.observable(0),p.subTotal=e.observable(0),p.amount=e.observable(0),p.tax=e.observable(0),p.secondaryCurrencyTaxAmount=e.observable(0),p.secondaryCurrencyTotal=e.observable(0),p.primaryCurrencyTotal=e.observable(0),p.shipping=e.observable(0),p.secondaryCurrencyShippingAmount=e.observable(0),p.taxExclusiveAmount=e.observable(0),p.shippingDiscount=e.observable(0),p.secondaryCurrencyShippingDiscount=e.observable(0),p.currencyCode=e.observable(""),p.shippingMethod=e.observable(""),p.catalogId=e.observable(""),p.priceListGroupId=e.observable(""),p.shippingAddress=e.observable(""),p.currentCountry=e.observable(""),p.currentState=e.observable(""),p.selectedCountry=e.observable(""),p.selectedState=e.observable(""),p.shippingSurcharge=e.observable(0),p.secondaryCurrencyShippingSurcharge=e.observable(0),p.updatedProduct=e.observable(""),p.validateAndRedirectCart=e.observable(!1),p.orderDiscount=e.observable(0),p.orderDiscountDescList=e.observableArray([]),p.couponErrorMessage=e.observable(),p.skipPriceChange=e.observable(!1),p.isPricingRequired=e.observable(!1),p.invalidProductNames=[],p.isPreOrderBackOrderEnabled=!1,p.checkoutWithPaypalClicked=e.observable(!1),p.isMatchingCookieData=e.observable(!1),p.giftCards=e.observableArray([]),p.IINDetails=e.observableArray([]),p.dynamicProperties=e.observableArray([]),p.lineAttributes=e.observableArray([]),p.cartPriceListGroupId=e.observable(),p.showSelectedOptions=e.observable(!1),p.isSplitShipping=e.observable(!1),p.orderShippingGroups=e.observableArray(),p.mergeCart=e.observable(!1),p.storeConfiguration=m.getInstance(),p.usingImprovedShippingWidgets=e.observable(!1),p.shippingMethodsLoadedAndPriced=e.observable(!1),p.createNewCart=e.observable(!!h.getStoredValue(l.LOCAL_STORAGE_CREATE_NEW_CART)),p.cartName=e.observable(""),p.orderedQuantityMap={},d&&d.global&&d.global.site&&d.global.site.extensionSiteSettings&&d.global.site.extensionSiteSettings.storeEndpointSettings&&d.global.site.extensionSiteSettings.storeEndpointSettings.cartFields&&(p.fields=d.global.site.extensionSiteSettings.storeEndpointSettings.cartFields),p.callbacks={},p.combineLineItems=l.COMBINE_YES,p.giftWithPurchaseOrderMarkers=[],p.gwpQualified=!1,p.placeHolderItems=e.observableArray([]),p.skipGWPMessage=!1,p.currentOrderId=e.observable(null),p.currentOrderState=e.observable(null),p.recurringChargeAmount=e.observable(0),p.recurringChargeCurrencyCode=e.observable(""),p.recurringChargeShipping=e.observable(0),p.recurringChargeSubTotal=e.observable(0),p.recurringChargeSubTotalByFrequency=e.observableArray([]),p.recurringChargeTax=e.observable(0),p.recurringChargeTaxByFrequency=e.observableArray([]),p.recurringChargeTotal=e.observable(0),p.isOrderSubmissionInProgress=!1,p.isCurrentCallInProgress=!1,p.markDirty=function(){c.isPathEqualTo(p.checkoutLink)&&(p.hardPricing=!0),p.isDirty()||p.isOrderSubmissionInProgress||1==p.storeConfiguration.isLargeCart()&&p.hardPricing!==!0?p.handleBlockedPricing():p.isDirty(!0),p.storeConfiguration.isLargeCart()===!0&&p.userActionPending(!0)},p.isItemPriceOverrideAllowed=e.observable(!1),p.hasPriceOverriddenItem=e.observable(!1),p.hasExternalPriceItem=e.observable(!1),p.quoteInfo=e.observable(null),p.registerSplitPaymentCallbacks=function(e,t){p.populateGiftCardsHandler=e,p.updateGiftCardDetailsHandler=t},p.emailAddressForGuestUser=null,p.createOrderForLoggedInAtCheckout=!(!window.clientConfigData||!window.clientConfigData.createOrderForLoggedInAtCheckout||"true"!==window.clientConfigData.createOrderForLoggedInAtCheckout),p.cartUpdated=function(){p.isDirty()&&p.isDirty(!1),p.saveCartCookie(),p.updateAllItemsArray(),s.Topic(t.topicNames.CART_UPDATED).publish(p),p.validateAndRedirectCart()&&p.handleValidateCart()},p.isDirty.subscribe(p.priceCartIfNeccessary.bind(p)),p.handleValidateCart=function(){p.validatePrice=!0,s.Topic(t.topicNames.LOAD_CHECKOUT).publishWith(p,[{message:"success"}])},p.registerMultiShippingMethodsCallback=function(e){p.loadMultipleShippingMethods=e},p.isCartTransient=function(){return p.user().loggedinAtCheckout()||p.storeConfiguration.transientCartEnabled()},p.nonTransientCartCheck=function(){return p.createOrderForLoggedInAtCheckout||!p.isCartTransient()},p.updateCartItems=function(){if(p.events.length>0){var e,t=p.events.pop();switch(p.events.push(t),t.type){case k:e=t.product,p.addItem(e);break;case x:e=t.product,p.updateItemQuantity(e);break;case G:e=t.product,p.removeItemsByProduct(e.id),p.removeItem(e);break;case H:e=t.coupon,p.removeCouponFromCart(e);break;case F:e=t.coupon,p.addCouponToCart(e);break;case Q:e=t.coupons,p.addMultipleCouponsToCart(e);break;case j:e=t.product,p.addItem(e);break;case J:e=t.coupons,p.removeMultipleCouponFromCart(e);break;case ee:e=t.href,h.profileType==l.PROFILE_TYPE_AGENT?p.cartPricedBeforeRefreshCallbackForLargeCart.length>0&&(s.each(p.cartPricedBeforeRefreshCallbackForLargeCart,function(e,t){"function"==typeof t&&t()}),p.cartPricedBeforeRefreshCallbackForLargeCart=[]):window.location.assign(e)}}},p.addItem=function(e){if(e&&e.childSKUs){var r,i,a=!1;if(p.isConfigurableItem(e)&&(i=[],i=p.getChildItemsDataAsCartItems(e)),e.selectedAddOnProducts&&e.selectedAddOnProducts.length>0){var o=p.getAddonDataAsCartItems(e);i&&i.length>0?i=i.concat(o):(i=[],i=o)}var n=null;if(!e.commerceItemId&&p.isConfigurableItem(e)?n=p.getConfigurableCartItem(e.id,e.childSKUs[0].repositoryId,e.commerceItemId):(n=e.selectedSku?p.getCartItem(e.id,e.selectedSku.repositoryId,e.commerceItemId):p.getCartItem(e.id,e.childSKUs[0].repositoryId,e.commerceItemId),p.combineLineItems==l.COMBINE_YES||n&&n.isUpdate()||(n=null)),p.isProductWithAddons(e)&&n&&!n.isUpdate()&&(n=null),null!==n){if(n.isUpdate()){if(n.shippingGroupRelationships().length>1)n.productData(e),n.updatableQuantity(e.orderQuantity),s.Topic(t.topicNames.CART_UPDATE_QUANTITY_SUCCESS).publishWith(null,[{message:"success",createNewSGR:!1,data:n,prodData:e}]),n.quantity(e.orderQuantity);else{var c=0;n.productData(e),n.shippingGroupRelationships()[0].quantity(e.orderQuantity),n.shippingGroupRelationships()[0].updatableQuantity(e.orderQuantity),n.updatableQuantity(e.orderQuantity);for(var d=0;d<n.shippingGroupRelationships().length;d++)c+=parseFloat(n.shippingGroupRelationships()[d].quantity()),n.shippingGroupRelationships()[d].catRefId=e.childSKUs[0].id;n.quantity(c),n.catRefId=e.childSKUs[0].id}if(e.selectedAddOnProducts&&e.selectedAddOnProducts.length>0){var o=p.getAddonDataAsCartItems(e);n.childItems&&n.childItems.length>0&&(n.childItems=n.childItems.filter(function(e){return!e.addOnItem})),n.childItems&&n.childItems.length>0?n.childItems=n.childItems.concat(o):(n.childItems=[],n.childItems=o)}}else r=n.quantity()+e.orderQuantity,n.quantity(r),n.updatableQuantity(n.quantity()),e.giftProductData&&(n.giftWithPurchaseSelections=[{giftWithPurchaseIdentifier:e.giftProductData.giftWithPurchaseIdentifier,promotionId:e.giftProductData.promotionId,giftWithPurchaseQuantity:e.giftProductData.giftWithPurchaseQuantity}]),s.Topic(t.topicNames.CART_UPDATE_QUANTITY_SUCCESS).publishWith(null,[{message:"success",cartItem:n,prodData:e,createNewSGR:!0}]),this.storeConfiguration.isLargeCart()===!0&&(p.updateItemPriceForLargeCart(e,n),p.updateItemShippingGroupRelationShipForLargeCart(e,n));a=!0}if(null==e.commerceItemId&&p.isConfigurableItem(e)&&(n=p.getCartItemForReconfiguration(e.id,e.childSKUs[0].repositoryId,e.configuratorId),null!==n)){for(var u=[],d=0;d<n.childItems.length;d++)n.childItems[d].addOnItem&&u.push(n.childItems[d]);u.length>0&&(i=i.concat(u)),n.childItems=i,n.externalPrice(e.price),n.externalData((e.externalData||[]).map(function(e){return new y(e)})),n.actionCode(e.actionCode),n.externalRecurringCharge(e.externalRecurringCharge),n.externalRecurringChargeFrequency(e.externalRecurringChargeFrequency),n.externalRecurringChargeDuration(e.externalRecurringChargeDuration),n.assetKey(e.assetKey),n.rootAssetKey(e.rootAssetKey),n.parentAssetKey(e.parentAssetKey),n.serviceId(e.serviceId),n.customerAccountId(e.customerAccountId),n.billingAccountId(e.billingAccountId),n.serviceAccountId(e.serviceAccountId),n.billingProfileId(e.billingProfileId),n.activationDate(e.activationDate),n.deactivationDate(e.deactivationDate),n.transactionDate(e.transactionDate),n.asset(e.asset),n.clearUnpricedError(),n.updatableQuantity.rules.remove(function(e){return"max"==e.rule}),p.getCartAvailability(),e.giftProductData&&(n.giftWithPurchaseSelections=[{giftWithPurchaseIdentifier:e.giftProductData.giftWithPurchaseIdentifier,promotionId:e.giftProductData.promotionId,giftWithPurchaseQuantity:e.giftProductData.giftWithPurchaseQuantity}]),a=!0}if(!a){r=e.orderQuantity;var h={productId:e.id,productData:e,quantity:r,catRefId:e.childSKUs[0].repositoryId,selectedOptions:e.selectedOptions,currency:p.currency,externalData:e.externalData,actionCode:e.actionCode,lineAttributes:p.lineAttributes,externalRecurringCharge:e.externalRecurringCharge,externalRecurringChargeFrequency:e.externalRecurringChargeFrequency,
- externalRecurringChargeDuration:e.externalRecurringChargeDuration,assetKey:e.assetKey,rootAssetKey:e.rootAssetKey,parentAssetKey:e.parentAssetKey,serviceId:e.serviceId,customerAccountId:e.customerAccountId,billingAccountId:e.billingAccountId,serviceAccountId:e.serviceAccountId,billingProfileId:e.billingProfileId,activationDate:e.activationDate,deactivationDate:e.deactivationDate,transactionDate:e.transactionDate,asset:e.asset,addOnItem:e.addOnItem,shopperInput:e.shopperInput,selectedStore:"function"==typeof e.selectedStore?e.selectedStore():e.selectedStore,availablePickupDateTime:e.availablePickupDateTime,soldAsPackage:e.childSKUs[0].soldAsPackage,assetable:e.assetable,shippable:e.shippable,allowVirtualShippingGroup:p.storeConfiguration.allowVirtualShippingGroup};if(p.isConfigurableItem(e))s.extend(h,{configuratorId:e.configuratorId,childItems:i,externalPrice:e.price,externalPriceQuantity:-1});else if(p.isProductWithAddons(e)){s.extend(h,{childItems:i});for(var g=e.externalPriceQuantity,f=0;f<i.length;f++)if(i[f].externalPrice){g=-1;break}e.externalPrice&&s.extend(h,{externalPrice:e.externalPrice,externalPriceQuantity:g})}else e.externalPrice&&e.externalPriceQuantity&&s.extend(h,{externalPrice:e.externalPrice,externalPriceQuantity:e.externalPriceQuantity});h.isVirtualShippingGroup=p.storeConfiguration.allowVirtualShippingGroup&&p.storeConfiguration.isVirtualShippingGroup.call(h);var m=new I(h);this.storeConfiguration.isLargeCart()===!0&&(p.updateItemPriceForLargeCart(e,m),p.updateItemShippingGroupRelationShipForLargeCart(e,m)),m.skuProperties=e.skuProperties,m.selectedSkuProperties=e.selectedSkuProperties,p.items.push(m)}p.isDirty(!1),this.storeConfiguration.isLargeCart()===!0&&(p.updateCartItemDataForLargeCart(e),p.updateAllItemsArray()),p.markDirty()}},p.addItems=function(e){for(var r,i=e.length,a=0;a<i;a++)if(r=e[a],r&&r.childSKUs){var o,n,c=!1;if(r.childItems){n=[];for(var d=0;d<r.childItems.length;d++){var u,h=r.childItems[d];u=h.catalogRefId?h.catalogRefId:h.catRefId;var g={productId:h.productId,quantity:h.quantity,catRefId:u,selectedOptions:h.selectedOptions,currency:p.currency,addOnItem:h.addOnItem,shopperInput:h.shopperInput,configurablePropertyId:h.configurablePropertyId,configurationOptionId:h.configurationOptionId,commerceItemId:p.generateCommerceItemId(),soldAsPackage:h.soldAsPackage,assetable:h.assetable,shippable:h.shippable,allowVirtualShippingGroup:p.storeConfiguration.allowVirtualShippingGroup};g.isVirtualShippingGroup=p.storeConfiguration.allowVirtualShippingGroup&&p.storeConfiguration.isVirtualShippingGroup.call(g),n[d]=new I(g)}}var f=p.getCartItem(r.id,r.childSKUs[0].repositoryId,r.commerceItemId);if(r.childItems&&r.childItems.length>0&&(f=null),p.combineLineItems==l.COMBINE_YES||f&&f.isUpdate()||(f=null),null!==f){if(o=f.quantity()+r.orderQuantity,f.quantity(o),f.shippingGroupRelationships()&&f.shippingGroupRelationships().length>0){var m=f.shippingGroupRelationships()[0].quantity()+r.orderQuantity,E=f.shippingGroupRelationships()[0];E.quantity(m),E.updatableQuantity&&E.updatableQuantity(m)}r.giftProductData&&(f.giftWithPurchaseSelections=[{giftWithPurchaseIdentifier:r.giftProductData.giftWithPurchaseIdentifier,promotionId:r.giftProductData.promotionId,giftWithPurchaseQuantity:r.giftProductData.giftWithPurchaseQuantity}]),c=!0,s.Topic(t.topicNames.CART_UPDATE_QUANTITY_SUCCESS).publishWith(function(){}),this.storeConfiguration.isLargeCart()===!0&&(p.updateItemPriceForLargeCart(r,f),p.updateItemShippingGroupRelationShipForLargeCart(r,f))}if(!c){o=r.orderQuantity;var y,v={productId:r.id,productData:r,quantity:o,catRefId:r.childSKUs[0].repositoryId,selectedOptions:r.selectedOptions,currency:p.currency,shopperInput:r.shopperInput,soldAsPackage:r.childSKUs[0].soldAsPackage,assetable:r.assetable,shippable:r.shippable,allowVirtualShippingGroup:p.storeConfiguration.allowVirtualShippingGroup};v.commerceItemId=r.commerceItemId||p.generateCommerceItemId(),v.isVirtualShippingGroup=p.storeConfiguration.allowVirtualShippingGroup&&p.storeConfiguration.isVirtualShippingGroup.call(v),r.childItems?s.extend(v,{configuratorId:r.configuratorId,childItems:n}):r.externalPrice&&r.externalPriceQuantity&&s.extend(v,{externalPrice:r.externalPrice,externalPriceQuantity:r.externalPriceQuantity}),y=new I(v),this.storeConfiguration.isLargeCart()===!0&&(p.updateItemPriceForLargeCart(r,y),p.updateItemShippingGroupRelationShipForLargeCart(r,y)),y.skuProperties=r.skuProperties,y.selectedSkuProperties=r.selectedSkuProperties,p.updateItemDynamicProperties(y,r),p.items.push(y)}}p.isDirty(!1),this.storeConfiguration.isLargeCart()===!0&&(p.updateCartItemsDataForLargeCart(e),p.updateAllItemsArray()),p.markDirty()},p.addToCart=function(){if(p.storeConfiguration.isLargeCart()===!0)return void p.addItem(this);var e=p.getCookieDataAndCompare();p.events.push(new w(k,1,this)),p.mergeCart()||!e||p.isMatchingCookieData()?p.addItem(this):(p.getLocalData(e),0==e.items.length&&p.addItem(this))},s.Topic(t.topicNames.CART_PRICE_COMPLETE).subscribe(p.updateCartItems),h.profileType==l.PROFILE_TYPE_AGENT&&s.Topic(t.topicNames.ORDER_PRICING_SUCCESS).subscribe(p.populateShippingMethodsDeferred.bind(p)),p.removeFromCart=function(e){if(!p.isDirty()){p.events.push(new w(G,0,this));var t=p.getCookieDataAndCompare();if(t&&t.items.length>0&&!p.isMatchingCookieData())p.getLocalData(t);else{if(e)var r=p.getCartItem(this.id,this.childSKUs[0].repositoryId,e.commerceItemId);else var r=p.getCartItem(this.id,this.childSKUs[0].repositoryId);null!==r&&(r.updatableQuantity(0),p.removeItem(r))}}},p.removeChildItemFromCart=function(e,t,r){var i=p.items();r&&(i=r);for(var a=0;a<i.length;a++){if(i[a].commerceItemId==e.commerceItemId)return void i.splice(a,1);i[a].childItems&&i[a].childItems.length>0&&(p.removeChildItemFromCart(e,t,i[a].childItems),i[a].childItems&&0==i[a].childItems.length&&delete i[a].childItems)}!r&&t&&p.markDirty()},p.removeChildItemFromLargeCart=function(e,t,r){var i=p.items();r&&(i=r);for(var a=0;a<i.length;a++){if(i[a].commerceItemId==e.commerceItemId)return void(i[a].invalid=!0);i[a].childItems&&i[a].childItems.length>0&&p.removeChildItemFromLargeCart(e,t,i[a].childItems),!r&&t&&p.markDirty()}},p.editChildItemFromCart=function(e,t){var r=p.items();t&&(r=t);for(var i=0;i<r.length;i++){if(r[i].commerceItemId==e.commerceItemId){r[i]=e,p.markDirty();break}r[i].childItems&&r[i].childItems.length>0&&p.editChildItemFromCart(e,r[i].childItems)}},p.addAddOnChildItemsToCartItem=function(e,t){var r=e,i=p.getAddonDataAsCartItems(t),a=r.childItems;r.childItems?(a=a.concat(i),r.childItems=a):r.childItems=i,p.markDirty()},p.getCookieDataAndCompare=function(){var e=p.getCookieData();return e&&p.isMatchingCookieData(p.compareItems(e.items)),e},p.removeItem=function(e){if(void 0!==e){p.items.remove(e),p.allItems.remove(e);var r=p.events.pop();r&&r.type==W||p.markDirty(),s.Topic(t.topicNames.CART_REMOVE_SUCCESS).publishWith([{message:"success",commerceItemId:e.commerceItemId,cartItem:e}])}},p.emptyCart=function(){p.items.removeAll(),p.allItems.removeAll(),p.shippingMethod(""),s.Topic(t.topicNames.CHECKOUT_RESET_SHIPPING_METHOD).publish(),p.numberOfItems(0),p.total(0),p.totalWithoutTax(0),p.subTotal(0),p.amount(0),p.shipping(0),p.secondaryCurrencyShippingAmount(0),p.taxExclusiveAmount(0),p.shippingDiscount(0),p.secondaryCurrencyShippingDiscount(0),p.shippingSurcharge(0),p.secondaryCurrencyShippingSurcharge(0),p.tax(0),p.secondaryCurrencyTaxAmount(0),p.secondaryCurrencyTotal(0),p.primaryCurrencyTotal(0),p.currencyCode(""),p.orderDiscount(0),p.orderCreationDate(null),p.giftCards([]),p.IINDetails([]),p.giftWithPurchaseOrderMarkers=[],p.cartName(""),p.placeHolderItems.removeAll(),p.hasPriceOverriddenItem(!1),p.hasExternalPriceItem(!1),p.quoteInfo(null),p.orderDiscountDescList()&&p.orderDiscountDescList.removeAll(),p.coupons()&&p.coupons().length>0&&p.coupons.removeAll(),p.couponMultiPromotions()&&p.couponMultiPromotions().length>0&&(p.couponMultiPromotions.removeAll(),p.claimedCouponMultiPromotions.removeAll()),p.dynamicProperties()&&p.dynamicProperties().length>0&&p.dynamicProperties.removeAll(),p.cartUpdated()},p.handleOrderSubmit=function(){p.emptyCart(),p.user().loggedIn()&&p.user().orderId()&&""!=p.user().orderId()&&(p.user().orderId(""),p.user().persistedOrder(null),p.user().setLocalData("orderId"),p.user().updateLocalData(!1,!1))},p.updateShippingMethod=function(){this&&this.repositoryId&&""!==p.shippingAddress()?(p.shippingMethod(this.repositoryId),p.shipping(this.shippingCost),p.secondaryCurrencyShippingAmount(this.secondaryCurrencyShippingCost()),p.items().length&&p.priceCartForCheckout()):(p.shippingMethod(""),p.shippingDiscount(0),p.secondaryCurrencyShippingDiscount(0),p.shippingSurcharge(0),p.secondaryCurrencyShippingSurcharge(0),0==p.shipping()||window.isAgentApplication||p.markDirty())},p.shippingMethodsLoaded=function(){var e,r=!1;if(this.shippingOptions()){for(var i=0;i<this.shippingOptions().length;i++)if(p.shippingMethod()&&p.shippingMethod()===this.shippingOptions()[i].repositoryId){e=this.shippingOptions()[i],r=!0;break}if(!r)for(var i=0;i<this.shippingOptions().length;i++)if(this.defaultShipping()===this.shippingOptions()[i].repositoryId){e=this.shippingOptions()[i];break}}s.Topic(t.topicNames.CHECKOUT_SHIPPING_METHOD).publishWith(e,[{message:"success"}])},p.updateShippingAddress=function(){if(this&&this.shippingAddress&&this.shippingAddress.validateForShippingMethod()){var e=p.shippingAddress();p.shippingAddress(this.shippingAddress.toJSON()),!p.isShippingAddressChanged(p.shippingAddress(),e)&&p.shippingMethod()||s.Topic(t.topicNames.RELOAD_SHIPPING_METHODS).publishWith(this,[{message:"success"}])}else p.shippingAddress("")},p.updateShippingAddressAndReloadMethod=function(){if(this&&this.shippingAddress&&this.shippingAddress().validateForShippingMethod()){var e=p.shippingAddress();p.shippingAddress(this.shippingAddress.toJSON()),!p.isShippingAddressChanged(p.shippingAddress(),e)&&p.shippingMethod()||s.Topic(t.topicNames.RELOAD_SHIPPING_METHODS).publishWith(this,[{message:"success"}])}else p.shippingAddress("")},p.resetShippingAddress=function(){p.shippingAddress("")},p.updateQuantity=function(e){e&&e.commerceItemId&&(this.commerceItemId=e.commerceItemId),p.events.push(new w(x,0,this));var t=p.getCookieDataAndCompare();p.mergeCart()||!t||p.isMatchingCookieData()?p.updateItemQuantity(this,e.shippingGroup,e.cartItem):p.getLocalData(t)},p.updateItemQuantity=function(e,r,i){var a;if(a=e.childSKUs?p.getCartItem(e.id,e.childSKUs[0].repositoryId,e.commerceItemId):p.getCartItem(e.productId,e.catRefId,e.commerceItemId),null!==a){var o=a;if(o.productPriceChanged()&&o.productPriceChanged(!1),r&&null!==r){var n=parseInt(r.updatableQuantity());r.quantity(n);for(var l=0,c=0;c<o.shippingGroupRelationships().length;c++)l+=parseInt(o.shippingGroupRelationships()[c].quantity());l?(o.quantity(l),p.validateProduct(o,r),s.Topic(t.topicNames.CART_UPDATE_QUANTITY_SUCCESS).publishWith(null,[{message:"success",createNewSGR:!1,shippingGroup:r}])):p.removeItem(o)}else if(o.updatableQuantity.isValid()){var n=parseInt(o.updatableQuantity());n?(o.quantity(parseFloat(o.updatableQuantity())),1==o.shippingGroupRelationships().length&&(o.shippingGroupRelationships()[0].updatableQuantity(o.updatableQuantity()),o.shippingGroupRelationships()[0].quantity(o.updatableQuantity())),p.validateProduct(o),s.Topic(t.topicNames.CART_UPDATE_QUANTITY_SUCCESS).publishWith(null,[{message:"success",createNewSGR:!1,data:i,prodData:e}])):p.removeItem(o)}}},p.validateProduct=function(e,t){var r,i,a,o=this;if(h.profileType===l.PROFILE_TYPE_AGENT&&e.childItems&&e.childItems.length)r="0",i=new D(o),a="getStockStatuses";else{var n=this.catalogId();o.user().catalogId&&(n=o.user().catalogId());var r=new Array(e.catRefId,e.productId,n),i={},s={};s[l.ENDPOINT_KEY]=l.ENDPOINT_GET_PRODUCT_AVAILABILITY,s[l.IDENTIFIER_KEY]="stockStatusForProdValidation";var c=o.storeConfiguration.getFilterToUse(s);c&&(i[l.FILTER_KEY]=c),t&&null!==t&&(r=new Array(t.catRefId,t.productId,n),t.isPickupInStore&&t.isPickupInStore()&&(i[l.LOCATION_ID]=t.selectedStore().locationId)),a="getStockStatus"}o.adapter.loadJSON(a,r,i,function(r){Array.isArray(r)?o.validateProductForPricingForChildItems(r,e.productId,t):o.validateProductForPricing(r,t)},function(e){o.reloadCart()})},p.validateProductForPricing=function(e,r){for(var i=null,a=null,n=0,c=0;c<p.items().length;c++)if(p.items()[c].productId===e.productId&&p.items()[c].catRefId===e.catRefId){i=p.items()[c],a=p.items()[c],n=p.user().clonedOrderId()&&p.validOrderQuantityMap&&p.validOrderQuantityMap[i.productId+":"+i.catRefId]?p.validOrderQuantityMap[i.productId+":"+i.catRefId]:e.orderableQuantity;break}if(r&&null!==r&&(i=r),l.IN_STOCK===e.stockStatus||l.PREORDERABLE===e.stockStatus||l.BACKORDERABLE===e.stockStatus||h.profileType===l.PROFILE_TYPE_AGENT&&n>0){if(i.updatableQuantity()<=n){i.stockStatus(!0);var d="";if(h.profileType===l.PROFILE_TYPE_AGENT){var u=!!p.user().clonedOrderId();d=i.getOrderableQuantityMessageForAgent(i,e,p.isPreOrderBackOrderEnabled,u,p.orderedQuantityMap)}else p.isPreOrderBackOrderEnabled&&e.inStockQuantity>0&&i.updatableQuantity()>e.inStockQuantity&&(e.backOrderableQuantity>0?d=o.t("ns.common:resources.partialBackOrderMsg",{stockLimit:e.inStockQuantity}):e.preOrderableQuantity>0&&(d=o.t("ns.common:resources.partialPreOrderMsg",{stockLimit:e.inStockQuantity}))),i.stockState(e.stockStatus);i.orderableQuantityMessage(d),p.updatedProduct(i.catRefId),p.markDirty()}else if(i.updatableQuantity()>n){i.stockStatus(!1);var g=o.t("ns.common:resources.insufficientStockMsg",{stockLimit:e.inStockQuantity});i.orderableQuantityMessage(g),i.stockState(e.stockStatus),p.updatedProduct(i.catRefId),s.Topic(t.topicNames.DESTROY_SHOPPING_CART_SPINNER).publish()}else p.reloadCart();return p.reApplyLimitsValidations(e,a,r),void p.reApplyLimitsValidations(e,a,r,!0)}if(l.OUT_OF_STOCK===e.stockStatus){i.stockStatus(!1);var f=o.t("ns.common:resources.outOfStockMsg");return i.orderableQuantityMessage(f),i.stockState(e.stockStatus),p.updatedProduct(i.catRefId),p.reApplyLimitsValidations(e,a,r),void p.reApplyLimitsValidations(e,a,r,!1)}p.reloadCart()},p.reApplyLimitsValidations=function(e,t,r,i){if(t.productId===e.productId&&t.catRefId===e.catRefId)if(r&&null!==r)if(r.isPickupInStore())r.getItemQuantityInCart=p.getUpdatableItemQuantityInCart.bind(p,p.items(),t.productId,t.catRefId,r),r.addLimitsValidation(t,[e],p.isPreOrderBackOrderEnabled);else for(var a=0;a<t.shippingGroupRelationships().length;a++){var o=t.shippingGroupRelationships()[a];o.isPickupInStore()||(o.getItemQuantityInCart=p.getUpdatableItemQuantityInCart.bind(p,p.items(),o.productId,o.catRefId,r),o.addLimitsValidation(t,[e],p.isPreOrderBackOrderEnabled))}else t.getItemQuantityInCart=p.getUpdatableItemQuantityInCart.bind(p,p.items(),t.productId,t.catRefId,r),t.addLimitsValidation(i,e.orderableQuantity,e,p.isPreOrderBackOrderEnabled)},p.validateProductForPricingForChildItems=function(e,r,i){for(var a,n,c,d,u,g,f=0,m=0;m<p.items().length;m++){for(var I=0;I<e.length;I++)if(n=p.items()[m],i&&null!==i&&(n=i),n.productId===e[I].productId&&n.catRefId===e[I].catRefId&&e[I].productId===r){u=e[I],p.user().clonedOrderId()&&p.validOrderQuantityMap&&p.validOrderQuantityMap[n.productId+":"+n.catRefId]?(f=p.validOrderQuantityMap[n.productId+":"+n.catRefId],c=!0):(f=e[I].orderableQuantity,c=!1);break}if(I!=e.length)break}if(l.IN_STOCK===u.stockStatus||l.PREORDERABLE===u.stockStatus||l.BACKORDERABLE===u.stockStatus||h.profileType===l.PROFILE_TYPE_AGENT&&f>0){if(n.updatableQuantity()<=f){a=n.getOrderableQuantityMessageForAgent(n,e[I],p.isPreOrderBackOrderEnabled,c,p.orderedQuantityMap);for(var I=0;n.childItems&&I<n.childItems.length;I++){n.availabilityDate(""),n.stockStatus(""),n.availabilityDate(p.getMaxAvailabilityDate(n,e));for(var E=0;E<e.length;E++)n.childItems[I].productId===e[E].productId&&n.childItems[I].catRefId===e[E].catRefId&&(g=e[E]);var y;if(p.user().clonedOrderId()&&p.validOrderQuantityMap&&p.validOrderQuantityMap[n.childItems[I].productId+":"+n.childItems[I].catRefId]?(y=p.validOrderQuantityMap[n.childItems[I].productId+":"+n.childItems[I].catRefId],c=!0):(y=g.orderableQuantity,c=!1),l.IN_STOCK===g.stockStatus||l.PREORDERABLE===g.stockStatus||l.BACKORDERABLE===g.stockStatus||y>0){if(n.childItems[I].updatableQuantity()<=y)return d=n.quantity(),a=n.childItems[I].getOrderableQuantityMessageForAgent(n.childItems[I],g,p.isPreOrderBackOrderEnabled,c,p.orderedQuantityMap,d),n.stockStatus(n.childItems[I].stockStatus()),n.stockState(n.childItems[I].stockState()),n.orderableQuantityMessage(a),p.updatedProduct(n.catRefId),void p.markDirty();if(n.childItems[I].updatableQuantity()>y){item.stockStatus(!1);var v=o.t("ns.common:resources.insufficientStockMsg",{stockLimit:g.inStockQuantity});return n.childItems[I].orderableQuantityMessage(v),n.childItems[I].stockState(g.stockStatus),p.updatedProduct(n.childItems[I].catRefId),void s.Topic(t.topicNames.DESTROY_SHOPPING_CART_SPINNER).publish()}if(l.OUT_OF_STOCK===g.stockStatus){item.stockStatus(!1);var b=o.t("ns.common:resources.outOfStockMsg");return n.childItems[I].orderableQuantityMessage(b),n.childItems[I].stockState(g.stockStatus),void p.updatedProduct(n.childItems[I].catRefId)}p.reloadCart()}}return n.orderableQuantityMessage(a),p.updatedProduct(n.catRefId),void p.markDirty()}if(item.updatableQuantity()>f){n.stockStatus(!1);var v=o.t("ns.common:resources.insufficientStockMsg",{stockLimit:e.inStockQuantity});return n.orderableQuantityMessage(v),n.stockState(u.stockStatus),p.updatedProduct(n.catRefId),void s.Topic(t.topicNames.DESTROY_SHOPPING_CART_SPINNER).publish()}return void p.reloadCart()}if(l.OUT_OF_STOCK===u.stockStatus){n.stockStatus(!1);var b=o.t("ns.common:resources.outOfStockMsg");return n.orderableQuantityMessage(b),n.stockState(u.stockStatus),void p.updatedProduct(n.catRefId)}p.reloadCart()},p.getMaxAvailabilityDate=function(e,t,r){for(var i,a=this,o=0;t&&o<t.length;o++)if(e.catRefId===t[o].catRefId){var n=t[o].availabilityDate?T.dateTimeFormatter(t[o].availabilityDate,null,"medium"):"";i=r&&new Date(r)>new Date(n)?r:n;break}if(void 0!==e.childItems&&e.childItems.length>0)for(var s=0;s<e.childItems.length;s++)i=a.getMaxAvailabilityDate(e.childItems[s],t,i);return i};var E=function(){i.emptyGrowlMessages();for(var e=0;e<p.items().length;e++)p.items()[e].revertQuantity()};return p.getCartItem=function(e,t,r){for(var i=0;i<p.items().length;i++)if(p.items()[i].productId===e&&p.items()[i].catRefId===t&&(null==r&&!p.isConfigurableItem(p.items()[i])||r&&r==p.items()[i].commerceItemId))return p.items()[i];return null},p.getConfigurableCartItem=function(e,t,r){for(var i=0;i<p.items().length;i++)if(p.items()[i].productId===e&&p.items()[i].catRefId===t&&p.isConfigurableItem(p.items()[i])&&(!r&&!p.isConfigurableItem(p.items()[i])||r&&p.isConfigurableItem(p.items()[i])&&r==p.items()[i].commerceItemId))return p.items()[i];return null},p.getCartItemForReconfiguration=function(e,t,r){for(var i=0;i<p.items().length;i++)if(p.items()[i].productId===e&&p.items()[i].catRefId===t&&r&&p.isConfigurableItem(p.items()[i])&&r==p.items()[i].configuratorId)return p.items()[i];return null},p.addSkuIdFromConfigurableProduct=function(e,t){for(var r=0;t.childItems&&r<t.childItems.length;r++)e.indexOf(t.childItems[r].catalogRefId)===-1&&e.push(t.childItems[r].catalogRefId),t.childItems[r].childItems&&t.childItems[r].childItems.length>0&&p.addSkuIdFromConfigurableProduct(e,t.childItems[r])},p.addProductIdFromConfigurableProduct=function(e,t){for(var r=0;t.childItems&&r<t.childItems.length;r++)e.indexOf(t.childItems[r].productId)===-1&&e.push(t.childItems[r].productId),t.childItems[r].childItems&&t.childItems[r].childItems.length>0&&p.addProductIdFromConfigurableProduct(e,t.childItems[r])},p.createChildItemTree=function(e,t,r){var i=[];if(null==r)for(var r=new Object,a=0;a<e.length;a++){var o=e[a].repositoryId;null==r[o]&&(r[o]=a)}for(var n=0;t.childItems&&n<t.childItems.length;n++){var c=r[t.childItems[n].catalogRefId],d=s.extend(!0,{},e[c]),u=d.parentProducts[0],h=d;delete h[l.PARENT_PRODUCTS],u.childSKUs=[h],d.productVariantOptions&&d.productVariantOptions.length>0&&(u.selectedOptions=d.productVariantOptions[0]),u.soldAsPackage=d.soldAsPackage,u.orderQuantity=parseInt(t.childItems[n].quantity),u.catalogRefId=t.childItems[n].catalogRefId,u.externalData=t.childItems[n].externalData,u.actionCode=t.childItems[n].actionCode,u.price=t.childItems[n].externalPrice,u.externalRecurringCharge=t.childItems[n].externalRecurringCharge,u.externalRecurringChargeFrequency=t.childItems[n].externalRecurringChargeFrequency,u.externalRecurringChargeDuration=t.childItems[n].externalRecurringChargeDuration,u.assetKey=t.childItems[n].assetKey,u.rootAssetKey=t.childItems[n].rootAssetKey,u.parentAssetKey=t.childItems[n].parentAssetKey,u.serviceId=t.childItems[n].serviceId,u.customerAccountId=t.childItems[n].customerAccountId,u.billingAccountId=t.childItems[n].billingAccountId,u.serviceAccountId=t.childItems[n].serviceAccountId,u.billingProfileId=t.childItems[n].billingProfileId,u.activationDate=t.childItems[n].activationDate,u.deactivationDate=t.childItems[n].deactivationDate,u.transactionDate=t.childItems[n].transactionDate,u.asset=t.childItems[n].asset,t.childItems[n].childItems&&t.childItems[n].childItems.length>0&&(u.childItems=p.createChildItemTree(e,t.childItems[n],r)),i.push(u)}return i},p.updateChildTreeProductDataForLargeCart=function(e,t){for(var r=0;e.childItems&&r<e.childItems.length;r++){if(t.id==e.childItems[r].productId&&0==e.childItems[r].processed)for(var i=0;i<t.childSKUs.length;i++)t.childSKUs[i].repositoryId==e.childItems[r].catRefId&&(e.childItems[r].processed=!0,e.childItems[r].productData(jQuery.extend(!0,{},t)),e.childItems[r].assetable=t.assetable,e.childItems[r].shippable=t.shippable,e.childItems[r].allowVirtualShippingGroup=p.storeConfiguration.allowVirtualShippingGroup,e.childItems[r].soldAsPackage(t.childSKUs[i].soldAsPackage),e.childItems[r].isVirtualShippingGroup=p.storeConfiguration.allowVirtualShippingGroup&&p.storeConfiguration.isVirtualShippingGroup.call(t));e.childItems[r].childItems&&e.childItems[r].childItems.length>0&&p.updateChildTreeProductDataForLargeCart(e.childItems[r],t)}},p.updateChildTreeProductData=function(e,t){for(var r=0;e.childItems&&r<e.childItems.length;r++){if(t.id==e.childItems[r].productId)for(var i=0;i<t.childSKUs.length;i++)t.childSKUs[i].repositoryId==e.childItems[r].catRefId&&(e.childItems[r].productData(jQuery.extend(!0,{},t)),e.childItems[r].assetable=t.assetable,e.childItems[r].shippable=t.shippable,e.childItems[r].allowVirtualShippingGroup=p.storeConfiguration.allowVirtualShippingGroup,e.childItems[r].soldAsPackage(t.childSKUs[i].soldAsPackage),e.childItems[r].isVirtualShippingGroup=p.storeConfiguration.allowVirtualShippingGroup&&p.storeConfiguration.isVirtualShippingGroup.call(t));e.childItems[r].childItems&&e.childItems[r].childItems.length>0&&p.updateChildTreeProductData(e.childItems[r],t)}},p.getChildItemsDataAsCartItems=function(e){var t=[];return e.childItems&&(t=e.childItems.map(function(e){var t={productId:e.id,productData:e,quantity:e.orderQuantity,catRefId:e.catalogRefId,selectedOptions:e.selectedOptions,currency:p.currency,externalPrice:e.price,externalPriceQuantity:-1,externalData:e.externalData,actionCode:e.actionCode,lineAttributes:p.lineAttributes,externalRecurringCharge:e.externalRecurringCharge,externalRecurringChargeFrequency:e.externalRecurringChargeFrequency,externalRecurringChargeDuration:e.externalRecurringChargeDuration,assetKey:e.assetKey,rootAssetKey:e.rootAssetKey,parentAssetKey:e.parentAssetKey,serviceId:e.serviceId,customerAccountId:e.customerAccountId,billingAccountId:e.billingAccountId,serviceAccountId:e.serviceAccountId,billingProfileId:e.billingProfileId,activationDate:e.activationDate,deactivationDate:e.deactivationDate,transactionDate:e.transactionDate,asset:e.asset,addOnItem:e.addOnItem,shopperInput:e.shopperInput,commerceItemId:p.generateCommerceItemId(),soldAsPackage:e.soldAsPackage,assetable:e.assetable,shippable:e.shippable,allowVirtualShippingGroup:p.storeConfiguration.allowVirtualShippingGroup};return t.isVirtualShippingGroup=p.storeConfiguration.allowVirtualShippingGroup&&p.storeConfiguration.isVirtualShippingGroup.call(t),e.childItems&&e.childItems.length>0&&s.extend(t,{childItems:p.getChildItemsDataAsCartItems(e)}),new I(t)})),t},p.getAddonDataAsCartItems=function(e){var t=[];e.selectedAddOnProducts&&(t=e.selectedAddOnProducts.map(function(e){for(var t=[],r=0;r<e.addOnOptions.length;r++){var i=e.addOnOptions[r];if(i){var a={productId:i.product.id,productData:i.product,quantity:i.quantity,catRefId:i.sku.repositoryId,selectedOptions:i.selectedOptions,currency:p.currency,externalData:i.externalData,actionCode:i.actionCode,lineAttributes:p.lineAttributes,externalRecurringCharge:i.externalRecurringCharge,externalRecurringChargeFrequency:i.externalRecurringChargeFrequency,externalRecurringChargeDuration:i.externalRecurringChargeDuration,assetKey:i.assetKey,rootAssetKey:i.rootAssetKey,parentAssetKey:i.parentAssetKey,serviceId:i.serviceId,customerAccountId:i.customerAccountId,billingAccountId:i.billingAccountId,serviceAccountId:i.serviceAccountId,billingProfileId:i.billingProfileId,activationDate:i.activationDate,deactivationDate:i.deactivationDate,transactionDate:i.transactionDate,asset:i.asset,addOnItem:!0,shopperInput:i.shopperInput,configurablePropertyId:e.repositoryId,configurationOptionId:i.repositoryId,commerceItemId:p.generateCommerceItemId(),soldAsPackage:i.sku.soldAsPackage,assetable:i.assetable,shippable:i.shippable,allowVirtualShippingGroup:p.storeConfiguration.allowVirtualShippingGroup};a.isVirtualShippingGroup=p.storeConfiguration.allowVirtualShippingGroup&&p.storeConfiguration.isVirtualShippingGroup.call(a),i.externalPrice&&s.extend(a,{externalPrice:i.externalPrice,externalPriceQuantity:-1})}p.isProductWithAddons(i.product)&&s.extend(a,{childItems:p.getAddonDataAsCartItems(i.product)}),t.push(new I(a))}if(t.length>0)return t}));for(var r=[],i=0;i<t.length;i++)r=r.concat(t[i]);return r},p.updateChildItemPrices=function(e,t){for(var r=0;r<e.length;r++)for(var i=0;i<t.length;i++)if(e[r].productId===t[i].productId&&e[r].catRefId===t[i].catRefId&&e[r].commerceItemId===t[i].commerceItemId){t[i].detailedItemPriceInfo(e[r].detailedItemPriceInfo),t[i].detailedRecurringChargeInfo(e[r].detailedRecurringChargeInfo),e[r].amount&&t[i].itemTotal(e[r].amount),e[r].rawTotalPrice&&t[i].rawTotalPrice(e[r].rawTotalPrice),e[r].id&&(t[i].repositoryId=e[r].id,p.currentOrderState()!=l.QUOTED_STATES&&p.currentOrderState()!=l.PENDING_PAYMENTS&&p.currentOrderState()!=l.PENDING_PAYMENT_TEMPLATE&&(e[r].commerceItemId?t[i].commerceItemId=e[r].commerceItemId:t[i].commerceItemId=e[r].id)),e[r].rootAssetKey&&t[i].rootAssetKey(e[r].rootAssetKey),e[r].parentAssetKey&&t[i].parentAssetKey(e[r].parentAssetKey),t[i].childItems&&e[r].childItems&&p.updateChildItemPrices(e[r].childItems,t[i].childItems);break}},p.getChildItemsAsCartItems=function(t){var r=[];return t.childItems&&(r=t.childItems.map(function(t){var r={productId:t.productId,quantity:t.quantity,catRefId:t.catRefId,selectedOptions:t.selectedOptions,currency:p.currency,externalPrice:t.externalPrice,externalPriceQuantity:t.externalPriceQuantity,externalData:t.externalData,actionCode:t.actionCode,lineAttributes:S.singleInstance.lineAttributes,externalRecurringCharge:t.externalRecurringCharge,externalRecurringChargeFrequency:t.externalRecurringChargeFrequency,externalRecurringChargeDuration:t.externalRecurringChargeDuration,assetKey:t.assetKey,rootAssetKey:t.rootAssetKey,parentAssetKey:t.parentAssetKey,serviceId:t.serviceId,customerAccountId:t.customerAccountId,billingAccountId:t.billingAccountId,serviceAccountId:t.serviceAccountId,billingProfileId:t.billingProfileId,activationDate:t.activationDate,deactivationDate:t.deactivationDate,transactionDate:t.transactionDate,asset:t.asset,rawTotalPrice:t.rawTotalPrice,commerceItemId:t.commerceItemId,addOnItem:t.addOnItem,shopperInput:t.shopperInput,configurablePropertyId:t.configurablePropertyId,configurationOptionId:t.configurationOptionId,soldAsPackage:t.soldAsPackage,assetable:t.assetable,shippable:t.shippable,allowVirtualShippingGroup:p.storeConfiguration.allowVirtualShippingGroup};t.childItems&&t.childItems.length>0?s.extend(r,{childItems:p.getChildItemsAsCartItems(t)}):s.extend(r,{backOrderQuantity:t.backOrderQuantity,preOrderQuantity:t.preOrderQuantity}),r.isVirtualShippingGroup=p.storeConfiguration.allowVirtualShippingGroup&&p.storeConfiguration.isVirtualShippingGroup.call(r);var i=new I(r);return i.displayName=e.observable(t.displayName),i.detailedItemPriceInfo(t.detailedItemPriceInfo),i.itemTotal(t.amount),i.detailedRecurringChargeInfo(t.detailedRecurringChargeInfo),i.repositoryId=t.id,i})),r},p.checkCpqItemValidity=function(e,t,r,i,a){for(var o=0;t.childItems&&o<t.childItems.length;o++){if(e.id==t.childItems[o].productId)if(e.active&&e.childSKUs&&0!=e.childSKUs.length){var n=0,s=!1;for(n=0;e.childSKUs&&n<e.childSKUs.length;n++)if(e.childSKUs[n].repositoryId==t.childItems[o].catRefId){s=!0;break}e.childSKUs[n]&&!e.childSKUs[n].active?t.childItems[o].addOnItem?a.indexOf(t.childItems[o])==-1&&a.push(t.childItems[o]):i.indexOf(t.childItems[o].catRefId)==-1&&i.push(t.childItems[o].catRefId):e.childSKUs[n]&&null==e.childSKUs[n].listPrice&&t.childItems[o].addOnItem?a.indexOf(t.childItems[o])==-1&&a.push(t.childItems[o]):!s&&t.childItems[o].addOnItem&&a.indexOf(t.childItems[o])==-1&&a.push(t.childItems[o])}else t.childItems[o].addOnItem?a.indexOf(t.childItems[o])==-1&&a.push(t.childItems[o]):r.indexOf(e.displayName)==-1&&r.push(e.displayName);t.childItems[o].childItems&&t.childItems[o].childItems.length>0&&p.checkCpqItemValidity(e,t.childItems[o],r,i,a)}},p.checkCpqItemValidityForLargeCart=function(e,t,r,i,a){for(var o=0;t.childItems&&o<t.childItems.length;o++){if(e.id==t.childItems[o].productId&&0==t.childItems[o].processed)if(e.active&&e.childSKUs&&0!=e.childSKUs.length){var n=0,s=!1;for(n=0;e.childSKUs&&n<e.childSKUs.length;n++)if(e.childSKUs[n].repositoryId==t.childItems[o].catRefId){s=!0;break}e.childSKUs[n]&&!e.childSKUs[n].active?t.childItems[o].addOnItem?a.indexOf(t.childItems[o])==-1&&(t.childItems[o].invalid=!0,a.push(t.childItems[o])):i.indexOf(t.childItems[o].catRefId)==-1&&(t.childItems[o].invalid=!0,i.push(t.childItems[o].catRefId)):e.childSKUs[n]&&null==e.childSKUs[n].listPrice&&t.childItems[o].addOnItem?a.indexOf(t.childItems[o])==-1&&(t.childItems[o].invalid=!0,a.push(t.childItems[o])):!s&&t.childItems[o].addOnItem&&a.indexOf(t.childItems[o])==-1&&(t.childItems[o].invalid=!0,a.push(t.childItems[o]))}else t.childItems[o].addOnItem?a.indexOf(t.childItems[o])==-1&&(t.childItems[o].invalid=!0,a.push(t.childItems[o])):r.indexOf(e.displayName)==-1&&(t.childItems[o].invalid=!0,r.push(e.displayName));t.childItems[o].childItems&&t.childItems[o].childItems.length>0&&p.checkCpqItemValidityForLargeCart(e,t.childItems[o],r,i,a)}},p.getChildItemsCookie=function(e){for(var t=[],r=0;e.childItems&&r<e.childItems.length;r++){var i=e.childItems[r];t[r]={productId:i.productId,quantity:i.quantity(),catRefId:i.catRefId,amount:i.itemTotal(),id:i.repositoryId,rawTotalPrice:i.rawTotalPrice(),stockStatus:i.stockStatus(),displayName:i.displayName(),selectedOptions:i.selectedOptions,selectedSkuProperties:i.selectedSkuProperties,discountInfo:i.discountInfo(),detailedItemPriceInfo:i.detailedItemPriceInfo(),externalPrice:i.externalPrice(),externalPriceQuantity:i.externalPriceQuantity(),configuratorId:i.configuratorId,externalData:i.externalData(),actionCode:i.actionCode(),commerceItemId:i.commerceItemId,unpricedExternalMessage:i.unpricedExternalMessage(),isGWPChoicesAvaliable:i.isGWPChoicesAvaliable(),giftData:i.giftData?i.giftData:null,giftWithPurchaseCommerceItemMarkers:i.giftWithPurchaseCommerceItemMarkers,priceListGroupId:i.priceListGroupId(),invalid:i.invalid,isPersonalized:i.isPersonalized(),detailedRecurringChargeInfo:i.detailedRecurringChargeInfo(),
- externalRecurringCharge:i.externalRecurringCharge(),externalRecurringChargeFrequency:i.externalRecurringChargeFrequency(),externalRecurringChargeDuration:i.externalRecurringChargeDuration(),assetKey:i.assetKey(),rootAssetKey:i.rootAssetKey(),parentAssetKey:i.parentAssetKey(),serviceId:i.serviceId(),customerAccountId:i.customerAccountId(),billingAccountId:i.billingAccountId(),serviceAccountId:i.serviceAccountId(),billingProfileId:i.billingProfileId(),activationDate:i.activationDate(),deactivationDate:i.deactivationDate(),transactionDate:i.transactionDate(),asset:i.asset(),addOnItem:i.addOnItem,shopperInput:i.shopperInput,configurablePropertyId:i.configurablePropertyId,configurationOptionId:i.configurationOptionId,soldAsPackage:i.soldAsPackage,assetable:i.assetable,shippable:i.shippable,allowVirtualShippingGroup:p.storeConfiguration.allowVirtualShippingGroup},i.childItems&&i.childItems.length>0&&(t[r].childItems=p.getChildItemsCookie(i))}return t},p.getRemoveCouponReadText=function(){return o.t("ns.common:resources.removeCouponLinkReadText")},p.populateGiftCards=function(e,t){if(p.populateGiftCardsHandler&&s.isFunction(p.populateGiftCardsHandler))p.populateGiftCardsHandler(e,t);else if(p.giftCards().length>0)for(var r=0;r<p.giftCards().length;r++){var i={},a=p.giftCards()[r];i.type=l.GIFT_CARD_PAYMENT_TYPE,i.giftCardNumber=a.giftCardNumber(),i.giftCardPin=a.giftCardPin(),a.amountInGiftCard()&&(t&&t.type===B&&t.product.giftCardNumber()===a.giftCardNumber()||(i.amount=a.amountInGiftCard())),e.payments.push(i)}},p.populateIINs=function(e,t){if(p.IINDetails().length>0)for(var r=0;r<p.IINDetails().length;r++){var i=p.IINDetails()[r];i.IIN=i.IIN;var a=l.IIN_PAYMENT_TYPE;i.type&&(a=i.type),i.type=a,e.payments.push(i)}},p.applyIINsToCart=function(e){p.IINDetails([]);for(var t=0;t<e.length;t++)p.IINDetails.push(e[t]);p.events.push(new w($,0,e)),p.markDirty()},p.validateGiftCards=function(){for(var e=0;e<p.giftCards().length;e++){var t=p.giftCards()[e];if(!t.validateNow())return!1}return!0},p.updateAllItemsArray=function(){p.storeConfiguration.largeCartConfig.enableOptimizedUpdatesofItems?p.updateAllItemsArrayOptimzed():(p.allItems.removeAll(),e.utils.arrayForEach(p.items(),function(e){p.allItems.push(e)}),e.utils.arrayForEach(p.placeHolderItems(),function(e){p.allItems.push(e)}))},p.isConfigurableItem=function(e){return void 0!=e.configuratorId&&null!=e.configuratorId&&""!=e.configuratorId||void 0!=e.childItems&&null!=e.childItems&&""!=e.childItems},p.cpqConfigMap=new Map,p.isProductWithAddons=function(e){return!!(e.selectedAddOnProducts&&e.selectedAddOnProducts.length>0)},p.getDerivedTotal=function(e,t){var r=this.isChargeTaxShippingInSecondaryCurrency()&&!this.allowAlternateCurrency()?e:t;return r},p.buildErrorInfo=function(e){var t={},r=!!e.hasOwnProperty("errorCode");if(e.errors&&e.errors.length>0||r)if(e.errors&&e.errors.length>0)t.errors=e.errors;else if(r){var i=[],a={};a.errorCode=e.errorCode,a.message=e.message,a.status=e.status,a.moreInfo=e.moreInfo,a.devMessage=e.moreInfo,i.push(a),t.errors=i}return t},p.getCampaigns=function(e){var t=[];return e&&e.length&&e.forEach(function(e){e.key.startsWith(l.CAMPAIGN_SOURCE_PREFIX)&&void 0!==e.value&&t.push({source:e.key,campaignId:e.value})}),t},s.Topic(t.topicNames.CART_ADD).subscribe(p.addToCart),s.Topic(t.topicNames.CART_REMOVE).subscribe(p.removeFromCart),s.Topic(t.topicNames.ORDER_SUBMISSION_SUCCESS).subscribe(p.handleOrderSubmit),s.Topic(t.topicNames.SCHEDULED_ORDER_SUBMISSION_SUCCESS).subscribe(p.handleOrderSubmit),s.Topic(t.topicNames.CART_UPDATE_QUANTITY).subscribe(p.updateQuantity),s.Topic(t.topicNames.CHECKOUT_SHIPPING_METHOD).subscribe(p.updateShippingMethod),s.Topic(t.topicNames.PAGE_CONTEXT_CHANGED).subscribe(i.emptyGrowlMessages),s.Topic(t.topicNames.PAGE_VIEW_CHANGED).subscribe(E),s.Topic(t.topicNames.PAGE_LAYOUT_UPDATED).subscribe(p.initCatalog.bind(p)),s.Topic(t.topicNames.LOAD_CHECKOUT).subscribe(p.checkPriceDataAndRedirect),s.Topic(t.topicNames.POPULATE_SHIPPING_METHODS).subscribe(p.updateShippingAddress),s.Topic(t.topicNames.CHECKOUT_SHIPPING_ADDRESS_INVALID).subscribe(p.resetShippingAddress),s.Topic(t.topicNames.USER_PROFILE_ADDRESSES_REMOVED).subscribe(p.resetShippingAddress),s.Topic(t.topicNames.USER_AUTO_LOGIN_SUCCESSFUL).subscribe(p.loadCartForProfile.bind(p)),s.Topic(t.topicNames.USER_LOAD_CART).subscribe(p.loadCartForProfile.bind(p)),s.Topic(t.topicNames.USER_CLEAR_CART).subscribe(p.clearCartForProfile.bind(p)),s.Topic(t.topicNames.REFRESH_USER_CART).subscribe(p.refreshUserCart.bind(p)),s.Topic(t.topicNames.REMOVE_INVALID_ITEMS).subscribe(p.handleInvalidItems.bind(p)),s.Topic(t.topicNames.ORDER_SUBMISSION_FAIL).subscribe(p.clearPins.bind(p)),s.Topic(t.topicNames.PAGE_CHANGED).subscribe(function(e){p.clearLoadedOrder(e),p.clearPins()}),s.Topic(t.topicNames.USER_LOGOUT_SUBMIT).subscribe(p.clearPins.bind(p)),s.Topic(t.topicNames.USER_SESSION_RESET).subscribe(p.clearPins.bind(p)),s.Topic(t.topicNames.GIFTCARD_REAPPLY_PINS).subscribe(p.reApplyGiftCardPins.bind(p)),s.Topic(t.topicNames.PLACE_HOLDER_REMOVE).subscribe(function(e){p.removePlaceHolderFromCart(e)}),s.Topic(t.topicNames.USER_LOAD_SHIPPING).subscribe(function(e){p.user()&&!p.user().loggedIn()&&p.resetShippingAddress()}),p}function C(e){var t=null;if(e.variant&&e.variant.length>0){var r=e.variant;t=[];for(var i=0;i<r.length;i++)t.push({optionName:r[i].optionName,optionValue:r[i].optionValue})}return t}function _(t,r,i,a,o,n,s,l){var c=this;return c.code=e.observable(t),c.description=e.observable(r),c.status=e.observable(i),c.level=e.observable(a),c.id=e.observable(o),c.totalAdjustment=e.observable(n),c.name=e.observable(s),c.longDescription=e.observable(l),c.toJSON=function(){var t=e.toJS(c);return t},c}function A(t,r,i,a){var o=this;return o.code=e.observable(t),o.couponStatus=e.observable(i?i:""),o.promotions=e.observableArray([]),o.newPromotionInfo=function(t,r,i,a,o,n,s){var l={};return l.promotionId=e.observable(t?t:""),l.promotionDesc=e.observable(r?r:""),l.promotionApplied=e.observable(!!i&&i),l.promotionLevel=e.observable(a?a:""),l.totalAdjustment=e.observable(o?o:"0"),l.promotionName=e.observable(n?n:""),l.promotionLongDesc=e.observable(s?s:""),l.toJSON=function(){var t=e.toJS(l);return t},l},o.populatePromotionData=function(e,t,r){t.promotionDesc(e.promotionDesc),t.promotionApplied(r?r:e.promotionApplied),t.promotionLevel(e.promotionLevel),t.totalAdjustment(e.totalAdjustment),t.promotionName(e.promotionName),t.promotionLongDesc(e.promotionLongDesc)},o.populateCouponData=function(t,r){var i=this,a=e.observableArray([]),o=!1;if(t&&t.length>0)for(var n=0;n<t.length;n++){o=!1;for(var s=0;s<i.promotions().length;s++)if(t[n].promotionId==i.promotions()[s].promotionId()){i.populatePromotionData(t[n],i.promotions()[s],r),o=!0;break}o||a.push(i.newPromotionInfo(t[n].promotionId,t[n].promotionDesc,r?r:t[n].promotionApplied,t[n].promotionLevel,t[n].totalAdjustment,t[n].promotionName,t[n].promotionLongDesc))}for(var n=0;n<a().length;n++)i.promotions.push(a()[n])},o.toJSON=function(){var t=e.toJS(o);return t},r&&r.length>0&&o.populateCouponData(r,a),o}function O(e,t,r,i,a,o,n){var s=!1;i.hasExternalPriceItem(!1);for(var c=new Object,d=0;d<t().length;d++){var u=t()[d],p=u.productId+u.catRefId;c[p]?c[p]=c[p]+","+d.toString():c[p]=d.toString()}for(var h=0;h<e.length;h++){var p=e[h].productId+e[h].catRefId,g=[];c[p];c[p]&&(g=c[p].split(","));for(var f=!1,m=0;m<g.length;m++){var E=g[m];(!i.isConfigurableItem(e[h])&&!i.isConfigurableItem(t()[E])&&null!=e[h].commerceItemId&&e[h].commerceItemId==t()[E].commerceItemId||i.isConfigurableItem(e[h])&&i.isConfigurableItem(t()[E])&&null!=e[h].commerceItemId&&e[h].commerceItemId==t()[E].commerceItemId)&&(t()[E].quantity(e[h].quantity),t()[E].discountInfo(e[h].discountInfo),t()[E].rawTotalPrice(e[h].rawTotalPrice),t()[E].selectedOptions=e[h].variant,(r||t()[E].giftWithPurchaseCommerceItemMarkers&&t()[E].giftWithPurchaseCommerceItemMarkers.length||e[h].giftWithPurchaseCommerceItemMarkers&&e[h].giftWithPurchaseCommerceItemMarkers.length)&&t()[E].updatableQuantity(e[h].quantity),t()[E].itemTotal(e[h].price),t()[E].originalPrice(e[h].unitPrice),t()[E].detailedItemPriceInfo(e[h].detailedItemPriceInfo),t()[E].repositoryId=e[h].id,i.isConfigurableItem(t()[E])&&i.isConfigurableItem(e[h])&&i.updateChildItemPrices(e[h].childItems,t()[E].childItems),t()[E].detailedRecurringChargeInfo(e[h].detailedRecurringChargeInfo),t()[E].repositoryId=e[h].id,t()[E].childItems&&t()[E].childItems.length>0&&e[h].childItems&&e[h].childItems.length>0&&i.updateChildItemPrices(e[h].childItems,t()[E].childItems),t()[E].giftWithPurchaseCommerceItemMarkers=e[h].giftWithPurchaseCommerceItemMarkers,t()[E].isGWPChoicesAvaliable(!1),e[h].externalPrice&&t()[E].externalPrice()&&(e[h].externalPrice!=t()[E].externalPrice()?t()[E].productPriceChanged(!0):t()[E].productPriceChanged(!1)),i.addGiftDataToItem(t()[E],a),delete t()[E].giftWithPurchaseSelections,i.updateItemDynamicProperties(t()[E],e[h]),i.updateItemPriceOverrideFields(t()[E],e[h]),f=!0)}if(i.currentOrderState()!=l.QUOTED_STATES&&i.currentOrderState()!=l.PENDING_PAYMENTS&&i.currentOrderState()!=l.PENDING_PAYMENT_TEMPLATE){if(!f)for(var E=0;t&&E<t().length;E++)if(!t()[E].commerceItemId){t()[E].quantity(e[h].quantity),t()[E].discountInfo(e[h].discountInfo),t()[E].rawTotalPrice(e[h].rawTotalPrice),(r||t()[E].giftWithPurchaseCommerceItemMarkers&&t()[E].giftWithPurchaseCommerceItemMarkers.length||e[h].giftWithPurchaseCommerceItemMarkers&&e[h].giftWithPurchaseCommerceItemMarkers.length)&&t()[E].updatableQuantity(e[h].quantity),t()[E].itemTotal(e[h].price),t()[E].detailedItemPriceInfo(e[h].detailedItemPriceInfo),t()[E].repositoryId=e[h].id,i.isConfigurableItem(t()[E])&&i.isConfigurableItem(e[h])&&i.updateChildItemPrices(e[h].childItems,t()[E].childItems),t()[E].detailedRecurringChargeInfo(e[h].detailedRecurringChargeInfo),t()[E].repositoryId=e[h].id,t()[E].childItems&&t()[E].childItems.length>0&&e[h].childItems&&e[h].childItems.length>0&&i.updateChildItemPrices(e[h].childItems,t()[E].childItems),t()[E].giftWithPurchaseCommerceItemMarkers=e[h].giftWithPurchaseCommerceItemMarkers,t()[E].isGWPChoicesAvaliable(!1),i.addGiftDataToItem(t()[E],a),delete t()[E].giftWithPurchaseSelections,i.updateItemDynamicProperties(t()[E],e[h]),i.updateItemPriceOverrideFields(t()[E],e[h]),t()[E].commerceItemId=e[h].id,f=!0;break}if((r||R(e[h].discountInfo))&&!f){var y=C(e[h]),v=null;i.isConfigurableItem(e[h])&&(v=[],v=i.getChildItemsAsCartItems(e[h]));var b={productId:e[h].productId,quantity:e[h].quantity,catRefId:e[h].catRefId,selectedOptions:y,currency:S.singleInstance.currency,discountInfo:e[h].discountInfo,rawTotalPrice:e[h].rawTotalPrice,externalPrice:e[h].externalPrice,externalPriceQuantity:e[h].externalPriceQuantity,configuratorId:e[h].configuratorId,childItems:v,commerceItemId:e[h].commerceItemId,unpricedExternalMessage:e[h].unpricedExternalMessage,externalData:e[h].externalData,actionCode:e[h].actionCode,lineAttributes:S.singleInstance.lineAttributes,externalRecurringCharge:e[h].externalRecurringCharge,externalRecurringChargeFrequency:e[h].externalRecurringChargeFrequency,externalRecurringChargeDuration:e[h].externalRecurringChargeDuration,assetKey:e[h].assetKey,rootAssetKey:e[h].rootAssetKey,parentAssetKey:e[h].parentAssetKey,serviceId:e[h].serviceId,customerAccountId:e[h].customerAccountId,billingAccountId:e[h].billingAccountId,serviceAccountId:e[h].serviceAccountId,billingProfileId:e[h].billingProfileId,activationDate:e[h].activationDate,deactivationDate:e[h].deactivationDate,transactionDate:e[h].transactionDate,asset:e[h].asset,addOnItem:e[h].addOnItem,shopperInput:e[h].shopperInput,shippingGroupRelationships:e[h].shippingGroupRelationships,allowVirtualShippingGroup:i.storeConfiguration.allowVirtualShippingGroup};b.isVirtualShippingGroup=i.storeConfiguration.allowVirtualShippingGroup&&i.storeConfiguration.isVirtualShippingGroup.call(b);var u=new I(b);u.itemTotal(e[h].price),u.detailedItemPriceInfo(e[h].detailedItemPriceInfo),u.detailedRecurringChargeInfo(e[h].detailedRecurringChargeInfo),u.repositoryId=e[h].id,i.updateItemDynamicProperties(u,e[h]),a.priceListGroup&&a.priceListGroup.repositoryId==i.priceListGroupId()&&i.updateItemPriceOverrideFields(u,e[h]),u.giftWithPurchaseCommerceItemMarkers=e[h].giftWithPurchaseCommerceItemMarkers,i.addGiftDataToItem(u,a),t.push(u),s=!0}}}a.shippingGroups&&a.shippingGroups[0].items&&i.associateShippingGroupsToItems(a.shippingGroups,r,n);for(var E=0;t&&E<t().length;E++){for(var f=!1,h=0;h<e.length;h++)if(e[h].productId==t()[E].productId&&e[h].catRefId==t()[E].catRefId){f=!0;break}f||(t.remove(t()[E]),E--)}return s}function R(e){if(e&&e.length)for(var t=0;t<e.length;t++)if(e[t].giftWithPurchaseDiscountInfo&&e[t].giftWithPurchaseDiscountInfo.length)return!0;return!1}function N(e){for(var t={},r=0;r<e.childSKUs.length;r++)e.childSKUs[r].primaryThumbImageURL&&(t[e.childSKUs[r].repositoryId]=e.childSKUs[r].primaryThumbImageURL);return t}function D(e){this.operation="availability",this.products=new Array,this.locationIds=new Array,this.catalogId=e.catalogId();for(var t=0;t<e.items().length;t++){var r=e.items()[t].productId,i=e.items()[t].catRefId;i&&(r=r+":"+i),this.products.push(r),this.getProductSkuFromChild=function(e){for(var t=0;t<e.childItems.length;t++){var r=e.childItems[t].productId,i=e.childItems[t].catRefId;i&&(r=r+":"+i),this.products.push(r),e.childItems[t].childItems&&e.childItems[t].childItems.length>0&&this.getProductSkuFromChild(e.childItems[t])}};var a=e.items()[t];if(a.shippingGroupRelationships&&a.shippingGroupRelationships()&&a.shippingGroupRelationships().length>0)for(var o=0;o<a.shippingGroupRelationships().length;o++){var n=a.shippingGroupRelationships()[o];n&&n.isPickupInStore&&n.isPickupInStore()&&this.locationIds.push(n.selectedStore().locationId)}e.isConfigurableItem(e.items()[t])&&e.items()[t].childItems&&e.items()[t].childItems.length>0&&this.getProductSkuFromChild(e.items()[t])}s.unique(this.products),s.unique(this.locationIds),this.products=this.products.join(","),this.locationIds&&this.locationIds.length>0&&(this.locationIds.push(e.contextData.global.site.siteInfo.inventoryLocationId),this.locationIds=this.locationIds.join(","))}function L(e){this.shoppingCart=new Object,this.shoppingCart.items=e.items(),this.shoppingCart.coupons=e.coupons(),!e.mergeCart()&&e.currentOrderId()&&(this.id=e.currentOrderId()),e.giftWithPurchaseOrderMarkers&&e.giftWithPurchaseOrderMarkers.length&&(this.giftWithPurchaseOrderMarkers=e.giftWithPurchaseOrderMarkers),this.combineLineItems=e.combineLineItems,this.payments=[],e.user().isPunchout()&&(this.requestChannel=l.PUNCHOUT_TEXT,e.user().orderId()&&""!=e.user().orderId()&&(this.id=e.user().orderId())),!(e.user()&&e.user().loggedIn()&&e.user().orderId()&&""!=e.user().orderId()&&e.nonTransientCartCheck())||e.createNewCart()||e.user().clonedOrderId()&&""!=e.user().clonedOrderId()||(this.id=e.user().orderId()),e.cartName()&&(this.cartName=e.cartName()),e.populateDynamicProperties(this),void 0!=e.storeConfiguration.isLargeCart()&&(this.largeCart=e.storeConfiguration.isLargeCart())}function w(e,t,r){this.type=e,this.quantity=t,e==F||e==H?this.coupon=r:e===Q||e===J?this.coupons=r:e===z?this.products=r:e==ee?this.href=r:this.product=r}function M(e,t){this.operation="availability",this.products=new Array,this.catalogId=t,this.products.push(e.id+":"+e.catalogRefId),this.getProductSkuFromChild=function(e){for(var t=0;t<e.childItems.length;t++){var r=e.childItems[t].id,i=e.childItems[t].catalogRefId;i&&(r=r+":"+i),this.products.push(r),e.childItems[t].childItems&&e.childItems[t].childItems.length>0&&this.getProductSkuFromChild(e.childItems[t])}},e.configuratorId&&e.childItems&&e.childItems.length>0&&this.getProductSkuFromChild(e),this.getProductSkuFromAddons=function(e){for(var t=0;t<e.selectedAddOnProducts.length;t++)for(var r=0;r<e.selectedAddOnProducts[t].addOnOptions.length;r++){var i=e.selectedAddOnProducts[t].addOnOptions[r],a=i.product.repositoryId+":"+i.sku.repositoryId;this.products.push(a),i.product.selectedAddOnProducts&&i.product.selectedAddOnProducts.length>0&&this.getProductSkuFromAddons(i.product)}},e.selectedAddOnProducts&&e.selectedAddOnProducts.length>0&&this.getProductSkuFromAddons(e),s.unique(this.products),this.products=this.products.join(",")}function U(e,t){this.operation="availability",this.products=new Array,this.catalogId=t;for(var r,i=0;i<e.length;i++)if(r=e[i],this.products.push(r.id+":"+r.catalogRefId),r.childItems)for(var a=0;a<r.childItems.length;a++){var o=r.childItems[a].productId,n=r.childItems[a].catRefId;n&&(o=o+":"+n),this.products.push(o)}this.products=this.products.join(",")}var k=1,x=2,G=3,F=4,H=5,V=6,Y=7,B=8,q=9,j=10,W=11,$=12,K=13,z=14,Q=15,X=16,J=17,Z=18,ee=21,te=1e12,re="CartViewModel",ie="GiftWithPurchase",ae=l.APPLICATION_STOREFRONT;return S.prototype.loadCartForProfile=function(i){if(void 0==i.isAutoLogin||!i.isAutoLogin){var a=this;r.clearError(re);if(a.isCurrentCallInProgress)s.Topic(t.topicNames.CART_LOADED_FOR_PROFILE).publish();else if(a.events.push(new w(X,0,c)),a.user()&&!a.isCartTransient()){if(i&&i.catalog){var n=i.catalog.repositoryId;this.catalogId()!=n&&this.catalogId(n)}if(i&&i.priceListGroup&&i.priceListGroup.id&&this.priceListGroupId(e.utils.unwrapObservable(i.priceListGroup.id)),1==a.user().isPunchout()){if(a.emptyCart(),a.user().orderId()&&""!=a.user().orderId()){var c={},d={};d[l.ENDPOINT_KEY]=l.ENDPOINT_GET_ORDER,d[l.IDENTIFIER_KEY]="loadCartForProfilebyOrderId";var u=a.storeConfiguration.getFilterToUse(d);u&&(c[l.FILTER_KEY]=u),a.isCurrentCallInProgress=!0,h.request(l.ENDPOINT_GET_ORDER,c,function(r){if(void 0===r&&(a.shippingAddress()&&e.utils.unwrapObservable(a.shippingAddress().email)&&(a.shippingAddress().email=null),s.Topic(t.topicNames.CART_READY).publish(a),a.events.pop(),s.Topic(t.topicNames.CART_LOADED_FOR_PROFILE).publish()),r&&r.orderId){a.user().orderId(r.orderId),a.user().persistedOrder(r),a.user().setLocalData("orderId"),a.cartName(r.cartName);a.removeItems(r);a.mergeItems(r),a.isPricingRequired(!0),a.validateServerCart(),a.getProductData(),a.getDynamicPropertiesMetadata(!0),a.getItemDynamicPropertiesMetadata(l.ENDPOINT_COMMERCE_ITEM_TYPE_PARAM),a.updateDynamicProperties(r),r.discountInfo.orderImplicitDiscountList&&a.orderDiscountDescList(r.discountInfo.orderImplicitDiscountList),r.discountInfo.unclaimedCouponsMap&&a.populateCoupons(r.discountInfo.unclaimedCouponsMap,l.COUPON_STATUS_UNCLAIMED),r.discountInfo.orderCouponsMap&&a.populateCoupons(r.discountInfo.orderCouponsMap,l.COUPON_STATUS_CLAIMED),a.couponMultiPromotions.splice(0),r.discountInfo.unclaimedCouponMultiPromotions&&a.populateCouponMultiPromotions(r.discountInfo.unclaimedCouponMultiPromotions,l.COUPON_STATUS_UNCLAIMED,l.PROMOTION_NOT_APPLIED),r.discountInfo.claimedCouponMultiPromotions&&a.populateCouponMultiPromotions(r.discountInfo.claimedCouponMultiPromotions,l.COUPON_STATUS_CLAIMED,l.PROMOTION_APPLIED),a.populateClaimedCouponMultiPromotions(a.couponMultiPromotions());for(var i=a.coupons().length-1;i>=0;i--)r.discountInfo.orderCouponsMap.hasOwnProperty(a.coupons()[i].code())||r.discountInfo.unclaimedCouponsMap.hasOwnProperty(a.coupons()[i].code())||a.coupons.splice(i,0);if(r.shippingGroups&&1==r.shippingGroups.length&&a.shippingAddress&&""==a.shippingAddress()&&r.shippingGroups[0].shippingAddress&&!(a.user()&&a.user().shippingAddressBook()&&a.user().shippingAddressBook.length>0)){var n={translate:function(e,t){return o.t("ns.common:resources."+e,t)}},c=new g("cart-shipping-address","",n,a.contextData.page.shippingCountriesPriceListGroup,a.contextData.page.defaultShippingCountry);c.copyFrom(r.shippingGroups[0].shippingAddress,a.contextData.page.shippingCountriesPriceListGroup),c.resetModified(),c.validateForShippingMethod()&&(a.shippingAddress(c),a.shippingMethod(r.shippingGroups[0].shippingMethod.value),s.Topic(t.topicNames.CART_SHIPPING_ADDRESS_UPDATED).publishWith())}}},function(e){a.user().orderId(""),a.user().persistedOrder(null),a.user().setLocalData("orderId"),a.loadCart()},a.user().orderId())}}else{var p={},d={};d[l.ENDPOINT_KEY]=l.ENDPOINT_GET_PROFILE_ORDER,d[l.IDENTIFIER_KEY]="loadCartForProfile";var u=a.storeConfiguration.getFilterToUse(d);u&&(p[l.FILTER_KEY]=u),a.isCurrentCallInProgress=!0,a.adapter.loadJSON("getCurrentProfileOrder","0",p,function(r){if(a.isCurrentCallInProgress=!1,void 0===r&&(a.shippingAddress()&&e.utils.unwrapObservable(a.shippingAddress().email)&&(a.shippingAddress().email=null),s.Topic(t.topicNames.CART_READY).publish(a),a.events.pop(),s.Topic(t.topicNames.CART_LOADED_FOR_PROFILE).publish()),r&&r.orderId){a.user().orderId(r.orderId),a.user().persistedOrder(r),a.user().setLocalData("orderId"),a.cartName(r.cartName);a.removeItems(r);a.mergeItems(r),a.isPricingRequired(!0),a.validateServerCart(),a.storeConfiguration.largeCartConfig.suppressClientCartValidations?a.handleSuppressValidations(r):a.getProductData(),a.storeConfiguration.isLargeCart()===!0&&a.updateCartAfterLoginForLargeCart(r),a.getDynamicPropertiesMetadata(!0),a.getItemDynamicPropertiesMetadata(l.ENDPOINT_COMMERCE_ITEM_TYPE_PARAM),a.updateDynamicProperties(r),r.discountInfo.orderImplicitDiscountList&&a.orderDiscountDescList(r.discountInfo.orderImplicitDiscountList),r.discountInfo.unclaimedCouponsMap&&a.populateCoupons(r.discountInfo.unclaimedCouponsMap,l.COUPON_STATUS_UNCLAIMED),r.discountInfo.orderCouponsMap&&a.populateCoupons(r.discountInfo.orderCouponsMap,l.COUPON_STATUS_CLAIMED),a.couponMultiPromotions.splice(0),r.discountInfo.unclaimedCouponMultiPromotions&&a.populateCouponMultiPromotions(r.discountInfo.unclaimedCouponMultiPromotions,l.COUPON_STATUS_UNCLAIMED,l.PROMOTION_NOT_APPLIED),r.discountInfo.claimedCouponMultiPromotions&&a.populateCouponMultiPromotions(r.discountInfo.claimedCouponMultiPromotions,l.COUPON_STATUS_CLAIMED,l.PROMOTION_APPLIED),a.populateClaimedCouponMultiPromotions(a.couponMultiPromotions());for(var i=a.coupons().length-1;i>=0;i--)r.discountInfo.orderCouponsMap.hasOwnProperty(a.coupons()[i].code())||r.discountInfo.unclaimedCouponsMap.hasOwnProperty(a.coupons()[i].code())||a.coupons.splice(i,0);if(r.shippingGroups&&1==r.shippingGroups.length&&a.shippingAddress&&""==a.shippingAddress()&&r.shippingGroups[0].shippingAddress&&!(a.user()&&a.user().shippingAddressBook()&&a.user().shippingAddressBook.length>0)){var n={translate:function(e,t){return o.t("ns.common:resources."+e,t)}},c=new g("cart-shipping-address","",n,a.contextData.page.shippingCountriesPriceListGroup,a.contextData.page.defaultShippingCountry);c.copyFrom(r.shippingGroups[0].shippingAddress,a.contextData.page.shippingCountriesPriceListGroup),c.resetModified(),c.validateForShippingMethod()&&(a.shippingAddress(c),a.shippingMethod(r.shippingGroups[0].shippingMethod.value),s.Topic(t.topicNames.CART_SHIPPING_ADDRESS_UPDATED).publishWith())}}else a.items()&&a.items().length>0&&(a.validateServerCart(),a.storeConfiguration.isLargeCart()||a.getProductData(),a.createCurrentProfileOrder())},function(e){a.isCurrentCallInProgress=!1,a.loadCart()})}}else a.events.pop(),a.createOrderForLoggedInAtCheckout&&a.user().loggedinAtCheckout()&&(a.createNewCart(!0),a.createCurrentProfileOrder()),s.Topic(t.topicNames.CART_LOADED_FOR_PROFILE).publish()}},S.prototype.loadOrderForProfile=function(e,t){var r=this;r.user()||(r.user=t),r.user().persistedOrder(null),r.emptyCart(),r.orderCurrency=e.priceListGroup.currency,r.orderItems(e.order?e.order.items:e.shoppingCart.items),r.mergeItems(e),r.user().clonedOrderId()?r.updateCartData(e,!1,!0,!0):r.updateCartData(e,!1,!0),r.updateDynamicProperties(e),r.cartUpdated()},S.prototype.clearLoadedOrder=function(e){var r=this;!r.mergeCart()&&r.currentOrderId()&&(e.pageId==l.PAGE_TYPE_CHECKOUT||e.pageId==l.PAGE_TYPE_AGENT_MULTISHIP_CHECKOUT||e.pageId==l.PAGE_TYPE_AGENT_CHECKOUT||e.pageId==l.PAGE_TYPE_PAYMENT||r.currentOrderState()!=l.QUOTED_STATES&&r.currentOrderState()!=l.PENDING_PAYMENTS&&r.currentOrderState()!=l.PENDING_PAYMENT_TEMPLATE||(r.currentOrderId(null),r.currentOrderState(null),r.orderItems([]),r.orderCurrency={},r.emptyCart(),r.loadCartForProfile(r.user()),s.Topic(t.topicNames.LOAD_ORDER_RESET_ADDRESS).publish()))},S.prototype.isShippingAddressChanged=function(e,t){return e.state&&e.state!=t.state||e.postalCode&&e.postalCode!=t.postalCode||e.country&&e.country!=t.country},S.prototype.removeItems=function(e){for(var t=this,r=!1,i=e.shoppingCart.items,a=0;a<i.length;a++)i[a].hasOwnProperty("isItemValid")&&!i[a].isItemValid&&(i[a].displayName&&t.invalidProductNames.indexOf(i[a].displayName)==-1&&t.invalidProductNames.push(i[a].displayName),i.splice(a,1),a--,r=!0);return r},S.prototype.compareItems=function(e){var t,r=this,i=e;if(i.length!=r.items().length||0==i.length)return!1;if(0==i.length)return!0;var a=r.events.pop();a&&r.events.push(a);for(var o=0;o<r.items().length;o++){t=!1;for(var n=0;n<i.length;n++)if(i[n].productId==r.items()[o].productId&&i[n].catRefId==r.items()[o].catRefId&&(!r.isConfigurableItem(i[n])&&!r.isConfigurableItem(r.items()[o])&&null!=i[n].commerceItemId&&i[n].commerceItemId==r.items()[o].commerceItemId||r.isConfigurableItem(i[n])&&r.isConfigurableItem(r.items()[o])&&i[n].commerceItemId==r.items()[o].commerceItemId)){(!a||2!=a.type&&3!=a.type||a.product.id!=i[n].productId)&&i[n].quantity!=r.items()[o].quantity()&&(r.items()[o].quantity(i[n].quantity),r.items()[o].updatableQuantity(i[n].quantity)),t=!0;break}if(!t)return!1}return!0},S.prototype.compareItemsAndQuantity=function(e){var t,r=this,i=e;if(i.length!=r.items().length||0==i.length)return!1;if(0==i.length)return!0;var a=r.events.pop();a&&r.events.push(a);for(var o=0;o<r.items().length;o++){t=!1;for(var n=0;n<i.length;n++)if(!r.isConfigurableItem(r.items()[n])&&i[n].productId==r.items()[o].productId&&i[n].catRefId==r.items()[o].catRefId&&(!r.isConfigurableItem(i[n])&&!r.isConfigurableItem(r.items()[o])&&null!=i[n].commerceItemId&&i[n].commerceItemId==r.items()[o].commerceItemId||r.isConfigurableItem(i[n])&&r.isConfigurableItem(r.items()[o])&&i[n].commerceItemId==r.items()[o].commerceItemId)){if((!a||2!=a.type||a.product.id!=i[n].productId)&&i[n].quantity!=r.items()[o].quantity())break;t=!0;break}if(!t)return!1}return!0},S.prototype.compareCoupons=function(e){var t,r=this;if(e.length!=r.coupons().length)return!1;if(0==e.length)return!0;for(var i=0;i<r.coupons().length;i++){t=!1;for(var a=0;a<e.length;a++)e[a].code==r.coupons()[i].code()&&(t=!0);if(!t)return!1}return!0},S.prototype.mergeItems=function(t){var r,i=this;r=t.order&&(i.currentOrderId()||i.mergeCart())?t.order.items:t.commerceItems&&i.mergeCart()?t.commerceItems:t.shoppingCart.items;var a=[];i.combineLineItems=1==(i.shouldCombineLineItems(i.items())&&i.shouldCombineLineItems(r))?l.COMBINE_YES:l.COMBINE_NO;for(var o=0;o<r.length;o++){var n=!1;r[o].catalogRefId&&(r[o].catRefId=r[o].catalogRefId);var s=null;if(s=i.isConfigurableItem(r[o])?i.getConfigurableCartItem(r[o].productId,r[o].catRefId,r[o].commerceItemId):i.combineLineItems==l.COMBINE_YES?i.getCartItem(r[o].productId,r[o].catRefId):i.getCartItem(r[o].productId,r[o].catRefId,r[o].commerceItemId),null!==s){var c=r[o].quantity+s.quantity();s.quantity(c),s.updatableQuantity(c),s.discountInfo(r[o].discountInfo),s.rawTotalPrice(r[o].rawTotalPrice),s.detailedItemPriceInfo(r[o].detailedItemPriceInfo),s.detailedRecurringChargeInfo(r[o].detailedRecurringChargeInfo),n=!0}n||a.push(r[o])}for(var d=i.associateShippingGroupsToItems(t.shippingGroups,!0,null,r),o=0;o<a.length;o++){if(i.isConfigurableItem(a[o])||i.lineAttributes&&e.isObservable(i.lineAttributes)&&i.lineAttributes().length>0){var u=[];for(var p in d){var h=d[p];h.commerceItemId===a[o].commerceItemId&&u.push(h)}a[o].shippingGroupRelationships=u}else{var g=Object.keys(d).reduce(function(e,t){var r=!1;if(d[t].childItems&&d[t].childItems.length>0)for(var n=0;n<d[t].childItems.length;n++)if(d[t].childItems[n].addOnItem){r=!0;break}return d[t].productId==a[o].productId&&d[t].catRefId==a[o].catRefId&&(!r&&i.combineLineItems===l.COMBINE_YES||!r&&i.combineLineItems===l.COMBINE_NO&&d[t].commerceItemId===a[o].commerceItemId||r&&d[t].commerceItemId==a[o].commerceItemId)&&(e.push(d[t]),delete d[t]),e},[]);a[o].shippingGroupRelationships=g}var f=C(a[o]),m=null;i.isConfigurableItem(a[o])&&a[o].childItems&&a[o].childItems.length>0&&(m=[],m=i.getChildItemsAsCartItems(a[o]));var E={productId:a[o].productId,quantity:a[o].quantity,catRefId:a[o].catRefId,selectedOptions:f,currency:i.currency,discountInfo:a[o].discountInfo,rawTotalPrice:a[o].rawTotalPrice,externalPrice:a[o].externalPrice,externalPriceQuantity:a[o].externalPriceQuantity,configuratorId:a[o].configuratorId,childItems:m,commerceItemId:a[o].commerceItemId,externalData:a[o].externalData,actionCode:a[o].actionCode,externalRecurringCharge:a[o].externalRecurringCharge,externalRecurringChargeFrequency:a[o].externalRecurringChargeFrequency,externalRecurringChargeDuration:a[o].externalRecurringChargeDuration,assetKey:a[o].assetKey,rootAssetKey:a[o].rootAssetKey,parentAssetKey:a[o].parentAssetKey,serviceId:a[o].serviceId,customerAccountId:a[o].customerAccountId,billingAccountId:a[o].billingAccountId,serviceAccountId:a[o].serviceAccountId,billingProfileId:a[o].billingProfileId,activationDate:a[o].activationDate,deactivationDate:a[o].deactivationDate,transactionDate:a[o].transactionDate,asset:a[o].asset,addOnItem:a[o].addOnItem,shopperInput:a[o].shopperInput,shippingGroupRelationships:a[o].shippingGroupRelationships,allowVirtualShippingGroup:i.storeConfiguration.allowVirtualShippingGroup};E.isVirtualShippingGroup=i.storeConfiguration.allowVirtualShippingGroup&&i.storeConfiguration.isVirtualShippingGroup.call(E);var y=new I(E);y.itemTotal(a[o].price),a[o].id?y.repositoryId=a[o].id:y.repositoryId=a[o].commerceItemId,y.originalPrice(a[o].unitPrice),y.updatableQuantity(a[o].quantity),y.detailedItemPriceInfo(a[o].detailedItemPriceInfo),y.giftWithPurchaseCommerceItemMarkers=a[o].giftWithPurchaseCommerceItemMarkers,i.updateItemDynamicProperties(y,a[o]),t.priceListGroup&&null!=t.priceListGroup.repositoryId&&y.priceListGroupId(t.priceListGroup.repositoryId),y.detailedRecurringChargeInfo(a[o].detailedRecurringChargeInfo),i.items.push(y)}},S.prototype.validateServerCart=function(){var e=this;e.user().pageToRedirect()&&e.user().pageToRedirect()==e.checkoutLink?e.validateAndRedirectCart(!0):e.validateAndRedirectCart(!1)},S.prototype.clearCartForProfile=function(e){var t=this;t.user()||t.user(e),t.user()&&(t.user().persistedOrder(null),t.isCartTransient()||t.user().loggedoutAtCheckout()||""==t.user().orderId()&&(t.storeConfiguration.isLargeCart()!==!0||t.userActionPending()!==!0)||t.emptyCart(),t.user().orderId(""),t.user().setLocalData("orderId"),t.cartName(""),t.createNewCart(!1),h.clearStoredValue(l.LOCAL_STORAGE_CREATE_NEW_CART))},S.prototype.refreshUserCart=function(e){var r=this;r.user()||r.user(e);var i=!!r.user().clonedOrderId();if(!i){if(h.profileType==l.PROFILE_TYPE_AGENT){var a=r.currentOrderState();if("QUOTED"==a)return}if(!r.isCurrentCallInProgress&&!r.updatedFromRepository&&r.currentOrderState()!=l.PENDING_PAYMENTS&&r.currentOrderState()!=l.PENDING_PAYMENT_TEMPLATE&&r.user()&&r.user().loggedIn()&&r.nonTransientCartCheck()&&!c.isPathEqualTo(r.checkoutLink)&&!r.createNewCart())if(1==r.user().isPunchout()){if(r.user().orderId()&&""!=r.user().orderId()){var n={},d={};d[l.ENDPOINT_KEY]=l.ENDPOINT_GET_ORDER,d[l.IDENTIFIER_KEY]="refreshCartForProfilebyOrderId";var u=r.storeConfiguration.getFilterToUse(d);u&&(n[l.FILTER_KEY]=u),h.request(l.ENDPOINT_GET_ORDER,n,function(e){if(null!=e&&e.orderId){r.user().orderId(e.orderId),r.user().persistedOrder(e),r.user().setLocalData("orderId"),r.cartName(e.cartName);var t=r.removeItems(e);if(r.isPricingRequired(t),r.compareItemsAndQuantity(e.shoppingCart.items)||(r.updateCartData(e,!0,!0,!0),r.isPricingRequired(!0)),r.getProductData(),r.getDynamicPropertiesMetadata(!0),r.getItemDynamicPropertiesMetadata(l.ENDPOINT_COMMERCE_ITEM_TYPE_PARAM),r.updateDynamicProperties(e),1==e.shippingGroups.length&&r.shippingAddress&&""==r.shippingAddress()&&e.shippingGroups[0].shippingAddress){
- var i={translate:function(e,t){return o.t("ns.common:resources."+e,t)}},a=new g("cart-shipping-address","",i,r.contextData.page.shippingCountriesPriceListGroup,r.contextData.page.defaultShippingCountry);a.copyFrom(e.shippingGroups[0].shippingAddress,r.contextData.page.shippingCountriesPriceListGroup),a.resetModified(),a.validateForShippingMethod()&&r.shippingAddress(a)}r.cartUpdated()}},function(e){r.user().orderId(""),r.user().persistedOrder(null),r.user().setLocalData("orderId"),r.loadCart()},r.user().orderId())}}else if(h.profileType==l.PROFILE_TYPE_AGENT&&r.currentOrderState()==l.QUOTED_STATES){var p={};p[l.INCLUDE_RESULT]=l.INCLUDE_RESULT_FULL,h.request(l.ENDPOINT_GET_ORDER,p,function(e){if(e&&(e.orderId=e.orderId?e.orderId:e.id),null!=e&&e.orderId){r.user().orderId(e.orderId),r.user().persistedOrder(e),r.user().setLocalData("orderId"),r.cartName(e.cartName),r.orderCreationDate(e.creationDate);var t=r.removeItems(e);if(r.isPricingRequired(t),r.compareItemsAndQuantity(e.shoppingCart.items)?r.getProductData():(r.updateCartData(e,!0,!0,!0),r.isPricingRequired(!0)),r.getDynamicPropertiesMetadata(!0),r.getItemDynamicPropertiesMetadata(l.ENDPOINT_COMMERCE_ITEM_TYPE_PARAM),r.updateDynamicProperties(e),e.shippingGroups&&1==e.shippingGroups.length&&r.shippingAddress&&""==r.shippingAddress()&&e.shippingGroups[0].shippingAddress){var i={translate:function(e,t){return o.t("ns.common:resources."+e,t)}},a=new g("cart-shipping-address","",i,r.contextData.page.shippingCountriesPriceListGroup,r.contextData.page.defaultShippingCountry);a.copyFrom(e.shippingGroups[0].shippingAddress,r.contextData.page.shippingCountriesPriceListGroup),a.resetModified(),a.validateForShippingMethod()&&(r.shippingAddress(a),r.shippingMethod(e.shippingGroups[0].shippingMethod.value),r.populateShipppingMethods())}r.cartUpdated()}},function(e){r.loadCart()},r.currentOrderId())}else{var f={},d={};d[l.ENDPOINT_KEY]=l.ENDPOINT_GET_PROFILE_ORDER,d[l.IDENTIFIER_KEY]="refreshCart";var u=r.storeConfiguration.getFilterToUse(d);u&&(f[l.FILTER_KEY]=u);var m,p;h.profileType==l.PROFILE_TYPE_AGENT?(m=l.ENDPOINT_ORDERS_SEARCH,r.contextManager=require("agentViewModels/agent-context-manager").getInstance(),p={profileId:r.user().id().length>0?r.user().id():r.contextManager.getShopperProfileId(),status:"incomplete"}):(m="getCurrentProfileOrder",p=f),r.adapter.loadJSON(m,"0",p,function(e){if(e&&(e.orderId=e.orderId?e.orderId:e.id),null!=e&&e.orderId){r.user().orderId(e.orderId),r.user().persistedOrder(e),r.user().setLocalData("orderId"),r.cartName(e.cartName),r.orderCreationDate(e.creationDate);var i=r.removeItems(e);if(r.isPricingRequired(i),r.compareItemsAndQuantity(e.shoppingCart.items)?r.storeConfiguration.largeCartConfig.suppressClientCartValidations||r.getProductData():(r.updateCartData(e,!0,!0,!0),r.isPricingRequired(!0)),r.getDynamicPropertiesMetadata(!0),r.getItemDynamicPropertiesMetadata(l.ENDPOINT_COMMERCE_ITEM_TYPE_PARAM),r.updateDynamicProperties(e),e.shippingGroups&&1==e.shippingGroups.length&&r.shippingAddress&&""==r.shippingAddress()&&e.shippingGroups[0].shippingAddress){var a={translate:function(e,t){return o.t("ns.common:resources."+e,t)}},n=new g("cart-shipping-address","",a,r.contextData.page.shippingCountriesPriceListGroup,r.contextData.page.defaultShippingCountry);n.copyFrom(e.shippingGroups[0].shippingAddress,r.contextData.page.shippingCountriesPriceListGroup),n.resetModified(),n.validateForShippingMethod()&&(r.shippingAddress(n),r.shippingMethod(e.shippingGroups[0].shippingMethod.value),h.profileType==l.PROFILE_TYPE_AGENT&&s.Topic(t.topicNames.USER_SELECTED_SHIPPING_ADDRESS_UPDATED).publishWith())}var c=r.events.length>0?r.events[r.events.length-1]:void 0;c&&Z===c.type?(r.events.pop(),r.markDirty()):r.cartUpdated()}else r.user().orderId(""),r.user().persistedOrder(null),r.user().setLocalData("orderId"),r.cartUpdated()},function(e){r.loadCart()})}}},S.prototype.handleInvalidItems=function(e){var t=this;if(e.errorCode==l.CREATE_ORDER_PRODUCT_NOT_FOUND){t.removeItemsByProduct(e.moreInfo);t.markDirty()}if(e.errorCode==l.CREATE_ORDER_SKU_NOT_FOUND){var r=JSON.parse(e.moreInfo);t.removeItemsByProductCatRef(r.productId,r.catRefId);t.markDirty()}},S.prototype.initCatalog=function(e,r){var i=this;if(!r||!r.onLogin){if(arguments[0].data.global.user&&arguments[0].data.global.user.catalog){var a=arguments[0].data.global.user.catalog.repositoryId;this.catalogId()!=a&&this.catalogId(a)}if(arguments[0].data.global.user&&arguments[0].data.global.user.priceListGroup){var o=arguments[0].data.global.user.priceListGroup.id;this.priceListGroupId(o)}var n=d.getInstance().getItem(l.REDIRECTED_TO_WEB_PAYMENT),u=d.getInstance().getItem(l.SKIP_LOADING_LOCAL_CART),p=!1;"true"==u?(p=!0,s.Topic(t.topicNames.DEFERRED_CART_LOAD).publish()):p=!("true"!=n||!(arguments[1].token&&arguments[1].paymentId||arguments[1].authorizationCode)),d.getInstance().setItem(l.REDIRECTED_TO_WEB_PAYMENT,"false"),c.isPathEqualTo(arguments[0].data.global.links.checkout.route)&&i.checkoutLink||p!==!1||i.deferLoadCart.done(function(){i.loadCart()})}},S.prototype.shouldCombineLineItems=function(e){var t=this;if(e&&1===e.length)return t.combineLineItems===l.COMBINE_YES;for(var r=0;r<e.length;r++)for(var i=r+1;i<e.length;i++)if(!t.isConfigurableItem(e[r])&&!t.isConfigurableItem(e[i])&&e[r].productId==e[i].productId&&e[r].catRefId==e[i].catRefId&&e[r].commerceItemId!=e[i].commerceItemId)return!1;return!0},S.prototype.loadCart=function(){var e=this;if(e.isDirty(!1),d.getInstance().setItem(l.REDIRECTED_TO_WEB_PAYMENT,"false"),!e.updatedFromRepository&&(c.isPathEqualTo(e.checkoutLink)||!(e.user()&&e.user().loggedIn()&&e.nonTransientCartCheck()&&e.user().orderId())||e.user()&&e.user().loggedIn()&&e.storeConfiguration.isLargeCart()===!0&&e.storeConfiguration.isFreshPageLoad===!0)){if(e.storeConfiguration.isLargeCart()===!0&&e.storeConfiguration.isFreshPageLoad===!1)return;var r=e.getCookieData();null!=r&&e.getLocalData(r)}e.cartPriceListGroupId()||d.getInstance().getItem("shoppingCart")&&e.cartPriceListGroupId(JSON.parse(d.getInstance().getItem("shoppingCart")).cartPriceListGroupId),e.combineLineItems=1==e.shouldCombineLineItems(e.items())?l.COMBINE_YES:l.COMBINE_NO,s.Topic(t.topicNames.CART_LOADED).publish(e)},S.prototype.reloadCart=function(){var e=this;e.user()&&e.user().loggedIn()&&e.nonTransientCartCheck()?(e.isDirty(!1),e.refreshUserCart(e.user())):e.loadCart()},S.prototype.getItemPrice=function(e){var t=0;if(null!=e.productData()){if(e.productData().childSKUs){for(var r=(e.productData().childSKUs,e.productData().childSKUs.length),i=0;i<r;i++)if(e.productData().childSKUs[i].repositoryId==e.catRefId){var a=e.productData().childSKUs[i];t=null!=a.salePrice?a.salePrice:null!=e.productData().salePrice?e.productData().salePrice:null!=a.listPrice?a.listPrice:e.productData().listPrice}}else t=null!=e.productData().salePrice?e.productData().salePrice:e.productData().listPrice;return t}},S.prototype.saveCartCookie=function(){if(!window.isAgentApplication){var t=this,r=!1,i=new Object;i.numberOfItems=t.numberOfItems(),i.total=t.total(),i.totalWithoutTax=t.totalWithoutTax(),i.subTotal=t.subTotal(),i.amount=t.amount(),i.tax=t.tax(),i.currencyCode=t.currencyCode(),i.shipping=t.shipping(),i.shippingDiscount=t.shippingDiscount(),i.shippingSurcharge=t.shippingSurcharge(),i.orderDiscount=t.orderDiscount(),i.orderDiscountDescList=t.orderDiscountDescList(),i.coupons=t.coupons(),i.cartPriceListGroupId=u.getInstance().selectedPriceListGroup().id,i.giftWithPurchaseOrderMarkers=t.giftWithPurchaseOrderMarkers,i.recurringChargeAmount=t.recurringChargeAmount(),i.recurringChargeCurrencyCode=t.recurringChargeCurrencyCode(),i.recurringChargeShipping=t.recurringChargeShipping(),i.recurringChargeSubTotal=t.recurringChargeSubTotal(),i.recurringChargeSubTotalByFrequency=t.recurringChargeSubTotalByFrequency(),i.recurringChargeTax=t.recurringChargeTax(),i.recurringChargeTaxByFrequency=t.recurringChargeTaxByFrequency(),i.recurringChargeTotal=t.recurringChargeTotal(),i.userActionPending=t.userActionPending(),i.items=new Array,i.cartName=t.cartName();var a=t.getCookieData();"string"==typeof a&&(a=JSON.parse(a));var o={};if(null!=a)for(var n=0;n<a.items.length;n++)void 0===o[a.items[n].catRefId]&&(o[a.items[n].catRefId]=a.items[n].originalPrice);var s=t.user().persistedOrder();if(s&&s.shoppingCart.items)for(var c=s.shoppingCart,p=c.items.length,n=0;n<p;n++)void 0===o[c.items[n].catRefId]&&(o[c.items[n].catRefId]=c.items[n].unitPrice);if(t.lineAttributes){i.lineAttributes=new Array;for(var n=0;n<t.lineAttributes().length;n++){var h=t.lineAttributes()[n],g=h.id(),f=null;null!=h.value()&&(f=h.value()),i.lineAttributes.push({id:g,value:f})}}for(var n=0;n<t.items().length;n++){var m=0,I=t.getItemPrice(t.items()[n]);void 0==o[t.items()[n].catRefId]?m=I:""!=t.updatedProduct()&&t.updatedProduct()===t.items()[n].catRefId?(m=I,t.updatedProduct("")):m=o[t.items()[n].catRefId],t.cartPriceListGroupId()!=u.getInstance().selectedPriceListGroup().id&&void 0!=I&&(t.items()[n].priceListGroupId(u.getInstance().selectedPriceListGroup().id),m=I,r=!0),t.items()[n].originalPrice(m);var E=void 0;t.isConfigurableItem(t.items()[n])&&(E=[],E=t.getChildItemsCookie(t.items()[n]));for(var y=t.items()[n].shippingGroupRelationships,v=0;v<y().length;v++)y()[v].childItems&&(y()[v].childItems=null);var b={productId:t.items()[n].productId,quantity:t.items()[n].quantity(),catRefId:t.items()[n].catRefId,itemTotal:t.items()[n].itemTotal(),id:t.items()[n].repositoryId,rawTotalPrice:t.items()[n].rawTotalPrice(),originalPrice:m,selectedOptions:t.items()[n].selectedOptions,selectedSkuProperties:t.items()[n].selectedSkuProperties,discountInfo:t.items()[n].discountInfo(),detailedItemPriceInfo:t.items()[n].detailedItemPriceInfo(),externalPrice:t.items()[n].externalPrice(),externalPriceQuantity:t.items()[n].externalPriceQuantity(),configuratorId:t.items()[n].configuratorId,childItems:E,externalData:t.items()[n].externalData(),actionCode:t.items()[n].actionCode(),externalRecurringCharge:t.items()[n].externalRecurringCharge(),externalRecurringChargeFrequency:t.items()[n].externalRecurringChargeFrequency(),externalRecurringChargeDuration:t.items()[n].externalRecurringChargeDuration(),commerceItemId:t.items()[n].commerceItemId,unpricedExternalMessage:t.items()[n].unpricedExternalMessage(),isGWPChoicesAvaliable:t.items()[n].isGWPChoicesAvaliable(),giftData:t.items()[n].giftData?t.items()[n].giftData:null,giftWithPurchaseCommerceItemMarkers:t.items()[n].giftWithPurchaseCommerceItemMarkers,detailedRecurringChargeInfo:t.items()[n].detailedRecurringChargeInfo(),isPersonalized:t.items()[n].isPersonalized(),assetKey:t.items()[n].assetKey(),rootAssetKey:t.items()[n].rootAssetKey(),parentAssetKey:t.items()[n].parentAssetKey(),serviceId:t.items()[n].serviceId(),customerAccountId:t.items()[n].customerAccountId(),billingAccountId:t.items()[n].billingAccountId(),serviceAccountId:t.items()[n].serviceAccountId(),billingProfileId:t.items()[n].billingProfileId(),activationDate:t.items()[n].activationDate(),deactivationDate:t.items()[n].deactivationDate(),transactionDate:t.items()[n].transactionDate(),asset:t.items()[n].asset(),addOnItem:t.items()[n].addOnItem,shopperInput:t.items()[n].shopperInput,shippingGroupRelationships:e.toJSON(y),soldAsPackage:t.items()[n].soldAsPackage(),assetable:t.items()[n].assetable,shippable:t.items()[n].shippable,allowVirtualShippingGroup:t.storeConfiguration.allowVirtualShippingGroup};for(var T in t.lineAttributes())t.items()[n].hasOwnProperty(t.lineAttributes()[T].id())&&(b[t.lineAttributes()[T].id()]=t.items()[n][t.lineAttributes()[T].id()]());i.items.push(b)}if(r&&t.cartPriceListGroupId(u.getInstance().selectedPriceListGroup().id),t.dynamicProperties){t.getDynamicPropertiesMetadata(!0),i.dynamicProperties=new Array;for(var n=0;n<t.dynamicProperties().length;n++){var h=t.dynamicProperties()[n],g=h.id(),f=null;null!=h.value()&&(f=h.value()),i.dynamicProperties.push({id:g,value:f})}}try{t.currentOrderState()!=l.PENDING_PAYMENT&&d.getInstance().setItem("shoppingCart",JSON.stringify(i))}catch(e){}}},S.prototype.getLocalData=function(t){var r=this;if("string"==typeof t&&(t=JSON.parse(t)),t){if(r.numberOfItems(t.numberOfItems),r.total(t.total),r.totalWithoutTax(t.totalWithoutTax),r.subTotal(t.subTotal),r.amount(t.amount),r.tax(t.tax),r.currencyCode(t.currencyCode),r.shipping(t.shipping),r.shippingDiscount(t.shippingDiscount),r.shippingSurcharge(t.shippingSurcharge),r.orderDiscount(t.orderDiscount),r.orderDiscountDescList(t.orderDiscountDescList),r.cartPriceListGroupId(t.cartPriceListGroupId),r.giftWithPurchaseOrderMarkers=t.giftWithPurchaseOrderMarkers,r.cartName(t.cartName),r.coupons.splice(0),t.hasOwnProperty("coupons"))for(var i=0;i<t.coupons.length;i++){var a=new _(t.coupons[i].code,t.coupons[i].description,t.coupons[i].status,t.coupons[i].level,t.coupons[i].id,t.coupons[i].totalAdjustment,t.coupons[i].name,t.coupons[i].longDescription);r.coupons.push(a)}r.populateClaimedCouponMultiPromotions(r.couponMultiPromotions()),r.items.splice(0);for(var i=0;i<t.items.length;i++){var o=void 0;r.isConfigurableItem(t.items[i])&&(o=[],o=r.getChildItemsAsCartItems(t.items[i]));var n={productId:t.items[i].productId,quantity:t.items[i].quantity,catRefId:t.items[i].catRefId,selectedOptions:t.items[i].selectedOptions,currency:r.currency,discountInfo:t.items[i].discountInfo,rawTotalPrice:t.items[i].rawTotalPrice,externalPrice:t.items[i].externalPrice,externalPriceQuantity:t.items[i].externalPriceQuantity,configuratorId:t.items[i].configuratorId,childItems:o,commerceItemId:t.items[i].commerceItemId,unpricedExternalMessage:t.items[i].unpricedExternalMessage,externalData:t.items[i].externalData,actionCode:t.items[i].actionCode,backOrderQuantity:t.items[i].backOrderQuantity,preOrderQuantity:t.items[i].preOrderQuantity,externalRecurringCharge:t.items[i].externalRecurringCharge,externalRecurringChargeFrequency:t.items[i].externalRecurringChargeFrequency,externalRecurringChargeDuration:t.items[i].externalRecurringChargeDuration,assetKey:t.items[i].assetKey,rootAssetKey:t.items[i].rootAssetKey,parentAssetKey:t.items[i].parentAssetKey,serviceId:t.items[i].serviceId,customerAccountId:t.items[i].customerAccountId,billingAccountId:t.items[i].billingAccountId,serviceAccountId:t.items[i].serviceAccountId,billingProfileId:t.items[i].billingProfileId,activationDate:t.items[i].activationDate,deactivationDate:t.items[i].deactivationDate,transactionDate:t.items[i].transactionDate,asset:t.items[i].asset,addOnItem:t.items[i].addOnItem,shopperInput:t.items[i].shopperInput,shippingGroupRelationships:t.items[i].shippingGroupRelationships?JSON.parse(t.items[i].shippingGroupRelationships):void 0,soldAsPackage:t.items[i].soldAsPackage,assetable:t.items[i].assetable,shippable:t.items[i].shippable,allowVirtualShippingGroup:r.storeConfiguration.allowVirtualShippingGroup};n.isVirtualShippingGroup=r.storeConfiguration.allowVirtualShippingGroup&&r.storeConfiguration.isVirtualShippingGroup.call(n);var s=new I(n);s.itemTotal(t.items[i].itemTotal),s.originalPrice(t.items[i].originalPrice),s.productPriceChanged(!1),s.detailedItemPriceInfo(t.items[i].detailedItemPriceInfo),s.priceListGroupId(t.cartPriceListGroupId),s.isGWPChoicesAvaliable(t.items[i].isGWPChoicesAvaliable),s.skuProperties=t.items[i].skuProperties,s.isPersonalized=e.observable(t.items[i].isPersonalized),t.items[i].giftWithPurchaseCommerceItemMarkers&&(s.giftWithPurchaseCommerceItemMarkers=t.items[i].giftWithPurchaseCommerceItemMarkers),t.items[i].giftData&&(s.giftData=t.items[i].giftData);for(var l in t.lineAttributes)s[t.lineAttributes[l].id]=e.observable(t.items[i][t.lineAttributes[l].id]);s.detailedRecurringChargeInfo(t.items[i].detailedRecurringChargeInfo),r.items.push(s)}}if(r.items().length>0){if((r.storeConfiguration.isLargeCart()===!0||r.storeConfiguration.largeCartConfig.suppressClientCartValidations===!0)&&1!=r.storeConfiguration.isFreshPageLoad)return;r.getProductData()}r.getDynamicPropertiesMetadata(!0),t.hasOwnProperty("dynamicProperties")&&r.updateDynamicProperties(t)},S.prototype.processCartDataForLargeCart=function(e,t){var r=this,i=!1,a=!1,o=0,n=0;if(null==t)for(var t=new Object,n=0;n<r.items().length;n++)r.addIndexForTheProducts(r.items()[n],t,n);for(var s=0;s<e.length;s++){var l=[];if(null!=t[e[s].id]){l=t[e[s].id].split(","),o=l.length;for(var c=0;c<o;c++){n=parseInt(l[c]);var d=r.items()[n],p=e[s];if(p.id==d.productId&&0==d.processed)for(var h=N(p),g=0;g<p.childSKUs.length;g++)if(p.childSKUs[g].repositoryId==d.catRefId){d.processed=!0;var f=p.childSKUs[g],m=jQuery.extend(!0,{},p);if(m.childSKUs=[f],d.currentPrice(r.getItemPrice(d)),!m.childSKUs[0].primaryThumbImageURL&&m.childSKUs[0].listingSKUId&&(m.childSKUs[0].primaryThumbImageURL=h[m.childSKUs[0].listingSKUId]),d.productData(m),!R(d.discountInfo())){var I=r.getItemPrice(d);if(f=f||{},f.saleVolumePrice||f.listVolumePrice||m.saleVolumePrice||m.listVolumePrice?d.productPriceChanged(!1):d.originalPrice()!=I&&d.priceListGroupId()==u.getInstance().selectedPriceListGroup().id&&u.getInstance().selectedPriceListGroup().id==r.cartPriceListGroupId()?(r.skipPriceChange()&&d.productPriceChanged()&&d.currentPrice()==I||d.invalid||(i=!0),null!=I&&d.productPriceChanged(!0)):(d.productPriceChanged(!1),d.currentPrice()&&I&&d.currentPrice()!=I&&!d.invalid&&r.isPricingRequired(!0)),p.productVariantOptions)for(var E=0;E<p.productVariantOptions.length;E++)r.updateItemOptionDetails(p.productVariantOptions[E],d.catRefId,n,!0),a=!0;break}}r.isConfigurableItem(d)&&d.childItems&&d.childItems.length>0&&r.updateChildTreeProductDataForLargeCart(d,p)}}}return a&&r.updateLocalStorageWithSelectedOption(),r.skipPriceChange(!1),r.showSelectedOptions(!0),i},S.prototype.processCartData=function(e){for(var t=this,r=!1,i=!1,a=0;a<t.items().length;a++)for(var o=0;o<e.length;o++){var n=e[o];if(n.id==t.items()[a].productId)for(var s=N(n),l=0;l<n.childSKUs.length;l++)if(n.childSKUs[l].repositoryId==t.items()[a].catRefId){var c=n.childSKUs[l],d=jQuery.extend(!0,{},n);if(d.childSKUs=[c],t.items()[a].currentPrice(t.getItemPrice(t.items()[a])),!d.childSKUs[0].primaryThumbImageURL&&d.childSKUs[0].listingSKUId&&(d.childSKUs[0].primaryThumbImageURL=s[d.childSKUs[0].listingSKUId]),t.items()[a].productData(d),t.items()[a].assetable=d.assetable,t.items()[a].shippable=d.shippable,t.items()[a].allowVirtualShippingGroup=t.storeConfiguration.allowVirtualShippingGroup,t.items()[a].soldAsPackage(c.soldAsPackage),t.items()[a].isVirtualShippingGroup=t.storeConfiguration.allowVirtualShippingGroup&&t.storeConfiguration.isVirtualShippingGroup.call(d),!R(t.items()[a].discountInfo())){var p=t.getItemPrice(t.items()[a]);if(c=c||{},c.saleVolumePrice||c.listVolumePrice||d.saleVolumePrice||d.listVolumePrice||window.isAgentApplication?t.items()[a].productPriceChanged(!1):t.items()[a].externalPrice()||t.items()[a].originalPrice()==p||t.items()[o].priceListGroupId()!=u.getInstance().selectedPriceListGroup().id||u.getInstance().selectedPriceListGroup().id!=t.cartPriceListGroupId()?(t.items()[a].productPriceChanged(!1),t.items()[a].currentPrice()&&p&&t.items()[a].currentPrice()!=p&&!t.items()[a].invalid&&t.isPricingRequired(!0)):(t.skipPriceChange()&&t.items()[a].productPriceChanged()&&t.items()[a].currentPrice()==p||t.items()[a].invalid||(r=!0),null!=p&&t.items()[a].productPriceChanged(!0)),n.productVariantOptions)for(var h=0;h<n.productVariantOptions.length;h++)t.updateItemOptionDetails(n.productVariantOptions[h],t.items()[a].catRefId,a,!1),i=!0;break}}t.isConfigurableItem(t.items()[a])&&t.items()[a].childItems&&t.items()[a].childItems.length>0&&t.updateChildTreeProductData(t.items()[a],n)}return i&&t.updateLocalStorageWithSelectedOption(),t.skipPriceChange(!1),t.showSelectedOptions(!0),r},S.prototype.applyAddLimitsValidationPostDataAndStockLoading=function(e){var t=this,r=!1,i=0;if(e)for(var a=0;a<t.items().length;a++){var o=t.items()[a];if(!o.childItems){if(o.shippingGroupRelationships&&o.shippingGroupRelationships()&&o.shippingGroupRelationships().length>0)for(var n=0;n<o.shippingGroupRelationships().length;n++){var s=o.shippingGroupRelationships()[n],l=null;if(s.isPickupInStore&&s.isPickupInStore()?l=e[s.selectedStore().locationId]:s.isPickupInStore&&!s.isPickupInStore()&&(l=t.contextData.global.site.siteInfo&&t.contextData.global.site.siteInfo.inventoryLocationId?e[t.contextData.global.site.siteInfo.inventoryLocationId]:e[null]),l){if(l.length>=1)for(var c=0;c<l.length;c++)if(s.productId===l[c].productId&&s.catRefId===l[c].catRefId){i=l[c].orderableQuantity;break}t.user().clonedOrderId()&&t.validOrderQuantityMap&&t.validOrderQuantityMap[s.productId+":"+s.catRefId]&&(r=!0,i=t.validOrderQuantityMap[s.productId+":"+s.catRefId]),s.addLimitsValidation(o,l,t.isPreOrderBackOrderEnabled,r,i,t.orderedQuantityMap)}}var l={};if(l=t.contextData.global.site.siteInfo&&t.contextData.global.site.siteInfo.inventoryLocationId?e[t.contextData.global.site.siteInfo.inventoryLocationId]:e[null],l&&l.length>0)for(var d=0;d<l.length;d++)if(t.items()[a].productId===l[d].productId&&t.items()[a].catRefId===l[d].catRefId){i=t.user().clonedOrderId()&&t.validOrderQuantityMap&&null!=t.validOrderQuantityMap[l[d].productId+":"+l[d].catRefId]?t.validOrderQuantityMap[l[d].productId+":"+l[d].catRefId]:l[d].orderableQuantity;var u=!1;t.user().clonedOrderId()&&i>0&&(u=!0);var p="IN_STOCK"===l[d].stockStatus||"PREORDERABLE"===l[d].stockStatus||"BACKORDERABLE"===l[d].stockStatus||u;o.addLimitsValidation(p,i,l[d],t.isPreOrderBackOrderEnabled,null,r,t.orderedQuantityMap);break}}}},S.prototype.getProductData=function(){var e=this,r=e.getAllProductIdsForItemsInCart(),i=e.getBatchSizeForProdAndSkuData(r)<0?e.getProductDataForCart:e.getProductDataForLargeCart;s.when(i.bind(e,r)(),e.getAvailabilityOfCart()).done(function(r,i){e.applyAddLimitsValidationPostDataAndStockLoading(i),s.Topic(t.topicNames.CART_READY).publish(e),e.cartValidationPending(!1)})},S.prototype.filterInactiveAddons=function(e){if(e.addOnProducts&&e.addOnProducts.length>0)for(var t=e.addOnProducts.length,r=t-1;r>=0;r--)if(e.addOnProducts[r].addOnOptions&&0!=e.addOnProducts[r].addOnOptions.length&&e.addOnProducts[r].addOnOptions[0].product.active)for(var i=e.addOnProducts[r].addOnOptions.length-1;i>=0;i--)e.addOnProducts[r].addOnOptions[i].sku.active||e.addOnProducts[r].addOnOptions.splice(i,1);else e.addOnProducts.splice(r,1)},S.prototype.processEachBatchBeforeCheckout=function(e,t){var r=this;if(null==t)for(var t=new Object,i=0;i<r.items().length;i++)r.addIndexForTheProducts(r.items()[i],t,i);r.markInvalidItemsForLargeCart(e,r.invalidProductNames,t);var a=!1;return r.items().length>0&&(a=r.processCartDataForLargeCart(e,t)),{productPriceChanged:a}},S.prototype.processEachBatch=function(e,t){var r=this;if(null==t)for(var t=new Object,i=0;i<r.items().length;i++)r.addIndexForTheProducts(r.items()[i],t,i);for(var a=0;a<e.length;a++)r.filterInactiveAddons(e[a]);if(r.mergeCart())for(var o=0;o<e.length;o++)e[o].active||e[o].displayName&&r.invalidProductNames.indexOf(e[o].displayName)==-1&&r.invalidProductNames.push(e[o].displayName);var n=r.removeInvalidItemsForLargeCart(e,r.invalidProductNames,t),s=r.removeUnlinkedAddonItemsForLargeCart(e,r.invalidProductNames,t);n||(n=s);var l=r.processCartDataForLargeCart(e,t);return{productPriceChanged:l,itemsRemovedFromCart:n}},S.prototype.getBatchedProductDataForLargeCart=function(e,t,i){var a=this,o=s.Deferred();if(null==i)for(var i=new Object,n=0;n<a.items().length;n++)a.addIndexForTheProducts(a.items()[n],i,n);return a.adapter.loadJSON("cart",t,e,function(e){var t=a.processEachBatch(e,i);o.resolve({pResult:e,productPriceChanged:t.productPriceChanged,itemsRemovedFromCart:t.itemsRemovedFromCart})},function(n){o.reject(n),n.errors&&n.errors.length>0&&(n.errors[0].errorCode==l.MULTI_CATALOG_INVALID_ID_ERROR_CODE?r.sendError(re,n.errors[0].message,!0):(a.handleListProductsFailure({pResult:n}),a.getBatchedProductDataForLargeCart(e,t,i)))}),o},S.prototype.removeItemsMarkedAsInvalid=function(e){var t=this;if(t.currentOrderState()!=l.PENDING_PAYMENTS&&t.currentOrderState()!=l.PENDING_PAYMENT_TEMPLATE)for(var r=0;r<e.length;r++)0==e[r].processed||1==e[r].invalid?(e.splice(r,1),r--):e[r].childItems&&e[r].childItems.length>0&&t.removeItemsMarkedAsInvalid(e[r].childItems)},S.prototype.addIndexForTheProducts=function(e,t,r){var i=this;if(e.invalid=!1,e.processed=!1,null==t[e.productId]?t[e.productId]=r.toString():t[e.productId]=t[e.productId]+","+r.toString(),i.isConfigurableItem(e))for(var a=0;a<e.childItems.length;a++)i.addIndexForTheProducts(e.childItems[a],t,r)},S.prototype.getProductDataForCart=function(e){var i=this,a=s.Deferred();null==e&&(e=i.getAllProductIdsForItemsInCart());var o=new Array(i.catalogId(),e,!0,i.priceListGroupId(),i.fields,!0),n={},d={};d[l.ENDPOINT_KEY]=l.ENDPOINT_PRODUCTS_LIST_PRODUCTS,d[l.IDENTIFIER_KEY]="getProductData";var p=i.storeConfiguration.getFilterToUse(d);return p&&(n[l.FILTER_KEY]=p),i.adapter.loadJSON("cart",o,n,function(e){for(var r=0;r<e.length;r++)i.filterInactiveAddons(e[r]);if(i.mergeCart())for(var o=0;o<e.length;o++)e[o].active||e[o].displayName&&i.invalidProductNames.indexOf(e[o].displayName)==-1&&i.invalidProductNames.push(e[o].displayName);var n=i.removeInvalidItems(e,i.invalidProductNames),l=i.removeUnlinkedAddonItems(e,i.invalidProductNames);n||(n=l);var d=i.processCartData(e);1==n||d===!0||i.isPricingRequired()?(i.events.push(new w(q,0,e)),c.isPathEqualTo(i.checkoutLink)&&""!=i.shippingMethod()?i.priceCartForCheckout():i.markDirty(),i.isPricingRequired(!1)):i.cartPriceListGroupId()&&i.cartPriceListGroupId()!=u.getInstance().selectedPriceListGroup().id?(i.events.push(new w(q,0,e)),i.markDirty()):s.Topic(t.topicNames.CART_PRICE_COMPLETE).publish(),i.mergeCart()?(i.notifyInvalidProducts("cart"),i.isDirty()||i.markDirty(),i.mergeCart(!1)):i.notifyInvalidProducts(),i.updateAllItemsArray(),a.resolve(e)},function(e){a.reject(e);var t=i.buildErrorInfo(e);t.errors&&t.errors.length>0&&(t.errors[0].errorCode==l.MULTI_CATALOG_INVALID_ID_ERROR_CODE?r.sendError(re,t.errors[0].message,!0):(i.handleListProductsFailure(t),i.getProductData()))}),a},S.prototype.getProductDataForLargeCart=function(e){for(var r=this,i=s.Deferred(),a=new Object,o=0;o<r.items().length;o++)r.addIndexForTheProducts(r.items()[o],a,o);null==e&&(e=r.getAllProductIdsForItemsInCart());var n=!1,d={},p={};p[l.ENDPOINT_KEY]=l.ENDPOINT_PRODUCTS_LIST_PRODUCTS,p[l.IDENTIFIER_KEY]="getProductDataForLargeCart";var h=r.storeConfiguration.getFilterToUse(p);h&&(d[l.FILTER_KEY]=h);var g=new Array,f=r.getBatchSizeForProdAndSkuData(e);f<0&&(f=e.length);for(var m=0;m<e.length;m){for(var I=[],o=0;o<f&&m<e.length;o++,m++)I.push(e[m]);var E=new Array(r.catalogId(),I,!0,r.priceListGroupId(),r.fields,!0);g.push(r.getBatchedProductDataForLargeCart(d,E,a))}return s.when.apply(null,g).done(function(){for(var e=new Array,o=!1,l=0;l<arguments.length;l++){var d=arguments[l].pResult;o=1==arguments[l].productPriceChanged||o,n=1==arguments[l].itemsRemovedFromCart||n;for(var p=0;p<d.length;p++)e.push(d[p])}var h=r.processEachBatch(e,a);o=1==h.productPriceChanged||o,n=1==h.itemsRemovedFromCart||n,r.removeItemsMarkedAsInvalid(r.items()),1==n||o===!0||r.isPricingRequired()?(r.events.push(new w(q,0,e)),(c.isPathEqualTo(r.checkoutLink)||c.isPathEqualTo("occs-agent-new/agentCheckout")||c.isPathEqualTo("occs-agent/agentMultiShipCheckout"))&&(r.isSplitShipping()||""!=r.shippingMethod())?r.priceCartForCheckout():r.markDirty(),r.isPricingRequired(!1)):r.cartPriceListGroupId()&&r.cartPriceListGroupId()!=u.getInstance().selectedPriceListGroup().id?(r.events.push(new w(q,0,e)),r.markDirty()):s.Topic(t.topicNames.CART_PRICE_COMPLETE).publish(),r.mergeCart()?(r.notifyInvalidProducts("cart"),r.isDirty()||r.markDirty(),r.mergeCart(!1)):r.notifyInvalidProducts(),r.updateAllItemsArray(),i.resolve(e)}),i},S.prototype.notifyInvalidProducts=function(e){var t=this,i="";if(t.invalidProductNames.length>0){for(var a="",n=t.invalidProductNames.length-1,s=0;s<n;s++)a+=o.t("ns.common:resources.productNameHasNext",{productName:t.invalidProductNames[s]});a+=t.invalidProductNames[n],i=o.t("ns.common:resources.invalidCartItemsError",{productNames:a})}i&&(e?r.sendWarningToPage(re,i,!0,e,!0):(t.user().redirectNotificationMessage(i),r.sendWarning(re,i,!0))),t.invalidProductNames=[]},S.prototype.removeItemsByProduct=function(e){for(var t=this,r=!1,i=0;i<t.items().length;i++)t.items()[i].productId===e?(t.items.remove(t.items()[i]),i--,r=!0,t.isPricingRequired(!0)):r=t.removeChildItemsByProduct(e);return r},S.prototype.removeChildItemsByProduct=function(e,t){var r=this,i=r.items();t&&(i=t);for(var a=!1,o=0;o<i.length;o++)i[o].productId===e?(i.splice(o,1),o--,a=!0,r.isPricingRequired(!0)):i[o].childItems&&i[o].childItems.length>0&&(a=r.removeChildItemsByProduct(e,i[o].childItems),i[o].childItems&&0==i[o].childItems.length&&delete i[o].childItems);return a},S.prototype.removeItemsByProductCatRef=function(e,t){for(var r=this,i=!1,a=0;a<r.items().length;a++)r.items()[a].productId===e&&r.items()[a].catRefId===t&&(r.items.remove(r.items()[a]),a--,i=!0,r.isPricingRequired(!0));return i},S.prototype.markInvalidItems=function(e,t){for(var r=this,i=0;i<r.items().length;i++)for(var a=r.items()[i],o=!1,n=0;n<e.length;n++)if(e[n].id==a.productId){if(!e[n].active||!e[n].childSKUs||0==e[n].childSKUs.length){a.invalid=!0;break}for(var s=0;e[n].childSKUs&&s<e[n].childSKUs.length;s++)if(e[n].childSKUs[s].repositoryId==a.catRefId&&e[n].childSKUs[s].active){o=!0;break}if(o)break;a.invalid=!0}return!1},S.prototype.markInvalidItemsForLargeCart=function(e,t,r){var i=this,a=!1,o=0,n=[];if(null==r)for(var r=new Object,s=0;s<i.items().length;s++)i.addIndexForTheProducts(i.items()[s],r,s);for(var s=0;s<e.length;s++)if(a=!1,null!=r[e[s].id]){n=r[e[s].id].split(","),o=n.length;for(var l=0;l<o;l++){d=parseInt(n[l]);var c=i.items()[d];if(e[s].id==c.productId){if(c.productId!=e[s].id||1==c.processed)continue;if(!e[s].active||!e[s].childSKUs||0==e[s].childSKUs.length){c.invalid=!0;break}for(var d=0;e[s].childSKUs&&d<e[s].childSKUs.length;d++)if(e[s].childSKUs[d].repositoryId==c.catRefId&&e[s].childSKUs[d].active){a=!0;break}if(a)break;c.invalid=!0}}}return!1},S.prototype.removeUnlinkedAddonItemsForLargeCart=function(e,t,r){var i=this,a=0,o=0,n=[];if(null==r)for(var r=new Object,s=0;s<i.items().length;s++)i.addIndexForTheProducts(i.items()[s],r,s);for(var s=0;s<e.length;s++){var l=[];if(null!=r[e[s].id]){l=r[e[s].id].split(","),a=l.length;for(var c=0;c<a;c++){o=parseInt(l[c]);var d=i.items()[o];if(d.productId==e[s].id&&1!=d.processed){i.items()[o].childItems&&i.items()[o].childItems.length>0&&i.processInvalidAddonItemsForLargeCart(i.items()[o],e[s],e,n);break}}}}if(n.length>0){for(var c=0;c<n.length;c++)t.push(n[c]);return!0}return!1},S.prototype.removeUnlinkedAddonItems=function(e,t){for(var r=this,i=[],a=0;a<r.items().length;a++)for(var o=0;o<e.length;o++)if(r.items()[a].productId==e[o].id){r.items()[a].childItems&&r.items()[a].childItems.length>0&&r.processInvalidAddonItems(r.items()[a],e[o],e,i);break}if(i.length>0){for(var a=0;a<i.length;a++)t.push(i[a]);return!0}return!1},S.prototype.processInvalidAddonItems=function(e,t,r,i){for(var a=this,o=!1,n=[],s=0;e.childItems&&s<e.childItems.length;s++)if(o=!1,e.childItems[s].addOnItem){for(var l=0;l<t.addOnProducts.length;l++){for(var c=0;c<t.addOnProducts[l].addOnOptions.length;c++)if(t.addOnProducts[l].addOnOptions[c].product&&t.addOnProducts[l].addOnOptions[c].product.repositoryId==e.childItems[s].productId&&t.addOnProducts[l].addOnOptions[c].sku&&t.addOnProducts[l].addOnOptions[c].sku.repositoryId==e.childItems[s].catRefId){o=!0;break}if(o)break}if(o){if(e.childItems[s].childItems&&e.childItems[s].childItems.length>0)for(var d=0;d<r.length;d++)if(r[d].id==e.childItems[s].productId){a.processInvalidAddonItems(e.childItems[s],r[d],r,i);break}}else i.push(e.childItems[s].displayName()),n.push(e.childItems[s])}for(var s=0;s<n.length;s++)a.removeChildItemFromCart(n[s],!1)},S.prototype.processInvalidAddonItemsForLargeCart=function(e,t,r,i){
- for(var a=this,o=!1,n=[],s=0;e.childItems&&s<e.childItems.length;s++)if(o=!1,e.childItems[s].addOnItem){for(var l=0;l<t.addOnProducts.length;l++){for(var c=0;c<t.addOnProducts[l].addOnOptions.length;c++)if(t.addOnProducts[l].addOnOptions[c].product&&t.addOnProducts[l].addOnOptions[c].product.repositoryId==e.childItems[s].productId&&t.addOnProducts[l].addOnOptions[c].sku&&t.addOnProducts[l].addOnOptions[c].sku.repositoryId==e.childItems[s].catRefId){o=!0;break}if(o)break}if(o){if(e.childItems[s].childItems&&e.childItems[s].childItems.length>0)for(var d=0;d<r.length;d++)if(r[d].id==e.childItems[s].productId){a.processInvalidAddonItemsForLargeCart(e.childItems[s],r[d],r,i);break}}else i.push(e.childItems[s].displayName()),e.childItems[s].invalid=!0}for(var s=0;s<n.length;s++)a.removeChildItemFromLargeCart(n[s],!1)},S.prototype.removeInvalidItemsForLargeCart=function(e,t,r){var i=this,a=!1,o="",n=!1,l=!1,c=0,d=[];if(null==r)for(var r=new Object,u=0;u<i.items().length;u++)i.addIndexForTheProducts(i.items()[u],r,u);for(var u=0;u<e.length;u++){n=!1;var p=[];if(null!=r[e[u].id]){p=r[e[u].id].split(","),c=p.length;for(var h=0;h<c;h++){f=parseInt(p[h]);var g=i.items()[f];if(!g||g.productId==e[u].id&&1!=g.processed){if(!e[u].active||!e[u].childSKUs||0==e[u].childSKUs.length||e[u].notForIndividualSale){g.invalid=!0,o=e[u].displayName;break}for(var f=0;e[u].childSKUs&&f<e[u].childSKUs.length;f++)if(e[u].childSKUs[f].repositoryId==g.catRefId&&e[u].childSKUs[f].active&&null!=e[u].childSKUs[f].listPrice){n=!0;break}if(n||(g.invalid=!0,o=e[u].displayName),i.isConfigurableItem(g)){var m=[],I=[],E=[];if(i.checkCpqItemValidityForLargeCart(e[u],g,I,m,E),I.length>0&&(g.invalid=!0,t=t.concat(I),s.unique(t)),m.length>0){g.invalid=!0;for(var y=0;y<e.length;y++)if(e[y].id==g.productId){o=e[y].displayName;break}break}E.length>0&&(l=!0,d=E)}}}if(o&&t&&t.indexOf(o)==-1)t.push(o);else if(l)for(var v=0;v<d.length;v++)t&&t.indexOf(d[v].displayName())==-1&&t.push(d[v].displayName())}}return a},S.prototype.removeInvalidItems=function(e,t){for(var r=this,i=!1,a=0;a<r.items().length;a++){for(var o=r.items()[a],n="",c=!1,d=!1,u=!1,p=[],h=0;h<e.length;h++){if(e[h].id==o.productId){if(!e[h].active||!e[h].childSKUs||0==e[h].childSKUs.length||!o.isThisGWPCommerceItemAndValid()&&e[h].notForIndividualSale){d=!0,n=e[h].displayName;break}for(var g=0;e[h].childSKUs&&g<e[h].childSKUs.length;g++)if(e[h].childSKUs[g].repositoryId==o.catRefId&&e[h].childSKUs[g].active&&null!=e[h].childSKUs[g].listPrice){c=!0;break}c||(d=!0,n=e[h].displayName)}if(r.isConfigurableItem(o)){var f=[],m=[],I=[];if(r.checkCpqItemValidity(e[h],o,m,f,I),m.length>0&&(d=!0,t=t.concat(m),s.unique(t)),f.length>0){d=!0;for(var E=0;E<e.length;E++)if(e[E].id==o.productId){n=e[E].displayName;break}break}I.length>0&&(u=!0,p=I)}}if(r.currentOrderState()!=l.PENDING_PAYMENTS&&r.currentOrderState()!=l.PENDING_PAYMENT_TEMPLATE)if(!c||d)r.items.remove(o),t&&n&&t.indexOf(n)==-1&&t.push(n),i=!0,a--;else if(u)for(var y=0;y<p.length;y++)r.removeChildItemFromCart(p[y],!1),t&&t.indexOf(p[y].displayName())==-1&&t.push(p[y].displayName()),i=!0}return i},S.prototype.updateItemOptionDetails=function(e,t,r,i){var a=this;if(null===r||void 0===r){for(var o=0;o<this.items().length;o++)if(this.items()[o].catRefId===t&&this.items()[o].selectedOptions)for(var n=0;n<this.items()[o].selectedOptions.length;n++)if(this.items()[o].selectedOptions[n].optionId===e.optionId){this.items()[o].selectedOptions[n].optionName=e.optionName;var s=e.optionValueMap;for(var l in s)if(s[l]===this.items()[o].selectedOptions[n].optionValueId){this.items()[o].selectedOptions[n].optionValue=l;break}break}}else if(this.items()[r].selectedOptions)for(var n=0;n<this.items()[r].selectedOptions.length;n++){var c=this.items()[r];if(c.selectedOptions[n].optionId===e.optionId){c.selectedOptions[n].optionName=e.optionName;var s=e.optionValueMap;for(var l in s)if(s[l]===c.selectedOptions[n].optionValueId){c.selectedOptions[n].optionValue=l;break}break}}1!=i&&a.updateLocalStorageWithSelectedOption()},S.prototype.updateLocalStorageWithSelectedOption=function(){var e=this.getCookieData();if(e){for(var t=e.items,r=0;r<this.items().length;r++)for(var i=0;i<t.length;i++)if(this.items()[r].catRefId===t[i].catRefId){t[i].selectedOptions=this.items()[r].selectedOptions;break}e.items=t;try{d.getInstance().setItem("shoppingCart",JSON.stringify(e))}catch(e){}}},S.prototype.getCookieData=function(){if(window.isAgentApplication)return null;var e=null;try{e=d.getInstance().getItem("shoppingCart"),e&&"string"==typeof e&&(e=JSON.parse(e))}catch(e){}return e},S.prototype.getCookieUserData=function(){if(window.isAgentApplication)return null;var e=null;try{e=d.getInstance().getItem("user"),e&&"string"==typeof e&&(e=JSON.parse(e))}catch(e){}return e},S.prototype.checkPriceDataAndRedirect=function(){var e=this;if(1==e.storeConfiguration.largeCartConfig.suppressClientCartValidationsInCheckout)return void e.redirect(e.checkoutLink);var t=e.getProductIdsForItemsInCart(),r=e.getBatchSizeForProdAndSkuData(t)<0?e.checkPriceDataBeforeCheckout:e.checkPriceDataBeforeCheckoutForLargeCart;s.when(r.bind(e,t)(),e.validateCartAvailability()).done(function(t,r){t===!0||0==r?(e.redirect(e.cartLink),e.notifyInvalidProducts("cart")):e.checkoutWithPaypalClicked()?e.redirect(l.PAYPAL_CHECKOUT_TYPE):(e.redirect(e.checkoutLink),e.notifyInvalidProducts("checkout"))})},S.prototype.checkPriceDataBeforeCheckout=function(e){var t=this,i=s.Deferred();null==e&&(e=t.getProductIdsForItemsInCart());var a=t.catalogId();t.user().catalogId()&&(a=t.user().catalogId());var o=new Array(a,e,!0,u.getInstance().selectedPriceListGroup().id,t.fields,!0),n={},d={};d[l.ENDPOINT_KEY]=l.ENDPOINT_PRODUCTS_LIST_PRODUCTS,d[l.IDENTIFIER_KEY]="getProductDataAndRedirect";var p=t.storeConfiguration.getFilterToUse(d);return p&&(n[l.FILTER_KEY]=p),t.adapter.loadJSON("cart",o,n,function(e){t.markInvalidItems(e,t.invalidProductNames);var r=!1;t.items().length>0?(r=t.processCartData(e),(r===!0||t.isPricingRequired())&&(c.isPathEqualTo(t.checkoutLink)&&""!=t.shippingMethod()?t.priceCartForCheckout():t.markDirty(),t.isPricingRequired(!1))):(r=null,t.isPricingRequired()&&(t.markDirty(),t.isPricingRequired(!1)),t.notifyInvalidProducts()),i.resolve(r)},function(e){i.reject(e);var a=t.buildErrorInfo(e);a.errors&&a.errors.length>0&&(a.errors[0].errorCode==l.MULTI_CATALOG_INVALID_ID_ERROR_CODE?r.sendError(re,a.errors[0].message,!0):(t.handleListProductsFailure(a),t.checkPriceDataAndRedirect())),t.checkoutWithPaypalClicked(!1)}),i},S.prototype.checkPriceDataBeforeCheckoutForLargeCart=function(e){var t=this,r=s.Deferred();null==e&&(e=t.getProductIdsForItemsInCart());for(var i=[],a=0;a<t.items().length;a++)t.addIndexForTheProducts(t.items()[a],i,a);var o={},n={};n[l.ENDPOINT_KEY]=l.ENDPOINT_PRODUCTS_LIST_PRODUCTS,n[l.IDENTIFIER_KEY]="getProductDataAndRedirectForLargeCart";var d=t.storeConfiguration.getFilterToUse(n);d&&(o[l.FILTER_KEY]=d);var u=t.catalogId();t.user().catalogId()&&(u=t.user().catalogId());var p=new Array,h=t.getBatchSizeForProdAndSkuData(e);h<0&&(h=e.length);for(var g=0;g<e.length;g){for(var f=[],a=0;a<h&&g<e.length;a++,g++)f.push(e[g]);var m=new Array(u,f,!0,t.priceListGroupId(),t.fields,!0);p.push(t.getBatchedProductDataForLargeCartBeforeCheckout(o,m,i))}return s.when.apply(null,p).done(function(){for(var e=new Array,a=!1,o=0;o<arguments.length;o++){var n=arguments[o].pResult;a=1==arguments[o].productPriceChanged||a;for(var s=0;s<n.length;s++)e.push(n[s])}var l=t.processEachBatchBeforeCheckout(e,i);a=1==l.productPriceChanged||a,a===!0||t.isPricingRequired()?(c.isPathEqualTo(t.checkoutLink)&&""!=t.shippingMethod()?t.priceCartForCheckout():t.markDirty(),t.isPricingRequired(!1)):(t.isPricingRequired()&&(t.markDirty(),t.isPricingRequired(!1)),t.notifyInvalidProducts()),r.resolve(a)}),r},S.prototype.getBatchedProductDataForLargeCartBeforeCheckout=function(e,t,i){var a=this,o=s.Deferred();if(null==i)for(var i=new Object,n=0;n<a.items().length;n++)a.addIndexForTheProducts(a.items()[n],i,n);return a.adapter.loadJSON("cart",t,e,function(e){var t=a.processEachBatchBeforeCheckout(e,i);o.resolve({pResult:e,productPriceChanged:t.productPriceChanged})},function(n){o.reject(n),n.errors&&n.errors.length>0&&(n.errors[0].errorCode==l.MULTI_CATALOG_INVALID_ID_ERROR_CODE?r.sendError(re,n.errors[0].message,!0):(a.handleListProductsFailure({pResult:n}),a.getBatchedProductDataForLargeCartBeforeCheckout(e,t,i))),a.checkoutWithPaypalClicked(!1)}),o},S.prototype.getProductIdsForItemsInCart=function(){for(var e=this,t=[],r=0;r<e.items().length;r++)t.indexOf(e.items()[r].productId)===-1&&t.push(e.items()[r].productId);return t},S.prototype.getAllProductIdsForItemsInCart=function(){for(var e=this,t=[],r=0;r<e.items().length;r++)t.indexOf(e.items()[r].productId)===-1&&t.push(e.items()[r].productId),e.isConfigurableItem(e.items()[r])&&e.addProductIdFromConfigurableProduct(t,e.items()[r]);return t},S.prototype.handleListProductsFailure=function(e){for(var t=this,r=0;r<e.errors.length;r++){var i=e.errors[r];i.errorCode==l.GET_PRODUCT_NO_PRODUCT_FOUND&&(i.devMessage&&t.invalidProductNames.indexOf(i.devMessage)==-1&&t.invalidProductNames.push(i.devMessage),t.removeItemsByProduct(i.moreInfo),t.isPricingRequired(!0))}},S.prototype.getCartAvailability=function(){var e=this,t=new D(e),r={},i={};r[l.ENDPOINT_KEY]=l.ENDPOINT_PRODUCTS_AVAILABILITY,r[l.IDENTIFIER_KEY]="stockStatusesForCart";var a=e.storeConfiguration.getFilterToUse(r);a&&!e.storeConfiguration.isLargeCart()&&(i[l.FILTER_KEY]=a),i[l.PRODUCTS_PARAM]=t.products,i[l.CATALOG]=t.catalogId,i[l.LOCATION_IDS_PARAM]=t.locationIds;var o=e.getThreshholdSizeForStockStatusData(t.products)<0?l.ENDPOINT_PRODUCTS_AVAILABILITY:l.ENDPOINT_LIST_STOCK_STATUS_LARGE_CART;h.request(o,i,function(t){for(var r=0;r<e.items().length;r++)if(e.isConfigurableItem(e.items()[r])){e.items()[r].getItemQuantityInCart=e.getUpdatableItemQuantityInCart.bind(e,e.items(),e.items()[r].productId,e.items()[r].catRefId,null);var i=!1;e.user().clonedOrderId()&&(i=!0),e.items()[r].addConfigurableStockValidation(t,e.isPreOrderBackOrderEnabled,i,e.validOrderQuantityMap,e.orderedQuantityMap)}else for(var a=0;a<t.length;a++)if(e.items()[r].productId===t[a].productId&&e.items()[r].catRefId===t[a].catRefId){var o=e.user().clonedOrderId()&&e.validOrderQuantityMap&&null!=e.validOrderQuantityMap[t[a].productId+":"+t[a].catRefId]?e.validOrderQuantityMap[t[a].productId+":"+t[a].catRefId]:t[a].orderableQuantity;"IN_STOCK"===t[a].stockStatus||"PREORDERABLE"===t[a].stockStatus||"BACKORDERABLE"===t[a].stockStatus?(e.items()[r].getItemQuantityInCart=e.getUpdatableItemQuantityInCart.bind(e,e.items(),e.items()[r].productId,e.items()[r].catRefId,null),e.items()[r].addLimitsValidation(!0,o,t[a],e.isPreOrderBackOrderEnabled)):o?e.items()[r].addLimitsValidation(!0,o,t[a],e.isPreOrderBackOrderEnabled):e.items()[r].addLimitsValidation(!1,t[a].orderableQuantity,t[a],e.isPreOrderBackOrderEnabled);break}},function(t){t.orderableQuantity=0;for(var r=0;r<e.items().length;r++)e.items()[r].addLimitsValidation(!1,0,t,e.isPreOrderBackOrderEnabled)})},S.prototype.getAvailabilityOfCart=function(){var e=this,t=s.Deferred();if(e.currentOrderState()!=l.PENDING_PAYMENTS&&e.currentOrderState()!=l.PENDING_PAYMENT_TEMPLATE){var r=new D(e),i={},a={};a[l.ENDPOINT_KEY]=l.ENDPOINT_PRODUCTS_AVAILABILITY,a[l.IDENTIFIER_KEY]="stockStatusesForCart";var o=e.storeConfiguration.getFilterToUse(a);o&&!e.storeConfiguration.isLargeCart()&&(i[l.FILTER_KEY]=o);var n=e.getThreshholdSizeForStockStatusData(r.products)<0?l.ENDPOINT_PRODUCTS_AVAILABILITY:l.ENDPOINT_LIST_STOCK_STATUS_LARGE_CART;i[l.PRODUCTS_PARAM]=r.products,i[l.CATALOG]=r.catalogId,i[l.LOCATION_IDS_PARAM]=r.locationIds,h.request(n,i,function(r){for(var i=r.reduce(function(e,t){if(e[t.locationId]&&null!==e[t.locationId]){var r=e[t.locationId];r.push(t)}else{var r=new Array;r.push(t),e[t.locationId]=r}return e},{}),a=0;a<e.items().length;a++)if(e.items()[a].childItems){var o,n=e.items()[a];if(n.shippingGroupRelationships&&n.shippingGroupRelationships()&&n.shippingGroupRelationships().length>0)for(var s=0;s<n.shippingGroupRelationships().length;s++){var l=n.shippingGroupRelationships()[s],c=[],d=null;if(l.isPickupInStore&&l.isPickupInStore()?(c=i[l.selectedStore().locationId],d=l.selectedStore().locationId):l.isPickupInStore&&!l.isPickupInStore()&&(c=e.contextData.global.site.siteInfo&&e.contextData.global.site.siteInfo.inventoryLocationId?i[e.contextData.global.site.siteInfo.inventoryLocationId]:i[null]),l.getItemQuantityInCart=e.getUpdatableItemQuantityInCart.bind(e,e.items(),e.items()[a].productId,e.items()[a].catRefId,l),o=!!e.user().clonedOrderId(),l.inventoryDetails=[],c&&c.length>0)for(var u=0;u<c.length;u++)if(l.productId===c[u].productId&&l.catRefId===c[u].catRefId){l.inventoryDetails.push(c[u]);break}for(var p=0;p<n.childItems.length;p++){var h=n.childItems[p].productId,g=n.childItems[p].catRefId;if(c)for(u=0;u<c.length;u++)if(h===c[u].productId&&g===c[u].catRefId){l.inventoryDetails.push(c[u]);break}}l.addConfigurableStockValidation(c,e.isPreOrderBackOrderEnabled,o,e.validOrderQuantityMap,e.orderedQuantityMap)}e.items()[a].getItemQuantityInCart=e.getUpdatableItemQuantityInCart.bind(e,e.items(),e.items()[a].productId,e.items()[a].catRefId,null),e.items()[a].addConfigurableStockValidation(r,e.isPreOrderBackOrderEnabled,o,e.validOrderQuantityMap,e.orderedQuantityMap)}else{var n=e.items()[a];if(n.shippingGroupRelationships&&n.shippingGroupRelationships()&&n.shippingGroupRelationships().length>0)for(var s=0;s<n.shippingGroupRelationships().length;s++){var l=n.shippingGroupRelationships()[s],c=null;if(l.isPickupInStore&&l.isPickupInStore()?c=i[l.selectedStore().locationId]:l.isPickupInStore&&!l.isPickupInStore()&&(c=e.contextData.global.site.siteInfo&&e.contextData.global.site.siteInfo.inventoryLocationId?i[e.contextData.global.site.siteInfo.inventoryLocationId]:i[null]),c&&c.length>0)for(var u=0;u<c.length;u++)if(l.productId===c[u].productId&&l.catRefId===c[u].catRefId){"IN_STOCK"!==c[u].stockStatus&&"PREORDERABLE"!==c[u].stockStatus&&"BACKORDERABLE"!==c[u].stockStatus||(l.stockState(c[u].stockStatus),l.getItemQuantityInCart=e.getUpdatableItemQuantityInCart.bind(e,e.items(),e.items()[a].productId,e.items()[a].catRefId,l));break}}for(var f=0;f<r.length;f++)if(e.items()[a].productId===r[f].productId&&e.items()[a].catRefId===r[f].catRefId){"IN_STOCK"!==r[f].stockStatus&&"PREORDERABLE"!==r[f].stockStatus&&"BACKORDERABLE"!==r[f].stockStatus||(e.items()[a].getItemQuantityInCart=e.getUpdatableItemQuantityInCart.bind(e,e.items(),e.items()[a].productId,e.items()[a].catRefId,null));break}}t.resolve(i)},function(r){for(var i=0;i<e.items().length;i++)e.items()[i].addLimitsValidation(!1,0,r,e.isPreOrderBackOrderEnabled);t.reject(r)})}return t},S.prototype.getUpdatableItemQuantityInCart=function(t,r,i,a,o,n){for(var s=this,l=0,c=0;c<t.length;c++)if(n||t[c].productId!==r){if(n){if(t[c].productId===n){if(o&&i&&t[c].catRefId!=i)continue;l+=parseInt(t[c].updatableQuantity(),10)}else if(t[c].childItems&&t[c].childItems.length>0)for(var d=t[c].childItems,u=0;u<d.length;u++)d[u].productId===n&&(l+=s.getUpdatableItemQuantityInCart([d[u]],d[u].productId)*parseInt(t[c].updatableQuantity(),10))}else if(t[c].childItems&&t[c].childItems.length>0)for(var d=t[c].childItems,u=0;u<d.length;u++)d[u].productId===r&&(l+=s.getUpdatableItemQuantityInCart([d[u]],d[u].productId)*parseInt(t[c].updatableQuantity(),10))}else{if(o&&i&&t[c].catRefId!=i)continue;var p=t[c];if(a&&null!==a&&p.shippingGroupRelationships&&p.shippingGroupRelationships()&&p.shippingGroupRelationships().length>0)for(var h=0;h<p.shippingGroupRelationships().length;h++){var g=p.shippingGroupRelationships()[h];g.isPickupInStore&&g.isPickupInStore()&&e.isObservable(a.selectedStore)&&a.selectedStore()&&g.selectedStore()&&a.selectedStore().locationId===g.selectedStore().locationId?l+=parseInt(g.updatableQuantity(),10):g.isPickupInStore()||a&&null!==a&&e.isObservable(a.isPickupInStore)&&a.isPickupInStore()||(l+=parseInt(g.updatableQuantity(),10))}else l+=parseInt(t[c].updatableQuantity(),10)}return l},S.prototype.getItemQuantityInCart=function(t,r,i,a,o,n){for(var s=this,l=0,c=0;c<t.length;c++)if(o||t[c].productId!==r){if(o){if(t[c].productId===o){if(a&&i&&t[c].catRefId!=i)continue;l+=parseInt(t[c].quantity(),10)}else if(t[c].childItems&&t[c].childItems.length>0)for(var d=t[c].childItems,u=0;u<d.length;u++)d[u].productId===o&&(l+=s.getItemQuantityInCart([d[u]],d[u].productId)*parseInt(t[c].quantity(),10))}else if(t[c].childItems&&t[c].childItems.length>0)for(var d=t[c].childItems,u=0;u<d.length;u++)d[u].productId===r&&(l+=s.getItemQuantityInCart([d[u]],d[u].productId)*parseInt(t[c].quantity(),10))}else{if(a&&i&&t[c].catRefId!=i)continue;var p=t[c];if(n&&null!==n&&p.shippingGroupRelationships&&p.shippingGroupRelationships()&&p.shippingGroupRelationships().length>0)for(var h=0;h<p.shippingGroupRelationships().length;h++){var g=p.shippingGroupRelationships()[h];g.isPickupInStore&&g.isPickupInStore()&&n&&e.isObservable(n)&&null!==n()&&n().locationId===g.selectedStore().locationId?l+=parseInt(g.quantity(),10):g.isPickupInStore()||n&&null!==n&&e.isObservable(n)&&null!==n()&&null!==n().locationId||(l+=parseInt(g.quantity(),10))}else l+=parseInt(t[c].quantity(),10)}return l},S.prototype.priceCartIfNeccessary=function(e){var r=this;if(e){var i=!!r.user().clonedOrderId();if(h.profileType==l.PROFILE_TYPE_AGENT&&i)r.callbacks&&r.callbacks.hasOwnProperty(l.PREPRICINGFORAMENDMENT)&&"function"==typeof r.callbacks[l.PREPRICINGFORAMENDMENT]&&r.callbacks[l.PREPRICINGFORAMENDMENT](),r.priceCartForCheckout();else if(r.callbacks&&r.callbacks.hasOwnProperty(l.PREPRICING)&&"function"==typeof r.callbacks[l.PREPRICING]&&r.callbacks[l.PREPRICING](),r.items().length>0)r.user()&&r.user().loggedIn()&&r.nonTransientCartCheck()&&(!r.hasShippingInformation()||!c.isPathEqualTo(r.checkoutLink)&&!c.isPathEqualTo(r.agentCheckout))?r.priceItemsAndPersist():r.callPriceBeforeShippingMethods||!r.shippingMethod()&&!r.hasShippingInformation()?r.priceItems():r.usingImprovedShippingWidgets()?r.priceCartForCheckout():r.populateShipppingMethods();else{r.emptyCart(),r.events.pop();var a=r.getCookieUserData();a&&r.user().orderId(a.orderId),h.profileType==l.PROFILE_TYPE_AGENT&&r.user().clonedOrderId()?s.Topic(t.topicNames.CART_PRICE_COMPLETE).publish():0==r.items().length&&r.user().loggedIn()&&r.nonTransientCartCheck()&&r.user().orderId()&&""!=r.user().orderId()&&r.removeCurrentProfileOrder()}}},S.prototype.populateShippingMethodsDeferred=function(){var e=this;0==e.shippingMethodsLoadedAndPriced()&&e.populateShipppingMethods()},S.prototype.populateShipppingMethods=function(){var e=this;if(e.shippingMethodsLoadedAndPriced(!0),e.hasSplitShippingInformation()||e.shippingAddress().afterValidation&&e.shippingMethod())e.priceCartForCheckout();else{var r={};r[l.SHIPPING_ADDRESS_FOR_METHODS]=e.shippingAddress()?{toJSON:function(){return e.shippingAddress()}}:e.shippingAddress(),r[l.PRODUCT_IDS_FOR_SHIPPING]=this.getProductIdsForItemsInCart(),s.Topic(t.topicNames.RELOAD_SHIPPING_METHODS).publishWith(r,[{message:"success"}])}},S.prototype.priceItemsAndPersist=function(){var e=this,t=!1,r=e.getCookieUserData();r&&e.user().orderId(r.orderId),e.user().loggedIn()&&e.user().orderId()&&""!=e.user().orderId()?e.updateCurrentProfileOrder(!1,t):e.createCurrentProfileOrder()},S.prototype.createCartPricingModel=function(){var e=this,t=new L(e);return t},S.prototype.updateCurrentProfileOrder=function(e,i){var a=this,n=a.events.pop();if(1==this.storeConfiguration.isLargeCart()&&n&&n.type==ee){var d=n;n=a.events.pop(),a.events.push(d)}if(a.isOrderSubmissionInProgress)console.warn(o.t("ns.common:resources.priceOrderBlockedText")),a.handleBlockedPricing();else{var u=new L(a);a.populateGiftCards(u,n),a.populateIINs(u,n),a.populateDynamicProperties(u),u.merge=e,u.clearCoupons=i,u.op=l.UPDATE_OP;var p=l.ENDPOINT_UPDATE_PROFILE_ORDER,g=!1;h.profileType!=l.PROFILE_TYPE_AGENT&&(!c.isPathEqualTo(a.checkoutLink)||c.isPathEqualTo(a.checkoutLink)&&a.hasShippingInformation())&&(u.shippingGroups=a.createShippingGroups(!0),g=!0),this.currentOrderState()!=l.PENDING_PAYMENTS&&a.currentOrderState()!=l.PENDING_PAYMENT_TEMPLATE&&(h.profileType==l.PROFILE_TYPE_AGENT&&((!c.isPathEqualTo(a.agentMultiShipCheckout)||c.isPathEqualTo(a.agentMultiShipCheckout)&&a.hasShippingInformation())&&(u.shippingGroups=a.createShippingGroups(!0),g=!0),p=l.ENDPOINT_ORDERS_CREATE_ORDER,u.op="priceOrder",u.orderId=a.user().orderId()),a.isCurrentCallInProgress=!0,h.request(p,u,function(r){if(a.hardPricing=!1,a.userActionPending(!1),a.isCurrentCallInProgress=!1,a.isPricingRequired(!1),a.updateCart(r,n,e),a.shippingMethod()&&(a.skipGWPMessage=!0,a.usingImprovedShippingWidgets()?a.priceCartForCheckout():a.populateShipppingMethods()),s.Topic(t.topicNames.COUPON_ADD_CLEAR_INPUT).publish(),a.callbacks&&a.callbacks.hasOwnProperty(l.PRICING_SUCCESS_CB)&&"function"==typeof a.callbacks[l.PRICING_SUCCESS_CB]&&a.callbacks[l.PRICING_SUCCESS_CB](r),s.Topic(t.topicNames.DESTROY_SHIPPING_OPTIONS_SPINNER).publishWith(r),a.events.length>0){var i=a.events.pop();16==i.type?s.Topic(t.topicNames.CART_LOADED_FOR_PROFILE).publish():a.events.push(i)}},function(e){if(a.isCurrentCallInProgress=!1,e.status==l.HTTP_UNAUTHORIZED_ERROR)a.handleSessionExpiry(n);else if(e.errorCode==l.COUPON_APPLY_ERROR)a.handleCouponPricingError(e,n);else if(e.errorCode==l.CREATE_ORDER_PRODUCT_NOT_FOUND||e.errorCode==l.CREATE_ORDER_SKU_NOT_FOUND||e.errorCode==l.PRODUCT_NOT_FOR_INDIVIDUAL_SALE)a.isDirty(!1),a.handleInvalidAddItem(e,n),a.notifyInvalidProducts(),a.handleInvalidItems(e),a.tax(0),a.secondaryCurrencyTaxAmount(0);else if(e.errorCode==l.GIFTCARD_APPLY_ERROR||e.errorCode==l.GIFTCARD_INSUFFICIENT_ERROR||e.errorCode==l.INVALID_GIFTCARD_DATA_ERROR||e.errorCode==l.GIFTCARD_ORDER_PROCESSING_ERROR)a.handleGiftCardError(e,n);else if(e.errorCode==l.UNLINKED_ADD_ON_PRODUCT)a.reloadCart();else if(e.errorCode==l.ADDON_VOLUME_PRICE_ERROR){var i=e.message+" "+o.t("ns.common:resources.removeItemFromCart");r.sendError(re,i,!0),a.isDirty(!1)}else if(e.errorCode==l.INVALID_SHOPPER_INPUT){var c=JSON.parse(e.moreInfo),d=c.productId,u=a.findCartProductById(d);u&&(d=u.displayName);var i=o.t("ns.common:resources.invalidShopperInputError",{productName:d});r.sendError(re,i,!0),a.isDirty(!1)}else if(a.isSplitShipping()&&e.errorCode==l.INVALID_SHIPPING_ADDRESS)a.tax(0),a.secondaryCurrencyTaxAmount(0);else{a.shippingMethod(""),a.reloadCart(),a.tax(0),a.secondaryCurrencyTaxAmount(0);var i=e.message;h.profileType==l.PROFILE_TYPE_AGENT?(e.errors&&e.errors.length>0?r.sendError(re,e.errors[0].message,!0):r.sendError(re,i,!0),s.Topic(t.topicNames.DESTROY_SHOPPING_CART_SPINNER).publish()):r.sendError(re,i,!0)}if(s.Topic(t.topicNames.DESTROY_SHIPPING_OPTIONS_SPINNER).publishWith(e),a.callbacks&&a.callbacks.hasOwnProperty(l.PRICING_FAILURE_CB)&&"function"==typeof a.callbacks[l.PRICING_FAILURE_CB]&&a.callbacks[l.PRICING_FAILURE_CB](e),a.events.length>0){var p=a.events.pop();16==p.type?s.Topic(t.topicNames.CART_LOADED_FOR_PROFILE).publish():a.events.push(p)}},void 0,void 0,void 0,void 0,void 0,{includeShippingGroups:g}))}},S.prototype.handleInvalidAddItem=function(e,t){var r=this;if(e.errorCode==l.CREATE_ORDER_PRODUCT_NOT_FOUND&&t&&t.type===k&&t.product.id==e.moreInfo&&t.product.displayName&&r.invalidProductNames.indexOf(t.product.displayName)==-1)r.invalidProductNames.push(t.product.displayName);else if(e.errorCode==l.CREATE_ORDER_PRODUCT_NOT_FOUND&&t&&t.type===x&&t.product.displayName&&r.invalidProductNames.indexOf(t.product.displayName)==-1)r.invalidProductNames.push(e.moreInfo);else if(e.errorCode==l.CREATE_ORDER_PRODUCT_NOT_FOUND&&t&&t.type===k&&t.product.selectedAddOnProducts&&t.product.selectedAddOnProducts.length>0)r.handleInvalidAddonItem(t.product.selectedAddOnProducts,e.moreInfo);else if(e.errorCode==l.CREATE_ORDER_SKU_NOT_FOUND){var i=JSON.parse(e.moreInfo);t&&t.type===k&&t.product.id==i.productId&&t.product.childSKUs[0].repositoryId==i.catRefId&&t.product.displayName&&r.invalidProductNames.indexOf(t.product.displayName)==-1?r.invalidProductNames.push(t.product.displayName):t&&t.type===k&&t.product.selectedAddOnProducts&&t.product.selectedAddOnProducts.length>0&&r.handleInvalidAddonItem(t.product.selectedAddOnProducts,i.productId,i.catRefId)}else e.errorCode==l.PRODUCT_NOT_FOR_INDIVIDUAL_SALE&&t&&t.type===k&&t.product.displayName&&r.invalidProductNames.indexOf(t.product.displayName)==-1&&r.invalidProductNames.push(t.product.displayName)},S.prototype.handleInvalidAddonItem=function(e,t,r){var i=this;if(e&&e.length>0)for(var a=0;a<e.length;a++)for(var o=0;o<e[a].addOnOptions.length;o++)r&&e[a].addOnOptions[o].sku.repositoryId==r&&e[a].addOnOptions[o].product.id==t&&i.invalidProductNames.indexOf(e[a].addOnOptions[o].product.displayName)==-1?i.invalidProductNames.push(e[a].addOnOptions[o].product.displayName):e[a].addOnOptions[o].product.id==t&&i.invalidProductNames.indexOf(e[a].addOnOptions[o].product.displayName)==-1&&i.invalidProductNames.push(e[a].addOnOptions[o].product.displayName),e[a].addOnOptions[o].product.selectedAddOnProducts&&e[a].addOnOptions[o].product.selectedAddOnProducts.length>0&&i.handleInvalidAddonItem(e[a].addOnOptions[o].product.selectedAddOnProducts,t,r)},S.prototype.findCartProductById=function(e,t){var r=this,i=r.items();t&&(i=t);for(var a=0;a<i.length;a++){if(i[a].productId==e)return i[a].productData();if(i[a].childItems&&i[a].childItems.length>0){var o=r.findCartProductById(e,i[a].childItems);if(o)return o}}},S.prototype.createCurrentProfileOrder=function(){var e=this;({incomplete:!0,allowMultipleCart:e.user().isPunchout()||e.createNewCart()});if(e.items()&&e.items().length>0&&!e.isOrderSubmissionInProgress){var i=e.events.pop();if(1==this.storeConfiguration.isLargeCart()&&i&&i.type==ee){var a=i;i=e.events.pop(),e.events.push(a)}var n=new L(e);e.populateGiftCards(n,i),e.populateIINs(n,i),n.shippingGroups=e.createShippingGroups(!0),delete n.id,e.user().isPunchout()||e.createNewCart()?n.op=l.CREATE_NEW_OP:n.op=l.CREATE_OP,h.profileType==l.PROFILE_TYPE_AGENT&&(n.op=l.CREATE_OP,n.profileId=e.user().id?e.user().id():e.user().customerId()),e.isCurrentCallInProgress=!0,h.request(l.ENDPOINT_UPDATE_PROFILE_ORDER,n,function(r){e.isCurrentCallInProgress=!1,r.orderId&&e.user().orderId(r.orderId),e.hardPricing=!1,e.userActionPending(!1),e.isPricingRequired(!1),e.shippingMethod()?(e.updateCart(r,i,!1),e.skipGWPMessage=!0,e.populateShipppingMethods()):e.updateCart(r,i,!1,!0),s.Topic(t.topicNames.COUPON_ADD_CLEAR_INPUT).publish(),e.callbacks&&e.callbacks.hasOwnProperty(l.PRICING_SUCCESS_CB)&&"function"==typeof e.callbacks[l.PRICING_SUCCESS_CB]&&e.callbacks[l.PRICING_SUCCESS_CB](r),e.createNewCart(!1),h.clearStoredValue(l.LOCAL_STORAGE_CREATE_NEW_CART),e.callbacks&&e.callbacks.hasOwnProperty(l.FIRST_ITEM_ADDED_CB)&&"function"==typeof e.callbacks[l.FIRST_ITEM_ADDED_CB]&&e.callbacks[l.FIRST_ITEM_ADDED_CB](e.user().orderId())},function(t){if(t.status==l.HTTP_UNAUTHORIZED_ERROR)e.handleSessionExpiry(i);else{if(t.errorCode==l.COUPON_APPLY_ERROR)e.handleCouponPricingError(t,i);else if(t.errorCode==l.GIFTCARD_APPLY_ERROR||t.errorCode==l.GIFTCARD_INSUFFICIENT_ERROR||t.errorCode==l.INVALID_GIFTCARD_DATA_ERROR||t.errorCode==l.GIFTCARD_ORDER_PROCESSING_ERROR)e.handleGiftCardError(t,i);else if(t.errorCode==l.CREATE_ORDER_PRODUCT_NOT_FOUND||t.errorCode==l.CREATE_ORDER_SKU_NOT_FOUND||t.errorCode==l.PRODUCT_NOT_FOR_INDIVIDUAL_SALE)e.handleInvalidAddItem(t,i),e.notifyInvalidProducts();else if(t.errorCode==l.UNLINKED_ADD_ON_PRODUCT){if(i&&i.type==k&&i.product.selectedAddOnProducts){var a=JSON.parse(t.moreInfo);e.handleInvalidAddonItem(i.product.selectedAddOnProducts,a.productId,a.catRefId),e.notifyInvalidProducts()}}else if(t.errorCode==l.ADDON_VOLUME_PRICE_ERROR){var n=t.message+" "+o.t("ns.common:resources.removeItemFromCart");r.sendError(re,n,!0),e.isDirty(!1)}else if(t.errorCode==l.INVALID_SHOPPER_INPUT){var a=JSON.parse(t.moreInfo),s=a.productId,c=e.findCartProductById(s);c&&(s=c.displayName);var n=o.t("ns.common:resources.invalidShopperInputError",{productName:s});r.sendError(re,n,!0),e.isDirty(!1)}else{var n=t.message;r.sendError(re,n,!0),e.isDirty(!1)}e.loadCart()}e.callbacks&&e.callbacks.hasOwnProperty(l.PRICING_FAILURE_CB)&&"function"==typeof e.callbacks[l.PRICING_FAILURE_CB]&&e.callbacks[l.PRICING_FAILURE_CB](t)},void 0,void 0,void 0,void 0,void 0,{includeShippingGroups:!0})}else e.isOrderSubmissionInProgress&&(console.warn(o.t("ns.common:resources.priceOrderBlockedText")),e.handleBlockedPricing())},S.prototype.removeCurrentProfileOrder=function(){var e=this;if(1==e.user().isPunchout()){var r={},i={};i[l.ENDPOINT_KEY]=l.ENDPOINT_REMOVE_PROFILE_INCOMPLETE_ORDER_BY_ID,i[l.IDENTIFIER_KEY]="removeProfileIncompleteOrderById";var a=e.storeConfiguration.getFilterToUse(i);a&&(r[l.FILTER_KEY]=a),h.request(l.ENDPOINT_REMOVE_PROFILE_INCOMPLETE_ORDER_BY_ID,r,function(t){e.user().orderId(""),e.user().persistedOrder(null),e.user().setLocalData("orderId"),e.cartName(""),e.hardPricing=!1,e.storeConfiguration.isLargeCart()===!0&&e.callbacks&&e.callbacks.hasOwnProperty(l.PRICING_SUCCESS_CB)&&"function"==typeof e.callbacks[l.PRICING_SUCCESS_CB]&&e.callbacks[l.PRICING_SUCCESS_CB](t)},function(t){e.loadCart(),e.storeConfiguration.isLargeCart()===!0&&e.callbacks&&e.callbacks.hasOwnProperty(l.PRICING_FAILURE_CB)&&"function"==typeof e.callbacks[l.PRICING_FAILURE_CB]&&e.callbacks[l.PRICING_FAILURE_CB](t)},e.user().orderId())}else{var r={};r.profileId=e.user().id?e.user().id():e.user().customerId(),h.request(l.ENDPOINT_REMOVE_PROFILE_INCOMPLETE_ORDER,r,function(r){e.hardPricing=!1,e.userActionPending(!1),e.user().orderId(""),e.user().persistedOrder(null),e.user().setLocalData("orderId"),e.cartName(""),s.Topic(t.topicNames.CART_PRICE_COMPLETE).publish(),e.storeConfiguration.isLargeCart()===!0&&e.callbacks&&e.callbacks.hasOwnProperty(l.PRICING_SUCCESS_CB)&&"function"==typeof e.callbacks[l.PRICING_SUCCESS_CB]&&e.callbacks[l.PRICING_SUCCESS_CB](r)},function(t){e.loadCart(),e.storeConfiguration.isLargeCart()===!0&&e.callbacks&&e.callbacks.hasOwnProperty(l.PRICING_FAILURE_CB)&&"function"==typeof e.callbacks[l.PRICING_FAILURE_CB]&&e.callbacks[l.PRICING_FAILURE_CB](t)})}},S.prototype.addCoupon=function(e){var t=this;if(e){var r=t.getCookieDataAndCompare(),i=new _(e,"","","","");t.events.push(new w(F,1,i)),r&&!t.isMatchingCookieData()?t.getLocalData(r):t.addCouponToCart(i)}},S.prototype.addMultipleCoupons=function(e){var t,r=this,i=e.length;if(i>0){for(var a=r.getCookieDataAndCompare(),o=0;o<i;o++){t=e[o];var n=new _(t,"","","","");e[o]=n}r.events.push(new w(Q,1,e)),a&&!r.isMatchingCookieData()?r.getLocalData(a):r.addMultipleCouponsToCart(e)}},S.prototype.addMultipleCoupons=function(e){var t,r=this,i=e.length;if(i>0){for(var a=r.getCookieDataAndCompare(),o=0;o<i;o++){t=e[o];var n=new _(t,"","","","");e[o]=n}r.events.push(new w(Q,1,e)),a&&!r.isMatchingCookieData()?r.getLocalData(a):r.addMultipleCouponsToCart(e)}},S.prototype.addGiftCard=function(e){var t=this;e.giftCardNumber&&e.giftCardPin&&(t.giftCards.push(e),t.currentOrderState()==l.PENDING_PAYMENTS||t.currentOrderState()==l.PENDING_PAYMENT_TEMPLATE?t.pendingPaymentGiftCardCheck(e):(t.events.push(new w(V,0,e)),t.markDirty()))},S.prototype.addMultipleGiftCards=function(e){var t,r=this,i=e.length;if(i>0){for(var a=0;a<i;a++)t=e[a],t.giftCardNumber&&t.giftCardPin&&r.giftCards.push(t);r.currentOrderState()==l.PENDING_PAYMENTS||r.currentOrderState()==l.PENDING_PAYMENT_TEMPLATE?r.pendingPaymentGiftCardCheck(e):(r.events.push(new w(K,0,e)),r.markDirty())}},S.prototype.pendingPaymentGiftCardCheck=function(e){for(var t=this,r="inquireBalance",i=[],a={},o=0;o<t.giftCards().length;o++){var n=t.giftCards()[o],a={};a.paymentMethodType=l.GIFT_CARD_PAYMENT_TYPE,a.giftCardNumber=n.giftCardNumber(),a.giftCardPin=n.giftCardPin(),null!=a.giftCardPin&&void 0!=a.giftCardPin&&""!=a.giftCardPin&&i.push(a)}var s={};s.orderId=t.currentOrderId(),s.op=r;var c=t.user().id?t.user().id():t.user().customerId();
- h.profileType!=l.PROFILE_TYPE_AGENT?s.profileId=c:c&&(s.profileId=c),s.payments=i;var d="addPayments";h.request(d,s,function(e){t.updateGiftCardDetailsForPendingPayment(e)},function(r){t.handleGiftCardErrorPendingPayment(r,e)})},S.prototype.updateGiftCardDetailsForPendingPayment=function(e){var r=this;if(e.paymentResponses&&r.giftCards().length>0)for(var i=0;i<r.giftCards().length;i++){for(var a=!1,o=r.giftCards()[i],n=0;n<e.paymentResponses.length;n++){var l=e.paymentResponses[n];if(o.giftCardNumber()==l.giftCardNumber){o.amountInGiftCard(l.balance);var c=r.isChargeTaxShippingInSecondaryCurrency()&&e.amountsRemaining?e.amountsRemaining.secondaryCurrencyRemainingAmount:e.amountRemaining;c>=parseFloat(l.balance)?(o.amountUsed(parseFloat(l.balance)),o.isAmountRemaining(!1),c=parseFloat(c)-parseFloat(l.balance)):(o.amountUsed(parseFloat(c)),o.isAmountRemaining(!0),c=0),o.maskedGiftCardNumber(l.maskedCardNumber),o.isApplyGiftCardClicked(!1),a=!0;break}}0==a?o.isPinCleared(!0):o.isPinCleared(!1)}s.Topic(t.topicNames.GIFTCARD_UPDATE_FROM_CART).publish(r.giftCards()),s.Topic(t.topicNames.UPDATE_AMOUNT_REMAINING).publish(c),s.Topic(t.topicNames.CART_UPDATED_PENDING_PAYMENT).publish(r)},S.prototype.pendingPaymentRemoveGiftCard=function(e){var r=this;s.Topic(t.topicNames.GIFTCARD_UPDATE_FROM_CART).publish(r.giftCards()),s.Topic(t.topicNames.UPDATE_AMOUNT_REMAINING_PENDING_PAYMENT).publish(e.amountUsed()),s.Topic(t.topicNames.CART_UPDATED_PENDING_PAYMENT).publish(r)},S.prototype.handleGiftCardErrorPendingPayment=function(e,r){var i=this;i.giftCards.remove(function(e){return e.giftCardNumber()==r.giftCardNumber()}),s.Topic(t.topicNames.GIFTCARD_UPDATE_FROM_CART).publish(i.giftCards()),s.Topic(t.topicNames.GIFTCARD_PRICING_FAILED).publish(e,r),i.isDirty(!1)},S.prototype.clearPins=function(){for(var e=this,r=0;r<e.giftCards().length;r++){var i=e.giftCards()[r];i.giftCardPin(""),i.isPinCleared(!0),i.isApplyGiftCardClicked(!1)}s.Topic(t.topicNames.GIFTCARD_UPDATE_FROM_CART).publish(e.giftCards())},S.prototype.reApplyGiftCardPins=function(e){var t=this;t.currentOrderState()==l.PENDING_PAYMENTS||t.currentOrderState()==l.PENDING_PAYMENT_TEMPLATE?t.pendingPaymentGiftCardCheck(e):(t.events.push(new w(B,0,e)),t.markDirty())},S.prototype.removeGiftCard=function(e){var t=this;t.giftCards.remove(function(t){return t.giftCardNumber()==e.giftCardNumber()}),t.currentOrderState()==l.PENDING_PAYMENTS||t.currentOrderState()==l.PENDING_PAYMENT_TEMPLATE?t.pendingPaymentRemoveGiftCard(e):(t.events.push(new w(Y,0,e)),t.markDirty())},S.prototype.addCouponToCart=function(e){var t=this;t.coupons.push(e),t.couponMultiPromotions.push(new A(e.code())),t.markDirty()},S.prototype.addMultipleCouponsToCart=function(e){for(var t,r=this,i=e.length,a=0;a<i;a++)t=e[a],r.coupons.push(t),r.couponMultiPromotions.push(new A(t.code()));r.markDirty()},S.prototype.addMultipleCouponsToCart=function(e){for(var t,r=this,i=e.length,a=0;a<i;a++)t=e[a],r.coupons.push(t),r.couponMultiPromotions.push(new A(t.code()));r.markDirty()},S.prototype.removeCoupon=function(e){var t=this;if(e.code){var r=t.getCookieDataAndCompare();t.events.push(new w(H,0,e)),r&&!t.isMatchingCookieData()?t.getLocalData(r):t.removeCouponFromCart(e)}},S.prototype.removeCouponFromCart=function(e){var t=this;t.coupons.remove(function(t){return t.code()==e.code()}),t.couponMultiPromotions.remove(function(t){return t.code()==e.code()}),t.markDirty()},S.prototype.removeMultipleCoupons=function(e){var t=this;if(e.length>0){var r=e.filter(function(e){return null!=e.code}),i=t.getCookieDataAndCompare();t.events.push(new w(J,0,r)),i&&!t.isMatchingCookieData()?t.getLocalData(i):t.removeMultipleCouponFromCart(r)}},S.prototype.removeMultipleCouponFromCart=function(e){for(var t,r=this,i=e.length,a=0;a<i;a++)t=e[a],r.coupons.remove(function(e){return e.code()==t.code()}),r.couponMultiPromotions.remove(function(e){return e.code()==t.code()});r.markDirty()},S.prototype.handleSessionExpiry=function(e){var t=this;if(e&&e.type===k){var i=e.product,a=t.addToCart.bind(i);a()}else e&&(e.type===x||e.type===G||e.type===F||e.type===Q||e.type===H||e.type===J)&&c.isPathEqualTo(t.cartLink)?(r.sendError(re,o.t("ns.common:resources.cartSessionExpired"),!0),t.user().clearUserData()):e&&(e.type===F||e.type===Q||e.type===H||e.type===J)&&c.isPathEqualTo(t.checkoutLink)&&(t.isDirty(!1),t.markDirty())},S.prototype.handleCouponPricingError=function(e,t){var i=this;e.message&&t&&(t.type===F||t.type===Q)&&i.coupons()[i.coupons().length-1].code()==e.moreInfo?i.couponErrorMessage(e.message):!e.message||t&&t.type==F&&t.type==Q||r.sendError(re,o.t("ns.common:resources.orderPricingPromotionError"),!0),e.moreInfo&&(i.isDirty(!1),i.coupons.remove(function(t){return t.code()==e.moreInfo}),i.couponMultiPromotions.remove(function(t){return t.code()==e.moreInfo}),i.markDirty())},S.prototype.handleCurrencyPricingError=function(){var t=this;t.cartPriceListGroupId(u.getInstance().selectedPriceListGroup().id),h.setStoredValue(l.LOCAL_STORAGE_PRICELISTGROUP_ID,e.toJSON(u.getInstance().selectedPriceListGroup().id)),t.isDirty(!1),t.markDirty()},S.prototype.priceItems=function(){var e=this,i=e.events.pop();if(1==this.storeConfiguration.isLargeCart()&&i&&i.type==ee){var a=i;i=e.events.pop(),e.events.push(a)}var n=new L(e);delete n.id,e.populateGiftCards(n,i),e.populateIINs(n,i);var d=!1;h.profileType!=l.PROFILE_TYPE_AGENT&&(!c.isPathEqualTo(e.checkoutLink)||c.isPathEqualTo(e.checkoutLink)&&e.hasShippingInformation())&&(n.shippingGroups=e.createShippingGroups(!0),d=!0);var u=l.ENDPOINT_ORDERS_PRICE_ORDER;h.profileType==l.PROFILE_TYPE_AGENT&&(c.isPathEqualTo(e.agentMultiShipCheckout)&&e.hasShippingInformation()&&(n.shippingGroups=e.createShippingGroups(!0),d=!0),u=l.ENDPOINT_ORDERS_CREATE_ORDER,n.op="priceOrder"),h.request(u,n,function(r){r.isTransientOrder=!0,e.hardPricing=!1,e.userActionPending(!1),e.isPricingRequired(!1),e.updateCart(r,i,!1),e.callPriceBeforeShippingMethods&&e.populateShipppingMethods(),s.Topic(t.topicNames.COUPON_ADD_CLEAR_INPUT).publish(),e.callbacks&&e.callbacks.hasOwnProperty(l.PRICING_SUCCESS_CB)&&"function"==typeof e.callbacks[l.PRICING_SUCCESS_CB]&&e.callbacks[l.PRICING_SUCCESS_CB](r),s.Topic(t.topicNames.DESTROY_SHIPPING_OPTIONS_SPINNER).publishWith(r)},function(a){if(a.errorCode==l.SELECTED_CURRENCY_NOT_FOUND)e.handleCurrencyPricingError();else if(a.errorCode==l.COUPON_APPLY_ERROR)e.handleCouponPricingError(a,i);else if(a.errorCode==l.CREATE_ORDER_PRODUCT_NOT_FOUND||a.errorCode==l.CREATE_ORDER_SKU_NOT_FOUND||a.errorCode==l.PRODUCT_NOT_FOR_INDIVIDUAL_SALE)e.handleInvalidAddItem(a,i),e.notifyInvalidProducts(),e.loadCart(),e.tax(0),e.secondaryCurrencyTaxAmount(0);else if(a.errorCode==l.GIFTCARD_APPLY_ERROR||a.errorCode==l.GIFTCARD_INSUFFICIENT_ERROR||a.errorCode==l.INVALID_GIFTCARD_DATA_ERROR||a.errorCode==l.GIFTCARD_ORDER_PROCESSING_ERROR)e.handleGiftCardError(a,i);else if(a.errorCode==l.ANONYMOUS_USER_ACCESS_CONTROL_ERROR)r.sendError("UserNotAuthorized",o.t("ns.common:resources.anonymousAccessControlError"),!0);else if(a.errorCode==l.UNLINKED_ADD_ON_PRODUCT){if(i&&i.type==k&&i.product.selectedAddOnProducts){var n=JSON.parse(a.moreInfo);e.handleInvalidAddonItem(i.product.selectedAddOnProducts,n.productId,n.catRefId),e.notifyInvalidProducts(),e.loadCart()}}else if(a.errorCode==l.ADDON_VOLUME_PRICE_ERROR){var c=a.message+" "+o.t("ns.common:resources.removeItemFromCart");r.sendError(re,c,!0),e.isDirty(!1)}else if(a.errorCode==l.INVALID_SHOPPER_INPUT){var n=JSON.parse(a.moreInfo),d=n.productId,u=e.findCartProductById(d);u&&(d=u.displayName);var c=o.t("ns.common:resources.invalidShopperInputError",{productName:d});r.sendError(re,c,!0),e.isDirty(!1)}else e.isDirty(!1),e.tax(0),e.secondaryCurrencyTaxAmount(0);s.Topic(t.topicNames.DESTROY_SHIPPING_OPTIONS_SPINNER).publishWith(a),e.callbacks&&e.callbacks.hasOwnProperty(l.PRICING_FAILURE_CB)&&"function"==typeof e.callbacks[l.PRICING_FAILURE_CB]&&e.callbacks[l.PRICING_FAILURE_CB](a)},void 0,void 0,void 0,void 0,void 0,{includeShippingGroups:d})},S.prototype.hasSingleShippingInformation=function(){var e=!1;return this.isSplitShipping()||(e=""!==this.shippingAddress()&&""!==this.shippingMethod()),e},S.prototype.subItemsHaveShippingInformation=function(e){var t=!0,r=this;return e.childItems&&e.childItems.length>0&&(t=0!==e.childItems.length&&e.childItems.every(function(e){return e.shippingGroupRelationships().every(function(t){return t.updatableQuantity.isValid()&&(t.shippingAddress()&&t.shippingAddress().isValid&&t.shippingAddress().isValid()&&t.shippingMethod()&&r.subItemsHaveShippingInformation(e)||t.selectedStore())})})),t},S.prototype.hasSplitShippingInformation=function(){var e=!1,t=this;return this.isSplitShipping()&&(e=0!=this.items().length&&this.items().every(function(e){return e.shippingGroupRelationships().every(function(r){return e.soldAsPackage()===!1?r.updatableQuantity.isValid()&&(r.shippingAddress()&&r.shippingAddress().isValid&&r.shippingAddress().isValid()&&r.shippingMethod()&&t.subItemsHaveShippingInformation(e)||r.selectedStore()):r.updatableQuantity.isValid()&&(r.shippingAddress()&&r.shippingAddress().isValid&&r.shippingAddress().isValid()&&r.shippingMethod()||r.selectedStore())})})),e},S.prototype.hasShippingInformation=function(){var e=this.hasSplitShippingInformation()||this.hasSingleShippingInformation();return e},S.prototype.setUnpricedErrorAndSaveCart=function(t,r){var i=this;e.utils.arrayForEach(i.items(),function(e){e.commerceItemId==t&&i.isConfigurableItem(e)&&e.childItems&&e.childItems.length>0&&e.setUnpricedError(r)}),i.saveCartCookie()},S.prototype.clearAllUnpricedErrorsAndSaveCart=function(){var t=this;e.utils.arrayForEach(t.items(),function(e){e.clearUnpricedError()}),t.saveCartCookie()},S.prototype.setExternalPricesForItems=function(t){var r=this;e.utils.arrayForEach(r.items(),function(e){t.commerceItemId==e.commerceItemId&&e.externalPrice(t.externalPrice)})},S.prototype.priceCartForCheckout=function(){var i=this,a=i.events.pop();if(1==this.storeConfiguration.isLargeCart()&&a&&a.type==ee){var n=a;a=i.events.pop(),i.events.push(n)}if((h.profileType==l.PROFILE_TYPE_AGENT&&i.user().clonedOrderId()||i.hasShippingInformation())&&!i.isOrderSubmissionInProgress){var d=new L(i);if(i.hasShippingInformation()){if(this.isSplitShipping())d.shippingGroups=this.createShippingGroups();else if(h.profileType==l.PROFILE_TYPE_AGENT&&this.orderShippingGroups()&&this.orderShippingGroups().length>1)d.shippingGroups=this.createShippingGroups(!0);else{if(d.shippingMethod={value:this.shippingMethod()},d.shippingAddress=this.shippingAddress(),l.PROFILE_TYPE_AGENT===h.profileType&&i.user().clonedOrderId())for(var u=d.shoppingCart.items.length,p=0;p<u;p++)d.shoppingCart.items[p].commerceItemId||(d.shoppingCart.items[p].commerceItemId=this.generateCommerceItemId());this.user().emailAddress()&&!e.utils.unwrapObservable(d.shippingAddress.email)?d.shippingAddress.email=this.user().emailAddress():this.user().loggedIn()||!this.emailAddressForGuestUser||e.utils.unwrapObservable(d.shippingAddress.email)&&d.shippingAddress.email==this.emailAddressForGuestUser||(d.shippingAddress.email=this.emailAddressForGuestUser)}d.populateShippingMethods=!0}if(i.populateGiftCards(d,a),i.populateIINs(d,a),i.items().length>0){if(i.currentOrderState()!=l.PENDING_PAYMENTS&&this.currentOrderState()!=l.PENDING_PAYMENT_TEMPLATE)if(i.user()&&i.user().loggedIn()&&i.nonTransientCartCheck()||h.profileType==l.PROFILE_TYPE_AGENT){d.checkout=!0,d.clearCoupons=!1,d.merge=!1;var g;if(h.profileType==l.PROFILE_TYPE_AGENT){var f=!!i.user().clonedOrderId();f?(d.orderId=i.user().orderId(),d[l.OP]=l.PRICE_ORDER_AMENDMENT_OP,d.shoppingCart.coupons=e.toJS(i.coupons())):(g=l.ENDPOINT_ORDERS_CREATE_ORDER,d.op="priceOrder",i.user().orderId()&&(d.orderId=i.user().orderId()))}else g="order";var m=i.user().orderId(),I={includeShippingGroups:!1};i.user().clonedOrderId()&&((!c.isPathEqualTo(i.agentMultiShipCheckout)||c.isPathEqualTo(i.agentMultiShipCheckout)&&i.hasShippingInformation())&&(I.includeShippingGroups=!0),m=i.user().clonedOrderId(),g="handleOrderAmendment",d.op="priceOrderAmendment"),i.adapter.persistUpdate(g,m,d,I,function(e){i.hardPricing=!1,i.userActionPending(!1),i.isPricingRequired(!1),i.updateCart(e,a,!1),s.Topic(t.topicNames.ORDER_PRICING_SUCCESS).publish([{message:"success"}]),s.Topic(t.topicNames.COUPON_ADD_CLEAR_INPUT).publish(),s.Topic(t.topicNames.DESTROY_SHIPPING_OPTIONS_SPINNER).publishWith(e)},function(e){if(e.errorCode==l.SELECTED_CURRENCY_NOT_FOUND)i.handleCurrencyPricingError();else if(e.errorCode==l.COUPON_APPLY_ERROR)i.handleCouponPricingError(e,a);else if(e.errorCode==l.CREATE_ORDER_PRODUCT_NOT_FOUND||e.errorCode==l.CREATE_ORDER_SKU_NOT_FOUND)i.loadCart(),i.tax(0),i.secondaryCurrencyTaxAmount(0);else if(e.errorCode==l.GIFTCARD_APPLY_ERROR||e.errorCode==l.GIFTCARD_INSUFFICIENT_ERROR||e.errorCode==l.INVALID_GIFTCARD_DATA_ERROR||e.errorCode==l.GIFTCARD_ORDER_PROCESSING_ERROR)i.handleGiftCardError(e,a);else if(e.errorCode==l.INVALID_SHIPPING_METHOD&&i.usingImprovedShippingWidgets())i.shippingMethod(null),i.isDirty(!1),i.tax(0),i.shipping(0),i.markDirty(),r.sendError(re,e.message,!0),i.populateShipppingMethods();else if(e.errorCode==l.UNLINKED_ADD_ON_PRODUCT)i.loadCart();else if(e.errorCode==l.ADDON_VOLUME_PRICE_ERROR){var n=e.message+" "+o.t("ns.common:resources.removeItemFromCart");r.sendError(re,n,!0),i.isDirty(!1)}else if(e.errorCode==l.INVALID_SHOPPER_INPUT){var c=JSON.parse(e.moreInfo),d=c.productId,u=i.findCartProductById(d);u&&(d=u.displayName);var n=o.t("ns.common:resources.invalidShopperInputError",{productName:d});r.sendError(re,n,!0),i.isDirty(!1)}else i.isSplitShipping()&&e.errorCode==l.INVALID_SHIPPING_ADDRESS?(i.tax(0),i.secondaryCurrencyTaxAmount(0),s.Topic(t.topicNames.ORDER_PRICING_FAILED).publishWith(e)):e.errorCode==l.CART_ITEM_QUANTITY_NOT_FULY_ALLOCATED?i.isDirty(!1):(i.shippingMethod(""),i.loadCart(),i.tax(0),i.secondaryCurrencyTaxAmount(0),s.Topic(t.topicNames.ORDER_PRICING_FAILED).publishWith(e),s.Topic(t.topicNames.DESTROY_SHOPPING_CART_SPINNER).publish());s.Topic(t.topicNames.DESTROY_SHIPPING_OPTIONS_SPINNER).publishWith(e)})}else{var g;h.profileType==l.PROFILE_TYPE_AGENT?(g=l.ENDPOINT_ORDERS_CREATE_ORDER,d.op="priceOrder"):g="orderPricing",i.adapter.loadJSON(g,"0",d,function(e){i.hardPricing=!1,i.userActionPending(!1),i.isPricingRequired(!1),i.updateCart(e,a,!1),s.Topic(t.topicNames.ORDER_PRICING_SUCCESS).publish([{message:"success"}]),s.Topic(t.topicNames.COUPON_ADD_CLEAR_INPUT).publish(),i.associateShippingGroupsToItems(e.shippingGroups),s.Topic(t.topicNames.DESTROY_SHIPPING_OPTIONS_SPINNER).publishWith(e)},function(e){if(e.errorCode==l.SELECTED_CURRENCY_NOT_FOUND)i.handleCurrencyPricingError();else if(e.errorCode==l.COUPON_APPLY_ERROR)i.handleCouponPricingError(e,a);else if(e.errorCode==l.CREATE_ORDER_PRODUCT_NOT_FOUND||e.errorCode==l.CREATE_ORDER_SKU_NOT_FOUND)i.loadCart(),i.tax(0),i.secondaryCurrencyTaxAmount(0);else if(e.errorCode==l.GIFTCARD_APPLY_ERROR||e.errorCode==l.GIFTCARD_INSUFFICIENT_ERROR||e.errorCode==l.INVALID_GIFTCARD_DATA_ERROR||e.errorCode==l.GIFTCARD_ORDER_PROCESSING_ERROR)i.handleGiftCardError(e,a);else if(e.errorCode==l.INVALID_SHIPPING_METHOD&&i.usingImprovedShippingWidgets())i.shippingMethod(null),i.isDirty(!1),i.tax(0),i.shipping(0),i.markDirty(),r.sendError(re,e.message,!0),i.populateShipppingMethods();else if(e.errorCode==l.UNLINKED_ADD_ON_PRODUCT)i.loadCart();else if(e.errorCode==l.ADDON_VOLUME_PRICE_ERROR){var n=e.message+" "+o.t("ns.common:resources.removeItemFromCart");r.sendError(re,n,!0),i.isDirty(!1)}else if(e.errorCode==l.INVALID_SHOPPER_INPUT){var c=JSON.parse(e.moreInfo),d=c.productId,u=i.findCartProductById(d);u&&(d=u.displayName);var n=o.t("ns.common:resources.invalidShopperInputError",{productName:d});r.sendError(re,n,!0),i.isDirty(!1)}else i.isSplitShipping()&&e.errorCode==l.INVALID_SHIPPING_ADDRESS?(i.tax(0),i.secondaryCurrencyTaxAmount(0),s.Topic(t.topicNames.ORDER_PRICING_FAILED).publishWith(e)):(i.shippingMethod(""),i.loadCart(),i.tax(0),i.secondaryCurrencyTaxAmount(0),s.Topic(t.topicNames.ORDER_PRICING_FAILED).publishWith(e));s.Topic(t.topicNames.DESTROY_SHIPPING_OPTIONS_SPINNER).publishWith(e)})}}else i.emptyCart(),s.Topic(t.topicNames.ORDER_PRICING_FAILED).publish(),h.profileType==l.PROFILE_TYPE_AGENT&&i.user().clonedOrderId()?s.Topic(t.topicNames.CART_PRICE_COMPLETE).publish():i.user()&&i.user().loggedIn()&&i.nonTransientCartCheck()&&i.removeCurrentProfileOrder()}else i.isOrderSubmissionInProgress&&console.warn(o.t("ns.common:resources.priceOrderBlockedText"))},S.prototype.handleGiftCardError=function(e,r){var i=this,a=r.product;if(r.type===V)i.giftCards.remove(function(e){return e.giftCardNumber()==a.giftCardNumber()});else if(r.type===K)for(var o=0;o<a.length;o++)i.giftCards.remove(function(e){return e.giftCardNumber()==a[o].giftCardNumber()});else r.type===B&&e.errorCode==l.GIFTCARD_INSUFFICIENT_ERROR&&(i.giftCards.remove(function(e){return e.giftCardNumber()==a.giftCardNumber()}),s.Topic(t.topicNames.GIFTCARD_UPDATE_FROM_CART).publish(i.giftCards()),i.isDirty(!1),i.isDirty(!0));s.Topic(t.topicNames.GIFTCARD_PRICING_FAILED).publish(e,a,r),i.isDirty(!1)},S.prototype.updateCart=function(e,r,i,a){var o=this;if(h.profileType==l.PROFILE_TYPE_AGENT&&o.isItemPriceOverrideAllowed(e.isItemPriceOverrideAllowed),i||o.items().length>0){if(o.updateCartData(e,i,a),o.updateGiftCardDetails(e,r),o.updateDynamicProperties(e),o.cartUpdated(),s.Topic(t.topicNames.CART_PRICE_COMPLETE).publish(),r&&r.type===k){var n=e.markers&&e.markers.length?o.getCampaigns(e.markers):[];s.Topic(t.topicNames.CART_ADD_SUCCESS).publish(r.product,n)}else r&&r.type===x?s.Topic(t.topicNames.CART_UPDATE_SUCCESS).publish():r&&r.type===F?s.Topic(t.topicNames.COUPON_APPLY_SUCCESSFUL).publish():r&&r.type===H&&s.Topic(t.topicNames.COUPON_DELETE_SUCCESSFUL).publish();s.Topic(t.topicNames.CART_PRICE_SUCCESS).publish(o)}},S.prototype.updateGiftCardDetails=function(e,i){var a=this;if(a.giftCards().length>0&&a.updateGiftCardDetailsHandler&&s.isFunction(a.updateGiftCardDetailsHandler))a.updateGiftCardDetailsHandler(e,i);else{var n=[];if(e.payments&&a.giftCards().length>0){for(var c=0;c<a.giftCards().length;c++){for(var d=!1,u=a.giftCards()[c],p=0;p<e.payments.length;p++){var h=e.payments[p];if(h.paymentMethod==l.GIFT_CARD_PAYMENT_TYPE&&u.giftCardNumber()==h.giftCardNumber){u.amountInGiftCard(h.balance),u.amountUsed(h.amount),u.isAmountRemaining(h.isAmountRemaining),u.maskedGiftCardNumber(h.maskedCardNumber),u.isApplyGiftCardClicked(!1),d=!0;break}}i&&i.product&&i.product.giftCardNumber&&i.product.giftCardNumber()===u.giftCardNumber()&&u.isPinCleared(!1),0==d&&n.push(u)}for(var g=0;g<n.length;g++)a.giftCards.remove(function(e){return e.giftCardNumber()==n[g].giftCardNumber()});n&&n.length>0&&r.sendError(re,o.t("ns.common:resources.orderPricingPromotionError"),!0)}s.Topic(t.topicNames.GIFTCARD_UPDATE_FROM_CART).publish(a.giftCards()),a.updateRemainingAmount(e)}},S.prototype.updateRemainingAmount=function(e){var r=this,i=null;if(e.payments&&r.giftCards().length>0){for(var a=r.getDerivedTotal(r.secondaryCurrencyTotal(),r.total()),o=r.isChargeTaxShippingInSecondaryCurrency()?r.secondaryCurrency().fractionalDigits:r.currency.fractionalDigits,n=0,l=0,c=0;c<e.payments.length;c++){var d=e.payments[c];"true"!=d.default_initial&&(l=parseFloat(n)+parseFloat(d.amount),n=v.handleFractionalDigits(l,o))}l=parseFloat(a)-parseFloat(n),i=v.handleFractionalDigits(l,o)}s.Topic(t.topicNames.UPDATE_AMOUNT_REMAINING).publish(i)},S.prototype.updateCartData=function(e,t,r,i){var a=this;e&&(e.orderId||e.id)&&!e.isTransientOrder&&(e.orderId?a.user().orderId(e.orderId):e.id&&a.user().orderId(e.id),a.user().setLocalData("orderId"));var o=null;if(e.priceListGroup&&e.priceListGroup.currency)a.currency=e.priceListGroup.currency;else if(e.priceListGroup&&e.priceListGroup.repositoryId){"agentUI"===h.profileType&&(a.agentConfiguration=require("agentViewModels/agentConfiguration"));var n,c=a.agentConfiguration?a.agentConfiguration.getPriceListGroups():null;c&&(n=c[e.priceListGroup.repositoryId]),n&&(a.currency=n.currency)}if(s.when(u.getInstance().siteLoadedDeferred).done(function(){var t=u.getInstance().getCurrency(e.secondaryCurrencyCode);a.setSecondaryCurrencyData(t,e.exchangeRate,e.payShippingInSecondaryCurrency,e.payTaxInSecondaryCurrency,e.allowAlternateCurrency)}),o=e.order&&(a.currentOrderId()||a.mergeCart())?O(e.order.items,a.items,t,a,e,r):O(e.shoppingCart.items,a.items,t,a,e,r,i),a.combineLineItems===l.COMBINE_YES&&(a.combineLineItems=1==a.shouldCombineLineItems(a.items())?l.COMBINE_YES:l.COMBINE_NO),e.order&&(a.currentOrderId()||a.mergeCart())?a.numberOfItems(e.order.numberOfItems):a.numberOfItems(e.shoppingCart.numberOfItems),a.total(e.priceInfo.total),a.totalWithoutTax(e.priceInfo.totalWithoutTax),a.subTotal(e.priceInfo.subTotal),a.shipping(e.priceInfo.shipping),a.secondaryCurrencyShippingAmount(e.priceInfo.secondaryCurrencyShippingAmount),a.taxExclusiveAmount(e.priceInfo.taxExclusiveAmount),a.tax(e.priceInfo.tax),a.secondaryCurrencyTaxAmount(e.priceInfo.secondaryCurrencyTaxAmount),a.currencyCode(e.priceInfo.currencyCode),a.shippingSurcharge(e.priceInfo.shippingSurchargeValue),a.secondaryCurrencyShippingSurcharge(e.priceInfo.secondaryCurrencyShippingSurchargeValue),a.secondaryCurrencyTotal(e.priceInfo.secondaryCurrencyTotal),a.primaryCurrencyTotal(e.priceInfo.primaryCurrencyTotal),a.quoteInfo(e.quoteInfo),e.recurringChargePriceInfo&&(a.recurringChargeAmount(e.recurringChargePriceInfo.amount),a.recurringChargeCurrencyCode(e.recurringChargePriceInfo.currencyCode),a.recurringChargeShipping(e.recurringChargePriceInfo).shipping,a.recurringChargeSubTotal(e.recurringChargePriceInfo.subTotal),a.recurringChargeSubTotalByFrequency(e.recurringChargePriceInfo.subTotalByFrequency),a.recurringChargeTax(e.recurringChargePriceInfo.tax),a.recurringChargeTaxByFrequency(e.recurringChargePriceInfo.taxByFrequency),a.recurringChargeTotal(e.recurringChargePriceInfo.total)),e.discountInfo){e.discountInfo.orderDiscount?a.orderDiscount(e.discountInfo.orderDiscount):a.orderDiscount(0),e.discountInfo.shippingDiscount?(a.shippingDiscount(e.discountInfo.shippingDiscount),a.secondaryCurrencyShippingDiscount(e.discountInfo.secondaryCurrencyShippingDiscount)):(a.shippingDiscount(0),a.secondaryCurrencyShippingDiscount(0)),e.discountInfo.orderImplicitDiscountList&&a.orderDiscountDescList(e.discountInfo.orderImplicitDiscountList),e.discountInfo.unclaimedCouponsMap&&a.populateCoupons(e.discountInfo.unclaimedCouponsMap,l.COUPON_STATUS_UNCLAIMED),e.discountInfo.orderCouponsMap&&a.populateCoupons(e.discountInfo.orderCouponsMap,l.COUPON_STATUS_CLAIMED),a.couponMultiPromotions.splice(0),e.discountInfo.unclaimedCouponMultiPromotions&&a.populateCouponMultiPromotions(e.discountInfo.unclaimedCouponMultiPromotions,l.COUPON_STATUS_UNCLAIMED,l.PROMOTION_NOT_APPLIED),e.discountInfo.claimedCouponMultiPromotions&&a.populateCouponMultiPromotions(e.discountInfo.claimedCouponMultiPromotions,l.COUPON_STATUS_CLAIMED,l.PROMOTION_APPLIED),e.pricingMessages&&a.populatePricingMessage(e.pricingMessages),a.populateClaimedCouponMultiPromotions(a.couponMultiPromotions());for(var d=a.coupons().length-1;d>=0;d--)e.discountInfo.orderCouponsMap.hasOwnProperty(a.coupons()[d].code())||e.discountInfo.unclaimedCouponsMap.hasOwnProperty(a.coupons()[d].code())||a.coupons.splice(d,1);e.shippingGroups&&e.shippingGroups[0].items?(e.shippingGroups.map(function(e,t){var r=e.items.reduce(function(e,t){return e+=t.quantity},0);if(null==e.shippingAddress&&(e.shippingAddress={}),e.shippingMethod)for(var i in e.shippingMethod)null==e.shippingMethod[i]&&(e.shippingMethod[i]="");else e.shippingMethod={};return e.totalItemQuantity=r}),a.orderShippingGroups(e.shippingGroups)):(a.shippingDiscount(0),a.secondaryCurrencyShippingDiscount(0))}if(a.amount(e.priceInfo.amount),a.skipGWPMessage||a.sendGWPMessages(e),a.skipGWPMessage=!1,a.giftWithPurchaseOrderMarkers=e.giftWithPurchaseOrderMarkers,a.placeHolderItems.removeAll(),e.giftWithPurchaseInfo&&e.giftWithPurchaseInfo.length&&a.updatePlaceHolderItems(e.giftWithPurchaseInfo),a.items().length>0){for(var d=0;d<a.items().length;d++)if(null==a.items()[d].productData()||!a.isChildItemHasProductData(a.items()[d].childItems)){a.getProductData();break}}else a.events.push(new w(Z,0));return o},S.prototype.isChildItemHasProductData=function(e){var t=this,r=!0;if(null!=e&&e.length>0)for(var i=0;i<e.length&&(r=null!=e[i].productData()&&(r&&t.isChildItemHasProductData(e.childItems)),r);i++);return r},S.prototype.addGiftDataToItem=function(e,t){if(e.discountInfo().length){var r=e.discountInfo();e.giftData=[];for(var i=0;i<r.length;i++)if(r[i].giftWithPurchaseDiscountInfo&&r[i].giftWithPurchaseDiscountInfo.length)for(var a=0;a<r[i].giftWithPurchaseDiscountInfo.length;a++){var o=r[i].giftWithPurchaseDiscountInfo[a];if(o.giftWithPurchaseChoicesAvailable)for(var n=o.giftWithPurchaseIdentifier,s=0;s<t.giftWithPurchaseInfo.length;s++)if(t.giftWithPurchaseInfo[s].giftWithPurchaseIdentifier==n&&t.giftWithPurchaseInfo[s].promotionId==r[i].promotionId){var l={};l.giftWithPurchaseType=t.giftWithPurchaseInfo[s].giftWithPurchaseType,l.giftWithPurchaseDetail=t.giftWithPurchaseInfo[s].giftWithPurchaseDetail,l.promotionId=t.giftWithPurchaseInfo[s].promotionId,l.giftWithPurchaseIdentifier=t.giftWithPurchaseInfo[s].giftWithPurchaseIdentifier,l.giftWithPurchaseQuantity=o.giftWithPurchaseQuantity,e.giftData.push(l),e.isGWPChoicesAvaliable(!0);break}}}},S.prototype.updatePlaceHolderItems=function(e){for(var t=this,r=0;r<e.length;r++)if(e[r].giftWithPurchaseQuantityAvailableForSelection){var i=e[r].giftWithPurchaseQuantityAvailableForSelection;if(i){var a=e[r];a.displayName=o.t("ns.common:resources.freeProductText"),a.imageData={primaryThumbImageURL:"/img/GWP_GiftWithPurchase.jpg",primaryImageAltText:a.displayName,primaryImageTitle:a.displayName},a.quantity=1,a.itemTotal=0,a.quantityDisabled=!0,a.id=Math.floor(1e4*Math.random()),a.isPlaceHolderItem=!0}for(;i;)t.placeHolderItems.push(a),i--}t.numberOfItems(t.numberOfItems()+t.placeHolderItems().length)},S.prototype.removePlaceHolderFromCart=function(e){var r=this;r.placeHolderItems.remove(e),r.allItems.remove(e),s.Topic(t.topicNames.CART_REMOVE_SUCCESS).publishWith([{message:"success",cartItem:e}]),r.numberOfItems(r.numberOfItems()-1)},S.prototype.sendGWPMessages=function(e){var i=this;if(r.clearError(ie),i.gwpQualified&&(s.Topic(t.topicNames.GWP_CLEAR_QUALIFIED_MESSAGE).publish(),i.gwpQualified=!1),e.pricingMessages&&e.pricingMessages.giftWithPurchaseMessages&&e.pricingMessages.giftWithPurchaseMessages.length){for(var a,o,n,l=e.pricingMessages.giftWithPurchaseMessages,c=!1,d=!1,u=null,p=0;p<l.length;p++)"GWPFullFailure"!=l[p].identifier||d?"GWPQualified"!=l[p].identifier||i.gwpQualified?"GWPInvalidated"!=l[p].identifier||c||(n=l[p].summary,c=!0,s.Topic(t.topicNames.GWP_INVALIDATED_MESSAGE).publish(l[p])):(o=l[p].summary,u==l[p].params[0]?(s.Topic(t.topicNames.GWP_CLEAR_QUALIFIED_MESSAGE).publish(),i.gwpQualified=!1,u=null):(s.Topic(t.topicNames.GWP_QUALIFIED_MESSAGE).publish(l[p]),i.gwpQualified=!0,u=l[p].params[0])):(a=l[p].summary,d=!0,l[p].params[0]==u?(s.Topic(t.topicNames.GWP_CLEAR_QUALIFIED_MESSAGE).publish(),i.gwpQualified=!1,u=null):u=l[p].params[0],s.Topic(t.topicNames.GWP_FAILURE_MESSAGE).publish(l[p]));d&&!i.gwpQualified?r.sendError(ie,a,!0):i.gwpQualified?r.sendSuccess(ie,o,!0):c&&r.sendError(ie,n,!0)}},S.prototype.populateCoupons=function(e,t){var r=this,i=[],a=!1,o=r.coupons().length;for(var n in e){for(var s=0;s<o;s++)if(n==r.coupons()[s].code()){r.coupons()[s].description(e[r.coupons()[s].code()].promotionDesc),r.coupons()[s].status(t),r.coupons()[s].level(e[r.coupons()[s].code()].promotionLevel),r.coupons()[s].id(e[r.coupons()[s].code()].promotionId),r.coupons()[s].totalAdjustment(e[r.coupons()[s].code()].totalAdjustment),r.coupons()[s].name(e[r.coupons()[s].code()].promotionName),r.coupons()[s].longDescription(e[r.coupons()[s].code()].promotionLongDesc),a=!0;break}a||i.push(new _(n,e[n].promotionDesc,t,e[n].promotionLevel,e[n].promotionId,e[n].totalAdjustment,e[n].promotionName,e[n].promotionLongDesc))}for(var s=0;s<i.length;s++)r.coupons.push(i[s])},S.prototype.populatePricingMessage=function(e){var t=this;e&&e.promotionUpsellMessages&&t.promotionUpsellContainer.populatePromotionUpsellMessages(e.promotionUpsellMessages)},S.prototype.populateCouponMultiPromotions=function(e,t,r){var i=this,a=[],o=!1,n=i.couponMultiPromotions().length;for(var s in e){o=!1;for(var l=0;l<n;l++)if(s==i.couponMultiPromotions()[l].code()){i.couponMultiPromotions()[l].couponStatus(t),i.couponMultiPromotions()[l].populateCouponData(e[s],r),o=!0;break}o||a.push(new A(s,e[s],t,r))}for(var l=0;l<a.length;l++)i.couponMultiPromotions.push(a[l])},S.prototype.populateClaimedCouponMultiPromotions=function(t){var r=this;r.claimedCouponMultiPromotions.splice(0);for(var i=0;i<t.length;i++)if(t[i].couponStatus()===l.COUPON_STATUS_CLAIMED){for(var a=[],o=0;o<t[i].promotions().length;o++)t[i].promotions()[o].promotionApplied()&&a.push(e.mapping.toJS(t[i].promotions()[o]));r.claimedCouponMultiPromotions.push(new A(t[i].code(),a,l.COUPON_STATUS_CLAIMED,l.PROMOTION_APPLIED))}},S.prototype.populateShippingMethodsForShippingGroup=function(t,r,i){var a=this,o={};o.shoppingCart={},o.shoppingCart.items=[],o.shoppingCart.items.push({catRefId:t.catRefId,productId:t.productId,quantity:t.quantity()}),a.adapter.persistCreate(l.ENDPOINT_ORDERS_PRICE_ORDER,"0",o,function(o){var n={},c=t.shippingAddress();if(c){n[l.PRODUCT_IDS_FOR_SHIPPING]=[t.productId],n[l.POPULATE_SHIPPING_METHODS]=!0,n[l.SHIPPING_ADDRESS_FOR_METHODS]=c.toJSON(),n.priceInfo={amount:a.amount(),total:a.total(),shipping:a.shipping(),totalWithoutTax:a.totalWithoutTax(),currencyCode:a.currencyCode(),shippingSurchargeValue:a.shippingSurcharge(),tax:a.tax(),subTotal:a.subTotal()};var d=e.observableArray();O(o.shoppingCart.items,d,!0),n.items=d(),t.shippingOptions.removeAll(),a.loadMultipleShippingMethods&&s.isFunction(a.loadMultipleShippingMethods)&&a.loadMultipleShippingMethods(r,i,n)}},function(e){i(e)})},S.prototype.events=new Array,S.prototype.validateCartAvailability=function(){var e=this,t=s.Deferred();if(e.items().length>0){var r=new D(e),i={},a={};i[l.ENDPOINT_KEY]=l.ENDPOINT_PRODUCTS_AVAILABILITY,i[l.IDENTIFIER_KEY]="stockStatsToValidateCart";var o=e.storeConfiguration.getFilterToUse(i);o&&!e.storeConfiguration.isLargeCart()&&(a[l.FILTER_KEY]=o);var n=e.getThreshholdSizeForStockStatusData(r.products)<0?l.ENDPOINT_PRODUCTS_AVAILABILITY:l.ENDPOINT_LIST_STOCK_STATUS_LARGE_CART;a[l.PRODUCTS_PARAM]=r.products,a[l.CATALOG]=r.catalogId,a[l.LOCATION_IDS_PARAM]=r.locationIds,h.request(n,a,function(r){t.resolve(e.validateCartForCheckout(r))},function(r){t.reject(r),e.redirect(e.cartLink),e.notifyInvalidProducts("cart")})}return t},S.prototype.validateCartForCheckout=function(e){for(var t=this,r=0;r<t.items().length;r++)if(t.isConfigurableItem(t.items()[r]))t.items()[r].getItemQuantityInCart=t.getUpdatableItemQuantityInCart.bind(t,t.items(),t.items()[r].productId,t.items()[r].catRefId,null),t.items()[r].addConfigurableStockValidation(e,t.isPreOrderBackOrderEnabled);else for(var i=0;i<e.length;i++)if(t.items()[r].productId===e[i].productId&&t.items()[r].catRefId===e[i].catRefId){"IN_STOCK"===e[i].stockStatus||"PREORDERABLE"===e[i].stockStatus||"BACKORDERABLE"===e[i].stockStatus?(t.items()[r].getItemQuantityInCart=t.getUpdatableItemQuantityInCart.bind(t,t.items(),t.items()[r].productId,t.items()[r].catRefId,null),t.items()[r].addLimitsValidation(!0,e[i].orderableQuantity,e[i],t.isPreOrderBackOrderEnabled)):t.items()[r].addLimitsValidation(!1,e[i].orderableQuantity,e[i],t.isPreOrderBackOrderEnabled);break}for(var a=e.reduce(function(e,t){if(e[t.locationId]&&null!==e[t.locationId]){var r=e[t.locationId];r.push(t)}else{var r=new Array;r.push(t),e[void 0==t.locationId?null:t.locationId]=r}return e},{}),r=0;r<t.items().length;r++){var o=t.items()[r];if(o.shippingGroupRelationships&&o.shippingGroupRelationships()&&o.shippingGroupRelationships().length>0)for(var n=0;n<o.shippingGroupRelationships().length;n++){
- var s=o.shippingGroupRelationships()[n],l=[];if(s.isPickupInStore&&s.isPickupInStore()?l=a[s.selectedStore().locationId]:s.isPickupInStore&&!s.isPickupInStore()&&(l=t.contextData.global.site.siteInfo&&t.contextData.global.site.siteInfo.inventoryLocationId?a[t.contextData.global.site.siteInfo.inventoryLocationId]:a[null]),l&&l.length>0)for(var i=0;i<l.length;i++)if(s.productId===l[i].productId&&s.catRefId===l[i].catRefId){if("PREORDERABLE"!==l[i].stockStatus&&"IN_STOCK"!==l[i].stockStatus&&"BACKORDERABLE"!==l[i].stockStatus||!(s.quantity()<=l[i].orderableQuantity)||!s.updatableQuantity.isValid())return t.redirect(t.cartLink),t.checkoutWithPaypalClicked(!1),!1;break}}else for(var i=0;i<e.length;i++)if(t.items()[r].productId===e[i].productId&&t.items()[r].catRefId===e[i].catRefId){if("PREORDERABLE"!==e[i].stockStatus&&"IN_STOCK"!==e[i].stockStatus&&"BACKORDERABLE"!==e[i].stockStatus||!(t.items()[r].quantity()<=e[i].orderableQuantity)||!t.items()[r].updatableQuantity.isValid())return t.redirect(t.cartLink),t.checkoutWithPaypalClicked(!1),!1;break}}return!0},S.prototype.redirect=function(e){var r=this;r.validateAndRedirectCart()||(r.checkoutLink==e||e==l.PAYPAL_CHECKOUT_TYPE)&&(r.user().loggedIn()||r.user().isUserSessionExpired())?(r.validateAndRedirectCart(!1),e==l.PAYPAL_CHECKOUT_TYPE?r.user().validateAndRedirectPage(e):r.user().validateAndRedirectPage(r.checkoutLink)):c.isPathEqualTo(e)?r.reloadCart():e==l.PAYPAL_CHECKOUT_TYPE?s.Topic(t.topicNames.CONTINUE_TO_PAYPAL).publish():c.goTo(e)},S.prototype.setContext=function(e){this.contextData=e,this.cartLink=this.contextData.global.links.cart.route,this.checkoutLink=this.contextData.global.links.checkout.route,this.isTaxIncluded=this.contextData.global.site.isTaxIncluded,this.showTaxSummary=this.contextData.global.site.showTaxSummary,this.isPreOrderBackOrderEnabled=this.contextData.global.preorderBackorderEnabled,h.profileType==l.PROFILE_TYPE_AGENT&&(this.agentCheckout=window.applicationContextPath+this.contextData.global.links.agentCheckout.route,this.agentMultiShipCheckout=window.applicationContextPath+this.contextData.global.links.agentMultiShipCheckout.route)},S.prototype.validateDynamicProperties=function(){for(var e=this,t=0;t<e.dynamicProperties().length;t++){var r=e.dynamicProperties()[t];if(!r.validateNow())return!1}return!0},S.prototype.updateDynamicProperties=function(e){var t=this;if(e.dynamicProperties&&t.dynamicProperties){for(var r=!1,i=0;i<e.dynamicProperties.length;i++){for(var a=!1,o=0;o<t.dynamicProperties().length;o++)if(e.dynamicProperties[i].id===t.dynamicProperties()[o].id()){t.dynamicProperties()[o].value(e.dynamicProperties[i].value),a=!0;break}if(!a){r=!0;var n=new p;n.id(e.dynamicProperties[i].id),n.value(e.dynamicProperties[i].value),t.dynamicProperties.push(n)}}if(h.profileType===l.PROFILE_TYPE_AGENT){var s=t.dynamicProperties.slice(0);t.dynamicProperties.removeAll(),t.dynamicProperties(s)}r&&t.getDynamicPropertiesMetadata(!1)}},S.prototype.updateItemDynamicProperties=function(t,r){function i(e,t){var r=e.childItems||[],i=t.childItems||[],o=i.reduce(function(e,t){return e[t.commerceItemId]=t,e},{});r.forEach(function(e){var t=o[e.commerceItemId];t&&a.updateItemDynamicProperties(e,t)})}var a=this;if(r.dynamicProperties){for(var o=0;o<r.dynamicProperties.length;o++)t[r.dynamicProperties[o].id]=e.observable(r.dynamicProperties[o].value);i(t,r)}},S.prototype.updateItemPriceOverrideFields=function(e,t){if(h.profileType==l.PROFILE_TYPE_AGENT){var r=this;"number"==typeof t.overriddenPrice&&t.overriddenPrice>=0?e.overriddenPrice(t.overriddenPrice):e.overriddenPrice(void 0),t.priceOverrideReason&&e.priceOverrideReason(t.priceOverrideReason.key),e.isPriceOverridden(t.isPriceOverridden),e.discountAmount(t.discountAmount),e.isPriceOverridden()&&!r.hasPriceOverriddenItem()&&r.hasPriceOverriddenItem(!0),void 0!==e.externalPrice()&&r.hasExternalPriceItem(!0)}},S.prototype.populateDynamicProperties=function(e){for(var t=this,r=0;r<t.dynamicProperties().length;r++){var i=t.dynamicProperties()[r],a=i.id(),o=i.value();e[a]=o}},S.prototype.getDynamicPropertiesMetadata=function(e){var t=this,r=!0;if(e){var i=null;try{i=t.getStorageItem("cartDynPropsMetadata"),i&&(i=JSON.parse(i),t.processDynamicPropertiesMetadata(i,!1),r=!1)}catch(e){}}if(r){var a={},o={};o[l.ENDPOINT_KEY]=l.ENDPOINT_METADATA_GET_METADATA,o[l.IDENTIFIER_KEY]="dynamicProperties";var n=t.storeConfiguration.getFilterToUse(o);n&&(a[l.FILTER_KEY]=n),h.profileType==l.PROFILE_TYPE_AGENT?t.adapter.loadJSON(l.ENDPOINT_GET_ITEM_TYPE,"order",a,function(e){e&&t.processDynamicPropertiesMetadata(e.specifications,!0)},function(e){}):t.adapter.loadJSON("dynamicProperties","order",a,function(e){e&&t.processDynamicPropertiesMetadata(e,!0)},function(e){})}},S.prototype.getItemDynamicPropertiesMetadata=function(e){var t=this;t.adapter.loadJSON(l.ENDPOINT_GET_ITEM_TYPE,e,null,function(r){r&&t.processItemDynamicPropertiesMetadata(r,e)},function(e){})},S.prototype.processDynamicPropertiesMetadata=function(e,t){for(var r=this,i=[],a=0;a<e.length;a++){for(var o=!0,n=0;n<r.dynamicProperties().length&&o;n++)e[a].id===r.dynamicProperties()[n].id()&&(o=!1,r.dynamicProperties()[n].initializeMetadata(e[a],!1));if(o){var s=new p;s.initializeMetadata(e[a],!0),i.push(s)}}for(var a=0;a<i.length;a++)r.dynamicProperties.push(i[a]);if(t)try{for(var l=new Array,a=0;a<r.dynamicProperties().length;a++)l.push(r.dynamicProperties()[a].getMetadata());var c=JSON.stringify(l);r.setStorageItem("cartDynPropsMetadata",c,10800)}catch(e){}},S.prototype.processItemDynamicPropertiesMetadata=function(e,t){var r=this,i=[];if(t==l.ENDPOINT_COMMERCE_ITEM_TYPE_PARAM){for(var a=0;a<e.specifications.length;a++){for(var o=!0,n=0;n<r.lineAttributes().length&&o;n++)e.specifications[a].id===r.lineAttributes()[n].id()&&(o=!1,r.lineAttributes()[n].initializeMetadata(e.specifications[a],!1));if(o){var s=new p;s.initializeMetadata(e.specifications[a],!0),i.push(s)}}for(var a=0;a<i.length;a++)r.lineAttributes.push(i[a])}},S.prototype.setStorageItem=function(e,t,r){void 0!==r&&null!==r||(r=3600);var i=new Date,a=Math.round(i.setSeconds(i.getSeconds()+r)/1e3);d.getInstance().setItem(e,t),d.getInstance().setItem(e+"_time",a)},S.prototype.getStorageItem=function(e){var t=new Date,r=Math.round(t/1e3),i=d.getInstance().getItem(e),a=d.getInstance().getItem(e+"_time");return void 0!==a&&null!==a||(a=0),a<r?(this.removeStorageItem(e),null):i},S.prototype.removeStorageItem=function(e){d.getInstance().removeItem(e),d.getInstance().removeItem(e+"_time")},S.prototype.setCallbackFunctions=function(e){var t=this;if(e&&Object.keys(e)&&Object.keys(e).length>0)for(var r in e)t.callbacks[r]=e[r]},S.prototype.generateCommerceItemId=function(){this.cmIdSequence||(this.cmIdSequence=1);var e="ci"+Math.floor(te+Math.random()*te)+this.cmIdSequence++;return e},S.prototype.createShippingGroups=function(e){var t,r=this,i=null;if(this.user().emailAddress()&&(i=this.user().emailAddress()),!this.user().loggedIn()&&this.emailAddressForGuestUser&&(i=this.emailAddressForGuestUser),e)for(var a=0;a<this.items().length;a++)this.items()[a].shippingGroupRelationships()&&1===this.items()[a].shippingGroupRelationships().length&&this.items()[a].shippingGroupRelationships()[0].quantity()!=this.items()[a].quantity()&&this.items()[a].shippingGroupRelationships()[0].quantity(this.items()[a].quantity());if(this.isSplitShipping()||e){var o={},n={};n.createShippingGroups=e,n.shippingGroupIdx=0,this.items().forEach(function(e){r.mapShippingGroups(o,e,e.soldAsPackage(),n)}),t=Object.keys(o).map(function(e){return o[e]}).filter(function(e){if(e.items=Object.keys(e.items).map(function(t){return e.items[t]}).filter(function(e){if(e.quantity>0)return e}),e.items.length)return e})}return t},S.prototype.mapShippingGroups=function(t,r,i,a){var o=this,n=null;if(this.user().emailAddress()&&(n=this.user().emailAddress()),!this.user().loggedIn()&&this.emailAddressForGuestUser&&(n=this.emailAddressForGuestUser),a.createShippingGroups)for(var c=0;c<this.items().length;c++)this.items()[c].shippingGroupRelationships()&&1===this.items()[c].shippingGroupRelationships().length&&this.items()[c].shippingGroupRelationships()[0].quantity()!=this.items()[c].quantity()&&this.items()[c].shippingGroupRelationships()[0].quantity(this.items()[c].quantity());if((o.isConfigurableItem(r)&&!r.commerceItemId||!r.commerceItemId&&o.lineAttributes&&e.isObservable(o.lineAttributes)&&o.lineAttributes().length>0||!r.commerceItemId&&r.productData()&&r.productData().addOnProducts&&r.productData().addOnProducts.length>0||!r.commerceItemId&&o.combineLineItems===l.COMBINE_NO)&&(r.commerceItemId=o.generateCommerceItemId()),r.shippingGroupRelationships())for(var d=0;d<r.shippingGroupRelationships().length;d++)r.shippingGroupRelationships()[d].commerceItemId=r.commerceItemId,r.shippingGroupRelationships()[d].assetable=r.assetable,r.shippingGroupRelationships()[d].shippable=r.shippable,!o.isSplitShipping()&&o.shippingAddress&&o.shippingAddress()&&r.shippingGroupRelationships()[d].shippingAddress(o.shippingAddress()),!o.isSplitShipping()&&o.shippingMethod&&o.shippingMethod()&&r.shippingGroupRelationships()[d].shippingMethod(o.shippingMethod()),r.childItems&&r.childItems.length>0&&(r.shippingGroupRelationships()[d].childItems=r.childItems,i===!1&&r.childItems.forEach(function(e){o.mapShippingGroups(t,e,i,a)}));return r.shippingGroupRelationships().forEach(function(e){var r=e.asMap(n),i=Object.keys(r)[0],o=t[i],l=r[i];if(e.commerceItemId)var c=e.catRefId+"_"+e.commerceItemId;else var c=e.catRefId;var d=o?o.items[c]:void 0,u=l.items[c];o?e.shippingGroupId=o.shippingGroupId:(l.shippingGroupId=a.shippingGroupIdx.toString(),e.shippingGroupId=a.shippingGroupIdx.toString(),a.shippingGroupIdx++),d?d.quantity+=u.quantity:s.extend(!0,t,r)}),t},S.prototype.associateShippingGroupsToItems=function(t,r,i,a){var n=this;new Object,t.length;if(t&&0!=t.length){for(var d=new Object,u=n.createChildItemsKeyList(a),p=t.reduce(function(t,r,i){return r.items.forEach(function(a,c){var p="";a.allowVirtualShippingGroup=n.storeConfiguration.allowVirtualShippingGroup,a.isVirtualShippingGroup=r.type===l.VIRTUAL_SHIPPING_GROUP_TYPE;var h=new E(a,a.quantity);if(h.commerceItemId=a.commerceItemId,h.assetable=a.assetable,h.shippable=a.shippable,h.detailedItemPriceInfo&&h.detailedItemPriceInfo.length>0){var f=0;s.each(h.detailedItemPriceInfo,function(e,t){f+=t.amount}),h.price(f)}if(r.type==l.INSTORE_PICKUP)h.selectedStore({store:r.store,locationId:r.store.locationId}),h.isPickupInStore(!0),r.firstName&&h.firstName(r.firstName),r.lastName&&h.lastName(r.lastName),r.phoneNumber&&h.phoneNumber(r.phoneNumber),a.availablePickupDate&&h.availablePickupDate(a.availablePickupDate),a.preferredPickupDate&&h.preferredPickupDate(a.preferredPickupDate);else{if(r.shippingAddress){var m,I={translate:function(e,t){return o.t("ns.common:resources."+e,t)}},y=n.contextData&&n.contextData.page&&n.contextData.page.shippingCountriesPriceListGroup?n.contextData.page.shippingCountriesPriceListGroup:[],v=n.contextData&&n.contextData.page&&n.contextData.page.defaultShippingCountry?n.contextData.page.defaultShippingCountry:"";m=new g("split-shipping-address","",I,y,v),m.copyFrom(r.shippingAddress,[]),m&&m.isValid()&&(h.shippingAddress(m),h.shippingMethod(r.shippingMethod))}h.isPickupInStore(!1)}if(h.addOnItem=!1,a.childItems&&a.childItems.length>0)for(var b=0;b<a.childItems.length;b++)if(a.childItems[b].addOnItem){h.addOnItem=!0;break}u.indexOf(n.getKeyForChildItemUsingItemProperties(a))>-1||(n.isConfigurableItem(a)||n.combineLineItems===l.COMBINE_NO?(p=h.hashCode(a.commerceItemId),t[p]=h):n.lineAttributes&&e.isObservable(n.lineAttributes)&&n.lineAttributes().length>0?(p=n.combineLineItems==l.COMBINE_YES?h.hashCode():h.hashCode(a.commerceItemId),t[p]=h):(p=h.hashCode(),t&&t[p]&&null!==t[p]&&t[p].quantity&&h.quantity(parseInt(h.quantity())+parseInt(t[p].quantity())),t[p]=h));var T=i+":"+c;d[T]=p}),t},{}),h={},f=new Object,m=0;m<t.length;m++)for(var I=0;I<t[m].items.length;I++){var y=t[m].items[I],v=y.productId,b=y.catRefId,T=v.concat(b),P=y.commerceItemId;n.isConfigurableItem(y)&&(T=T.concat(P)),(y.addOnItem||n.combineLineItems===l.COMBINE_NO&&!n.isConfigurableItem(y))&&(T=P);var C=m+":"+I;f[T]?f[T]=f[T]+","+C:f[T]=C}for(var _=0;_<n.items().length;_++){var A=!!(n.lineAttributes&&e.isObservable(n.lineAttributes)&&n.lineAttributes().length>0);if(n.isConfigurableItem(n.items()[_])||A){var O=[];if(n.isConfigurableItem(n.items()[_])){var R=n.items()[_],T=R.productId.concat(R.catRefId).concat(R.commerceItemId),N=[];f[T]&&(N=f[T].split(","));for(var D=0;D<N.length;D++){var L=d[N[D]],w=p[L];w.sgID=n.items()[_].productId+n.items()[_].catRefId+L+D,w.shippable=n.items()[_].shippable,w.assetbale=n.items()[_].assetable,O.push(w)}}else if(A){var M=0;O=Object.keys(p).reduce(function(e,t){if(p[t].productId==n.items()[_].productId&&p[t].catRefId==n.items()[_].catRefId&&(r&&!S.isHardRefresh&&n.combineLineItems===l.COMBINE_YES||(!r||S.isHardRefresh||n.combineLineItems===l.COMBINE_NO)&&p[t].commerceItemId==n.items()[_].commerceItemId)){var i=p[t];i.shippable=n.items()[_].shippable,i.assetbale=n.items()[_].assetable,i.sgID=n.items()[_].productId+n.items()[_].catRefId+n.items()[_].commerceItemId+M,M++,delete p[t],e.push(i)}return e},[])}if(S.isHardRefresh=!1,i){if(!n.items()[_].productData()||null===n.items()[_].productData()){n.items()[_].shippingGroupRelationships.removeAll();for(var U=0;U<O.length;U++)n.items()[_].shippingGroupRelationships.push(O[U]);n.items()[_].shippingGroupRelationships.valueHasMutated()}}else{for(var k=[],x=0;x<n.items()[_].shippingGroupRelationships().length;x++){var G=n.items()[_].shippingGroupRelationships()[x],F=n.combineLineItems==l.COMBINE_YES?G.hashCode():G.hashCode(n.items()[_].commerceItemId),P=n.items()[_].commerceItemId,H=!1;s.each(O,function(e,t){if(A&&(n.combineLineItems==l.COMBINE_YES&&t.hashCode()===F||n.combineLineItems==l.COMBINE_NO&&t.hashCode(P)===F)||!A&&t.hashCode()===F)return G.update(t,r),h[F]=G,H=!0,O.splice(e,1),!1}),H||r||(h[F]&&h[F].updatableQuantity(parseInt(h[F].updatableQuantity())+parseInt(G.quantity())),k.push(x))}if(k.length>0)for(var M=k.length-1;M>=0;M--)n.items()[_].shippingGroupRelationships.splice(k[M],1);n.items()[_].shippingGroupRelationships.valueHasMutated(),O.length>0&&s.each(O,function(e,t){n.items()[_].shippingGroupRelationships().push(t)}),n.storeConfiguration.largeCartConfig.enableOptimizedUpdatesofItems&&n.items()[_].shippingGroupRelationships.valueHasMutated(),(!n.items()[_].shippingGroupRelationships||n.items()[_].shippingGroupRelationships()&&0===n.items()[_].shippingGroupRelationships().length)&&n.items().splice(_,1)}}else if(!c.isPathEqualTo(n.checkoutLink)||c.isPathEqualTo(n.checkoutLink)&&r){var O=[],R=n.items()[_];if(R.addOnItem||n.combineLineItems===l.COMBINE_NO)var T=R.commerceItemId;else var T=R.productId.concat(R.catRefId);var N=[];f[T]&&(N=f[T].split(","));for(var D=0;D<N.length;D++){var L=d[N[D]],w=p[L];w.sgID=n.items()[_].productId+n.items()[_].catRefId+L+D,O.push(w)}if(i){if(!n.items()[_].productData()||null===n.items()[_].productData()){n.items()[_].shippingGroupRelationships.removeAll();for(var U=0;U<O.length;U++)n.items()[_].shippingGroupRelationships.push(O[U]);n.items()[_].shippingGroupRelationships.valueHasMutated()}}else{for(var k=[],x=0;x<n.items()[_].shippingGroupRelationships().length;x++){var G=n.items()[_].shippingGroupRelationships()[x],F=G.hashCode(),H=!1;s.each(O,function(e,t){if(t.hashCode()===F)return G.update(t,r),h[F]=G,H=!0,O.splice(e,1),!1}),H||r||(h[F]&&h[F].updatableQuantity(parseInt(h[F].updatableQuantity())+parseInt(G.quantity())),k.push(x))}if(k.length>0)for(var M=k.length-1;M>=0;M--)n.items()[_].shippingGroupRelationships.splice(k[M],1);n.items()[_].shippingGroupRelationships.valueHasMutated(),O.length>0&&s.each(O,function(e,t){n.items()[_].shippingGroupRelationships().push(t)}),n.storeConfiguration.largeCartConfig.enableOptimizedUpdatesofItems&&n.items()[_].shippingGroupRelationships.valueHasMutated(),(!n.items()[_].shippingGroupRelationships||n.items()[_].shippingGroupRelationships()&&0===n.items()[_].shippingGroupRelationships().length)&&n.items().splice(_,1)}}else{if(!r&&i)continue;for(var V=[],M=0,k=[],Y=0;Y<n.items()[_].shippingGroupRelationships().length;Y++){var B=n.items()[_].shippingGroupRelationships()[Y],q=B.hashCode();if(n.combineLineItems===l.COMBINE_NO&&(q=B.hashCode(B.commerceItemId)),V.length>0&&V.indexOf(q)!=-1)h[q]&&!r&&h[q].updatableQuantity(parseInt(h[q].updatableQuantity())+parseInt(B.quantity())),k.push(Y);else{if(p&&p[q]){var j=p[q];B.update(j,r),h[q]=B,V.push(q),delete p[q]}else{var O=Object.keys(p).reduce(function(e,t){if(p[t].productId==n.items()[_].productId&&p[t].catRefId==n.items()[_].catRefId){var r=p[t];r.sgID=n.items()[_].productId+n.items()[_].catRefId+M,delete p[t],e.push(r)}return e},[]);n.items()[_].shippingGroupRelationships.remove(B);for(var U=0;U<O.length;U++)n.items()[_].shippingGroupRelationships.push(O[U])}M++}}if(k.length>0){for(var M=k.length-1;M>=0;M--)n.items()[_].shippingGroupRelationships.splice(k[M],1);n.storeConfiguration.largeCartConfig.enableOptimizedUpdatesofItems&&n.items()[_].shippingGroupRelationships.valueHasMutated()}}}return r?p:void 0}},S.prototype.createChildItemsKeyList=function(e){var t=this;e||(e=t.items());for(var r=[],i=0;i<e.length;i++)t.isConfigurableItem(e[i])&&t.addChildItemsToKeyList(r,e[i]);return r},S.prototype.addChildItemsToKeyList=function(e,t){var r=this;if(t.childItems&&""!==t.childItems&&t.childItems.length>0)for(var i=0;i<t.childItems.length;i++){var a=r.getKeyForChildItemUsingItemProperties(t.childItems[i]);e.push(a),t.childItems[i].childItems&&r.addChildItemsToKeyList(e,t.childItems[i])}},S.prototype.getKeyForChildItemUsingItemProperties=function(e){return e.productId+"_"+e.catRefId+"_"+e.commerceItemId},S.prototype.splitItems=function(e,t,r){var i=this,a=!1;i.combineLineItems=l.COMBINE_NO,i.events.push(new w(W,11,e)),i.removeItem(e);for(var o=0;o<t.length;o++){var n={productId:e.productId,productData:e.productData(),quantity:t[o],catRefId:e.catRefId,selectedOptions:e.selectedOptions,currency:i.currency,externalData:e.externalData(),actionCode:e.actionCode(),lineAttributes:i.lineAttributes,externalRecurringCharge:e.externalRecurringCharge(),externalRecurringChargeFrequency:e.externalRecurringChargeFrequency(),externalRecurringChargeDuration:e.externalRecurringChargeDuration(),assetKey:e.assetKey(),rootAssetKey:e.rootAssetKey(),parentAssetKey:e.parentAssetKey(),serviceId:e.serviceId(),customerAccountId:e.customerAccountId(),billingAccountId:e.billingAccountId(),serviceAccountId:e.serviceAccountId(),billingProfileId:e.billingProfileId(),activationDate:e.activationDate(),deactivationDate:e.deactivationDate(),transactionDate:e.transactionDate(),asset:e.asset(),childItems:e.childItems,addOnItem:e.addOnItem,shopperInput:e.shopperInput,commerceItemId:i.generateCommerceItemId(),soldAsPackage:e.soldAsPackage,assetable:e.assetable,shippable:e.shippable,allowVirtualShippingGroup:i.storeConfiguration.allowVirtualShippingGroup,isVirtualShippingGroup:e.isVirtualShippingGroup},s=new I(n);s.populateItemDynamicProperties(r[o]),s.isPersonalized(!0),!a&&R(e.discountInfo())&&(s.giftWithPurchaseCommerceItemMarkers=e.giftWithPurchaseCommerceItemMarkers,a=!0),i.items.push(s)}i.getCartAvailability(),i.markDirty()},S.prototype.addItemToCart=function(t,r,i,a){function n(e,t,r){var i=[{errorCode:e,catRefId:t,errorMessage:r}];return i}function c(e,t){for(var r=[],a=0;a<t.length;a++){var o={errorCode:t[a].errorCode,catRefId:t[a].catRefId,errorMessage:t[a].errorMessage};r.push(o)}"function"==typeof i&&i(e,r)}var d=this;d.storeConfiguration.isLargeCart()===!0&&void 0===a&&(a=r);var u=[];u.push(t.catalogRefId),d.isConfigurableItem(t)&&t.childItems&&t.childItems.length>0&&d.addSkuIdFromConfigurableProduct(u,t);var p=d.getBatchSizeForProdAndSkuData(u);p<0&&(p=u.length);for(var g=new Array,f=0;f<u.length;f){for(var m=[],I=0;I<p&&f<u.length;I++,f++)m.push(u[f]);var E=new Array(d.catalogId(),m,!0,d.priceListGroupId(),!0);g.push(d.getSkuDataBatch(E,n))}s.when.apply(null,g).done(function(i){var i=new Array;i.deletedSkus=[],i.items=[];for(var u=0;u<arguments.length;u++){var p=arguments[u];i.deletedSkus=null!=p.deletedSkus?i.deletedSkus.concat(p.deletedSkus):i.deletedSkus,i.items=i.items.concat(p.items||p)}for(var g,f=[],m=!0,I=i.items?i.items:i,u=0;u<I.length;u++)I[u].parentProducts[0]&&!I[u].parentProducts[0].active&&(f.push(I[u].repositoryId),m=!1);if(m){for(var u=0;u<I.length;u++){var E=s.extend(!0,{},I[u]);if(E.repositoryId==t.catalogRefId){g=E.parentProducts[0];var y=E;delete y[l.PARENT_PRODUCTS],g.childSKUs=[y],E.productVariantOptions&&E.productVariantOptions.length>0&&(g.selectedOptions=E.productVariantOptions[0]),g.soldAsPackage=E.soldAsPackage,g.orderQuantity=parseInt(t.quantity),g.itemTotal=t.amount,g.price=t.externalPrice,g.catalogRefId=t.catalogRefId,d.isConfigurableItem(t)&&void 0!=t.configuratorId&&null!=t.configuratorId&&""!=t.configuratorId&&(g.configuratorId=t.configuratorId),g.externalData=t.externalData,g.actionCode=t.actionCode,g.externalRecurringCharge=t.externalRecurringCharge,g.externalRecurringChargeFrequency=t.externalRecurringChargeFrequency,g.externalRecurringChargeDuration=t.externalRecurringChargeDuration,g.assetKey=t.assetKey,g.rootAssetKey=t.rootAssetKey,g.parentAssetKey=t.parentAssetKey,g.serviceId=t.serviceId,g.customerAccountId=t.customerAccountId,g.billingAccountId=t.billingAccountId,g.serviceAccountId=t.serviceAccountId,g.billingProfileId=t.billingProfileId,g.activationDate=t.activationDate,g.deactivationDate=t.deactivationDate,g.asset=t.asset,d.cpqConfigMap&&d.cpqConfigMap.size>0&&d.cpqConfigMap.get(t.catalogRefId)&&null!==d.cpqConfigMap.get(t.catalogRefId)&&(g.selectedStore=e.observable(d.cpqConfigMap.get(t.catalogRefId).selectedStore),d.cpqConfigMap.set(t.catalogRefId,null)),g.transactionDate=t.transactionDate;break}}d.isConfigurableItem(t)&&(g.childItems=d.createChildItemTree(I,t));var v=new M(g,d.catalogId()),b={};b[l.ENDPOINT_KEY]=l.ENDPOINT_PRODUCTS_AVAILABILITY,b[l.IDENTIFIER_KEY]="stockStatsForItem";var T=d.storeConfiguration.getFilterToUse(b);T&&(v[l.FILTER_KEY]=T),null!==g.selectedStore&&e.isObservable(g.selectedStore)&&g.selectedStore()&&(v[l.LOCATION_IDS]=g.selectedStore().locationId);var P={},S=d.getThreshholdSizeForStockStatusData(v.products)<0?l.ENDPOINT_PRODUCTS_AVAILABILITY:l.ENDPOINT_LIST_STOCK_STATUS_LARGE_CART;P[l.PRODUCTS_PARAM]=v.products,P[l.CATALOG]=v.catalogId,h.request(S,P,function(e){for(var i=[],s=!0,u=0;u<e.length;u++)"IN_STOCK"!=e[u].stockStatus&&"PREORDERABLE"!=e[u].stockStatus&&"BACKORDERABLE"!=e[u].stockStatus&&(i.push(e[u].catRefId),s=!1);if(s){var p=d.getCookieDataAndCompare(),h=d.getCartItemForReconfiguration(g.id,g.childSKUs[0].repositoryId,g.configuratorId);null!==h?d.events.push(new w(j,1,g)):d.events.push(new w(k,1,g));var f={pricingsuccess:function(e){f&&"function"==typeof r&&(r(g),f=null)},pricingfailure:function(e){f&&(c(t,n(l.PRODUCT_ADD_TO_CART_PRICING_ERROR,"",e.message)),f=null)},addItemSuccess:function(e){f&&"function"==typeof a&&(a(g),f.addItemSuccess=null)}};d.setCallbackFunctions(f),p&&!d.isMatchingCookieData()?(d.getLocalData(p),0==p.items.length&&d.addItem(g)):d.addItem(g)}else{for(var m=[],u=0;u<i.length;u++){var I={sku:i[u]},E={errorCode:l.PRODUCT_ADD_TO_CART_OUT_OF_STOCK,catRefId:i[u],errorMessage:o.t("ns.common:resources.skuOutOfStockError",I)};m.push(E)}c(g,m)}},function(e){c(t,n(l.PRODUCT_ADD_TO_CART_INVENTORY_ERROR,"",e.message))})}else{for(var C=[],u=0;u<f.length;u++){var _={sku:f[u]},A={errorCode:l.CREATE_ORDER_SKU_NOT_FOUND,catRefId:f[u],errorMessage:o.t("ns.common:resources.skuNotFoundError",_)};C.push(A)}c(t,C)}}).fail(function(e){for(var r=0;r<arguments.length;r++){var i;i=arguments[r]}c(t,i)})},S.prototype.getSkuDataBatch=function(e,t){var r=this,i=s.Deferred(),a={},o={};o[l.ENDPOINT_KEY]=l.ENDPOINT_PRODUCTS_LIST_SKUS,o[l.IDENTIFIER_KEY]="skuListing";var n=r.storeConfiguration.getFilterToUse(o);n&&(a[l.FILTER_KEY]=n),a[l.EXCLUDE]=l.EXCLUDE_FILTERED_SKUS;var c=r.storeConfiguration.getEndpointConfiguration(o);if(void 0!==c&&null!==c){var d=c[l.PRE_FILTER];void 0!==d&&null!==d&&d===!0&&(a[l.PRE_FILTER]=d);var u=c[l.SKIP_EXCLUDE];void 0!==u&&null!==u&&u===!0&&delete a[l.EXCLUDE]}return r.adapter.loadJSON("sku",e,a,function(e){i.resolve(e)},function(e){i.reject(t(l.PRODUCT_ADD_TO_CART_GET_SKU_ERROR,"",e.message))}),i},S.prototype.addItemsToCart=function(e,t,r,i,a,n){function c(e,t,r){var i=[{errorCode:e,catRefId:t,errorMessage:r}];return i}function d(e){for(var t=[],i=0;i<e.length;i++){var a={errorCode:e[i].errorCode,catRefId:e[i].catRefId,errorMessage:e[i].errorMessage};t.push(a)}"function"==typeof r&&r(t)}var u,p=this,g=[],f=e.length,m=new Array,I=new Array;I.deletedSkus=[],I.items=[];for(var E=0;E<f;E++)if(u=e[E],u.catalogRefId?g.push(u.catalogRefId):u.catRefId&&g.push(u.catRefId),u.childItems)for(var y=0;y<u.childItems.length;y++)u.childItems[y].catalogRefId?g.push(u.childItems[y].catalogRefId):u.childItems[y].catRefId&&g.push(u.childItems[y].catRefId);var v=[],b=function(r){var n,u=[],g=[],f=[],m=!0,I=!1,E=!1,y=r.items||r;if(r.deletedSkus&&r.deletedSkus.length>0)for(var b=[],T=0;T<r.deletedSkus.length;T++)for(var P=0;P<e.length;P++)e[P].catalogRefId!=r.deletedSkus[T]&&e[P].catRefId!=r.deletedSkus[T]||g.push({displayName:e[P].displayName||r.deletedSkus[T]});0==y.length&&d(c(l.NONE_OF_THE_ITEMS_ADDED,"",o.t("ns.common:resources.noneOfTheItemsCanBeAdded")));for(var S=0;S<y.length;S++)y[S].parentProducts[0]&&!y[S].parentProducts[0].active?(g.push({displayName:y[S].parentProducts[0].displayName,SKUId:y[S].repositoryId}),m=!1):y[S]&&y[S].parentProducts[0]&&y[S].parentProducts[0].notForIndividualSale&&(g.push({displayName:y[S].parentProducts[0].displayName}),E=!0),y[S]&&y[S].configurable&&(f.push(y[S]),I=!0);for(var C,_=e.length,S=0;S<y.length;S++){var A=s.extend(!0,{},y[S]);if(A.listPrice||!i)for(var O=null,R=0;R<_;R++){O&&(A=O),C=e[R];var N=C.catalogRefId;if(N||(N=C.catRefId),A.repositoryId==N&&(A.listPrice||!i)&&(O=s.extend(!0,{},y[S]),n=A.parentProducts[0],n.active&&!n.notForIndividualSale)){var D=A;delete D[l.PARENT_PRODUCTS],n.childSKUs=[D],A.productVariantOptions&&A.productVariantOptions.length>0&&(n.selectedOptions=A.productVariantOptions[0]),n.orderQuantity=parseInt(C.orderQuantity),n.orderQuantity||(void 0!=C.quantityDesired?n.orderQuantity=parseInt(C.quantityDesired()):n.orderQuantity=parseInt(C.quantity)),n.itemTotal=C.amount,n.catalogRefId=C.catalogRefId,n.catalogRefId||(n.catalogRefId=C.catRefId),C.configurationId&&(n.configuratorId=C.configurationId),C.childItems&&(n.childItems=C.childItems),p.combineLineItems===l.COMBINE_NO&&C.commerceItemId&&(n.commerceItemId=p.generateCommerceItemId()),C.dynamicProperties&&(n.dynamicProperties=C.dynamicProperties),u.push(n)}}else g.push({displayName:A.parentProducts[0].displayName})}if(0==u.length)return void d(c(l.NONE_OF_THE_ITEMS_ADDED,"",o.t("ns.common:resources.noneOfTheItemsCanBeAdded")));var L=new U(u,p.catalogId()),M={};M[l.ENDPOINT_KEY]=l.ENDPOINT_PRODUCTS_AVAILABILITY,M[l.IDENTIFIER_KEY]="stockStatsForItem";var k=p.storeConfiguration.getFilterToUse(M);k&&(L[l.FILTER_KEY]=k);var x={},G=p.getThreshholdSizeForStockStatusData(L.products)<0?l.ENDPOINT_PRODUCTS_AVAILABILITY:l.ENDPOINT_LIST_STOCK_STATUS_LARGE_CART;if(x[l.PRODUCTS_PARAM]=L.products,x[l.CATALOG]=L.catalogId,h.request(G,x,function(e){for(var r=[],i=!0,n=0;n<e.length;n++)"IN_STOCK"!=e[n].stockStatus&&"PREORDERABLE"!=e[n].stockStatus&&"BACKORDERABLE"!=e[n].stockStatus&&(r.push(e[n]),i=!1);for(var n=0;n<u.length;n++)for(var s=0;s<r.length;s++){if(u[n].catalogRefId==r[s].catRefId){r[s].displayName=u[n].displayName,u.splice(n,1),n--;break}if(u[n].childItems&&u[n].childItems.length>0){for(var h=u[n].childItems.length-1;h>=0;h--)u[n].childItems[h].catRefId==r[s].catRefId&&(r[s].displayName=u[n].childItems[s].displayName,u[n].childItems.splice(h,1));if(u[n].childItems&&0==u[n].childItems.length){u.splice(n,1),n--;break}}}if(0==u.length)return void d(c(l.NONE_OF_THE_ITEMS_ADDED,"",o.t("ns.common:resources.noneOfTheItemsCanBeAdded")));var g={pricingsuccess:function(e){g&&"function"==typeof t&&(t(u),g=null)},pricingfailure:function(e){g&&(d(c(l.PRODUCT_ADD_TO_CART_PRICING_ERROR,"",e.message)),g=null)},addItemsSuccess:function(e){g&&"function"==typeof a&&(a(u),g[l.ADD_ITEMS_SUCCESS_CB]=null)}};if(p.setCallbackFunctions(g),p.storeConfiguration.isLargeCart()===!0)p.addItems(u);else{var f=p.getCookieDataAndCompare();p.events.push(new w(z,1,u)),f&&!p.isMatchingCookieData()?(p.getLocalData(f),0==f.items.length&&p.addItems(u)):p.addItems(u)}if(!i){for(var m=r[0].displayName,I=r[0].catRefId,n=1;n<r.length;n++)m=m+" ,"+r[n].displayName,I=I+","+r[n].catRefId;var E={displayName:m},y={errorCode:l.PRODUCT_ADD_TO_CART_OUT_OF_STOCK,catRefId:I,errorMessage:o.t("ns.common:resources.outOfStockError",E)};v.push(y),d(v)}},function(e){d(c(l.PRODUCT_ADD_TO_CART_INVENTORY_ERROR,"",e.message))}),g&&g.length>0){var F={};b=g[0].displayName;for(var H=g[0].SKUId,S=1;S<g.length;S++)b+=g[S].displayName,H=H+","+g[S].SKUId;var F={displayName:b},V={errorCode:l.CREATE_ORDER_SKU_NOT_FOUND,catRefId:H,errorMessage:o.t("ns.common:resources.productNotFoundError",F)};v.push(V)}if(I&&f[0].parentProducts&&f[0].parentProducts[0]){var Y=f[0].repositoryId;b=f[0].parentProducts[0].displayName;for(var S=1;S<f.length;S++)b=b+","+f[S].parentProducts[0].displayName,Y=f[S].repositoryId;var F={displayName:b},V={errorCode:l.CONFIGURABLE_PRODUCTS_NOT_ALLOWED_FAILURE_CODE,catRefId:Y,errorMessage:o.t("ns.common:resources.configurableProductError",F)};v.push(V)}v.length>0&&d(v)};if(n&&n.length>0)b(n);else{var T=p.getBatchSizeForProdAndSkuData(g);if(T<0&&(T=g.length),g.length>0){for(var E=0;E<g.length;E){for(var P=[],y=0;y<T&&E<g.length;y++,E++)P.indexOf(g[E])<0&&P.push(g[E]);var S=new Array(p.catalogId(),P,!0,p.priceListGroupId(),!0);m.push(p.getSkuDataBatch(S,c))}s.when.apply(null,m).done(function(){for(var e=0;e<arguments.length;e++){var t=arguments[e];I.deletedSkus=null!=t.deletedSkus?I.deletedSkus.concat(t.deletedSkus):I.deletedSkus,I.items=I.items.concat(t.items||t)}b(I)}).fail(function(){for(var e,t=0;t<arguments.length;t++)e=arguments[t];d(e)})}else d(c(l.NONE_OF_THE_ITEMS_ADDED,"",o.t("ns.common:resources.noneOfTheItemsCanBeAdded")))}},S.prototype.requestQuote=function(e,t,r,i){var a=this,o={};e&&(o.note=e),t&&(o.orderId=t),t&&(o.id=t),"agentUI"===h.profileType&&(a.contextManager=require("agentViewModels/agent-context-manager").getInstance(),o.profileId=a.user().id().length>0?a.user().id():a.contextManager.getShopperProfileId()),a.adapter.persistCreate("requestQuote","0",a.addDynamicProperties(o),null,r,i)},S.prototype.rejectQuote=function(e,t,r,i){var a={};e&&(a.note=e),t&&(a.orderId=t),t&&(a.id=t),h.request(l.ENDPOINT_QUOTE_REJECT,a,r,i)},S.prototype.addDynamicProperties=function(e){for(var t=this,r=0;r<t.dynamicProperties().length;r++){var i=t.dynamicProperties()[r],a=i.id(),o=null;null!=i.value&&(o=i.value()),e[a]=o}return e},S.getInstance=function(e,t,r,i){return S.singleInstance||(S.isHardRefresh=!0,S.singleInstance=new S(e,t,i,r),S.singleInstance.isPricingRequired(!0),S.singleInstance.getItemDynamicPropertiesMetadata(l.ENDPOINT_COMMERCE_ITEM_TYPE_PARAM)),t&&t.items&&(S.singleInstance.updatedFromRepository=!0,S.singleInstance.getLocalData(t)),r&&S.singleInstance.setContext(r),S.singleInstance},S.prototype.loadTemplateOrderItems=function(e){var i=this;if(i.user()&&i.user().loggedIn()&&!i.user().isUserSessionExpired()){var a={},o={};o[l.ENDPOINT_KEY]=l.ENDPOINT_GET_ORDER,o[l.IDENTIFIER_KEY]="templateOrder";var n=i.storeConfiguration.getFilterToUse(o);n&&(a[l.FILTER_KEY]=n),h.request(l.ENDPOINT_GET_ORDER,a,function(e){var a=e.state;a==l.TEMPLATE||a==l.PENDING_APPROVAL_TEMPLATE||a==l.SCHEDULED_ORDER_STATE_REJECTED||a==l.PENDING_PAYMENT_TEMPLATE?(i.mergeItems(e),i.markDirty(),s.Topic(t.topicNames.LOADED_ORDER_SHIPPING_ADDRESS).publish(e.shippingAddress),s.Topic(t.topicNames.POPULATE_SHIPPING_METHODS).publish(e.shippingMethod.value),
- i.shippingMethod(e.shippingMethod.value),i.cartUpdated(),i.user().validateAndRedirectPage("/cart")):r.sendError("scheduledOrder","Invalid order state.",!0)},function(e){c.goTo(i.contextData.global.links[404].route)},e)}else c.doLogin(c.getPath(),i.contextData.global.links.home.route)},S.prototype.loadOrderItems=function(e){var r=this;r.mergeItems(e),r.getProductData(),s.Topic(t.topicNames.LOADED_ORDER_SHIPPING_ADDRESS).publish(e.shippingAddress),s.Topic(t.topicNames.POPULATE_SHIPPING_METHODS).publish(e.shippingMethod.value),r.shippingMethod(e.shippingMethod.value),r.user().validateAndRedirectPage("/cart")},S.prototype.getParticularIncompleteOrder=function(e){var r=this;r.user()&&r.user().loggedIn()&&r.nonTransientCartCheck()&&h.request(l.ENDPOINT_GET_ORDER,null,function(e){if(void 0===e&&s.Topic(t.topicNames.CART_READY).publish(r),e&&e.orderId){r.user().orderId(e.orderId),r.user().persistedOrder(e),r.user().setLocalData("orderId"),r.cartName(e.cartName);r.removeItems(e);r.mergeItems(e),r.isPricingRequired(!0),r.validateServerCart(),r.storeConfiguration.largeCartConfig.suppressClientCartValidations?r.handleSuppressValidations(e):r.getProductData(),r.getDynamicPropertiesMetadata(!0),r.getItemDynamicPropertiesMetadata(l.ENDPOINT_COMMERCE_ITEM_TYPE_PARAM),r.updateDynamicProperties(e),e.discountInfo.orderImplicitDiscountList&&r.orderDiscountDescList(e.discountInfo.orderImplicitDiscountList),e.discountInfo.unclaimedCouponsMap&&r.populateCoupons(e.discountInfo.unclaimedCouponsMap,l.COUPON_STATUS_UNCLAIMED),e.discountInfo.orderCouponsMap&&r.populateCoupons(e.discountInfo.orderCouponsMap,l.COUPON_STATUS_CLAIMED),r.couponMultiPromotions.splice(0),e.discountInfo.unclaimedCouponMultiPromotions&&r.populateCouponMultiPromotions(e.discountInfo.unclaimedCouponMultiPromotions,l.COUPON_STATUS_UNCLAIMED,l.PROMOTION_NOT_APPLIED),e.discountInfo.claimedCouponMultiPromotions&&r.populateCouponMultiPromotions(e.discountInfo.claimedCouponMultiPromotions,l.COUPON_STATUS_CLAIMED,l.PROMOTION_APPLIED),r.populateClaimedCouponMultiPromotions(r.couponMultiPromotions());for(var i=r.coupons().length-1;i>=0;i--)e.discountInfo.orderCouponsMap.hasOwnProperty(r.coupons()[i].code())||e.discountInfo.unclaimedCouponsMap.hasOwnProperty(r.coupons()[i].code())||r.coupons.splice(i,0);if(e.shippingGroups&&1==e.shippingGroups.length&&r.shippingAddress&&""==r.shippingAddress()&&!(r.user()&&r.user().shippingAddressBook()&&r.user().shippingAddressBook.length>0)){var a={translate:function(e,t){return o.t("ns.common:resources."+e,t)}},n=new g("cart-shipping-address","",a,r.contextData.page.shippingCountriesPriceListGroup,r.contextData.page.defaultShippingCountry);n.copyFrom(e.shippingGroups[0].shippingAddress,r.contextData.page.shippingCountriesPriceListGroup),n.resetModified(),n.validateForShippingMethod()&&(r.shippingAddress(n),r.shippingMethod(e.shippingGroups[0].shippingMethod.value),s.Topic(t.topicNames.CART_SHIPPING_ADDRESS_UPDATED).publishWith())}}},function(e){r.loadCart()},e)},S.prototype.loadCartWithParticularIncompleteOrder=function(e){var t=this;r.clearError(re);t.emptyCart(),t.createNewCart(!1),h.clearStoredValue(l.LOCAL_STORAGE_CREATE_NEW_CART),t.user()&&t.user().loggedIn()&&t.nonTransientCartCheck()&&t.getParticularIncompleteOrder(e)},S.prototype.mergeCartWithParticularIncompleteOrder=function(e){var t=this;t.createNewCart(!1),h.clearStoredValue(l.LOCAL_STORAGE_CREATE_NEW_CART),r.clearError(re);t.user()&&t.user().loggedIn()&&t.nonTransientCartCheck()&&t.getParticularIncompleteOrder(e)},S.prototype.deleteParticularIncompleteOrders=function(e){var r=this;h.request(l.ENDPOINT_REMOVE_PROFILE_INCOMPLETE_ORDER_BY_ID,null,function(i){r.user().orderId()&&""!=r.user().orderId()&&e==r.user().orderId()&&(r.emptyCart(),r.user().orderId(""),r.user().persistedOrder(null),r.user().setLocalData("orderId"),r.cartName(""),r.reloadCart()),s.Topic(t.topicNames.CART_DELETE_SUCCESS).publish()},function(e){s.Topic(t.topicNames.CART_DELETE_ERROR).publish()},e)},S.setApplication=function(e){ae=e},S.prototype.getBatchSizeForProdAndSkuData=function(e){var t=this;return null!=e?P.getEntityCountLimitInGetRequest(t.storeConfiguration.batchSizeForProdAndSkuData,e.length):-1},S.prototype.getThreshholdSizeForStockStatusData=function(e){var t=this;if(null!=e){var r=e.split(",");return P.getEntityCountLimitInGetRequest(t.storeConfiguration.threshholdSizeForStockStatusData,r.length)}return-1},S.prototype.priceCartBeforeRefreshInLargeCart=function(e){var t=this;t.events.push(new w(ee,0,e)),t.hardPricing=!0,t.markDirty()},S.prototype.updateItemPriceForLargeCart=function(e,t){var r=e.childSKUs[0].salePrice?e.childSKUs[0].salePrice:e.childSKUs[0].listPrice;t.itemTotal(t.itemTotal()+r*e.orderQuantity)},S.prototype.updateItemShippingGroupRelationShipForLargeCart=function(e,t){var r,i=t.shippingGroupRelationships().length,a=-1,o=!1;if(1==i)a=0,r=t.shippingGroupRelationships()[a];else for(var n=t.shippingGroupRelationships()[i-1],s=0;s<i-1;s++)if(t.shippingGroupRelationships()[s].hashCode()===n.hashCode()){t.shippingGroupRelationships().splice(-1),a=s,r=t.shippingGroupRelationships()[a],o=!0;break}if(r){var l=e.childSKUs[0].salePrice?e.childSKUs[0].salePrice:e.childSKUs[0].listPrice;void 0===r.price()&&r.price(0),r.price(r.price()+l*e.orderQuantity)}if(o){var c=t.shippingGroupRelationships()[a].quantity()+e.orderQuantity;r.quantity(c),r.updatableQuantity(c)}},S.prototype.updateCartItemDataForLargeCart=function(e){var t=this,r=e.childSKUs[0].salePrice?e.childSKUs[0].salePrice:e.childSKUs[0].listPrice;t.numberOfItems(t.numberOfItems()+e.orderQuantity),t.events=[],t.shippingSurcharge(t.shippingSurcharge()+e.shippingSurcharge),t.subTotal(r*e.orderQuantity+t.subTotal()),t.total(t.total()+r+e.shippingSurcharge),t.saveCartCookie(),t.callbacks&&t.callbacks.hasOwnProperty(l.ADD_ITEM_SUCCESS_CB)&&"function"==typeof t.callbacks[l.ADD_ITEM_SUCCESS_CB]&&t.callbacks[l.ADD_ITEM_SUCCESS_CB](e)},S.prototype.updateCartAfterLoginForLargeCart=function(e){var t=this;t.numberOfItems(t.numberOfItems()+e.shoppingCart.numberOfItems),t.total(t.total()+e.priceInfo.amount),t.subTotal(t.subTotal()+e.priceInfo.subTotal),t.saveCartCookie()},S.prototype.updateCartItemsDataForLargeCart=function(e){var t,r=this,i=0,a=0,o=0;for(t=0;t<e.length;t++){var n=e[t].childSKUs[0].salePrice?e[t].childSKUs[0].salePrice:e[t].childSKUs[0].listPrice;i+=e[t].orderQuantity,a+=e[t].shippingSurcharge,o+=n*e[t].orderQuantity}r.numberOfItems(i+r.numberOfItems()),r.events=[],r.shippingSurcharge(r.shippingSurcharge()+a),r.subTotal(o+r.subTotal()),r.total(r.total()+o+a),r.saveCartCookie(),r.callbacks&&r.callbacks.hasOwnProperty(l.ADD_ITEMS_SUCCESS_CB)&&"function"==typeof r.callbacks[l.ADD_ITEMS_SUCCESS_CB]&&r.callbacks[l.ADD_ITEMS_SUCCESS_CB](e)},S.prototype.handleSuppressValidations=function(e){for(var t=this,r=0;r<t.items().length;r++)for(var i=0;i<e.shoppingCart.items.length;i++)if(e.shoppingCart.items[i].productId===t.items()[r].productId){var a=e.shoppingCart.items[i],o=jQuery.extend(!0,{},a);if(o.configurable=!1,o.childItems=[],t.items()[r].productData(o),t.items()[r].catRefId===o.catRefId){var n=o;n.repositoryId=n.catRefId,t.items()[r].productData().childSKUs=[n]}}1!=this.storeConfiguration.isLargeCart()&&this.storeConfiguration.largeCartConfig.suppressClientCartValidations===!0&&t.updateCartAfterLoginForLargeCart(e),t.updateAllItemsArray(),t.isPricingRequired()&&t.markDirty(),t.cartValidationPending(!0)},S.prototype.handleBlockedPricing=function(e){var t=this;t.storeConfiguration.isLargeCart()===!0&&1==t.hardPricing&&t.callbacks&&t.callbacks.hasOwnProperty(l.PRICING_BLOCKED_CB)&&"function"==typeof t.callbacks[l.PRICING_BLOCKED_CB]&&t.callbacks[l.PRICING_BLOCKED_CB](e)},S.prototype.updateAllItemsArrayOptimzed=function(){var t=this;t.storeConfiguration.largeCartConfig.enableOptimizedUpdatesofItems&&(t.allItems(t.items()),e.utils.arrayForEach(t.placeHolderItems(),function(e){t.allItems.push(e)}))},S}),define("viewModels/paymentDetails",["knockout","ccConstants","pubsub"],function(e,t,r){"use strict";function i(a,o){if(i.singleInstance)throw new Error("Cannot instantiate more than one PaymentDetails, use getInstance(pAdapter, data)");var n=this;return n.nameOnCard=e.observable(),n.cardType=e.observable(),n.cardNumber=e.observable(),n.cardCVV=e.observable(),n.endMonth=e.observable(),n.endYear=e.observable(),n.selectedCardType=e.observable(),n.selectedEndMonth=e.observable(),n.selectedEndYear=e.observable(),n.cardTypeList=e.observableArray(),n.cards=null,n.gateways=null,n.payULatamCountryList=null,n.enabledTypes=null,n.IINPromotionsEnabled=!0,n.monthList=e.observableArray(),n.endYearList=e.observableArray(),n.cardIINPattern=e.observable("[0-9]"),n.cardNumberLength=e.observable("16"),n.cvvLength=e.observable("3"),n.startDateRequired=e.observable(!1),n.endMonthPlaceholderText=e.observable(""),n.endYearPlaceholderText=e.observable(""),n.cardTypePlaceholderText=e.observable(""),n.isCardPaymentDisabled=e.observable(!1),n.isPaypalDisabled=e.observable(!1),n.isCardEnabledForScheduledOrder=e.observable(!1),n.isGiftCardEnabledForScheduledOrder=e.observable(!1),n.isInvoiceEnabledForScheduledOrder=e.observable(!1),n.isCashEnabledForScheduledOrder=e.observable(!1),n.isPayULEnabledForScheduledOrder=e.observable(!1),n.isPaypalEnabledForScheduledOrder=e.observable(!1),n.isCardEnabledForApproval=e.observable(!1),n.isGiftCardEnabledForApproval=e.observable(!1),n.isInvoiceEnabledForApproval=e.observable(!1),n.isCashEnabledForApproval=e.observable(!1),n.isPayULEnabledForApproval=e.observable(!1),n.isPaypalEnabledForApproval=e.observable(!1),n.isValid=function(){return n.nameOnCard.isValid()&&n.cardType.isValid()&&n.cardNumber.isValid()&&n.cardCVV.isValid()&&n.endMonth.isValid()&&n.endYear.isValid()},n.isModified=function(){return n.nameOnCard.isModified||n.cardType.isModified||n.cardNumber.isModified||n.cardCVV.isModified||n.endMonth.isModified||n.endYear.isModified?n.nameOnCard.isModified&&n.nameOnCard.isModified()||n.cardType.isModified&&n.cardType.isModified()||n.cardNumber.isModified&&n.cardNumber.isModified()||n.cardCVV.isModified&&n.cardCVV.isModified()||n.endMonth.isModified&&n.endMonth.isModified()||n.endYear.isModified&&n.endYear.isModified():!!(n.nameOnCard&&n.cardType&&n.cardNumber&&n.cardCVV&&n.endMonth&&n.endYear)},n.resetModified=function(){n.nameOnCard.isModified&&n.nameOnCard.isModified(!1),n.cardType.isModified&&n.cardType.isModified(!1),n.cardNumber.isModified&&n.cardNumber.isModified(!1),n.cardCVV.isModified&&n.cardCVV.isModified(!1),n.endMonth.isModified&&n.endMonth.isModified(!1),n.endYear.isModified&&n.endYear.isModified(!1)},n.validatePaymentDetails=function(){return n.nameOnCard.isModified(!0),n.cardType.isModified(!0),n.cardNumber.isModified(!0),n.cardCVV.isModified(!0),n.endMonth.isModified(!0),n.endYear.isModified(!0),n.isValid()},n.resetPaymentDetails=function(e){n.nameOnCard(null),n.selectedCardType(null),n.cardType(void 0),n.cardNumber(null),n.cardCVV(null),n.selectedEndMonth(void 0),n.selectedEndYear(void 0),n.endMonth(null),n.endYear(null),n.nameOnCard.isModified&&n.nameOnCard.isModified(!1),n.cardType.isModified&&n.cardType.isModified(!1),n.cardNumber.isModified&&n.cardNumber.isModified(!1),n.cardCVV.isModified&&n.cardCVV.isModified(!1),n.endMonth.isModified&&n.endMonth.isModified(!1),n.endYear.isModified&&n.endYear.isModified(!1)},n.resetCVV=function(){n.cardCVV.isModified&&n.cardCVV.isModified(!1),n.cardCVV("")},n.populatePaymentData=function(r,i){if(n.cardTypeList=e.observableArray(r.cards),n.cards=r.cards,n.gateways=r.gateways,n.payULatamCountryList=r.payULatamCountryList,n.cashPaymentCountryList=r.cashPaymentCountryList,n.enabledTypes=r.enabledTypes,n.IINPromotionsEnabled=r.IINPromotionsEnabled,i().isB2BUser()){var a=i().currentOrganization().derivedUseAllPaymentMethodsFromSite;if(void 0!=a&&a)n.enabledTypes=r.enabledTypes;else{for(var o=r.enabledTypes.length,s=i().currentOrganization().derivedPaymentMethods,l=[],c=0;c<o;c++)for(var d=0;d<s.length;d++)r.enabledTypes[c]==s[d]&&l.push(r.enabledTypes[c]);n.enabledTypes=l}}else n.enabledTypes=r.enabledTypes;n.enabledTypes&&n.enabledTypes.indexOf(t.CARD_PAYMENT_TYPE)<0&&n.isCardPaymentDisabled(!0),n.enabledTypes&&n.enabledTypes.indexOf(t.PAYPAL_PAYMENT_TYPE)<0?n.isPaypalDisabled(!0):n.isPaypalDisabled(!1);for(var c=0;c<r.scheduledOrderEnabledGateways.length;c++)r.scheduledOrderEnabledGateways[c]===t.CARD_PAYMENT_TYPE&&n.isCardEnabledForScheduledOrder(!0),r.scheduledOrderEnabledGateways[c]===t.GIFT_CARD_PAYMENT_TYPE&&n.isGiftCardEnabledForScheduledOrder(!0),r.scheduledOrderEnabledGateways[c]===t.INVOICE_PAYMENT_TYPE&&n.isInvoiceEnabledForScheduledOrder(!0),r.scheduledOrderEnabledGateways[c]===t.CASH_PAYMENT_TYPE&&n.isCashEnabledForScheduledOrder(!0),r.scheduledOrderEnabledGateways[c]===t.PAYULATAM_CHECKOUT_TYPE&&n.isPayULEnabledForScheduledOrder(!0),r.scheduledOrderEnabledGateways[c]===t.PAYPAL_PAYMENT_TYPE&&n.isPaypalEnabledForScheduledOrder(!0);for(var c=0;c<r.approvalEnabledGateways.length;c++)r.approvalEnabledGateways[c]===t.CARD_PAYMENT_TYPE&&n.isCardEnabledForApproval(!0),r.approvalEnabledGateways[c]===t.GIFT_CARD_PAYMENT_TYPE&&n.isGiftCardEnabledForApproval(!0),r.approvalEnabledGateways[c]===t.INVOICE_PAYMENT_TYPE&&n.isInvoiceEnabledForApproval(!0),r.approvalEnabledGateways[c]===t.CASH_PAYMENT_TYPE&&n.isCashEnabledForApproval(!0),r.approvalEnabledGateways[c]===t.PAYULATAM_CHECKOUT_TYPE&&n.isPayULEnabledForApproval(!0),r.approvalEnabledGateways[c]===t.PAYPAL_PAYMENT_TYPE&&n.isPaypalEnabledForApproval(!0)},n.createCustomProperties=function(t){var r={};for(var i in t)"string"==typeof t[i]&&(r[t[i]]="");n.customProperties=e.mapping.fromJS(r)},$.Topic(r.topicNames.ORDER_SUBMISSION_SUCCESS).subscribe(this.resetPaymentDetails),$.Topic(r.topicNames.USER_LOGOUT_SUBMIT).subscribe(this.resetPaymentDetails),$.Topic(r.topicNames.USER_SESSION_RESET).subscribe(this.resetPaymentDetails),$.Topic(r.topicNames.ORDER_SUBMISSION_FAIL).subscribe(this.resetCVV),n}return i.getInstance=function(e,t,r){return i.singleInstance||(i.singleInstance=new i(e,t)),t&&i.singleInstance.populatePaymentData(t,r),i.singleInstance},i}),define("viewModels/giftCardViewModel",["knockout","ccConstants","koValidate","ccKoValidateRules","storeKoExtensions","CCi18n","pageLayout/site","viewModels/paymentDetails"],function(e,t,r,i,a,o,n,s){"use strict";function l(){var r=this;if(r.giftCardNumber=e.observable(""),r.maskedGiftCardNumber=e.observable(""),r.giftCardPin=e.observable(""),r.amountInGiftCard=e.observable(""),r.paymentGroupId=e.observable(""),r.amountUsed=e.observable(0),r.isAmountRemaining=e.observable(!1),r.GIFTCARD_PIN_MAX_LENGTH=e.observable(4),r.GIFTCARD_NUMBER_MAX_LENGTH=e.observable(19),r.isPinCleared=e.observable(!1),r.isApplyGiftCardClicked=e.observable(!1),r.IS_GIFT_CARD_PIN_REQUIRED=e.observable(!0),r.triggerValidations=e.observable(!0),l.prototype.setGiftCardNumberMaxLength=function(e){if(e){var t=this;t.GIFTCARD_NUMBER_MAX_LENGTH(e),t.giftCardNumber.extend({validatable:!1}),t.giftCardNumber.extend({required:{params:!0,onlyIf:t.conditionsApply,message:o.t("ns.common:resources.giftCardNumberRequired",{})},maxLength:{params:t.GIFTCARD_NUMBER_MAX_LENGTH(),message:o.t("ns.common:resources.maxlengthValidationMsg",{maxLength:t.GIFTCARD_NUMBER_MAX_LENGTH(),fieldName:o.t("ns.common:resources.giftCardNumberText",{})})}})}},l.prototype.setGiftCardPinDetails=function(e,t){if(void 0!=e&&null!=e&&void 0!=t&&null!=t){var r=this;t<=0&&(e=!1,t=0),r.IS_GIFT_CARD_PIN_REQUIRED(e),r.GIFTCARD_PIN_MAX_LENGTH(t),r.giftCardPin.extend({validatable:!1}),r.giftCardPin.extend({required:{params:r.IS_GIFT_CARD_PIN_REQUIRED(),onlyIf:r.conditionsApply,message:o.t("ns.common:resources.giftCardPinRequired",{})},maxLength:{params:r.GIFTCARD_PIN_MAX_LENGTH(),message:o.t("ns.common:resources.maxlengthValidationMsg",{maxLength:r.GIFTCARD_PIN_MAX_LENGTH(),fieldName:o.t("ns.common:resources.giftCardPinText",{})})}})}},s.getInstance()&&s.getInstance().enabledTypes&&s.getInstance().enabledTypes.indexOf(t.GIFT_CARD_PAYMENT_TYPE)>-1){var i=n.getInstance();for(var a in i.extensionSiteSettings){var c=i.extensionSiteSettings[a];if(c[t.PAYMENT_METHOD_TYPES]&&c[t.PAYMENT_METHOD_TYPES].indexOf(t.GIFT_CARD_PAYMENT_TYPE)!=-1){void 0!=c.giftCardMaxLength&&r.GIFTCARD_NUMBER_MAX_LENGTH(c.giftCardMaxLength),void 0!=c.giftCardPinRequired&&void 0!=c.giftCardPinMaxLength&&(r.IS_GIFT_CARD_PIN_REQUIRED(c.giftCardPinRequired),r.GIFTCARD_PIN_MAX_LENGTH(c.giftCardPinMaxLength));break}}}r.setGiftCardNumberMaxLength(r.GIFTCARD_NUMBER_MAX_LENGTH()),r.setGiftCardPinDetails(r.IS_GIFT_CARD_PIN_REQUIRED(),r.GIFTCARD_PIN_MAX_LENGTH()),r.isValid=function(){return r.giftCardNumber.isValid()&&r.giftCardPin.isValid()},r.conditionsApply=function(){return r.triggerValidations()},r.validateNow=function(){return r.giftCardNumber.isModified(!0),r.giftCardPin.isModified(!0),r.isValid()},r.reset=function(){r.giftCardNumber(""),r.maskedGiftCardNumber(""),r.giftCardPin(""),r.amountInGiftCard(""),r.amountUsed(0),r.giftCardNumber.isModified(!1),r.giftCardPin.isModified(!1),r.isApplyGiftCardClicked(!1)},r.clearPin=function(){r.giftCardPin("")},r.createCustomProperties=function(t){var i={};for(var a in t)"string"==typeof t[a]&&(i[t[a]]="");r.customProperties=e.mapping.fromJS(i)}}return l}),define("ccStoreServerLogger",["knockout","pubsub","jquery","ccRestClient","ccConstants","storageApi","pageViewTracker"],function(e,t,r,i,a,o,n){"use strict";function s(){if(s.singleInstance)throw new Error("Cannot instantiate more than one CCStoreServerLogger. Use getInstance() method");var e=this;e.loggingEnabled=!0;var c="",d="",u=[],p=[],h=["debug","info","warning","error"],g={getPage:"0001",paymentTimeOut:"0002",createOrderFailure:"0003",updateOrderFailure:"0004",paymentGroupFailure:"0005",orderSubmissionFailure:"0006"},f={getPage:"Landed on __pageId__ page",paymentTimeOut:"Unable to Authorize payment due to time-out, while placing order for order ID __orderId__",createOrderFailure:"Unable to create order due to error code __errorCode__",updateOrderFailure:"Unable to update the order with order ID __orderId__ due to error code __errorCode__",paymentGroupFailure:"Unable to place order for order ID __orderId__ as the payment state is found to be __paymentState__ for the payment group ID __paymentGroupId__",orderSubmissionFailure:"Order Submission Failed for order with order ID __orderId__"},m={error:"[ERROR]",warning:"[WARN]",info:"[INFO]",debug:"[DEBUG]"},I=function(e){try{o.getInstance().setItem("logLevel",e)}catch(e){}},E=function(){var e=null;try{e=o.getInstance().getItem("logLevel")}catch(e){}return e},y=function(e){var t=[];switch(e){case"debug":t.push("debug");case"info":t.push("info");case"warning":t.push("warning");case"error":t.push("error");break;default:t=u}return t};e.setDefaultLogLevel=function(){"info"!=c&&(c="info",u=y(c),I(c))},e.setLogLevel=function(e){h.indexOf(e.toLowerCase())>-1&&c!=e.toLowerCase()&&(c=e.toLowerCase(),u=y(c),I(e))},E()?(c=E().toLowerCase(),u=y(c)):e.setDefaultLogLevel();var v=function(e){try{o.getInstance().setItem("pageIdListToLog",e)}catch(e){}},b=function(){var e=null;try{e=o.getInstance().getItem("pageIdListToLog"),e=e.split(",")}catch(e){}return e};if(e.setPagesToLog=function(e){null!=e&&(p=e,v(p))},e.addPageIdToLog=function(e){p.indexOf(e)<0&&(p.push(e),v(p))},e.disablePageIdToLog=function(e){var t=this;null!=e&&p.indexOf(e)>-1&&(p.splice(p.indexOf(e),1),t.setPagesToLog(p))},b())p=b();else{var T=["checkout","payment","confirmation"];e.setPagesToLog(T)}var P=function(e,t){var r={},o=function(e){},n=function(e){};null!=t&&null!=e&&(r={logLevel:e,messages:t},i.request(a.ENDPOINT_LOGS_CREATE_LOG,r,o,n))},S=function(e,t,r){var i=m[r];if(null!=i){var a=n.getVisitorId(),o=n.getVisitId(),s=e+"-"+i+" "+t+", "+o+", "+a,l={LogData:s},c=[];c.push(l),P(r,c)}},C=function(e,t,r,i,a){a.loggingEnabled&&u.indexOf(t)>-1&&p.indexOf(d)>-1&&null!=r&&(null!=e&&""!=e||(e=l),null==i&&(i=g[e],null==i&&(i=e)),S(i,r,t))};e.logInfo=function(e,t,r){var i=this,a="info";C(e,a,t,r,i)},e.logWarning=function(e,t,r){var i=this,a="warning";C(e,a,t,r,i)},e.logDebug=function(e,t,r){var i=this,a="debug";C(e,a,t,r,i)},e.logError=function(e,t,r){var i=this,a="error";C(e,a,t,r,i)},e.getMessage=function(e,t){var r="";if(null!=e){var i=f[e];if(null!=i)for(var a=0;a<Object.keys(t).length;a++)r=Object.keys(t)[a],i=i.replace("__"+r+"__",t[r])}return i};var _=function(e,t){d=t.pageId};r.Topic(t.topicNames.PAGE_LAYOUT_LOADED).subscribe(_)}var l="UnstatedEvent";return s.getInstance=function(){return s.singleInstance||(s.singleInstance=new s),s.singleInstance},s}),define("viewModels/cashViewModel",["knockout","pageLayout/site","ccConstants","viewModels/paymentDetails"],function(e,t,r,i){"use strict";function a(){if(a.singleInstance)throw new Error("Cannot instantiate more than one cashViewModels, use getInstance()");var n=this;n.isPayingByCash=e.observable(!1),n.isCashPaymentEnabled=e.observable(!1),n.paymentDetails=i.getInstance(),n.setCashEnabledCountries=function(){for(var e in t.getInstance().extensionSiteSettings){var i=t.getInstance().extensionSiteSettings[e];i[r.PAYMENT_METHOD_TYPES]&&i[r.PAYMENT_METHOD_TYPES].split(",").indexOf(r.CASH_PAYMENT_TYPE)!=-1&&i[r.SELECTED_COUNTRIES]&&(o=i[r.SELECTED_COUNTRIES])}},n.verifyCashPaymentToBeEnabled=function(e){n.paymentDetails.enabledTypes.indexOf(r.CASH_PAYMENT_TYPE)!=-1&&o.indexOf(e)!=-1?n.isCashPaymentEnabled(!0):(n.isCashPaymentEnabled(!1),n.isPayingByCash(!1))},n.createCustomProperties=function(t){var r={};for(var i in t)"string"==typeof t[i]&&(r[t[i]]="");n.customProperties=e.mapping.fromJS(r)}}var o=[];return a.getInstance=function(){return a.singleInstance||(a.singleInstance=new a),a.singleInstance},a}),define("ccClientErrorCodes",[],function(){"use strict";function e(){}return e.SYNTAX_ERROR="15000",e.REFERENCE_ERROR="15001",e.TYPE_ERROR="15002",e.EVAL_ERROR="15003",e.RANGE_ERROR="15004",e.URI_ERROR="15005",e.GENERIC_ERROR="15006",e.NO_SPECIFIED_ERROR="15007",e.FILE_IS_NOT_AN_EXTENSION="15008",e}),define("sfExceptionHandler",["knockout","ccRestClient","ccConstants","ccClientErrorCodes","pubsub","pageViewTracker"],function(e,t,r,i,a,o){"use strict";function n(){}var s,l,c,d,u=[],p=0,h=10,g={},f=[],m="";return n.prototype.subscribe=function(){s=this,s.logWindowOnErrorBinding=s.logWindowOnError.bind(s),s.logExceptionErrorBinding=s.logExceptionError.bind(s),$.Topic(a.topicNames.EXCEPTION_HANDLER).subscribe(s.logExceptionErrorBinding),$.Topic(a.topicNames.ONERROR_EXCEPTION_HANDLER).subscribe(s.logWindowOnErrorBinding)},n.prototype.getErrorCode=function(e){return e?(e=e.toLowerCase(),c=e==="RangeError".toLowerCase()||e==="RangeError:".toLowerCase()?i.RANGE_ERROR:e==="TypeError".toLowerCase()||e==="TypeError:".toLowerCase()?i.TYPE_ERROR:e==="SyntaxError".toLowerCase()||e==="SyntaxError:".toLowerCase()?i.SYNTAX_ERROR:e==="ReferenceError".toLowerCase()||e==="ReferenceError:".toLowerCase()?i.REFERENCE_ERROR:e==="EvalError".toLowerCase()||e==="EvalError:".toLowerCase()?i.EVAL_ERROR:e==="URIError".toLowerCase()||e==="URIError:".toLowerCase()?i.URI_ERROR:i.GENERIC_ERROR):c=i.NO_SPECIFIED_ERROR,c},n.prototype.logExceptionError=function(e){s=this,s.errorCode=s.getErrorCode(e.name),s.errorUrl=location.href,s.errorLine="",s.errorMessage="";var t;for(t in e)"fileName"===t?s.errorUrl=e[t]:"lineNumber"===t&&(s.errorLine=e[t]);s.errorMessage=e.toString(),!s.errorLine&&e.line>0&&(s.errorLine=e.line),s.sendErrorReport(s.errorMessage,s.errorLine,s.errorUrl,s.errorCode)},n.prototype.logWindowOnError=function(e,t,r,i,a){s=this;var o,n,l,c=e.split(" ");for(n=0,l=c.length;n<l;n+=1)if(c[n].indexOf("Error")>=0){o=c[n];break}s.errorCode=s.getErrorCode(o),s.errorCode||(s.errorCode=" "),e?s.errorMessage=e:s.errorMessage=" ",t?s.errorUrl=t:s.errorUrl=" ",r?s.errorLine=r:s.errorLine=" ",i?s.errorCol=i:s.errorCol=" ",a&&(s.errorObj=a),s.sendErrorReport(s.errorMessage,s.errorLine,s.errorUrl,s.errorCode,s.errorCol,s.errorObj)},navigator.findBrowserVersion=function(){var e,t,r=navigator.appName,i=navigator.userAgent;return t=i.match(/(opera|chrome|safari|firefox|msie)\/?\s*(\.?\d+(\.\d+)*)/i),t&&null!==(e=i.match(/version\/([\.\d]+)/i))&&(t[2]=e[1]),t=t?[t[1],t[2]]:[r,navigator.appVersion,"-?"]}(),n.prototype.sendErrorReport=function(e,t,r,i,a,n){var s=o.getVisitorId(),c=o.getVisitId(),d=window.location.href,g=null;n&&(g=n.stack),"undefined"!=typeof e&&p<h&&(p+=1,l={message:e,url:r,browserURL:d,line:t,column:a,osVersion:window.navigator.platform,locale:window.navigator.language,browserVersion:navigator.findBrowserVersion[0]+" "+navigator.findBrowserVersion[1],time:(new Date).toISOString(),clientErrorCode:i,visitorId:s,visitId:c,stack:g},m=i+"#"+d+"#"+r+"#"+t+"#"+a,f.indexOf(m)<0&&(f.push(m),u.push(l),this.reportErrorsToServer()))},n.prototype.reportErrorsToServer=function(){u.length>0&&(d=r.ENDPOINT_ERRORLOGS_CREATE_ERRORLOG,g={},g={clientSideErrors:u},t.request(d,g,this.sendSuccess,this.sendError),u=[],p=0)},n.prototype.sendSuccess=function(e){},n.prototype.sendError=function(e){},n}),define("viewModels/cash",["knockout","ccConstants","koMapping"],function(e,t,r){"use strict";function i(){var i=this;i.paymentMethodType=t.CASH_PAYMENT_TYPE,i.type=t.CASH_PAYMENT_TYPE,i.amount=e.observable(),i.billingAddress=e.observable(void 0),i.seqNum=null,i.message=e.observable(),i.paymentGroupId=null,i.isEdit=e.observable(!1),i.createCustomProperties=function(t){var r={};for(var a in t)"string"==typeof t[a]&&(r[t[a]]="");i.customProperties=e.mapping.fromJS(r)},i.toJSON=function(){var e=r.defaultOptions().ignore;r.defaultOptions().ignore=["message","paymentGroupId","gatewayName","isAmountRemaining","paymentMethod","paymentState","uiIntervention","isEdit"];var t=r.toJS(i);return r.defaultOptions().ignore=e,t},i.resetPaymentDetails=function(){},i.validatePaymentData=function(){return!0}}return i}),define("viewModels/creditCard",["knockout","ccConstants","CCi18n","koMapping","ccStoreUtils","ccStoreConfiguration"],function(e,t,r,i,a,o){"use strict";function n(){var n=this;n.paymentMethodType=t.CARD_PAYMENT_TYPE,n.type=t.CARD_PAYMENT_TYPE,n.amount=e.observable(),n.billingAddress=e.observable(void 0),n.nameOnCard=e.observable(),n.cardType=e.observable(),n.cardNumber=e.observable(),n.cardCVV=e.observable(),n.expiryMonth=e.observable(),n.expiryYear=e.observable(),n.nickname=e.observable(),n.isSavedCard=e.observable(),n.saveCard=e.observable(),n.setAsDefault=e.observable(),n.endMonth=e.observable(),n.endYear=e.observable(),n.triggerValidations=e.observable(!0),n.seqNum=null,n.cardIINPattern=e.observable("[0-9]"),n.cardNumberLength=e.observable("16"),n.cvvLength=e.observable("3"),n.startDateRequired=e.observable(!1),n.message=e.observable(),n.maskedNumber=e.observable(),n.paymentGroupId=null,n.gatewayName=null,n.uiIntervention=null,n.isEdit=e.observable(!1),n.isCardPaymentDisabled=e.observable(!1),Object.defineProperty(n,"gatewayName",{value:null,enumerable:!1,writable:!0}),Object.defineProperty(n,"uiIntervention",{value:null,enumerable:!1,writable:!0}),n.createCustomProperties=function(t){var r={};for(var i in t)"string"==typeof t[i]&&(r[t[i]]="");n.customProperties=e.mapping.fromJS(r)},n.toJSON=function(){var e=i.defaultOptions().ignore,t=i.defaultOptions().include;i.defaultOptions().ignore=["cardIINPattern","cardNumberLength","cvvLength","startDateRequired","message","maskedNumber","paymentGroupId","gatewayName","uiIntervention","isAmountRemaining","paymentMethod","paymentState","isCardPaymentDisabled","triggerValidations","isEdit","isSavedCard","isDefault","repositoryId"],n.isSavedCard()&&(i.defaultOptions().include=["seqNum","amount","type"],s!=o.getInstance().isCVVRequiredForSavedCards()&&(s=o.getInstance().isCVVRequiredForSavedCards()),i.defaultOptions().ignore.push("nameOnCard","billingAddress","cardNumber","expiryMonth","expiryYear","iin","nickname","cardType","hasExpired"),null!=s&&0==s?n.cardCVV&&null!=n.cardCVV()?i.defaultOptions().include.push("cardCVV"):i.defaultOptions().ignore.push("cardCVV"):i.defaultOptions().include.push("cardCVV"));var r=i.toJS(n);return n.billingAddress()&&(delete r.billingAddress,r.billingAddress=n.billingAddress().toJSON()),i.defaultOptions().ignore=e,i.defaultOptions().include=t,r},n.setMaskedNumber=function(e,t){n.maskedNumber(n.cardNumber().replace(e,t))},n.conditionsApply=function(){return!n.isSavedCard()&&n.triggerValidations()&&n.paymentMethodType==t.CARD_PAYMENT_TYPE&&!n.isCardPaymentDisabled()},n.conditionsApplyForCVV=function(){return!(n.isSavedCard()&&!o.getInstance().isCVVRequiredForSavedCards())&&n.triggerValidations()&&n.paymentMethodType==t.CARD_PAYMENT_TYPE&&!n.isCardPaymentDisabled()},n.nameOnCard.extend({required:{params:!0,onlyIf:n.conditionsApply,message:r.t("ns.common:resources.nameOnCardRequired")}}),n.cardType.extend({required:{params:!0,onlyIf:n.conditionsApply,message:r.t("ns.common:resources.cardTypeRequired")}}),n.cardNumber.extend({required:{params:!0,onlyIf:n.conditionsApply,message:r.t("ns.common:resources.cardNumberRequired")},maxLength:{params:t.CYBERSOURCE_CARD_NUMBER_MAXIMUM_LENGTH,message:r.t("ns.common:resources.cardNumberMaxLength",{maxLength:t.CYBERSOURCE_CARD_NUMBER_MAXIMUM_LENGTH})},creditcard:{params:{iin:n.cardIINPattern,length:n.cardNumberLength},onlyIf:n.conditionsApply,message:r.t("ns.common:resources.cardNumberInvalid")}}),n.cardCVV.extend({required:{params:!0,onlyIf:n.conditionsApplyForCVV,message:r.t("ns.common:resources.cardCVVRequired")},minLength:{params:3,onlyIf:n.conditionsApplyForCVV,message:r.t("ns.common:resources.cardCVVNumberMinLength")},maxLength:{params:4,onlyIf:n.conditionsApplyForCVV,message:r.t("ns.common:resources.cardCVVNumberMaxLength")},number:{param:!0,message:r.t("ns.common:resources.cardCVVNumberInvalid")},cvv:{params:n.cvvLength,onlyIf:n.conditionsApplyForCVV,message:r.t("ns.common:resources.cardCVVInvalid")}}),n.expiryMonth.extend({required:{params:!0,onlyIf:n.conditionsApply,message:r.t("ns.common:resources.endMonthRequired")},endmonth:{params:n.expiryYear,message:r.t("ns.common:resources.endMonthInvalid")}}),n.expiryYear.extend({required:{params:!0,onlyIf:n.conditionsApply,message:r.t("ns.common:resources.endYearRequired")}}),n.resetPaymentDetails=function(e){n.nameOnCard(null),n.cardType(null),n.cardNumber(null),n.cardCVV(null),n.expiryMonth(null),n.expiryYear(null),n.nameOnCard.isModified&&n.nameOnCard.isModified(!1),n.cardType.isModified&&n.cardType.isModified(!1),n.cardNumber.isModified&&n.cardNumber.isModified(!1),n.cardCVV.isModified&&n.cardCVV.isModified(!1),n.expiryMonth.isModified&&n.expiryMonth.isModified(!1),n.expiryYear.isModified&&n.expiryYear.isModified(!1),n.isCardPaymentDisabled(!1),void 0!==e&&null!==e&&e!==!1||(n.nameOnCard.extend({validatable:!1}),n.cardType.extend({validatable:!1}),n.cardNumber.extend({validatable:!1}),n.cardCVV.extend({validatable:!1}),n.expiryMonth.extend({validatable:!1}),n.expiryYear.extend({validatable:!1}))},n.resetCardCvv=function(){n.cardCVV(void 0)},n.validatePaymentData=function(){return n.nameOnCard.isModified(!0),n.cardType.isModified(!0),n.cardNumber.isModified(!0),n.cardCVV.isModified(!0),n.expiryMonth.isModified(!0),n.expiryYear.isModified(!0),n.billingAddress()&&n.billingAddress().validateNow&&n.billingAddress().validateNow(),n.isValid()},n.isModified=function(){return n.nameOnCard.isModified()||n.cardType.isModified()||n.cardNumber.isModified()||n.cardCVV.isModified()||n.expiryMonth.isModified()||n.expiryYear.isModified()},n.resetModified=function(){n.nameOnCard.isModified(!1),n.cardType.isModified(!1),n.cardNumber.isModified(!1),n.cardCVV.isModified(!1),n.expiryMonth.isModified(!1),n.expiryYear.isModified(!1)},n.isValid=function(){var e=!0;return n.nameOnCard.isValid()&&n.cardType.isValid()&&n.cardNumber.isValid()&&n.cardCVV.isValid()&&n.expiryMonth.isValid()&&n.expiryYear.isValid()||(e=!1),n.billingAddress()&&n.billingAddress().isValid&&!n.billingAddress().isValid()&&(e=!1),e},n.populateData=function(e){var t=this,r=!1,i=[],o=[],n=[];a.fromJS(e,t,r,i,o,n)}}var s=o.getInstance().isCVVRequiredForSavedCards();return n}),define("viewModels/giftCard",["knockout","ccConstants","CCi18n","pageLayout/site","koMapping"],function(e,t,r,i,a){
- "use strict";function o(){var o=this;o.paymentMethodType=t.GIFT_CARD_PAYMENT_TYPE,o.type=t.GIFT_CARD_PAYMENT_TYPE,o.amount=e.observable(),o.amountInGiftCard=e.observable(),o.billingAddress=e.observable(void 0),o.giftCardNumberMaxLength=e.observable(19),o.giftCardPinMaxLength=e.observable(4),o.isGiftCardPinRequired=e.observable(!0),o.message=e.observable(),o.paymentGroupId=null,o.maskedNumber=e.observable(),o.isGiftCardReApplied=e.observable(!1),o.giftCardNumber=e.observable(),o.giftCardPin=e.observable(),o.isEdit=e.observable(!1),o.triggerValidations=e.observable(!0),o.seqNum=null;var n=i.getInstance();for(var s in n.extensionSiteSettings){var l=n.extensionSiteSettings[s];if(l[t.PAYMENT_METHOD_TYPES]&&l[t.PAYMENT_METHOD_TYPES].indexOf(t.GIFT_CARD_PAYMENT_TYPE)!=-1){void 0!=l.giftCardMaxLength&&o.giftCardNumberMaxLength(l.giftCardMaxLength),void 0!=l.giftCardPinRequired&&void 0!=l.giftCardPinMaxLength&&(o.isGiftCardPinRequired(l.giftCardPinRequired),o.giftCardPinMaxLength(l.giftCardPinMaxLength));break}}o.createCustomProperties=function(t){var r={};for(var i in t)"string"==typeof t[i]&&(r[t[i]]="");o.customProperties=e.mapping.fromJS(r)},o.toJSON=function(){var e=a.defaultOptions().ignore;a.defaultOptions().ignore=["giftCardNumberMaxLength","giftCardPinMaxLength","isGiftCardPinRequired","message","paymentGroupId","maskedNumber","balance","gatewayName","isAmountRemaining","maskedCardNumber","paymentMethod","paymentState","uiIntervention","isGiftCardReApplied","triggerValidations","isEdit"];var t=a.toJS(o);return a.defaultOptions().ignore=e,t},o.setMaskedNumber=function(e,t){o.maskedNumber(o.giftCardNumber().replace(e,t))},o.conditionsApply=function(){return o.triggerValidations()&&o.paymentMethodType==t.GIFT_CARD_PAYMENT_TYPE},o.giftCardNumber.extend({required:{params:!0,onlyIf:o.conditionsApply,message:r.t("ns.common:resources.giftCardNumberRequired",{})},maxLength:{params:o.giftCardNumberMaxLength(),message:r.t("ns.common:resources.maxlengthValidationMsg",{maxLength:o.giftCardNumberMaxLength(),fieldName:r.t("ns.common:resources.giftCardNumberText",{})})}}),o.giftCardPin.extend({required:{params:o.isGiftCardPinRequired(),onlyIf:o.conditionsApply,message:r.t("ns.common:resources.giftCardPinRequired",{})},maxLength:{params:o.giftCardPinMaxLength(),onlyIf:function(){return o.paymentMethodType==t.GIFT_CARD_PAYMENT_TYPE},message:r.t("ns.common:resources.maxlengthValidationMsg",{maxLength:o.giftCardPinMaxLength(),fieldName:r.t("ns.common:resources.giftCardPinText",{})})}}),o.resetPaymentDetails=function(){o.giftCardNumber(null),o.giftCardPin(null),o.giftCardNumber.isModified&&o.giftCardNumber.isModified(!1),o.giftCardNumber.extend({validatable:!1}),o.giftCardPin.isModified&&o.giftCardPin.isModified(!1),o.giftCardPin.extend({validatable:!1})},o.resetGiftCardPin=function(){o.giftCardPin(null)},o.validatePaymentData=function(){return o.giftCardNumber.isModified(!0),o.giftCardPin.isModified(!0),o.isValid()},o.isValid=function(){return o.giftCardNumber.isValid()&&o.giftCardPin.isValid()}}return o}),define("viewModels/invoice",["knockout","ccConstants","CCi18n","koMapping"],function(e,t,r,i){"use strict";function a(){var a=this;a.paymentMethodType=t.INVOICE_PAYMENT_TYPE,a.type=t.INVOICE_PAYMENT_TYPE,a.amount=e.observable(),a.billingAddress=e.observable(void 0),a.message=e.observable(),a.paymentGroupId=null,a.maskedNumber=e.observable(""),a.isEdit=e.observable(!1),a.PONumber=e.observable(),a.seqNum=null,a.PONumber.extend({maxLength:{params:t.PONUMBER_MAXIMUM_LENGTH,message:r.t("maxPOLengthValidationMsg",{maxLength:t.PONUMBER_MAXIMUM_LENGTH})}}),a.createCustomProperties=function(t){var r={};for(var i in t)"string"==typeof t[i]&&(r[t[i]]="");a.customProperties=e.mapping.fromJS(r)},a.toJSON=function(){var e=i.defaultOptions().ignore;i.defaultOptions().ignore=["message","paymentGroupId","maskedNumber","gatewayName","isAmountRemaining","paymentMethod","paymentState","uiIntervention","isEdit"];var t=i.toJS(a);return i.defaultOptions().ignore=e,a.billingAddress()&&(delete t.billingAddress,t.billingAddress=a.billingAddress().toJSON()),t},a.setMaskedNumber=function(e,t){a.PONumber()&&a.maskedNumber(a.PONumber().replace(e,t))},a.resetPaymentDetails=function(){a.PONumber(null),a.PONumber.isModified&&a.PONumber.isModified(!1),a.PONumber.extend({validatable:!1})},a.validatePaymentData=function(){return a.PONumber.isModified(!0),a.billingAddress()&&a.billingAddress().validateNow&&a.billingAddress().validateNow(),a.isValid()},a.isValid=function(){var e=!0;return a.PONumber.isValid()||(e=!1),a.billingAddress()&&a.billingAddress().isValid&&!a.billingAddress().isValid()&&(e=!1),e}}return a}),define("viewModels/paypal",["knockout","ccConstants","koMapping"],function(e,t,r){"use strict";function i(){var i=this;i.paymentMethodType=t.PAYPAL_PAYMENT_TYPE,i.type=t.PAYPAL_PAYMENT_TYPE,i.amount=e.observable(),i.billingAddress=e.observable(),i.seqNum=null,i.message=e.observable(),i.paymentGroupId=null,i.isEdit=e.observable(!1),i.createCustomProperties=function(t){var r={};for(var a in t)"string"==typeof t[a]&&(r[t[a]]="");i.customProperties=e.mapping.fromJS(r)},i.toJSON=function(){var e=r.defaultOptions().ignore;r.defaultOptions().ignore=["message","isEdit","seqNum"];var t=r.toJS(i);return r.defaultOptions().ignore=e,t},i.validatePaymentData=function(){return!0},i.updatePaymentData=function(e){i.paymentId=e[t.PAYMENT_ID],i.token=e[t.TOKEN],i.PayerID=e[t.PAYER_ID]},i.resetPaymentDetails=function(){}}return i}),define("viewModels/payu",["knockout","ccConstants","koMapping"],function(e,t,r){"use strict";function i(){var i=this;i.paymentMethodType=t.PAYULATAM_CHECKOUT_TYPE,i.type=t.PAYULATAM_CHECKOUT_TYPE,i.amount=e.observable(),i.billingAddress=e.observable(void 0),i[t.CURRENCY]=void 0,i[t.PAYMENT_ID]=void 0,i[t.TRANSACTION_STATUS]=void 0,i[t.TRANSACTION_TYPE]=void 0,i[t.SIGNATURE]=void 0,i.seqNum=null,i.message=e.observable(),i.paymentGroupId=null,i.isEdit=e.observable(!1),i.createCustomProperties=function(t){var r={};for(var a in t)"string"==typeof t[a]&&(r[t[a]]="");i.customProperties=e.mapping.fromJS(r)},i.toJSON=function(){var e=r.defaultOptions().ignore;r.defaultOptions().ignore=["message","isEdit"];var t=r.toJS(i);return i.billingAddress()&&(delete t.billingAddress,t.billingAddress=i.billingAddress().toJSON()),r.defaultOptions().ignore=e,t},i.validatePaymentData=function(){var e=!0;return i.billingAddress()&&i.billingAddress().isValid&&!i.billingAddress().isValid()&&(e=!1),e},i.updatePaymentDetails=function(e,r){i[t.CURRENCY]=e,i.amount(r)},i.resetPaymentDetails=function(){}}return i}),define("viewModels/loyalty",["knockout","ccConstants","CCi18n","koMapping"],function(e,t,r,i){"use strict";function a(){}return a}),define("viewModels/storeCredit",["knockout","ccConstants","CCi18n","koMapping"],function(e,t,r,i){"use strict";function a(){var r=this;r.paymentMethodType=t.STORE_CREDIT_PAYMENT_TYPE,r.type=t.STORE_CREDIT_PAYMENT_TYPE,r.amount=e.observable(),r.storeCreditNumber=e.observable(),r.triggerValidations=e.observable(!0),r.billingAddress=e.observable(void 0),r.storeCreditNumber.extend({required:!1}),r.isEdit=e.observable(!1),r.seqNum=null,r.message=e.observable(),r.paymentGroupId=null,r.gatewayName=null,r.uiIntervention=null,r.isStoreCreditPaymentDisabled=e.observable(!1),Object.defineProperty(r,"gatewayName",{value:null,enumerable:!1,writable:!0}),Object.defineProperty(r,"uiIntervention",{value:null,enumerable:!1,writable:!0}),r.isEdit=e.observable(!1),r.maskedNumber=e.observable(),r.createCustomProperties=function(t){var i={};for(var a in t)"string"==typeof t[a]&&(i[t[a]]="");r.customProperties=e.mapping.fromJS(i)},r.toJSON=function(){var e=i.defaultOptions().ignore;i.defaultOptions().ignore=["message","maskedNumber","paymentGroupId","gatewayName","uiIntervention","isAmountRemaining","paymentMethod","paymentState","isStoreCreditPaymentDisabled","triggerValidations"];var t=i.toJS(r);return i.defaultOptions().ignore=e,t},r.setMaskedNumber=function(e,t){r.storeCreditNumber()&&r.maskedNumber(r.storeCreditNumber().replace(e,t))},r.conditionsApply=function(){return r.triggerValidations()&&r.paymentMethodType==t.STORE_CREDIT_PAYMENT_TYPE&&!r.isStoreCreditPaymentDisabled()},r.resetPaymentDetails=function(){r.storeCreditNumber(null)},r.validatePaymentData=function(){return!r.storeCreditNumber()||(r.storeCreditNumber.isModified(!0),r.isValid())},r.isModified=function(){return r.storeCreditNumber.isModified()},r.resetModified=function(){r.storeCreditNumber.isModified(!1)},r.isValid=function(){return r.storeCreditNumber.isValid()}}return a}),define("viewModels/inStorePayment",["knockout","ccConstants","CCi18n","pageLayout/site","koMapping"],function(e,t,r,i,a){"use strict";function o(){var r=this;r.paymentMethodType=t.IN_STORE_PAYMENT_TYPE,r.type=t.IN_STORE_PAYMENT_TYPE,r.amount=e.observable(),r.seqNum=null,r.isEdit=e.observable(!1),r.message=e.observable(),r.createCustomProperties=function(t){var i={};for(var a in t)"string"==typeof t[a]&&(i[t[a]]="");r.customProperties=e.mapping.fromJS(i)},r.toJSON=function(){var e=a.defaultOptions().ignore;a.defaultOptions().ignore=["triggerValidations"];var t=a.toJS(r);return a.defaultOptions().ignore=e,t},r.resetPaymentDetails=function(){},r.validatePaymentData=function(){return!0}}return o}),define("viewModels/pointsPayment",["knockout","ccConstants","CCi18n","koMapping"],function(e,t,r,i){"use strict";function a(){var r=this;r.paymentMethodType=t.LOYALTY_POINTS_PAYMENT_TYPE,r.type=t.LOYALTY_POINTS_PAYMENT_TYPE,r.program=e.observable(null),r.amount=e.observable(),r.billingAddress=e.observable(void 0),r.message=e.observable(),r.seqNum=null,r.currencyCode=e.observable(null),r.isEdit=e.observable(!1),r.createCustomProperties=function(t){var i={};for(var a in t)"string"==typeof t[a]&&(i[t[a]]="");r.customProperties=e.mapping.fromJS(i)},r.toJSON=function(){var e=i.defaultOptions().ignore;if(i.defaultOptions().ignore=["message","paymentGroupId","gatewayName","paymentMethod","paymentState","program","loyaltyPrograms","customPaymentProperties"],r.program()){var t={},a=r.program();$.each(a,function(e,r){"string"==typeof r||r instanceof String?t[e]=r:t[e]=JSON.stringify(r)}),r.customProperties=t}var o=i.toJS(r);return i.defaultOptions().ignore=e,r.billingAddress()&&(delete o.billingAddress,o.billingAddress=r.billingAddress().toJSON()),o},r.resetPaymentDetails=function(){r.program(null),r.amount(null),r.billingAddress(null),r.message(null),r.currencyCode(null)},r.validatePaymentData=function(){return!0}}return a}),define("viewModels/paymentsViewModel",["knockout","pubsub","ccConstants","ccRestClient","CCi18n","pageLayout/site","viewModels/cash","viewModels/creditCard","viewModels/giftCard","viewModels/invoice","viewModels/paypal","viewModels/payu","viewModels/loyalty","viewModels/storeCredit","navigation","pageLayout/order","ccStoreConfiguration","viewModels/inStorePayment","notifier","viewModels/pointsPayment"],function(e,t,r,i,a,o,n,s,l,c,d,u,p,h,g,f,m,I,E,y){"use strict";function v(){if(v.singleInstance)throw new Error("Cannot instantiate more than one PaymentsViewModel, use getInstance(data)");var p=this;return p.completedPayments=e.observableArray([]),p.pendingPayments=e.observableArray([]),p.failedPayments=e.observableArray([]),p.paymentDue=e.observable(),p.loyaltyPaymentDue=e.observable(),p.minimumMonetaryAmountDue=e.observable(0),p.historicalCompletedPayments=e.observableArray([]),p.historicalCompletedLoyaltyPayments=e.observableArray([]),p.cashEnabledCountries=[],p.scheduleOrderEnabledGateways=[],p.approvalEnabledGateways=[],p.isCardGatewayGeneric=!1,p.paypalPaymentGroupId=e.observable(),p.isLoyaltyEnabled=e.observable(!1),p.isCardPaymentDisabled=e.observable(!1),p.isPaypalDisabled=e.observable(!1),p.isPaypalVerified=e.observable(!1),p.isStoreCreditEnabled=e.observable(!1),p.isInStorePaymentEnabled=e.observable(!1),p.isCashPaymentEnabled=e.observable(!1),p.isPayuLPaymentEnabled=e.observable(!1),p.isCVVRequiredForSavedCards=!0,p.allowSavingCards=!1,p.isCardEnabledForScheduledOrder=e.observable(!1),p.isGiftCardEnabledForScheduledOrder=e.observable(!1),p.isInvoiceEnabledForScheduledOrder=e.observable(!1),p.isCashEnabledForScheduledOrder=e.observable(!1),p.isPayULEnabledForScheduledOrder=e.observable(!1),p.isPaypalEnabledForScheduledOrder=e.observable(!1),p.isLoyaltyEnabledForScheduledOrder=e.observable(!1),p.isStoreCreditEnabledForScheduledOrder=e.observable(!1),p.isInStorePaymentEnabledForScheduledOrder=e.observable(!1),p.isCardEnabledForApproval=e.observable(!1),p.isGiftCardEnabledForApproval=e.observable(!1),p.isInvoiceEnabledForApproval=e.observable(!1),p.isCashEnabledForApproval=e.observable(!1),p.isPayULEnabledForApproval=e.observable(!1),p.isPaypalEnabledForApproval=e.observable(!1),p.isLoyaltyEnabledForApproval=e.observable(!1),p.isStoreCreditEnabledForApproval=e.observable(!1),p.isInStorePaymentEnabledForApproval=e.observable(!1),p.totalAmountAuthorized=e.observable(0),p.totalAmountAuthorizedOnVoid=e.observable(0),p.partialPaymentOption="",p.toBeVoidedPayments=e.observableArray([]),p.amountRemaining="",p.primaryCurrencyAmountRemaining="",p.primaryCurrencyTotalAmountAuthorized=e.observable(0),p.isBalanceDueAPICallInProgress=e.observable(!1),p.excludeFieldsMap=["amount","cardNumber","cardType","giftCardNumber","seqNum","customPaymentProperties"],p.setCashEnabledCountries=function(){for(var e in o.getInstance().extensionSiteSettings){var t=o.getInstance().extensionSiteSettings[e];t[r.PAYMENT_METHOD_TYPES]&&t[r.PAYMENT_METHOD_TYPES].split(",").indexOf(r.CASH_PAYMENT_TYPE)!=-1&&t[r.SELECTED_COUNTRIES]&&(p.cashEnabledCountries=t[r.SELECTED_COUNTRIES])}},p.populatePaymentData=function(t,i){if(p.cardTypeList=e.observableArray(t.cards),p.gateways=t.gateways,p.payULatamCountryList=t.payULatamCountryList,p.paymentMethods=e.observableArray(),i().isB2BUser()){var o=i().currentOrganization().derivedUseAllPaymentMethodsFromSite;if(void 0!=o&&o)p.enabledTypes=t.enabledTypes;else{for(var n=t.enabledTypes.length,s=i().currentOrganization().derivedPaymentMethods,l=[],c=0;c<n;c++)for(var d=0;d<s.length;d++)t.enabledTypes[c]==s[d]&&l.push(t.enabledTypes[c]);p.enabledTypes=l}}else p.enabledTypes=t.enabledTypes;p.enabledTypes&&p.enabledTypes.indexOf(r.CARD_PAYMENT_TYPE)<0&&p.isCardPaymentDisabled(!0),p.enabledTypes&&p.enabledTypes.indexOf(r.PAYPAL_PAYMENT_TYPE)<0?p.isPaypalDisabled(!0):p.isPaypalDisabled(!1),p.enabledTypes&&p.enabledTypes.indexOf(r.STORE_CREDIT_PAYMENT_TYPE)!=-1?p.isStoreCreditEnabled(!0):p.isStoreCreditEnabled(!1),p.enabledTypes&&p.enabledTypes.indexOf(r.IN_STORE_PAYMENT_TYPE)!=-1&&p.isInStorePaymentEnabled(!0),p.enabledTypes&&p.enabledTypes.indexOf(r.PAYULATAM_CHECKOUT_TYPE)!=-1&&p.isPayuLPaymentEnabled(!0),p.enabledTypes&&p.enabledTypes.indexOf(r.CASH_PAYMENT_TYPE)!=-1?p.isCashPaymentEnabled(!0):p.isCashPaymentEnabled(!1),p.setCashEnabledCountries(),p.scheduleOrderEnabledGateways=t.scheduledOrderEnabledGateways,p.approvalEnabledGateways=t.approvalEnabledGateways,p.isCardGatewayGeneric=t.isCardGatewayGeneric,p.isCVVRequiredForSavedCards=t.isCVVRequiredForSavedCards,m.getInstance().isCVVRequiredForSavedCards(null!=t.isCVVRequiredForSavedCards&&1==t.isCVVRequiredForSavedCards),p.allowSavingCards=t.allowSavingCards,m.getInstance().allowSavingCards(null!=t.allowSavingCards&&1==t.allowSavingCards);for(var c=0;c<t.scheduledOrderEnabledGateways.length;c++)t.scheduledOrderEnabledGateways[c]===r.CARD_PAYMENT_TYPE&&p.isCardEnabledForScheduledOrder(!0),t.scheduledOrderEnabledGateways[c]===r.GIFT_CARD_PAYMENT_TYPE&&p.isGiftCardEnabledForScheduledOrder(!0),t.scheduledOrderEnabledGateways[c]===r.INVOICE_PAYMENT_TYPE&&p.isInvoiceEnabledForScheduledOrder(!0),t.scheduledOrderEnabledGateways[c]===r.CASH_PAYMENT_TYPE&&p.isCashEnabledForScheduledOrder(!0),t.scheduledOrderEnabledGateways[c]===r.PAYULATAM_CHECKOUT_TYPE&&p.isPayULEnabledForScheduledOrder(!0),t.scheduledOrderEnabledGateways[c]===r.PAYPAL_PAYMENT_TYPE&&p.isPaypalEnabledForScheduledOrder(!0),t.scheduledOrderEnabledGateways[c]===r.LOYALTY_POINTS_PAYMENT_TYPE&&p.isLoyaltyEnabledForScheduledOrder(!0),t.scheduledOrderEnabledGateways[c]===r.STORE_CREDIT_PAYMENT_TYPE&&p.isStoreCreditEnabledForScheduledOrder(!0),t.scheduledOrderEnabledGateways[c]===r.IN_STORE_PAYMENT_TYPE&&p.isInStorePaymentEnabledForScheduledOrder(!0);for(var c=0;c<t.approvalEnabledGateways.length;c++)t.approvalEnabledGateways[c]===r.CARD_PAYMENT_TYPE&&p.isCardEnabledForApproval(!0),t.approvalEnabledGateways[c]===r.GIFT_CARD_PAYMENT_TYPE&&p.isGiftCardEnabledForApproval(!0),t.approvalEnabledGateways[c]===r.INVOICE_PAYMENT_TYPE&&p.isInvoiceEnabledForApproval(!0),t.approvalEnabledGateways[c]===r.CASH_PAYMENT_TYPE&&p.isCashEnabledForApproval(!0),t.approvalEnabledGateways[c]===r.PAYULATAM_CHECKOUT_TYPE&&p.isPayULEnabledForApproval(!0),t.approvalEnabledGateways[c]===r.PAYPAL_PAYMENT_TYPE&&p.isPaypalEnabledForApproval(!0),t.approvalEnabledGateways[c]===r.LOYALTY_POINTS_PAYMENT_TYPE&&p.isLoyaltyEnabledForApproval(!0),t.approvalEnabledGateways[c]===r.STORE_CREDIT_PAYMENT_TYPE&&p.isStoreCreditEnabledForApproval(!0),t.approvalEnabledGateways[c]===r.IN_STORE_PAYMENT_TYPE&&p.isInStorePaymentEnabledForApproval(!0);for(var c=0;c<p.enabledTypes.length;c++)p.enabledTypes[c]==r.CASH_PAYMENT_TYPE?p.paymentMethods().push({name:a.t("ns.common:resources.cashPaymentMethod"),value:p.enabledTypes[c]}):p.enabledTypes[c]==r.LOYALTY_POINTS_PAYMENT_TYPE?i().loggedIn()&&!i().isUserSessionExpired()?(p.isLoyaltyEnabled(!0),p.paymentMethods().push({name:a.t("ns.common:resources.loyaltyPoints"),value:p.enabledTypes[c]})):p.isLoyaltyEnabled(!1):p.paymentMethods().push({name:a.t("ns.common:resources."+p.enabledTypes[c]),value:p.enabledTypes[c]})},p.createPaymentAuthDetails=function(t,r,i,a,o){var n={};return n.emailAddress=t,n.billingAddress=r,n.paymentDetails=i,o.payments=[],o.payments.push(e.toJS(a)),n.orderDetails=o,n},p.createPaymentGroup=function(t){var i=null;switch(t){case r.CARD_PAYMENT_TYPE:i=new s;break;case r.GIFT_CARD_PAYMENT_TYPE:i=new l;break;case r.CASH_PAYMENT_TYPE:i=new n;break;case r.INVOICE_PAYMENT_TYPE:i=new c;break;case r.PAYPAL_PAYMENT_TYPE:i=new d;break;case r.PAYULATAM_CHECKOUT_TYPE:i=new u;break;case r.LOYALTY_POINTS_PAYMENT_TYPE:i=new y;break;case r.STORE_CREDIT_PAYMENT_TYPE:i=new h;break;case r.IN_STORE_PAYMENT_TYPE:i=new I}return i.useDefaultBillingAddress=e.observable(!1),i.isDefaultAddressValid=e.observable(!0),i},p.processPayments=function(t,a,o,n,s,l,c){var d=this,u=null;u=c?c:d.pendingPayments();for(var p=0;p<u.length;p++)if(!u[p].validatePaymentData())return;var h={};o&&(h.orderId=o),n&&(h.uuid=n),s&&(h.profileId=s),l&&(h.channel=l);var g=[];c&&c.length>0?g=d.preparePaymentsRequest(c):d.pendingPayments()&&d.pendingPayments().length>0&&(g=d.preparePaymentsRequest(d.pendingPayments())),h[r.PAYMENTS]=g;var f=function(r){var i=[];i=c?c:d.pendingPayments();for(var a=0;a<r.paymentResponses.length;a++)for(var o=0;o<i.length;o++)if(r.paymentResponses[a].seqNum==i[o].seqNum){for(var n in r.paymentResponses[a])$.inArray(n,d.excludeFieldsMap)==-1&&(e.isObservable(i[o][n])?i[o][n](r.paymentResponses[a][n]):i[o][n]=r.paymentResponses[a][n]);break}t(r)};i.request(r.ADD_ORDER_PAYMENTS,h,f,a)},p.inquireBalance=function(e,t,a,o){var n={};n.op=r.INQUIRE_GIFT_CARD_BALANCE;var s=[];a&&a.length>0&&(s=p.preparePaymentsRequest(a)),n[r.PAYMENTS]=s,o&&(n[r.PROFILE_ID]=o),i.request(r.ADD_ORDER_PAYMENTS,n,e,t)},p.calculateBalanceDue=function(e,t,a){if(!p.isBalanceDueAPICallInProgress()){p.isBalanceDueAPICallInProgress(!0);var o=p.prepareRequestForCalculateBalanceAPI(a);i.request(r.ENDPOINT_CALCULATE_REMAINING_BALANCE,o,function(t){p.isBalanceDueAPICallInProgress(!1),e(t)},function(e){p.isBalanceDueAPICallInProgress(!1),t(e)})}},p.prepareRequestForCalculateBalanceAPI=function(e){var t=0,i=0,a="";a=e[r.ALTERNATE_CURRENCY].currencyType===r.LOYALTY_POINTS_PAYMENT_TYPE?e[r.ALTERNATE_CURRENCY].currencyCode:e.plgCurrency.currencyCode;for(var o=e[r.PAYMENTS],n=0,s=0;s<o.length;s++)n=o[s].amount(),isNaN(n)&&(n=0),o[s].type===r.LOYALTY_POINTS_PAYMENT_TYPE?(t+=parseFloat(n),null==a?a=o[s].currencyCode:a!==o[s].currencyCode):i+=parseFloat(n);var l={};return null==e.plgCurrency.currencyType?(l[r.AMOUNT]=i,l[r.ALTERNATE_CURRENCY_CODE]=a,l[r.ALTERNATE_CURRENCY_AMOUNT]=t):(l[r.AMOUNT]=t,l[r.ALTERNATE_CURRENCY_CODE]=e[r.ALTERNATE_CURRENCY].currencyCode,l[r.ALTERNATE_CURRENCY_AMOUNT]=i),l.orderId=e.pOrderId,e.pProfileId&&(l.profileId=e.pProfileId),l},p.preparePaymentsRequest=function(e){for(var t=[],r=0;r<e.length;r++){e[r].seqNum=r.toString();var i={},a=null;a=e[r].toJSON&&$.isFunction(e[r].toJSON)?e[r].toJSON():e[r];for(var o in a)$.isFunction(a[o])||(i[o]=a[o]);t.push(i)}return t},p.resetPaymentsContainer=function(){p.isPaypalVerified()||(p.completedPayments([]),p.pendingPayments([]),p.failedPayments([]),p.historicalCompletedPayments([]),p.historicalCompletedLoyaltyPayments([]),p.toBeVoidedPayments([]),p.paymentDue(0),p.loyaltyPaymentDue(0),p.minimumMonetaryAmountDue(0))},p.populateViewModelWithServerData=function(e,t){if(t.paymentResponses&&t.paymentResponses.length>0)for(var r in t.paymentResponses[0])e[r]=t.paymentResponses[0][r]},p.hasSufficientPoints=function(e,t,r){var i=!1;if(e&&e.selectedProgramDetails()&&e.selectedProgramDetails().loyaltyPointDetails)for(var a=e.selectedProgramDetails().loyaltyPointDetails,o=0;o<a.length;o++)if(a[o].pointsType&&a[o].pointsType==t&&a[o].pointsBalance&&a[o].pointsBalance>=r){i=!0;break}return i},p.updatePaymentGatewayData=function(e){var t=e.parameters;if(t){for(var i=t.split("&"),a={},o=0;o<i.length;o++){var n=i[o].split("=");a[n[0]]=n[1]}if(a[r.TOKEN]&&!a[r.PAYMENT_ID]&&a[r.PAYMENT_TYPE]===r.PAYPAL_PAYMENT_TYPE&&(a[r.PAYMENT_ID]=a[r.TOKEN]),a[r.PAYMENT_ID]&&a[r.TOKEN]&&a[r.PAYER_ID]){var s=p.createPaymentGroup(r.PAYPAL_PAYMENT_TYPE);s.updatePaymentData(a),p.isPaypalVerified(!0),p.pendingPayments().length>0?p.pendingPayments()[0].paymentMethodType==r.PAYPAL_PAYMENT_TYPE&&(p.pendingPayments()[0]=s):p.pendingPayments().unshift(s)}else if(t.indexOf(r.PAYU_REFERENCE_POL)!=-1){var l=a[r.PAYU_TRANSACTION_STATE];if(l==r.PAYU_TRANSACTION_APPROVED_CODE||l==r.PAYU_TRANSACTION_PENDING_CODE||l==r.PAYU_TRANSACTION_DECLINED_CODE||l==r.PAYU_TRANSACTION_EXPIRED_CODE||l==r.PAYU_TRANSACTION_ERROR_CODE){a[r.PAYU_REFERENCE_CODE],a[r.PAYU_TX_VALUE],a[r.CURRENCY],a[r.SIGNATURE]}}else p.isPaypalVerified(!1)}else p.isPaypalVerified()&&g.getPathWithoutLocale()!=p.checkoutLink&&(p.isPaypalVerified(!1),p.resetPaymentsContainer())},p.populateGiftCardsCallBack=function(e,t){if(p.pendingPayments().length>0)for(var i=0;i<p.pendingPayments().length;i++)if("physicalGiftCard"==p.pendingPayments()[i].paymentMethodType){var a={},o=p.pendingPayments()[i];a.type=r.GIFT_CARD_PAYMENT_TYPE,a.giftCardNumber=o.giftCardNumber(),a.giftCardPin=o.giftCardPin(),o.amountInGiftCard()&&(t&&t.type===b&&t.product.giftCardNumber()===o.giftCardNumber()||(a.amount=o.amountInGiftCard())),e.payments.push(a)}},p.updateGiftCardDetailsCallBack=function(e,t){var i=[];if(e.payments&&p.pendingPayments().length>0){for(var o=0;o<p.pendingPayments().length;o++){for(var n=!1,s=p.pendingPayments()[o],l=0;l<e.payments.length;l++){var c=e.payments[l];if(c.paymentMethod==r.GIFT_CARD_PAYMENT_TYPE&&s.giftCardNumber()==c.giftCardNumber){s.amountInGiftCard(c.balance),s.amount(c.amount),s.maskedNumber(c.maskedCardNumber),n=!0;break}}0==n&&i.push(s)}for(var d=0;d<i.length;d++)p.pendingPayments.remove(function(e){return e.giftCardNumber()==i[d].giftCardNumber()});i&&i.length>0&&E.sendError(T,a.t("ns.common:resources.orderPricingPromotionError"),!0)}},p.retrieveStoreCreditBalance=function(e,t,a){var o=this,n={};i.request(r.ENDPOINT_PAYMENT_GET_GATEWAYS,n,function(i){for(var n=i.paymentGateways,s=0;s<n.length;s++)if(n[s].enabled&&n[s].type===r.GENERIC_PAYMENT_GATEWAY){var l=n[s].agentConfigEnabledTypes||[];if(0==l.length)continue;for(var c=0;c<l.length;c++)if(l[c]===r.STORE_CREDIT_PAYMENT_TYPE){var d=[];d.push({paymentMethodType:r.STORE_CREDIT_PAYMENT_TYPE}),o.inquireBalance(e,t,d,a)}}},function(e){})},p.resetAmountAuthorized=function(){p.totalAmountAuthorized(0),p.primaryCurrencyTotalAmountAuthorized(0),p.totalAmountAuthorizedOnVoid(0)},p.isPaymentAuthorized=function(e){return e==r.PAYMENT_STATE_AUTHORIZED||e==r.PAYMENT_GROUP_STATE_AUTHORIZED||e==r.PAYMENT_STATE_SETTLED||e==r.PAYMENT_GROUP_STATE_SETTLED||e==r.PAYMENT_STATE_PAYMENT_REQUEST_ACCEPTED||e==r.PAYMENT_GROUP_STATE_PAYMENT_REQUEST_ACCEPTED||e==r.PAYMENT_STATE_PAYMENT_DEFERRED||e==r.PAYMENT_GROUP_PAYMENT_DEFERRED},p.isVoidInitiatedForPaymentGroup=function(e){var t=!1;return e.transactionTypeInitiated&&"void"==e.transactionTypeInitiated&&(t=!0),t},p.voidAuthorizedPayment=function(e,t,a,o,n){var s=this,l=[],c={};s.removablePaymentGroup=e.array[e.index],s.removabelPaymentIndex=e.index,c.paymentGroupId=e.array[e.index].paymentGroupId,c.cancelReason=t,l.push(c);var d={},u="voidPayments";d.orderId=a,d[r.PAYMENTS]=l,i.request(u,d,function(e){o(e)},function(e){n(e)})},p.populateCompletedPayments=function(e){for(var t=this,r=e.length,i=0;i<r;i++){var a=t.isVoidInitiatedForPaymentGroup(e[i]);t.isPaymentAuthorized(e[i].paymentState)&&!a&&t.completedPayments.push(e[i])}},p.voidPaymentsInAmendment=function(e,t,r){var i=this,a=i.getDeferredVoidPaymentResponse(e);a.done(function(r){t(r,e)}),a.fail(function(e){r(e)})},p.getDeferredVoidPaymentResponse=function(e){var t=this,a={};a[r.ORDER_ID]=e,a[r.PAYMENTS]=t.toBeVoidedPayments();var o=$.Deferred();return i.request(r.END_POINT_VOID_PAYMENTS,a,function(e){o.resolve(e)},function(e){o.reject(e)}),o.promise()},p.clearAuthorizedPayments=function(){var e=this;e.completedPayments.removeAll()},i.profileType!==r.PROFILE_TYPE_AGENT&&$.Topic(t.topicNames.PAGE_CHANGED).subscribe(p.updatePaymentGatewayData.bind(p)),p}var b=8,T="PaymentsViewModel";return v.getInstance=function(e,t){return v.singleInstance||(v.singleInstance=new v),e&&v.singleInstance.populatePaymentData(e,t),v.singleInstance},v}),define("pageLayout/order",["knockout","pubsub","notifier","CCi18n","ccLogger","ccRestClient","ccConstants","jquery","navigation","spinner","viewModels/address","viewModels/paymentDetails","viewModels/giftCardViewModel","storageApi","viewModels/dynamicProperty","ccStoreServerLogger","viewModels/cashViewModel","pageViewTracker","sfExceptionHandler","ccStoreConfiguration","viewModels/paymentsViewModel","pageLayout/site","currencyHelper","ccStoreUtils"],function(e,t,r,i,a,o,n,s,l,c,d,u,p,h,g,f,m,I,E,y,v,b,T,P){"use strict";function S(a,c,p,h){if(S.prototype.singleInstance)throw new Error("Cannot instantiate more than one OrderViewModel, use OrderViewModel.getInstance(pAdapter, pCart, pData)");var g=this;return o.profileType==n.PROFILE_TYPE_AGENT&&(g.agentConfiguration=require("agentViewModels/agentConfiguration"),g.contextManager=require("agentViewModels/agent-context-manager")),g.cloneOrderData=e.observable(""),g.adapter=a,g.cart=c,g.restClient=o,g.schedule=e.observable(),g.showSchedule=e.observable(!1),g.id=e.observable(),g.billingAddress=e.observable(),g.shippingAddress=e.observable(),g.shippingAddressAsBilling=e.observable(!1),g.paymentDetails=e.observable(u.getInstance()),g.paymentsViewModel=e.observable(v.getInstance()),g.emailAddress=e.observable(),g.order=e.observable(),g.orderProfileId=e.observable(),g.paymentGateway=e.observable(),g.selectedShippingOption=e.observable(),g.isPaypalVerified=e.observable(!1),g.isPayULatamCheckout=e.observable(!1),g.op=e.observable(),g.giftCards=e.observableArray([]),g.amountRemaining=e.observable(),g.amountRemaining(null),g.isCashPayment=e.observable(!1),g.cashModel=e.observable(m.getInstance()),g.cashModel().isPayingByCash(g.isCashPayment()),g.isInvoicePayment=e.observable(!1),g.isPayLater=e.observable(!1),g.poNumber=e.observable(),g.isOrderValid=e.observable(!1),g.isSplitPayment=e.observable(!1),g.isShippingAddressModified=!1,g.isBillingAddressModified=!1,g.isInStorePayment=!1,g.enableOrderButton=e.observable(!0),g.isOrderLocked=!1,g.isOrderEditable=e.observable(!0),g.isOrderSubmitted=!1,g.checkoutGuest=e.observable(n.GUEST),g.checkoutLogin=e.observable(n.LOGIN),g.checkoutOption=e.observable(n.GUEST).extend({throttle:400}),g.guestEmailAddress=e.observable(""),g.createAccount=e.observable(!1),g.user=h,g.registerUser=!1,g.webCheckoutShippingMethodValue=null,g.storeServerLog=f.getInstance(),g.exceptionHandler=new E,g.loadedOrderShippingAddress=null,g.isPaymentDisabled=function(){var e=g.cart().getDerivedTotal(g.cart().secondaryCurrencyTotal(),g.cart().total());return 0==e},g.payments=e.observableArray([]),g.approvalRequired=e.observable(!1),g.isAutherizeCalled=!1,g.validationCallbacks=[],g.fields=null,g.storeConfiguration=y.getInstance(),g.isCashPayment.subscribe(function(e){g.cashModel().isPayingByCash(e)}),g.registerSplitPaymentCallbacks=function(e,t,r,i,a){g.createOrderSuccessHandler=e,g.createOrderFailureHandler=t,g.validateSplitPaymentsHandler=r,g.invokePaymentsAPIHandler=i,g.validateSplitPaymentsBillingAddresses=a},g.registerPendingPaymentCallback=function(e){g.pendingPaymentOrderHandler=e},g.validOrderQuantityMap={},g.guestEmailAddress.subscribe(function(e){g.guestEmailAddress.isValid()?g.cart().emailAddressForGuestUser=g.guestEmailAddress():g.cart().emailAddressForGuestUser=""}),g.registerPointsPaymentCallbacks=function(e){g.validatePointsPaymentHandler=e},g.registerUpdateShippingAddressDynamicPropertiesCallback=function(e){g.addDynamicPropertiesToAddressHandler=e},g.updateBillingAddress=function(){g.billingAddress(this)},g.preparePayULatamDataForCreateOrder=function(e){g.paymentGateway(new L(e,g.cart().total(),g.cart().currency.currencyCode))},g.updateShippingAddress=function(){g.shippingAddress(this);var e={};e[n.SHIPPING_ADDRESS_FOR_METHODS]=g.shippingAddress(),e[n.PRODUCT_IDS_FOR_SHIPPING]=c().getProductIdsForItemsInCart(),c().updateShippingAddress.bind(e)()},g.updatePaypalPaymentType=function(e){var t;g.paymentGateway()&&g.paymentGateway().type===e&&g.paymentGateway().customProperties&&(t=g.paymentGateway().customProperties),g.paymentGateway(new D(e)),t&&(g.paymentGateway().customProperties=t)},g.updateShippingMethod=function(){if(this&&this.repositoryId){var e={};e.value=this.repositoryId,e.shippingOption=this,g.selectedShippingOption(e)}else g.selectedShippingOption("")},g.updateEmail=function(){g.emailAddress(this)},g.resetAddress=function(){g.billingAddress()&&g.billingAddress().reset(),g.shippingAddress()&&g.shippingAddress().reset()},g.resetOrderId=function(){g.id("")},g.updatePaymentDetails=function(){var e=this;if(g.paymentDetails&&g.paymentDetails())for(var t in e)g.paymentDetails()[t]&&g.paymentDetails()[t](e[t]);else g.paymentDetails(e)},g.updatePaymentGatewayData=function(e){var t=e.parameters;if(t){for(var r=t.split("&"),i={},a=0;a<r.length;a++){var o=r[a].split("=");i[o[0]]=o[1]}if(i[n.PAYMENT_ID]&&i[n.TOKEN]&&i[n.PAYER_ID])g.paymentGateway(new D(n.PAYPAL_CHECKOUT_TYPE,i[n.PAYMENT_ID],i[n.TOKEN],i[n.PAYER_ID])),g.isPaypalVerified(!0);else if(i[n.PAYER_ID]&&i[n.TOKEN]&&!i[n.PAYMENT_ID]&&i[n.PAYMENT_TYPE]===n.PAYPAL_PAYMENT_TYPE)g.paymentGateway(new D(n.PAYPAL_CHECKOUT_TYPE,i[n.TOKEN],i[n.TOKEN],i[n.PAYER_ID])),g.isPaypalVerified(!0);else if(t.indexOf(n.PAYU_REFERENCE_POL)!=-1){g.createSpinner();var s=i[n.PAYU_TRANSACTION_STATE];if(s==n.PAYU_TRANSACTION_APPROVED_CODE||s==n.PAYU_TRANSACTION_PENDING_CODE||s==n.PAYU_TRANSACTION_DECLINED_CODE||s==n.PAYU_TRANSACTION_EXPIRED_CODE||s==n.PAYU_TRANSACTION_ERROR_CODE){var c=i[n.PAYU_REFERENCE_CODE],d=i[n.PAYU_TX_VALUE],u=i[n.CURRENCY],p=i[n.SIGNATURE];g.paymentGateway(new L(n.PAYULATAM_CHECKOUT_TYPE,d,u,c,s,n.PAYULATAM_RESPONSE_TYPE,p)),g.getOrder()}}else g.clearPaypalData()}else g.isPaypalVerified()&&l.getPathWithoutLocale()!=g.checkoutLink&&g.clearPaypalData()},g.getCampaigns=function(e){var t=[];return e&&e.length&&e.forEach(function(e){e.key.startsWith(n.CAMPAIGN_SOURCE_PREFIX)&&void 0!==e.value&&t.push({source:e.key,campaignId:e.value})}),t},g.loadOrderForSubmit=function(e){var a=this;if(e.pageId==n.PAGE_TYPE_CHECKOUT&&a.user()&&a.user().loggedIn()&&!a.user().isUserSessionExpired()&&a.cart().currentOrderId()||(e.pageId==n.PAGE_TYPE_AGENT_CHECKOUT||e.pageId==n.PAGE_TYPE_AGENT_MULTISHIP_CHECKOUT||e.pageId==n.AGENT_ORDER_DETAILS_PAGE_TYPE)&&a.cart().currentOrderId()){
- var e=(e.pageId,{}),u={};u[n.ENDPOINT_KEY]=n.ENDPOINT_GET_ORDER,u[n.IDENTIFIER_KEY]="orderForSubmit";var p=a.storeConfiguration.getFilterToUse(u);p&&(e[n.FILTER_KEY]=p),e[n.INCLUDE_RESULT]="full",o.request(n.ENDPOINT_GET_ORDER,e,function(e){var u=e.hasOwnProperty("stateString")?e.stateString:e.state;if(u==n.QUOTED_STATES||u==n.INCOMPLETE)a.cart().loadOrderForProfile(e,a.user),s.Topic(t.topicNames.LOADED_ORDER_SHIPPING_ADDRESS).publish(e.shippingAddress),o.profileType==n.PROFILE_TYPE_AGENT?a.shippingAddress&&a.shippingAddress()&&a.shippingAddress().validateForShippingMethod()&&(a.cart().shippingAddress(a.shippingAddress()),a.cart().shippingMethod(e.shippingMethod.value),a.cart().populateShipppingMethods()):a.cart().shippingMethod(e.shippingMethod.value),a.user().orderId(a.cart().currentOrderId()),a.user().setLocalData("orderId");else if(u==n.PENDING_PAYMENTS||u==n.PENDING_PAYMENT_TEMPLATE){if(a.isOrderEditable(!1),a.cart().loadOrderForProfile(e,a.user),o.profileType==n.PROFILE_TYPE_AGENT&&(a.isAnonymousCheckout=!!e.profile.isAnonymous,a.populatePaymentsViewModel(e),a.pendingPaymentOrderHandler&&s.isFunction(a.pendingPaymentOrderHandler)&&a.pendingPaymentOrderHandler()),e.shippingGroups[0].type==n.HARDGOOD_SHIPPING_GROUP_TYPE){var p={translate:function(e,t){return i.t("ns.common:resources."+e,t)}},h=new d("cart-shipping-address","",p,a.contextData.page.shippingCountriesPriceListGroup,a.contextData.page.defaultShippingCountry);h.copyFrom(e.shippingGroups[0].shippingAddress,a.contextData.page.shippingCountriesPriceListGroup),h.resetModified(),s.Topic(t.topicNames.CHECKOUT_SHIPPING_ADDRESS).publishWith(h,[{message:"success"}]);var g={};g[n.SHIPPING_ADDRESS_FOR_METHODS]=a.shippingAddress(),g[n.PRODUCT_IDS_FOR_SHIPPING]=c().getProductIdsForItemsInCart(),s.Topic(t.topicNames.VERIFY_SHIPPING_METHODS).publishWith(g,[{message:"success"}]),a.cart().shippingMethod(e.shippingMethod.value)}s.Topic(t.topicNames.LOADED_ORDER_SHIPPING_ADDRESS).publish(e.shippingAddress),a.loadedOrderShippingAddress=e.shippingAddress;var f=a.cart().getDerivedTotal(e.priceInfo.secondaryCurrencyTotal,e.priceInfo.total);a.amountRemaining(f),s.Topic(t.topicNames.CART_UPDATED_PENDING_PAYMENT).publish(a),e.scheduledOrder&&e.scheduledOrder.length>0&&(a.showSchedule(!0),a.schedule()&&a.schedule().fromJS(e.scheduledOrder[0])),a.user().orderId(a.cart().currentOrderId()),a.user().setLocalData("orderId"),a.isAutherizeCalled||r.sendWarning(M,i.t("ns.common:resources.orderCannotBeUpdatePendingPaymentText"),!0),!a.emailAddress()&&a.user().emailAddress()&&a.emailAddress(a.user().emailAddress())}else u==n.INCOMPLETE_CANCEL?a.isOrderEditable(!1):l.goTo(a.contextData.global.links[404].route)},function(e){l.goTo(a.contextData.global.links[404].route)},a.cart().currentOrderId())}a.isOrderEditable(!0)},g.updatePayments=function(e){g.payments([]);for(var t=e.length,r=0;r<t;r++)g.payments().push(e[r])},g.addPayment=function(e){g.payments.push(e)},g.hasPaymentType=function(e){for(var t=g.payments().length,r=0;r<t;r++)if(g.payments()[r].type===e)return!0;return!1},g.validateShippingGroupRelationships=function(){if(r.clearError("checkoutAddressBook-ShippingGroupRelationships"),this.cart().hasSplitShippingInformation()||this.errorFlag){var e={};this.errorFlag=!this.cart().items().every(function(t){return t.shippingGroupRelationships().every(function(t){if(t.isPickupInStore())if(e[t.selectedStore().locationId+t.availablePickupDate()]){if(e[t.selectedStore().locationId+t.availablePickupDate()]!==t.firstName()+t.lastName()+t.phoneNumber())return!1}else e[t.selectedStore().locationId+t.availablePickupDate()]=t.firstName()+t.lastName()+t.phoneNumber();return!0})}),this.errorFlag&&r.sendError("checkoutAddressBook-ShippingGroupRelationships",i.t("ns.common:resources.pickupDetailsErrorMsg"),!0)}else this.errorFlag=!0,r.sendError("checkoutAddressBook-ShippingGroupRelationships",i.t("ns.common:resources.checkoutErrorMsg"),!0)},g.validateShippingAddress=function(){r.clearError("checkoutAddressBook-Shipping"),g.shippingAddress&&(g.shippingAddress().validateNow()||this.errorFlag?this.shippingAddress().afterValidation=!0:(this.errorFlag=!0,r.sendError("checkoutAddressBook-Shipping",i.t("ns.common:resources.checkoutErrorMsg"),!0))),g.addDynamicPropertiesToAddressHandler&&s.isFunction(g.addDynamicPropertiesToAddressHandler)&&g.addDynamicPropertiesToAddressHandler(this.shippingAddress())},g.validateSchedule=function(){r.clearError("checkoutScheduledOrder-Schedule"),g.showSchedule()&&g.schedule&&(g.schedule().validateNow()||this.errorFlag?this.schedule().afterValidation=!0:(this.errorFlag=!0,r.sendError("checkoutScheduledOrder-Schedule",i.t("ns.common:resources.checkoutErrorMsg"),!0)))},g.validateBillingAddress=function(){r.clearError("checkoutAddressBook-Billing"),r.clearError("splitPayments-Billing"),g.isSplitPayment()||g.billingAddress().phoneNumber.isValid()||g.billingAddress().phoneNumber(g.shippingAddress().phoneNumber()),g.isSplitPayment()?g.validateSplitPaymentsBillingAddresses&&!g.validateSplitPaymentsBillingAddresses()&&(this.errorFlag=!0,r.sendError("splitPayments-Billing",i.t("ns.common:resources.checkoutErrorMsg"),!0)):!g.billingAddress||g.isPaypalVerified()||!g.billingAddress()||g.billingAddress().validateNow()||this.errorFlag||(this.errorFlag=!0,r.sendError("checkoutAddressBook-Billing",i.t("ns.common:resources.checkoutErrorMsg"),!0))},g.validateCheckoutCartSummary=function(){r.clearError("checkoutCartSummary"),0!==g.cart().items().length||this.errorFlag||(this.errorFlag=!0,r.sendError("checkoutCartSummary",i.t("ns.common:resources.checkoutErrorMsg"),!0))},g.validateCheckoutOrderSummary=function(){!this.selectedShippingOption||this.selectedShippingOption()||this.errorFlag?r.clearError("checkoutOrderSummary-shippingMethods"):(this.errorFlag=!0,r.sendError("checkoutOrderSummary",i.t("ns.common:resources.checkoutErrorMsg"),!0))},g.validateCheckoutPaymentDetails=function(){r.clearError("checkoutPaymentDetails");var e=g.cart().getDerivedTotal(this.cart().secondaryCurrencyTotal(),this.cart().total());this.paymentDetails&&this.payments()<1&&(e>0||this.paymentDetails().isModified())&&(this.isPaypalVerified()||this.cashModel().isPayingByCash()||this.isPayULatamCheckout()||this.isInvoicePayment()||this.showSchedule()&&!this.paymentDetails().isCardEnabledForScheduledOrder()||!(null==this.amountRemaining()||this.amountRemaining()>0)||this.paymentDetails().validatePaymentDetails()||this.errorFlag||(this.errorFlag=!0,r.sendError("checkoutPaymentDetails",i.t("ns.common:resources.checkoutErrorMsg"),!0)))},g.validateGiftcards=function(){r.clearError("checkoutGiftCards"),this.giftCards&&this.giftCards().length>0&&(this.cart().validateGiftCards()||(s.Topic(t.topicNames.SHOW_GIFT_CARD_ERROR_PANEL).publish(),this.errorFlag||(this.errorFlag=!0,r.sendError("checkoutGiftCards",i.t("ns.common:resources.checkoutErrorMsg"),!0))))},g.validatePaymentMethodsForScheduledOrder=function(){r.clearError("checkoutPaymentMethodsForScheduledOrder"),this.showSchedule()&&(this.cashModel().isPayingByCash()||this.paymentDetails&&this.paymentDetails().isCardEnabledForScheduledOrder()||this.giftCards&&this.giftCards().length>0||this.isInvoicePayment()||this.isPayULatamCheckout()||this.isPaypalVerified()||this.errorFlag||(this.errorFlag=!0,r.sendError("checkoutPaymentMethodsForScheduledOrder",i.t("ns.common:resources.checkoutErrorMsg"),!0)))},g.validateRegisteredUser=function(){this.user().validateLogin(),this.user().isLoginValid()||this.errorFlag?(s.Topic(t.topicNames.CHECKOUT_EMAIL_ADDRESS).publishWith(this.user().emailAddress(),[{message:"success"}]),s.Topic(t.topicNames.USER_PROFILE_UPDATE_SUBMIT).publishWith(this.user(),[{message:"success"}])):(this.errorFlag=!0,r.sendError("checkoutRegistration",i.t("ns.common:resources.checkoutErrorMsg"),!0))},g.validateGuestUser=function(){if(this.guestEmailAddress.isValid()||this.createAccount()!==!1)if(this.user().isValid()||this.createAccount()!==!0){var e=o.getStoredValue(n.LOCAL_STORAGE_USER_CONTENT_LOCALE);null!=e&&(e=JSON.parse(e),s.Topic(t.topicNames.CHECKOUT_USER_LOCALE).publishWith(e[0].name,[{message:"success"}])),s.Topic(t.topicNames.CHECKOUT_EMAIL_ADDRESS).publishWith(this.guestEmailAddress(),[{message:"success"}])}else this.user().validateUser(),this.errorFlag||(this.errorFlag=!0,r.sendError("checkoutRegistration",i.t("ns.common:resources.checkoutErrorMsg"),!0));else this.guestEmailAddress.isModified(!0),this.errorFlag||(this.errorFlag=!0,r.sendError("checkoutRegistration",i.t("ns.common:resources.checkoutErrorMsg"),!0))},g.validateCheckoutRegistration=function(){r.clearError("checkoutRegistration"),this.user().loggedIn()||(this.checkoutOption()===this.checkoutLogin()?g.validateRegisteredUser():g.validateGuestUser())},g.isGiftCardDisabled=e.computed(function(){return!!g.approvalRequired()||!!(0==g.cart().items().length||0==g.amountRemaining()||g.isCashPayment()||g.isInvoicePayment()||g.showSchedule()&&!g.paymentDetails().isGiftCardEnabledForScheduledOrder()||g.approvalRequired()&&!g.paymentDetails().isGiftCardEnabledForApproval())}),g.validateDynamicProperties=function(){r.clearError("checkoutDynamicProperties");this.cart().validateDynamicProperties()||this.errorFlag||(this.errorFlag=!0,r.sendError("checkoutDynamicProperties",i.t("ns.common:resources.checkoutErrorMsg"),!0))},g.validatePlaceHolderItems=function(){r.clearError("placeHolderItems"),this.cart().placeHolderItems().length&&(this.errorFlag||(this.errorFlag=!0,this.placeHolderItemsMsgDisplayed=!0,r.sendWarning("placeHolderItems",i.t("ns.common:resources.placeHolderItemsErrorMsg"),!0)),this.cart().placeHolderItems.subscribe(function(){this.cart().placeHolderItems().length&&(this.placeHolderItemsMsgDisplayed=!1)},this))},g.invokePaymentValidations=function(){n.LOYALTY_POINTS_PAYMENT_TYPE==this.cart().currency.currencyType?this.paymentsViewModel().isLoyaltyEnabled()&&(this.cart().isChargeTaxShippingInSecondaryCurrency()&&(this.isSplitPayment()?this.validateSplitPaymentsHandler():(this.validateCheckoutPaymentDetails(),this.validateGiftcards(),this.validatePaymentMethodsForScheduledOrder())),this.validatePointsPaymentHandler&&this.validatePointsPaymentHandler()):this.isSplitPayment()?this.validateSplitPaymentsHandler():(this.validateCheckoutPaymentDetails(),this.validateGiftcards(),this.validatePaymentMethodsForScheduledOrder())},g.reset=function(){this.user().reset(),this.createAccount(!1),this.guestEmailAddress.isModified&&this.guestEmailAddress.isModified(!1),this.guestEmailAddress(""),g.cart().emailAddressForGuestUser=""},g.checkSingleException=function(e){if(e.errorCode==n.CHECKOUT_SESSION_EXPIRED_ERROR)return r.sendError(n.CHECKOUT_SESSION_EXPIRED,e.message,!0),!0;if(e.errorCode==n.CREATE_ORDER_PRODUCT_NOT_FOUND||e.errorCode==n.CREATE_ORDER_SKU_NOT_FOUND||e.errorCode==n.PRODUCT_NOT_FOR_INDIVIDUAL_SALE)return r.sendError(M,e.message,!0),g.cart().loadCart(),!0;if(e.errorCode==n.UNLINKED_ADD_ON_PRODUCT)return g.cart().loadCart(),!0;if(e.errorCode==n.ADDON_VOLUME_PRICE_ERROR){var t=e.message+" "+i.t("ns.common:resources.removeItemFromCart");r.sendError(M,t,!0)}else if(e.errorCode==n.INVALID_SHOPPER_INPUT){var a=JSON.parse(e.moreInfo),o=a.productId,s=g.cart().findCartProductById(o);s&&(o=s.displayName);var t=i.t("ns.common:resources.invalidShopperInputError",{productName:o});r.sendError(M,t,!0)}else{if(e.errorCode==n.ORDER_CANNOT_BE_UPDATED){g.id("");var l=i.t("ns.common:resources.orderSubmissionFailed");return r.sendError(M,l,!0),!0}if(e.errorCode==n.COUPON_APPLY_ERROR)g.cart().handleCouponPricingError(e,null);else if(e.errorCode==n.PROCESS_COMPLETION_FAILED_CODE){var l=i.t("ns.common:resources.processCompletionFailed");e.message=l,r.sendError(M,l,!0)}else if(e.errorCode==n.CONFIGURABLE_PRODUCTS_NOT_ALLOWED_FAILURE_CODE){var l=i.t("ns.common:resources.orderPricingPromotionError");e.message=l,r.sendError(M,l,!0)}else if(e.errorCode==n.PAYMENT_REVERSAL_FAILED_CODE){g.id("");var l=i.t("ns.common:resources.paymentReversalFailed");e.message=l,r.sendError(M,l,!0)}else if(e.errorCode==n.INVALID_PROFILE_FOR_CHECKOUT){var c=i.t("ns.common:resources.invalidProfileForCheckout");e.message=c,r.sendError(M,c,!0)}else{if(e.status==n.HTTP_UNAUTHORIZED_ERROR){var l=i.t("ns.common:resources.orderSubmissionFailed");return r.sendError(M,l,!0),!1}if(!g.isPaypalVerified())return r.sendError(M,e.message,!0),!0}}},g.buildShoppingcartPayload=function(t){for(var r=new Array,i=t.items,a=0;a<i().length;a++){var o=new _(i()[a]),n=JSON.parse(e.toJSON(o)),s=i()[a].childItems;if(s){e.isObservableArray(s)?n.childItems=s():n.childItems=s;var l=i()[a].configuratorId;l&&e.isObservable(l)?n.configuratorId=l():n.configuratorId=l}for(var c=0;c<t.lineAttributes().length;c++){var d=i()[a][t.lineAttributes()[c].id()];d&&e.isObservable(d)?n[t.lineAttributes()[c].id()]=d():n[t.lineAttributes()[c].id()]=d}r.push(n)}return new A(r,t.coupons(),t.total())},s.Topic(t.topicNames.ORDER_CREATE).subscribe(this.createOrder.bind(this)),s.Topic(t.topicNames.CHECKOUT_EMAIL_ADDRESS).subscribe(g.updateEmail),s.Topic(t.topicNames.CHECKOUT_BILLING_ADDRESS).subscribe(g.updateBillingAddress),s.Topic(t.topicNames.CHECKOUT_SHIPPING_ADDRESS).subscribe(g.updateShippingAddress),s.Topic(t.topicNames.USER_PROFILE_ADDRESSES_REMOVED).subscribe(g.resetAddress),s.Topic(t.topicNames.CHECKOUT_PAYMENT_DETAILS).subscribe(g.updatePaymentDetails),s.Topic(t.topicNames.ORDER_CREATED).subscribe(this.authPayment.bind(this)),s.Topic(t.topicNames.PAYMENT_AUTH_SUCCESS).subscribe(this.paymentAuthorized.bind(this)),s.Topic(t.topicNames.PAYMENT_AUTH_DECLINED).subscribe(this.paymentDeclined),s.Topic(t.topicNames.PAYMENT_AUTH_TIMED_OUT).subscribe(this.paymentTimeout),s.Topic(t.topicNames.CHECKOUT_SHIPPING_METHOD).subscribe(g.updateShippingMethod),s.Topic(t.topicNames.ORDER_COMPLETED).subscribe(this.clear.bind(this)),s.Topic(t.topicNames.ORDER_SUBMISSION_FAIL).subscribe(g.handleRedirect.bind(g)),s.Topic(t.topicNames.ORDER_SUBMISSION_SUCCESS).subscribe(g.handleSubmissionSuccess.bind(g)),s.Topic(t.topicNames.SCHEDULED_ORDER_SUBMISSION_SUCCESS).subscribe(g.handleScheduledOrderSubmissionSuccess.bind(g)),s.Topic(t.topicNames.PAGE_CHANGED).subscribe(g.updatePaymentGatewayData.bind(g)),s.Topic(t.topicNames.PAGE_READY).subscribe(g.handlePageReady.bind(g)),s.Topic(t.topicNames.CONTINUE_TO_PAYPAL).subscribe(this.createOrder.bind(this)),s.Topic(t.topicNames.USER_LOGOUT_SUCCESSFUL).subscribe(this.resetAddress.bind(this)),s.Topic(t.topicNames.USER_LOGOUT_SUCCESSFUL).subscribe(this.resetOrderId.bind(this)),s.Topic(t.topicNames.USER_LOGIN_SUCCESSFUL).subscribe(this.resetOrderId.bind(this)),s.Topic(t.topicNames.GIFTCARD_UPDATE_FROM_CART).subscribe(this.updateGiftCards.bind(this)),s.Topic(t.topicNames.UPDATE_AMOUNT_REMAINING).subscribe(this.updateAmountRemaining.bind(this)),s.Topic(t.topicNames.UPDATE_AMOUNT_REMAINING_PENDING_PAYMENT).subscribe(this.updateAmountRemainingPendingPayment.bind(this)),s.Topic(t.topicNames.USER_CREATION_FAILURE).subscribe(this.createOrderAfterRegistration.bind(this)),s.Topic(t.topicNames.AUTO_LOGIN_AND_GET_USER_DATA_SUCCESSFUL).subscribe(this.createOrderAfterRegistration.bind(this)),s.Topic(t.topicNames.USER_AUTO_LOGIN_FAILURE).subscribe(this.createOrderAfterRegistration.bind(this)),s.Topic(t.topicNames.USER_PROFILE_UPDATE_SUCCESSFUL).subscribe(this.createOrderAfterProfileUpdate.bind(this)),s.Topic(t.topicNames.USER_PROFILE_UPDATE_NOCHANGE).subscribe(this.createOrderAfterProfileUpdate.bind(this)),s.Topic(t.topicNames.USER_PROFILE_UPDATE_INVALID).subscribe(this.createOrderAfterProfileUpdate.bind(this)),s.Topic(t.topicNames.USER_PROFILE_UPDATE_FAILURE).subscribe(this.createOrderAfterProfileUpdate.bind(this)),s.Topic(t.topicNames.CART_PRICE_COMPLETE).subscribe(this.disablePaymentIfNecessary.bind(this)),g}function C(e,t,r,i,a,o,n,s,l,c,d,u,p,h,g,f,m){var I=this;e&&(I.id=e),I.shoppingCart=t,I.appliedPromotions=r,I.isAnonymousCheckout=c,I.combineLineItems=f,a&&(I.scheduleOnly=!0,I.schedule=a),g?I.shippingGroups=g:(o&&(I.shippingAddress=o),i&&(I.shippingMethod={value:i.value})),n&&(I.billingAddress=n),u&&(I.payments=u),I.visitorId=s,I.visitId=l,c||(I.profileId=d),I.placeAsyncOrder=!1,null!=m&&(I.placeAsyncOrder=m),I.op=p,I.giftWithPurchaseOrderMarkers=h}function _(e){s.extend(this,{productId:e.productId,quantity:e.quantity,catRefId:e.productData().childSKUs[0].repositoryId,externalPrice:e.externalPrice,externalPriceQuantity:e.externalPriceQuantity,giftWithPurchaseCommerceItemMarkers:e.giftWithPurchaseCommerceItemMarkers,externalData:e.externalData,actionCode:e.actionCode,commerceItemId:e.commerceItemId,externalRecurringCharge:e.externalRecurringCharge,externalRecurringChargeFrequency:e.externalRecurringChargeFrequency,externalRecurringChargeDuration:e.externalRecurringChargeDuration,assetKey:e.assetKey,rootAssetKey:e.rootAssetKey,parentAssetKey:e.parentAssetKey,serviceId:e.serviceId,customerAccountId:e.customerAccountId,billingAccountId:e.billingAccountId,serviceAccountId:e.serviceAccountId,billingProfileId:e.billingProfileId,activationDate:e.activationDate,deactivationDate:e.deactivationDate,transactionDate:e.transactionDate,asset:e.asset,shopperInput:e.shopperInput})}function A(e,t,r){var i=this;i.items=e,i.coupons=t,i.orderTotal=r}function O(e,t,r,i){var a=this;a.emailAddress=e,a.billingAddress=t,a.paymentDetails=r,a.orderDetails=i}function R(e){var t=this;t.nameOnCard=e.nameOnCard(),null==e.selectedCardType()?t.cardType=e.cardType():t.cardType=e.selectedCardType(),t.cardNumber=e.cardNumber(),t.cardCVV=e.cardCVV(),t.endMonth=e.endMonth(),t.endYear=e.endYear(),null==e.selectedCardType()?t.selectedCardType=e.cardType():t.selectedCardType=e.selectedCardType(),null==e.selectedEndMonth()?t.selectedEndMonth=e.endMonth():t.selectedEndMonth=e.selectedEndMonth(),null==e.selectedEndYear()?t.selectedEndYear=e.endYear():t.selectedEndYear=e.selectedEndYear()}function N(e){var t=this;t.nameOnCard=e.nameOnCard(),null==e.selectedCardType()?t.cardType=e.cardType():t.cardType=e.selectedCardType(),t.cardNumber=e.cardNumber(),t.cardCVV=e.cardCVV(),t.expiryMonth=e.endMonth(),t.expiryYear=e.endYear().toString(),null==e.selectedCardType()?t.selectedCardType=e.cardType():t.selectedCardType=e.selectedCardType(),null==e.selectedEndMonth()?t.selectedEndMonth=e.endMonth():t.selectedEndMonth=e.selectedEndMonth(),null==e.selectedEndYear()?t.selectedEndYear=e.endYear():t.selectedEndYear=e.selectedEndYear()}function D(e,t,r,i,a){var o=this;o.type=e,o[n.PAYMENT_ID]=t,o[n.TOKEN]=r,o[n.PAYER_ID]=i,o[n.PAYMENT_GROUP_ID]=a}function L(e,t,r,i,a,o,s){var l=this;l.type=e,l[n.AMOUNT]=t,l[n.CURRENCY]=r,l[n.PAYMENT_ID]=i,l[n.TRANSACTION_STATUS]=a,l[n.TRANSACTION_TYPE]=o,l[n.SIGNATURE]=s}function w(t,r,i,a,o){var n={};return n.msg=t.toString(),n.shoppingCartItems=r,n.emailId=i,n.visitorId=a,n.visitId=o,n.toJSON=function(){var t=e.toJS(n);return t},n}var M="OrderViewModel";return S.prototype.isPaymentsDisabled=function(){var e=this,r=e.cart().getDerivedTotal(e.cart().secondaryCurrencyTotal(),e.cart().total()),i=0==r;return i&&s.Topic(t.topicNames.PAYMENTS_DISABLED).publish(),i},S.prototype.isPointPaymentsDisabled=function(){var e=this,t=e.cart().getDerivedTotal(e.cart().primaryCurrencyTotal(),e.cart().total()),r=0==t;return r},S.prototype.updateGiftCards=function(e){var t=this;t.giftCards([]);for(var r=0;r<e.length;r++){var i=e[r];t.giftCards.push(i)}},S.prototype.updateAmountRemaining=function(e){var t=this;t.amountRemaining(e)},S.prototype.updateAmountRemainingPendingPayment=function(e){var t=this,r=t.amountRemaining()+e;t.amountRemaining(r)},S.prototype.createOrderAfterRegistration=function(e){!this.registerUser||!this.contextData.global.guestCheckoutEnabled&&e&&e.errorCode===n.CREATE_PROFILE_USER_EXISTS?(this.destroySpinner(),this.enableOrderButton(!0),this.registerUser=!1,e&&r.sendError(M,e.message,!0),o.getStoredValue(n.PAYULATAM_CHECKOUT_REGISTRATION)===n.PAYULATAM_CHECKOUT_REGISTRATION_FAILURE&&o.clearStoredValue(n.PAYULATAM_CHECKOUT_REGISTRATION)):(this.createOrder(),this.registerUser=!1)},S.prototype.createOrderAfterProfileUpdate=function(){this.user&&!this.user().isUserSessionExpired()?(this.placeOrder&&(this.cart().currentOrderState()==n.PENDING_PAYMENTS||this.cart().currentOrderState()==n.PENDING_PAYMENT_TEMPLATE?this.isSplitPayment()?this.invokePaymentsAPIHandler():this.addPaymentsToOrder():this.createOrder(),this.enableOrderButton(!0),this.placeOrder=!1),this.destroySpinner()):(this.enableOrderButton(!0),this.destroySpinner())},S.prototype.handleSubmissionSuccess=function(e){var t=this;t.restClient.profileType===n.PROFILE_TYPE_AGENT?l.goTo(this.contextData.global.links.AgentOrderDetails.route+"/"+(e[0].scheduledId?e[0].scheduledId+"?"+n.AGENT_PARAM_IS_SCHEDULED_ORDER+"=true":e[0].id)):l.goTo(this.contextData.global.links.confirmation.route+"/"+e[0].uuid),t.isOrderSubmitted=!0,t.approvalRequired(!1),t.enableOrderButton(!0),t.isPaypalVerified()&&t.clearPaypalData(),t.user().loggedIn()||t.reset()},S.prototype.handleScheduledOrderSubmissionSuccess=function(e){var t=this;t.restClient.profileType===n.PROFILE_TYPE_AGENT?l.goTo(this.contextData.global.links.AgentOrderDetails.route+"/"+e[0].scheduleOrderId+"?"+n.AGENT_PARAM_IS_SCHEDULED_ORDER+"=true"):l.goTo(this.contextData.global.links.scheduledOrders.route+"/"+e[0].scheduleOrderId),t.isOrderSubmitted=!0,t.enableOrderButton(!0),t.isPaypalVerified()&&t.clearPaypalData(),t.user().loggedIn()||t.reset(),this.destroySpinner()},S.prototype.handleRedirect=function(e){var t=this;t.enableOrderButton(!0);var i=l.getPathWithoutLocale().split("?");if(o.profileType==n.PROFILE_TYPE_AGENT){if(!t.order()||"PENDING_PAYMENT"!=t.order().state&&t.order().state!=n.PENDING_PAYMENT_TEMPLATE){var a=t.agentCheckoutLink,s=t.contextManager.getInstance().export();a=a+"?context="+encodeURIComponent(s),i[0]=a}else{t.contextManager.getInstance().setProperty(n.IS_PENDING_PAYMENT,!0),t.contextManager.getInstance().includedAgentContextProperties.push(n.IS_PENDING_PAYMENT);var s=t.contextManager.getInstance().export();i[0]=t.agentCheckoutLink+"?orderId="+t.order().id+"&context="+encodeURIComponent(s)}l.goTo(i[0])}else l.getPathWithoutLocale()==t.cartLink&&(t.isPaypalVerified()||t.cart().checkoutWithPaypalClicked())?l.goTo(t.cartLink):l.getPathWithoutLocale()==t.checkoutLink&&t.isPaypalVerified()?l.goTo(t.checkoutLink):i[0]==t.checkoutLink&&l.getPathWithoutLocale().indexOf("orderId=")!=-1?l.goTo(l.getPathWithoutLocale()):l.goTo(t.checkoutLink),e.data&&(t.isPaypalVerified()||t.cart().checkoutWithPaypalClicked())&&r.sendErrorToPage(n.PAYPAL_PLACE_ORDER_ERROR,e.data.message,!0,"checkout",!0),(t.isPaypalVerified()||t.cart().checkoutWithPaypalClicked())&&t.clearPaypalData()},S.prototype.handleCheckoutWithPaypal=function(){var e=this;e.cashModel().isPayingByCash(!1),e.shippingAddress()&&e.shippingAddress().address1()&&!e.emailAddress()&&l.getPathWithoutLocale()==e.checkoutLink&&!e.user().loggedIn()?s.Topic(t.topicNames.PAYPAL_EMAIL_VALIDATION).publishWith(e,[{message:"fail"}]):e.continueCheckoutWithPaypal()},S.prototype.continueCheckoutWithPaypal=function(){var e=this;!e.cart().shippingMethod()&&e.shippingAddress()&&e.shippingAddress().validateForShippingMethod()&&h.getInstance().setItem("checkoutAddressWithoutShippingMethod",JSON.stringify(e.shippingAddress().toJSON())),e.guestEmailAddress()&&h.getInstance().setItem("guestEmailAddress",e.guestEmailAddress()),e.updatePaypalPaymentType(n.PAYPAL_CHECKOUT_TYPE),e.cart().checkoutWithPaypalClicked(!0),e.cart().skipPriceChange(!0),e.cart().handleValidateCart(),e.id(null),e.op(n.ORDER_OP_INITIATE)},S.prototype.clear=function(){var e=this;e.id(null),e.emailAddress(""),e.order(null),e.orderProfileId(null),e.selectedShippingOption(null),e.op(null),e.giftCards([]),e.isInvoicePayment(!1),e.isPayLater(!1),e.poNumber(""),e.enableOrderButton(!0),e.createAccount(!1),e.guestEmailAddress.isModified&&e.guestEmailAddress.isModified(!1),e.guestEmailAddress(""),e.checkoutOption(n.GUEST),e.isOrderLocked=!1,e.isOrderSubmitted=!1,e.payments([]),e.amountRemaining(null),e.approvalRequired(!1),e.isAutherizeCalled=!1,e.loadedOrderShippingAddress=null,e.cart().currentOrderId(null),e.cart().currentOrderState(null),o.profileType==n.PROFILE_TYPE_AGENT&&e.user().clonedOrderId()&&(e.clearCloneOrderData(),e.paymentsViewModel().resetPaymentsContainer(),e.paymentsViewModel().totalAmountAuthorized(0),e.paymentsViewModel().totalAmountAuthorizedOnVoid(0),e.cart().emptyCart(),e.contextManager&&e.contextManager.getInstance().clearAgentContext())},S.prototype.clearPaypalData=function(){var e=this;e.paymentGateway(new D),e.cart().checkoutWithPaypalClicked(!1),e.isPaypalVerified(!1),e.id(null),e.op(null)},S.prototype.getOrder=function(){var e=this;e.giftCards([]),e.cart().giftCards([]),e.cart().dynamicProperties([]);var a=e.paymentGateway().type,c={};e.paymentGateway().type==n.PAYPAL_CHECKOUT_TYPE?(c[n.PAYER_ID]=e.paymentGateway().PayerID,c[n.TOKEN]=e.paymentGateway().token,c[n.PAYMENT_ID]=e.paymentGateway().paymentId):e.paymentGateway().type==n.PAYULATAM_CHECKOUT_TYPE?(c[n.AMOUNT]=e.paymentGateway().amount,c[n.CURRENCY]=e.paymentGateway().currency,c[n.PAYMENT_ID]=e.paymentGateway().paymentId,c[n.TRANSACTION_STATUS]=e.paymentGateway().transactionStatus,c[n.TRANSACTION_TYPE]=e.paymentGateway().transactionType,c[n.SIGNATURE]=e.paymentGateway().signature):e.payments().length>0&&(a=e.payments()[0].type,e.payments()[0].customProperties&&(c.customProperties=e.payments()[0].customProperties));var d={};d[n.ENDPOINT_KEY]=n.ENDPOINT_GET_INITIAL_ORDER,d[n.IDENTIFIER_KEY]="getOrder";var u=e.storeConfiguration.getFilterToUse(d);u&&(c[n.FILTER_KEY]=u),e.adapter.loadJSON(n.ENDPOINT_GET_INITIAL_ORDER,a,c,function(a){var c,d=!(!e.user()||!e.user().loggedIn()),u=a.markers&&a.markers.length?e.getCampaigns(a.markers):[];if(a.shoppingCart&&a.shoppingCart.items&&(c=a.shoppingCart.items),d)e.cart().emptyCart(),e.cart().mergeItems(a),e.cart().updateCartData(a,!1,d),e.cart().cartUpdated();else{e.cart().loadCart();var p=h.getInstance().getItem("guestEmailAddress");p&&(e.guestEmailAddress(p),h.getInstance().removeItem("guestEmailAddress"))}if(a.state==n.PENDING_PAYMENT||a.state==n.PENDING_PAYMENT_TEMPLATE){e.cart().currentOrderState(a.state),e.cart().currentOrderId(a.id),e.cart().orderCurrency=a.priceListGroup.currency,e.cart().orderItems(a.shoppingCart.items);var g=e.cart().getDerivedTotal(a.priceInfo.secondaryCurrencyTotal,a.priceInfo.total);e.amountRemaining(g),e.isAutherizeCalled=!0,e.isOrderEditable(!1)}if(a.state==n.QUOTED_STATES&&(e.cart().currentOrderState(a.state),e.cart().currentOrderId(a.id),e.cart().orderCurrency=a.priceListGroup.currency,e.cart().orderItems(a.shoppingCart.items),e.isOrderEditable(!1)),a.state==n.INCOMPLETE_CANCEL&&(e.cart().currentOrderState(a.state),e.cart().currentOrderId(a.id),e.cart().orderCurrency=a.priceListGroup.currency,e.cart().orderItems(a.shoppingCart.items),e.isOrderEditable(!1)),e.isPaypalVerified()){e.id(a.id);for(var f=a.payments,m="",I=0;I<f.length;I++)if(f[I]&&f[I].type==n.PAYPAL_CHECKOUT_TYPE){m=f[I].paymentGroupId;var E=new D(n.PAYPAL_CHECKOUT_TYPE,e.paymentGateway().paymentId,e.paymentGateway().token,e.paymentGateway().PayerID,m);e.paymentGateway(E),e.paymentsViewModel().paypalPaymentGroupId(m)}var y=h.getInstance().getItem("checkoutAddressWithoutShippingMethod");s.Topic(t.topicNames.PAYPAL_CHECKOUT_SHIPPING_ADDRESS).publish(a.shippingAddress),s.Topic(t.topicNames.EXTERNAL_CHECKOUT_BILLING_ADDRESS).publish(a.billingAddress),a.shippingMethod&&!y?s.Topic(t.topicNames.PAYPAL_CHECKOUT_SHIPPING_METHOD_VALUE).publishWith(a.shippingMethod.value):s.Topic(t.topicNames.PAYPAL_CHECKOUT_NO_SHIPPING_METHOD).publish(),a.dynamicProperties&&e.cart().updateDynamicProperties(a);var v=a.priceInfo.secondaryCurrencyTotal?a.priceInfo.secondaryCurrencyTotal:a.priceInfo.total;if(1==f.length&&f[0]&&f[0].type==n.PAYPAL_PAYMENT_TYPE&&f[0].amount!=v){var b=i.t("ns.common:resources.reapplyGIftCards");r.sendError("GC",b,!0)}}else if(e.paymentGateway().type==n.PAYULATAM_CHECKOUT_TYPE){for(var T,f=a.payments,I=0;I<f.length;I++)if(f[I]&&f[I].type===n.PAYULATAM_CHECKOUT_TYPE){T=f[I];break}if(T.transactionStatusByQuery==n.PAYU_TRANSACTION_APPROVED||T.transactionStatusByQuery==n.PAYU_TRANSACTION_PENDING||T.paymentState==n.PAYMENT_GROUP_STATE_SETTLED)s.Topic(t.topicNames.ORDER_SUBMISSION_SUCCESS).publish([{message:"success",id:a.id,uuid:a.uuid,items:c,campaigns:u}]);else if(T.transactionStatusByQuery==n.PAYU_TRANSACTION_DECLINED||T.transactionStatusByQuery==n.PAYU_TRANSACTION_EXPIRED||T.transactionStatusByQuery==n.PAYU_TRANSACTION_ERROR){s.Topic(t.topicNames.WEB_CHECKOUT_SHIPPING_ADDRESS).publish(a.shippingAddress),a.shippingMethod&&(e.webCheckoutShippingMethodValue=a.shippingMethod.value),!e.user().loggedIn()&&a.shippingAddress.email&&e.guestEmailAddress(a.shippingAddress.email);var P="";T.transactionStatusByQuery==n.PAYU_TRANSACTION_DECLINED?P=i.t("ns.common:resources.paymentDeclinedMsg"):T.transactionStatusByQuery==n.PAYU_TRANSACTION_EXPIRED?P=i.t("ns.common:resources.paymentExpiredMsg"):T.transactionStatusByQuery==n.PAYU_TRANSACTION_ERROR&&(P=i.t("ns.common:resources.paymentErrorMsg")),o.clearStoredValue(n.PAYULATAM_CHECKOUT_REGISTRATION),o.profileType==n.PROFILE_TYPE_AGENT?l.goTo(e.agentCheckoutLink):l.goTo(e.checkoutLink),r.sendErrorToPage(M,P,!0,"checkout",!0),s("#CC-messages").attr("aria-live","assertive")}e.paymentGateway(null),e.destroySpinner()}s.Topic(t.topicNames.ORDER_RETRIEVED_INITIAL).publishWith(a,[{message:"success",order:a}])},function(i){e.destroySpinner(),e.clearPaypalData(),e.paymentGateway(null),e.payments([]),s.Topic(t.topicNames.GET_INITIAL_ORDER_FAIL).publish([{message:"fail"}]),r.sendError(M,i.message,!0)})},S.prototype.addPaymentsToOrder=function(){var t=this,r=void 0;t.billingAddress()&&(r=t.billingAddress().toJSON());var i="";if(t.op()==n.ORDER_OP_INITIATE)i=t.op();else var a=h.getInstance().getItem(n.PAYMENT_GROUP_AFTER_PAYPAL);var s=[];if(!t.isSplitPayment()&&n.LOYALTY_POINTS_PAYMENT_TYPE==t.cart().currency.currencyType&&t.paymentsViewModel().isLoyaltyEnabled())for(var l=t.paymentsViewModel().preparePaymentsRequest(t.paymentsViewModel().pendingPayments()),c=0;c<l.length;c++)if(l[c].paymentMethodType==n.LOYALTY_POINTS_PAYMENT_TYPE){if(l[c].amount&&null==l[c].amount){var d=t.cart().getDerivedTotal(t.cart().primaryCurrencyTotal(),t.cart().total());l[c].amount=d}l[c].billingAddress&&null==l[c].billingAddress&&(l[c].billingAddress=r),s.push(l[c])}if(t.cashModel().isPayingByCash()){var u={};u.paymentMethodType=n.CASH_PAYMENT_TYPE,t.cashModel().customProperties&&Object.keys(t.cashModel().customProperties).length-1>0&&(u.customProperties=e.mapping.toJS(t.cashModel().customProperties)),u.billingAddress=r,u.amount=t.amountRemaining(),s.push(u),i=n.ORDER_OP_INITIATE}else{if(t.giftCards())for(var c=0;c<t.giftCards().length;c++){var u={};u.paymentMethodType=n.GIFT_CARD_PAYMENT_TYPE,u.giftCardNumber=t.giftCards()[c].giftCardNumber(),u.giftCardPin=t.giftCards()[c].giftCardPin(),t.giftCards()[c].isAmountRemaining()&&!t.isPaypalVerified()||(u.amount=t.giftCards()[c].amountUsed()),u.paymentGroupId=t.giftCards()[c].paymentGroupId,t.giftCards()[c].customProperties&&Object.keys(t.giftCards()[c].customProperties).length-1>0&&(u.customProperties=e.mapping.toJS(t.giftCards()[c].customProperties)),u.amount=t.giftCards()[c].amountUsed(),u.billingAddress=r,s.push(u)}if(t.payments().length>0)e.utils.arrayForEach(t.payments(),function(e){e.billingAddress=r,e.type&&(e.paymentMethodType=e.type,delete e.type),s.push(e)});else if(t.isPaypalVerified()||t.amountRemaining&&0!=t.amountRemaining())if(t.paymentGateway()&&t.paymentGateway().type){var u={};u.paymentMethodType=t.paymentGateway().type,u.billingAddress=r,""==i&&t.paymentGateway().type==n.PAYPAL_CHECKOUT_TYPE?(u.PayerID=t.paymentGateway().PayerID,u.token=t.paymentGateway().token,u.paymentId=t.paymentGateway().paymentId,u.paymentGroupId=a):t.paymentGateway().type==n.PAYULATAM_CHECKOUT_TYPE&&(u.currency=t.paymentGateway().currency),u.amount=t.amountRemaining(),s.push(u),t.createSpinner()}else if(t.isInvoicePayment()){var u={};u={paymentMethodType:n.INVOICE_PAYMENT_TYPE,
- PONumber:t.poNumber()},u.billingAddress=r,u.amount=t.amountRemaining(),s.push(u)}else if(t.paymentDetails&&t.paymentDetails()&&t.paymentDetails().isModified()){var u={};u=new N(t.paymentDetails()),t.paymentDetails().customProperties&&Object.keys(t.paymentDetails().customProperties).length-1>0&&(u.customProperties=e.mapping.toJS(t.paymentDetails().customProperties)),u.paymentMethodType=n.CARD_PAYMENT_TYPE,u.billingAddress=r,u.amount=t.amountRemaining(),s.push(u)}}if(t.user()&&t.user().orderId()&&t.user().loggedIn()&&!t.hasPaymentType(n.GENERIC_PAYMENT_TYPE)){var p="addPayments",g={};g.orderId=t.user().orderId(),""!=i&&(g.op=i);var f=t.user().id();o.profileType!=n.PROFILE_TYPE_AGENT?g.profileId=f:f&&(g.profileId=f),g.payments=s,o.request(p,g,function(e){t.postPaymentOrderUpdateSuccess(e)},function(e){var r=new Object;r.orderId=t.id(),r.errorCode=e.errorCode,t.storeServerLog.logError("updateOrderFailure",t.storeServerLog.getMessage("updateOrderFailure",r)),t.postOrderCreateOrUpdateFailure(e)})}else if(!this.user().isB2BUser()){var p="addPayments",g={};if(g.orderId=t.user().orderId(),""!=i&&(g.op=i),g.uuid=t.order().uuid,g.payments=s,o.profileType==n.PROFILE_TYPE_AGENT){var f=t.user().id();f&&(g.profileId=f)}o.request(p,g,function(e){t.postPaymentOrderUpdateSuccess(e)},function(e){var r=new Object;r.orderId=t.id(),r.errorCode=e.errorCode,t.storeServerLog.logError("updateOrderFailure",t.storeServerLog.getMessage("updateOrderFailure",r)),t.postOrderCreateOrUpdateFailure(e)})}},S.prototype.createOrder=function(){if(this.cart().isOrderSubmissionInProgress=!0,this.cart().currentOrderState()==n.PENDING_PAYMENTS||this.cart().currentOrderState()==n.PENDING_PAYMENT_TEMPLATE)this.isSplitPayment()?this.invokePaymentsAPIHandler():this.addPaymentsToOrder();else{var t,i=this,a=i.cart().giftWithPurchaseOrderMarkers,c=i.buildShoppingcartPayloadModel(i.cart());t=i.cart().createShippingGroups();var d=void 0;i.showSchedule()&&i.schedule()&&(d=i.schedule().toJSON());var u=void 0;if(i.shippingAddress())if(i.paymentGateway()&&i.paymentGateway().type===n.PAYPAL_CHECKOUT_TYPE&&l.isPathEqualTo(i.cartLink)){var p=i.shippingAddress().isValid();p&&(u=i.shippingAddress().toJSON())}else u=i.shippingAddress().toJSON();var g=void 0;i.billingAddress()&&(g=i.billingAddress().toJSON());var f=!0;if(i.user().loggedIn()&&(f=!1,!i.emailAddress()&&i.user().emailAddress()&&i.emailAddress(i.user().emailAddress())),i.emailAddress()){var m=i.emailAddress().toString();t?t.forEach(function(e){e.shippingAddress?e.shippingAddress.email=m:e.email=m}):u&&(u.email=m)}for(var I=[],E=0;E<i.cart().orderDiscountDescList().length;E++)I.push(i.cart().orderDiscountDescList()[E].promotionId);for(var y=0;y<i.cart().claimedCouponMultiPromotions().length;y++)for(var v=0;v<i.cart().claimedCouponMultiPromotions()[y].promotions().length;v++)I.push(i.cart().claimedCouponMultiPromotions()[y].promotions()[v].promotionId());var b=[];if(!i.isPayLater()){if(n.LOYALTY_POINTS_PAYMENT_TYPE==i.cart().currency.currencyType&&i.paymentsViewModel().isLoyaltyEnabled())for(var T=i.paymentsViewModel().preparePaymentsRequest(i.paymentsViewModel().pendingPayments()),E=0;E<T.length;E++)if(T[E].paymentMethodType==n.LOYALTY_POINTS_PAYMENT_TYPE){if(T[E].amount&&null==T[E].amount){var S=i.cart().getDerivedTotal(i.cart().primaryCurrencyTotal(),i.cart().total());T[E].amount=S}T[E].billingAddress&&null==T[E].billingAddress&&(T[E].billingAddress=g),b.push(T[E])}if(i.isSplitPayment())for(var T=i.paymentsViewModel().preparePaymentsRequest(i.paymentsViewModel().pendingPayments()),E=0;E<T.length;E++)if(T[E].paymentMethodType==n.CARD_PAYMENT_TYPE&&i.isCardPaymentClientSide)b.push({type:"card",amount:T[E].amount,seqNum:T[E].seqNum});else if(T[E].paymentMethodType==n.PAYPAL_CHECKOUT_TYPE)i.paymentsViewModel().paypalPaymentGroupId()&&T[E].token&&(T[E].paymentGroupId=i.paymentsViewModel().paypalPaymentGroupId()),b.push(T[E]);else{if(T[E].paymentMethodType==n.LOYALTY_POINTS_PAYMENT_TYPE&&n.LOYALTY_POINTS_PAYMENT_TYPE==i.cart().currency.currencyType)continue;b.push(T[E])}else if(i.cashModel().isPayingByCash()){var _={};_.type=n.CASH_PAYMENT_TYPE,i.cashModel().customProperties&&Object.keys(i.cashModel().customProperties).length-1>0&&(_.customProperties=e.mapping.toJS(i.cashModel().customProperties)),b.push(_)}else{if(i.giftCards())for(var E=0;E<i.giftCards().length;E++){var _={};_.type=n.GIFT_CARD_PAYMENT_TYPE,_.giftCardNumber=i.giftCards()[E].giftCardNumber(),_.giftCardPin=i.giftCards()[E].giftCardPin(),i.giftCards()[E].isAmountRemaining()&&!i.isPaypalVerified()||(_.amount=i.giftCards()[E].amountUsed()),_.paymentGroupId=i.giftCards()[E].paymentGroupId,i.giftCards()[E].customProperties&&Object.keys(i.giftCards()[E].customProperties).length-1>0&&(_.customProperties=e.mapping.toJS(i.giftCards()[E].customProperties)),b.push(_)}if(i.payments().length>0)e.utils.arrayForEach(i.payments(),function(e){b.push(e)});else if(i.isPaypalVerified()||i.amountRemaining&&0!=i.amountRemaining())if(i.paymentGateway()&&i.paymentGateway().type)b.push(i.paymentGateway()),i.createSpinner();else if(i.isInvoicePayment())b.push({type:n.INVOICE_PAYMENT_TYPE,PONumber:i.poNumber()});else if(i.paymentDetails&&i.paymentDetails()&&i.paymentDetails().isModified()){var _={};i.isCardPaymentClientSide||(_=new R(i.paymentDetails()),i.paymentDetails().customProperties&&Object.keys(i.paymentDetails().customProperties).length-1>0&&(_.customProperties=e.mapping.toJS(i.paymentDetails().customProperties))),_.type=n.CARD_PAYMENT_TYPE,b.push(_)}}}var A="";A=i.op()!=n.ORDER_OP_INITIATE?n.ORDER_OP_COMPLETE:i.op(),r.clearError(M);var O=P.getVisitorId(),N=P.getVisitId(),D=void 0!=i.storeConfiguration.isPlaceAsyncOrder()&&i.storeConfiguration.isPlaceAsyncOrder(i);if(i.user()&&i.user().orderId()&&i.user().loggedIn()&&i.cart().nonTransientCartCheck()&&!i.hasPaymentType(n.GENERIC_PAYMENT_TYPE)&&o.profileType!=n.PROFILE_TYPE_AGENT){var L=new C(i.user().orderId,c,I,i.selectedShippingOption(),d,u,g,O,N,f,null,b,A,a,t,i.cart().combineLineItems,D);i.adapter.persistUpdate("updateOrder",i.user().orderId(),i.addDynamicProperties(L),function(e){for(var t=0;t<e.payments.length;t++)if(e.markers&&e.markers.length&&e.payments[t].type&&e.payments[t].type===n.CYBERSOURCE_GATEWAY){var r=i.getCampaigns(e.markers);h.getInstance().setItem(n.CAMPAIGNS,JSON.stringify(r));break}i.createOrderSuccessHandler&&s.isFunction(i.createOrderSuccessHandler)?(i.id(e.id),i.order(e),i.orderProfileId(e.orderProfileId),i.createOrderSuccessHandler(e)):i.postOrderCreateOrUpdateSuccess(e)},function(e){var t=new Object;e&&e.errors&&e.errors instanceof Array?(t.orderId=i.id(),t.errorCode="",e.errors.forEach(function(e){t.errorCode+=e.errorCode+", "}),t.errorCode=t.errorCode.slice(0,-2)):(t.orderId=i.id(),t.errorCode=e.errorCode),i.storeServerLog.logError("updateOrderFailure",i.storeServerLog.getMessage("updateOrderFailure",t)),i.postOrderCreateOrUpdateFailure(e),i.createOrderFailureHandler&&s.isFunction(i.createOrderFailureHandler)&&i.createOrderFailureHandler(e)})}else{i.paymentGateway()&&i.paymentGateway().type==n.PAYPAL_CHECKOUT_TYPE||i.hasPaymentType(n.PAYPAL_CHECKOUT_TYPE)||i.hasPaymentType(n.GENERIC_PAYMENT_TYPE)||i.user().loggedIn()||i.id(""),i.cart().currentOrderId()?i.id(i.cart().currentOrderId()):i.user()&&i.user().orderId()&&i.user().loggedIn()&&i.cart().nonTransientCartCheck()&&i.hasPaymentType(n.GENERIC_PAYMENT_TYPE)&&i.id(i.user().orderId());var w,U=new C(i.id(),c,I,i.selectedShippingOption(),d,u,g,O,N,f,i.user().id(),b,A,a,t,i.cart().combineLineItems,D);o.profileType==n.PROFILE_TYPE_AGENT&&(U.op="submitOrder",i.user().orderId()&&(U.orderId=i.user().orderId()));var w=n.ENDPOINT_ORDERS_CREATE_ORDER;o.request(w,i.addDynamicProperties(U),function(e){i.createOrderSuccessHandler&&s.isFunction(i.createOrderSuccessHandler)?(i.id(e.id),i.order(e),e.orderProfileId=e.orderProfileId?e.orderProfileId:e.profileId,i.orderProfileId(e.orderProfileId),i.createOrderSuccessHandler(e)):(e.orderProfileId=e.orderProfileId?e.orderProfileId:e.profileId,i.postOrderCreateOrUpdateSuccess(e))},function(e){var t=new Object;e&&e.errors&&e.errors instanceof Array?(t.errorCode="",e.errors.forEach(function(e){t.errorCode+=e.errorCode+", "}),t.errorCode=t.errorCode.slice(0,-2)):t.errorCode=e.errorCode,i.storeServerLog.logError("createOrderFailure",i.storeServerLog.getMessage("createOrderFailure",t)),i.postOrderCreateOrUpdateFailure(e),i.createOrderFailureHandler&&s.isFunction(i.createOrderFailureHandler)&&i.createOrderFailureHandler(e)})}}},S.prototype.addDynamicProperties=function(e){for(var t=this,r=0;r<t.cart().dynamicProperties().length;r++){var i=t.cart().dynamicProperties()[r],a=i.id(),o=null;null!=i.value&&(o=i.value()),e[a]=o}var s=h.getInstance().getItem(n.LOCAL_STORAGE_CURRENT_CONTEXT);if(s){s=JSON.parse(s);for(var l in s)s.hasOwnProperty(l)&&e.hasOwnProperty(l)&&(e[l]=s[l])}return e},S.prototype.postOrderCreateOrUpdateSuccess=function(e){var a=this;a.cart().isOrderSubmissionInProgress=!1,a.id(e.id),a.order(e),a.orderProfileId(e.orderProfileId),a.op("");var o,c=e.markers&&e.markers.length?a.getCampaigns(e.markers):[];if(a.user()&&a.user().loggedIn()&&a.user().id()==e.orderProfileId&&(a.user().orderId(e.id),a.user().setLocalData("orderId")),e.shoppingCart&&e.shoppingCart.items?o=e.shoppingCart.items:e.order&&e.order.items&&(o=e.order.items),e.state==n.SUBMITTED||e.stateString==n.SUBMITTED)s.Topic(t.topicNames.ORDER_COMPLETED).publish({message:"success",id:e.id,uuid:e.uuid,payment:e.payments}),s.Topic(t.topicNames.ORDER_SUBMISSION_SUCCESS).publish([{message:"success",id:e.id,uuid:e.uuid,items:o,campaigns:c}]);else if(e.state==n.TEMPLATE||e.stateString==n.TEMPLATE)s.Topic(t.topicNames.ORDER_COMPLETED).publish({message:"success",id:e.id,uuid:e.uuid,payment:e.payments}),s.Topic(t.topicNames.SCHEDULED_ORDER_SUBMISSION_SUCCESS).publish([{message:"success",id:e.id,scheduleOrderId:"agentUI"==a.restClient.profileType?e.scheduledOrderId:e.scheduledOrder.id?e.scheduledOrder.id:e.scheduledOrder[0].id,uuid:e.uuid,items:o}]);else if(e.state==n.PENDING_APPROVAL||e.state==n.PENDING_SCHEDULED_ORDER_APPROVAL)s.Topic(t.topicNames.ORDER_COMPLETED).publish({message:"success",id:e.id,uuid:e.uuid,payment:e.payments}),a.destroySpinner(),s.Topic(t.topicNames.ORDER_SUBMISSION_SUCCESS).publish([{message:"success",id:e.id,uuid:e.uuid,items:o}]);else{for(var d=e.payments,u=!1,p=!1,g=!1,f=0;f<d.length;f++)if(d[f].paymentState==n.PAYMENT_GROUP_STATE_AUTHORIZED_FAILED||d[f].paymentState==n.PAYMENT_GROUP_STATE_PAYMENT_REQUEST_FAILED){this.destroySpinner(),p=!0;var m="";if(d[f]&&d[f].message&&""!==d[f].message){m=d[f].message;var I={orderId:e.id,paymentState:d[f].paymentState,paymentGroupId:d[f].paymentGroupId};a.storeServerLog.logError("paymentGroupFailure",a.storeServerLog.getMessage("paymentGroupFailure",I))}else{var I={orderId:e.id};a.storeServerLog.logError("orderSubmissionFailure",a.storeServerLog.getMessage("orderSubmissionFailure",I)),m=i.t("ns.common:resources.orderSubmissionFailed")}r.sendError(M,m,!0),s.Topic(t.topicNames.ORDER_SUBMISSION_FAIL).publishWith(e,[{message:"fail",data:d[f]}]),u=!0,(a.isPaypalVerified()||a.cart().checkoutWithPaypalClicked())&&a.clearPaypalData();break}if(!u)for(var f=0;f<d.length;f++){if(d[f].type==n.PAYPAL_PAYMENT_TYPE&&d[f].uiIntervention==n.REDIRECT){p=!0,a.paymentGateway(null),h.getInstance().setItem(n.REDIRECTED_TO_WEB_PAYMENT,"true"),window.location=e.payments[f].REDIRECT;break}if(d[f].type===n.PAYPAL_PAYMENT_TYPE||d[f].type===n.GENERIC_PAYMENT_TYPE){g=!0,p=!0;break}if(d[f].type==n.CYBERSOURCE_GATEWAY&&d[f].uiIntervention==n.SOP){p=!0,this.destroySpinner(),l.goTo(a.paymentLink,!0),s.Topic(t.topicNames.ORDER_CREATED).publish([{message:"success",id:e.id,uuid:e.uuid}]);break}if(d[f].uiIntervention==n.PAYER_AUTH_REQUIRED){p=!0,this.destroySpinner(),l.goTo(a.paymentLink,!0),s.Topic(t.topicNames.ORDER_CREATED).publish([{message:"success",id:e.id,uuid:e.uuid,customPaymentProperties:d[f].customPaymentProperties}]);break}if(d[f].type&&d[f].type==n.PAYULATAM_CHECKOUT_TYPE&&d[f].uiIntervention==n.SOP){p=!0,s.Topic(t.topicNames.PAYULATAM_WEB_CHECKOUT).publishWith(d[f],[{message:"success",id:e.id,uuid:e.uuid}]),h.getInstance().setItem(n.REDIRECTED_TO_WEB_PAYMENT,"true");break}}if(p)(e.state===n.INCOMPLETE||g)&&s.Topic(t.topicNames.ORDER_CREATED_INITIAL).publishWith(e,[{message:"success",order:e}]),this.destroySpinner();else{this.destroySpinner();var m=i.t("ns.common:resources.orderSubmissionFailed");r.sendError(M,m,!0),s.Topic(t.topicNames.ORDER_SUBMISSION_FAIL).publishWith(e,[{message:"fail",data:e}])}}},S.prototype.postOrderCreateOrUpdateFailure=function(e){var a=this;if(this.destroySpinner(),a.cart().isOrderSubmissionInProgress=!1,e&&e.message&&""!==e.message)if(e.__stateData__&&(h.getInstance().removeItem(n.LOCAL_STORAGE_SHOPPER_CONTEXT),h.getInstance().setItem(n.LOCAL_STORAGE_SHOPPER_CONTEXT,e.__stateData__)),e.errorCode==n.INVENTORY_CONFIGURABLE_ITEM_CHECK_ERROR)e.message=i.t("ns.common:resources.orderPricingPromotionError"),r.sendError(M,e.message,!0);else if(e.errors instanceof Array){var o=!1;for(var l in e.errors){if(e.errors[l].errorCode==n.EXTERNAL_PRICE_CHANGED||e.errors[l].errorCode==n.EXTERNAL_PRICE_PARTIAL_FAILURE_ERROR){e.message=i.t("ns.common:resources.orderPricingPromotionError"),r.sendError(M,e.message,!0),o=!0;break}if(o=a.checkSingleException(e),1==o)break}}else a.checkSingleException(e);s.Topic(t.topicNames.ORDER_SUBMISSION_FAIL).publishWith(e,[{message:"fail",data:e}])},S.prototype.authPayment=function(){var r=this,i=(r.order(),new O(r.emailAddress(),e.toJS(r.billingAddress()),r.paymentDetails(),r.order()));s.Topic(t.topicNames.ORDER_AUTHORIZE_PAYMENT).publish([{message:"success",details:i}])},S.prototype.paymentAuthorized=function(e){if(e[0].orderState==n.SUBMITTED){var r=this.cart().items(),i=JSON.parse(JSON.stringify(r)),a=[];e[0].type===n.CYBERSOURCE_GATEWAY&&(a=JSON.parse(h.getInstance().getItem(n.CAMPAIGNS)),a&&h.getInstance().removeItem(n.CAMPAIGNS)),s.Topic(t.topicNames.ORDER_SUBMISSION_SUCCESS).publish([{message:"success",id:e[0].id,uuid:e[0].uuid,items:i,campaigns:a}])}},S.prototype.paymentDeclined=function(e){s.Topic(t.topicNames.ORDER_SUBMISSION_FAIL).publish([{message:"fail"}])},S.prototype.paymentTimeout=function(e){s.Topic(t.topicNames.ORDER_SUBMISSION_FAIL).publish([{message:"fail"}])},S.prototype.setContext=function(e){this.contextData=e,this.paymentLink=this.contextData.global.links.payment.route,this.checkoutLink=this.contextData.global.links.checkout.route,this.cartLink=this.contextData.global.links.cart.route,o.profileType==n.PROFILE_TYPE_AGENT&&(this.agentCheckoutLink=this.contextData.global.links.agentCheckout.route),this.isCardPaymentClientSide=this.contextData.page.payment.isCardPaymentClientSide,this.contextData&&this.contextData.global&&this.contextData.global.site&&this.contextData.global.site.extensionSiteSettings&&this.contextData.global.site.extensionSiteSettings.storeEndpointSettings&&this.contextData.global.site.extensionSiteSettings.storeEndpointSettings.cartFields&&(this.fields=this.contextData.global.site.extensionSiteSettings.storeEndpointSettings.cartFields)},S.prototype.destroySpinner=function(){s("#loadingModal").hide(),c.destroy()},S.prototype.createSpinner=function(e){var t={parent:"#loadingModal",posTop:"0",posLeft:"50%"},e=i.t("ns.common:resources.loadingText");s("#loadingModal").removeClass("hide"),s("#loadingModal").show(),t.loadingText=e,c.create(t)},S.prototype.addValidationCallback=function(e){e&&"function"==typeof e&&this.validationCallbacks.push(e)},S.prototype.triggerValidationCallbacks=function(){if(this.validationCallbacks.length>0)for(var e=this.validationCallbacks.length,t=0;t<e;t++)this.validationCallbacks[t]&&"function"==typeof this.validationCallbacks[t]&&this.validationCallbacks[t]()},S.prototype.addValidationError=function(e,t){this.errorFlag=!0;var a=t;a&&""!==a||(a=i.t("ns.common:resources.checkoutErrorMsg")),r.sendError(e,a,!0)},S.prototype.postPaymentOrderUpdateSuccess=function(e){for(var t=this,i=e.orderId,a=n.ENDPOINT_GET_ORDER,s=0;s<e.paymentResponses.length;s++)e.paymentResponses[s].type==n.PAYPAL_PAYMENT_TYPE&&h.getInstance().setItem(n.PAYMENT_GROUP_AFTER_PAYPAL,e.paymentResponses[s].paymentGroupId);o.request(a,null,function(r){for(var i=0;i<e.paymentResponses.length;i++){for(var a=0;a<r.payments.length;a++)if(e.paymentResponses[i].paymentGroupId==r.payments[a].paymentGroupId){r.payments[a].customPaymentProperties=e.paymentResponses[i].customPaymentProperties,r.payments[a].uiIntervention=e.paymentResponses[i].uiIntervention;break}if(r.markers&&r.markers.length&&e.paymentResponses[i].type&&e.paymentResponses[i].type===n.CYBERSOURCE_GATEWAY){var o=t.getCampaigns(r.markers);h.getInstance().setItem(n.CAMPAIGNS,JSON.stringify(o))}}t.postOrderCreateOrUpdateSuccess(r)},function(e){t.destroySpinner(),r.sendError(M,e.message,!0)},i)},S.prototype.handlePayments=function(){try{r.clearError("handlePlaceOrder"),this.enableOrderButton(!1),this.errorFlag=!1,this.isOrderSubmitted=!1,this.shippingAddressAsBilling()&&this.shippingAddress().copyTo(this.billingAddress()),this.isOrderLocked||this.isOrderSubmitted||(this.isOrderLocked=!0,this.triggerValidationCallbacks(),this.isPayLater()||this.invokePaymentValidations(),this.validateBillingAddress(),this.validateDynamicProperties(),this.errorFlag?(this.enableOrderButton(!0),r.sendError("handlePlaceOrder",i.t("ns.common:resources.checkoutErrorMsg"),!0)):(this.createSpinner(),this.isPayULatamCheckout()&&this.preparePayULatamDataForCreateOrder(n.PAYULATAM_CHECKOUT_TYPE),this.user().loggedIn()&&!this.user().isB2BUser()?(this.placeOrder=!0,this.user().handleUpdateProfile()):this.isSplitPayment()?this.invokePaymentsAPIHandler():this.addPaymentsToOrder()),this.isOrderLocked=!1)}catch(r){this.enableOrderButton(!0),this.isOrderLocked=!1;var e=this.user().loggedIn()?this.user().emailAddress():this.emailAddress(),t=new w(r,this.cart().items(),e,I.getVisitorId(),I.getVisitId());this.exceptionHandler.logWindowOnError(JSON.stringify(t),"","")}},S.prototype.disablePaymentIfNecessary=function(){var e=this;e.cart().items().length>0&&e.isPaymentsDisabled()?e.isPaymentDisabled(!0):e.isPaymentDisabled(!1)},S.prototype.handlePlaceOrder=function(){try{if(r.clearError("handlePlaceOrder"),this.enableOrderButton(!1),this.errorFlag=!1,this.isOrderSubmitted=!1,this.isShippingAddressModified=this.shippingAddress().isModified(),this.isBillingAddressModified=this.billingAddress().isModified(),this.shippingAddressAsBilling()&&this.shippingAddress().copyTo(this.billingAddress()),!this.isOrderLocked&&!this.isOrderSubmitted){if(this.isOrderLocked=!0,this.validateCheckoutRegistration(),this.validateCheckoutCartSummary(),this.showSchedule()&&this.validateSchedule(),this.cart().isSplitShipping()?this.validateShippingGroupRelationships():(this.validateShippingAddress(),this.validateCheckoutOrderSummary()),this.triggerValidationCallbacks(),this.isPayLater()||this.invokePaymentValidations(),this.validateBillingAddress(),this.validateDynamicProperties(),this.placeHolderItemsMsgDisplayed||this.validatePlaceHolderItems(),this.errorFlag)this.enableOrderButton(!0);else if(s.Topic(t.topicNames.CHECKOUT_SAVE_SHIPPING_ADDRESS).publishWith(this.shippingAddress(),[{message:"success",shippingGroups:this.cart().orderShippingGroups()}]),this.createSpinner(),this.isPayULatamCheckout()&&this.preparePayULatamDataForCreateOrder(n.PAYULATAM_CHECKOUT_TYPE),this.user().contextData.global.enableProfileRegistrationEmailCheck||this.createAccount()!==!0)this.user().contextData.global.enableProfileRegistrationEmailCheck&&this.createAccount()===!0?r.sendWarning(M,i.t("ns.common:resources.placeOrderRegisterWarnMsg"),!0):this.user().loggedIn()&&!this.user().isB2BUser()?(this.placeOrder=!0,this.user().handleUpdateProfile()):this.createOrder();else{var e={widgetId:"checkoutRegistration"};this.user().updateLocalData(!0,!1),this.user().registerUser(e),this.registerUser=!0}this.isOrderLocked=!1}}catch(e){this.enableOrderButton(!0),this.isOrderLocked=!1;var a=this.user().loggedIn()?this.user().emailAddress():this.emailAddress(),o=new w(e,this.cart().items(),a,I.getVisitorId(),I.getVisitId());this.exceptionHandler.logWindowOnError(JSON.stringify(o),"","","",e),this.cart().isOrderSubmissionInProgress=!1}},S.prototype.checkOrderForApproval=function(e){var t=this,r={};r.orderId=e.orderId;var i="checkRequiresApproval";o.request(i,r,function(e){t.approvalRequired(e.requiresApproval)},function(e){})},S.prototype.handlePageReady=function(e){var t=this;t.loadOrderForSubmit(e)},S.prototype.buildShoppingcartPayloadModel=function(e){return this.buildShoppingcartPayload(e)},S.prototype.buildCreditCardPaymentDetailsModel=function(e){return new R(e)},S.prototype.buildShoppingCartModel=function(e,t,r){return new A(e,t,r)},S.prototype.buildOrderItemModel=function(e){return new _(e)},S.prototype.buildOrderModel=function(e,t,r,i,a,o,n,s,l,c,d,u,p,h,g,f){return new C(e,t,r,i,a,o,n,s,l,c,d,u,p,h,g,f)},S.getInstance=function(e,t,r,i,a){return S.prototype.singleInstance||(S.prototype.singleInstance=new S(e,t,r,a)),i&&S.prototype.singleInstance.setContext(i),S.prototype.singleInstance},S}),define("pageLayout/layout-mapping",["knockout"],function(e,t){"use strict";function r(t){var r=this;return this.ignore=["data"],this.regions={create:function(i){var a;return a=new t.RegionViewModel,e.mapping.fromJS(i.data,r,a),a.handleMetadata(),a}},this.widget={create:function(i){var a,o=null;return i.data.id&&(a=t.widgetCache.get("widget",i.data.id),void 0!==a&&void 0!==a.hit&&a.hit?o=a.result:(o=new t.WidgetViewModel(t.basePath),e.mapping.fromJS(i.data,r,o),t.initializeWidget(o,!0),t.widgetCache.set("widget",i.data.id,o))),o}},this.widgets={create:function(e){return r.widget.create(e)}},this}return r}),define("pageLayout/context-handler",["knockout"],function(e){"use strict";function t(){return this.values={global:{},page:{},user:{}},this.eventAnchor=$({}),this}return t.prototype.exclusiveSet=function(t,r,i){var a,o;if(i=i||"user",o=this.values[i],t){for(a in o)o.hasOwnProperty(a)&&a!==t&&this.values[a]&&(this.eventAnchor.trigger(t,null),e.isObservable(o[a])?o[a](null):(o[a]=e.observable(null),o[a].isData=!0));this.set(t,r,i)}},t.prototype.set=function(t,r,i){var a,o;i=i||"user",o=this.values[i],t&&o&&(a=e.utils.unwrapObservable(r),(!o[t]||a!==o[t]()&&(a||o[t]()))&&(o[t]?o[t](a):(o[t]=e.observable(a),o[t].isData=!0),this.eventAnchor.trigger(t,o[t])))},t.prototype.get=function(t,r){var i;return r=r||"user",i=this.values[r],t&&i?e.isObservable(i[t])?i[t]:(i[t]=e.observable(),i[t].isData=!0,i[t]):null},t.prototype.listen=function(e,t){e&&(this.eventAnchor.on(e,t),t(null,this.values[e]))},t.prototype.unlisten=function(e,t){e&&this.eventAnchor.off(e,t)},t.prototype.flush=function(t){var r;t&&(this.eventAnchor=$({}));for(r in this.values.page)this.values.page.hasOwnProperty(r)&&(t||this.eventAnchor.trigger(r,null),e.isObservable(this.values[r])?this.values.page[r](null):this.values.page[r]=null);for(r in this.values.user)this.values.user.hasOwnProperty(r)&&(t||this.eventAnchor.trigger(r,null),e.isObservable(this.values.user[r])?this.values.user[r](null):this.values.user[r]=null)},t}),define("pageLayout/view-model-builder",["knockout","viewModels/paymentsViewModel"],function(e,t){"use strict";return{page:{scope:"global",cachable:!0,load:!0},layout:{cachable:!1,load:function(t,r,i){var a;a=i&&i.model?i.model:new r.masterViewModel;var o={ignore:["data","regions"]};return e.mapping.fromJS(t,o,a),a.data=t.data,a}},region:{cachable:!1,load:function(t,r,i){var a,o=null;return null!==t.id&&void 0!==t.id&&(a=r.cache.get("region",t.id),void 0!==a&&void 0!==a.hit&&a.hit?(o=a.result,t.metadata&&o.metadata(t.metadata)):(o=new r.RegionViewModel,e.mapping.fromJS(t,r.layoutMapping,o),r.cache.set("region",t.id,o))),o.handleMetadata(),o}},widgetDefinition:{cachable:!0,load:function(t,r,i){var a=!1,o=new r.WidgetViewModel(r.basePath);return i&&i.load===!0&&(a=!0),e.mapping.fromJS(t,{},o),r.initializeWidget(o,a),o}},widget:{cachable:!0,load:function(t,r,i){var a=!0,o=new r.WidgetViewModel(r.basePath);return i&&i.load===!1&&(a=!1),e.mapping.fromJS(t,{},o),r.initializeWidget(o,a),o}},category:{cachable:!0,load:!0},product:{cachable:!0,load:function(e,t,r){var i=!0;r&&r.load===!1&&(i=!1);var a=new t.ProductViewModel(e,r);return a.fetchSkuProperties(),a}},store:{scope:"global",cachable:!0,load:!0},links:{scope:"global",cachable:!1,load:!0},payment:{scope:"page",cachable:!1,create:!0,load:function(e,r,i){return t.getInstance(e,r.contextHandler.get("user","global")),r.PaymentDetails.getInstance(r.adapter,e,r.contextHandler.get("user","global"))}},cart:{scope:"global",cachable:!1,load:function(e,t,r){return t.CartViewModel.getInstance(t.adapter,e,r,t.contextHandler.get("user","global"))}},order:{scope:"page",cachable:!1,load:function(e,t,r){return t.OrderViewModel.getInstance(t.adapter,t.contextHandler.get("cart","global"),e,r,t.contextHandler.get("user","global"))}},confirmation:{cachable:!0,load:!0},productList:{cachable:!0,load:function(e,t,r){return e.products}},categoryList:{cachable:!1,load:function(e,t,r){return e}},search:{scope:"global",cachable:!1,load:function(e,t,r){return t.SearchViewModel.getInstance(t.adapter,e,r)}},site:{scope:"global",cachable:!1,load:function(e,t,r){return t.SiteViewModel.getInstance(t.adapter,e,r)}},shippingmethods:{scope:"page",cachable:!1,load:function(e,t,r){return t.ShippingMethodsViewModel.getInstance(t.adapter,e)}},paymentauthorization:{scope:"page",cachable:!1,load:function(e,t,r){var i=new t.PaymentAuthResponseViewModel(t.adapter,e);return i}},space:{scope:"global",cachable:!1,load:function(e,t,r){return t.SpaceViewModel.getInstance(t.adapter,e,r)}},user:{scope:"global",cachable:!1,load:function(e,t,r){return t.UserViewModel.getInstance(t.adapter,e,r)}},orderDetails:{scope:"page",cachable:!1,load:function(e,t,r){return new t.OrderDetailsViewModel(e)}},orderDetailsAgent:{scope:"page",cachable:!1,load:function(e,t,r){return new t.OrderDetailsWrapperViewModel.getInstance(e,r)}}}}),define("viewModels/searchResultDetails",["knockout","ccConstants","ccLogger"],function(e,t,r){"use strict";function i(){if(null!==a)throw new Error("Cannot instantiate more than one SearchResultDetails, use SearchResultDetails.getInstance()");this.initialize()}var a=null;return i.prototype={initialize:function(){this.searchResults=[],this.totalRecordsFound=0,this.recordsPerPage=t.DEFAULT_SEARCH_RECORDS_PER_PAGE,this.searchAdjustments={},this.breadcrumbs={},this.navigation={},this.pageCount=0,this.recordOffSet=0},update:function(e){var i=[],a=[];if(null!=e){if(e["@error"])return void r.error("An error occurred while searching -"+e["@error"]);if(e.searchEventSummary&&(this.searchEventSummary=e.searchEventSummary),e.resultsList){var o="records"in e.resultsList?e.resultsList.records:[];this.searchResults=this.formatSearchResults(o),this.totalRecordsFound="totalNumRecs"in e.resultsList?e.resultsList.totalNumRecs:0,this.recordsPerPage="totalNumRecs"in e.resultsList?e.resultsList.recsPerPage:t.DEFAULT_SEARCH_RECORDS_PER_PAGE,this.recordOffSet="firstRecNum"in e.resultsList?e.resultsList.firstRecNum-1:0;var n=this.totalRecordsFound%this.recordsPerPage>0?1:0;this.pageCount=this.totalRecordsFound>0?Math.floor(this.totalRecordsFound/this.recordsPerPage)+n:0,"pagingActionTemplate"in e.resultsList&&(this.pagingActionTemplate=e.resultsList.pagingActionTemplate)}e.searchAdjustments&&(e.searchAdjustments.originalTerms&&(i=e.searchAdjustments.originalTerms),"function"!=typeof String.prototype.endsWith&&(String.prototype.endsWith=function(e){return this.indexOf(e,this.length-e.length)!==-1}),"undefined"!=typeof i[0]&&i[0]==t.PRODUCT_DISPLAYABLE&&i.splice(0,1),a=i.slice(),$.each(i,function(e,r){r.endsWith(t.SEARCH_WILDCARD)&&(i[e]=r.substr(0,r.length-1))}),e.searchAdjustments.originalTerms=i,e.searchAdjustments.originalSearchTerms=a),this.searchAdjustments=e.searchAdjustments,this.breadcrumbs=e.breadcrumbs,e.navigation&&(this.navigation=e.navigation.navigation),e.assemblerRequestInformation&&(this.assemblerRequestInformation=e.assemblerRequestInformation);var s=["@appFilterState","lastPublishedTime","___etag___","__stateData__","endeca:auditInfo","endeca:siteRootPath","resultsList","navigation","searchAdjustments","breadcrumbs","assemblerRequestInformation"];for(var l in e)s.indexOf(l)==-1&&(this[l]=e[l])}},formatSearchResults:function(e){for(var r=[],i=0;i<e.length;i++)if(e[i].attributes[t.SEARCH_RECORD_COLLECTION])r.push(e[i]);else{var a=this.formatRecord(e[i].records[0]);a.childSKUs=this.formatChildSkus(e[i].records);var o=["sku.maxActivePrice","sku.minActivePrice","product.repositoryId"];for(var n in e[i].attributes)o.indexOf(n)==-1&&(a[n]=e[i].attributes[n]);e[i].attributes["sku.maxActivePrice"]&&e[i].attributes["sku.maxActivePrice"][0]&&(a.maxActivePrice=e[i].attributes["sku.maxActivePrice"][0]),e[i].attributes["sku.minActivePrice"]&&e[i].attributes["sku.minActivePrice"][0]&&(a.minActivePrice=e[i].attributes["sku.minActivePrice"][0]),a.originalRecord=e[i],r.push(a)}return r},formatChildSkus:function(e){for(var t=e.length,r=[],i=0;i<t;i++)r[i]={salePrice:e[i].attributes["sku.salePrice"]?e[i].attributes["sku.salePrice"][0]:null,listPrice:e[i].attributes["sku.listPrice"]?e[i].attributes["sku.listPrice"][0]:null,repositoryId:e[i].attributes["sku.repositoryId"],largeImage:{url:e[i].attributes["sku.listingLargeImageURL"]?e[i].attributes["sku.listingLargeImageURL"][0]:""},smallImage:{url:e[i].attributes["sku.listingSmallImageURL"]?e[i].attributes["sku.listingSmallImageURL"][0]:""},primaryThumbImageURL:e[i].attributes["sku.listingThumbImageURL"]?e[i].attributes["sku.listingThumbImageURL"][0]:""};return r},formatRecord:function(e){var t,r,i={},a=["product.repositoryId","product.displayName","product.shippingSurcharge","product.listPrice","product.salePrice","product.description","sku.styleProperty","product.avgCustRating","product.primaryImageAltText","product.primaryImageTitle","product.primaryLargeImageURL","product.primarySmallImageURL","product.primaryMediumImageURL","product.primaryFullImageURL","product.primaryThumbImageURL","sku.listingFullImageURL"];for(var o in e.attributes)a.indexOf(o)==-1&&(i[o]=e.attributes[o]);if(e.attributes["product.repositoryId"]?(i.id=e.attributes["product.repositoryId"],i.repositoryId=e.attributes["product.repositoryId"]):(i.id="",i.repositoryId=""),e.attributes["product.displayName"]?i.displayName=e.attributes["product.displayName"][0]:i.displayName="",e.attributes["product.shippingSurcharge"]?i.shippingSurcharge=Number(e.attributes["product.shippingSurcharge"]):i.shippingSurcharge=0,i.listPrice=Number(e.attributes["product.listPrice"]),i.salePrice=Number(e.attributes["product.salePrice"]),e.attributes["product.description"]?e.attributes["product.description"]instanceof Array&&e.attributes["product.description"].length>0?(i.description=e.attributes["product.description"][0],i.longDescription=e.attributes["product.description"][0]):(i.description=e.attributes["product.description"],i.longDescription=e.attributes["product.description"]):(i.description="",i.longDescription=""),i.route=e.attributes["product.route"]&&e.attributes["product.route"][0]?e.attributes["product.route"][0]:"",Array.isArray(e.attributes["sku.styleProperty"])&&(t=e.attributes["sku.styleProperty"][0],t&&(Array.isArray(e.attributes["sku."+t])&&(r=e.attributes["sku."+t][0]),r&&(i.listingSku={},i.listingSku.images=[],i.listingSku.route=i.route+"?variantName="+t+"&variantValue="+r))),e.attributes["product.avgCustRating"]&&(i.avgCustRating=e.attributes["product.avgCustRating"]),e.attributes["product.primaryImageAltText"]&&(i.primaryImageAltText=e.attributes["product.primaryImageAltText"]),e.attributes["product.primaryImageTitle"]&&(i.primaryImageTitle=e.attributes["product.primaryImageTitle"]),i.primaryLargeImageURL=e.attributes["product.primaryLargeImageURL"]&&e.attributes["product.primaryLargeImageURL"][0]?e.attributes["product.primaryLargeImageURL"][0]:"",i.primarySmallImageURL=e.attributes["product.primarySmallImageURL"]&&e.attributes["product.primarySmallImageURL"][0]?e.attributes["product.primarySmallImageURL"][0]:"",
- i.primaryThumbImageURL=e.attributes["product.primaryThumbImageURL"]&&e.attributes["product.primaryThumbImageURL"][0]?e.attributes["product.primaryThumbImageURL"][0]:"",i.primaryMediumImageURL=e.attributes["product.primaryMediumImageURL"]&&e.attributes["product.primaryMediumImageURL"][0]?e.attributes["product.primaryMediumImageURL"][0]:"",i.primaryFullImageURL=e.attributes["product.primaryFullImageURL"]&&e.attributes["product.primaryFullImageURL"][0]?e.attributes["product.primaryFullImageURL"][0]:"",e.attributes["sku.listingFullImageURL"]&&e.attributes["sku.listingFullImageURL"][0]){var n={};n.metadata={},i.listingSku||(i.listingSku={},i.listingSku.images=[],i.listingSku.route=i.route),i.listingSku.images.push(n),e.attributes["sku.listingLargeImageURL"]&&(i.listingSku.primaryLargeImageURL=e.attributes["sku.listingLargeImageURL"][0]),e.attributes["sku.listingSmallImageURL"]&&(i.listingSku.primarySmallImageURL=e.attributes["sku.listingSmallImageURL"][0]),e.attributes["sku.listingThumbImageURL"]&&(i.listingSku.primaryThumbImageURL=e.attributes["sku.listingThumbImageURL"][0]),e.attributes["sku.listingMediumImageURL"]&&(i.listingSku.primaryMediumImageURL=e.attributes["sku.listingMediumImageURL"][0]),e.attributes["sku.listingFullImageURL"]&&(i.listingSku.primaryFullImageURL=e.attributes["sku.listingFullImageURL"][0])}return i}},i.getInstance=function(){return null===a&&(a=new i),a},i.getInstance()}),define("pageLayout/search",["knockout","pubsub","ccLogger","viewModels/searchResultDetails","ccConstants","pageViewTracker","navigation","ccStoreConfiguration"],function(e,t,r,i,a,o,n,s){"use strict";function l(c,d){if(l.prototype.singleInstance)throw new Error("Cannot instantiate more than one SearchViewModel, use SearchViewModel.getInstance(pAdapter, data)");var u=this;return u.siteId="Default",u.pagePath="searchresults",u.defaultTypeaheadService="Default/services/typeahead",u.popularTypeaheadSearchService="Default/keywords/typeahead",u.popularTypeaheadSearchInterface="keywords",u.searchPathPattern=RegExp("^.*("+u.pagePath+".*)$"),u.adapter=c,u.isNewSearch=!0,u.isCategorySearch=!1,u.isRequesting=!1,u.searchLocale=e.observable(),u.storeConfiguration=s.getInstance(),u.createSearch=function(e){var t,r=this,i=!(!window.clientConfigData||!window.clientConfigData.useEnhancedSearch||"true"!=window.clientConfigData.useEnhancedSearch);u.assemblerPagesPath=null,r.getFromUrlParam&&(r=u);for(var n in this)this.hasOwnProperty(n)&&(r[n]=this[n]);if(t={},"undefined"!=typeof r.navigationDescriptors&&""!=r.navigationDescriptors&&(t[a.SEARCH_NAV_DESCRIPTORS_KEY]=r.navigationDescriptors),null!==r.suppressResults&&void 0!==r.suppressResults&&(t[a.SEARCH_SUPPRESS_RESULTS]=r.suppressResults),r.searchType&&(t[a.SEARCH_TYPE]=r.searchType),null!==r.recordOffSet&&void 0!==r.recordOffSet&&(t[a.SEARCH_NAV_ERECS_OFFSET]=r.recordOffSet),null!==r.recordsPerPage&&void 0!==r.recordsPerPage&&(t[a.SEARCH_REC_PER_PAGE_KEY]=r.recordsPerPage),r.recSearchKey&&(t[a.SEARCH_NAV_EREC_SEARCHES_KEY]=r.recSearchKey),r.searchText&&(t[a.SEARCH_TERM_KEY]=r.searchText),r.searchInterface&&(t[a.SEARCH_NAV_EREC_SEARCHES_KEY]=r.searchInterface),r.sortDirectiveProperty){var s=r.sortDirectiveProperty;s+=void 0!==r.sortDirectiveOrder&&"desc"===r.sortDirectiveOrder?"|1":"|0",t[a.SEARCH_SORT_ORDER]=s}r.recSpellCorrectionKey&&(t[a.SEARCH_DYM_SPELL_CORRECTION_KEY]=r.recSpellCorrectionKey),r.rangeFilter&&(t[a.SEARCH_RANGE_FILTER]=r.rangeFilter),r.recFilter&&(t[a.SEARCH_NAV_RECORD_FILTER_KEY]=r.recFilter),r.additionalSearchQueryParams&&(t=Object.assign(t,r.additionalSearchQueryParams));var l=["page"];for(var c in r.searchKeysMap)l.indexOf(c)<0&&(null==t[c]||void 0==t[c])&&(t[c]=r.searchKeysMap[c]);t[a.VISITOR_ID]=o.getVisitorId(),t[a.VISIT_ID]=o.getVisitId(),t[a.SEARCH_LANGUAGE]=u.searchLocale(),void 0!==r.newSearch?u.isNewSearch=r.newSearch:u.isNewSearch=!0;var d=u.siteId+"/"+u.pagePath,p=window.location.pathname,h=u.searchPathPattern.exec(p);if(null!=h){var g=h[1];d=u.siteId+"/"+g}e.assemblerPagesPath?(d=d.replace(u.pagePath,e.assemblerPagesPath),u.assemblerPagesPath=e.assemblerPagesPath):u.assemblerPagesPath=null,u.isRequesting||(u.isRequesting=!0,void 0!==r.searchText?u.isCategorySearch=!1:u.isCategorySearch=!0,i||u.assemblerPagesPath?u.adapter.loadJSON(a.ENDPOINT_SEARCH_ASSEMBLER_PAGES,d,t,u.searchSuccess,u.searchError):u.adapter.loadJSON(a.ENDPOINT_SEARCH_SEARCH,d,t,u.searchSuccess,u.searchError),u.matchedSearchPath="")},u.createSearchAndAddData=function(e){u.searchKeysMap={},this.parameters.page&&"number"==typeof parseInt(this.parameters.page)?u.pageNumber=parseInt(this.parameters.page):u.pageNumber=1,null===this.parameters[a.SEARCH_NAV_ERECS_OFFSET]||void 0===this.parameters[a.SEARCH_NAV_ERECS_OFFSET]||"number"!=typeof parseInt(this.parameters[a.SEARCH_NAV_ERECS_OFFSET])?u.recordOffSet=0+(u.pageNumber-1)*a.DEFAULT_SEARCH_RECORDS_PER_PAGE:u.recordOffSet=parseInt(this.parameters[a.SEARCH_NAV_ERECS_OFFSET])+(u.pageNumber-1)*a.DEFAULT_SEARCH_RECORDS_PER_PAGE,u.searchKeysMap[a.SEARCH_NAV_ERECS_OFFSET]=u.recordOffSet,null===this.parameters[a.SEARCH_REC_PER_PAGE_KEY]||void 0===this.parameters[a.SEARCH_REC_PER_PAGE_KEY]||"number"!=typeof parseInt(this.parameters[a.SEARCH_REC_PER_PAGE_KEY])?u.recordsPerPage=a.DEFAULT_SEARCH_RECORDS_PER_PAGE:u.recordsPerPage=parseInt(this.parameters[a.SEARCH_REC_PER_PAGE_KEY]),u.searchKeysMap[a.SEARCH_REC_PER_PAGE_KEY]=u.recordsPerPage,null!==this.parameters[a.SEARCH_TERM_KEY]&&void 0!==this.parameters[a.SEARCH_TERM_KEY]?(u.searchText=decodeURIComponent(this.parameters[a.SEARCH_TERM_KEY]),u.searchKeysMap[a.SEARCH_TERM_KEY]=u.searchText):u.searchText="",null!==this.parameters[a.SEARCH_NAV_EREC_SEARCHES_KEY]&&void 0!==this.parameters[a.SEARCH_NAV_EREC_SEARCHES_KEY]&&(u.recSearchKey=decodeURIComponent(this.parameters[a.SEARCH_NAV_EREC_SEARCHES_KEY]),u.searchKeysMap[a.SEARCH_NAV_EREC_SEARCHES_KEY]=u.recSearchKey),void 0===u.recSearchKey&&(u.recSearchKey=""),null!==this.parameters[a.SEARCH_NAV_DESCRIPTORS_KEY]&&void 0!==this.parameters[a.SEARCH_NAV_DESCRIPTORS_KEY]?(u.navigationDescriptors=decodeURIComponent(this.parameters[a.SEARCH_NAV_DESCRIPTORS_KEY]).replace(/\+/g," "),u.searchKeysMap[a.SEARCH_NAV_DESCRIPTORS_KEY]=u.navigationDescriptors):u.navigationDescriptors="";for(var t in this.parameters)if(t==a.PARAMETERS_TYPE){if(this.parameters[t]!=a.PARAMETERS_SEARCH_QUERY)return}else null!==this.parameters[t]&&void 0!==this.parameters[t]&&(u.searchKeysMap[t]=decodeURIComponent(this.parameters[t]))},u.searchSuccess=function(e){if(e&&e["endeca:redirect"]&&e["endeca:redirect"].link&&e["endeca:redirect"].link.url){var o=e["endeca:redirect"].link.url;return"/"!==o.charAt(0)?navigator.userAgent.match(/Trident/)||navigator.userAgent.match(/Edge/)?window.open(o,"_newtab"):window.location.replace(o):n.goTo(o,!1,!0),void(u.isRequesting=!1)}var s=[{message:a.SEARCH_MESSAGE_SUCCESS,requestor:u}];e["@error"]?(r.error("search error returned :"+e["@error"]),s=[{message:a.SEARCH_MESSAGE_FAIL}]):(e.assemblerPagesPath=u.assemblerPagesPath,i.update(e),i.isNewSearch=u.isNewSearch),u.isCategorySearch?$.Topic(t.topicNames.SEARCH_RESULTS_FOR_CATEGORY_UPDATED).publishWith(i,s):$.Topic(t.topicNames.SEARCH_RESULTS_UPDATED).publishWith(i,s),u.isRequesting=!1},u.searchError=function(e){if(u.isCategorySearch)$.Topic(t.topicNames.SEARCH_FAILED_TO_PERFORM).publish();else{var r=[{message:a.SEARCH_MESSAGE_FAIL}];$.Topic(t.topicNames.SEARCH_RESULTS_UPDATED).publishWith(e,r)}u.isRequesting=!1},u.typeaheadSearch=function(e){var t,r;void 0!==this.searchText&&(this.searchText=this.searchText.trim()),void 0!==this.typeaheadConfig&&void 0!==this.typeaheadConfig.searchText&&(this.searchText=this.typeaheadConfig.searchText);var i=this.typeaheadConfig,n=function(e){u.successTypeahead(e,i)},s=o.getVisitorId(),l=o.getVisitId();r={},r[a.SEARCH_TERM_KEY]=this.searchText,r[a.SEARCH_NAV_EREC_SEARCHES_KEY]=a.TYPEAHEAD_SEARCH_INTERFACE,r[a.VISITOR_ID]=s,r[a.VISIT_ID]=l,r[a.SEARCH_TYPE]=a.SEARCH_TYPE_TYPEAHEAD,r[a.SEARCH_LANGUAGE]=u.searchLocale(),r[a.ASSEMBLER_PATH_QUERY_PARAM]=a.ASSEMBLER_DEFAULT_TYPEAHEAD_PATH,r[a.ASSEMBLER_REDIRECTS_QUERY_PARAM]="yes",r[a.ASSEMBLER_SITE_QUERY_PARAM]="default",void 0!==this.typeaheadConfig&&void 0!==this.typeaheadConfig.queryParams?(void 0!==this.newSearch&&(u.isNewSearch=this.newSearch),this.typeaheadConfig.queryParams.forEach(function(e,t){r[t]=e}),$.each(this.typeaheadConfig.queryParams,function(e,t){r[e]=t}),i.usePopularSearch===!0?(r[a.SEARCH_NAV_EREC_SEARCHES_KEY]=u.popularTypeaheadSearchInterface,t=u.popularTypeaheadSearchService,u.adapter.loadJSON(a.ENDPOINT_SEARCH_ASSEMBLER_PAGES,t,r,n,u.failureTypeahead)):(t=i.assemblerPagesPath?i.assemblerPagesPath:"Default/services/typeahead",u.adapter.loadJSON(a.ENDPOINT_SEARCH_ASSEMBLER_PAGES,t,r,n,u.failureTypeahead))):(r[a.SEARCH_NAV_ERECS_OFFSET]=this.recordOffSet,r[a.SEARCH_REC_PER_PAGE_KEY]=this.recordsPerPage,void 0!==this.newSearch&&(u.isNewSearch=this.newSearch),t="assembler",u.adapter.loadJSON("assembler",t,r,u.typeaheadSuccess,u.typeaheadError))},u.successTypeahead=function(e,t){var i=[{message:a.SEARCH_MESSAGE_SUCCESS}];if(e["@error"]&&(r.error("search error returned :"+e["@error"]),i=[{message:a.SEARCH_MESSAGE_FAIL}]),e.resultsList&&e.resultsList.records)for(var o=e.resultsList.records,n=0;n<o.length;n++)if(t.assemblerPagesPath||t.usePopularSearch===!0)t.searchResults.push(o[n].attributes);else{var s,l=o[n].records[0],c={};if($.each(t.displayProps,function(e,t){l.attributes[t]&&void 0!==l.attributes[t]?c[t]=l.attributes[t][0]:c[t]=""}),c["product.route"]=l.attributes["product.route"][0],Array.isArray(l.attributes["sku.styleProperty"])&&$.each(l.attributes["sku.styleProperty"],function(e,t){var r;Array.isArray(l.attributes["sku."+t])&&(r=l.attributes["sku."+t][0]),r&&(c["product.route"]=c["product.route"]+"?variantName="+t+"&variantValue="+r)}),o[n].attributes&&o[n].attributes["sku.minActivePrice"]&&Array.isArray(o[n].attributes["sku.minActivePrice"]))s=o[n].attributes["sku.minActivePrice"][0];else{var d,u=l.attributes["product.salePrice"]?l.attributes["product.salePrice"][0]:null,p=l.attributes["product.listPrice"]?l.attributes["product.listPrice"][0]:null,h=u?u:p;Array.isArray(o[n].records)&&o[n].records.length>0&&$.each(o[n].records,function(e,t){var r=t.attributes["sku.salePrice"]?t.attributes["sku.salePrice"][0]:null,i=t.attributes["sku.listPrice"]?t.attributes["sku.listPrice"][0]:null,a=r?r:i;a||(a=h),(!d||a<d)&&(d=a)}),s=d}c.displayPrice=s,c["product.repositoryId"]=l.attributes["product.repositoryId"][0],Array.isArray(l.attributes["product.primaryImageAltText"])?c["product.primaryImageAltText"]=l.attributes["product.primaryImageAltText"][0]:c["product.primaryImageAltText"]="",Array.isArray(l.attributes["product.primaryImageTitle"])?c["product.primaryImageTitle"]=l.attributes["product.primaryImageTitle"][0]:c["product.primaryImageTitle"]="",t.searchResults.push(c)}var e=void 0!==t.getSearchResponse&&t.getSearchResponse?e:null;t.displayCallback(t,e)},u.failureTypeahead=function(e){r.error("Couldn't execute typeahead search query.")},u.typeaheadSuccess=function(e){var o=[{message:a.SEARCH_MESSAGE_SUCCESS}];e["@error"]&&(r.error("search error returned :"+e["@error"]),o=[{message:a.SEARCH_MESSAGE_FAIL}]);var n=[];if(e.resultsList&&e.resultsList.records){var s=[];n=e.resultsList.records,i.update(e),s.push(i.searchResults),s.push(n)}$.Topic(t.topicNames.SEARCH_TYPEAHEAD_UPDATED).publishWith(s,[{message:"success"}])},u.typeaheadError=function(e){var r=([{message:a.SEARCH_MESSAGE_FAIL}],[]);$.Topic(t.topicNames.SEARCH_TYPEAHEAD_UPDATED).publishWith(r,[{message:"success"}])},$.Topic(t.topicNames.SEARCH_CREATE_CATEGORY_LISTING).subscribe(u.createSearch),$.Topic(t.topicNames.SEARCH_CREATE).subscribe(u.createSearch),$.Topic(t.topicNames.PAGE_PARAMETERS).subscribe(u.createSearchAndAddData),$.Topic(t.topicNames.SEARCH_TYPEAHEAD).subscribe(u.typeaheadSearch),u}return l.prototype.setContext=function(e){var t=this;e.global.locale&&t.searchLocale(e.global.locale),t.contextData=e},l.getInstance=function(e,t,r){return l.prototype.singleInstance||(l.prototype.singleInstance=new l(e,t)),r&&l.prototype.singleInstance.setContext(r),l.prototype.singleInstance},l.prototype.getFilteredNavState=function(e){for(var t=[],r=[a.VISITOR_ID,a.VISIT_ID,a.SEARCH_LANGUAGE,a.SEARCH_TYPE],i=e.split("&"),o=0;o<i.length;o++){var n=i[o].split("=");r.indexOf(n[0])==-1&&t.push(i[o])}return t.join("&")},l}),define("viewModels/shippingMethodItemViewModel",["knockout","pubsub","ccStoreUtils"],function(e,t,r){"use strict";function i(i,a){var o=this;return r.fromJS(i,o,!0),o.cartValue=e.observable(a),o.estimatedCostText=e.computed(function(){var e=o.calcCorrectAmout(o.cartValue());if(null!=e)var t=e.toFixed(2).toString();return t},o),o.secondaryCurrencyShippingCost=e.pureComputed(function(){var e=o.calcCorrectAmountInSecondaryCurrency(o.cartValue());if(null!=e)var t=e.toFixed(2).toString();return t},o),o.shippingCost=e.computed(function(){var e=o.calcCorrectAmout(o.cartValue());return e},o),o.cartUpdatedMethod=function(e){o.cartValue(e.amount())},$.Topic(t.topicNames.CART_UPDATED).subscribe(o.cartUpdatedMethod),o}return i.prototype.calcCorrectAmout=function(e){for(var t=this,r=0,i=0;i<t.ranges.length;i++){var a=t.ranges[i].high,o=t.ranges[i].low;null==t.ranges[i].high&&(a=Number.MAX_VALUE),e>=o&&e<=a&&(r=t.ranges[i].amount)}return r},i.prototype.calcCorrectAmountInSecondaryCurrency=function(e){for(var t=this,r=0,i=0;i<t.ranges.length;i++){var a=t.ranges[i].high,o=t.ranges[i].low;null==t.ranges[i].high&&(a=Number.MAX_VALUE),e>=o&&e<=a&&(r=t.ranges[i].secondaryCurrencyShippingAmount)}return r},i}),define("pageLayout/shippingmethods",["knockout","pubsub","ccConstants","viewModels/shippingMethodItemViewModel","ccLogger","pageLayout/cart","jquery","ccRestClient"],function(e,t,r,i,a,o,n,s){"use strict";function l(c,d){if(l.singleInstance)throw new Error("Cannot instantiate more than one ShippingMethodsViewModel, use getInstance(pAdapter, data)");var u=this;return u.adapter=c,u.shippingOptions=e.observableArray(),u.defaultShipping=e.observable(),u.defaultShippingName=e.observable(),u.isOrderInRequestPayloadAllowed=e.observable(!1),u.fetchRequestPayloadFlag=function(){if(window&&window.clientConfigData)"true"===window.clientConfigData.includeOrderDetailsInShippingMethodsPayload&&u.isOrderInRequestPayloadAllowed(!0);else{var e=r.ENDPOINT_GET_CLOUD_CONFIGURATION;s.request(e,null,function(e){e&&e.clientConfiguration&&e.clientConfiguration.includeOrderDetailsInShippingMethodsPayload&&u.isOrderInRequestPayloadAllowed(!0)},function(e){u.isOrderInRequestPayloadAllowed(!1)})}},u.loadShippingOptions=function(){var e=this[r.SHIPPING_ADDRESS_FOR_METHODS];if(e){if(!e.afterValidation||!u.cart.shippingMethod())if(u.isOrderInRequestPayloadAllowed()){var l=function(e){if(e.items&&1==e.items.length){u.shippingOptions.removeAll(),u.cart=o.getInstance(null,null,null);for(var a=0;a<e.items[0].shippingMethods.length;a++)u.shippingOptions.push(new i(e.items[0].shippingMethods[a],u.cart?u.cart.amount():0));u.setDefaultShipping();var s=[{message:r.SEARCH_MESSAGE_SUCCESS}];n.Topic(t.topicNames.SHIPPING_METHODS_LOADED).publishWith(u,s),u.cart.shippingMethodsLoaded.call(u)}},c=function(e){e&&e.message&&""!==e.message?a.error("order.loadShippingMethod"+e.message):a.error("order.loadShippingMethod - unknown error returned"),n.Topic(t.topicNames.LOAD_SHIPPING_METHODS_FAILED).publishWith(e)};void 0!==this[r.PROFILE_ID]&&(u[r.PROFILE_ID]=this[r.PROFILE_ID]),u.loadMultipleShippingOptions(l,c)}else{var d={};u.cart=o.getInstance(null,null,null),d[r.PRODUCT_IDS_FOR_SHIPPING]=this[r.PRODUCT_IDS_FOR_SHIPPING],void 0!==this[r.PROFILE_ID]&&(d[r.PROFILE_ID]=this[r.PROFILE_ID]),void 0!==this[r.SECONDARY_CURRENCY_CODE]&&(d[r.SECONDARY_CURRENCY_CODE]=this[r.SECONDARY_CURRENCY_CODE]),d.priceInfo={amount:u.cart.amount(),total:u.cart.total(),shipping:u.cart.shipping(),totalWithoutTax:u.cart.totalWithoutTax(),currencyCode:u.cart.currencyCode(),shippingSurchargeValue:u.cart.shippingSurcharge(),tax:u.cart.tax(),subTotal:u.cart.subTotal(),orderDiscount:u.cart.orderDiscount(),coupons:u.cart.coupons()},d.items=[];for(var p=0;p<u.cart.items().length;p++){var h=u.cart.items()[p];h.price=h.itemTotal,d.items.push(h)}d[r.SHIPPING_ADDRESS_FOR_METHODS]=e.toJSON(),d[r.POPULATE_SHIPPING_METHODS]=!0;var g=function(e){var a;if(u.shippingOptions.removeAll(),u.cart=o.getInstance(null,null,null),s.profileType!=r.PROFILE_TYPE_AGENT||""!=u.cart.shippingAddress()){if(void 0!==e){for(a=0;a<e.length;a++)u.shippingOptions.push(new i(e[a],u.cart?u.cart.amount():0));u.setDefaultShipping()}var l=[{message:r.SEARCH_MESSAGE_SUCCESS}];n.Topic(t.topicNames.SHIPPING_METHODS_LOADED).publishWith(u,l),u.cart.shippingMethodsLoaded.call(u)}},f=function(e){e&&e.message&&""!==e.message?a.error("order.loadShippingMethod"+e.message):a.error("order.loadShippingMethod - unknown error returned"),n.Topic(t.topicNames.LOAD_SHIPPING_METHODS_FAILED).publishWith(e)};u.loadMultipleShippingOptions(g,f,d)}delete e.afterValidation}},n.Topic(t.topicNames.RELOAD_SHIPPING_METHODS).subscribe(u.loadShippingOptions),u.createProductIdsFromShippingGroupItems=function(e,t){for(var r=0;r<e.length;r++)t.indexOf(e[r].productId)==-1&&t.push(e[r].productId),e[r].childItems&&e[r].childItems.length>0&&u.createProductIdsFromShippingGroupItems(e[r].childItems,t)},u.loadMultipleShippingOptions=function(e,t,i){var a=null;if(i)a=i;else{u.cart=o.getInstance(null,null,null);var n=u.cart.createCartPricingModel();n.priceInfo={amount:u.cart.amount(),total:u.cart.total(),shipping:u.cart.shipping(),totalWithoutTax:u.cart.totalWithoutTax(),currencyCode:u.cart.currencyCode(),shippingSurchargeValue:u.cart.shippingSurcharge(),tax:u.cart.tax(),subTotal:u.cart.subTotal(),orderDiscount:u.cart.orderDiscount(),coupons:u.cart.coupons()},n.shippingGroups=u.cart.createShippingGroups(!0);for(var l=0;l<n.shippingGroups.length;l++){var c=[];u.createProductIdsFromShippingGroupItems(n.shippingGroups[l].items,c),n.shippingGroups[l].productIdForShippingSurcharge=c,delete n.shippingGroups[l].shippingMethod}void 0!==this[r.PROFILE_ID]&&(n[r.PROFILE_ID]=this[r.PROFILE_ID]),a=n,a.id&&delete a.id}s.request(r.ENDPOINT_SHIPPING_METHODS_LIST_SHIPPING_METHODS,a,function(t){e(t)},function(e){t(e)})},u.cart=o.getInstance(null,null,null),u.cart.registerMultiShippingMethodsCallback(u.loadMultipleShippingOptions),u}return l.prototype.updateEstimatedTextCost=function(t){var r=this;e.utils.arrayForEach(r.shippingOptions(),function(e){e.cartValue(t)})},l.prototype.calcCorrectAmout=function(e,t){for(var r=0,i=0;i<e.ranges.length;i++){var a=e.ranges[i].high,o=e.ranges[i].low;null==e.ranges[i].high&&(a=Number.MAX_VALUE),t>=o&&t<=a&&(r=e.ranges[i].amount)}return r},l.prototype.setDefaultShipping=function(){var e=this;e.shippingOptions().length>=1&&(e.defaultShipping(e.shippingOptions()[0].repositoryId),e.defaultShippingName(e.shippingOptions()[0].displayName))},l.getInstance=function(e,t){return l.singleInstance||(l.singleInstance=new l(e,t),l.singleInstance.fetchRequestPayloadFlag()),l.singleInstance},l}),define("pageLayout/payment-auth-response",["pubsub","ccConstants","ccLogger","ccStoreServerLogger","ccStoreConfiguration"],function(e,t,r,i,a){"use strict";function o(r,o){var s=this;return s.adapter=r,s.numOfRetries=o.maxTries?o.maxTries:t.PAYMENT_AUTHORIZATION_DEFAULT_TRIES,s.delay=o.interval?o.interval:t.PAYMENT_AUTHORIZATION_DEFAULT_INTERVAL,s.storeServerLog=i.getInstance(),s.storeConfiguration=a.getInstance(),void 0!=n&&$.Topic(e.topicNames.PAYMENT_GET_AUTH_RESPONSE).unsubscribe(n),n=s.paymentAuthorizedRequest.bind(this),$.Topic(e.topicNames.PAYMENT_GET_AUTH_RESPONSE).subscribe(n),s}var n;return o.prototype.paymentAuthorizedRequest=function(e){var t=this;e[0].numOfRetries&&(t.numOfRetries=e[0].numOfRetries),e[0].delay&&(t.delay=e[0].delay),t.getPaymentAuthorization(e[0].transactionuuid,e[0].orderid,e[0].orderuuid,e[0].gatewayname,e[0].paymentGroupId)},o.prototype.getPaymentAuthorization=function(e,t,r,i,a){var o=this;o.checkForAuthorization(e,t,r,i,0,a)},o.prototype.checkForAuthorization=function(i,a,o,n,s,l){function c(){if(s<=u.numOfRetries)setTimeout(function(){u.checkForAuthorization(i,a,o,n,s+1,l)},u.delay);else{var t={orderId:a};u.storeServerLog.logError("paymentTimeOut",u.storeServerLog.getMessage("paymentTimeOut",t));var r=[{message:"fail",id:a,gatewayName:n,type:n}];$.Topic(e.topicNames.PAYMENT_AUTH_TIMED_OUT).publish(r)}}function d(e){var t;return e.length>0&&(t=e[e.length-1]),t}var u=this,p={},h={};h[t.ENDPOINT_KEY]=t.ENDPOINT_GET_PAYMENT_GROUP;var g=u.storeConfiguration.getFilterToUse(h);g&&(p[t.FILTER_KEY]=g),u.adapter.loadJSON("paymentGroup",l,p,function(r){if(r.stateAsString&&r.orderStatus)if(r.stateAsString===t.PAYMENT_GROUP_STATE_INITIAL){var i=d(r.authorizationStatus);if(i&&i.authorizationDecision===t.PAYMENT_AUTHORIZATION_DECLINE&&i.reasonCode===t.CYBERSOURCE_PA_CHALLENGE_REASON_CODE){var s=[{message:"success",id:a,uuid:o,responsedata:i,gatewayName:n,orderState:r.orderStatus,paymentGroupId:r.id,type:n}];$.Topic(e.topicNames.CYBERSOURCE_PA_CHALLENGE_CODE_REQUIRED).publish(s)}c()}else if(r.stateAsString===t.PAYMENT_GROUP_STATE_REMOVED){var i=d(r.authorizationStatus);if(i){var s=[{message:"fail",id:a,uuid:o,responsedata:i,gatewayName:n,type:n}];s[0].responsedata.reasonCode=t.PROCESS_COMPLETION_FAILED,$.Topic(e.topicNames.PAYMENT_AUTH_DECLINED).publish(s)}}else if(r.stateAsString===t.PAYMENT_GROUP_STATE_AUTHORIZED||r.stateAsString===t.PAYMENT_GROUP_STATE_SETTLED){var i=d(r.authorizationStatus);if(i){var s=[{message:"success",id:a,uuid:o,responsedata:i,gatewayName:n,orderState:r.orderStatus,paymentGroupId:r.id,type:n}];i.authorizationDecision!==t.PAYMENT_AUTHORIZATION_ACCEPT&&1!=i.transactionSuccess||r.orderStatus!==t.SUBMITTED?i.authorizationDecision===t.PAYMENT_AUTHORIZATION_ACCEPT&&r.orderStatus==t.FAILED?(s[0].responsedata.reasonCode=t.PAYMENT_REVERSAL_FAILED,s[0].message="fail",$.Topic(e.topicNames.PAYMENT_AUTH_DECLINED).publish(s)):i.authorizationDecision!==t.PAYMENT_AUTHORIZATION_ACCEPT&&1!=i.transactionSuccess||r.orderStatus!==t.PENDING_PAYMENT&&r.orderStatus!==t.BEING_AMENDED?c():(s[0].orderState=r.orderStatus,$.Topic(e.topicNames.PAYMENT_AUTH_SUCCESS).publish(s)):($.Topic(e.topicNames.ORDER_COMPLETED).publish(s),$.Topic(e.topicNames.PAYMENT_AUTH_SUCCESS).publish(s))}}else{var i=d(r.authorizationStatus);if(i){var s=[{message:"success",id:a,uuid:o,responsedata:i,gatewayName:n,orderState:r.orderStatus,paymentGroupId:r.id,type:n}];i.authorizationDecision===t.PAYMENT_AUTHORIZATION_ACCEPT?($.Topic(e.topicNames.ORDER_COMPLETED).publish(s),$.Topic(e.topicNames.PAYMENT_AUTH_SUCCESS).publish(s)):(s[0].message="fail",$.Topic(e.topicNames.PAYMENT_AUTH_DECLINED).publish(s))}}else c()},function(e,t,i){e&&e.message&&""!==e.message?r.error("PaymentAuthResponseViewModel.checkForAuthorization - error -"+e.message):r.error("PaymentAuthResponseViewModel.checkForAuthorization -unknown error returned"),c()})},o}),define("pageLayout/parent-organisation",["knockout"],function(e){"use strict";function t(){this.id=e.observable(""),this.name=e.observable(""),this.description=e.observable(""),this.organizationLogoURL=e.observable(""),this.organizationLogoAltText=e.observable(""),this.organizationLogoTitle=e.observable(""),this.delegateApprovalManagement=e.observable("")}return t}),define("pageLayout/organization",["knockout","ccConstants","ccRestClient","viewModels/dynamicPropertyMetaContainer","pageLayout/parent-organisation"],function(e,t,r,i,a){"use strict";function o(o,n){var s=this,l=s.listOfIgnoreProperties();return e.mapping.fromJS(o,l,s),s.blockSize=20,s.sortProperty="email:asc",s.adapter=n,s.id=e.observable(""),s.active=e.observable(!1),s.relativeRoles=e.observable([]),s.approvalRequired=e.observable(!1),s.orderPriceLimit=e.observable(""),s.delegateApprovalManagement=e.observable(!1),s.numberOfActiveApprovers=e.observable(),s.isApprovalWebhookEnabled=e.observable(!1),s.parentOrganization=new a,s.dynamicProperties=e.observableArray(),s.dynamicPropertyMetaInfo=i.getInstance(),o&&(s.id(o.id),s.active(o.active),s.relativeRoles(o.relativeRoles),s.approvalRequired(o.approvalRequired),s.orderPriceLimit(o.orderPriceLimit),s.delegateApprovalManagement(o.delegateApprovalManagement),s.isApprovalWebhookEnabled(o.useExternalApprovalWebhook),e.mapping.fromJS(o.parentOrganization,{},s.parentOrganization),r.profileType==t.PROFILE_TYPE_AGENT?s.getApproverList():s.updatenumberOfActiveApprovers()),s}return o.prototype.updatenumberOfActiveApprovers=function(){var e,r,i=this;r={},r[t.OFFSET]=0,r[t.LIMIT]=i.blockSize,r[t.SORTS]=i.sortProperty;for(var a=i.relativeRoles().length,o=0;o<a;o++)"approver"===i.relativeRoles()[o].function&&(e=i.relativeRoles()[o].repositoryId);r.q='roles.id eq "'+e+'" AND active eq "1"',i.adapter.loadJSON(t.ENDPOINT_LIST_CONTACTS_BY_ORGANIZATION,null,r,function(e){i.numberOfActiveApprovers(e.totalResults)},function(e){})},o.prototype.populateOrganizationViewModel=function(i){var o=this,n=o.listOfIgnoreProperties();e.mapping.fromJS(i,n,o),i&&(o.id(i.id),o.active(i.active),o.relativeRoles(i.relativeRoles),o.approvalRequired(i.approvalRequired),o.orderPriceLimit(i.orderPriceLimit),o.delegateApprovalManagement(i.delegateApprovalManagement),o.isApprovalWebhookEnabled(i.useExternalApprovalWebhook),r.profileType==t.PROFILE_TYPE_AGENT?o.getApproverList():o.updatenumberOfActiveApprovers()),o.parentOrganization=new a,e.mapping.fromJS(i.parentOrganization,{},o.parentOrganization)},o.prototype.populateDynamicPropertiesMetaData=function(){var e=this,i={};i[t.PARENT]=t.ENDPOINT_ORGANIZATION_PARAM,e.dynamicPropertyMetaInfo&&e.dynamicPropertyMetaInfo.dynamicPropertyMetaCache&&!e.dynamicPropertyMetaInfo.dynamicPropertyMetaCache.hasOwnProperty(t.ENDPOINT_ORGANIZATION_PARAM)&&r.request(t.ENDPOINT_GET_ITEM_TYPE,i,function(r){e.dynamicPropertyMetaInfo.intializeDynamicProperties(r.specifications,t.ENDPOINT_ORGANIZATION_PARAM)},function(e){},t.ENDPOINT_ORGANIZATION_PARAM)},o.prototype.listOfIgnoreProperties=function(){var e={ignore:["id","active","relativeRoles","approvalRequired","orderPriceLimit","delegateApprovalManagement","numberOfActiveApprovers","isApprovalWebhookEnabled","parentOrganization"]};return e},o.prototype.getApproverList=function(){for(var e=this,i="",a=0;a<e.relativeRoles().length;a++)"approver"==e.relativeRoles()[a].function&&(i=e.relativeRoles()[a].repositoryId);var o={};o.q='(profileType eq "'+t.B2B_PROFILE_TYPE+'"',o.q+=' AND (roles co "'+i+'") AND active eq "1")',o.queryFormat="SCIM";var n=t.ENDPOINT_SEARCH_CUSTOMERS;r.request(n,o,function(t){e.numberOfActiveApprovers(t.items.length)},function(e){})},o.prototype.loadOrganizationsWithSelfRegistration=function(e,i){var a={};a.q='source eq "selfRegistration"',a.useAdvancedQParser=!0,r.request(t.ENDPOINT_B2B_ADMINISTRATION_LIST_ORGANIZATIONS,a,e,i)},o.prototype.getRegistrationRequest=function(e,i){var a=this,o={};o.q=t.ENDPOINT_ORGANIZATION_TYPE_PARAM+' eq "'+a.id()+'"',o.fields="id",r.request(t.ENDPOINT_LIST_ORGANIZATION_REQUESTS,o,e,i)},o.prototype.getRegistrationRequestNotes=function(e,i,a){var o={};o.fields="approverComments,requesterComments,siteId,relatedOrganizationName",r.request(t.ENDPOINT_GET_ORGANIZATION_REQUEST,o,i,a,e)},o.prototype.updateOrganization=function(e,i,a){var o=this;r.request(t.ENDPOINT_UPDATE_ORGANIZATION,e,i,a,o.id())},o.prototype.updateDynamicProperties=function(e){var r=this,i=r.dynamicPropertyMetaInfo.dynamicPropertyMetaCache[t.ENDPOINT_ORGANIZATION_TYPE_PARAM];r.initializeDynamicProperties(i,e)},o.prototype.initializeDynamicProperties=function(e,t){var r=this;r.dynamicProperties.removeAll();for(var i=[],a=0;a<e.length;a++)if(r.hasOwnProperty(e[a].id())){var o=r[e[a].id()]();if("checkbox"===e[a].type()&&o!==!0&&(o=!1),"update"===t||void 0!==o&&null!==o||"boolean"==typeof o)if("enum"===e[a].type()){for(var n=0;n<o.length;n++)value=o[n],e[a].values.push(value);i.push(e[a])}else e[a].value(o),i.push(e[a])}r.dynamicProperties(r.dynamicProperties().concat(i))},o.prototype.isOrganizationDynamicPropertiesValid=function(){for(var e=this,t=0;t<e.dynamicProperties().length;t++){var r=e.dynamicProperties()[t];if(!r.isValid())return!1}return!0},o.prototype.resetDynamicPropertiesValueIsModified=function(){for(var e=this,t=0;t<e.dynamicProperties().length;t++)e.dynamicProperties()[t].value.isModified&&e.dynamicProperties()[t].value.isModified(!1)},o}),define("viewModels/storeCreditContainer",["knockout"],function(e){"use strict";function t(){if(t.singleInstance)throw new Error("Cannot instantiate more than one StoreCreditContainer, use getInstance(data)");var r=this;r.userStoreCreditDetails={},r.totalStoreCredits=e.observable()}return t.prototype.populateViewModelWithServerData=function(e){var t=this;if(e&&e.paymentResponses&&e.paymentResponses.length>0){var r=0;e.paymentResponses[0].totalAvailableAmount&&!isNaN(e.paymentResponses[0].totalAvailableAmount)&&(r=e.paymentResponses[0].totalAvailableAmount,t.userStoreCreditDetails=e.paymentResponses[0].storeCredits),t.totalStoreCredits(r)}},t.getInstance=function(){return t.singleInstance||(t.singleInstance=new t),t.singleInstance},t}),define("pageLayout/user",["knockout","pubsub","notifier","CCi18n","ccRestClient","ccConstants","koValidate","ccKoValidateRules","storeKoExtensions","navigation","viewModels/address","storageApi","pageLayout/parent-organisation","viewModels/dynamicProperty","pageLayout/organization","ccStoreConfiguration","viewModels/loyalty","viewModels/storeCreditContainer"],function(e,t,r,i,a,o,n,s,l,c,d,u,p,h,g,f,m,I){"use strict";function E(n,s){if(E.singleInstance)throw new Error("Cannot instantiate more than one UserViewModel, use getInstance(pAdapter, pUserData)");var l=this;l.selectedPriceListGroup=e.observable(s.priceListGroup),l.currentOrganization=e.observable(),l.activePriceListGroups=e.observableArray([]),l.dynamicProperties=e.observableArray([]),l.profileType=e.observable(),l.loyaltyPrograms=e.observableArray([]),e.mapping.fromJS(s,{ignore:["links","dynamicProperties"]},l),l.id=e.observable(""),l.login=e.observable(""),l.customerContactId=e.observable(),l.adapter=n,l.resetAll=e.observable(!1),l.emailAddress=e.observable(""),l.emailAddressForForgottenPwd=e.observable(""),l.emailMarketingMails=e.observable(!1),l.emailMarketingModified=e.observable(!1),l.receiveEmailGlobally=e.observable(!1),l.GDPRProfileP13nConsentGranted=e.observable(!1),l.GDPRProfileP13nConsentModified=e.observable(!1),l.previousVisitDate=e.observable(),l.justAfterLogin=e.observable(!1),l.firstName=e.observable(""),l.loggedInUserName=e.observable(""),l.lastName=e.observable(""),l.password=e.observable(""),l.newPassword=e.observable(""),l.confirmPassword=e.observable(""),l.token="",l.primaryShippingAddress=e.observable(""),l.shippingAddressBook=e.observableArray().extend({deferred:!0}),l.defaultShippingAddress=e.observable(),l.editShippingAddress=e.observable(),l.deleteShippingAddress=e.observable(!1),l.locale=e.observable(""),l.supportedLocales=[],l.ssoLoginAccountName=e.observable(""),l.client=e.observable(a),l.loginError=e.observable(""),l.loggedIn=e.observable(l.client().loggedIn),l.isLoginFailed=e.observable(!1),l.readyToDisplay=e.observable(!0),l.autoLoginComplete=$.Deferred(),l.pageAppeared=$.Deferred(),l.registeringUser=!1,l.oldPassword=e.observable(""),l.emailAddress.isData=!0,l.firstName.isData=!0,l.lastName.isData=!0,l.password.isData=!0,l.newPassword.isData=!0,l.confirmPassword.isData=!0,l.oldPassword.isData=!0,l.emailAddressForForgottenPwd.isData=!0,l.locale.isData=!0,l.createOrderForLoggedInAtCheckout=!(!window.clientConfigData||!window.clientConfigData.createOrderForLoggedInAtCheckout||"true"!=window.clientConfigData.createOrderForLoggedInAtCheckout),l.ssoLoginAccountName.isData=!0,l.loggedinAtCheckout=e.observable(!1),l.loggedoutAtCheckout=e.observable(!1),l.persistedOrder=e.observable(),l.orderId=e.observable(""),l.countOfSubmittedOrders=e.observable(0),l.ignoreEmailValidation=e.observable(!0),l.isLoginNotEmail=e.observable(!1),l.ignorePasswordValidation=e.observable(!0),
- l.isUserProfileEdited=e.observable(!1),l.delaySuccessNotification=e.observable(!1),l.isSearchInitiatedWithUnsavedChanges=e.observable(!1),l.isUserSessionExpired=e.observable(!1),l.pageToRedirect=e.observable(),l.pageToRedirectAfterLogin=e.observable("/home"),l.isSessionExpiredDuringSave=e.observable(!1),l.isUserLoggedOut=e.observable(!0),l.isPageRedirected=e.observable(!1),l.isResourcesLoaded=e.observable(!1),l.errorMessageKey=e.observable(""),l.successMessageKey=e.observable(""),l.passwordPolicies=e.observable(),l.isChangePassword=e.observable(!1),l.showCreateNewPasswordMsg=e.observable(!1),l.createNewPasswordError=e.observable(""),l.isPasswordExpired=e.observable(!1),l.hasFieldLevelError=e.observable(!1),l.ignoreConfirmPasswordValidation=e.observable(!0),l.forgotPasswordMsg=e.observable(""),l.myWishLists=e.observableArray(),l.joinedWishLists=e.observableArray(),l.isSesExpDuringPlaceOrder=e.observable(!1),l.parentOrganization=new p,l.defaultPrimaryOrganization=new p,s.parentOrganization&&(e.mapping.fromJS(s.parentOrganization,{},l.defaultPrimaryOrganization),e.mapping.fromJS(s.parentOrganization,{},l.parentOrganization)),l.refreshPageAfterContactLogout=e.observable(!1),l.catalogId=e.observable(""),l.roles=e.observableArray([]),l.rememberDevice=e.observable(!1),l.passcode=e.observable(""),l.loginVerificationMessage=e.observable(""),l.rolesForCurrentOrganization=e.observableArray([]),l.isUserDataModified=e.observable(!1),l.isDelegatedAdmin=e.observable(!1),l.isApprover=e.observable(!1),l.isAccountAddressManager=e.observable(!1),l.isProfileAddressManager=e.observable(!1),l.organizations=e.observableArray([]),l.currentOrganizationDetails=e.observable(),l.defaultShippingAddressType=e.observable(),l.defaultBillingAddressType=e.observable(),l.redirectNotificationMessage=e.observable(""),l.sessionExpiredProfileRedirected=!1,l.approvalRequired=e.observable(!1),l.orderPurchaseLimit=e.observable(null),l.isHistoricalOrder=!1,l.loyaltyViewModel=e.observable(null),l.storeCreditContainer=e.observable(I.getInstance()),l.comments=e.observable(),l.clonedOrderId=e.observable(""),l.active=e.observable(),l.profileHomeRedirectRoutesArray=[o.PAGETYPE_PROFILE,o.PAGETYPE_ORDER_HISTORY,o.PAGETYPE_ORDER_DETAILS,o.PAGETYPE_SCHEDULED_ORDERS,o.PAGETYPE_ASSET_DETAILS,o.PAGETYPE_ASSETS,o.PAGETYPE_CONFIRMATION],l.onLoadCartSubscribe=null,l.emailAddressFocused=function(){return l.ignoreEmailValidation(!0),!0},l.emailAddressLostFocus=function(){return l.ignoreEmailValidation(!1),!0},l.updatedShippingAddress=null,l.updatedShippingAddressBook=null,l.confirmPassword.subscribe(function(e){l.newPassword.isModified(!0)}),l.emailMarketingMails.subscribe(function(e){l.emailMarketingModified(!0)}),l.GDPRProfileP13nConsentGranted.subscribe(function(e){l.GDPRProfileP13nConsentModified(!0)}),l.updateShippingAddress=function(e){if(l.shippingAddressBook()){var t={translate:function(e,t){return i.t("ns.common:resources."+e,t)}},r=new d("user-shipping-address","",t,l.contextData.page.shippingCountriesPriceListGroup,l.contextData.page.defaultShippingCountry);r.copyFrom(this.toJSON(),l.contextData.page.shippingCountriesPriceListGroup),r.isDefaultAddress(0===l.shippingAddressBook().length),!l.isAddressSaved(r)&&r.isValid()&&l.shippingAddressBook.push(r)}},l.updateLocale=function(){l.locale(this)},l.updateLocaleToSupported=function(){if(void 0!==l.locale.isModified){for(var e=a.getStoredValue(o.LOCAL_STORAGE_USER_CONTENT_LOCALE),r=!1,i=[],n=0;n<l.supportedLocales.length;n++)i.push(l.supportedLocales[n].name);a.previewMode&&!l.contextData&&e?(l.locale(JSON.parse(e)[0].name),r=!0):i.indexOf(l.contextData.global.user.locale)>-1?l.locale(l.contextData.global.user.locale):e?(l.locale(JSON.parse(e)[0].name),r=!0):(l.locale(l.contextData.global.locale),r=!0),l.locale.isModified(!0),r&&a.profileType!=o.PROFILE_TYPE_AGENT&&($.Topic(t.topicNames.USER_PROFILE_UPDATE_SUBMIT).publishWith(l,[{message:"success"}]),l.locale.isModified(!1),$.Topic(t.topicNames.UPDATE_USER_LOCALE_NOT_SUPPORTED_ERROR).publish())}},l.showExpiredPasswordErrorMsg=e.computed(function(){return!l.isPasswordExpired()||!(l.oldPassword.isModified()&&!l.oldPassword.isValid()||l.newPassword.isModified()&&!l.newPassword.isValid()||l.confirmPassword.isModified()&&!l.confirmPassword.isValid()||l.hasFieldLevelError())},l),l.validateUser=function(){return l.ignoreEmailValidation(!1),l.ignorePasswordValidation(!1),l.ignoreConfirmPasswordValidation(!1),l.emailAddress.isModified(!0),l.firstName.isModified(!0),l.lastName.isModified(!0),l.contextData.global.enableProfileRegistrationEmailCheck||(l.newPassword.isModified(!0),l.confirmPassword.isModified(!0)),l.isValid()},l.isValid=function(){return l.emailAddress.isValid()&&l.firstName.isValid()&&l.lastName.isValid()&&(l.contextData.global.enableProfileRegistrationEmailCheck||l.newPassword.isValid()&&l.confirmPassword.isValid())},l.reset=function(){(l.isUserLoggedOut()||!l.loggedIn()&&!l.isUserSessionExpired())&&(l.login(""),l.isResourcesLoaded()&&l.login.isModified(!1),l.loggedInUserName("")),l.emailAddress(""),l.firstName(""),l.lastName(""),l.loginError(""),l.resetPassword(),l.resetVerifyLoginData(),l.isLoginFailed(!1),l.emailMarketingMails(!1),l.receiveEmailGlobally(!1),l.GDPRProfileP13nConsentGranted(!1),l.isResourcesLoaded()&&(l.lastName.isModified(!1),l.emailAddress.isModified(!1),l.firstName.isModified(!1))},l.resetPassword=function(){l.password(""),l.newPassword(""),l.confirmPassword(""),l.oldPassword(""),l.isResourcesLoaded()&&(l.password.isModified(!1),l.newPassword.isModified(!1),l.confirmPassword.isModified(!1),l.oldPassword.isModified(!1)),l.isChangePassword(!1)},l.resetDetails=function(){l.firstName(""),l.lastName(""),l.resetPassword(),l.emailMarketingMails(!1),l.GDPRProfileP13nConsentGranted(!1),l.firstName.isModified(!1),l.lastName.isModified(!1),l.emailMarketingModified(!1),l.GDPRProfileP13nConsentModified(!1)},l.isLoginValid=function(){return l.ignoreEmailValidation(!1),this.login.isValid()&&this.password.isValid()},l.validateLogin=function(){var e=this;return e.login.isModified(!0),e.password.isModified(!0),e.isLoginValid()},l.validateLoginOTP=function(){var e=this;return e.passcode.isModified(!0),e.passcode.isValid()},l.resetLoginData=function(){var e=this;e.login(""),e.password(""),e.loginError(""),e.rememberDevice(!1),e.passcode(""),e.isLoginFailed(!1),e.isResourcesLoaded()&&(e.login.isModified(!1),e.password.isModified(!1),e.passcode.isModified(!1))},l.resetVerifyLoginData=function(){var e=this;e.rememberDevice(!1),e.passcode(""),e.isResourcesLoaded()&&e.passcode.isModified(!1)},l.resetModified=function(){var e=this;e.emailAddress.isModified(!1),e.firstName.isModified(!1),e.lastName.isModified(!1),e.oldPassword.isModified(!1),e.newPassword.isModified(!1),e.confirmPassword.isModified(!1),e.emailMarketingModified(!1),e.GDPRProfileP13nConsentModified(!1)},l.resetShippingAddressBookModified=function(){var t=this;e.utils.arrayForEach(t.shippingAddressBook(),function(e){e.resetModified()})},l.isProfileModified=function(){return!!(l.firstName.isModified()||l.lastName.isModified()||l.emailAddress.isModified()||l.emailMarketingModified()||l.locale.isModified()||l.GDPRProfileP13nConsentModified())},l.isPasswordModified=function(){return!!(l.oldPassword.isModified()||l.newPassword.isModified()||l.confirmPassword.isModified())},l.isPasswordValid=function(e){return e||l.oldPassword.isModified(!0),l.newPassword.isModified(!0),l.confirmPassword.isModified(!0),!(!l.newPassword.isValid()||!l.confirmPassword.isValid()||!e&&!l.oldPassword.isValid())},l.isProfileValid=function(){return l.firstName.isModified(!0),l.lastName.isModified(!0),l.emailAddress.isModified(!0),l.ignoreEmailValidation(!1),!!(l.firstName.isValid()&&l.lastName.isValid()&&l.emailAddress.isValid())},l.isAddressSaved=function(e){for(var t=0;t<l.shippingAddressBook().length;t++)if(e.compare(l.shippingAddressBook()[t]))return!0;return!1},l.isB2BUser=function(){return!(!l.parentOrganization||!l.parentOrganization.name())},l.isB2BProfileType=function(){if(l.profileType()&&l.profileType()==o.B2B_PROFILE_TYPE)return!0},l.isShippingAddressBookModified=function(){if(l.deleteShippingAddress())return!0;for(var e=0;e<l.shippingAddressBook().length;e++)if(l.shippingAddressBook()[e].isModified())return!0;return!1},l.isShippingAddressBookValid=function(){for(var e=0;e<l.shippingAddressBook().length;e++)if(!l.shippingAddressBook()[e].isValid())return!1;return!0},l.isDynamicPropertiesModified=function(){for(var e=0;e<l.dynamicProperties().length;e++)if(l.dynamicProperties()[e].value.isModified())return!0;return!1},l.selectDefaultAddress=function(e){for(var t=0;t<l.shippingAddressBook().length;t++){var r=l.shippingAddressBook()[t];r.isDefaultAddress(r===e)}},l.sortShippingAddresses=function(){l.updatedShippingAddressBook&&l.updatedShippingAddressBook.length&&l.updatedShippingAddressBook.sort(function(e,t){return e.isDefaultAddress?-1:t.isDefaultAddress?1:e.lastName&&t.lastName&&e.lastName.toLowerCase()==t.lastName.toLowerCase()?e.address1&&t.address1&&e.address1.toLowerCase()==t.address1.toLowerCase()?0:e.address1&&t.address1&&e.address1.toLowerCase()<t.address1.toLowerCase()?-1:1:e.lastName&&t.lastName&&e.lastName.toLowerCase()<t.lastName.toLowerCase()?-1:1})},l.loginSuccessFunc=function(e){if(l.loggedIn(l.client().loggedIn),l.isUserSessionExpired(!1),l.isLoginFailed(!1),l.isSesExpDuringPlaceOrder(!1),l.isUserLoggedOut(!1),l.password(""),l.password.isModified(!1),l.passcode(""),l.passcode.isModified(!1),l.rememberDevice(!1),r.clearError(l.WIDGET_ID),l.id(l.client().profileId),c.isPathEqualTo(l.myAccountHash)||l.pageToRedirect()!=l.myAccountHash||(l.sessionExpiredProfileRedirected=!0),l.pageToRedirect()&&""!=l.pageToRedirect()&&l.pageToRedirect()!=l.checkoutHash){var i=l.pageToRedirect();if(l.pageToRedirect(null),c.isPathEqualTo(i)){var a=l.getLocalData();null!=a&&a.login==l.login()&&c.isPathEqualTo(l.myAccountHash)&&!l.isPasswordExpired()&&l.isSessionExpiredDuringSave()||(l.getCurrentUser(e,!0),c.isPathEqualTo(l.myAccountHash)&&(l.isSessionExpiredDuringSave(!1),$.Topic(t.topicNames.USER_PROFILE_SESSION_RESET).publish()))}l.isPageRedirected(!0),c.goTo(i)}else l.getCurrentUser(e,!0),null==l.onLoadCartSubscribe&&(l.onLoadCartSubscribe=$.Topic(t.topicNames.CART_LOADED_FOR_PROFILE).subscribe(function(){if(!l.registeringUser||!l.loggedinAtCheckout()){l.registeringUser=!1;var r=c.getPathWithoutLocale().split("?"),i={pageId:c.getPath(),parameters:r[1],onLogin:!0};l.pageAppeared=$.Deferred(),$.when($.Topic(t.topicNames.PAGE_VIEW_CHANGED).publish(i)).done(function(){e&&(l.storeConfiguration.enablePrioritizedLoading?$.when(l.pageAppeared).done(function(){l.autoLoginComplete.resolve(),l.pageAppeared=$.Deferred()}):l.autoLoginComplete.resolve())})}}));l.isPasswordExpired(!1)},l.loginErrorFunc=function(){l.isLoginFailed(!0),l.loginError(i.t("ns.common:resources.loginError")),l.password(""),l.password.isModified(!1)},l.processDynamicPropertiesMetadata=function(e){for(var t=this,r=[],i=0;i<e.length;i++){for(var a=!0,o=0;o<t.dynamicProperties().length&&a;o++)e[i].id===t.dynamicProperties()[o].id()&&(a=!1,t.dynamicProperties()[o].initializeMetadata(e[i],!1),t.dynamicProperties()[o].value(e[i].value));if(a){var n=new h;n.initializeMetadata(e[i],!0),n.value(e[i].value),r.push(n)}}for(var i=0;i<r.length;i++)t.dynamicProperties.push(r[i])},s.dynamicProperties&&l.processDynamicPropertiesMetadata(s.dynamicProperties),l.populateUserFromLocalData(!1),l.storeConfiguration=f.getInstance(),l.isPunchout=e.observable(!1),l.isPunchout(!!s.isPunchout&&s.isPunchout);var u=a.getStoredValue(o.LOCAL_STORAGE_ADDITIONAL_FORM_DATA);if(u){var g=JSON.parse(u);g&&g.orderId&&l.orderId(g.orderId)}return $.Topic(t.topicNames.USER_REGISTRATION_SUBMIT).subscribe(l.registerUser),$.Topic(t.topicNames.USER_LOGIN_SUBMIT).subscribe(l.handleLogin),$.Topic(t.topicNames.USER_LOGIN_CANCEL).subscribe(l.handleCancel),$.Topic(t.topicNames.SAML_LOGIN_SUCCESSFUL).subscribe(l.SamlLoginSuccessCallback.bind(l)),$.Topic(t.topicNames.SAML_LOGIN_FAILURE).subscribe(l.SamlLoginErrorCallback.bind(l)),$.Topic(t.topicNames.OPENID_LOGIN_SUCCESSFUL).subscribe(l.openIdLoginSuccessCallback.bind(l)),$.Topic(t.topicNames.OPENID_LOGIN_FAILURE).subscribe(l.openIdLoginErrorCallback.bind(l)),$.Topic(t.topicNames.LOCALE_READY).subscribe(l.loadResources.bind(l)),$.Topic(t.topicNames.USER_PROFILE_UPDATE_SUBMIT).subscribe(l.handleUpdateProfile),$.Topic(t.topicNames.USER_PROFILE_UPDATE_CANCEL).subscribe(l.handleUpdateCancel),$.Topic(t.topicNames.PAGE_LAYOUT_LOADED).subscribe(l.handlePageChanged.bind(l)),$.Topic(t.topicNames.PAGE_METADATA_CHANGED).subscribe(l.handlePageChanged.bind(l)),$.Topic(t.topicNames.USER_LOGOUT_SUBMIT).subscribe(l.handleLogout.bind(l)),$.Topic(t.topicNames.USER_SESSION_VALID).subscribe(l.handleSessionValid.bind(l)),$.Topic(t.topicNames.USER_SESSION_EXPIRED).subscribe(l.handleSessionExpired.bind(l)),$.Topic(t.topicNames.CHECKOUT_SAVE_SHIPPING_ADDRESS).subscribe(l.updateShippingAddress),$.Topic(t.topicNames.CHECKOUT_USER_LOCALE).subscribe(l.updateLocale),$.Topic(t.topicNames.USER_LOCALE_NOT_SUPPORTED).subscribe(l.updateLocaleToSupported),$.Topic(t.topicNames.USER_MFA_LOGIN_SUBMIT).subscribe(l.handleVerifyLogin),l}return E.prototype.loadResources=function(){var e=this;e.firstName.extend({required:{params:!0,message:i.t("ns.common:resources.firstNameRequired")}}),e.lastName.extend({required:{params:!0,message:i.t("ns.common:resources.lastNameRequired")}}),e.locale.extend({required:{params:!0,message:i.t("ns.common:resources.localeRequired")}}),e.emailAddressForForgottenPwd.extend({required:{params:!0,message:i.t("ns.common:resources.emailAddressRequired")},maxLength:{params:o.CYBERSOURCE_EMAIL_MAXIMUM_LENGTH,message:i.t("ns.common:resources.maxLengthEmailAdd",{maxLength:o.CYBERSOURCE_EMAIL_MAXIMUM_LENGTH})},email:{params:!0,onlyIf:function(){return!e.ignoreEmailValidation()},message:i.t("ns.common:resources.emailAddressInvalid")}}),e.emailAddress.extend({required:{params:!0,message:i.t("ns.common:resources.emailAddressRequired")},maxLength:{params:o.CYBERSOURCE_EMAIL_MAXIMUM_LENGTH,message:i.t("ns.common:resources.maxLengthEmailAdd",{maxLength:o.CYBERSOURCE_EMAIL_MAXIMUM_LENGTH})},email:{params:!0,onlyIf:function(){return!e.ignoreEmailValidation()},message:i.t("ns.common:resources.emailAddressInvalid")}}),e.isLoginNotEmail?e.login.extend({required:{params:!0,message:function(){return e.isLoginNotEmail()?i.t("ns.common:resources.loginRequired"):i.t("ns.common:resources.emailAddressRequired")}},maxLength:{params:o.CYBERSOURCE_EMAIL_MAXIMUM_LENGTH,message:i.t("ns.common:resources.maxLengthEmailAdd",{maxLength:o.CYBERSOURCE_EMAIL_MAXIMUM_LENGTH})},email:{params:!0,onlyIf:function(){return!e.ignoreEmailValidation()&&!e.isLoginNotEmail()},message:i.t("ns.common:resources.emailAddressInvalid")}}):e.login.extend({required:{params:!0,message:i.t("ns.common:resources.emailAddressRequired")},maxLength:{params:o.CYBERSOURCE_EMAIL_MAXIMUM_LENGTH,message:i.t("ns.common:resources.maxLengthEmailAdd",{maxLength:o.CYBERSOURCE_EMAIL_MAXIMUM_LENGTH})},email:{params:!0,onlyIf:function(){return!e.ignoreEmailValidation()},message:i.t("ns.common:resources.emailAddressInvalid")}}),e.password.extend({required:{params:!0,message:i.t("ns.common:resources.passwordRequired")}}),e.newPassword.extend({password:{params:{policies:e.passwordPolicies,login:e.emailAddress,observable:e.newPassword,includePreviousNPasswordRule:e.isChangePassword},onlyIf:function(){return(!e.ignoreEmailValidation()||e.newPassword.isModified())&&!e.ignorePasswordValidation()},message:i.t("ns.common:resources.passwordPoliciesErrorText")},required:{params:!0,message:i.t("ns.common:resources.passwordRequired")}}),e.oldPassword.extend({required:{params:!0,message:i.t("ns.common:resources.currentPasswordRequired")}}),e.confirmPassword.extend({required:{params:!0,message:i.t("ns.common:resources.confirmPasswordRequired")},match:{params:e.newPassword,onlyIf:function(){return!e.ignoreConfirmPasswordValidation()},message:i.t("ns.common:resources.passwordUnmatched")}}),e.passcode.extend({required:{params:!0,message:i.t("ns.common:resources.verificationCodeRequired")}}),e.isResourcesLoaded(!0)},E.prototype.populateUserFromLocalData=function(e){var t=this,r=t.getLocalData();null!=r&&a.profileType!=o.PROFILE_TYPE_AGENT&&(t.loggedinAtCheckout(r.loggedinAtCheckout),t.loggedoutAtCheckout(r.loggedoutAtCheckout),t.orderId(r.orderId),e&&r.login&&(t.loggedInUserName(r.loggedInUserName),t.login(r.login),t.isUserSessionExpired(r.isUserSessionExpired),t.isUserLoggedOut(r.isUserLoggedOut)))},E.prototype.getLocalData=function(){var e=null;try{e=u.getInstance().getItem("user"),e&&(e=JSON.parse(e))}catch(e){}return e},E.prototype.setLocalData=function(e){var t=this;if(!e&&""==e)return!0;var r=t.getLocalData();switch(null==r&&(r={}),e){case"all":r={loggedinAtCheckout:t.loggedinAtCheckout(),loggedoutAtCheckout:t.loggedoutAtCheckout(),orderId:t.orderId(),loggedInUserName:t.loggedInUserName(),login:t.login(),isUserSessionExpired:t.isUserSessionExpired(),isUserLoggedOut:t.isUserLoggedOut()};break;case"checkoutFlag":r.loggedinAtCheckout=t.loggedinAtCheckout(),r.loggedoutAtCheckout=t.loggedoutAtCheckout();break;case"orderId":r.orderId=t.orderId();break;case"sessionExpiry":r.isUserSessionExpired=t.isUserSessionExpired(),r.isUserLoggedOut=t.isUserLoggedOut()}try{u.getInstance().setItem("user",JSON.stringify(r))}catch(e){}},E.prototype.updateLocalData=function(e,t){var r=this;r.loggedinAtCheckout(e),r.loggedoutAtCheckout(t),r.setLocalData("checkoutFlag")},E.prototype.removeLocalData=function(){try{u.getInstance().removeItem("user")}catch(e){}},E.prototype.removeSoftLoginCookie=function(){try{u.getInstance().saveToCookies(o.SOFT_LOGIN,"",-1)}catch(e){}},E.prototype.resetForgotPassword=function(e){var r=this,i={};i[o.LOGIN]=e||r.emailAddressForForgottenPwd();var n=function(e){$.Topic(t.topicNames.USER_RESET_PASSWORD_SUCCESS).publish(e)},s=function(e){$.Topic(t.topicNames.USER_RESET_PASSWORD_FAILURE).publish(e)};a.profileType==o.PROFILE_TYPE_AGENT?a.request(o.ENDPOINT_FORGOT_PASSWORD,i,n,s,r.id()):r.adapter.persistCreate(o.ENDPOINT_FORGOT_PASSWORD,"id",i,null,n,s)},E.prototype.handleLogin=function(){var e=this;return e.isLoginValid()?(a.setStoredValue(o.LOCAL_STORAGE_ORGANIZATION_ID,null),void e.client().login(this.login(),this.password(),function(r){r?$.Topic(t.topicNames.LOGIN_VERIFICATION_REQUIRED).publish():(e.loginSuccessFunc(!1),$.Topic(t.topicNames.USER_LOGIN_SUCCESSFUL).publish())},function(r){r.error==o.PASSWORD_EXPIRED?(e.isPasswordExpired(!0),$.Topic(t.topicNames.USER_PASSWORD_EXPIRED).publish()):r.error==o.PASSWORD_GENERATED?(e.isPasswordExpired(!0),$.Topic(t.topicNames.USER_PASSWORD_GENERATED).publish()):(e.loginErrorFunc(),$.Topic(t.topicNames.USER_LOGIN_FAILURE).publish(r))})):(e.login.isModified(!0),e.password.isModified(!0),!1)},E.prototype.handleVerifyLogin=function(e){var r=this;if(!r.passcode.isValid())return r.passcode.isModified(!0),!1;var i=function(){r.loginSuccessFunc(!1),$.Topic(t.topicNames.USER_LOGIN_SUCCESSFUL).publish()},a=function(e){r.resetVerifyLoginData(),r.loginErrorFunc(),$.Topic(t.topicNames.USER_MFA_LOGIN_FAILURE).publish(e)},o=e&&e.getDeviceIdentifier;o&&"function"==typeof o&&(o=e.getDeviceIdentifier()),r.client().verifyLogin(r.passcode(),r.rememberDevice(),i,a,o)},E.prototype.handleSamlLogin=function(){var e=this;a.setStoredValue(o.LOCAL_STORAGE_ORGANIZATION_ID,null);var r=c.getPathWithoutLocale();if(r.indexOf("?loggedIn=false")>-1){var i=r.indexOf("page=")+5;r=decodeURIComponent(r.substr(i)),r="/"===r.charAt(0)?r:"/"+r}else r=c.getRelativePath()+c.getQueryString();e.client().setSessionStoredValue("SSO_RETURN_URL",r),u.getInstance().removeFromMemory(o.CC_IS_SSO_LOGIN_FAILURE),e.client().generateSamlAuthnRequest(function(t){var r=$("<form/>",{action:t.authnRequestTarget,method:"POST"});r.append($("<input>",{type:"hidden",name:"SAMLRequest",value:t.authnRequest})),r.append($("<input>",{type:"hidden",name:"RelayState",value:e.ssoLoginAccountName()})),$(document.body).append(r),r.submit()},function(r){e.loginErrorFunc(),$.Topic(t.topicNames.USER_LOGIN_FAILURE).publish(r)})},E.prototype.authSuccessCallback=function(e){var r=this,i=a.getSessionStoredValue("SSO_RETURN_URL");null==i&&(i="/"),r.pageToRedirect(i),a.setSessionStoredValue("SSO_RETURN_URL",null),r.loginSuccessFunc(!1),u.getInstance().removeFromMemory(e),$.Topic(t.topicNames.USER_LOGIN_SUCCESSFUL).publish()},E.prototype.authErrorCallback=function(e,r){var i=this;a.setSessionStoredValue("SSO_RETURN_URL",null),i.loginErrorFunc(),e===o.CC_IS_OPENID_LOGIN_UNDER_PROGRESS?(u.getInstance().removeFromMemory(o.CC_IS_OPENID_LOGIN_UNDER_PROGRESS),u.getInstance().saveToMemory(o.CC_IS_OPENID_LOGIN_FAILURE,!0)):(u.getInstance().removeFromMemory(o.CC_IS_SSO_LOGIN_UNDER_PROGRESS),u.getInstance().saveToMemory(o.CC_IS_SSO_LOGIN_FAILURE,!0)),$.Topic(t.topicNames.USER_LOGIN_FAILURE).publish(r)},E.prototype.SamlLoginSuccessCallback=function(){var e=this;e.authSuccessCallback(o.CC_IS_SSO_LOGIN_UNDER_PROGRESS)},E.prototype.openIdLoginSuccessCallback=function(){var e=this;e.authSuccessCallback(o.CC_IS_OPENID_LOGIN_UNDER_PROGRESS)},E.prototype.SamlLoginErrorCallback=function(e){var t=this;t.authErrorCallback(o.CC_IS_SSO_LOGIN_UNDER_PROGRESS,e)},E.prototype.openIdLoginErrorCallback=function(e){var t=this;t.authErrorCallback(o.CC_IS_OPENID_LOGIN_UNDER_PROGRESS,e)},E.prototype.handleOpenIDLogin=function(){var e=this;a.setStoredValue(o.LOCAL_STORAGE_ORGANIZATION_ID,null);var r=c.getPathWithoutLocale();if(r.indexOf("?loggedIn=false")>-1){var i=r.indexOf("page=")+5;r=decodeURIComponent(r.substr(i)),r="/"===r.charAt(0)?r:"/"+r}else r=c.getRelativePath()+c.getQueryString();e.client().setSessionStoredValue("SSO_RETURN_URL",r),u.getInstance().removeFromMemory(o.CC_IS_OPENID_LOGIN_FAILURE),e.client().generateOpenIDAuthRequest(function(e){document.location.href=e.authz_code_request_dst},function(r){e.loginErrorFunc(),$.Topic(t.topicNames.USER_LOGIN_FAILURE).publish(r)})},E.prototype.handleOpenIDLogout=function(){var e=this,r=c.getPathWithoutLocale();if(r.indexOf("?loggedIn=false")>-1){var i=r.indexOf("page=")+5;r=decodeURIComponent(r.substr(i)),r="/"===r.charAt(0)?r:"/"+r}else r=c.getRelativePath()+c.getQueryString();e.client().setSessionStoredValue("SSO_RETURN_URL",r),e.client().generateOpenIDLogoutRequest(function(i){e.client().storeToken=function(e){},e.client().clearStoredValues(),e.client().tokenSecret=null,e.client().loggedIn=!1,e.client().clearStoredValue("code_challenge"),$.Topic(t.topicNames.USER_LOGOUT_SUBMIT).publishWith([{message:"success"}]),e.clearUserData(),e.contextData.page.pageType!=o.PAGETYPE_ORDER_HISTORY&&e.contextData.page.pageType!=o.PAGETYPE_ORDER_DETAILS&&e.contextData.page.pageType!=o.PAGETYPE_PROFILE&&e.contextData.page.pageType!=o.PAGETYPE_SCHEDULED_ORDERS&&e.contextData.page.pageType!=o.PAGETYPE_SCHEDULED_ORDERS?document.location.href=i.openid_logout_request_dst+"&state="+r:document.location.href=i.openid_logout_request_dst},function(e){})},E.prototype.handleLogout=function(){var e=this;$.Topic(t.topicNames.USER_CLEAR_CART).publish([{message:"success"}]);var r=function(){if($.Topic(t.topicNames.USER_LOGOUT_SUCCESSFUL).publish([{message:"success"}]),u.getInstance().removeItem(o.LOCAL_STORAGE_SHOPPER_CONTEXT),u.getInstance().removeItem(o.LOCAL_STORAGE_CURRENT_CONTEXT),a.clearStoredValue(o.LOCAL_STORAGE_PRICELISTGROUP_ID),e.clearUserData(),e.profileRedirect(),e.refreshPageAfterContactLogout())e.refreshPageAfterContactLogout(!1),c.goTo(e.contextData.global.links.home.route);else{var r={pageId:c.getPath()};$.Topic(t.topicNames.PAGE_VIEW_CHANGED).publish(r)}if(a.previewMode){var i={},n=new CustomEvent("preview_logout",i);window.parent.dispatchEvent(n)}},i=function(t){e.clearUserData(),e.profileRedirect(),c.goTo(e.contextData.global.links.home.route)};e.loggedIn()?(e.parentOrganization&&e.parentOrganization.name()&&e.refreshPageAfterContactLogout(!0),e.client().logout(r,i)):(e.clearUserData(),$.Topic(t.topicNames.USER_LOGOUT_SUCCESSFUL).publish([{message:"success"}]),e.profileRedirect())},E.prototype.profileRedirect=function(){var e=this,t=c.getPathWithoutLocale();t="/"===t.charAt(0)?t.substr(1):t;for(var r=0;r<e.profileHomeRedirectRoutesArray.length;r++){var i=c.getPathWithoutLocale(e.contextData.global.links[e.profileHomeRedirectRoutesArray[r]].route);if(i="/"===i.charAt(0)?i.substr(1):i,0===t.indexOf(i)){c.goTo(e.contextData.global.links.home.route);break}}},E.prototype.clearUserData=function(){var e=this;e.isUserSessionExpired(!1),e.isUserLoggedOut(!0),e.removeSoftLoginCookie(),e.loggedIn(!1),e.resetLoginData(),e.clearUserSpecificData()},E.prototype.clearUserSpecificData=function(){var e=this;e.id(null),e.removeLocalData(),e.parentOrganization=new p,e.organizations([]),e.editShippingAddress(null),e.deleteShippingAddress(!1),e.shippingAddressBook([]),e.updatedShippingAddress=null,e.updatedShippingAddressBook=null,e.reset(),e.locale(""),e.loyaltyViewModel(null),e.storeCreditContainer(null),$.Topic(t.topicNames.USER_LOAD_SHIPPING).publish([{message:"success"}]);for(var r=0;r<e.dynamicProperties().length;r++)e.dynamicProperties()[r].reset()},E.prototype.handleCancel=function(){var e=this;e.resetLoginData(),r.clearError(e.WIDGET_ID)},E.prototype.registerUserWithAutoLogin=function(e,r){var n=this;n.client().registerUserWithAutoLogin(o.ENDPOINT_REGISTER_PROFILE,r,function(r){n.resetDynamicPropertiesValueIsModified(),e.successCallback?e.successCallback(r):(r.widgetId=e.widgetId,n.registeringUser=!0,n.orderId(""),a.setStoredValue(o.LOCAL_STORAGE_ORGANIZATION_ID,null),r.isAutoLogin=!0,n.loginSuccessFunc(!0),$.Topic(t.topicNames.USER_AUTO_LOGIN_SUCCESSFUL).publish(r))},function(r){r.widgetId=e.widgetId,r.errorCode==o.OAUTH_INTERNAL_ERROR||r.error==(o.OAUTH_ERROR_INVALID_REQUEST||o.OAUTH_ERROR_INVALID_GRANT||o.OAUTH_ERROR_UNAUTHORIZED_CLIENT||o.OAUTH_ERROR_USER_LOCKED)?(n.loginErrorFunc(),$.Topic(t.topicNames.USER_AUTO_LOGIN_FAILURE).publish(r)):(r.errorCode==o.CREATE_PROFILE_USER_EXISTS&&(r.message=i.t("ns.common:resources.accountAlreadyExists")),$.Topic(t.topicNames.USER_CREATION_FAILURE).publish(r))})},E.prototype.registerUser=function(e){var r=this,n=!1,s=!1;r.receiveEmail=r.emailMarketingMails()?"yes":"no";var l={};if(e.inputParams)l=e.inputParams;else{if(l[o.PROFILE_EMAIL]=r.emailAddress(),r.contextData.global.enableProfileRegistrationEmailCheck||(l[o.PROFILE_PASSWORD]=r.newPassword()),l[o.PROFILE_FIRST_NAME]=r.firstName(),l[o.PROFILE_LAST_NAME]=r.lastName(),l[o.PROFILE_RECEIVE_EMAIL]=r.receiveEmail,l[o.PROFILE_GDPR_CONSENT_GRANTED_KEY]=r.GDPRProfileP13nConsentGranted(),null!==r.shippingAddressBook()&&void 0!=r.shippingAddressBook()&&r.isShippingAddressBookValid()&&(l[o.PROFILE_SHIPPING_ADDRESSES]=r.shippingAddressBook()),!r.locale()){var c=a.getStoredValue(o.LOCAL_STORAGE_USER_CONTENT_LOCALE);c&&r.locale(JSON.parse(c)[0].name)}l[o.PROFILE_LOCALE]=r.locale()}if(r.dynamicProperties().length>0&&r.isDynamicPropertiesModified()){for(var d=0;d<r.dynamicProperties().length;d++){var u=r.dynamicProperties()[d];if(!u.isValid()){n=!0;break}}n||(s=!0)}return n?void $.Topic(t.topicNames.USER_PROFILE_UPDATE_INVALID).publish():(s&&r.handleDynamicPropertiesUpdate(l),void(!r.contextData.global.enableProfileRegistrationEmailCheck&&r.storeConfiguration.multiFactorAuthenticationEnabled?r.registerUserWithAutoLogin(e,l):r.adapter.persistCreate(o.ENDPOINT_CREATE_PROFILE,o.ENDPOINT_CREATE_PROFILE,l,function(i){if(r.resetDynamicPropertiesValueIsModified(),e.successCallback)e.successCallback(i);else if(i&&i.message&&r.contextData.global.enableProfileRegistrationEmailCheck){var a={};a.widgetId=e.widgetId,a.message=i.message,$.Topic(t.topicNames.USER_ACCOUNT_CREATION_MESSAGE).publish(a)}else r.registeringUser=!0,i.widgetId=e.widgetId,r.handleAutoLogin(e)},function(r){r.widgetId=e.widgetId,r.errorCode==o.CREATE_PROFILE_USER_EXISTS&&(r.message=i.t("ns.common:resources.accountAlreadyExists")),$.Topic(t.topicNames.USER_CREATION_FAILURE).publish(r)})))},E.prototype.handleAutoLogin=function(e){var r=this;r.orderId(""),r.login(r.emailAddress()),a.setStoredValue(o.LOCAL_STORAGE_ORGANIZATION_ID,null),r.client().login(r.login(),r.newPassword(),function(){var i={};i.widgetId=e.widgetId,i.isAutoLogin=!0,r.loginSuccessFunc(!0),$.Topic(t.topicNames.USER_AUTO_LOGIN_SUCCESSFUL).publish(i)},function(i){i.widgetId=e.widgetId,r.loginErrorFunc(),$.Topic(t.topicNames.USER_AUTO_LOGIN_FAILURE).publish(i)})},E.prototype.resetDynamicPropertiesValueIsModified=function(){for(var e=this,t=0;t<e.dynamicProperties().length;t++)e.dynamicProperties()[t].value.isModified&&e.dynamicProperties()[t].value.isModified(!1)},E.prototype.getCurrentUser=function(i,n,s,l){var d=this;d.redirectNotificationMessage("");var u={},p={};p[o.ENDPOINT_KEY]=o.ENDPOINT_GET_CURRENT_USER,p[o.IDENTIFIER_KEY]="userData";var h=d.storeConfiguration.getFilterToUse(p);h&&(u[o.FILTER_KEY]=h);var g=function(r){d.currentOrganization(r.currentOrganization),e.mapping.fromJS(r,{ignore:["links","dynamicProperties"]},d),d.populateUserViewModel(r),d.resetModified(),d.readyToDisplay(!0),i?$.Topic(t.topicNames.AUTO_LOGIN_AND_GET_USER_DATA_SUCCESSFUL).publish():!n||!d.createOrderForLoggedInAtCheckout&&d.loggedinAtCheckout()?$.Topic(t.topicNames.USER_LOAD_SHIPPING).publish([{message:"success"}]):$.Topic(t.topicNames.CART_READY).subscribe(function(){$.Topic(t.topicNames.USER_LOAD_SHIPPING).publish([{message:"success"}]),$.Topic(t.topicNames.CART_READY).unsubscribe()}),d.sessionExpiredProfileRedirected&&(n=!0,d.sessionExpiredProfileRedirected=!1),n&&(r.parentOrganization&&r.parentOrganization.name&&(c.isPathEqualTo(d.checkoutHash)||$.Topic(t.topicNames.CART_READY).subscribe(d.navigateToHome())),$.Topic(t.topicNames.USER_LOAD_CART).publish(r)),"undefined"!=typeof s&&s&&s(r)},f=function(e){e.status==o.HTTP_UNAUTHORIZED_ERROR&&(d.handleSessionExpired(),(c.isPathEqualTo(d.contextData.global.links.profile.route)||c.isPathEqualTo(d.contextData.global.links.orderHistory.route))&&c.doLogin(c.getPath(),d.contextData.global.links.home.route)),"undefined"!=typeof l&&l&&l(e)};a.profileType==o.PROFILE_TYPE_AGENT?a.request(o.ENDPOINT_GET_CUSTOMER,{},function(e){var t=e.profileDetail;t.dynamicProperties=e.dynamicProperties,t.priceListGroup.id=t.priceListGroup.repositoryId,g(t)},f,d.id()):d.adapter.loadJSON("getUser","getCurrentUser",u,g,f),d.navigateToHome=function(){setTimeout(function(){var e=d.pageToRedirectAfterLogin();void 0!=e&&""!=e||(e=c.getPathWithoutLocale()),d.navigateToPage(e,function(){""!==d.redirectNotificationMessage()&&(r.sendWarningToPage("UserViewModel",d.redirectNotificationMessage(),!0,"home",!0),d.redirectNotificationMessage(""))})},2e3)}},E.prototype.populateUserViewModel=function(t){var r=this;r.emailAddress(t.email),r.firstName(t.firstName),r.lastName(t.lastName),r.loggedInUserName(t.firstName),r.login(r.emailAddress()),r.GDPRProfileP13nConsentGranted(t.GDPRProfileP13nConsentGranted),r.customerContactId(t.customerContactId);var i=t.receiveEmail;if("yes"==i?r.emailMarketingMails(!0):r.emailMarketingMails(!1),r.id(t.id),r.approvalRequired(t.derivedApprovalRequired),r.orderPurchaseLimit(t.derivedOrderPriceLimit),r.isPunchout(!!t.isPunchout&&t.isPunchout),r.locale(""),r.isDelegatedAdmin(!1),r.isAccountAddressManager(!1),r.isProfileAddressManager(!1),r.isApprover(!1),r.comments(t.comments),t.catalog&&r.catalogId(t.catalog.repositoryId),r.loyaltyPrograms(t.loyaltyPrograms),r.catalog&&(r.catalog=void 0),r.profileType(t.profileType),t.parentOrganization&&(e.mapping.fromJS(t.parentOrganization,{},r.defaultPrimaryOrganization),r.defaultPrimaryOrganization.id(t.parentOrganization.repositoryId)),t.currentOrganization){r.currentOrganization(t.currentOrganization),null==r.parentOrganization&&(r.parentOrganization=new p),e.mapping.fromJS(t.currentOrganization,{},r.parentOrganization),r.parentOrganization.id(t.currentOrganization.repositoryId);var n=JSON.parse(a.getStoredValue(o.LOCAL_STORAGE_ORGANIZATION_ID));!n&&t.currentOrganization&&a.setStoredValue(o.LOCAL_STORAGE_ORGANIZATION_ID,e.toJSON(t.currentOrganization.repositoryId));
- }else if(t.parentOrganization&&t.parentOrganization.active)r.parentOrganization||(r.parentOrganization=new p),e.mapping.fromJS(t.parentOrganization,{},r.parentOrganization),r.parentOrganization.id(t.parentOrganization.repositoryId),r.currentOrganization(t.parentOrganization);else if(t.secondaryOrganizations&&t.secondaryOrganizations.length>0){for(var s=t.secondaryOrganizations,l=0;l<s.length;l++)if(s[l].active){r.parentOrganization||(r.parentOrganization=new p),e.mapping.fromJS(t.secondaryOrganizations[l],{},r.parentOrganization),r.parentOrganization.id(t.secondaryOrganizations[l].repositoryId),r.currentOrganization(t.secondaryOrganizations[l]);break}}else r.parentOrganization=null,r.currentOrganization(null);if(r.active(t.active),t.roles&&t.roles.length>0){var d=t.roles.length,u=r.currentOrganization()?r.currentOrganization().repositoryId:null;r.resetRoles();for(var h=[],f=0;f<d;f++){r.roles.push(t.roles[f]);var m=t.roles[f].relativeTo;("object"==typeof m&&m.repositoryId===u||m===u)&&(h.push(t.roles[f].function),"accountAddressManager"===t.roles[f].function&&r.isAccountAddressManager(!0),"profileAddressManager"===t.roles[f].function&&r.isProfileAddressManager(!0),"admin"===t.roles[f].function?r.isDelegatedAdmin(!0):"approver"===t.roles[f].function&&r.isApprover(!0))}r.rolesForCurrentOrganization(h)}r.isB2BUser()&&(r.isDelegatedAdmin()||a.profileType==o.PROFILE_TYPE_AGENT)&&(a.profileType===o.PROFILE_TYPE_AGENT&&(r.contextManager=require("agentViewModels/agent-context-manager").getInstance(),r.contextManager.setShopperProfileId(r.id()),r.contextManager.setCurrentOrganizationId(r.parentOrganization?r.parentOrganization.id():null)),a.request(o.ENDPOINT_GET_ORGANIZATION,null,function(e){r.defaultShippingAddressType(e.derivedShippingAddressType),r.defaultBillingAddressType(e.derivedBillingAddressType),r.organizations&&r.organizations().length>0?r.organizations()[0].populateOrganizationViewModel(e):r.organizations.push(new g(e,r.adapter)),r.organizations&&r.organizations().length>0&&r.organizations()[0].populateDynamicPropertiesMetaData(),r.currentOrganizationDetails(r.organizations()[0])},function(e){e.status==o.HTTP_UNAUTHORIZED_ERROR&&(r.handleSessionExpired(),(c.isPathEqualTo(r.contextData.global.links.profile.route)||c.isPathEqualTo(r.contextData.global.links.orderHistory.route))&&c.doLogin(c.getPath(),r.contextData.global.links.home.route))},r.parentOrganization.id())),r.selectedPriceListGroup(t.priceListGroup);var I=r.contextData.global.site.priceListGroup.activePriceListGroups;if(!r.isB2BUser()&&r.selectedPriceListGroup()){var E=!1;if(a.getStoredValue(o.LOCAL_STORAGE_PRICELISTGROUP_ID))for(var y=JSON.parse(a.getStoredValue(o.LOCAL_STORAGE_PRICELISTGROUP_ID)),l=0;l<I.length;l++)if(y&&y==I[l].id){r.selectedPriceListGroup(I[l]),E=!0;break}E||r.selectedPriceListGroup(r.contextData.global.site.priceListGroup.defaultPriceListGroup)}if(a.setStoredValue(o.LOCAL_STORAGE_PRICELISTGROUP_ID,e.toJSON(r.selectedPriceListGroup().id)),r.previousVisitDate(t.previousVisitDate),r.deleteShippingAddress(!1),r.updatedShippingAddress=t.shippingAddress,r.updatedShippingAddress&&(r.updatedShippingAddress.isDefaultAddress=!0),r.updatedShippingAddressBook=t.shippingAddresses,r.updatedShippingAddressBook&&r.updatedShippingAddressBook.length)if(null==r.updatedShippingAddress)r.updatedShippingAddressBook[0].isDefaultAddress=!0;else for(var v=0,b=r.updatedShippingAddressBook.length;v<b;v++)r.updatedShippingAddressBook[v].isDefaultAddress=r.updatedShippingAddressBook[v].repositoryId===r.updatedShippingAddress.repositoryId;r.organizationAddressBook=[];for(var T in t.secondaryAddresses){var P=t.secondaryAddresses[T];P.isDefaultAddress=!1,r.organizationAddressBook.push(t.secondaryAddresses[T])}r.contactShippingAddress=t.contactShippingAddress,r.primaryShippingAddress(r.contactShippingAddress),r.contactBillingAddress=t.contactBillingAddress,r.sortShippingAddresses(),r.isUserSessionExpired(!1),r.isUserLoggedOut(!1),r.populateUserFromLocalData(!1),r.setLocalData("all");for(var l=0;l<this.supportedLocales.length;l++)t.locale===this.supportedLocales[l].name&&(r.locale(t.locale),void 0!==r.locale.isModified&&r.locale.isModified(!1));r.locale()||r.updateLocaleToSupported(),r.processDynamicPropertiesMetadata(t.dynamicProperties),r.resetDynamicPropertiesValueIsModified()},E.prototype.resetRoles=function(){var e=this;e.roles([]),e.isAccountAddressManager(!1),e.isProfileAddressManager(!1),e.isDelegatedAdmin(!1),e.isApprover(!1)},E.prototype.setContext=function(e){var t=this;t.contextData=e,t.myAccountHash=t.contextData.global.links.profile.route,t.checkoutHash=t.contextData.global.links.checkout.route,t.homeHash=t.contextData.global.links.home.route,t.passwordPolicies(e.global.passwordPolicies),t.readyToDisplay(!0),e.global.user.catalog&&t.catalogId(e.global.user.catalog.repositoryId),t.catalog&&(t.catalog=void 0),e.global.supportedLocales&&e.global.supportedLocales.length>0?t.supportedLocales=e.global.supportedLocales:t.supportedLocales=e.global.site.additionalLanguages,e.global.user.firstName?t.populateUserViewModel(e.global.user):(t.populateUserFromLocalData(!0),t.isUserLoggedOut()||t.loggedIn()||t.isUserSessionExpired()||void 0==t.login()||""==t.login()||t.handleSessionExpired())},E.prototype.handlePageChanged=function(e,r){var i=this,a=i.storeConfiguration.isFreshPageLoad,o=!1;if(i.storeConfiguration.isLargeCart()===!0&&a===!0){var n=u.getInstance().getItem("shoppingCart");n&&"string"==typeof n&&(n=JSON.parse(n),n.userActionPending===!0&&(o=!0))}(i.isPageRedirected()||!i.loggedIn()||!i.createOrderForLoggedInAtCheckout&&i.loggedinAtCheckout()||r.onLogin||window.isAgentApplication||i.storeConfiguration.isLargeCart()||i.storeConfiguration.largeCartConfig.suppressPageChangeValidations)&&(i.storeConfiguration.isLargeCart()!==!0||a!==!0||o!==!1)||$.Topic(t.topicNames.REFRESH_USER_CART).publish(i),i.isPageRedirected(!1)},E.prototype.handleSessionExpired=function(){var e=this;u.getInstance().removeItem(o.LOCAL_STORAGE_SHOPPER_CONTEXT),u.getInstance().removeItem(o.LOCAL_STORAGE_CURRENT_CONTEXT),e.isUserSessionExpired()||e.isUserLoggedOut()||(e.loggedIn(!1),c.isPathEqualTo(e.myAccountHash)||0!=e.isSesExpDuringPlaceOrder()||(e.resetLoginData(),e.reset(),e.id(null)),c.isPathEqualTo(e.checkoutHash)||c.getPath().indexOf(e.checkoutHash)>=0||$.Topic(t.topicNames.USER_CLEAR_CART).publish(e),e.populateUserFromLocalData(!0),e.orderId(""),e.loggedinAtCheckout(!1),e.loggedoutAtCheckout(!1),e.isUserSessionExpired(!0),e.isUserLoggedOut(!1),e.setLocalData("sessionExpiry"),e.readyToDisplay(!0))},E.prototype.handleSessionValid=function(){var e=this;e.loggedIn(e.client().loggedIn),e.isUserSessionExpired(!1),e.isUserLoggedOut(!1),e.setLocalData("sessionExpiry"),e.readyToDisplay(!0)},E.prototype.validatePrivilagePageRequest=function(e,t){var r=this;if(r.isUserProfileEdited())return!0;var i=t.currentTarget.pathname,a=i.indexOf("#!");return a>=0&&(i=i.substring(a+2)),r.validateAndRedirectPage(i),!1},E.prototype.navigateToPage=function(e,r){if(c.isPathEqualTo(e)){var i={pageId:c.getPath()};$.Topic(t.topicNames.PAGE_VIEW_CHANGED).publish(i)}else c.goTo(e),r&&r()},E.prototype.validateAndRedirectPage=function(e){var r,i=this;if(e!=o.PAYPAL_CHECKOUT_TYPE&&(r=[{message:"success",linkToRedirect:e}]),!i.loggedIn()&&i.isUserSessionExpired())e==o.PAYPAL_CHECKOUT_TYPE&&c.isPathEqualTo(i.checkoutHash)?$.Topic(t.topicNames.CONTINUE_TO_PAYPAL).publish():c.doLogin(e);else if(i.loggedIn()){var a=function(){i.handleSessionValid(),i.pageToRedirect()&&""!=i.pageToRedirect()&&i.pageToRedirect()==e&&i.pageToRedirect(null),e==o.PAYPAL_CHECKOUT_TYPE?$.Topic(t.topicNames.CONTINUE_TO_PAYPAL).publish():c.goTo(e)},n=function(t){t&&(i.handleSessionExpired(),c.doLogin(e))};i.client().refresh(a,n)}else c.goTo(e);return!1},E.prototype.handleUpdateProfile=function(){var e=this,r={},i=!1,n=!1,s=!1,l=!1,c=!1,d=!1;if(e.isProfileModified()&&(e.isProfileValid()?s=!0:i=!0,n=!0),e.isPasswordModified()&&(e.isPasswordValid()?c=!0:i=!0,n=!0),null!=e.editShippingAddress()&&($.inArray(e.editShippingAddress(),e.shippingAddressBook())<0&&e.shippingAddressBook.push(e.editShippingAddress()),1===e.shippingAddressBook().length&&e.shippingAddressBook()[0].isDefaultAddress(!0),e.editShippingAddress().isDefaultAddress()&&e.selectDefaultAddress(e.editShippingAddress())),e.isShippingAddressBookModified()){for(var u=0;u<e.shippingAddressBook().length;u++)if(!e.shippingAddressBook()[u].validateNow()){i=!0;break}d=!i,n=!0}if(e.dynamicProperties().length>0&&e.isDynamicPropertiesModified()){for(var p=0;p<e.dynamicProperties().length;p++){var h=e.dynamicProperties()[p];if(!h.isValid()){i=!0;break}}i||(l=!0),n=!0}return e.isUserDataModified()&&(n=!0),n?i?void $.Topic(t.topicNames.USER_PROFILE_UPDATE_INVALID).publish():(s&&e.handleAccountDetailsUpdate(r),l&&e.handleDynamicPropertiesUpdate(r),c&&e.handleUpdatePassword(r),d&&e.handleShippingAddressUpdate(r),e.isB2BUser()&&e.isDelegatedAdmin()&&a.profileType==o.PROFILE_TYPE_AGENT&&e.updateRolesForCurrentOrganization(r),void e.invokeUpdateProfile(r)):void $.Topic(t.topicNames.USER_PROFILE_UPDATE_NOCHANGE).publish()},E.prototype.updateRolesForCurrentOrganization=function(e){for(var t=this,r=[],i=t.rolesForCurrentOrganization(),a=t.currentOrganization(),n=0;n<i.length;n++)r.push({function:i[n],relativeTo:{id:a.repositoryId}});e[o.ROLES_TEXT]=r},E.prototype.handleAccountDetailsUpdate=function(e){var t=this;t.receiveEmail=t.emailMarketingMails()?"yes":"no",e[o.PROFILE_EMAIL]=t.emailAddress(),e[o.PROFILE_FIRST_NAME]=t.firstName(),e[o.PROFILE_LAST_NAME]=t.lastName(),e[o.PROFILE_RECEIVE_EMAIL]=t.receiveEmail,e[o.PROFILE_LOCALE]=t.locale(),e[o.PROFILE_GDPR_CONSENT_GRANTED_KEY]=t.GDPRProfileP13nConsentGranted()},E.prototype.handleDynamicPropertiesUpdate=function(e){for(var t=this,r=0;r<t.dynamicProperties().length;r++)t.dynamicProperties()[r].value.isModified&&t.dynamicProperties()[r].value.isModified()&&(e[t.dynamicProperties()[r].id()]=t.dynamicProperties()[r].value())},E.prototype.handleUpdatePassword=function(e){var t=this;e[o.PROFILE_OLD_PASSWORD]=t.oldPassword(),e[o.PROFILE_NEW_PASSWORD]=t.newPassword(),e[o.PROFILE_CONFIRM_PASSWORD]=t.confirmPassword()},E.prototype.handleShippingAddressUpdate=function(e){var t=this;e[o.PROFILE_SHIPPING_ADDRESSES]=t.shippingAddressBook()},E.prototype.invokeUpdateProfile=function(e){var r=this;r.adapter.loadJSON(o.ENDPOINT_UPDATE_PROFILE,r.id(),e,function(e){r.editShippingAddress(null),r.resetPassword(),r.resetDynamicPropertiesValueIsModified(),$.Topic(t.topicNames.USER_PROFILE_UPDATE_SUCCESSFUL).publish(e)},function(e){var i=a.getStoredValue(o.LOCAL_STORAGE_USER_CONTENT_LOCALE);if(i){var n=JSON.parse(i)[0].name;r.locale()!==n&&r.locale(n)}else r.locale(r.contextData.global.locale);r.resetPassword(),$.Topic(t.topicNames.USER_PROFILE_UPDATE_FAILURE).publish(e)})},E.prototype.updateExpiredPassword=function(){var e=this,r={};r[o.PROFILE_LOGIN]=e.login(),r[o.PROFILE_OLD_PASSWORD]=e.oldPassword(),r[o.PROFILE_NEW_PASSWORD]=e.newPassword(),r[o.PROFILE_CONFIRM_PASSWORD]=e.confirmPassword(),e.adapter.persistCreate(o.ENDPOINT_UPDATE_EXPIRED_PASSWORD,"id",r,function(r){$.Topic(t.topicNames.USER_PROFILE_PASSWORD_UPDATE_SUCCESSFUL).publish(r);var i=e.newPassword();e.resetPassword(),e.password(i)},function(r){e.resetPassword(),$.Topic(t.topicNames.USER_PROFILE_PASSWORD_UPDATE_FAILURE).publish(r)})},E.prototype.validateTokenForPasswordUpdate=function(e,t,r){var i=this;e=decodeURIComponent(decodeURIComponent(e)),i.token=e;var a={};a[o.OP]=o.VALIDATE_TOKEN_OPERATION,a[o.TOKEN]=e,i.adapter.persistCreate(o.ENDPOINT_UPDATE_EXPIRED_PASSWORD,"id",a,function(e){"function"==typeof t&&t(e)},function(e){i.token="","function"==typeof r&&r(e)})},E.prototype.updateExpiredPasswordUsingToken=function(e,r,i,a,n,s){var l=this,c={};c[o.TOKEN]=e,c[o.PROFILE_LOGIN]=r,c[o.PROFILE_PASSWORD]=i,c[o.PROFILE_PASSWORD_CONFIRM]=a,l.adapter.persistCreate(o.ENDPOINT_UPDATE_EXPIRED_PASSWORD,"id",c,function(e){$.Topic(t.topicNames.USER_PROFILE_PASSWORD_UPDATE_SUCCESSFUL).publish(e),l.resetPassword(),l.token="","function"==typeof n&&n(e)},function(e){l.resetPassword(),l.emailAddressForForgottenPwd(""),$.Topic(t.topicNames.USER_PROFILE_PASSWORD_UPDATE_FAILURE).publish(e),"function"==typeof s&&s(e)})},E.prototype.createProductNotification=function(e){var r=this;r.adapter.persistCreate(o.ENDPOINT_PRODUCT_NOTIFY,"id",e,function(e){$.Topic(t.topicNames.USER_PRODUCT_NOTIFICATION_SUCCESS).publish(e)},function(e){$.Topic(t.topicNames.USER_PRODUCT_NOTIFICATION_FAILED).publish(e)})},E.getInstance=function(e,t,r){return E.singleInstance?!E.singleInstance.loggedInUserName()&&r&&r.global&&r.global.user&&r.global.user.firstName&&E.singleInstance.loggedInUserName(r.global.user.firstName):E.singleInstance=new E(e,t),r&&E.singleInstance.setContext(r),E.singleInstance},E.prototype.getOnBehlafOfToken=function(e,t){var r=this,i={};i.shopperProfileId=r.id(),a.request(o.ON_BEHALF_OF,i,e,t)},E.prototype.getSiteSpecificProperties=function(e,t,r){var i=this,n=function(r){for(var a=!1,o=!0,n=0;n<e.length;n++){for(var s=e[n],l=!1,c=0;c<r.items.length;c++)if(s.id==r.items[c].site.id){l=!0;break}if(!l){o=!1;break}}if(o){for(var c=0;c<r.items.length;c++){if("yes"!=r.items[c].properties.receiveEmail){a=!1;break}a=!0}a?i.receiveEmailGlobally(!0):(null!=i.receiveEmailGlobally()||i.receiveEmailGlobally())&&i.receiveEmailGlobally(!1)}else(null!=i.receiveEmailGlobally()||i.receiveEmailGlobally())&&i.receiveEmailGlobally(!1);i.originalReceiveEmailGlobally=i.receiveEmailGlobally(),t&&t()},s=function(){r&&r()};a.request(o.ENDPOINT_GET_SITE_SPECIFIC_PROFILE_PROPS,null,n,s,i.id())},E.prototype.updateSiteSpecificProperites=function(e,t,r){var i=this,n={},s=[],l="no";i.receiveEmailGlobally()&&(l="yes");for(var c=0;c<e.length;c++){var d={},u={};u.id=e[c].id,d.site=u;var p={};p.receiveEmail=l,d.properties=p,s.push(d)}n.siteProperties=s,a.request(o.ENDPOINT_UPDATE_SITE_SPECIFIC_PROFILE_PROPS,n,t,r,i.id())},E.prototype.resendVerificationCode=function(e,t){var r={};r[o.VALIDATION_TOKEN]=u.getInstance().getItem(o.VALIDATION_TOKEN),a.request(o.ENDPOINT_RESEND_VERIFICATION_CODE,r,e,t)},E}),define("viewModels/skuPropertiesHandler",["knockout","ccRestClient","ccConstants","ccLogger","ccStoreConfiguration"],function(e,t,r,i,a){function o(){var e=this;return e.fetchSkuProperties=function(a,o,n,s,l){n.parent="sku";var c=function(e){e&&e.base&&e.base.forEach(function(e){"sku-base"===e.propertyType&&a().push(e)}),e&&e.specifications&&e.specifications.forEach(function(e){"sku-custom"===e.propertyType&&a().push(e)}),"function"==typeof s&&s(a)},d=function(e){i.error("Failed to fetch SKU properties for "+o,e),"function"==typeof l&&l()},u={};u[r.ENDPOINT_KEY]=r.ENDPOINT_GET_ITEM_TYPE;var p=e.storeConfiguration.getFilterToUse(u);p&&(n[r.FILTER_KEY]=p),t.request(r.ENDPOINT_GET_ITEM_TYPE,n,c,d,o)},e.getBase=function(t,r,i){e.fetchSkuProperties(t,"sku",{includeBase:!0},r,i)},e.getAll=function(t,r,i,a){r&&(r+"").trim()?e.fetchSkuProperties(t,"sku-"+r,{includeBase:!0},i,a):e.getBase(t,i,a)},e.getCustom=function(t,r,i,a){r&&(r+"").trim()?e.fetchSkuProperties(t,"sku-"+r,{includeBase:!1},i,a):e.fetchSkuProperties(t,"sku",{includeBase:!1},i,a)},e.storeConfiguration=a.getInstance(),e}return new o}),define("pageLayout/product",["knockout","ccRestClient","ccConstants","pubsub","CCi18n","ccLogger","viewModels/skuPropertiesHandler","ccStoreConfiguration"],function(e,t,r,i,a,o,n,s){"use strict";function l(t,r){var i=this;t.childSKUs||(t.childSKUs=[]);var a={ignore:["addOnProducts"]};e.mapping.fromJS(t,a,i),i.product=t,i.filterInactiveAddons(t),i.addOnProducts=t.addOnProducts;var o=["id","salePrice","listPrice","primaryFullImageURL","primaryLargeImageURL","primaryMediumImageURL","primarySmallImageURL","primaryThumbImageURL","shippingSurcharge","type","displayName"],n=["childSKUs","thumbImageURLs","smallImageURLs","mediumImageURLs","largeImageURLs","fullImageURLs","sourceImageURLs","productImagesMetadata"];for(var l in o)void 0==i[o[l]]&&(i[o[l]]=e.observable(""));for(var l in n)void 0==i[n[l]]&&(i[n[l]]=e.observableArray([]));return i.minPrice=i.getMinimumPrice(),i.maxPrice=i.getMaximumPrice(!1),i.productSalePrice=i.getSalePrice(),i.productListPrice=i.getListPrice(),i.isOnSale=i.isOnSale(),i.hasPriceRange=i.hasRange(),i.stockStatus=e.observable(),i.variantName=e.observable(),i.variantValue=e.observable(),i.relatedProducts=t.relatedProducts,i.productVariantOptions&&i.productVariantOptions()&&(i.variantOptionsArray=i.populateVariantOptions(e.mapping.toJS(i.productVariantOptions()))),i.inStock=e.observable(!1),i.showStockStatus=e.observable(!1),i.filtered=e.observable(!1),i.skuProperties=e.observableArray([]),i.storeConfiguration=s.getInstance(),i.minListPrice=i.getMinimumPrice(!0),i.maxListPrice=i.getMaximumPrice(!0),r&&r.hasOwnProperty("externalPrice")&&(i.externalPrice=r.externalPrice),r&&r.hasOwnProperty("quantity")&&(i.quantity=r.quantity),i}return l.prototype.getMinimumPrice=function(e){var t,r,i,a,o,n=this,s=n.childSKUs()?n.childSKUs().length:0;if(n.minActivePrice&&!e)return n.minActivePrice();if(t=e?n.listPrice():n.salePrice()||0===n.salePrice()?n.salePrice():n.listPrice(),n.childSKUs())if(s>0)for(var o in n.childSKUs())i=n.childSKUs()[o],a=e?i.listPrice():i.salePrice()||0===i.salePrice()?i.salePrice():i.listPrice(),a||0==a||null==a||(a=t),(!r&&0!=r||a<r)&&(r=a);else r=t;return r},l.prototype.getMaximumPrice=function(e){var t,r,i,a,o,n=this,s=n.childSKUs().length;if(n.maxActivePrice&&!e)return n.maxActivePrice();if(t=e?n.listPrice():n.salePrice()||0===n.salePrice()?n.salePrice():n.listPrice(),n.childSKUs())if(s>0)for(var o in n.childSKUs())i=n.childSKUs()[o],a=e?i.listPrice():i.salePrice()||0===i.salePrice()?i.salePrice():i.listPrice(),a||0==a||null==a||(a=t),(!r&&0!=r||a>r)&&(r=a);else r=t;return r},l.prototype.isOnSale=function(){var e=this,t=e.childSKUs().length;if(!t&&e.product.salePrice)return!0;for(var r in e.childSKUs()){var i=e.childSKUs()[r];if(null!=i.salePrice()&&i.salePrice()>=0)return!0}return!1},l.prototype.hasRange=function(){var e=this;return e.minPrice=e.getMinimumPrice(),e.maxPrice=e.getMaximumPrice(!1),e.minPrice!=e.maxPrice&&!isNaN(parseFloat(e.minPrice))&&!isNaN(parseFloat(e.maxPrice))},l.prototype.getListPrice=function(){var e=this;return e.childSKUs().length>=1?e.getMaximumPrice(!0):e.listPrice()},l.prototype.getSalePrice=function(){var e=this;return!e.hasRange()&&e.isOnSale()?e.minPrice:e.salePrice()},l.prototype.getPrices=function(e,a){var o=this,n={},s=e,l={};l[r.ENDPOINT_KEY]=r.ENDPOINT_GET_PRODUCT_PRICES;var c=o.storeConfiguration.getFilterToUse(l);c&&(n[r.FILTER_KEY]=c);var d=r.ENDPOINT_GET_PRODUCT_PRICES;t.request(d,n,function(e){var t=function(e,t){e.levels(t.levels),e.numLevels(t.numLevels)};if(e.skuPrices)for(var a=o.childSKUs().length,n=e.skuPrices.length,s=0;s<a;s+=1)for(var l=0;l<n;l+=1)o.childSKUs()&&o.childSKUs()[s].repositoryId()==e.skuPrices[l].skuId&&(o.childSKUs()[s].listPrice(e.skuPrices[l].listPrice),o.childSKUs()[s].salePrice(e.skuPrices[l].salePrice),e.skuPrices[l].hasOwnProperty(r.LIST_VOLUME_PRICE)&&(e.skuPrices[l].listVolumePrice.hasOwnProperty(r.BULK_PRICE)?t(o.childSKUs()[s].listVolumePrice.bulkPrice,e.skuPrices[l].listVolumePrice.bulkPrice):e.skuPrices[l].listVolumePrice.hasOwnProperty(r.TIERED_PRICE)&&t(o.childSKUs()[s].listVolumePrice.tieredPrice,e.skuPrices[l].listVolumePrice.tieredPrice)),e.skuPrices[l].hasOwnProperty(r.SALE_VOLUME_PRICE)&&(e.skuPrices[l].saleVolumePrice.hasOwnProperty(r.BULK_PRICE)?t(o.childSKUs()[s].saleVolumePrice.bulkPrice,e.skuPrices[l].saleVolumePrice.bulkPrice):e.skuPrices[l].saleVolumePrice.hasOwnProperty(r.TIERED_PRICE)&&t(o.childSKUs()[s].saleVolumePrice.tieredPrice,e.skuPrices[l].saleVolumePrice.tieredPrice)));o.hasPriceRange=e.priceRange,e.priceRange===!0&&(o.maxPrice=e.priceMax,o.minPrice=e.priceMin),e.list&&o.listPrice(e.list),null===o.product.type&&e.skuPrices&&(o.childSKUs()&&o.childSKUs()[0]&&(o.childSKUs()[0].listPrice(e.skuPrices.listPrice||e.list),o.listPrice(e.skuPrices.listPrice||e.list)),e.skuPrices.hasOwnProperty(r.LIST_VOLUME_PRICE)&&(e.skuPrices.listVolumePrice.hasOwnProperty(r.BULK_PRICE)?t(o.childSKUs()[0].listVolumePrice.bulkPrice,e.skuPrices.listVolumePrice.bulkPrice):e.skuPrices.listVolumePrice.hasOwnProperty(r.TIERED_PRICE)&&t(o.childSKUs()[0].listVolumePrice.tieredPrice,e.skuPrices.listVolumePrice.tieredPrice)),e.skuPrices.hasOwnProperty(r.SALE_VOLUME_PRICE)&&(e.skuPrices.saleVolumePrice.hasOwnProperty(r.BULK_PRICE)?t(o.childSKUs()[0].saleVolumePrice.bulkPrice,e.skuPrices.saleVolumePrice.bulkPrice):e.skuPrices.saleVolumePrice.hasOwnProperty(r.TIERED_PRICE)&&t(o.childSKUs()[0].saleVolumePrice.tieredPrice,e.skuPrices.saleVolumePrice.tieredPrice))),e.sale||0===e.sale?o.salePrice(e.sale):o.salePrice(null),null===o.product.type&&e.skuPrices&&(o.childSKUs()&&o.childSKUs()[0]&&o.childSKUs()[0].salePrice(e.skuPrices.salePrice),o.salePrice(e.skuPrices.salePrice)),$.Topic(i.topicNames.PRODUCT_PRICE_CHANGED).publish()},function(e){},s)},l.prototype.getAvailability=function(e,i,a){var o=this,n={},s=e;n[r.SKU_ID]=i,n[r.CATALOG]=null==a?"":a;var l=r.ENDPOINT_GET_PRODUCT_AVAILABILITY,c={};c[r.ENDPOINT_KEY]=r.ENDPOINT_GET_PRODUCT_AVAILABILITY,c[r.IDENTIFIER_KEY]="productStockStatus";var d=o.storeConfiguration.getFilterToUse(c);d&&(n[r.FILTER_KEY]=d),t.request(l,n,function(e){if(null!=e.productSkuInventoryStatus)for(var t=e.productSkuInventoryStatus,r=o.product.childSKUs?o.product.childSKUs.length:0,i=0;i<r;i++){var a=o.product.childSKUs[i];a.quantity=t[a.repositoryId]}o.stockStatus(e)},function(e){var t={stockStatus:r.OUT_OF_STOCK};o.stockStatus(t)},s)},l.prototype.getSkuPrice=function(e){var t=this,r={};for(var i in t.childSKUs())t.childSKUs()[i].repositoryId()==e.repositoryId&&(r.listPrice=t.childSKUs()[i].listPrice(),r.salePrice=t.childSKUs()[i].salePrice(),r.listVolumePrice=t.childSKUs()[i].listVolumePrice,r.saleVolumePrice=t.childSKUs()[i].saleVolumePrice);return r},l.prototype.isConfigurable=function(){var e=this;if(e.configurable&&e.configurable())return!0;for(var t in e.childSKUs())if(e.childSKUs()[t].configurable&&e.childSKUs()[t].configurable())return!0;return!1},l.prototype.fetchSkuProperties=function(){var e=this;e.skuProperties([]),n.getAll(e.skuProperties,e.product.type)},l.prototype.populateVariantOptions=function(e){var t=this;if(e&&null!==e&&e.length>0)for(var r,i,a=[],o=0;o<e.length;o++)r=t.mapOptionsToArray(e[o].optionValueMap),i=t.productVariantModel(e[o].optionName,e[o].mapKeyPropertyAttribute,r,e[o].optionId),a.push(i);else t.imgMetadata=t.productImagesMetadata;return a},l.prototype.mapOptionsToArray=function(t){var r=[];for(var i in t)t.hasOwnProperty(i)&&r.push({key:i,value:t[i],visible:e.observable(!0)});return r},l.prototype.productVariantModel=function(t,r,i,o){var n=this,s={},l={};s.optionDisplayName=t,s.parent=this,s.optionId=r,s.originalOptionValues=e.observableArray(i),s.actualOptionId=o;var c=e.observable(!0);1===i.length&&c(n.checkOptionValueWithSkus(r,i[0].value)),c()&&(s.optionCaption=a.t("ns.common:resources.optionCaption",{optionName:t},!0)),s.selectedOptionValue=e.observable(),s.countVisibleOptions=e.computed(function(){for(var e=0,t=0;t<s.originalOptionValues().length;t++)1==i[t].visible()&&(e+=1);return e},s),s.disable=e.computed(function(){return 0==s.countVisibleOptions()},s),s.selectedOption=e.computed({write:function(e){n.filtered(!1),s.selectedOptionValue(e),n.filterOptionValues(s.optionId)},read:function(){return s.selectedOptionValue()},owner:s}),s.selectedOption.extend({required:{params:!0,message:a.t("ns.common:resources.optionRequiredMsg",{optionName:t},!0)}}),s.optionValues=e.computed({write:function(e){s.originalOptionValues(e)},read:function(){return e.utils.arrayFilter(s.originalOptionValues(),function(e){return 1==e.visible()})},owner:s}),l.thumbImageURLs=1==n.thumbImageURLs().length&&n.thumbImageURLs()[0].indexOf("/img/no-image.jpg&")>0?[]:n.thumbImageURLs(),l.smallImageURLs=1==n.smallImageURLs().length&&n.smallImageURLs()[0].indexOf("/img/no-image.jpg&")>0?[]:n.smallImageURLs(),l.mediumImageURLs=1==n.mediumImageURLs().length&&n.mediumImageURLs()[0].indexOf("/img/no-image.jpg&")>0?[]:n.mediumImageURLs,l.largeImageURLs=1==n.largeImageURLs().length&&n.largeImageURLs()[0].indexOf("/img/no-image.jpg&")>0?[]:n.largeImageURLs(),l.fullImageURLs=1==n.fullImageURLs().length&&n.fullImageURLs()[0].indexOf("/img/no-image.jpg&")>0?[]:n.fullImageURLs(),l.sourceImageURLs=1==n.sourceImageURLs().length&&n.sourceImageURLs()[0].indexOf("/img/no-image.jpg")>0?[]:n.sourceImageURLs();var d=[];if(n.thumbImageURLs&&n.thumbImageURLs().length>0)for(var u=0;u<n.thumbImageURLs().length;u++)d.push(n.productImagesMetadata[u]);return s},l.prototype.filterOptionValues=function(e){var t=this;if(!t.filtered()){for(var r=t.variantOptionsArray,i=0;i<r.length;i++){var a=r[i],o=t.getMatchingSKUs(r[i].optionId),n=t.updateOptionValuesFromSku(o,e,a);r[i].optionValues(n),t.filtered(!0)}t.updateSingleSelection(e)}},l.prototype.getMatchingSKUs=function(e){for(var t=this,r=t.childSKUs(),i=[],a=t.variantOptionsArray,o={},n=0;n<a.length;n++)a[n].optionId!=e&&void 0!=a[n].selectedOption()&&(o[a[n].optionId]=a[n].selectedOption().value);for(var s=0;s<r.length;s++){var l=!0;for(var c in o)if(o.hasOwnProperty(c)&&(!r[s].dynamicPropertyMapLong[c]||r[s].dynamicPropertyMapLong[c]()!=o[c])){l=!1;break}l&&i.push(r[s])}return i},l.prototype.updateOptionValuesFromSku=function(e,t,r){for(var i=r.optionId,a=[],o=r.originalOptionValues(),n=0;n<e.length;n++){var s=e[n].dynamicPropertyMapLong[i];void 0!=s&&a.push(s())}for(var l=0;l<o.length;l++){var c=o[l].value,d=!1,u=a.indexOf(c);u!=-1&&(d=!0),o[l].visible(d)}return o},l.prototype.updateSingleSelection=function(e){for(var t=this,r=t.variantOptionsArray,i=0;i<r.length;i++){var a=r[i].optionId;if(1==r[i].countVisibleOptions()&&void 0==r[i].selectedOption()&&a!=e)for(var o=(t.validForSingleSelection(a),r[i].originalOptionValues()),n=0;n<o.length;n++)if(1==o[n].visible()){r[i].selectedOption(o[n]);break}}},l.prototype.validForSingleSelection=function(e){for(var t=this,r=t.variantOptionsArray,i=0;i<r.length;i++){if(r[i].disable()||r[i].optionId!=e&&void 0!=r[i].selectedOption())return!0;if(r[i].optionId!=e&&void 0==r[i].selectedOption()&&1==r[i].countVisibleOptions())return!0}return!1},l.prototype.checkOptionValueWithSkus=function(e,t){for(var r=this,i=r.childSKUs(),a=i.length,o=0;o<a;o++)if(!i[o].dynamicPropertyMapLong[e]||void 0===i[o].dynamicPropertyMapLong[e]())return!0;return!1},l.prototype.getSelectedSkuOptions=function(e){for(var t=[],r=0;r<e.length;r++)e[r].disable()||t.push({optionName:e[r].optionDisplayName,optionValue:e[r].selectedOption().key,optionId:e[r].actualOptionId,optionValueId:e[r].selectedOption().value});return t},l.prototype.getProductsAvailability=function(e,i,a,o,n){var s={};s[r.PRODUCTS_PARAM]=a,s[r.CATALOG]=null==o?"":o,n&&null!==n&&""!==n&&(s[r.LOCATION_IDS]=n);var l=r.ENDPOINT_PRODUCTS_AVAILABILITY;t.request(l,s,e,i)},l.prototype.filterInactiveAddons=function(e){if(e.addOnProducts&&e.addOnProducts.length>0)for(var t=e.addOnProducts.length,r=t-1;r>=0;r--)if(e.addOnProducts[r].addOnOptions&&0!=e.addOnProducts[r].addOnOptions.length&&e.addOnProducts[r].addOnOptions[0].product&&e.addOnProducts[r].addOnOptions[0].product.active)for(var i=e.addOnProducts[r].addOnOptions.length-1;i>=0;i--)e.addOnProducts[r].addOnOptions[i].sku.active||e.addOnProducts[r].addOnOptions.splice(i,1);else e.addOnProducts.splice(r,1)},l}),define("swmRestClientConstructor",["jquery","ccRestClient","ccLogger","storageApi","pageLayout/site"],function(e,t,r,i,a){"use strict";function o(e,r){var a=this;a.isInitialized=!1,a.usingCCAuthentication=!1,a.isSynced=!1,a.unauthorizedCount=0,a.cors="withCredentials"in new XMLHttpRequest,a.corsFrameReady=!1,a.ccsyncInProgress=!1,a.ccsyncBlockedCallQue={items:[]},a.refreshTimeoutID=null,a.siteid="",a.ccsiteid="",a.apiuserid="",a.apiuserauth="";try{i.getInstance().removeItem("social.ccsyncprofileid"),i.getInstance().removeItem("social.ccsyncapiuserid")}catch(e){}a.ccrestapi=t,a.tenantid="",a.swmhost="",a.isPreview=!1,a.currentRequestId=0,a.commonSuccessCallback=e,a.commonErrorCallback=r,a.doRefresh=function(){if(a.usingCCAuthentication){var e=function(){},r=function(e){};a.refresh(e,r),t.storeRequestWasMade=!0}},a.stackedPostMessages={items:[]},a.setCorsFrameReady=function(){if(a.corsFrameReady=!0,a.stackedPostMessages&&a.stackedPostMessages.items.length>0){for(var e=0;e<a.stackedPostMessages.items.length;e++)a.proxyFrame.postMessage(a.stackedPostMessages.items[e].msgObj,a.swmhost);a.stackedPostMessages={items:[]}}}}return o.GET="GET",o.POST="POST",o.JSON="json",o.REQUEST_JSON_CONTENT_TYPE="application/json",o.REQUEST_FORM_URL_ENCODED="application/x-www-form-urlencoded",o.SWM_CCSYNC_ENDPOINT="/swm/rs/v1/users/cc",o.SWM_REFRESH_ENDPOINT="/swm/rs/v1/users/refresh",o.AUTH_HEADER_NAME="Authorization",o.CC_TENANTID_HEADER_NAME="X-CCTenantId",o.CC_SITEID_HEADER_NAME="X-CCSiteId",o.CC_ISPREVIEW_HEADER_NAME="X-CCIsPreview",o.ACCEPT_LANGUAGE_HEADER_NAME="Accept-Language",o.X_REQUESTED_WITH="X-Requested-With",o.X_REQUESTED_WITH_AJAX_VALUE="XMLHttpRequest",o.SWM_ACCESS_TOKEN="access_token",o.AUTH_HEADER_PREFIX="Bearer ",o.JWT_BEARER_GRANT_TYPE="urn:ietf:params:oauth:grant-type:jwt-bearer",o.TOKEN_REFRESH_TIMEOUT=5e3,o.IFRAME_ELEMENT="iframe",o.ZERO="0",o.IFRAME_STYLE="width: 0; height: 0; border: none;",o.IFRAME_NAME="swm_iframe",o.ID_ATTRIBUTE="id",o.NAME_ATTRIBUTE="name",o.WIDTH_ATTRIBUTE="width",o.HEIGHT_ATTRIBUTE="height",o.BORDER_ATTRIBUTE="border",o.STYLE_ATTRIBUTE="style",o.SRC_ATTRIBUTE="src",o.MAX_INT=4294967295,o.prototype.setSWMHost=function(e){this.swmhost=e},o.prototype.init=function(e,t,r){var i=this;if(i.tenantid=e,i.isPreview=1==t?"true":"false",i.locale=r,i.ccsiteid=a.getInstance().siteInfo.id,!i.cors&&!i.isInitialized){i.crossDomainUrl=i.swmhost+"/swm/pm/?tenantId="+e+"&isPreview="+i.isPreview,i.eventHandlerMap={},i.eventHandlerMap.initializedSWMFrame={success:i.setCorsFrameReady,error:i.setCorsFrameReady},i.initXDomainMessageListener();var o=i.createCrossDomainIFrame();null!=o&&(i.proxyFrame=o.contentWindow)}i.isInitialized=!0},o.prototype.createCrossDomainIFrame=function(){var e=this,t=o.IFRAME_NAME,r=document.createElement(o.IFRAME_ELEMENT);r.setAttribute(o.ID_ATTRIBUTE,t),r.setAttribute(o.NAME_ATTRIBUTE,t),r.setAttribute(o.WIDTH_ATTRIBUTE,o.ZERO),r.setAttribute(o.HEIGHT_ATTRIBUTE,o.ZERO),r.setAttribute(o.BORDER_ATTRIBUTE,o.ZERO),r.setAttribute(o.STYLE_ATTRIBUTE,o.IFRAME_STYLE),r.setAttribute(o.SRC_ATTRIBUTE,e.crossDomainUrl);var i=null;try{document.body.appendChild(r),window.frames[t].name=t,i=document.getElementById(t)}catch(e){}return i},o.prototype.initXDomainMessageListener=function(){var e=this;window.addEventListener("message",function(t){var r=t.origin;if(r===e.swmhost){var i;i="string"==typeof t.data?JSON.parse(t.data):t.data;var a=i.id,o=i.success,n=i.payload,s=e.eventHandlerMap[a];s&&(o?s.success(n):s.error(JSON.stringify(n)))}},!1)},o.prototype.proxyRequest=function(e,t,r,i,a,n){var s=this;s.currentRequestId>=o.MAX_INT?s.currentRequestId=0:s.currentRequestId++;var l=s.currentRequestId;s.eventHandlerMap[l]={success:i,error:a};var c=t.replace("{siteid}",s.siteid);c=s.swmhost+s.insertParamsIntoUri(c,n),c.indexOf(o.SWM_REFRESH_ENDPOINT)==-1&&c.indexOf(o.SWM_CCSYNC_ENDPOINT)==-1&&(null==s.refreshTimeoutID?s.refreshTimeoutID=setTimeout(s.doRefresh,o.TOKEN_REFRESH_TIMEOUT):(clearTimeout(s.refreshTimeoutID),s.refreshTimeoutID=setTimeout(s.doRefresh,o.TOKEN_REFRESH_TIMEOUT)));var d=0===t.indexOf(o.SWM_CCSYNC_ENDPOINT),u=(d?o.REQUEST_FORM_URL_ENCODED:o.REQUEST_JSON_CONTENT_TYPE,r?d?r:JSON.stringify(r):""),p={};p.id=l,p.pMethod=e,p.pUrl=c,p.pData=u,p.pIsPreview=s.isPreview,p.pTenantId=s.tenantid,p.pCCSiteId=s.ccsiteid,p.pLocale=s.locale,p.pApiuserauth=s.apiuserauth,p.pAssertion=s.ccrestapi.tokenSecret,s.corsFrameReady?s.proxyFrame.postMessage(JSON.stringify(p),s.swmhost):s.stackedPostMessages.items.push({msgObj:JSON.stringify(p)})},o.prototype.syncCCUser=function(e,t){var r=this,a=function(t){
- r.isSynced=!0,r.siteid=t.siteId,r.apiuserid=t.userId,r.apiuserauth=t.access_token;try{i.getInstance().setItem("social.ccsyncprofileid",r.ccrestapi.profileId),i.getInstance().setItem("social.ccsyncapiuserid",t.userId)}catch(e){}e&&e(t)},n=function(e){r.isSynced=!1,null!=r.refreshTimeoutID&&clearTimeout(r.refreshTimeoutID),t&&t(e)};this.cors?this.corsRequest(o.POST,o.SWM_CCSYNC_ENDPOINT+"/{ccprofileid}","grant_type="+encodeURIComponent(o.JWT_BEARER_GRANT_TYPE)+"&assertion="+encodeURIComponent(r.ccrestapi.tokenSecret),a,n,{ccprofileid:r.ccrestapi.profileId}):this.proxyRequest(o.POST,o.SWM_CCSYNC_ENDPOINT+"/{ccprofileid}","grant_type="+encodeURIComponent(o.JWT_BEARER_GRANT_TYPE)+"&assertion="+encodeURIComponent(r.ccrestapi.tokenSecret),a,n,{ccprofileid:r.ccrestapi.profileId})},o.prototype.refresh=function(e,t){var r=this,i=function(t){r.isSynced=!0,r.apiuserauth=t.access_token,e&&e(t)},a=function(e){};r.apiuserauth?r.cors?r.corsRequest(o.POST,o.SWM_REFRESH_ENDPOINT,{},i,a):r.proxyRequest(o.POST,o.SWM_REFRESH_ENDPOINT,{},i,a):a()},o.prototype.clear=function(){var e=this;e.usingCCAuthentication=!1,e.isSynced=!1,e.siteid="",e.apiuserid="",e.apiuserauth="";try{i.getInstance().removeItem("social.ccsyncprofileid"),i.getInstance().removeItem("social.ccsyncapiuserid")}catch(e){}},o.prototype.request=function(e,t,a,o,n,s){var l=this,c=o,d=n;if(""==l.swmhost||!l.isInitialized)return void r.warn("rest client not initialized properly");null!=l.ccrestapi.profileId&&null!=l.ccrestapi.tokenSecret&&(l.usingCCAuthentication=!0);var u=i.getInstance().getItem("social.ccsyncprofileid"),p=i.getInstance().getItem("social.ccsyncapiuserid");if(u&&l.ccrestapi.profileId!==u||p&&l.apiuserid!==p){l.clear();var h='{"o:errorCode":"401.99"}';return void l.commonErrorCallback(h)}if(l.apiuserid===p&&l.ccrestapi.profileId===u||(l.isSynced=!1),l.usingCCAuthentication&&!l.isSynced){var g=function(r){l.ccsyncInProgress=!1,l.cors?l.corsRequest(e,t,a,c,d,s):l.proxyRequest(e,t,a,c,d,s),l.ccsyncBlockedCallQueExecution()},f=function(e){l.ccsyncInProgress=!1,null!=l.refreshTimeoutID&&clearTimeout(l.refreshTimeoutID),d&&d(e)};l.ccsyncInProgress?l.ccsyncBlockedCallQue.items.push({pMethod:e,pUrl:t,pData:a,pSuccessCallback:o,pErrorCallback:n,pJSONParams:s}):(l.ccsyncInProgress=!0,l.syncCCUser(g,f))}else l.cors?this.corsRequest(e,t,a,o,n,s):this.proxyRequest(e,t,a,o,n,s)},o.prototype.ccsyncBlockedCallQueExecution=function(){var e=this;if(e.ccsyncBlockedCallQue.items.length>0){for(var t=0;t<e.ccsyncBlockedCallQue.items.length;t++)e.cors?e.corsRequest(e.ccsyncBlockedCallQue.items[t].pMethod,e.ccsyncBlockedCallQue.items[t].pUrl,e.ccsyncBlockedCallQue.items[t].pData,e.ccsyncBlockedCallQue.items[t].pSuccessCallback,e.ccsyncBlockedCallQue.items[t].reqErrorCB,e.ccsyncBlockedCallQue.items[t].pJSONParams):e.proxyRequest(e.ccsyncBlockedCallQue.items[t].pMethod,e.ccsyncBlockedCallQue.items[t].pUrl,e.ccsyncBlockedCallQue.items[t].pData,e.ccsyncBlockedCallQue.items[t].pSuccessCallback,e.ccsyncBlockedCallQue.items[t].reqErrorCB,e.ccsyncBlockedCallQue.items[t].pJSONParams);e.ccsyncBlockedCallQue={items:[]}}},o.prototype.corsRequest=function(t,r,i,a,n,s){var l=this,c=t,d=r.replace("{siteid}",l.siteid);d=l.swmhost+l.insertParamsIntoUri(d,s),d.indexOf(o.SWM_REFRESH_ENDPOINT)==-1&&d.indexOf(o.SWM_CCSYNC_ENDPOINT)==-1&&(null==l.refreshTimeoutID?l.refreshTimeoutID=setTimeout(l.doRefresh,o.TOKEN_REFRESH_TIMEOUT):(clearTimeout(l.refreshTimeoutID),l.refreshTimeoutID=setTimeout(l.doRefresh,o.TOKEN_REFRESH_TIMEOUT)));var u=function(e){r.indexOf(o.SWM_CCSYNC_ENDPOINT)==-1&&(l.unauthorizedCount=0);var t=function(e,t){l.commonSuccessCallback(e,t),a(e,t)};t(e.data,e.textStatus)},p=function(e){var c=function(e,t,r){l.commonErrorCallback(e,t,r),n(e,t,r)};if(l.usingCCAuthentication)try{var d=JSON.parse(e.jqXHR.responseText);l.unauthorizedCount<=1&&401===d.status&&r.indexOf(o.SWM_CCSYNC_ENDPOINT)==-1?(l.isSynced=!1,l.unauthorizedCount++,l.request(t,r,i,a,n,s)):c(e.jqXHR.responseText,e.jqXHR.status,e.errorThrown)}catch(e){}else c(e.jqXHR.responseText,e.jqXHR.status,e.errorThrown)};c===o.GET&&(d=l.fixIECaching(d));var h=0===r.indexOf(o.SWM_CCSYNC_ENDPOINT),g=h?o.REQUEST_FORM_URL_ENCODED:o.REQUEST_JSON_CONTENT_TYPE,f=i?h?i:JSON.stringify(i):"",m={};m={dataType:o.JSON,contentType:g,type:c,url:d,data:f,processData:!1,success:function(e,t,r){u({data:e,textStatus:t,jqXHR:r})},error:function(e,t,r){p({jqXHR:e,textStatus:t,errorThrown:r})}};var I={};I[o.X_REQUESTED_WITH]=o.X_REQUESTED_WITH_AJAX_VALUE,I[o.CC_ISPREVIEW_HEADER_NAME]=l.isPreview,I[o.ACCEPT_LANGUAGE_HEADER_NAME]=l.locale,h?(I[o.CC_TENANTID_HEADER_NAME]=l.tenantid,I[o.CC_SITEID_HEADER_NAME]=l.ccsiteid):l.apiuserauth&&l.apiuserauth.length>0&&(I[o.AUTH_HEADER_NAME]=o.AUTH_HEADER_PREFIX+l.apiuserauth),m.headers=I,e.ajax(m)},o.prototype.insertParamsIntoUri=function(e,t){var r=e;for(var i in t)t.hasOwnProperty(i)&&(r=r.replace("{"+i+"}",encodeURIComponent(t[i])));return r},o.prototype.fixIECaching=function(e){return e},o.getTimestamp=function(e){var t=new Date/1e3,r=parseInt(e,10),i=t+r;return parseInt(+i,10)},o}),define("swmRestClient",["swmRestClientConstructor","ccRestClient","ccLogger","pubsub","jquery","ccConstants","storageApi"],function(e,t,r,i,a,o,n){"use strict";var s=function(e){},l=function(e,t){try{var o=JSON.parse(e);if(o.error&&o.status)switch(o.status){case"400.12":a.Topic(i.topicNames.SOCIAL_SPACE_UNAVAILABLE).publish({reason:"ccsync_failed"});break;default:a.Topic(i.topicNames.SOCIAL_SPACE_UNAVAILABLE).publish({reason:"config"})}else 401===o.status?(a.Topic(i.topicNames.SOCIAL_SPACE_UNAVAILABLE).publish({reason:"unauthorized"}),"401.99"===o["o:errorCode"]&&a.Topic(i.topicNames.SOCIAL_REFRESH_SPACES).publish({})):"403.1"!==o["o:errorCode"]&&"403.2"!==o["o:errorCode"]||n.getInstance().removeItem("social.currentSpaceId")}catch(e){r.warn("swm error occurred, response code: "+t),a.Topic(i.topicNames.SOCIAL_SPACE_UNAVAILABLE).publish({})}},c=new e(s,l);if(window.externalServiceData){var d=window.externalServiceData.social.scheme+"://"+window.externalServiceData.social.host;"0"!=window.externalServiceData.social.port&&(d+=":"+window.externalServiceData.social.port),c.setSWMHost(d)}return c}),define("swmKoValidateRules",["knockout","jqueryui","koValidate"],function(e,t,r){"use strict";e.validation.rules.multiemail={validator:function(t,r){if(!r)return!0;var i=!0;if(!e.validation.utils.isEmptyVal(t)){var a=t.replace(/,/g,";").split(";");$(a).each(function(t){return i=e.validation.rules.email.validator($.trim(this),r)})}return i},message:"Please enter valid email addresses (separate multiple email addresses using a colon or semicolon)."},e.validation.rules.multiemailmax={validator:function(t,r){if(!r)return!1;if(!e.validation.utils.isEmptyVal(t)){var i=t.trim().replace(/,/g,";"),a=i.split(";"),o=a.length;if(";"==i.charAt(i.length-1)&&(o-=1),o>r)return!1}return!0},message:"Please limit the number of valid email addresses"},e.validation.rules.uniquespacename={validator:function(t,r){var i=e.utils.unwrapObservable(r),a=t.trim().replace(/\s+/g," ");if(Array.isArray(i))for(var o=0;o<i.length;o++){var n;if(n="string"==typeof i[o].spaceNameFull?i[o].spaceNameFull.toUpperCase():i[o].spaceNameFull().toUpperCase(),n==a.toUpperCase())return!1}return!0},message:"Name must be unique"},e.validation.rules.editSpaceNameUniqueRule={validator:function(t,r){var i=t.trim().replace(/\s+/g," "),a=r.currentSpaceId,o=e.utils.unwrapObservable(r.spaces);if(Array.isArray(o))for(var n=0;n<o.length;n++){var s;if(s="string"==typeof o[n].spaceNameFull?o[n].spaceNameFull.toUpperCase():o[n].spaceNameFull().toUpperCase(),s==i.toUpperCase()){if(o[n].spaceid==a)continue;return!1}}return!0},message:"Name must be unique"},e.validation.rules.badrequestinvalidemail={validator:function(e){return!1},message:"Please type in valid email addresses for your recipients."},e.validation.rules.badrequestspacename={validator:function(e){return!1},message:"Name must be unique"},e.validation.registerExtenders()}),define("pageLayout/space",["jquery","knockout","pubsub","notifier","ccLogger","CCi18n","swmRestClient","swmKoValidateRules"],function(e,t,r,i,a,o,n,s){"use strict";function l(e,r){if(l.singleInstance)throw new Error("Cannot instantiate more than one SpaceViewModel, use getInstance(pAdapter, pUserData, pParams)");var i=this;return i.adapter=e,i.id=t.observable(""),i.name=t.observable(""),i.ownerId=t.observable(""),i.ownerFirstName=t.observable(""),i.ownerLastName=t.observable(""),i.ownerMediaId=t.observable(""),i.ownerMediaUrl=t.observable(""),i.accessLevel=t.observable(""),i.siteName=t.observable(""),i.fbAppId=t.observable(""),i.inviteAcceptInProgress=t.observable(!1),i.members=t.observableArray([]),i.ownerFullName=t.computed(function(){return i.ownerFirstName()+" "+i.ownerLastName()},i),i.contextId=t.observable(""),i.showSpace=t.observable(!1),i.spaceProductMediaUrl=t.observable(""),i}return l.prototype.isSpaceOwner=function(e){var t=this;return t.ownerId()===e},l.prototype.isMember=function(t){var r=this,i=!1;return e.each(r.members(),function(e,r){if(r.userId==t)return i=!0,!1}),i},l.prototype.isPrivate=function(){var e=this,t=!1;return"0"===e.accessLevel()&&(t=!0),t},l.prototype.isGroup=function(){var e=this,t=!1;return"2"===e.accessLevel()&&(t=!0),t},l.prototype.isShared=function(){var e=this,t=!1;return"1"===e.accessLevel()&&(t=!0),t},l.prototype.isPrivateOrGroup=function(){var e=this,t=!1;return(e.isPrivate()||e.isGroup())&&(t=!0),t},l.prototype.updateSpace=function(e){var t=this;e.id&&t.id(e.id),e.name&&t.name(e.name),e.ownerId&&t.ownerId(e.ownerId),e.ownerFirstName&&t.ownerFirstName(e.ownerFirstName),e.ownerLastName&&t.ownerLastName(e.ownerLastName),e.ownerMediaId&&t.ownerMediaId(e.ownerMediaId),e.ownerMediaUrl&&t.ownerMediaUrl(e.ownerMediaUrl),e.accessLevel&&t.accessLevel(e.accessLevel),e.siteName&&t.siteName(e.siteName),e.fbAppId&&t.fbAppId(e.fbAppId),e.spaceProductMediaUrl&&t.spaceProductMediaUrl(e.spaceProductMediaUrl)},l.prototype.updateMembers=function(t){var i=this;i.members.removeAll(),i.members(t),e.Topic(r.topicNames.SOCIAL_SPACE_MODEL_MEMBERS_CHANGED).publish()},l.getInstance=function(e,t,r){return l.singleInstance||(l.singleInstance=new l(e,t)),l.singleInstance},l}),define("pageLayout/infinity",["jquery","knockout","pubsub","storageApi","CCi18n","ccLogger"],function(e,t,r,i,a,o){"use strict";function n(t,r,i,a){if(n.singleInstance)throw new Error("Cannot instantiate more than one InfinityViewModel, use InfinityViewModel.getInstance()");var o=this;o.user=t,o.cart=r,o.confirmation=i,o.site=a,o.infinityLoaded=e.Deferred(),o.configInfinity=function(){localStorage.setItem(l,document.referrer),window.ORA.analytics.addMutation(B,function(e){e.params.payload[u]=encodeURI(window.location).split("?")[0],e.params.payload[s]=document.title,e.params.payload.dcsuri=window.location.pathname,e.params.payload.dcsref=localStorage.getItem(l)}),o.infinityLoaded.resolve()},o.addSubscriptions(),document.body.addEventListener(c,o.configInfinity,!1),o.populateProductData=function(e,t){t[y]=e.id,t[E]=e.childSKUs[0].repositoryId;var r;r=e.childSKUs[0].salePrice?e.childSKUs[0].salePrice:e.childSKUs[0].listPrice?e.childSKUs[0].listPrice:e.salePrice?e.salePrice:e.listPrice,t[C]=r,t[_]=this.site().selectedPriceListGroup().currency.currencyCode,e.type?t[v]=e.type:t[v]="Basic",e.brand&&null!==e.brand&&"null"!==e.brand&&(t[b]=e.brand)},o.addCampaignsData=function(e,t){for(var r="",i="",a=0;a<e.length;a++)0===a?(r=e[a].campaignId,i=e[a].source):(r=r+";"+e[a].campaignId,i=i+";"+e[a].source);0!==r.length&&0!==i.length&&(t[q]=r,t[j]=i)}}var s="wt.ti",l="occ.referrer",c="ORA_ANALYTICS_READY",d="page-uri",u="wt.es",p="wt.dcsvid",h="wt.vt_f",g="wt.ce",f="wt.cg_n",m="wt.cg_s",I="wt.si_p",E="wt.pn_sku",y="wt.pn_id",v="wt.pn_fa",b="wt.pn_ma",T="wt.tx_e",P="wt.tx_cartid",S="wt.tx_u",C="wt.tx_s",_="wt.z_currency",A="wt.tx_i",O="wt.tx_id",R="wt.tx_it",N="wt.conv",D="wt.oss",L="wt.oss_r",w="wt.z_selectedSearchFacet",M="wt.mc_id",U="wt.z_country",k="wt.z_region",x="wt.z_city",G="wt.z_zip",F="wt.z_gatewayName",H="wt.z_gatewayTransactionAmount",V="wt.z_shippingMethod",Y="wt.z_shippingCharges",B="OCC_MUTATION",q="wt.z_campaignId",j="wt.z_campaignSource";return n.initialize=function(e,t,r,i){return n.singleInstance||i().extensionSiteSettings.InfinityTag.content&&i().extensionSiteSettings.InfinityTag.content.url&&(require([i().extensionSiteSettings.InfinityTag.content.url]),n.singleInstance=new n(e,t,r,i)),n.singleInstance},n.prototype.addSubscriptions=function(){var t=this;e.Topic(r.topicNames.PAGE_CHANGED).subscribe(t.mapPageEventData.bind(t)),e.Topic(r.topicNames.CART_ADD_SUCCESS).subscribe(t.mapCartAddEventData.bind(t)),e.Topic(r.topicNames.CART_REMOVE_SUCCESS).subscribe(function(){t.mapCartRemoveEventData(this)}),e.Topic(r.topicNames.CART_UPDATE_QUANTITY).subscribe(function(){t.mapCartUpdateQuantityEventData(this)}),e.Topic(r.topicNames.SEARCH_RESULTS_UPDATED).subscribe(function(e){t.mapSearchResultsEventData(this,e)}),e.Topic(r.topicNames.USER_AUTO_LOGIN_SUCCESSFUL).subscribe(t.mapRegistrationEventData.bind(t)),e.Topic(r.topicNames.USER_LOGIN_SUCCESSFUL).subscribe(t.mapLoginSuccessEventData.bind(t)),e.Topic(r.topicNames.USER_LOGIN_SUBMIT).subscribe(t.mapLoginSubmitEventData.bind(t)),e.Topic(r.topicNames.USER_LOGOUT_SUBMIT).subscribe(t.mapLogoutSubmitEventData.bind(t)),e.Topic(r.topicNames.USER_PROFILE_UPDATE_SUCCESSFUL).subscribe(t.mapProfileUpdateSuccessEventData.bind(t)),e.Topic(r.topicNames.USER_PROFILE_UPDATE_SUBMIT).subscribe(t.mapProfileUpdateSubmitEventData.bind(t)),e.Topic(r.topicNames.PRODUCT_VIEWED).subscribe(t.mapProductViewedEventData.bind(t)),e.Topic(r.topicNames.CHECKOUT_REGISTER_USER).subscribe(t.mapCheckoutRegisterEventData.bind(t)),e.Topic(r.topicNames.CHECKOUT_SAVE_SHIPPING_ADDRESS).subscribe(t.mapSaveShippingAddressEventData.bind(t)),e.Topic(r.topicNames.CHECKOUT_SHIPPING_METHOD).subscribe(function(){t.mapShippingMethodSelectedEventData(this)}),e.Topic(r.topicNames.PAYMENT_AUTH_SUCCESS).subscribe(t.mapPaymentCompleteEventData.bind(t)),e.Topic(r.topicNames.PAYMENT_AUTH_DECLINED).subscribe(t.mapPaymentDeclinedEventData.bind(t)),e.Topic(r.topicNames.COUPON_APPLY_SUCCESSFUL).subscribe(t.mapCouponAddEventData.bind(t)),e.Topic(r.topicNames.PRODUCT_ADDED_TO_PURCHASE_LIST_SUCCESS).subscribe(t.mapPurchaseListAddEventData.bind(t)),e.Topic(r.topicNames.ADD_TO_QUICK_ORDER).subscribe(t.mapQuickOrderAddEventData.bind(t)),e.Topic(r.topicNames.ORDER_SUBMISSION_SUCCESS).subscribe(t.mapOrderSubmissionSuccessEventData.bind(t)),e.Topic(r.topicNames.ORDER_SUBMISSION_FAIL).subscribe(t.mapOrderSubmissionFailEventData.bind(t)),e.Topic(r.topicNames.ORDER_COMPLETED).subscribe(t.mapOrderCompleteEventData.bind(t))},n.prototype.mapCartAddEventData=function(e,t){var r={};r[d]=encodeURI(window.location).split("?")[0];var i=this;try{i.user().loggedIn()&&(r[p]=i.user().id()),r[T]="a",r[f]="Cart",r[I]="Add to Cart",r[S]=e.orderQuantity,i.populateProductData(e,r),t&&i.addCampaignsData(t,r),i.sendDataToInfinity(r)}catch(e){o.warn(a.t("ns.common:resources.publishableDataMissingText"),e)}},n.prototype.mapCartRemoveEventData=function(e){var t={};t[d]=encodeURI(window.location).split("?")[0];var r=this;try{r.user().loggedIn()&&(t[p]=r.user().id());var i=e[0].cartItem.productData();t[S]=e[0].cartItem.quantity(),r.populateProductData(i,t),t[T]="r",t[f]="Cart",t[I]="Remove from Cart",r.sendDataToInfinity(t)}catch(e){o.warn(a.t("ns.common:resources.publishableDataMissingText"),e)}},n.prototype.mapCartUpdateQuantityEventData=function(e){var t={};t[d]=encodeURI(window.location).split("?")[0];var r=this;try{r.user().loggedIn()&&(t[p]=r.user().id()),t[T]="a",t[f]="Cart",t[I]="Update Cart";var i=this.cart().getCartItem(e.id,e.childSKUs[0].repositoryId,e.commerceItemId);if(!i)return;t[S]=i.updatableQuantity(),r.populateProductData(e,t),r.sendDataToInfinity(t)}catch(e){o.warn(a.t("ns.common:resources.publishableDataMissingText"),e)}},n.prototype.mapRegistrationEventData=function(){var e={};e[d]=encodeURI(window.location).split("?")[0];var t=this;t.user().loggedIn()&&(e[p]=t.user().id()),e[f]="User Profile",e[I]="Registered","false"===i.getInstance().getItem("GDPRCookieP13nConsentGranted")?(e[h]=2,e[g]=0):(e[h]=1,e[g]=0),t.sendDataToInfinity(e)},n.prototype.mapLoginSuccessEventData=function(){var e={};e[d]=encodeURI(window.location).split("?")[0];var t=this;t.user().loggedIn()&&(e[p]=t.user().id()),e[f]="User Profile",e[I]="Logged In","false"===i.getInstance().getItem("GDPRCookieP13nConsentGranted")?e[g]=0:e[g]=1,t.sendDataToInfinity(e)},n.prototype.mapLoginSubmitEventData=function(){var e={};e[d]=encodeURI(window.location).split("?")[0];var t=this;t.user().loggedIn()&&(e[p]=t.user().id()),e[f]="User Profile",e[I]="Log In Submit",t.sendDataToInfinity(e)},n.prototype.mapLogoutSubmitEventData=function(){var e={};e[d]=encodeURI(window.location).split("?")[0];var t=this;t.user().loggedIn()&&(e[p]=t.user().id()),e[f]="User Profile",e[I]="User Logged Out",t.sendDataToInfinity(e)},n.prototype.mapProfileUpdateSubmitEventData=function(){var e={};e[d]=encodeURI(window.location).split("?")[0];var t=this;t.user().loggedIn()&&(e[p]=t.user().id()),e[f]="User Profile",e[I]="Update Submit",t.sendDataToInfinity(e)},n.prototype.mapProfileUpdateSuccessEventData=function(){var e={};e[d]=encodeURI(window.location).split("?")[0];var t=this;t.user().loggedIn()&&(e[p]=t.user().id()),e[f]="User Profile",e[I]="Update Successful",t.sendDataToInfinity(e)},n.prototype.mapCheckoutRegisterEventData=function(){var e={};e[d]=encodeURI(window.location).split("?")[0];var t=this;t.user().loggedIn()&&(e[p]=t.user().id()),e[f]="User Profile",e[I]="Checkout Register","false"===i.getInstance().getItem("GDPRCookieP13nConsentGranted")?e[g]=0:e[g]=1,t.sendDataToInfinity(e)},n.prototype.mapProductViewedEventData=function(e){var r={};r[d]=encodeURI(window.location).split("?")[0];var i=this;try{i.user().loggedIn()&&(r[p]=i.user().id()),r[T]="v",r[f]="Product",r[I]="Product Viewed";var n=t.mapping.toJS(e);i.populateProductData(n,r);for(var s="",l=0;l<n.childSKUs.length;l++)s=0===l?n.childSKUs[l].repositoryId:s+";"+n.childSKUs[l].repositoryId;r[E]=s,i.sendDataToInfinity(r)}catch(e){o.warn(a.t("ns.common:resources.publishableDataMissingText"),e)}},n.prototype.mapSearchResultsEventData=function(e,t){var r={};r[d]=encodeURI(window.location).split("?")[0];var i=this;try{if(i.user().loggedIn()&&(r[p]=i.user().id()),r[f]="Search",r[D]=t.requestor.searchText,r[L]=e.totalRecordsFound,e.searchEventSummary.facetFilters&&e.searchEventSummary.facetFilters.length>0){var n=e.searchEventSummary.facetFilters[e.searchEventSummary.facetFilters.length-1];r[w]=n.dimensionName+" - "+n.spec}i.sendDataToInfinity(r)}catch(e){o.warn(a.t("ns.common:resources.publishableDataMissingText"),e)}},n.prototype.mapCouponAddEventData=function(){var e={};e[d]=encodeURI(window.location).split("?")[0];var t=this;t.user().loggedIn()&&(e[p]=t.user().id()),e[M]=t.cart().coupons()[t.cart().coupons().length-1].code(),e[f]="Coupon",t.sendDataToInfinity(e)},n.prototype.mapSaveShippingAddressEventData=function(e){var t={};t[d]=encodeURI(window.location).split("?")[0];var r=this;try{r.user().loggedIn()&&(t[p]=r.user().id()),t[f]="Address";for(var i="",n="",s="",l="",c=0;c<e.shippingGroups.length;c++)0===c?(i=e.shippingGroups[c].shippingAddress.city,n=e.shippingGroups[c].shippingAddress.country,s=e.shippingGroups[c].shippingAddress.state,l=e.shippingGroups[c].shippingAddress.postalCode):(i=i+";"+e.shippingGroups[c].shippingAddress.city,n=n+";"+e.shippingGroups[c].shippingAddress.country,s=s+";"+e.shippingGroups[c].shippingAddress.state,l=l+";"+e.shippingGroups[c].shippingAddress.postalCode);t[x]=i,t[U]=n,t[G]=l,t[k]=s,r.sendDataToInfinity(t)}catch(e){o.warn(a.t("ns.common:resources.publishableDataMissingText"),e)}},n.prototype.mapPaymentCompleteEventData=function(e){var t={};t[d]=encodeURI(window.location).split("?")[0];var r=this;try{r.user().loggedIn()&&(t[p]=r.user().id()),t[I]="Payment Success",t[f]="Payment",t[P]=e[0].id,r.sendDataToInfinity(t)}catch(e){o.warn(a.t("ns.common:resources.publishableDataMissingText"),e)}},n.prototype.mapPaymentDeclinedEventData=function(e){var t={};t[d]=encodeURI(window.location).split("?")[0];var r=this;try{r.user().loggedIn()&&(t[p]=r.user().id()),t[I]="Payment Fail",t[f]="Payment",t[P]=e[0].id,r.sendDataToInfinity(t)}catch(e){o.warn(a.t("ns.common:resources.publishableDataMissingText"),e)}},n.prototype.mapOrderCompleteEventData=function(){var e={};e[d]=encodeURI(window.location).split("?")[0];var t=this;t.user().loggedIn()&&(e[p]=t.user().id()),e[I]="Order Completed",e[f]="Order",t.sendDataToInfinity(e)},n.prototype.mapOrderSubmissionFailEventData=function(e){var t={};t[d]=encodeURI(window.location).split("?")[0];var r=this;r.user().loggedIn()&&(t[p]=r.user().id()),t[I]="Order Submission Fail",t[f]="Order",r.sendDataToInfinity(t)},n.prototype.mapOrderSubmissionSuccessEventData=function(e){var t={};t[d]=encodeURI(window.location).split("?")[0];var r=this;try{r.user().loggedIn()&&(t[p]=r.user().id()),t[I]="Order Submission Success",t[f]="Order";var i=new Date,n=("0"+i.getDate()).slice(-2),s=("0"+(i.getMonth()+1)).slice(-2),l=s+"/"+n+"/"+i.getFullYear();t[O]=l;var c=("0"+i.getHours()).slice(-2),u=("0"+i.getMinutes()).slice(-2),h=("0"+i.getSeconds()).slice(-2),g=c+":"+u+":"+h;if(t[R]=g,t[T]="p",t[P]=e[0].id,t[A]=e[0].uuid,t[N]="purchase",e[0].items){for(var m="",y="",v="",b=0;b<e[0].items.length;b++)0===b?(m=e[0].items[b].catRefId,y=e[0].items[b].quantity,v=e[0].items[b].rawTotalPrice):(m=m+";"+e[0].items[b].catRefId,y=y+";"+e[0].items[b].quantity,v=v+";"+e[0].items[b].rawTotalPrice);t[E]=m,t[S]=y,t[C]=v}t[_]=r.site().selectedPriceListGroup().currency.currencyCode,e[0].campaigns&&r.addCampaignsData(e[0].campaigns,t),r.sendDataToInfinity(t)}catch(e){o.warn(a.t("ns.common:resources.publishableDataMissingText"),e)}},n.prototype.mapShippingMethodSelectedEventData=function(e){var t={};t[d]=encodeURI(window.location).split("?")[0];var r=this;r.user().loggedIn()&&(t[p]=r.user().id()),e&&(t[I]="Shipping Method Selected",t[f]="Shipping Method",r.sendDataToInfinity(t))},n.prototype.mapPurchaseListAddEventData=function(e){var t={};t[d]=encodeURI(window.location).split("?")[0];var r=this;try{r.user().loggedIn()&&(t[p]=r.user().id()),t[T]="w",t[f]="Purchase List",t[I]="Add to Purchase List";for(var i=e.items,n="",s="",l="",c="",u="",h=0;h<i.length;h++)if(0===h){n=i[h].catRefId,s="function"==typeof i[h].quantityDesired?i[h].quantityDesired():i[h].quantityDesired;var g="";i[h].childSKUs&&i[h].childSKUs[0].salePrice?g=i[h].childSKUs[0].salePrice:i[h].childSKUs&&i[h].childSKUs[0].listPrice?g=i[h].childSKUs[0].listPrice:i[h].salePrice?g=i[h].salePrice:i[h].listPrice&&(g=i[h].listPrice),l=g,c=i[h].type?i[h].type:"Basic",i[h].brand&&null!==i[h].brand&&"null"!==i[h].brand&&(u=i[h].brand)}else{n=n+";"+i[h].catRefId,s="function"==typeof i[h].quantityDesired?i[h].quantityDesired():i[h].quantityDesired;var g="";i[h].childSKUs&&i[h].childSKUs[0].salePrice?g=i[h].childSKUs[0].salePrice:i[h].childSKUs&&i[h].childSKUs[0].listPrice?g=i[h].childSKUs[0].listPrice:i[h].childSKUs&&i[h].salePrice?g=i[h].salePrice:i[h].listPrice&&(g=i[h].listPrice),l=l+";"+g,i[h].type?c=c+";"+i[h].type:c+=";Basic",i[h].brand&&null!==i[h].brand&&"null"!==i[h].brand&&(u=u+";"+i[h].brand)}t[E]=n,t[S]=s,t[C]=l,t[v]=c,t[b]=u,t[_]=r.site().selectedPriceListGroup().currency.currencyCode,r.sendDataToInfinity(t)}catch(e){o.warn(a.t("ns.common:resources.publishableDataMissingText"),e)}},n.prototype.mapQuickOrderAddEventData=function(e){var t={};t[d]=encodeURI(window.location).split("?")[0];var r=this;try{r.user().loggedIn()&&(t[p]=r.user().id()),t[T]="q",t[f]="Quick Order",t[I]="Add to Quick Order",t[S]=e.orderQuantity,r.populateProductData(e,t),r.sendDataToInfinity(t)}catch(e){o.warn(a.t("ns.common:resources.publishableDataMissingText"),e)}},n.prototype.mapPageEventData=function(e){var t={},r=this;t[d]=encodeURI(window.location).split("?")[0];try{if(t[f]=e.pageId,r.user().loggedIn()&&(t[p]=r.user().id()),"home"===e.pageId&&(t[f]="Home Page"),"category"===e.pageId){t[f]=e.path.split("/")[0];var i=e.path.split("/").length;i>3&&(t[m]=e.path.split("/")[i-1])}if("searchresults"===e.pageId||"noSearchResults"===e.pageId)return;if("product"===e.pageId)return;if("article"===e.pageId&&(t[f]=e.pageId),"cart"===e.pageId&&(t[f]=e.pageId),"checkout"===e.pageId&&(t[f]=e.pageId,t[I]="Checkout Page"),"confirmation"===e.pageId){for(var n="",s=0,c=0;c<r.confirmation().payments.length;c++)0===c?(n=r.confirmation().payments[c].gatewayName,s=r.confirmation().payments[c].amount):(n=n+";"+r.confirmation().payments[c].gatewayName,s=s+";"+r.confirmation().payments[c].amount);t[F]=n,t[H]=s;for(var u="",h="",c=0;c<r.confirmation().shippingGroups.length;c++)0===c?(u=r.confirmation().shippingGroups[c].shippingMethod.value,h=r.confirmation().shippingGroups[c].shippingMethod.cost):(u=u+";"+r.confirmation().shippingGroups[c].shippingMethod.value,h=h+";"+r.confirmation().shippingGroups[c].shippingMethod.cost);t[V]=u,t[Y]=h,t[_]=r.site().selectedPriceListGroup().currency.currencyCode}r.sendDataToInfinity(t)}catch(e){o.warn(a.t("ns.common:resources.publishableDataMissingText"),e)}localStorage.setItem(l,window.location.href)},n.prototype.sendDataToInfinity=function(e){var t={};t.data=e;var r=this;r.infinityLoaded.done(function(){window.ORA&&window.ORA.view?window.ORA.view(t):o.warn("Infinity Tag has not loaded.")})},n}),define("viewModels/orderDetailsViewModel",["knockout","ccConstants","CCi18n","ccConstants","ccRestClient","notifier","ccStoreUtils"],function(e,t,r,i,a,o,n){"use strict";function s(t){var i=this;i.CCi18n=r,n.fromJS(t,i,!0),i.getReturnhistoryInvoked=e.observable(!1),i.returnRequesthistoryArray=e.observableArray([]),i.cancelRequesthistoryArray=e.observableArray([])}var l=i.INCOMPLETE_CANCEL,c=i.CANCEL_ORDER,d=i.CANCEL_REQUESTS;return s.prototype.getReturnhistory=function(e,r,i){var o=this,n={};a.request(t.ENDPOINT_LIST_RETURN_REQUESTS,n,function(e){o.getReturnhistorySuccess(e,r)}.bind(o),function(e){o.getReturnhistoryFailure(e,i)}.bind(o),e,"returnRequests")},s.prototype.getReturnhistorySuccess=function(e,t){"function"==typeof t&&t(e)},s.prototype.getReturnhistoryFailure=function(e,t){"function"==typeof t&&t(e)},s.prototype.getCancelhistory=function(e,r,i){var o=this,n={},s="";s+='state ne "'+l+'"',s+=' AND orderAction eq "'+c+'"',s+=' AND createdByOrderId eq "'+e+'"',n.q=s,a.request(t.ENDPOINT_GET_ALL_ORDERS_FOR_PROFILE,n,function(e){o.getCancelhistorySuccess(e,r)}.bind(o),function(e){o.getCancelhistoryFailure(e,i)}.bind(o),e,d)},s.prototype.getCancelhistorySuccess=function(e,t){"function"==typeof t&&t(e)},s.prototype.getCancelhistoryFailure=function(e,t){"function"==typeof t&&t(e)},s.prototype.populateCancelHistory=function(e){var t=this;t.cancelRequesthistoryArray(e.items)},s.prototype.populateReturnHistory=function(e){var t=this;t.returnRequesthistoryArray(e.items);var r,i,a,o,n=t.order.items;for(i=0;i<t.returnRequesthistoryArray().length;i++)for(r=t.returnRequesthistoryArray()[i].returnItems,a=0;a<r.length;a++)for(o=0;o<n.length;o++)if(n[o].productId==r[a].productId&&n[o].catRefId==r[a].catRefId){r[a].itemInfo=n[o];break}},s}),define("pageLayout/css-loader",["module","jquery","ccConstants","ccRestClient","storageApi","xDomainProxy"],function(e,t,r,i,a,o){function n(e){var t=0;if(0==e.length)return t;for(var r=0;r<e.length;r++){var i=e.charCodeAt(r);t=(t<<5)-t+i,t&=t}return t}function s(){this.loadingOptimizedCSS=e.config().optimizingCSS}var l="agentUI"==i.profileType?"/ccagentui/v1/pages/css/":"/ccstoreui/v1/pages/css/",c="style",d="text/css";return s.prototype.loadCssForLayout=function(e,a){var s=l+e,u=t.Deferred(),p=t.extend({},a),h={};return i.tokenSecret&&!i.tokenCookieEnabled&&(h[r.AUTHORIZATION_HEADER]=r.BEARER+" "+i.tokenSecret),h=i.updateHeaderWithAgentContext(h),h["X-CCAgentContext"]instanceof Object&&(h["X-CCAgentContext"]=JSON.stringify(h["X-CCAgentContext"])),h=i.updateHeaderWithViewport(h),h=i.updateHeaderWithSelectedOrganization(h),h=i.updateHeaderWithPriceListGroupId(h),h=i.updateHeaderWithShopperContext(h),h=i.updateHeaderWithVisitData(h),i.profileType==r.PROFILE_TYPE_AGENT&&(h[o.PROFILE_TYPE_HEADER_NAME]="fileAgent"),window.siteId&&(p[r.URL_SITE_PARAM]=window.siteId),this.loadingOptimizedCSS?t.ajax({url:s,data:p,headers:h}).then(function(e,t,r){if(200===r.status){var i=n(e);if(!document.getElementById(i)){var a=document.createElement(c);a.type=d,a.id=i,a.appendChild(document.createTextNode(e)),document.head.appendChild(a)}}u.resolve()}).fail(function(){u.resolve()}):u.resolve(),u},new s}),define("ociApm",["ccConstants","pubsub"],function(e,t){"use strict";function r(){this.initialized=!1,this.initialize=function(r){if(!this.initialized){const i=r().extensionSiteSettings||{},a=i.ociApm||{};a.enabled&&$.Topic(t.topicNames.PAGE_LAYOUT_UPDATED).subscribe(function(){if(window.apmrum){const t=window.localStorage.getItem(e.VISITOR_ID)||"unknown";window.apmrum.username=t,window.apmrum.webApplication=r().siteInfo.id+" - "+r().siteInfo.name}}),this.initialized=!0}}}return new r}),define("pageLayout/layout-container",["knockout","pageLayout/data","pageLayout/layout","pageLayout/region","pageLayout/widget","pageLayout/cart","pageLayout/order","pageLayout/layout-mapping","pageLayout/simple-cache","pageLayout/context-handler","pageLayout/view-model-builder","pageLayout/search","pageLayout/shippingmethods","pageLayout/payment-auth-response","pageLayout/user","pageLayout/product","pageLayout/space","pageViewTracker","viewModels/paymentDetails","pageLayout/infinity","pubsub","CCi18n","ccConstants","ccLogger","jquery","notifier","pageLayout/site","sfExceptionHandler","ccStoreServerLogger","viewportHelper","navigation","storageApi","ccRestClient","ccStoreConfiguration","spinner","viewModels/orderDetailsViewModel","pageLayout/css-loader","ccResourceLoader","ociApm"],function(e,t,r,i,a,o,n,s,l,c,d,u,p,h,g,f,m,I,E,y,v,b,T,P,S,C,_,A,O,R,N,D,L,w,M,U,k,x,G){"use strict";function F(t,r){var i=this;this.isPreview,this.layoutMapping=new s(this),this.masterViewModel=e.observable(),this.basePath=r,this.adapter=t,this.cache=new l,this.widgetCache=new l,this.contextHandler=new c,this.viewModelBuilder=d,this.contextDataSet=S.Deferred(),this.contextDataSetSubscriber=this.contextDataSet.promise(),this.networkErrorMessage,this.networkErrorReloadText,i.storeServerLog=O.getInstance(),this.storeConfiguration=w.getInstance(),this.queue=new H,this.widgets={},this.displayQueue={},this.pageResponse,this.widgetCount=0,this.appLoadedDeferred=S.Deferred(),this.deferLoadLargeCartInPromptRefresh=!1,this.currentPage=null,this.pendingWidgets=e.observableArray().extend({deferred:!0}),S.Topic(v.topicNames.PAGE_VIEW_CHANGED).subscribe(i.pageViewChanged.bind(i)),S.Topic(v.topicNames.PAGE_CONTEXT_CHANGED).subscribe(i.pageContextChanged.bind(i)),S.Topic(v.topicNames.PAGE_PARAMETERS_CHANGED).subscribe(i.pageParametersChanged.bind(i)),S.Topic(v.topicNames.PAGE_READY).subscribe(i.pageReady.bind(i)),S.Topic(v.topicNames.RECORD_PAGINATION_PAGE_CHANGE).subscribe(i.pageReady.bind(i)),S.Topic(v.topicNames.PAGE_PAGINATION_CHANGE).subscribe(i.paginationChange.bind(i)),S.Topic(v.topicNames.USER_NETWORK_ERROR).subscribe(i.networkError.bind(i));var a=!0;return a&&(this.exceptionHandler=new A,this.exceptionHandler.subscribe&&this.exceptionHandler.subscribe()),S.when(i.appLoadedDeferred).then(function(e){x.callAppLevelJsMethod(q,[i.currentPage,i.pageResponse]),i.callMethodInAllWidgets(q)}),this}function H(){function e(){var e=S.Deferred();return S.when(t).always(function(){e.resolve()}),e.promise()}var t=null;return{display:function(r,i){function a(){0===i.widgetCount&&(i.callMethodInAllWidgets($),i.UserViewModel.getInstance().pageAppeared.resolve(),i.appLoadedDeferred.resolve())}var o=S.Deferred(),n=e();n.done(function(){i.displayQueue[r]&&(i.widgets[r].initialized()?(i.widgets[r].occPrioritizedDisplay(!0),i.widgetCount--,a(),o.resolve()):i.displayQueue[r].done(function(e){e.occPrioritizedDisplay(!0),
- i.widgetCount--,a(),o.resolve()}))}),t=o.promise()},resetHead:function(){t=null}}}function V(e){if(L.profileType===T.PROFILE_TYPE_AGENT){if(e.status==T.HTTP_NOT_FOUND)N.goTo("/agentError",!0,!0);else if(e.status==T.BAD_REQUEST){var t=window.location.origin+window.applicationContextPath+"/agentError";window.location.assign(t)}}else e.status==T.HTTP_NOT_FOUND&&N.goTo("/404",!0,!0)}function Y(t,r){if(!t||!r)return!0;if(t.stackType&&t.stackType()==T.STACK_TYPE_POPUP&&r.stackType==T.STACK_TYPE_POPUP&&t.regions().length&&t.regions()[0].widgets().length&&t.regions()[0].widgets()[0].WIDGET_ID==T.WIDGET_ID_PRODUCT_LISTING&&t.regions()[0].widgets()[0].listType()!=r.regions[0].widgets[0].listType)return!0;if(t.similarRegions&&Object.keys(t.similarRegions).length>0&&t.similarRegions.hasOwnProperty(r.id))return!1;if(r.similarRegions&&Object.keys(r.similarRegions).length>0&&r.similarRegions.hasOwnProperty(t.id))return!1;var i=e.isObservable(t.widgets)?t.widgets():t.widgets,a=i?i.length:0;if(i&&a>0){if(r.widgets&&r.widgets.length>0){if(a!==r.widgets.length)return!0;var o=e.isObservable(t.width)?t.width():t.width;if(o!==r.width)return!0;for(var n=0;n<a;n++){var s=e.isObservable(i[n].id)?i[n].id():i[n].id;if(s!==r.widgets[n].id)return!0}return!(!t.metadata()||!r.metadata||t.id()==r.id)}return!0}return r.widgets,!0}function B(e,t){for(var r=-1,i=0;i<t.length;i++)if(!Y(e,t[i])){r=i;break}return r}var q="afterApplicationLoad",j="afterLoad",W="beforeDisappear",$="afterPageAppear";return String.prototype.endsWith||(String.prototype.endsWith=function(e,t){return(void 0===t||t>this.length)&&(t=this.length),this.substring(t-e.length,t)===e}),window.previewNavigation=function(t,r,i,a,o,n,s,l,c){var d="/"+t+"?occsite="+r+"&ccvp="+i+"&audience="+o+"&disableMinify="+!n+"&date="+s;L.setStoredValue(T.LOCAL_STORAGE_SITE_ID,r),L.setStoredValue("disableMinify",!n),L.setStoredValue("audience",o),R.setViewport(a),L.setStoredValue("viewport",i),L.setStoredValue("date",s),L.setStoredValue(T.LOCAL_STORAGE_ORGANIZATION_ID,e.toJSON(l)),console.log("Preview moving to: "+d),window.location.href=d},F.prototype.getViewModelBuilder=function(e){var t=this.viewModelBuilder[e];return null==t&&(t={scope:"page",cacheable:!1,load:!0,create:!0}),t},F.prototype.setContextData=function(e){var t,r,i=0,a=this,o=function(){for(t=["global","page"],i=0;i<t.length;i++)for(r in e[t[i]])e[t[i]].hasOwnProperty(r)&&"__ko_mapping__"!==r&&a.loadCurrentFromJSON(r,e[t[i]][r],e);void 0!==a.contextHandler.get("site","global")().extensionSiteSettings.InfinityTag&&1==a.contextHandler.get("site","global")().extensionSiteSettings.InfinityTag.enabled&&y.initialize(a.contextHandler.get("user","global"),a.contextHandler.get("cart","global"),a.contextHandler.get("confirmation","page"),a.contextHandler.get("site","global")),void 0!==a.contextHandler.get("site","global")().extensionSiteSettings.ociApm&&1==a.contextHandler.get("site","global")().extensionSiteSettings.ociApm.enabled&&G.initialize(a.contextHandler.get("site","global")),a.contextDataSet.resolve(),a.contextDataSet=S.Deferred(),a.contextDataSetSubscriber=a.contextDataSet.promise()},n=e.global.locale;n&&null!==n?b.setLocaleOnce(n,o):o()},F.prototype.pageContextChanged=function(e){var t=this;t.currentPage=e;var r=e.pageId,i={};i[T.PAGE_PARAM]=e.contextId,i[T.DATA_ONLY]=!0,this.load("layout",r,i,function(r){t.setContextData(r.data),t.updatePageEventData(r.data,e),r.data&&r.data.global&&r.data.global.site&&r.data.global.site.tenantId&&I.tenantId(r.data.global.site.tenantId),S.Topic(v.topicNames.PAGE_METADATA_CHANGED).publish(r),S.Topic(v.topicNames.PAGE_READY).publish(e)},t.handleServerError)},F.prototype.updatePageEventData=function(e,t){e.page&&e.page.repositoryId&&(t.pageRepositoryId=e.page.repositoryId)},F.prototype.handleServerError=function(e){this.networkError()},F.prototype.pageParametersChanged=function(e){var t=this.getParameterData(e.parameters);S.Topic(v.topicNames.PAGE_PARAMETERS).publishWith({pageId:e.pageId,seoslug:e.seoslug,parameters:t},[{message:"success"}])},F.prototype.pageViewChanged=function(e){var t=this;t.shouldPageBeRefreshed(e.path),t.currentPage=e;var r="home/";"agentUI"===L.profileType&&(r="agentHome/");var i=null;e.pageId&&(r=e.pageId),e.contextId&&(r=e.pageId,i={},i[T.PAGE_PARAM]=e.contextId,i[T.DATA_ONLY]=!1),e.path&&!/.ftl$/.test(e.path)&&(r=e.path),r=N.getPathWithoutApplicationContext(r);var a=window.siteBaseURLPath;a&&"/"!==a&&(r=N.getPathWithoutSiteBasePath(r),""===r&&(r="home","agentUI"===L.profileType&&(r="agentHome/")));var o=window.location.href.split("?"),n=null,s=void 0;if(o.length>1&&(s=o[1],n=o[1].split("&")),n){null==i&&(i={});for(var l in n){var c=n[l].split("=");!e.path||"404"!==e.path||e.parameters&&""!==e.parameters?"occsite"!==c[0]&&(i[c[0]]=c[1]):"usePageId"!==c[0]&&"usePreviewData"!==c[0]&&(i[c[0]]=c[1])}}null==i&&(i={}),i.dataOnly||(i.dataOnly=!1),this.load("layout",r,i,function(r){t.isPreview=r.isPreview(),t.pageResponse=r,r.data.page.pageId&&(e.pageId=r.data.page.pageId),r.data.page.contextId&&(e.contextId=r.data.page.contextId),t.storeConfiguration.enablePrioritizedLoading&&(t.formWidgetQueue(r),t.displayWidgets());var i;t.setContextData(r.data),t.updatePageEventData(r.data,e),r.data&&r.data.global&&r.data.global.site&&r.data.global.site.tenantId&&I.tenantId(r.data.global.site.tenantId),e.parameters&&S.Topic(v.topicNames.PAGE_PARAMETERS).publishWith({pageId:e.pageId,seoslug:e.seoslug,parameters:t.getParameterData(e.parameters)},[{message:"success"}]),S.Topic(v.topicNames.PAGE_CHANGED).publish(e),S.Topic(v.topicNames.PAGE_LAYOUT_LOADED).publish(r,e);var a={pageId:e.pageId};t.storeServerLog.logInfo("getPage",t.storeServerLog.getMessage("getPage",a)),0===t.pendingWidgets().length?S.Topic(v.topicNames.PAGE_READY).publish(e):i=t.pendingWidgets.subscribe(function(t){0===t.length&&(S.Topic(v.topicNames.PAGE_READY).publish(e),i.dispose())})},t.handleServerError.bind(t))},F.prototype.create=function(e,t,r,i,a,o,n){var s,l,c,d=this;if(S.isFunction(i)?(S.isFunction(a)?(n=o,o=a):n=a,a=i,i=null):S.isFunction(o)||(n=o,o=null),s=this.getViewModelBuilder(e),s&&s.create){if(s.cachable){var u=d.idAndParamsToCacheKey(t,i);d.cache.set(e,u,r)}if(l=s.create,!l)throw"Loading of resource type: "+e+" forbidden";c=l===!0?r:l(r,i,n),this.adapter.persistCreate(e,t,c,i,function(e){a&&a(e,n)},function(e){o&&o(e,n)})}},F.prototype.update=function(e,t,r,i,a,o,n){var s,l,c;if(S.isFunction(i)?(S.isFunction(a)?(n=o,o=a):n=a,a=i,i=null):S.isFunction(o)||(n=o,o=null),s=this.getViewModelBuilder(e),s&&s.update){if(l=s.update,!l)throw"Updating of resource type: "+e+" forbidden";c=l===!0?r:l(r,i,n),this.adapter.persistUpdate(e,t,c,i,function(e){a&&a(e,n)},function(e){o&&o(e,n)})}},F.prototype.remove=function(e,t,r,i,a,o){var n,s,l=this;if(S.isFunction(r)?(S.isFunction(i)?(o=a,a=i):o=i,i=r,r=null):S.isFunction(a)||(o=a,a=null),n=this.getViewModelBuilder(e),n&&n.remove){if(n.cachable){var c=l.idAndParamsToCacheKey(t,r);this.cache.set(e,c,null)}if(s=n.remove,!s)throw"Deleting of resource type: "+e+" forbidden";this.adapter.persistDelete(e,t,r,function(e){i&&i(e,o)},function(e){a&&a(e,o)})}},F.prototype.loadRequestForLayout=function(e,t,r,i,a,o,n){var s=S.Deferred(),l=this;return L.request(e,t,function(e){l.shouldPageBeRefreshed(r),1==l.deferLoadLargeCartInPromptRefresh?s.reject(e):s.resolve(e)},function(e){s.reject(e),V(e)},r,i,a,o,n),s},e.observableArray.fn.setAt=function(e,t){this.valueWillMutate(),this()[e]=t,this.valueHasMutated()},F.prototype.loadDataForLayout=function(e,t,r,i,a,o){var n=this,s=e,l=a.load,c=S.extend({},e);c.hasOwnProperty(T.DATA_ONLY)&&delete c[T.DATA_ONLY];var d=R.viewportDesignation();if(n.storeConfiguration.enableLayoutsRenderedForLayout===!0){var u=n.storeConfiguration.getLayoutIdsRendered();u.length>0&&(c[T.LAYOUTS_RENDERED]=u.toString())}d&&(c.ccvp=d);var p=S.extend({},e,{cacheableDataOnly:!0});this.storageApi.getItem(T.LOCAL_STORAGE_CURRENT_CONTEXT)&&(p.cacheableDataOnly=!1);var h=!1;void 0!==n.contextHandler.get(T.PRODUCT_TYPES,"page")()||n.storeConfiguration.skipLoadingProductTypes||(h=!0),p.productTypesRequired=h;var g={};g[T.ENDPOINT_KEY]=T.ENDPOINT_PAGES_GET_PAGE,g[T.PAGE_KEY]=t,g[T.IDENTIFIER_KEY]="layoutOnly";var f=n.storeConfiguration.getFilterToUse(g);f&&(c[T.FILTER_KEY]=f),L.previewMode&&(c[T.DISABLE_MINIFY]=L.getStoredValue(T.DISABLE_MINIFY)),g[T.IDENTIFIER_KEY]="cachableData";var m=n.storeConfiguration.getFilterToUse(g);m&&(p[T.FILTER_KEY]=m);var I={currentDataOnly:!0};g[T.IDENTIFIER_KEY]="currentData";var E=n.storeConfiguration.getFilterToUse(g);E&&(I[T.FILTER_KEY]=E),n.storeConfiguration.enableSpinnerOnPageLoad&&n.pageLoading();var y=S.extend({},e,{currentDataOnly:!0});y.productTypesRequired=h;var b=S.extend({},e);b.hasOwnProperty(T.DATA_ONLY)&&delete b[T.DATA_ONLY],S.when(this.loadRequestForLayout(T.ENDPOINT_GET_LAYOUT,c,t),this.loadRequestForLayout(T.ENDPOINT_PAGES_GET_PAGE,p,t),this.loadRequestForLayout(T.ENDPOINT_PAGES_GET_PAGE,y,t),k.loadCssForLayout(t,b)).done(function(e,c,d){if(r){d.data.global.user.parentOrganization&&(c.data.global.site.priceListGroup.defaultPriceListGroup=d.data.global.user.priceListGroup,c.data.global.site.priceListGroup.activePriceListGroups=[d.data.global.user.priceListGroup],c.data.global.site.currency=d.data.global.user.priceListGroup.currency);var u,p=S.extend(!0,e,c,d);if(s.pageId=t,!p.data.page||"product"!==p.data.page.pageId&&"category"!==p.data.page.pageId||0!=p.data.page.hasOwnProperty(T.PRODUCT_TYPES)||void 0==n.contextHandler.get(T.PRODUCT_TYPES,"page")()||(p.data.page[T.PRODUCT_TYPES]=n.contextHandler.get(T.PRODUCT_TYPES,"page")()),n.storeConfiguration.storeLayoutIdsRendered(e),d&&d.data&&d.data.global&&(n.storeConfiguration.multiFactorAuthenticationEnabled=d.data.global.multiFactorAuthenticationEnabled),l===!0)u=p;else{u=l(p,n,s);var h=n.masterViewModel().regions(),g=p.regions,f=0;h.length=g.length;var m=new Array(h.length);for(n.masterViewModel().regions.valueWillMutate(),f=0;f<h.length;f++){var I=Y(h[f],g[f]);if(I){var E=B(h[f],g);if(E!=-1&&(m[E]=h[f]),!m[f]){var y=n.getViewModelBuilder("region"),b=y.load(g[f],n,s);h[f]=b}}else h[f].similarRegions[g[f].id]={}}for(f=0;f<m.length;f++)void 0!==m[f]&&(n.masterViewModel().regions()[f]=m[f]);if(n.storeConfiguration.enablePrioritizedLoading)for(n.widgetCount=0,f=0;f<n.masterViewModel().regions().length;f++)n.iterateRegionsAndResetDisplay(n.masterViewModel().regions()[f]);n.masterViewModel().regions.valueHasMutated(),n.masterViewModel().buildRows()}if(n.masterViewModel().title(u.title()),n.masterViewModel().keywords(u.keywords()),n.masterViewModel().description(u.description()),n.masterViewModel().metaTags(u.metaTags()),n.masterViewModel().isPreview(u.isPreview()),n.masterViewModel().noindex(u.noindex()),R.layoutViewports(u.viewports?u.viewports():""),void 0===n.storeConfiguration.isFreshPageLoad?n.storeConfiguration.isFreshPageLoad=!0:n.storeConfiguration.isFreshPageLoad===!0&&(n.storeConfiguration.isFreshPageLoad=!1),S.Topic(v.topicNames.PAGE_LAYOUT_UPDATED).publish(p,s),S.Topic(v.topicNames.LOCALE_READY).subscribe(n.updatePageChangeMessage.bind(n,p)),""===n.masterViewModel().pageChangeMessage()&&n.masterViewModel().dataForPageChangeMessage(p.data),n.storeConfiguration.enableSpinnerOnPageLoad&&n.pageLoadingComplete(),a.cachable){var P=n.idAndParamsToCacheKey(t,s);n.cache.set(type,P,u)}r(u,o)}else u.status==T.HTTP_NOT_FOUND||u.status==T.BAD_REQUEST?V(u):i&&pResult&&i(pResult,o)})},F.prototype.iterateRegionsAndResetDisplay=function(e){var t=this;if(e.regions().length>0)for(var r=0;r<e.regions().length;r++)t.iterateRegionsAndResetDisplay(e.regions()[r]);else for(var r=0;r<e.widgets().length;r++){var i=e.widgets()[r].id();i in t.widgets&&delete t.widgets[i],e.widgets()[r].occPrioritizedDisplay(!1),t.widgetCount++}},F.prototype.updatePageChangeMessage=function(e){var t=this;e.data.page.category?t.masterViewModel().pageChangeMessage(b.t("ns.common:resources.categoryPageLoadedText",{collection:e.data.page.category.displayName})):e.data.page.product?t.masterViewModel().pageChangeMessage(b.t("ns.common:resources.productPageLoadedText",{product:e.data.page.product.displayName})):"userSpacesPage"===e.data.page.repositoryId?t.masterViewModel().pageChangeMessage(b.t("ns.common:resources.wishlistPageLoadedText")):"searchResultsPage"!=e.data.page.repositoryId&&t.masterViewModel().pageChangeMessage(b.t("ns.common:resources.pageLoadedText",{page:e.data.page.repositoryId})),S.Topic(v.topicNames.LOCALE_READY).unsubscribe(t.updatePageChangeMessage)},F.prototype.load=function(e,t,r,i,a,o){var n,s,l,c=this;if(S.isFunction(r)?(S.isFunction(i)?(o=a,a=i):o=i,i=r,r=null):S.isFunction(a)||(o=a,a=null),n=this.getViewModelBuilder(e),n&&n.load){if(n.cachable){var d=c.idAndParamsToCacheKey(t,r);if(l=this.cache.get(e,d),l.hit===!0)return void(i&&i(l.result,o))}if(s=n.load,!s)throw"Loading of resource type: "+e+" forbidden";var u=r?r:{};"layout"==e&&u.dataOnly===!1?this.loadDataForLayout(u,t,i,a,n,o):this.adapter.loadJSON(e,t,r,function(a){var l;if(l=s===!0?a:s(a,c,r),n.cachable){var d=c.idAndParamsToCacheKey(t,r);c.cache.set(e,d,l)}i&&i(l,o)},function(e){a&&a(e,o)})}},F.prototype.loadCurrentFromJSON=function(e,t,r,i){var a,o,n;if(o=this.getViewModelBuilder(e),!o)return null;if(a=o.scope?o.scope:"page",o.load){if(o.load===!0){if(this.contextHandler.set(e,t,a),i&&o.cachable){var s=self.idAndParamsToCacheKey(i,r);this.cache.set(e,s,n)}return t}if(n=o.load(t,this,r),this.contextHandler.set(e,n,a),i&&o.cachable){var s=self.idAndParamsToCacheKey(i,r);this.cache.set(e,s,n)}return n}return null},F.prototype.instantiateWidget=function(t){var r,i=new this.WidgetViewModel(this.basePath);for(r in t)t.hasOwnProperty(r)&&(e.isObservable(t[r])&&!e.isComputed(t[r])?t[r].remove?i[r]=e.observableArray(t[r]()):i[r]=e.observable(t[r]()):e.isComputed(t[r])||(i[r]=t[r]));return this.initializeWidget(i,!0),i},F.prototype.initializeWidget=function(e,t,r){var i=this;i.contextDataSetSubscriber.done(function(){i.runWidgetInitialization(e,t,r)})},F.prototype.runWidgetInitialization=function(t,r,i){var a,o,n,s,l=this;if(l.pendingWidgets.push(t),r&&t.imports)for(o=e.utils.unwrapObservable(t.imports),s=o.length-1;s>=0;s-=1)a=o[s],n=this.getViewModelBuilder(a),n&&(n=n.scope||"page"),t[a]=this.contextHandler.get(a,n);if(e.utils.unwrapObservable(t.javascript)){var c=t.jsPath()+"/",d=t.javascript();if(t.assetMappings){var u="/js/"+t.javascript()+".js",p=t.assetMappings[u];if(p){var h=p().lastIndexOf("/");c=p().substring(0,h),d=p()}}requirejs.s.contexts._.nextTick=function(e){e()};var g=requirejs.s.contexts._.config.map?requirejs.s.contexts._.config.map:{};g[d]={};var f=!1,m=S.Deferred();if(null!==t.javascriptExtension()){var I=t.assetMappings["/js/ext/"+t.javascriptExtension()],E=e.unwrap(I);E&&require([E],function(e){e&&e.beforeAppear&&"function"==typeof e.beforeAppear&&(f=!0),e&&e.onLoad&&"function"==typeof e.onLoad&&e.onLoad.call(t,t),t.__cc__extjs=e,m.resolve(e)})}for(var y in t.assetMappings)if(0===y.indexOf("/js/")&&y.indexOf(t.javascript()+".js")===-1){var b=t.javascript().endsWith(".min"),T=b?".min.js":".js",C=y.indexOf(T);C==-1&&(C=y.indexOf(".js"));var _=t.assetMappings[y](),A=y.substring(1,C);(!g[d][A]||b&&!g[d][A].endsWith(".min.js"))&&(g[d][A]=_)}require({baseUrl:c,map:g},[d],function(a){"function"==typeof a&&(a=a().bind(e));var o;for(o in a)a.hasOwnProperty(o)&&(e.isObservable(a[o])&&!e.isComputed(a[o])?a[o].remove?t[o]=e.observableArray(a[o]()):t[o]=e.observable(a[o]()):t[o]=a[o]);if(t.allPropertiesSet(t),a||P.warn("Failed to execute javascript for widget: "+t.javascript()),r&&a&&a.onLoad)var n=a.onLoad(t);l.storeConfiguration.enablePrioritizedLoading&&S.when(n).always(function(){l.callWidgetMethodIfApplicable(j,t)}),r&&a&&a.resourcesLoaded&&(t.resources()&&a.resourcesLoaded(t),t.resources.subscribe(function(e){e&&a.resourcesLoaded(t)})),t.initialized(!0),l.storeConfiguration.enablePrioritizedLoading&&void 0!=l.displayQueue[t.id()]&&l.displayQueue[t.id()].resolve(t),i&&i.call(this,t),l.pendingWidgets.remove(t),(t.hasBeforeAppear()||f)&&S.Topic(v.topicNames.PAGE_READY).subscribe(t.maybeFireBeforeAppearExtJSDeferred(m).bind(t))}),requirejs.s.contexts._.nextTick=requirejs.nextTick}else l.pendingWidgets.remove(t),t.initialized(!0),l.storeConfiguration.enablePrioritizedLoading&&void 0!=l.displayQueue[t.id()]&&l.displayQueue[t.id()].resolve(t)},F.prototype.idAndParamsToCacheKey=function(e,t){if(null==t)return e;var r=new Array;return r.push(e),t[T.PAGE_PARAM]&&r.push(t[T.PAGE_PARAM]),t[T.DATA_ONLY]&&r.push(t[T.DATA_ONLY]),r},F.prototype.pageReady=function(){var e=this;if(!e.isServerSideProcess()&&!e.isPreview){var t=I.createPageViewEvent(1);I.recordPageChange(t)}},F.prototype.paginationChange=function(e){e.paginationOnly&&this.pageReady()},F.prototype.isServerSideProcess=function(){var e=!1,t=window.location.href;return t.indexOf(T.SERVERSIDE_PROCESS_STRING)!=-1&&(e=!0),e},F.prototype.getParameterData=function(e){var t={};if(e)for(var r=e.split("&"),i=0;i<r.length;i++){var a=r[i].split("=");t[a[0]]=a[1]}return t},F.prototype.networkError=function(){var e=this;e.networkErrorMessage=b.t("ns.common:resources.networkConnectivityError",{}),e.networkErrorReloadText=b.t("ns.common:resources.reloadPage",{}),S(window).scrollTop("0"),S(".modal").modal("hide"),S("#loadingModal").hide(),S("body").removeClass("modal-open"),S(".modal-backdrop").remove(),C.sendTemplateInfo(T.LAYOUT_CONTAIER_ID,e,"notificationsNetworkError")},F.prototype.formWidgetQueue=function(e){var t=this,r=e.regions();t.displayQueue={};for(var i in t.widgets)t.callWidgetMethodIfApplicable(W,t.widgets[i]);t.widgets={},t.queue.resetHead();for(var a=0;a<r.length;a++)t.iterateRegionsAndFormQueue(r[a])},F.prototype.iterateRegionsAndFormQueue=function(t){var r=this;if(t.regions().length>0)for(var i=0;i<t.regions().length;i++)r.iterateRegionsAndFormQueue(t.regions()[i]);else for(var i=0;i<t.widgets().length;i++){var a=t.widgets()[i],o=e.unwrap(a.id);r.widgets[o]=a,r.displayQueue[o]=S.Deferred()}},F.prototype.displayWidgets=function(){for(var e in this.widgets)this.queue.display(e,this)},F.prototype.callMethodInAllWidgets=function(e){for(var t in this.widgets)this.callWidgetMethodIfApplicable(e,this.widgets[t])},F.prototype.callWidgetMethodIfApplicable=function(e,t){if(e in t&&"function"==typeof t[e])try{t[e].call(t,this.currentPage,this.pageResponse)}catch(r){P.error("Error in "+e+" of widget : "+t.displayName(),r)}},F.prototype.pageLoading=function(){var e={parent:"#loadingModal",posTop:"0",posLeft:"50%"},t=b.t("ns.common:resources.loadingText");S("#loadingModal").removeClass("hide"),S("#loadingModal").show(),e.loadingText=t,M.create(e)},F.prototype.pageLoadingComplete=function(){S("#loadingModal").addClass("hide"),M.destroy()},window.onerror=function(e,t,r,i,a){S.Topic(v.topicNames.ONERROR_EXCEPTION_HANDLER).publish(e,t,r,i,a)},F.prototype.LayoutViewModel=r,F.prototype.RegionViewModel=i,F.prototype.WidgetViewModel=a,F.prototype.CartViewModel=o,F.prototype.OrderViewModel=n,F.prototype.SearchViewModel=u,F.prototype.ShippingMethodsViewModel=p,F.prototype.PaymentDetails=E,F.prototype.PaymentAuthResponseViewModel=h,F.prototype.UserViewModel=g,F.prototype.ProductViewModel=f,F.prototype.OrderDetailsViewModel=U,F.prototype.SpaceViewModel=m,F.prototype.ServerData=t,F.prototype.SiteViewModel=_,F.prototype.shouldPageBeRefreshed=function(e){if(L.isRefreshRequired&&"payment"!==e)if(this.storeConfiguration.largeCart){if(this.deferLoadLargeCartInPromptRefresh)return;this.deferLoadLargeCartInPromptRefresh=!0,S.Topic(v.topicNames.SAVE_CART_BEFORE_REFRESH).publish(self)}else window.location.reload()},F.prototype.storageApi=D.getInstance(),F}),define("pageLayout/scheduled-order",["ccConstants","knockout","ccDate","pageLayout/rest-adapter","pubsub","ccStoreConfiguration","ccRestClient"],function(e,t,r,i,a,o,n){"use strict";function s(e,t){return e-t}function l(e){var r=t.observable(!1);return{isDirty:t.computed(function(){return!!r()||(t.toJS(e),r(!0),!1)}),reset:function(){r(!1)}}}function c(){this.id=t.observable(),this.organizationId=t.observable(),this.name=t.observable(),this.state=t.observable(),this.scheduleType=t.observable(),this.occurrenceInDay=t.observable(),this.daysOfWeek=t.observableArray(),this.daysInMonth=t.observableArray(),this.weeksInMonth=t.observableArray(),this.monthsInYear=t.observableArray(),this.startDate=t.observable(),this.endDate=t.observable(),this.nextScheduledRun=t.observable(),this.profileId=t.observable(),this.templateOrderId=t.observable(),this.templateOrder=t.observable(),this.clonedOrders=t.observableArray(),this.lastError=t.observable(),this.suspend=t.observable(!1),this.scheduleMode=t.observable(),this.executionStatusList=t.observableArray(),this._adapter=new i("/ccstore/v1/"),this._scheduleModes=u,this._scheduleModePatterns=p,this._scheduleSeeds=h,this.dirtyFlag=l(this),this.subscriptions=[],this.storeConfiguration=o.getInstance(),this.period=t.observable(),this.delay=t.observable(),this.catchUp=t.observable(),this.dateCreated,this.nextOrder,this.responseData=t.observable()}function d(e){var t=new Date(e),r=""+(t.getMonth()+1),i=""+t.getDate(),a=t.getFullYear();return r.length<2&&(r="0"+r),i.length<2&&(i="0"+i),[a,r,i].join("-")}var u=[e.SCHEDULE_MODE_QUARTERLY,e.SCHEDULE_MODE_BI_MONTHLY,e.SCHEDULE_MODE_ONCE_MONTHLY,e.SCHEDULE_MODE_TWICE_DAILY,e.SCHEDULE_MODE_ONCE_DAILY,e.SCHEDULE_MODE_WEEKLY],p={};p[e.SCHEDULE_MODE_QUARTERLY]={occurrenceInDay:/^1$/,daysOfWeek:/^$/,daysInMonth:/^1$/,weeksInMonth:/^$/,monthsInYear:/^([0-9]|1[0-1])(,([0-9]|(1[0-1]))){3,3}$/},p[e.SCHEDULE_MODE_BI_MONTHLY]={occurrenceInDay:/^1$/,daysOfWeek:/^$/,daysInMonth:/^1$/,weeksInMonth:/^$/,monthsInYear:/^([0-9]|1[0-1])(,([0-9]|(1[0-1]))){5,5}$/},p[e.SCHEDULE_MODE_ONCE_MONTHLY]={occurrenceInDay:/^1$/,daysOfWeek:/^$/,daysInMonth:/^1$/,weeksInMonth:/^$/,monthsInYear:/^0,1,2,3,4,5,6,7,8,9,10,11$/},p[e.SCHEDULE_MODE_TWICE_DAILY]={occurrenceInDay:/^2$/,daysOfWeek:/^.*$/,daysInMonth:/^$/,weeksInMonth:/^1,2,3,4,5$/,monthsInYear:/^0,1,2,3,4,5,6,7,8,9,10,11$/},p[e.SCHEDULE_MODE_ONCE_DAILY]={occurrenceInDay:/^1$/,daysOfWeek:/^1,2,3,4,5,6,7$/,daysInMonth:/^$/,weeksInMonth:/^1,2,3,4,5$/,monthsInYear:/^0,1,2,3,4,5,6,7,8,9,10,11$/},p[e.SCHEDULE_MODE_WEEKLY]={occurrenceInDay:/^1$/,daysOfWeek:/^([1-7])(,[1-7]){0,6}$/,daysInMonth:/^$/,weeksInMonth:/^([1-5])(,[1-5]){0,4}$/,monthsInYear:/^0,1,2,3,4,5,6,7,8,9,10,11$/};var h={};return h[e.SCHEDULE_MODE_QUARTERLY]={occurrenceInDay:1,daysOfWeek:[],daysInMonth:[1],weeksInMonth:[],monthsInYear:[0,3,6,9]},h[e.SCHEDULE_MODE_BI_MONTHLY]={occurrenceInDay:1,daysOfWeek:[],daysInMonth:[1],weeksInMonth:[],monthsInYear:[0,2,4,6,8,10]},h[e.SCHEDULE_MODE_ONCE_MONTHLY]={occurrenceInDay:1,daysOfWeek:[],daysInMonth:[1],weeksInMonth:[],monthsInYear:[0,1,2,3,4,5,6,7,8,9,10,11]},h[e.SCHEDULE_MODE_TWICE_DAILY]={occurrenceInDay:2,daysOfWeek:[],daysInMonth:[],weeksInMonth:[1,2,3,4,5],monthsInYear:[0,1,2,3,4,5,6,7,8,9,10,11]},h[e.SCHEDULE_MODE_ONCE_DAILY]={occurrenceInDay:1,daysOfWeek:[1,2,3,4,5,6,7],daysInMonth:[],weeksInMonth:[1,2,3,4,5],monthsInYear:[0,1,2,3,4,5,6,7,8,9,10,11]},h[e.SCHEDULE_MODE_WEEKLY]={occurrenceInDay:1,daysOfWeek:[1],daysInMonth:[],weeksInMonth:[1,2,3,4,5],monthsInYear:[0,1,2,3,4,5,6,7,8,9,10,11]},h[e.SCHEDULE_MODE_CUSTOM]={occurrenceInDay:1,daysOfWeek:[],daysInMonth:[],weeksInMonth:[],monthsInYear:[]},c.prototype.subscribeForChanges=function(){this.subscriptions.push(this.scheduleMode.subscribe(this._setScheduleMode.bind(this),this))},c.prototype.dispose=function(){for(var e=this.subscriptions.length,t=0;t<e;t++)this.subscriptions[t].dispose()},c.prototype.save=function(e,t){var r=this.toJS(),i=function(t){this.fromJS(t),"function"==typeof e&&e(t)}.bind(this),a=function(e){"function"==typeof t&&t(e)}.bind(this);r.id?this._adapter.persistUpdate("scheduledOrder",r.id,r,null,i,a):this._adapter.persistCreate("scheduledOrder",null,r,null,i,a)},c.prototype.remove=function(e,t){var r=this.id(),i=function(t){"function"==typeof e&&e(t)}.bind(this),a=function(e){"function"==typeof t&&t(e)}.bind(this);this._adapter.persistRemove("scheduledOrder",r,null,i,a)},c.prototype.fromJS=function(e){e=e||{},e.schedule=e.schedule||{},this.dateCreated=r.dateTimeFormatter(e.createDate,"MM/DD/YY",null);var t=new Date(e.nextScheduledRun);t&&"Invalid Data"!=t&&(this.nextOrder=r.dateTimeFormatter(e.nextScheduledRun,"MM/DD/YY",null)),this.id(e.id),this.organizationId(e.templateOrder.organizationId?e.templateOrder.organizationId:e.templateOrder.profile&&e.templateOrder.profile.organization?e.templateOrder.profile.organization.id:void 0),this.name(e.name),this.state(e.state),this.scheduleType(e.schedule.scheduleType||"calendar"),e.schedule.scheduleType&&"calendar"==e.schedule.scheduleType?(this.occurrenceInDay(e.schedule.occurrenceInDay||1),this.daysOfWeek(e.schedule.daysOfWeek||[]),this.daysInMonth(e.schedule.daysInMonth||[]),this.weeksInMonth(e.schedule.weeksInMonth||[]),this.monthsInYear(e.schedule.monthsInYear||[])):e.schedule.scheduleType&&"periodic"==e.schedule.scheduleType&&(this.period(e.schedule.period),this.catchUp(e.schedule.catchUp)),this.startDate(e.startDate),this.endDate(e.endDate||""),this.nextScheduledRun(e.nextScheduledRun),this.profileId(e.profileId),this.templateOrderId(e.templateOrderId),this.templateOrder(e.templateOrder||{}),this.clonedOrders(e.clonedOrders||[]),this.lastError(e.lastError),this.executionStatusList(e.executionStatusList||[]),this.scheduleMode(this._getScheduleMode()),this.dirtyFlag.reset(),this.subscribeForChanges()},c.prototype.toJS=function(){var e={id:this.id(),name:this.name(),state:this.state(),scheduleType:this.scheduleType(),schedule:"periodic"==this.scheduleType()?{period:this.period(),catchUp:this.catchUp(),delay:this.delay()}:{occurrenceInDay:this.occurrenceInDay(),daysOfWeek:this.daysOfWeek(),daysInMonth:0!=this.daysInMonth().length?this.daysInMonth():void 0,weeksInMonth:this.weeksInMonth(),monthsInYear:this.monthsInYear()},startDate:r.setDateToTimeZone(d.call(this,this.startDate())),endDate:this.endDate()?r.setDateToTimeZone(d.call(this,this.endDate())):"",nextScheduledRun:this.nextScheduledRun(),profileId:this.profileId(),templateOrderId:this.templateOrderId(),clonedOrders:this.clonedOrders(),lastError:this.lastError()};return e},c.prototype._getScheduleMode=function(){var t=e.SCHEDULE_MODE_CUSTOM;for(var r in this._scheduleModes){var i=this._scheduleModes[r];if(this._testScheduleMode(i)){t=i;break}}return t},c.prototype._testScheduleMode=function(e){var t=this._scheduleModePatterns[e].occurrenceInDay.test(this.occurrenceInDay())&&this._scheduleModePatterns[e].daysOfWeek.test(this.daysOfWeek.sort(s)())&&this._scheduleModePatterns[e].daysInMonth.test(this.daysInMonth.sort(s)())&&this._scheduleModePatterns[e].weeksInMonth.test(this.weeksInMonth.sort(s)())&&this._scheduleModePatterns[e].monthsInYear.test(this.monthsInYear.sort(s)());return t},c.prototype._setScheduleMode=function(t){var r=this._scheduleSeeds[t]||this._scheduleSeeds[e.SCHEDULE_MODE_CUSTOM];if(this.occurrenceInDay(r.occurrenceInDay),this.daysOfWeek(r.daysOfWeek.slice(0)),this.daysInMonth(r.daysInMonth.slice(0)),this.weeksInMonth(r.weeksInMonth.slice(0)),t===e.SCHEDULE_MODE_BI_MONTHLY){for(var i=new Date(this.startDate()),a=[],o=0,n=i.getMonth();;){if(a[o]=n,n=(n+2)%12,n==i.getMonth())break;o++}this.monthsInYear(a.sort(s))}else this.monthsInYear(r.monthsInYear.slice(0))},c.prototype.reset=function(){var e=this;e.id(""),e.name(""),e.state(""),e.scheduleType(""),e.occurrenceInDay(""),e.daysOfWeek([]),e.daysInMonth([]),e.weeksInMonth([]),e.monthsInYear([]),e.startDate(""),e.endDate(""),e.nextScheduledRun(""),e.profileId(""),e.executionStatusList([]),e.templateOrderId(""),e.templateOrder(""),e.clonedOrders([]),e.lastError(""),e.suspend(""),e.dispose(),e.scheduleMode(""),e.dirtyFlag.reset(),e.period(""),e.delay(""),e.catchUp(""),e.dateCreated=null,e.nextOrder=null,e.responseData("")},c.prototype.load=function(t){var r=this,i={};i.orderDetails=!0;var o={};o[e.ENDPOINT_KEY]=e.ENDPOINT_GET_SCHEDULED_ORDER,o[e.IDENTIFIER_KEY]="loadOrder";var s=r.storeConfiguration.getFilterToUse(o);return s&&(i[e.FILTER_KEY]=s),i.includeResult="full",n.request(e.ENDPOINT_GET_SCHEDULED_ORDER,i,function(e){r.responseData(e),r.fromJS(e);var t={message:e.errorMessages?e.errorMessages:void 0};$.Topic(a.topicNames.SCHEDULED_ORDER_LOAD_SCUCCESS).publishWith(t),$.Topic(a.topicNames.SCHEDULED_ORDER_LOAD_SUCCESS_AGENT).publish(e,t)},function(e){$.Topic(a.topicNames.SCHEDULED_ORDER_LOAD_ERROR).publishWith(e)},t),this},c.getInstance=function(){return c.singleInstance||(c.singleInstance=new c),c.singleInstance},c}),define("viewModels/guidedNavigationViewModel",["knockout","pubsub","ccConstants","navigation","jquery","spinner","CCi18n","pageLayout/search","storageApi","pageLayout/site"],function(e,t,r,i,a,o,n,s,l,c){"use strict";function d(t,a,o,n){var s=this;s.displayWidget=e.observable(!0),s.maxDimensionCount=t,s.maxRefinementCount=a,s.dimensions=s.collapsibleList([],s.maxDimensionCount),s.allRefinementCrumbs=e.observableArray(),s.searchText=e.observable(""),s.categoryHref=e.observable(""),s.categoryName=e.observable(""),s.categoryDimensionId=e.observable(""),s.categoryRepositoryId=e.observable(""),s.priceRangeDimension=r.GUIDED_NAVIGATION_PRICERANGE,s.categoryDimension=r.GUIDED_NAVIGATION_CATEGORY,d.prototype.locale(o),d.prototype.searchResultsHash=n?n:r.SEARCH_RESULTS_HASH,s.initialize(),s.removeRefinement=function(e){if(d.prototype.createSpinner(),""===s.searchText()&&e.dimensionName===r.GUIDED_NAVIGATION_CATEGORY){for(var t=e.removeAction?e.removeAction.link?e.removeAction.link:e.removeAction.navigationState:void 0,a=t?t.split("&"):void 0,o=!1,n=0;n<a.length;n++)if(a[n].indexOf("N=")!==-1){var l=a[n].substring(a[n].indexOf("N=")+2),c=s.categoryDimensionId()+"+"+l;t=t.replace(l,c),o=!0}0==o?i.goTo(s.categoryHref()):i.goTo(s.searchResultsHash+t+"&"+r.SEARCH_TYPE+"="+r.SEARCH_TYPE_GUIDED+"&"+r.PARAMETERS_TYPE+"="+r.PARAMETERS_SEARCH_QUERY)}else i.goTo(s.searchResultsHash+(e.removeAction.link?e.removeAction.link:e.removeAction.navigationState)+"&"+r.SEARCH_TYPE+"="+r.SEARCH_TYPE_GUIDED+"&"+r.PARAMETERS_TYPE+"="+r.PARAMETERS_SEARCH_QUERY)},s.clearAllRefinements=function(){d.prototype.createSpinner(),s.searchText().trim()?i.goTo(s.searchResultsHash+"?"+r.SEARCH_TERM_KEY+"="+encodeURIComponent(s.searchText().trim())+"&"+r.SEARCH_DYM_SPELL_CORRECTION_KEY+"="+encodeURIComponent(r.DYM_ENABLED)+"&"+r.SEARCH_NAV_ERECS_OFFSET+"=0&"+r.SEARCH_REC_PER_PAGE_KEY+"="+r.DEFAULT_SEARCH_RECORDS_PER_PAGE+"&"+r.SEARCH_TYPE+"="+r.SEARCH_TYPE_SIMPLE+"&"+r.PARAMETERS_TYPE+"="+r.PARAMETERS_SEARCH_QUERY):i.goTo(s.categoryHref())},s.checkForRange=function(e){var t="dimval.match_type";return!(!e||!e.properties||"range"!==e.properties[t])},s.checkIfUnboundRange=function(e){var t="DGraph.Spec";return!(!e||!e.properties||e.properties[t].indexOf("-unbounded")==-1)},s.getLowerBound=function(e){var t="dimval.prop.lowerBound";return e&&e.properties&&e.properties[t]?e.properties[t]:null},s.getUpperBound=function(e){var t="dimval.prop.upperBound";return e&&e.properties&&e.properties[t]?this.correctUpperBound(e.properties[t]):null},s.correctUpperBound=function(e){for(var t=1,r=0;r<c.getInstance().selectedPriceListGroup().currency.fractionalDigits;r++)t*=.1;return t=t.toFixed(c.getInstance().selectedPriceListGroup().currency.fractionalDigits),e-t},s.getUpperBoundText=function(e){return e.label?e.label.substr(e.label.indexOf(" ")):null}}function u(t,r){var i=this;i.dimensionName=t.dimensionName,i.isExpanded=e.observable(!1),i.shouldDimensionExpand=e.observable(!1),i.ariaLabelText=e.observable("expandText"),i.displayName=t.displayName,"Category"===i.displayName?i.displayName=n.t("ns.common:resources.categoryText"):"Price Range"===i.displayName&&(i.displayName=n.t("ns.common:resources.priceRangeText")),i.refinements=d.prototype.refinementList(t.refinements,r,i.dimensionName,t.multiSelect),i.multiSelect=t.multiSelect,i.ancestors=t.ancestors,t.shouldMultiSelectDimensionExpand&&(i.shouldDimensionExpand(!0),i.isExpanded(!0))}var p=s.getInstance();return d.prototype.isSpinnerStarted=e.observable("false"),
- d.prototype.locale=e.observable(""),d.prototype.searchResultsHash="",d.prototype.refinementIndicatorOptions={parent:"#loadingModal"},d.prototype.destroySpinner=function(){a("#loadingModal").hide(),o.destroy()},d.prototype.createSpinner=function(){a("#loadingModal").removeClass("hide"),a("#loadingModal").show(),d.prototype.isSpinnerStarted("true"),(a(window)[0].innerWidth||a(window).width())<r.VIEWPORT_TABLET_LOWER_WIDTH?(d.prototype.refinementIndicatorOptions.posLeft="40%",d.prototype.refinementIndicatorOptions.posTop="80px"):(a(window)[0].innerWidth||a(window).width())<r.VIEWPORT_LARGE_DESKTOP_LOWER_WIDTH?(d.prototype.refinementIndicatorOptions.posLeft="45%",d.prototype.refinementIndicatorOptions.posTop="100px"):(d.prototype.refinementIndicatorOptions.posLeft="50%",d.prototype.refinementIndicatorOptions.posTop="150px"),o.create(d.prototype.refinementIndicatorOptions)},d.prototype.updateWithSearchResultsData=function(i,o,n){var s=[];if(o&&o.breadcrumbs&&o.breadcrumbs.refinementCrumbs){s=o.breadcrumbs.refinementCrumbs.slice(0);for(var l=0;l<s.length;l++){if(!o.assemblerPagesPath||window.clientConfigData&&window.clientConfigData.useEnhancedSearch&&"true"==window.clientConfigData.useEnhancedSearch||(s[l].removeAction.link=n.toLegacyUrl(s[l].removeAction.link)),1==s[l].multiSelect&&s[l].count>0){for(var c=!1,d=0;d<o.navigation.length;d++)if(o.navigation[d].dimensionName==s[l].dimensionName){o.navigation[d].shouldMultiSelectDimensionExpand=!0,s[l].isSelected=!0,c=!0,o.navigation[d].refinements&&o.navigation[d].refinements instanceof Array&&o.navigation[d].refinements.indexOf(s[l])<0&&o.navigation[d].refinements.push(s[l]);break}if(0==c){s[l].isSelected=!0;var p={multiSelect:!0,name:s[l].name,ancestors:[],shouldMultiSelectDimensionExpand:!0,displayName:s[l].displayName,dimensionName:s[l].dimensionName,refinements:[s[l]]};o.navigation.push(p)}}""===n.searchText()&&s[l].dimensionName==r.GUIDED_NAVIGATION_CATEGORY&&a.Topic(t.topicNames.CATEGORY_CRUMB_UPDATED).publish(n.convertLabel(s[l]))}""===n.searchText()&&s.length>0&&s[0].dimensionName===r.GUIDED_NAVIGATION_CATEGORY&&s[0].properties&&n.categoryRepositoryId()===s[0].properties["dimval.prop.category.repositoryId"]?n.allRefinementCrumbs(s.slice(1)):n.allRefinementCrumbs(s.slice(0))}if(o.searchAdjustments&&o.searchAdjustments.originalTerms&&o.searchAdjustments.originalTerms.length>0&&n.searchText(o.searchAdjustments.originalSearchTerms[0]),i.message!==r.SEARCH_MESSAGE_FAIL&&(o.navigation&&o.navigation.length>0||s.length>0)){n.dimensions(e.utils.arrayMap(o.navigation,function(e){return new u(e,n.maxRefinementCount)}),n.maxDimensionCount),n.dimensions.showAll(!1),n.displayWidget(!0)}else n.displayWidget(!1)},d.prototype.initialize=function(){var e=this;a.Topic(t.topicNames.SEARCH_RESULTS_UPDATED).subscribe(function(t){var r=this;d.prototype.updateWithSearchResultsData(t,r,e),d.prototype.checkSpinner()}),a.Topic(t.topicNames.SEARCH_RESULTS_FOR_CATEGORY_UPDATED).subscribe(function(t){var r=this;d.prototype.updateWithSearchResultsData(t,r,e),d.prototype.checkSpinner()}),a.Topic(t.topicNames.CATEGORY_UPDATED).subscribe(function(t){e.categoryHref(t.categoryRoute),e.categoryName(t.categoryName),e.categoryDimensionId(t.dimensionId),e.categoryRepositoryId(t.repositoryId),e.searchText("")}),a.Topic(t.topicNames.OVERLAYED_GUIDEDNAVIGATION_CLEAR).subscribe(function(){d.prototype.resetViewModel(e)}),e.searchText()||e.categoryName()||e.loadCategoryFromLocalData()},d.prototype.loadCategoryFromLocalData=function(){var e=this,t=null;t=l.getInstance().getItem("category"),t&&"string"==typeof t&&(t=JSON.parse(t)),null!=t&&(e.categoryHref(t.categoryRoute),e.categoryName(t.categoryName),e.categoryRepositoryId(t.repositoryId),e.categoryDimensionId(t.dimensionId))},d.prototype.convertLabel=function(e){var t=e.label,r="dimval.prop.displayName_"+d.prototype.locale();return e&&e.properties&&e.properties[r]&&(t=e.properties[r]),t},d.prototype.toLegacyUrl=function(e){return e=e.replace(/\?/,"&"),e=e.replace(/^.*\/_\//,""),e=e.replace(/^N-/,"N="),"?"+e},d.prototype.checkSpinner=function(){d.prototype.isSpinnerStarted()&&d.prototype.destroySpinner(),d.prototype.isSpinnerStarted("false")},d.prototype.resetViewModel=function(e){e.displayWidget(!1),e.dimensions.removeAll(),e.allRefinementCrumbs.removeAll()},d.prototype.refinementList=function(t,r,i,o){var s=this;a.each(t,function(t,r){r.label=s.convertLabel(r),r.refinementValue=n.t("ns.common:resources.refinementValueText",{dataLabel:r.label,dataCount:r.count}),!r.link||window.clientConfigData&&window.clientConfigData.useEnhancedSearch&&"true"==window.clientConfigData.useEnhancedSearch||(r.link=s.toLegacyUrl(r.link)),this.hasOwnProperty("multiSelect")&&1==this.multiSelect||!this.hasOwnProperty("multiSelect")&&o?(r.checkedValue=e.observable(!1),this.isSelected&&1==this.isSelected&&r.checkedValue(!0),r.checkedValue.subscribe(function(e){e||(this.navigationState=this.removeAction.link?this.removeAction.link:this.removeAction.navigationState),d.prototype.createSpinnerAndHandleRedirect(this.link?this.link:this.navigationState)},r)):r.clickRefinement=function(){d.prototype.createSpinnerAndHandleRedirect(this.link?this.link:this.navigationState)}});var l=s.collapsibleList(t,r);return l},d.prototype.createSpinnerAndHandleRedirect=function(e){var t=this;d.prototype.createSpinner(),i.goTo(t.searchResultsHash+p.getFilteredNavState(e)+"&"+r.SEARCH_TYPE+"="+r.SEARCH_TYPE_GUIDED+"&"+r.PARAMETERS_TYPE+"="+r.PARAMETERS_SEARCH_QUERY)},d.prototype.collapsibleList=function(t,r){var i=e.observableArray(t);return i.limit=e.observable(r),i.showAll=e.observable(!1),i.toggleShowAll=function(){i.showAll(!i.showAll())},i.display=e.computed(function(){return i.showAll()?i():i().slice(0,i.limit())},i),i},d}),define("ccPaginated",["knockout","pubsub","navigation","crossroads","ccConstants","ccNavState"],function(e,t,r,i,a,o){"use strict";function n(){var t=this;t.active=!1,t.pageNumber=1,t.pageId=e.observable(""),t.contextId=e.observable(""),t.paginationOnly=e.observable(!1),t.seoslug=e.observable(""),t.previousHash=e.observable(""),t.currentHash=e.observable(""),t.isMobileView=e.observable(!1),t.paginationType=e.observable(0),t.targetPage=1,t.clearOnLoad=!1,t.itemsPerPage=40,t.blockSize=40,t.pageBatchSize=1,t.data=e.observableArray().extend({deferred:!0}),t.pageWindowSize=5,t.startIndex=0,t.lastIndex=t.pageWindowSize-1,t.pageIndex=0,t.middlePageOffset=0,t.focusPage=!1,t.pages=e.computed(t.pagesFunction,t),t.scrollToTop=!0,t.currentPage(1),t.firstPageIndex(1),t.totalNumber(0),t.sortDirectiveProp("displayName"),t.sortDirectiveOrder("asc"),t.totalNumberOfPages(0),t.clickedPage(-1),t.useGenericSort=!1,t.sortOptions=e.observableArray([]),t.selectedResultsPerPageOption=e.observable(),t.resultsPerPageOptions=e.observableArray([])}return n.prototype.currentPage=e.observable(0),n.prototype.totalNumber=e.observable(0),n.prototype.firstPageIndex=e.observable(1),n.prototype.data=e.observableArray([]).extend({deferred:!0}),n.prototype.sortDirectiveProp=e.observable("displayName"),n.prototype.sortDirectiveOrder=e.observable("asc"),n.prototype.totalNumberOfPages=e.observable(0),n.prototype.pageStartIndex=e.observable(),n.prototype.pageEndIndex=e.observable(),n.prototype.clickedPage=e.observable(-1),n.prototype.updatePagination=function(e){var t="";if(a.ALLOW_HASHBANG&&(t+=a.URL_HASH_SIGN+a.URL_PREPEND_HASH),1==this.paginationType())return t=o.route()+"/"+e,r.getPathWithLocale(t);if(2==this.paginationType()){var n="/searchresults?{parameters}";window.clientConfigData&&window.clientConfigData.useEnhancedSearch&&"true"==window.clientConfigData.useEnhancedSearch&&(n="/"+r.getPath()+"?{parameters}");var s=i.addRoute(n),l="",c=!1;for(var d in this.parameters)this.parameters.hasOwnProperty(d)&&("page"==d&&(this.parameters[d]=e,c=!0),l+=d+"="+this.parameters[d]+"&");return l=l.substring(0,l.length-1),c||(l+="&page="+e),t+=s.interpolate({parameters:l}),r.getPathWithLocale(t)}if(3==this.paginationType()){t=a.AGENT_BASE_CONTEXT+"/"+a.URL_HASH_SIGN+a.URL_PREPEND_HASH;var s=i.addRoute("/{pageId}/{contextId}?{parameters}"),l="",c=!1;for(var d in this.parameters)this.parameters.hasOwnProperty(d)&&("page"==d&&(this.parameters[d]=e,c=!0),l+=d+"="+this.parameters[d]+"&");return l=l.substring(0,l.length-1),c||(l&&(l+="&"),l+="page="+e),t+=s.interpolate({pageId:this.pageId(),contextId:this.contextId(),parameters:l}),r.getPathWithLocale(t)}return""},n.prototype.load=function(e){e?(this.clearData(),this.clearOnLoad=!0):(this.clearData(),this.pageNumber&&(this.totalNumberOfPages(this.pageNumber),this.firstPageIndex(null),this.currentPage(this.pageNumber),this.firstPageIndex(1))),this.getPage(this.pageNumber||this.currentPage()||1)},n.prototype.cleanPage=function(){if(1==this.paginationType())n=o.route(),r.goTo(n);else if(2==this.paginationType()){var e=i.addRoute("/searchresults?{parameters}"),t="";for(var a in this.parameters)this.parameters.hasOwnProperty(a)&&("page"==a||(t+=a+"="+this.parameters[a]+"&"));t=t.substring(0,t.length-1),n=e.interpolate({parameters:t}),r.goTo(n)}else if(3==this.paginationType()){var e=i.addRoute("/{pageId}/{contextId}?{parameters}"),t="";for(var a in this.parameters)this.parameters.hasOwnProperty(a)&&("page"==a||(t+=a+"="+this.parameters[a]+"&"));t=t.substring(0,t.length-1);var n=e.interpolate({pageId:this.pageId(),contextId:this.contextId(),parameters:t});r.goTo(n)}},n.prototype.firstPage=function(){return this.updatePagination(this.firstPageIndex())},n.prototype.goToFirstPageControls=function(){return this.initializeIndex(),!0},n.prototype.previousPage=function(){return this.currentPage()>this.startIndex+1?this.updatePagination(this.currentPage()-1):this.updatePagination(this.currentPage())},n.prototype.goToPage=function(e){return this.updatePagination(e.pageNumber)},n.prototype.nextPage=function(){return this.currentPage()<this.totalNumberOfPages()?this.updatePagination(this.currentPage()+1):this.updatePagination(this.currentPage())},n.prototype.lastPage=function(){return this.updatePagination(this.totalNumberOfPages())},n.prototype.incrementPage=function(){this.currentPage()<this.totalNumberOfPages()&&this.getPage(this.currentPage()+1)},n.prototype.getPage=function(e){if(this.totalNumberOfPages()>1&&this.adjustPageIndex(e),this.adjustStartAndEndPageIndex(e),e!==this.currentPage()&&e!==this.targetPage&&this.isMobileView()&&$.Topic(t.topicNames.RECORD_PAGINATION_PAGE_CHANGE).publish(),e===this.targetPage&&null!==this.targetPage&&void 0!==this.targetPage||(this.targetPage=e),this.clearOnLoad)return this.fetchBlock(this.pageStartIndex()),this.clickedPage(e),void this.currentPage(e);for(var r=this.pageStartIndex();r<this.pageEndIndex();r+=1)if("undefined"==typeof this.data()[r])return e!==this.currentPage()&&(this.targetPage=e),void this.fetchBlock(this.pageStartIndex());this.currentPage(e)},n.prototype.pagesFunction=function(){var e,t,r,i,a,o,n,s,l,c=1;for(this.clearOnLoad&&this.adjustStartAndEndPageIndex(this.pageNumber),this.totalNumber()?(t=(this.totalNumber()-this.totalNumber()%this.itemsPerPage)/this.itemsPerPage,r=this.totalNumber()%this.itemsPerPage>0?1:0,e=t+r):e=0,this.prevTotalNumberOfPages=this.totalNumberOfPages(),this.totalNumberOfPages(e),this.adjustPageIndex(this.pageNumber),i=[],s=this.startIndex;s<=this.lastIndex&&s<this.totalNumberOfPages();s+=1)a=s+1,o=a===this.currentPage(),n=!!this.focusPage&&o,l=Math.abs(a-s-c),c+=1,i[l]={pageNumber:a,selected:o,focused:n};return!this.focusPage&&i.length>0&&(this.focusPage=!0),i},n.prototype.adjustPageIndex=function(e){var t=Math.floor(this.pageWindowSize/2);if(e>=this.totalNumberOfPages())e>this.totalNumberOfPages()&&(e=this.totalNumberOfPages()),e==this.totalNumberOfPages()&&(this.lastIndex=this.totalNumberOfPages()-1,this.lastIndex<this.pageWindowSize-1?this.startIndex=0:this.startIndex=this.lastIndex-(this.pageWindowSize-1));else if(e<=t)this.startIndex=0,this.totalNumberOfPages()<=this.pageWindowSize?this.lastIndex=this.totalNumberOfPages()-1:this.lastIndex=this.pageWindowSize-1;else{var r=this.totalNumberOfPages()-e;r>=t?(this.startIndex=e-1-t,this.lastIndex=e-1+t):(this.startIndex=e-1-t-r,this.lastIndex=e-1+t-r),this.startIndex<0&&(this.startIndex=0)}},n.prototype.sort=function(e){var t,r,i;this.sortDirectiveOrder(),e.order();if(!e.notReversible||this.sortDirectiveOrder()!=e.order()){for(e.maintainSortOrder&&e.maintainSortOrder===!0?r=e.order():e.id&&(r="none"===e.order()||"desc"===e.order()?"asc":"desc"),this.sortDirectiveOrder(r),t=0;t<this.sortOptions().length;t+=1)this.sortOptions()[t]===e?this.sortOptions()[t].order(r):this.sortOptions()[t].maintainSortOrder||this.sortOptions()[t].order("none");if(this.sortDirectiveProp(e.id),2==this.paginationType()||3==this.paginationType()){if(this.useGenericSort)var o=e.id+("desc"===r?"|1":"|0");else{var o="product.relevance";"listPrice"===e.id&&(o="sku.activePrice",o+="desc"===r?"|1":"|0")}this.parameters[a.SEARCH_SORT_ORDER]=encodeURIComponent(o)}if(this.data().length<this.totalNumber()||e.serverOnly)return this.clearOnLoad=!0,this.cleanPage(),this.initializeIndex(),this.targetPage=1,void(this.listType&&this.listType===a.LIST_VIEW_SEARCH||this.fetchBlock(0));if($.each(this.data(),function(e,t){if(!t)return i=!0,!1}),i)return this.clearOnLoad=!0,this.targetPage=1,void this.fetchBlock(0);this.data.sort(this.sortFunction.bind(this)),this.getPage(1)}},n.prototype.sortFunction=function(e,t){var r,i,a,o,n;for(n="desc"===this.sortDirectiveOrder()?-1:1,r=this.sortDirectiveProp()&&this.sortDirectiveProp().split("."),a=e,o=t,i=0;i<r.length;i+=1)$.isArray(a)&&(a=a[0]),$.isArray(a)&&(a=a[0]),a=a&&a[r[i]],$.isArray(o)&&(o=o[0]),o=o&&o[r[i]],$.isArray(o)&&(o=o[0]);return(a===o||"string"==typeof a&&a.toLowerCase()===o.toLowerCase())&&(e.displayName&&t.displayName?(a=e.displayName&&e.displayName.toString().toLowerCase(),o=t.displayName&&t.displayName.toString().toLowerCase()):e.dateTime&&t.dateTime&&(a=e.dateTime&&e.dateTime.toLowerCase(),o=t.dateTime&&t.dateTime.toLowerCase(),n=1)),a===o?0:isFinite(a)&&isFinite(o)?(parseFloat(a)-parseFloat(o))*n:a.toString().toLowerCase()>o.toString().toLowerCase()?n:-1*n},n.prototype.adjustStartAndEndPageIndex=function(e){var t=(e-1)*this.itemsPerPage,r=e*this.itemsPerPage,i=this.totalNumber();i&&r>i&&(r=i),this.pageStartIndex(t),this.pageEndIndex(r)},n.prototype.initializeIndex=function(){this.startIndex=0,this.lastIndex=this.pageWindowSize-1,this.clickedPage(1)},n.prototype.clearData=function(){this.data([]),this.prevTotalNumber=this.totalNumber(),this.totalNumber(null)},n.prototype.addData=function(e,t,r){var i,a,o;if(this.pageStartIndex()>0&&(t<0||t===r)?(t=this.prevTotalNumber-this.blockSize>=0?this.prevTotalNumber-this.blockSize:0,this.removeLastPage()):t=t<0?0:t,this.totalNumber(t),a=r+this.blockSize*this.pageBatchSize,a>t&&(a=t),this.clearOnLoad?(i=[],this.initializeIndex()):i=this.data(),e)for(o=0;o<e.length;o+=1)i[o+r]=e[o];this.clearOnLoad?(this.data(i),this.clearOnLoad=!1):this.data.valueHasMutated(),this.currentPage()===this.targetPage&&this.currentPage.notifySubscribers(),this.targetPage?(1==this.targetPage&&this.initializeIndex(),this.adjustStartAndEndPageIndex(this.targetPage),this.scrollToTop===!0&&$(window).scrollTop(0),this.firstPageIndex(null),this.currentPage(this.targetPage),this.firstPageIndex(1),this.scrollToTop===!0&&$(window).scrollTop(0),this.targetPage=null):a<this.pageEndIndex()&&this.pageEndIndex(a)},n.prototype.fetchBlock=function(e){throw"Function Not Implemented!"},n.prototype.removeLastPage=function(){this.clearOnLoad=!1,this.startIndex=this.startIndex-1>=0?this.startIndex-1:this.startIndex,this.getPage(this.currentPage()-1)},n.prototype.sortReset=function(){this.sortDirectiveProp("displayName"),this.sortDirectiveOrder("asc"),$.each(this.sortOptions(),function(e,t){"displayName"===t.id?t.order("asc"):t.order("none")})},n}),define("viewModels/productListingViewModel",["knockout","ccPaginated","pubsub","ccRestClient","ccConstants","CCi18n","spinner","ccNumber","pageLayout/product","storageApi","pageLayout/site","navigation","ccStoreConfiguration"],function(e,t,r,i,a,o,n,s,l,c,d,u,p){"use strict";function h(o){var n=this;t.call(this),n.widget=o,n.productGridRefreshOrAppend=!0,n.catalog=e.observable(),n.display=e.observable(!0),n.showInactiveProducts=null,n.showInactiveSkus=null,n.scrolledViewModels=[],n.isLoadOnScroll=e.observable(!1),n.productGridExtension=!1,n.isCacheEnabled=!1,n.cachedViewModels=[],n.viewModelCacheLimit=3,n.refreshValues=!1,n.defaultBlockSize=60,n.selectedSort=e.observable(),n.categoryOrSearchChanged=!1,n.changedViaDropDown=!1,n.pageNumberOffSetIndexMapForCategories=[],this.skipOffSetMapUpdateOnRefresh=!1,this.skipOffSetMapUpdateOnBrowserBack=!1,this.previousGetProductsBlockSize=0,i.profileType==a.PROFILE_TYPE_AGENT&&(n.showInactiveProducts=!1,n.showInactiveSkus=!1),this.handleResultsPerPage=function(e,t){setTimeout(this.doChangeResultsPerPage.bind(this,e,t),200)},this.doChangeResultsPerPage=function(e,t){var r=a.DEFAULT_ITEMS_PER_PAGE,i=this.defaultBlockSize,o=!1;e&&(this.prevTotalNumber=this.totalNumber&&null!==this.totalNumber()?this.totalNumber():this.prevTotalNumber,e.id==a.RESULTS_PER_PAGE_ALL?(r=this.prevTotalNumber,this.blockSize<r&&(i=r)):(r=e.value,this.widget&&this.widget.blockSize&&!isNaN(this.widget.blockSize())&&(i=parseInt(this.widget.blockSize()))),this.blockSize=i),this.itemsPerPage=r,this.widget&&(this.changedViaDropDown=!0,this.widget.listType()===a.LIST_VIEW_PRODUCTS?(this.cleanPage(),this.pageNumber=1,this.currentPage(null),this.getPage(1)):this.widget.listType()===a.LIST_VIEW_SEARCH&&(1==this.currentPage()&&(o=!0),this.pageNumber=1,this.currentPage(null),o?this.getPage(1):u.goTo(this.firstPage(),!1,!0)),this.changedViaDropDown=!1)},($(window)[0].innerWidth||$(window).width())<=a.VIEWPORT_TABLET_UPPER_WIDTH&&n.isLoadOnScroll(!0);n.spanClass=e.computed(function(){var e="",t=0,r=0,i=0,a=0;return this.itemsPerRowInPhoneView&&(t=12/this.itemsPerRowInPhoneView),this.itemsPerRowInTabletView&&(r=12/this.itemsPerRowInTabletView()),this.itemsPerRowInDesktopView&&(i=12/this.itemsPerRowInDesktopView()),this.itemsPerRowInLargeDesktopView&&(a=12/this.itemsPerRowInLargeDesktopView()),t>0&&(e+="col-xs-"+t),r>0&&r!=t&&(e+=" col-sm-"+r),i>0&&i!=r&&(e+=" col-md-"+i),a>0&&a!=i&&(e+=" col-lg-"+a),e},n).extend({deferred:!0}),n.type="ProductListingViewModel",this.productLoadingOptions={},this.productLoadingOptions.parent="#cc-product-spinner",this.productLoadingOptions.selector="#cc-product-spinner-area",this.removeSpinner=function(){setTimeout(function(){$("#cc-product-spinner-area").find(".cc-spinner").remove()},500)},this.handleSorting=function(e,t){setTimeout(this.doSort.bind(this,e,t),200)},this.doSort=function(e,t){if(this.isCacheEnabled){var r=this.findCachedResultIndex(1);if(void 0!=r)return this.sortDirectiveOrder(e.order()),this.sortDirectiveProp(e.id),1===this.currentPage()&&this.currentPage.notifySubscribers(),this.targetPage=1,void this.currentPage(1)}this.sort(e),t&&t(arguments[3])},this.itemsPerPage=a.DEFAULT_ITEMS_PER_PAGE,this.blockSize=this.defaultBlockSize,this.pageProductsTemp=[],this.widget&&this.widget.productsPerPage&&!isNaN(this.widget.productsPerPage())&&(this.itemsPerPage=parseInt(this.widget.productsPerPage())),this.widget&&this.widget.blockSize&&!isNaN(this.widget.blockSize())&&(this.blockSize=parseInt(this.widget.blockSize())),this.blockSize<=this.itemsPerPage&&(this.blockSize=this.itemsPerPage+1),this.recordsPerPage=e.observable(a.DEFAULT_ITEMS_PER_PAGE),this.lruSize=100,this.numberOfElementsToDelete=20,this.currentProductsComputed=e.observableArray([]),this.currentProducts=e.computed(function(){if(this.widget&&"product"===this.widget.listType()){var t=[];this.productGridRefreshOrAppend=!0;var r,i;r=(this.currentPage()-1)*this.itemsPerPage,i=r+this.itemsPerPage;var o=this.isLoadOnScroll.peek();if(this.currentPage()-1==0&&o&&this.pageProductsTemp.length>0&&(this.pageProductsTemp=[]),!this.isCacheEnabled){var s=this.data.peek();t=s.slice(r,i)}var d,u,p,h,g,f,m=[],I=t.length,E=[];if(n.isLoadOnScroll()||(n.refreshValues=!0),this.isCacheEnabled){var y=!0,v=this.findCachedResultIndex();if(void 0!=v){i>this.cachedViewModels[v].totalResults&&(i=this.cachedViewModels[v].totalResults);for(var b=r;b<i;b++)if(void 0==this.cachedViewModels[v].viewModels[b]){y=!1;break}if(y)return this.cachedViewModels[v].visitCount++,m=this.cachedViewModels[v].viewModels.slice(r,i),this.currentProductsComputed(m),o?this.cachedViewModels[v].viewModels:m;t=this.cachedViewModels[v].products.slice(r,i),I=t.length}}for(var T=0;T<I;T++)if(t[T]){if(p=new l(t[T].product),d=this.listingImageSize(),u=p.primarySmallImageURL().match(/.+?(?=&height=)/),u=null==u?p.primarySmallImageURL():u[0],p.listingImageURL=e.observable(u+"&height="+d+"&width="+d),(this.widget.shouldUseStyleBased()||"true"==this.widget.shouldUseStyleBased())&&window.history&&window.history.pushState){if(0==T&&this.category()&&!this.skipOffSetMapUpdateOnRefresh&&!this.skipOffSetMapUpdateOnBrowserBack){var h=c.getInstance().getItem(a.LISTING_OFFSET_MAP_KEY);if(h&&"string"==typeof h&&(h=JSON.parse(h)),h){if(g=Object.keys(h),f=g.length,f&&f>this.lruSize){E=g.sort(function(e,t){return h[e].timestamp-h[t].timestamp});for(var P=0;P<this.numberOfElementsToDelete;P++)delete h[E[P]]}}else h={};var S=this.getIndexForOffSetMap();null!=S&&this.data()[S]&&(this.data()[S].offsetMap.timestamp=Date.now(),this.data()[S].offsetMap.offsetMapIndex=S,h[this.category().route+"/"+this.pageNumber]=this.data()[S].offsetMap,c.getInstance().setItem(a.LISTING_OFFSET_MAP_KEY,JSON.stringify(h)))}var C;p.productVariantOptions&&p.productVariantOptions().length>0&&e.utils.arrayForEach(p.productVariantOptions(),function(t){t.listingVariant()===!0&&(C=e.mapping.toJS(t))}),p.listingSku=t[T].listingSku,C&&(!C.variantBasedDisplay&&t[T].product.defaultProductListingSku&&t[T].product.defaultProductListingSku.images&&t[T].product.defaultProductListingSku.images.length>0&&(p.listingSku=t[T].product.defaultProductListingSku),p.listingSku&&(p.listingSku.route=t[T].product.route+"?variantName="+C.optionId+"&variantValue="+p.listingSku[C.optionId]))}m.push(p),this.pageProductsTemp.push(p),(this.pageProductsTemp.length>0&&this.pageProductsTemp.length%this.itemsPerRow()===0||o&&this.totalNumber.peek()===this.pageProductsTemp.length+this.scrolledViewModels.length||!o&&T+1===I)&&(this.scrolledViewModels.push.apply(this.scrolledViewModels,this.pageProductsTemp),this.productGridExtension||this.viewportMode()!=a.TABLET_VIEW&&this.viewportMode()!=a.PHONE_VIEW?this.currentProductsComputed(this.pageProductsTemp.splice(0)):this.currentProductsComputed(this.scrolledViewModels),this.pageProductsTemp=[],this.productGridRefreshOrAppend=!1)}var _=this.category();if(_&&void 0!=v&&this.isCacheEnabled)for(var b=0;b<m.length;b++)this.cachedViewModels[v].viewModels[b+r]=m[b];return o?this.scrolledViewModels:m}},this).extend({deferred:!0}),this.checkResponsiveFeatures=function(e){e>a.VIEWPORT_LARGE_DESKTOP_LOWER_WIDTH?n.viewportMode()!=a.LARGE_DESKTOP_VIEW&&(n.viewportMode(a.LARGE_DESKTOP_VIEW),n.handleViewportChange(a.LARGE_DESKTOP_VIEW)):e>a.VIEWPORT_TABLET_UPPER_WIDTH&&e<=a.VIEWPORT_LARGE_DESKTOP_LOWER_WIDTH?n.viewportMode()!=a.DESKTOP_VIEW&&(n.viewportMode(a.DESKTOP_VIEW),n.handleViewportChange(a.DESKTOP_VIEW)):e>=a.VIEWPORT_TABLET_LOWER_WIDTH&&e<=a.VIEWPORT_TABLET_UPPER_WIDTH?n.viewportMode()!=a.TABLET_VIEW&&(n.viewportMode(a.TABLET_VIEW),n.handleViewportChange(a.TABLET_VIEW)):n.viewportMode()!=a.PHONE_VIEW&&(n.viewportMode(a.PHONE_VIEW),n.handleViewportChange(a.PHONE_VIEW))},this.getIndexForOffSetMap=function(){var e=this.itemsPerPage;if(this.widget&&this.widget.productsPerPage&&!isNaN(this.widget.productsPerPage())&&(e=parseInt(this.widget.productsPerPage())),this.itemsPerPage!==e)return null;if(this.sortOptions&&this.sortOptions()&&this.sortOptions().length>0&&this.sortOptions()[0]&&this.sortOptions()[0]!==this.selectedSort())return null;for(var t=null,r=0;r<this.pageNumberOffSetIndexMapForCategories.length;r++)if(this.pageNumberOffSetIndexMapForCategories[r].categoryId===this.category().id){t=this.pageNumberOffSetIndexMapForCategories[r].pageNumberOffSetIndexMap;break}if(!t)return null;if(this.totalExpandedResults<=this.itemsPerPage)return this.data().length-1;for(var i=0;i<t.length;i++){var a=null;if(i>0&&(a=t[i-1].offSetIndex),this.pageNumber===t[i].pageNumber)return t[i].offSetIndex;if(this.pageNumber<t[i].pageNumber&&a&&t[i-1].pageNumber>=this.pageNumber)return a}return this.totalExpandedResults===this.data().length&&t.length>0||1==t.length?t[t.length-1].offSetIndex:null},this.handleResponsiveViewports=function(){n.viewportMode()==a.TABLET_VIEW&&(n.itemsPerRow(n.itemsPerRowInTabletView()),n.isMobileView(!0),n.isLoadOnScroll(!0)),n.viewportMode()==a.PHONE_VIEW&&(n.itemsPerRow(n.itemsPerRowInPhoneView),n.isMobileView(!0),n.isLoadOnScroll(!0)),n.refreshValues=!0,n.scrolledViewModels=[],n.isLoadOnScroll()?(n.productGridExtension&&(1===n.currentPage()?n.currentPage.notifySubscribers():n.currentPage(1)),n.scrollToTop=!1):n.scrollToTop=!0},this.handleViewportChange=function(e){n.itemsPerRow();e!=n._internalViewportMode()&&(e&&n._internalViewportMode(e),n.viewportMode()==a.DESKTOP_VIEW?(n.itemsPerRow(n.itemsPerRowInDesktopView()),n.clearOnLoad=!0,n.targetPage=1,n.fetchBlock(0),n.isMobileView(!1),n.isLoadOnScroll(!1)):n.viewportMode()==a.LARGE_DESKTOP_VIEW&&(n.itemsPerRow(n.itemsPerRowInLargeDesktopView()),n.clearOnLoad=!0,n.targetPage=1,n.fetchBlock(0),n.isMobileView(!1),n.isLoadOnScroll(!1)),n.handleResponsiveViewports())},this.pageNumberDeferred=$.Deferred(),this.handleLinks=function(e,t){var i,a,o,n=e.totalNumberOfPages(),s=parseInt(t.page)||(t.paginationOnly?1:e.pageNumber);1==n||1==s?(a=null,i=""):(a="/"+(s-1),i="/"+s),o=1==n||s==n?null:"/"+(s+1),e.isLoadOnScroll&&e.isLoadOnScroll()&&(i="",a=o=null),$.Topic(r.topicNames.PAGE_PAGINATION_CALCULATED).publish({currPageNo:i,prevPageNo:a,nextPageNo:o})},this.handlePaginationChange=function(e){this.pageNumberDeferred.resolve(this,e),e.paginationOnly&&this.handleLinks(this,e)},$.Topic(r.topicNames.PAGE_PAGINATION_CHANGE).subscribe(this.handlePaginationChange.bind(this)),this.checkResponsiveFeatures($(window)[0].innerWidth||$(window).width()),this.handleResponsiveViewports(),this._internalViewportMode(this.viewportMode()),this.resultsText=e.computed(this.getResultsText,this),this.storeConfiguration=p.getInstance()}var g=function(){};return g.prototype=t.prototype,h.prototype=new g,h.prototype.constructor=h,h.prototype.category=e.observable(),h.prototype.resultsText=e.observable(),h.prototype.titleText=e.observable(),h.prototype.itemsPerRow=e.observable(4),h.prototype.itemsPerRowInTabletView=e.observable(4),h.prototype.itemsPerRowInPhoneView=2,h.prototype.itemsPerRowInDesktopView=e.observable(4),h.prototype.itemsPerRowInLargeDesktopView=e.observable(4),h.prototype._internalViewportMode=e.observable(4),h.prototype.viewportMode=e.observable(4),h.prototype.spanClass=e.observable(),h.prototype.listingImageSize=e.observable(300),h.prototype.resetSortOptions=function(){var e=this.sortOptions()[0];this.selectedSort(e),this.sortDirectiveProp(e.id),this.sortDirectiveOrder(e.order("none"))},h.prototype.clearData=function(){this.data([]),this.prevTotalNumber=this.totalNumber(),this.totalNumber(null),this.actualOffset=0,this.expandedOffset=0,this.scrolledViewModels=[]},h.prototype.getPage=function(e){if(this.totalNumberOfPages()>1&&this.adjustPageIndex(e),this.adjustStartAndEndPageIndex(e),e!==this.currentPage()&&e!==this.targetPage&&this.isMobileView()&&$.Topic(r.topicNames.RECORD_PAGINATION_PAGE_CHANGE).publish(),e===this.targetPage&&null!==this.targetPage&&void 0!==this.targetPage||(this.targetPage=e),this.isCacheEnabled){var t=!1,i=this.findCachedResultIndex(e);if(void 0==i)t=!0;else{var a=this.pageEndIndex();a>this.cachedViewModels[i].totalResults&&(a=this.cachedViewModels[i].totalResults);for(var o=this.pageStartIndex();o<a;o+=1)if("undefined"==typeof this.cachedViewModels[i].products[o]){t=!0;break}}if(t)return e!==this.currentPage()&&(this.targetPage=e),void this.fetchBlock(this.pageStartIndex());this.currentPage()===e&&this.currentPage.notifySubscribers(),this.totalNumber(this.cachedViewModels[i].totalResults),$.when(this.pageNumberDeferred).done(this.handleLinks),this.titleText(this.getTitleText())}else{if(this.clearOnLoad)return this.fetchBlock(this.pageStartIndex()),this.clickedPage(e),void this.currentPage(e);for(var o=this.pageStartIndex();o<this.pageEndIndex();o+=1)if("undefined"==typeof this.data()[o])return e!==this.currentPage()&&(this.targetPage=e),void this.fetchBlock(this.pageStartIndex())}this.currentPage(e)},h.prototype.findCachedResultIndex=function(){for(var e,t=this.category.peek(),r=this.selectedSort.peek(),i=0;i<this.cachedViewModels.length;i++)if(this.cachedViewModels[i]&&this.cachedViewModels[i].categoryId==t.repositoryId&&this.cachedViewModels[i].sortKey==r.id&&this.cachedViewModels[i].sortOrder==r.order()){e=i;break}return e},h.prototype.fetchBlock=function(e){var t,r;if(this.clearOnLoad&&(this.titleText(""),this.clearData()),r={},r[a.TOTAL_RESULTS]=!0,r[a.TOTAL_EXPANDED_RESULTS]=void 0===p.getInstance().PRODUCT_LISTING_TOTAL_EXPANDED_RESULTS||"true"===String(p.getInstance().PRODUCT_LISTING_TOTAL_EXPANDED_RESULTS),this.catalog&&(r[a.CATALOG]=this.catalog()),this.widget.user&&this.widget.user().catalogId&&(r[a.CATALOG]=this.widget.user().catalogId()),r[a.LIMIT]=this.blockSize,(this.widget.shouldUseStyleBased()||"true"==this.widget.shouldUseStyleBased())&&window.history&&window.history.pushState){if(0==e)this.actualOffset=0,this.expandedOffset=0,r[a.OFFSET]=this.actualOffset;else{for(var o=1;o<=this.blockSize;o++)if(this.data()[e+this.itemsPerPage-o]){this.skipOffSetMapUpdateOnRefresh?this.actualOffset=this.data()[e+this.itemsPerPage-o].offsetMap.actualOffset+this.previousGetProductsBlockSize:(this.actualOffset=this.data()[e+this.itemsPerPage-o].offsetMap.actualOffset+this.blockSize,this.actualOffset>this.totalNumber.peek()&&(this.actualOffset=e)),this.expandedOffset=e+this.itemsPerPage+1-o,r[a.OFFSET]=this.actualOffset;break}if(void 0==r[a.OFFSET])for(var o=1;o<=this.blockSize;o++)if(this.data()[e+o]){this.actualOffset=this.data()[e+o].offsetMap.actualOffset-this.blockSize<0?0:this.data()[e+o].offsetMap.actualOffset-this.blockSize,this.expandedOffset=-1*(e+o-1),r[a.OFFSET]=this.actualOffset;break}}if(void 0==r[a.OFFSET]){var s,l,u=this.itemsPerPage;if(this.widget&&this.widget.productsPerPage&&!isNaN(this.widget.productsPerPage())&&(u=parseInt(this.widget.productsPerPage())),this.itemsPerPage===u&&(l=c.getInstance().getItem(a.LISTING_OFFSET_MAP_KEY),l&&"string"==typeof l&&(l=JSON.parse(l))),l&&(s=l[this.category().route+"/"+this.pageNumber],s&&!isNaN(i.lastPublishedTimeStamp)&&new Date(parseInt(i.lastPublishedTimeStamp))>new Date(s.timestamp)&&(s=void 0)),s&&void 0!==s){var h=0;if(0!=s.actualOffset&&(h=this.itemsPerPage>this.blockSize?this.itemsPerPage%this.blockSize:this.blockSize%this.itemsPerPage),0===h)this.actualOffset=s.actualOffset,this.expandedOffset=s.expandedOffset,r[a.OFFSET]=this.actualOffset;else{var g=l[this.category().route+"/"+(this.pageNumber-1)];this.actualOffset=g.actualOffset,this.expandedOffset=g.expandedOffset,r[a.OFFSET]=this.actualOffset,this.data()[this.actualOffset+this.blockSize]||(r[a.LIMIT]=2*this.blockSize),this.skipOffSetMapUpdateOnBrowserBack=!0}}else 0==this.data().length?(this.actualOffset=0,this.expandedOffset=0,r[a.OFFSET]=this.actualOffset,r[a.LIMIT]=this.itemsPerPage*(this.pageNumber||1),this.skipOffSetMapUpdateOnRefresh=!0):this.data().length!==(this.pageNumber-1)*this.itemsPerPage&&(this.actualOffset=this.data()[this.data().length-1].offsetMap.actualOffset+this.previousGetProductsBlockSize-1,this.expandedOffset=this.data().length-1,r[a.OFFSET]=this.actualOffset,r[a.LIMIT]=this.itemsPerPage*(this.pageNumber||1),this.skipOffSetMapUpdateOnRefresh=!0)}}void 0==r[a.OFFSET]&&(this.actualOffset=e,this.expandedOffset=e,r[a.OFFSET]=this.actualOffset),"default"!==this.sortDirectiveProp()&&(r[a.SORTS]=this.sortDirectiveProp()+":"+this.sortDirectiveOrder()),
- t=a.ENDPOINT_PRODUCTS_LIST_PRODUCTS,this.category()&&(this.requesting&&this.currentRequest==this.category().id||(this.requesting=!0,n.create(this.productLoadingOptions),r[a.CATEGORY]=this.category().id,this.currentRequest=this.category().id,r.includeChildren=!0,null!=this.showInactiveProducts&&null!=this.showInactiveSkus&&(r.showInactiveProducts=this.showInactiveProducts,r.showInactiveSkus=this.showInactiveSkus),this.widget&&this.widget.fields&&this.widget.fields()&&(r.fields=this.widget.fields()),this.requesting=!0,r[a.STORE_PRICELISTGROUP_ID]=d.getInstance().selectedPriceListGroup().id,this.widget&&this.widget.productListing&&this.widget.productListing.filterKey&&(r[a.FILTER_KEY]=this.widget.productListing.filterKey),this.widget&&this.widget.productListingQueryParams&&this.widget.productListingQueryParams.size>0&&this.widget.productListingQueryParams.forEach(function(e,t){r[t]=e}),i.request(t,r,function(e){this.successFunc(e)}.bind(this),this.errorFunc.bind(this))))},h.prototype.buildResultsPerPageOption=function(e,t){return{id:t?a.RESULTS_PER_PAGE_ALL:"rec-per-page-"+e,displayText:t?o.t("ns.productlisting:resources.resultsPerPageOptionAll"):e,value:e}},h.prototype.buildResultsPerPage=function(e,t,r){var i=this;if(i.widget.showResultsPerPageSection&&i.widget.showResultsPerPageSection()){var o=[],n=0,s=i.widget.productsPerPage&&i.widget.productsPerPage()||a.DEFAULT_ITEMS_PER_PAGE;this.resultsPerPageOptions().length&&!this.categoryOrSearchChanged||(this.categoryOrSearchChanged=!1,$.each(a.RESULTS_PER_PAGE_SERIES,function(t,r){0!=t&&(n=s*r,n<e&&o.push(i.buildResultsPerPageOption(n)))}),o.push(i.buildResultsPerPageOption(e,!0)),this.resultsPerPageOptions(o))}},h.prototype.successFunc=function(e){var t=this.selectedResultsPerPageOption(),r=this.prevTotalNumber;if((this.widget.shouldUseStyleBased()||"true"==this.widget.shouldUseStyleBased())&&window.history&&window.history.pushState){this.totalExpandedResults=e.totalExpandedResults,this.totalResults=e.totalResults,this.previousGetProductsBlockSize=e.limit,this.buildResultsPerPage(this.totalExpandedResults,r,t);for(var i=this.previousGetProductsBlockSize/this.blockSize,o=[],n=0,s=0;s<i;s++){var l={};l.actualOffset=e.offset+this.blockSize*s;var d,p=this.expandProducts(e.items.slice(s*this.blockSize,(s+1)*this.blockSize),l);d=this.expandedOffset>=0?this.expandedOffset+o.length:Math.abs(this.expandedOffset)-o.length-p.length,l.expandedOffset=d,o=o.concat(p)}if(n=this.expandedOffset>=0?this.expandedOffset:Math.abs(this.expandedOffset)-o.length,o&&o.length>0){this.isCacheEnabled&&this.populateData(o,e.totalExpandedResults,n),this.addData(o,e.totalExpandedResults<0?0:e.totalExpandedResults,n),this.pageNumber>this.totalNumberOfPages()&&u.goTo(this.widget.links()[404].route,!0,!0);var h=!1;if(this.data().length==(this.pageNumber+1)*this.itemsPerPage&&(h=!0),this.pageNumberOffSetIndexMapForCategories){var g=!1,f=this.pageNumber,m=this.itemsPerPage;this.widget&&this.widget.productsPerPage&&!isNaN(this.widget.productsPerPage())&&(m=parseInt(this.widget.productsPerPage())),this.itemsPerPage!==m&&(f=m>parseInt(this.itemsPerPage)?this.pageNumber-Math.ceil(m/this.itemsPerPage):this.pageNumber+Math.ceil(Math.abs(m/this.itemsPerPage)));for(var I=0;I<this.pageNumberOffSetIndexMapForCategories.length;I++)if(this.pageNumberOffSetIndexMapForCategories[I].categoryId===this.category().id){for(var E=!1,y=0;y<this.pageNumberOffSetIndexMapForCategories[I].pageNumberOffSetIndexMap.length;y++)if(this.pageNumberOffSetIndexMapForCategories[I].pageNumberOffSetIndexMap[y].pageNumber===f){E=!0;break}if(E||this.pageNumberOffSetIndexMapForCategories[I].pageNumberOffSetIndexMap.push({pageNumber:f,offSetIndex:this.data().length-1}),E=!1,h){for(var y=0;y<this.pageNumberOffSetIndexMapForCategories[I].pageNumberOffSetIndexMap.length;y++)if(this.pageNumberOffSetIndexMapForCategories[I].pageNumberOffSetIndexMap[y].pageNumber===f+1){E=!0;break}E||this.pageNumberOffSetIndexMapForCategories[I].pageNumberOffSetIndexMap.push({pageNumber:f+1,offSetIndex:this.data().length-1})}E=!1,this.pageNumberOffSetIndexMapForCategories[I].pageNumberOffSetIndexMap=this.pageNumberOffSetIndexMapForCategories[I].pageNumberOffSetIndexMap.sort(function(e,t){return e.pageNumber-t.pageNumber}),g=!0;break}if(!g){var v=c.getInstance().getItem(a.LISTING_OFFSET_MAP_KEY);if(this.pageNumberOffSetIndexMapForCategories.push({categoryId:this.category().id,pageNumberOffSetIndexMap:[{pageNumber:this.pageNumber,offSetIndex:this.data().length-1}]}),1!=this.pageNumber&&v)for(var s=1;s<=this.totalNumberOfPages();s++)if(s!==this.pageNumber){var b=v[this.category().route+"/"+s];b&&b.offsetMapIndex&&this.pageNumberOffSetIndexMapForCategories[I].pageNumberOffSetIndexMap.push({pageNumber:y,offSetIndex:b.offsetMapIndex})}this.pageNumberOffSetIndexMapForCategories[I].pageNumberOffSetIndexMap=this.pageNumberOffSetIndexMapForCategories[I].pageNumberOffSetIndexMap.sort(function(e,t){return e.pageNumber-t.pageNumber})}}}else u.goTo(this.widget.links()[404].route,!0,!0)}else{this.totalResults=e.totalResults,this.buildResultsPerPage(this.totalResults,r,t);var T=[];if(e&&e.items&&e.items.length>0)for(var I=0,P=e.items.length;I<P;I++){var S={};S.product=e.items[I],T[I]=S}else u.goTo(this.widget.links()[404].route,!0,!0);this.isCacheEnabled&&this.populateData(T,e.totalResults,e.offset),this.addData(T,e.totalResults<0?0:e.totalResults,e.offset)}$.when(this.pageNumberDeferred).done(this.handleLinks),this.removeSpinner(),this.titleText(this.getTitleText()),this.requesting=!1},h.prototype.errorFunc=function(e){this.removeSpinner(),this.requesting=!1},h.prototype.populateData=function(e,t,r){var i,a,o=this.findCachedResultIndex();if(void 0==o){for(a=[],i=0;i<e.length;i+=1)a[i+r]=e[i];this.cachedViewModels.push({categoryId:this.category().repositoryId,viewModels:[],visitCount:0,sortKey:this.selectedSort().id,sortOrder:this.selectedSort().order(),products:a,totalResults:t}),this.cachedViewModels.length>this.viewModelCacheLimit&&this.cachedViewModels.splice(0,1)}else{for(a=this.cachedViewModels[o].products,i=0;i<e.length;i+=1)a[i+r]=e[i];this.cachedViewModels[o].products=a,this.cachedViewModels[o].viewModels.splice(r)}},h.prototype.expandProducts=function(t,r){var i,a,o,n,s=[],l=(this.widget.productListingTypes,[]),c=[],d=0;if(t)for(var u=0,p=t.length;u<p;u++){if(i=t[u],n=void 0,i.childSKUs.length>0&&i.productVariantOptions&&i.productVariantOptions.length>0&&(o={},e.utils.arrayForEach(i.productVariantOptions,function(e){e.listingVariant===!0&&e.variantBasedDisplay===!0&&(n=e)}),n)){c=i.variantValuesOrder[n.optionId];for(var h in n.optionValueMap)l[n.optionValueMap[h]]=h;for(var g=0,f=i.childSKUs.length;g<f;g++)if(a=i.childSKUs[g],!o[a[n.optionId]]||a.productListingSku){var m={};m.product=t[u],m.listingSku=a,o[a[n.optionId]]=m}var I=[];I=c&&c.length>0?c:l;for(var E=0;E<I.length;E++)o[I[E]]&&(s[d]=o[I[E]],s[d].offsetMap=r,d++)}if(void 0==n){var m={};m.product=t[u],s[d]=m,s[d].offsetMap=r,d++}}return s},h.prototype.getResultsText=function(){var e,t=this.pageStartIndex();return this.isLoadOnScroll()&&(t=0),s.formatNumber(this.totalNumber())&&(e=this.totalNumber()>0?o.t("ns.common:resources.productresultsText",{startIndex:s.formatNumber(t+1),endIndex:s.formatNumber(this.pageEndIndex()),totalProducts:s.formatNumber(this.totalNumber())}):o.t("ns.common:resources.emptyProductresultsText")),"ns.common:resources.productresultsText"===e&&(e=""),e},h.prototype.getTitleText=function(){var e="";return e=this.category()?this.category().displayName:o.t("ns.common:resources.TitleText")},h}),define("viewModels/productListingSearchViewModel",["knockout","viewModels/productListingViewModel","pubsub","CCi18n","ccConstants","ccNumber","navigation","pageLayout/product","pageLayout/search"],function(e,t,r,i,a,o,n,s,l){"use strict";function c(r){var i=this;i.initializationComplete=e.observable(!1),t.call(this),i.widget=r,i.initialize(),i.itemsPerRowInDesktopView=e.observable(4),i.itemsPerPage=a.DEFAULT_ITEMS_PER_PAGE,i.blockSize=a.DEFAULT_ITEMS_PER_PAGE,i.currentProductsComputed=e.observableArray([]),i.currentProducts=e.computed(function(){var t;this.pageProductsTemp=[],this.productGridRefreshOrAppend=!0;var r,i;r=(this.currentPage()-1)*this.itemsPerPage,i=r+this.itemsPerPage;var o=this.data.peek();t=o.slice(r,i);for(var n,l,c=this.isLoadOnScroll.peek(),d=[],u=t.length,p=0;p<u;p++)t[p]&&(t[p].attributes&&t[p].attributes[a.SEARCH_RECORD_COLLECTION]?(d.push(t[p]),this.pageProductsTemp.push(t[p])):(n=new s(t[p]),l=this.listingImageSize(),n.listingImageURL=e.observable(n.primaryFullImageURL()+"&width="+l+"&height="+l),n.listingSku&&(n.listingSku.route=n.listingSku.route(),n.listingSku.images=n.listingSku.images()),d.push(n),this.pageProductsTemp.push(n)),(this.pageProductsTemp.length>0&&this.pageProductsTemp.length%this.itemsPerRow()===0||c&&this.totalNumber.peek()-this.scrolledViewModels.length===this.pageProductsTemp.length||!c&&p+1===u)&&(this.scrolledViewModels.push.apply(this.scrolledViewModels,this.pageProductsTemp),this.productGridExtension||this.viewportMode()!=a.TABLET_VIEW&&this.viewportMode()!=a.PHONE_VIEW?this.currentProductsComputed(this.pageProductsTemp.splice(0)):this.currentProductsComputed(this.scrolledViewModels),this.pageProductsTemp=[],this.productGridRefreshOrAppend=!1));return $("#typeaheadDropdown").hide(),this.setFocus(),this.isLoadOnScroll.peek()?this.scrolledViewModels:d},this).extend({deferred:!0}),i.assemblerPagesPath=r.assemblerPagesPath,i.ntk=r.ntk,i.additionalSearchQueryParams=r.additionalSearchQueryParams}var d=l.getInstance(),u=function(){};return u.prototype=t.prototype,c.prototype=new u,c.prototype.constructor=c,c.base=t.prototype,c.prototype.itemsPerRowInTabletView=e.observable(4),c.prototype.itemsPerRowInPhoneView=2,c.prototype.itemsPerRowInDesktopView=e.observable(4),c.prototype.itemsPerRowInLargeDesktopView=e.observable(4),c.prototype.itemsPerRow=e.observable(4),c.prototype.type="ProductListingSearchViewModel",c.prototype.searchFailed=e.observable(!1),c.prototype.idToSearchIdMap={displayName:"product.relevance",listPrice:"sku.activePrice"},c.prototype.category=e.observable(),c.prototype.listingImageSize=e.observable(300),c.prototype.initialize=function(){var t=this;t.searchResults=[],t.recordsPerPage=e.observable(a.DEFAULT_SEARCH_RECORDS_PER_PAGE),t.searchAdjustments={},t.breadcrumbs={},t.navigation={},t.pageCount=0,t.recordOffSet=0,t.searchTerms=e.observableArray([]),t.adjustedSearchTerms=e.observableArray([]),t.suggestedSearches=e.observableArray([]),t.navigationDescriptors=e.observable(),t.display=e.observable(!0),t.totalNumber(0),t.pageStartIndex(0),t.pageEndIndex(0),t.searchText=e.observable(),t.resultsText=e.observable(),t.categoryName=e.observable(),t.noSearchResultsText=e.observable(),t.pageLoadedText=e.observable();$.Topic(r.topicNames.CATEGORY_CRUMB_UPDATED).subscribe(function(e){t.categoryName(e)}),$.Topic(r.topicNames.SEARCH_RESULTS_UPDATED).subscribe(function(e){if(t.noSearchResultsText(""),e.message===a.SEARCH_MESSAGE_FAIL)t.searchFailed(!0),n.goTo(t.widget.links().noSearchResults.route,!1,!0),$.Topic(r.topicNames.SEARCH_FAILED_TO_PERFORM).publish();else{if(!(0!==this.totalRecordsFound||this.searchAdjustments&&this.searchAdjustments.suggestedSearches))return n.goTo(t.widget.links().noSearchResults.route,!1,!0),$.Topic(r.topicNames.SEARCH_TERM).publishWith(this.searchAdjustments.originalTerms,[{message:"success"}]),void t.display(!1);t.display(!0),t.buildResultsPerPage(this.totalRecordsFound,t.prevTotalNumber,t.selectedResultsPerPageOption()),t.totalNumber(this.totalRecordsFound),this.searchAdjustments&&t.searchTerms(this.searchAdjustments.originalTerms),this.searchAdjustments&&this.searchAdjustments.adjustedSearches?t.adjustedSearchTerms(this.searchAdjustments.adjustedSearches[t.getSearchTerms()]):t.adjustedSearchTerms([]),this.searchAdjustments&&this.searchAdjustments.suggestedSearches?(t.formatSuggestedSearches(this.searchAdjustments.suggestedSearches[t.getSearchTerms()]),t.suggestedSearches(this.searchAdjustments.suggestedSearches[t.getSearchTerms()])):t.suggestedSearches([]),t.searchFailed(!1),this.pagingActionTemplate&&t.navigationDescriptors(t.getParameterByName(this.pagingActionTemplate.link?this.pagingActionTemplate.link:this.pagingActionTemplate.navigationState,a.SEARCH_NAV_DESCRIPTORS_KEY)),this.isNewSearch===!0?(t.clearOnLoad=!0,"displayName"!==t.sortDirectiveProp()&&t.selectedSort(t.sortOptions()[0])):t.clearOnLoad=!1,this.searchResults&&this.searchResults.length>0?t.addData(this.searchResults,t.totalNumber(),this.recordOffSet):(t.targetPage=1,this.searchAdjustments.suggestedSearches||n.goTo(t.widget.links()[404].route,!0,!0)),t.titleText(t.getTitleText(this.searchResults.length)),t.resultsText(t.getResultsText()),t.pageLoadedText(t.getPageLoadedText())}}),t.initializationComplete(!0)},c.prototype.getPageLoadedText=function(){var e=i.t("ns.common:resources.searchPageLoadedText",{results:this.resultsText(),searchTerm:this.searchTerms()[0]});return e},c.prototype.getPage=function(e){this.resultsText(""),this.clickedPage(e),this.adjustStartAndEndPageIndex(e),e!==this.currentPage()&&e!==this.targetPage&&this.isMobileView()&&$.Topic(r.topicNames.RECORD_PAGINATION_PAGE_CHANGE).publish(),e===this.currentPage()&&null!==this.targetPage&&void 0!==this.targetPage||(this.targetPage=e),(this.parameters||"product.relevance"!==c.prototype.idToSearchIdMap[this.sortDirectiveProp()])&&this.fetchBlock(this.pageStartIndex()),this.setFocus()},c.prototype.getParameterByName=function(e,t){var r=new RegExp("[\\?&]"+t+"=([^&#]*)"),i=r.exec(e);return null===i?"":i[1]},c.prototype.fetchBlock=function(e){this.initializationComplete()&&(this.recordOffSet=e,this.searchText(this.searchTerms().length>0?this.searchTerms()[0]:""),this.blockSize=this.itemsPerPage,($(window)[0].innerWidth||$(window).width())<a.VIEWPORT_TABLET_UPPER_WIDTH&&(this.recordOffSet=0,this.blockSize=e+this.recordsPerPage()),this.submitSearch())},c.prototype.submitSearch=function(){var e="",t="";this.searchText().trim()&&(e=a.PRODUCT_DISPLAYABLE+a.SEARCH_PROPERTY_SEPARATOR+this.searchText().trim()),this.parameters&&this.parameters.searchType&&(t=this.parameters.searchType);var i={getFromUrlParam:!0,newSearch:!1,recordsPerPage:this.blockSize,recordOffSet:this.recordOffSet,recDYMSuggestionKey:this.recDYMSuggestionKey,suppressResults:!1,searchType:t};if(this.parameters.Ns){var o=decodeURIComponent(this.parameters.Ns).split("|");2===o.length&&(i.sortDirectiveProperty=o[0],i.sortDirectiveOrder="1"==o[1]?"desc":"asc")}else this.sortDirectiveProp("displayName");this.useGenericSort||"product.relevance"===c.prototype.idToSearchIdMap[this.sortDirectiveProp()]||(i.sortDirectiveProperty=c.prototype.idToSearchIdMap[this.sortDirectiveProp()],i.sortDirectiveOrder="product.relevance"==i.sortDirectiveProperty?"none":this.sortDirectiveOrder()),this.assemblerPagesPath&&this.ntk&&(i.searchInterface=this.ntk),this.additionalSearchQueryParams&&(i.additionalSearchQueryParams=this.additionalSearchQueryParams),$.Topic(r.topicNames.SEARCH_CREATE).publishWith(i,[{message:"success",assemblerPagesPath:this.assemblerPagesPath}])},c.prototype.getResultsText=function(){var e=this.pageStartIndex(),t="";if(0!==this.totalNumber()){if(this.isLoadOnScroll()&&(e=0),this.searchFailed&&!this.searchFailed()){var r=this.getSearchTerms(),a="ns.common:resources.searchresultsText",n=this.pageEndIndex();this.pageEndIndex()>this.totalNumber()&&(n=this.totalNumber()),o.formatNumber(this.totalNumber())&&(t=i.t(a,{count:o.formatNumber(this.totalNumber()),searchterm:r,startIndex:o.formatNumber(e+1),endIndex:o.formatNumber(n)}))}else t=i.t("ns.common:resources.searchFailedText");return t}},c.prototype.getSearchTerms=function(){var t="",r=0;return this.searchTerms&&e.utils.arrayForEach(this.searchTerms(),function(e){t=0===r?e:t+" "+e,r++}),t},c.prototype.getTitleText=function(e){var t="";return""==this.getSearchTerms()?t=this.categoryName():this.adjustedSearchTerms().length>0?(t=i.t("ns.common:resources.searchText",{searchTerm:'"'+this.adjustedSearchTerms()[0].adjustedTerms+'"'}),this.noSearchResultsText(i.t("ns.common:resources.noSearchResultsText",{searchTerm:'"'+this.getSearchTerms()+'"'}))):this.suggestedSearches().length>0&&0===e?this.noSearchResultsText(i.t("ns.common:resources.noSearchResultsText",{searchTerm:'"'+this.getSearchTerms()+'"'})):t=i.t("ns.common:resources.searchText",{searchTerm:'"'+this.getSearchTerms()+'"'}),t},c.prototype.pagesFunction=function(){var e,t,r,i;this.clearOnLoad&&this.adjustStartAndEndPageIndex(this.pageNumber),this.totalNumber()?(t=(this.totalNumber()-this.totalNumber()%this.itemsPerPage)/this.itemsPerPage,r=this.totalNumber()%this.itemsPerPage>0?1:0,e=t+r):e=0,d.contextData&&n.getPathWithoutLocale("/"+n.getPath())==d.contextData.global.links.searchresults.route?this.totalNumberOfPages(e):window.clientConfigData&&window.clientConfigData.useEnhancedSearch&&"true"==window.clientConfigData.useEnhancedSearch&&d.contextData&&n.getPathWithoutLocale("/"+n.getPath()).indexOf(d.contextData.global.links.searchresults.route)!==-1&&this.totalNumberOfPages(e),this.adjustPageIndex(this.pageNumber);var a=[];for(i=0;i<e;i++){var o={};o.pageNumber=i+1,o.selected=o.pageNumber===this.currentPage(),a.push(o)}var s=[];if(this.pageWindowSize>=e)s=a.slice(0);else{var l=this.startIndex+this.pageWindowSize;l>e&&(l=e),s=a.slice(this.startIndex,l)}return s},c.prototype.formatSuggestedSearches=function(e){$.each(e,function(e,t){t.clickSuggestion=function(){n.goTo(a.SEARCH_RESULTS_HASH+d.getFilteredNavState(this.link?this.link:this.navigationState)+"&"+a.SEARCH_TYPE+"="+a.SEARCH_TYPE_SIMPLE+"&"+a.PARAMETERS_TYPE+"="+a.PARAMETERS_SEARCH_QUERY)}})},c.prototype.setFocus=function(){var e=$("#region-megaMenu").next().attr("id"),t="#"+e+" :focusable";$(t).first().focus()},c}),define("viewModels/productListingViewModelFactory",["viewModels/productListingViewModel","viewModels/productListingSearchViewModel","ccConstants"],function(e,t,r){"use strict";function i(){if(null!==a)throw new Error("Cannot instantiate more than one ProductListingViewModelFactory, use ProductListingViewModelFactory.getInstance()")}var a=null;return i.prototype={createListingViewModel:function(e){var t,i=e.listType();return i===r.LIST_VIEW_PRODUCTS&&(t=this.createProductListingViewModel(e)),i===r.LIST_VIEW_SEARCH&&(t=this.createProductListingSearchViewModel(e)),t.listType=i,t},createProductListingViewModel:function(t){return new e(t)},createProductListingSearchViewModel:function(e){return new t(e)}},i.getInstance=function(){return null===a&&(a=new i),a},i.getInstance()}),define("viewModels/searchTypeahead",["knockout","pubsub","ccConstants","CCi18n","navigation","jquery","ccNumber","pageLayout/product","pageLayout/site","ccRestClient","bstypeahead","bootstrap"],function(e,t,r,i,a,o,n,s,l,c){"use strict";function d(e,t,i,a,o,n){if(null!==u)throw new Error("Cannot instantiate more than one SearchTypeahead, use SearchTypeahead.getInstance()");v=t.symbol,v.match(/^[0-9a-zA-Z]+$/)&&(v+=" "),b=t.fractionalDigits,this.productURLRoot=i?i:p,this.searchResultPage=a?a:r.SEARCH_RESULTS_HASH,_=null!=o&&o,C=null==n?null:n,this.initialize(e)}var u=null,p="/product/";r.ALLOW_HASHBANG&&(p="#!"+p);var h="ns.common:resources.",g="--noMatchesFound--",f="close",m="showall",I=2,E=c.getStoredValue(r.LOCAL_STORAGE_USER_CONTENT_LOCALE);E=null!=E?JSON.parse(E)[0].name:o(":root").attr("lang"),"zh_CN"!=E&&"zh_TW"!=E||(I=1);var y,v,b,T=5,P=300,S=10,C=e.observable(null),_=e.observable(!1),A=e.observable(!1),O=e.observable(!1),R=e.observable("/img/no-image.jpg");return o.fn.typeahead.Constructor.prototype.keyup=function(e){switch(e.keyCode){case 9:case 40:case 38:case 16:case 17:case 18:break;case 13:if(!this.shown)return;A(!0),this.select();break;case 27:if(!this.shown)return;this.hide();break;default:this.lookup()}e.stopPropagation(),e.preventDefault()},o.fn.typeahead.Constructor.prototype.move=function(e){if(this.shown){switch(e.keyCode){case 13:case 27:e.preventDefault();break;case 38:"keyup"==e.type&&(e.preventDefault(),this.prev());break;case 9:if(e.preventDefault(),e.stopPropagation(),e.shiftKey){var t=this.$menu.find(".active").removeClass("active"),r=t.prev();if(!r.length){if(!this.shown)return;this.hide()}r.addClass("active")}else{var t=this.$menu.find(".active").removeClass("active"),i=t.next();i.length||(0==i.prevObject.length&&this.$menu.find("li").length>1?i=o(this.$menu.find("li")[0]):this.$element.next().next().focus()),0===i.length?o("#desktopSearchSubmit").focus():i.addClass("active")}break;case 40:"keydown"==e.type&&(e.preventDefault(),this.next())}e.stopPropagation()}},o.fn.typeahead.Constructor.prototype.blur=function(e){if(this.focused=!1,!this.mousedover&&this.shown)return this.$menu.hide(),this},d.prototype={initialize:function(e){if(void 0===e)throw new Error("Cannot instantiate SearchTypeahead, without a selector");o(e).typeahead({source:this.typeaheadSource,minLength:I,items:T,matcher:this.typeaheadMatch,sorter:this.typeaheadSort,updater:this.typeaheadUpdater,highlighter:this.typeaheadHighlight,render:this.typeaheadRender,select:this.typeaheadSelect,hide:this.typeaheadHide,menu:"<ul id='typeaheadDropdown' class='typeahead dropdown-menu' aria-live='polite'></ul>",item:"<li class='typeaheadProduct'><a href='#' onclick = $('#typeaheadDropdown').hide()> <img class='typeaheadProductThumbnail visible-md visible-lg img-responsive'/> <span class='typeaheadProductName'></span> <span class='typeaheadProductPrice'></span> </a></li>"}),o.Topic(t.topicNames.SEARCH_TYPEAHEAD_UPDATED).subscribe(this.typeaheadResults),o.Topic(t.topicNames.SEARCH_TYPEAHEAD_CANCEL).subscribe(this.typeaheadCancel.bind(this))},typeaheadUpdater:function(e){return e},typeaheadSource:function(e,r){y=this,this.render=this.options.render||this.render,this.select=this.options.select||this.select,this.hide=this.options.hide||this.hide;var i=y.query;if(this.searchQuery="",this.$menu.css("width",this.$element.width()-S/2),this.$menu.css("margin-left",S),l.getInstance().noImageSrc()&&""!=l.getInstance().noImageSrc()){R(l.getInstance().noImageSrc());var a=new Image;a.onerror=function(){R("/img/no-image.jpg")},a.src=l.getInstance().noImageSrc()}this.timer&&clearTimeout(this.timer);var n=function(){y.callback=r,y.query=y.query?y.query:i,y.searchQuery=y.query,o.Topic(t.topicNames.SEARCH_TYPEAHEAD).publishWith({searchText:y.query,recordsPerPage:T,recordOffSet:0},[{message:"success"}])};this.timer=setTimeout(n,P)},typeaheadResults:function(e){if(y&&y.focused&&!O()&&"none"==o("#typeaheadDropdown").css("display")&&(o("#alert-modal-change").text(i.t("ns.common:resources.searchDropdownOpenedText")),O(!0)),y&&y.focused&&y.options){var t,a,n=[],s=this[0]?this[0]:[],l=this[1]?this[1]:[];o.each(l,function(e,i){if(i.records[0]){var s=i.records[0],l={};l.id=s.attributes["product.repositoryId"][0],s.attributes["product.displayName"]?l.name=s.attributes["product.displayName"][0]:l.name="",(o(window)[0].innerWidth||o(window).width())>r.VIEWPORT_TABLET_LOWER_WIDTH&&(l.thumb=s.attributes["sku.listingThumbImageURL"]?s.attributes["sku.listingThumbImageURL"]:s.attributes["product.primaryThumbImageURL"]?s.attributes["product.primaryThumbImageURL"][0]:R(),l.noImageSrc='src="'+R()+'"',"/img/no-image.jpg"==l.thumb&&(l.thumb=R(),l.noImageSrc='src="/img/no-image.jpg"')),s.attributes["product.primaryImageTitle"]&&(l.primaryImageTitle=s.attributes["product.primaryImageTitle"][0]),(l.primaryImageAltText=s.attributes["product.primaryImageAltText"])&&(l.primaryImageAltText=s.attributes["product.primaryImageAltText"][0]),l.link=s.attributes["product.route"][0],Array.isArray(s.attributes["sku.styleProperty"])&&(t=s.attributes["sku.styleProperty"][0],t&&(Array.isArray(s.attributes["sku."+t])&&(a=s.attributes["sku."+t][0]),a&&(l.link=l.link+"?variantName="+t+"&variantValue="+a))),l.price="",n.push(l)}}),o.each(s,function(e,t){if(t.id[0]===n[e].id){var r=function(e){var t,r,i,a,o,n=e.childSKUs?e.childSKUs.length:0;if(e.minActivePrice)return e.minActivePrice;if(t=e.salePrice||0===e.salePrice?e.salePrice:e.listPrice,e.childSKUs)if(n>0)for(var o in e.childSKUs)i=e.childSKUs[o],a=i.salePrice||0===i.salePrice?i.salePrice:i.listPrice,a||0==a||(a=t),(!r&&0!=r||a<r)&&(r=a);else r=t;return r}(t);n[e].price=r}}),n.length||n.push({id:g,name:"",price:"",thumb:"",link:""}),y.callback&&"function"==typeof y.callback&&y.callback(n)}},typeaheadCancel:function(){y=this,y.timer&&clearTimeout(y.timer)},typeaheadMatch:function(e){return!0},typeaheadSort:function(e){return e},typeaheadHighlight:function(e){return e},typeaheadRender:function(e){if(1===e.length&&e[0].id===g){var t=i.t(h+"noMatchesFound");return this.$menu.html(o("<li class='typeaheadTop' disabled>").text(t)),this}e=o(e).map(function(e,t){e=o(y.options.item).attr("data-value",t.name),_?null!=C&&e.find("a").attr("href","#").on("click",function(e){return C.getProductDetails.call(C,t.id,_),e.preventDefault(),!1}):e.find("a").attr("href",a.getPathWithLocale(t.link)).on("click",function(e){var t=o(this).attr("href");return a.goTo(t),e.preventDefault(),!1}),e.find("a").attr("title",t.name),e.find("a").attr("id",t.id),e.find(".typeaheadProductThumbnail").attr("src",t.thumb),e.find(".typeaheadProductThumbnail").attr("alt",t.primaryImageAltText),e.find(".typeaheadProductThumbnail").attr("title",t.primaryImageTitle),e.find(".typeaheadProductThumbnail").attr("onError",t.noImageSrc),e.find(".typeaheadProductName").html(t.name);var r,s=parseFloat(t.price).toFixed(b).toString();if("NaN"===s||""===s||null===s)r=i.t(h+"priceUnavailable");else{var l=s.split(".");r=n.formatNumber(l[0],!0),0===b?r=r.substring(0,r.length-3):(r=r.substring(0,r.length-2),r+=l[1]),r=v+r}return e.find(".typeaheadProductPrice").text(r),e[0]}),e.first().addClass("firstResult");var r=i.t(h+"closeText"),s=i.t(h+"showAllResultsText");return this.$menu.html(e),this.$menu.prepend(o("<li/>").attr({class:"typeaheadClose","data-value":f}).append(o("<a/>").attr({href:"#",tabindex:"0"}).text(r))),this.$menu.prepend(o("<li/>").attr({class:"typeaheadAllProducts visible-lg visible-md","data-value":m}).append(o("<a/>").attr({href:"#",title:"Show all results"}).text(s))),this},typeaheadSelect:function(){var e=this.$menu.find(".active"),t=e.children("a").attr("href"),i=e.children("a").attr("id");if(t&&""!==t&&"#"!==t)window.location=t;else if(t&&"#"===t&&_&&null!=C&&null!=i)C.getProductDetails.call(C,i,_);else{var n=e.attr("data-value");if(n===m||!e.length){u.typeaheadCancel(),this.searchQuery=this.query;var s;A()?(s=o.trim(this.query),A(!1)):s=this.query.trim()+r.SEARCH_WILDCARD,0!=s.length&&a.goTo(u.searchResultPage+"?"+r.SEARCH_TERM_KEY+"="+encodeURIComponent(s)+"&"+r.SEARCH_RANDOM_KEY+"="+Math.floor(1e3*Math.random())+"&"+r.SEARCH_TYPE+"="+r.SEARCH_TYPE_SIMPLE+"&"+r.PARAMETERS_TYPE+"="+r.PARAMETERS_SEARCH_QUERY)}}return this.hide()},typeaheadHide:function(){return this.$element.val()===this.searchQuery&&this.$element.val("").change(),this.$menu.hide(),this.shown=!1,O()&&"none"==o("#typeaheadDropdown").css("display")&&(o("#alert-modal-change").text(i.t("ns.common:resources.searchDropdownClosedText")),O(!1)),this}},d.performTypeAhead=function(e){this.timer&&clearTimeout(this.timer);var r=function(){o.Topic(t.topicNames.SEARCH_TYPEAHEAD).publishWith({typeaheadConfig:e},[{message:"success"}])};this.timer=setTimeout(r,P)},d.getTypeAheadDefaultQueryParams=function(){var e=new Map;return e.set("Ntk","TypeAhead"),e.set("Ntx","mode matchany"),e.set("No","0"),e.set("Nrpp","5"),e.set("typeaheadMinLength",I),e},d.getInstance=function(e,t,r,i,a,o){return u=null,u=new d(e,t,r,i,a,o)},d}),define("viewModels/giftProductListingViewModel",["knockout","pubsub","ccConstants","pageLayout/product","ccRestClient","ccStoreConfiguration"],function(e,t,r,i,a,o){"use strict";function n(e,t){var r=this;return r.products=r.getProductsInfo(e),r}return n.prototype.storeConfiguration=o.getInstance(),n.prototype.getProductsInfo=function(e){for(var t=[],a=0;a<e.length;a++){var o={};e[a].hasOwnProperty(r.INVENTORY_PRODUCT_TYPE)&&(o=new i(e[a][r.INVENTORY_PRODUCT_TYPE])),t[a]={},t[a]=o}return t},n.prototype.getGiftProductChoices=function(e){if(null!=e.giftWithPurchaseDetail&&null!=e.giftWithPurchaseType){var t,i={};i[r.GIFT_WITH_PURCHASE_DETAIL]=e.giftWithPurchaseDetail,i[r.GIFT_WITH_PURCHASE_TYPE]=e.giftWithPurchaseType;var o={};o[r.ENDPOINT_KEY]=r.ENDPOINT_GET_GIFT_CHOICES;var n=this.storeConfiguration.getFilterToUse(o);n&&(i[r.FILTER_KEY]=n),t=r.ENDPOINT_GET_GIFT_CHOICES,a.request(t,i,this.getGiftChoicesSuccessFunc.bind(this,e.id),this.getGiftChoicesFailureFunc.bind(this))}},n.prototype.getGiftChoicesSuccessFunc=function(e,r){if(r&&r.length>0){var i=new n(r);$.Topic(t.topicNames.GET_GIFT_CHOICES_SUCCESSFUL).publishWith([i,e],[{message:"success"}])}else $.Topic(t.topicNames.GIFT_CHOICES_NOT_AVAILABLE).publish()},n.prototype.getGiftChoicesFailureFunc=function(e){$.Topic(t.topicNames.GET_GIFT_CHOICES_FAILURE).publishWith(e,[{message:"failure"}])},n});
- //# sourceMappingURL=main.js.map
|