{"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///../codebase/storefront-reference-architecture/cartridges/app_storefront_base/cartridge/client/default/js/components/focus.js","webpack:///../codebase/storefront-reference-architecture/cartridges/app_storefront_base/cartridge/client/default/js/components/scrollAnimate.js","webpack:///../codebase/storefront-reference-architecture/cartridges/app_storefront_base/cartridge/client/default/js/util.js","webpack:///../codebase/tkooples/cartridges/app_core_tkooples/cartridge/client/default/js/pdpZoom/pdpZoom.js","webpack:///../codebase/tkooples/cartridges/app_core_tkooples/cartridge/client/default/js/product/base.js","webpack:///../codebase/tkooples/cartridges/app_core_tkooples/cartridge/client/default/js/product/detail.js","webpack:///../codebase/tkooples/cartridges/app_core_tkooples/cartridge/client/default/js/product/stockStore.js","webpack:///../codebase/tkooples/cartridges/app_core_tkooples/cartridge/client/default/js/productDetail.js","webpack:///../codebase/tkooples/cartridges/app_core_tkooples/cartridge/client/default/js/updateQuantuty.js","webpack:///../codebase/tkooples/node_modules/@panzoom/panzoom/dist/panzoom.js"],"names":[],"mappings":";QAAA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;;QAEA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;;;QAGA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA,0CAA0C,gCAAgC;QAC1E;QACA;;QAEA;QACA;QACA;QACA,wDAAwD,kBAAkB;QAC1E;QACA,iDAAiD,cAAc;QAC/D;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA,yCAAyC,iCAAiC;QAC1E,gHAAgH,mBAAmB,EAAE;QACrI;QACA;;QAEA;QACA;QACA;QACA,2BAA2B,0BAA0B,EAAE;QACvD,iCAAiC,eAAe;QAChD;QACA;QACA;;QAEA;QACA,sDAAsD,+DAA+D;;QAErH;QACA;;;QAGA;QACA;;;;;;;;;;;;;AClFa;;AAEb;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,kDAAkD;AAClD;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;AClCa;;AAEb;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;;;;;;;;;;;;;ACVa;;AAEb;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;;;;;;;;;;;;ACZA,gBAAgB,mBAAO,CAAC,yGAA+B;;AAEvD;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,+CAA+C,kBAAkB;AACjE;AACA,KAAK;AACL,8CAA8C,aAAa;AAC3D,+CAA+C,aAAa;AAC5D,gDAAgD,mBAAmB;AACnE;;;AAGA;AACA,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA,mCAAmC,yDAAyD,EAAE,KAAK;AACnG;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA,iBAAiB;AACjB;AACA,aAAa;;AAEb,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB,aAAa;AACb,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA,SAAS;AACT;AACA;;;;;;;;;;;;;AC9Ga;AACb,kBAAkB,mBAAO,CAAC,2JAAuB;AACjD,OAAO,iBAAiB,GAAG,mBAAO,CAAC,0HAAmB;AACtD;AACA;AACA,WAAW,OAAO;AAClB,YAAY,OAAO;AACnB;AACA;AACA;;AAEA;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA;;AAEA;AACA;;AAEA;AACA;AACA,WAAW,OAAO;AAClB,YAAY,OAAO;AACnB;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;;AAEA;AACA;AACA,WAAW,OAAO;AAClB,YAAY,OAAO;AACnB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,SAAS;AACpB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,QAAQ;AACnB;AACA;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;;AAEA;AACA;AACA,SAAS;AACT;AACA;;AAEA;AACA;;AAEA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,SAAS;AACpB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,QAAQ;AACnB;AACA;AACA,WAAW,OAAO;AAClB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB;AACA,WAAW,OAAO;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA,WAAW,MAAM;AACjB,YAAY,OAAO;AACnB;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA,KAAK;;AAEL;AACA;;AAEA;AACA;AACA;AACA,cAAc,OAAO;AACrB,cAAc,OAAO;AACrB;;AAEA;AACA;AACA;AACA,cAAc,OAAO;AACrB,cAAc,OAAO;AACrB,cAAc,OAAO;AACrB,cAAc,qBAAqB;AACnC;;AAEA;AACA;AACA;AACA,WAAW,wBAAwB;AACnC,WAAW,OAAO;AAClB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,WAAW,SAAS;AACpB,WAAW,OAAO;AAClB;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,iBAAiB;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,SAAS;AACpB,WAAW,SAAS;AACpB,WAAW,QAAQ;AACnB;AACA;AACA,WAAW,OAAO;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA,SAAS;AACT,KAAK;AACL;AACA;AACA;AACA,SAAS;AACT;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,cAAc,QAAQ;AACtB,cAAc,OAAO;AACrB,cAAc,OAAO;AACrB;AACA;;AAEA;AACA;AACA,WAAW,kBAAkB;AAC7B,WAAW,OAAO;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,0CAA0C,qCAAqC,IAAI,0DAA0D,sBAAsB,cAAc;AACjL,sBAAsB;AACtB;AACA;AACA;;AAEA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB;AACA;AACA;AACA;AACA,aAAa,sDAAsD;AACnE;AACA;AACA;;AAEA;AACA;AACA;AACA,kBAAkB;AAClB;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB,2CAA2C;AAChE;AACA;AACA,0FAA0F,sBAAsB;AAChH;AACA;AACA;AACA;AACA;;AAEA,uDAAuD,UAAU,cAAc,WAAW,YAAY,SAAS;;AAE/G,aAAa;AACb;AACA;AACA;AACA,SAAS;AACT,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;;AAEA;AACA;AACA;AACA,YAAY,OAAO;AACnB;AACA;AACA;AACA;;AAEA;AACA;AACA,WAAW,OAAO;AAClB;AACA,YAAY,OAAO;AACnB;AACA;AACA;;AAEA;AACA;;AAEA,YAAY;AACZ;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mDAAmD;AACnD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA,WAAW,OAAO;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,YAAY,SAAS;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,KAAK;;AAEL;AACA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB,YAAY,OAAO;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;;AAEA;AACA;AACA;AACA,WAAW,iBAAiB;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,SAAS;AACT;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA,SAAS;AACT,KAAK;;AAEL;AACA;AACA;AACA,SAAS;AACT,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,KAAK;;AAEL;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,SAAS;AACT,KAAK;;AAEL;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,KAAK;;AAEL;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,SAAS;AACT,KAAK;;AAEL;AACA;;AAEA;AACA;AACA,aAAa;AACb;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,yBAAyB;AACzB;AACA,iBAAiB;AACjB;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iCAAiC;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6BAA6B;AAC7B;AACA,qBAAqB;AACrB;AACA;AACA;AACA,iBAAiB;AACjB;AACA,SAAS;AACT,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA,SAAS;AACT,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;;AAEA;AACA;AACA,SAAS;AACT,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA,aAAa;AACb,SAAS;AACT,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yBAAyB;AACzB,qBAAqB;AACrB;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yBAAyB;AACzB;AACA,iBAAiB;AACjB;AACA;AACA;AACA,aAAa;AACb,SAAS;AACT,KAAK;;AAEL;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA,GAAG;;;;;;;;;;;;;AC59BU;AACb,WAAW,mBAAO,CAAC,6GAAQ;AAC3B,iBAAiB,mBAAO,CAAC,yHAAc;AACvC,cAAc,mBAAO,CAAC,4HAAoB;AAC1C,oBAAoB,mBAAO,CAAC,2KAA+B;;AAE3D;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,WAAW,QAAQ;AACnB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6D;AACA,wD;AACA;AACA,SAAS;AACT,gE;AACA,2D;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6D;AACA,wD;AACA;AACA,SAAS;AACT,gE;AACA,2D;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,CAAC;;;AAGD;AACA;AACA;AACA;AACA,KAAK;AACL,CAAC;;AAED;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA,CAAC;;AAED;AACA;AACA;AACA,KAAK;;AAEL;;AAEA;;AAEA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA;AACA;AACA;AACA,iEAAiE,IAAI;AACrE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX,KAAK;;AAEL;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,SAAS;AACT,KAAK;;AAEL;AACA;AACA;AACA,SAAS;AACT,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA,iBAAiB;AACjB;AACA,SAAS;;AAET;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,SAAS;AACT,KAAK;AACL;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA,aAAa;AACb;AACA;;AAEA;AACA;;AAEA;AACA;AACA,aAAa;AACb;AACA,SAAS;AACT,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yBAAyB;;AAEzB;AACA;AACA;AACA,yBAAyB;;AAEzB;AACA;AACA;;AAEA;AACA;;AAEA;AACA,aAAa;AACb,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb,SAAS;AACT,KAAK;;;;AAIL;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,UAAU;AACV;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,KAAK;AACL,8CAA8C,uCAAuC;;AAErF;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,iBAAiB;AACjB,aAAa;AACb,SAAS;AACT;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,iBAAiB;AACjB,aAAa;;AAEb;AACA;;AAEA;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,6CAA6C,IAAI,QAAQ,IAAI,QAAQ,IAAI,4BAA4B,IAAI,OAAO,IAAI;;AAEpH;AACA;AACA;AACA;;AAEA;AACA;AACA,SAAS;AACT;AACA;AACA,KAAK;;AAEL;AACA;;AAEA;AACA;AACA,WAAW,EAAE;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA,KAAK;AACL;;AAEA;;AAEA;;AAEA,gBAAgB;;AAEhB;;;AAGA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK,Q;AACL,CAAC;;AAED;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;;AAEA;AACA,qD;AACA,gD;AACA;;AAEA,gE;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,CAAC;;;AAGD;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA,uFAAuF,UAAU;AACjG;AACA,CAAC;;;AAGD;AACA;AACA,C;;;;;;;;;;;ACnnBA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA,uD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB,aAAa;AACb;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB,aAAa;AACb;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;;AAEA;AACA;;AAEA;;;;;;;;;;;;;AC5Fa;;AAEb,qBAAqB,mBAAO,CAAC,mIAAW;;AAExC;AACA,mBAAmB,mBAAO,CAAC,yHAAkB;AAC7C,CAAC;;;;;;;;;;;;;ACNY;AACb;AACA;AACA;AACA;;AAEA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,E;;;;;;;;;;;ACZA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI,KAA4D;AAChE,IAAI,SACsG;AAC1G,CAAC,sBAAsB;;AAEvB;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,oDAAoD,OAAO;AAC3D;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8BAA8B;AAC9B;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gDAAgD,gBAAgB;AAChE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,SAAS;AACT;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+BAA+B,uCAAuC;AACtE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+BAA+B,cAAc;AAC7C,kEAAkE,MAAM,cAAc,EAAE,MAAM,EAAE;AAChG;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4BAA4B,aAAa;AACzC;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sCAAsC;AACtC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kCAAkC,WAAW;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kCAAkC,8BAA8B;AAChE;AACA;AACA;AACA;AACA,iDAAiD,8BAA8B;AAC/E,SAAS;AACT;AACA;AACA;AACA;AACA,oDAAoD,iBAAiB;AACrE;AACA;AACA;AACA,yBAAyB;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,2CAA2C;AAC3C,0BAA0B;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2CAA2C;AAC3C,0BAA0B;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4DAA4D,+BAA+B;AAC3F;AACA;AACA;AACA;AACA;AACA;AACA,oDAAoD,aAAa,gBAAgB;AACjF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oDAAoD,iBAAiB,iBAAiB,eAAe;AACrG;AACA;AACA;AACA;AACA;AACA,oDAAoD,2BAA2B,iBAAiB;AAChG;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oDAAoD,aAAa,6BAA6B;AAC9F;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qCAAqC,+DAA+D;AACpG;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA,uCAAuC,+DAA+D;AACtG;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+CAA+C,gBAAgB;AAC/D,iDAAiD,gBAAgB;AACjE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iCAAiC,UAAU,aAAa,EAAE,EAAE;AAC5D,mCAAmC,cAAc,EAAE;AACnD,qCAAqC,8BAA8B,EAAE;AACrE;AACA;AACA;AACA;AACA,8CAA8C,oCAAoC,EAAE;AACpF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA,CAAC","file":"default/js/productDetail.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = \"../codebase/tkooples/cartridges/app_core_tkooples/cartridge/client/default/js/productDetail.js\");\n","'use strict';\n\nmodule.exports = {\n setTabNextFocus: function (focusParams) {\n var KEYCODE_TAB = 9;\n var isTabPressed = (focusParams.event.key === 'Tab' || focusParams.event.keyCode === KEYCODE_TAB);\n\n if (!isTabPressed) {\n return;\n }\n\n var firstFocusableEl = $(focusParams.containerSelector + ' ' + focusParams.firstElementSelector);\n var lastFocusableEl = $(focusParams.containerSelector + ' ' + focusParams.lastElementSelector);\n\n if ($(focusParams.containerSelector + ' ' + focusParams.lastElementSelector).is(':disabled')) {\n lastFocusableEl = $(focusParams.containerSelector + ' ' + focusParams.nextToLastElementSelector);\n if ($('.product-quickview.product-set').length > 0) {\n var linkElements = $(focusParams.containerSelector + ' a#fa-link.share-icons');\n lastFocusableEl = linkElements[linkElements.length - 1];\n }\n }\n\n if (focusParams.event.shiftKey) /* shift + tab */ {\n if ($(':focus').is(firstFocusableEl)) {\n lastFocusableEl.focus();\n focusParams.event.preventDefault();\n }\n } else /* tab */ {\n if ($(':focus').is(lastFocusableEl)) { // eslint-disable-line\n firstFocusableEl.focus();\n focusParams.event.preventDefault();\n }\n }\n }\n};\n","'use strict';\n\nmodule.exports = function (element) {\n var position = element && element.length ? element.offset().top : 0;\n $('html, body').animate({\n scrollTop: position\n }, 500);\n if (!element) {\n $('.logo-home').focus();\n }\n};\n","'use strict';\n\nmodule.exports = function (include) {\n if (typeof include === 'function') {\n include();\n } else if (typeof include === 'object') {\n Object.keys(include).forEach(function (key) {\n if (typeof include[key] === 'function') {\n include[key]();\n }\n });\n }\n};\n","const Panzoom = require('@panzoom/panzoom/dist/panzoom');\n\nsetTimeout(function () {\n // Do something after 1 second \n\n var parentHeight = $('.js-popin-zoom').height();\n var parentWidth = $('.js-popin-zoom').width();\n var naturalWidth = $('.panzoom .image-zoomable').width();\n var naturalHeight = $('.panzoom .image-zoomable').height();\n\n var i = 0, r = 0;\n if (parentWidth / parentHeight > naturalWidth / naturalHeight) {\n i = parentWidth\n r = parentWidth / naturalWidth * naturalHeight\n } else {\n i = parentHeight / naturalHeight * naturalWidth;\n r = parentHeight\n }\n if ( $(window).width() > 840 ) {\n $('.panzoom .image-zoomable').width(`${Math.ceil(i) + 16}px`);\n $('.panzoom .image-zoomable').height(`auto`);\n }else {\n $('.js-popin-zoom .panzoom').width(`${Math.ceil(r)}px`);\n $('.panzoom .image-zoomable').width(`${Math.ceil(r)}px`);\n $('.panzoom .image-zoomable').height(`${Math.ceil(r) *1.24}px`);\n }\n \n\n initImageZoom(1)\n}, 1000);\n\nfunction initImageZoom(initialRatio,n) {\n // calculate ratio;\n const elem = document.getElementById('panzoom-element');\n const zoomInButton = document.getElementById('zoom-in');\n const zoomOutButton = document.getElementById('zoom-out');\n const resetButton = document.getElementById('reset');\n const panzoom = Panzoom(elem, { contain: 'outside', startScale: initialRatio,startX :`${n}px` })\n const parent = elem.parentElement\n\n // No function bind needed\n parent.addEventListener('wheel', panzoom.zoomWithWheel);\n zoomInButton.addEventListener('click', panzoom.zoomIn)\n zoomOutButton.addEventListener('click', panzoom.zoomOut)\n resetButton.addEventListener('click', panzoom.reset);\n}\n\nfunction openZoomPopin() {\n $('.js-popin-zoom-modal').addClass('open');\n $('body').addClass('modal-open');\n initImageZoom(1,-160)\n}\nfunction closeZoomPopin() {\n initImageZoom(1)\n $('.js-popin-zoom-modal').removeClass('open');\n $('body').removeClass('modal-open');\n initImageZoom()\n}\nmodule.exports = {\n initZoom: function () {\n $(\".primary-images img\").each(function (i) {\n $(document).on('click', '.primary-images img', function(){\n var SelectImg = $(this).data(\"image-index\");\n\n $(\".panzoom img\").each(function (i) {\n if (SelectImg == $(this).data(\"image-index\")) {\n $(this).css('display', 'inline-block').addClass('active');\n }\n else {\n $(this).hide().removeClass('active');\n }\n });\n $(\".btn-wrapp-zoom img\").each(function (i) {\n if (SelectImg == $(this).data(\"image-index\")) {\n $(this).addClass('active');\n } else {\n $(this).removeClass('active');\n }\n });\n openZoomPopin();\n });\n\n });\n $(\".btn-wrapp-zoom img\").each(function (i) {\n $(this).on('click', function () {\n $(this).addClass('active').siblings().removeClass('active');\n var SelectImg = $(this).data(\"image-index\");\n $(\".panzoom img\").each(function (i) {\n if (SelectImg == $(this).data(\"image-index\")) {\n $(this).css('display', 'inline-block').addClass('active');\n }\n else {\n initImageZoom(1,-160)\n $(this).hide().removeClass('active');\n }\n });\n });\n });\n var NumberImageZoom = $('.panzoom img').length,\n ArrowSlider = $('.btn-wrapp-zoom');\n if (NumberImageZoom <= 1) {\n ArrowSlider.hide();\n }\n $('.btn-close').on('click', function () {\n $(\".panzoom img\").each(function (i) {\n $(this).removeClass('active');\n });\n closeZoomPopin(this)\n });\n }\n}\n","'use strict';\nvar focusHelper = require('base/components/focus');\nconst { updateQuantity } = require('../updateQuantuty');\n/**\n * Retrieves the relevant pid value\n * @param {jquery} $el - DOM container for a given add to cart button\n * @return {string} - value to be used when adding product to cart\n */\nfunction getPidValue($el) {\n var pid;\n\n if ($('#quickViewModal').hasClass('show') && !$('.product-set').length) {\n pid = $($el).closest('.modal-content').find('.product-quickview').data('pid');\n } else if ($('.product-set-detail').length || $('.product-set').length) {\n pid = $($el).closest('.product-detail').find('.product-id').text();\n } else {\n pid = $('.product-detail:not(\".bundle-item\")').data('pid');\n }\n\n return pid;\n}\n\n/**\n * Retrieve contextual quantity selector\n * @param {jquery} $el - DOM container for the relevant quantity\n * @return {jquery} - quantity selector DOM container\n */\nfunction getQuantitySelector($el) {\n var quantitySelected;\n if ($el && $('.set-items').length) {\n quantitySelected = $($el).closest('.product-detail').find('.quantity-select');\n } else if ($el && $('.product-bundle').length) {\n var quantitySelectedModal = $($el).closest('.modal-footer').find('.quantity-select');\n var quantitySelectedPDP = $($el).closest('.bundle-footer').find('.quantity-select');\n if (quantitySelectedModal.val() === undefined) {\n quantitySelected = quantitySelectedPDP;\n } else {\n quantitySelected = quantitySelectedModal;\n }\n } else {\n quantitySelected = $('.quantity-select');\n }\n return quantitySelected;\n}\n\n/**\n * Retrieves the value associated with the Quantity pull-down menu\n * @param {jquery} $el - DOM container for the relevant quantity\n * @return {string} - value found in the quantity input\n */\nfunction getQuantitySelected($el) {\n return getQuantitySelector($el).val();\n}\n\n/**\n * Process the attribute values for an attribute that has image swatches\n *\n * @param {Object} attr - Attribute\n * @param {string} attr.id - Attribute ID\n * @param {Object[]} attr.values - Array of attribute value objects\n * @param {string} attr.values.value - Attribute coded value\n * @param {string} attr.values.url - URL to de/select an attribute value of the product\n * @param {boolean} attr.values.isSelectable - Flag as to whether an attribute value can be\n * selected. If there is no variant that corresponds to a specific combination of attribute\n * values, an attribute may be disabled in the Product Detail Page\n * @param {jQuery} $productContainer - DOM container for a given product\n * @param {Object} msgs - object containing resource messages\n */\n function processSwatchValues(attr, $productContainer, msgs) {\n attr.values.forEach(function (attrValue) {\n var $attrValue = $productContainer.find('[data-attr=\"' + attr.id + '\"] [data-attr-value=\"' +\n attrValue.value + '\"]');\n var $swatchButton = $attrValue.parent();\n\n if (attrValue.selected) {\n $attrValue.addClass('selected');\n $attrValue.siblings('.selected-assistive-text').text(msgs.assistiveSelectedText);\n $('.non-input-label em').text(attrValue.displayValue)\n } else {\n $attrValue.removeClass('selected');\n $attrValue.siblings('.selected-assistive-text').empty();\n }\n\n if (attrValue.url) {\n $swatchButton.attr('data-url', attrValue.url);\n } else {\n $swatchButton.removeAttr('data-url');\n }\n\n // Disable if not selectable\n $attrValue.removeClass('selectable unselectable');\n\n $attrValue.addClass(attrValue.selectable ? 'selectable' : 'unselectable');\n });\n}\n\n/**\n * Process attribute values associated with an attribute that does not have image swatches\n *\n * @param {Object} attr - Attribute\n * @param {string} attr.id - Attribute ID\n * @param {Object[]} attr.values - Array of attribute value objects\n * @param {string} attr.values.value - Attribute coded value\n * @param {string} attr.values.url - URL to de/select an attribute value of the product\n * @param {boolean} attr.values.isSelectable - Flag as to whether an attribute value can be\n * selected. If there is no variant that corresponds to a specific combination of attribute\n * values, an attribute may be disabled in the Product Detail Page\n * @param {jQuery} $productContainer - DOM container for a given product\n */\nfunction processNonSwatchValues(attr, $productContainer) {\n var $attr = '[data-attr=\"' + attr.id + '\"]';\n var $defaultOption = $productContainer.find($attr + ' .select-' + attr.id + ' option:first');\n $defaultOption.attr('value', attr.resetUrl);\n\n attr.values.forEach(function (attrValue) {\n var $attrValue = $productContainer\n .find($attr + ' [data-attr-value=\"' + attrValue.value + '\"]');\n $attrValue.attr('value', attrValue.url)\n .removeAttr('disabled');\n\n // if (!attrValue.selectable) {\n // $attrValue.attr('disabled', true);\n // }\n });\n}\n\n/**\n * Routes the handling of attribute processing depending on whether the attribute has image\n * swatches or not\n *\n * @param {Object} attrs - Attribute\n * @param {string} attr.id - Attribute ID\n * @param {jQuery} $productContainer - DOM element for a given product\n * @param {Object} msgs - object containing resource messages\n */\nfunction updateAttrs(attrs, $productContainer, msgs) {\n // Currently, the only attribute type that has image swatches is Color.\n var attrsWithSwatches = ['color'];\n\n attrs.forEach(function (attr) {\n if (attrsWithSwatches.indexOf(attr.id) > -1) {\n processSwatchValues(attr, $productContainer, msgs);\n } else {\n processNonSwatchValues(attr, $productContainer);\n }\n });\n}\n\n/**\n * Updates the availability status in the Product Detail Page\n *\n * @param {Object} response - Ajax response object after an\n * attribute value has been [de]selected\n * @param {jQuery} $productContainer - DOM element for a given product\n */\nfunction updateAvailability(response, $productContainer) {\n var availabilityValue = '';\n var availabilityMessages = response.product.availability.messages;\n if (response.product.readyToOrder) {\n availabilityMessages.forEach(function (message) {\n availabilityValue += '
  • ' + message.label + '
  • ';\n });\n }\n\n $($productContainer).trigger('product:updateAvailability', {\n product: response.product,\n $productContainer: $productContainer,\n message: availabilityValue,\n resources: response.resources\n });\n}\n\n/**\n * Generates html for product attributes section\n *\n * @param {array} attributes - list of attributes\n * @return {string} - Compiled HTML\n */\nfunction getAttributesHtml(attributes) {\n if (!attributes) {\n return '';\n }\n\n var html = '';\n\n attributes.forEach(function (attributeGroup) {\n if (attributeGroup.ID === 'mainAttributes') {\n attributeGroup.attributes.forEach(function (attribute) {\n html += '
    ' + attribute.label + ': '\n + attribute.value + '
    ';\n });\n }\n });\n\n return html;\n}\n\n/**\n * @typedef UpdatedOptionValue\n * @type Object\n * @property {string} id - Option value ID for look up\n * @property {string} url - Updated option value selection URL\n */\n\n/**\n * @typedef OptionSelectionResponse\n * @type Object\n * @property {string} priceHtml - Updated price HTML code\n * @property {Object} options - Updated Options\n * @property {string} options.id - Option ID\n * @property {UpdatedOptionValue[]} options.values - Option values\n */\n\n/**\n * Updates DOM using post-option selection Ajax response\n *\n * @param {OptionSelectionResponse} optionsHtml - Ajax response optionsHtml from selecting a product option\n * @param {jQuery} $productContainer - DOM element for current product\n */\nfunction updateOptions(optionsHtml, $productContainer) {\n // Update options\n $productContainer.find('.product-options').empty().html(optionsHtml);\n}\n\n/**\n * Dynamically creates Bootstrap carousel from response containing images\n * @param {Object[]} imgs - Array of large product images,along with related information\n * @param {jQuery} $productContainer - DOM element for a given product\n */\nfunction createCarousel(imgs, $productContainer) {\n var carousel = $productContainer.find('.carousel');\n $(carousel).carousel('dispose');\n var carouselId = $(carousel).attr('id');\n $(carousel).empty().append('
      ' + $(carousel).data('prev') + '' + $(carousel).data('next') + '');\n for (var i = 0; i < imgs.length; i++) {\n $('
      \"'
      ').appendTo($(carousel).find('.carousel-inner'));\n $('
    1. ').appendTo($(carousel).find('.carousel-indicators'));\n }\n $($(carousel).find('.carousel-item')).first().addClass('active');\n $($(carousel).find('.carousel-indicators > li')).first().addClass('active');\n if (imgs.length === 1) {\n $($(carousel).find('.carousel-indicators, a[class^=\"carousel-control-\"]')).detach();\n }\n $(carousel).carousel();\n $($(carousel).find('.carousel-indicators')).attr('aria-hidden', true);\n}\n\n/**\n * Parses JSON from Ajax call made whenever an attribute value is [de]selected\n * @param {Object} response - response from Ajax call\n * @param {Object} response.product - Product object\n * @param {string} response.product.id - Product ID\n * @param {Object[]} response.product.variationAttributes - Product attributes\n * @param {Object[]} response.product.images - Product images\n * @param {boolean} response.product.hasRequiredAttrsSelected - Flag as to whether all required\n * attributes have been selected. Used partially to\n * determine whether the Add to Cart button can be enabled\n * @param {jQuery} $productContainer - DOM element for a given product.\n */\nfunction handleVariantResponse(response, $productContainer) {\n var isChoiceOfBonusProducts =\n $productContainer.parents('.choose-bonus-product-dialog').length > 0;\n var isVaraint;\n if (response.product.variationAttributes) {\n updateAttrs(response.product.variationAttributes, $productContainer, response.resources);\n isVaraint = response.product.productType === 'variant';\n if (isChoiceOfBonusProducts && isVaraint) {\n $productContainer.parent('.bonus-product-item')\n .data('pid', response.product.id);\n\n $productContainer.parent('.bonus-product-item')\n .data('ready-to-order', response.product.readyToOrder);\n }\n }\n\n // Update primary images\n var primaryImageUrls = response.product.images.large;\n createCarousel(primaryImageUrls, $productContainer);\n\n // Update pricing\n if (!isChoiceOfBonusProducts) {\n var $priceSelector = $('.prices .price', $productContainer).length\n ? $('.prices .price', $productContainer)\n : $('.prices .price');\n $priceSelector.replaceWith(response.product.price.html);\n }\n\n // Update pp-amount\n if (typeof paypal !== 'undefined' && $('.pp-message').length > 0) {\n paypal.Messages({\n amount: response.product.price.sales.value,\n placement: \"product\",\n style: {\n layout: \"text\",\n text: {\n color: \"greyscale\",\n size: \"13\",\n align: \"center\"\n },\n logo: {\n type: \"none\"\n }\n }\n })\n .render(\".pp-message\");\n }\n\n // Update promotions\n $productContainer.find('.promotions').empty().html(response.product.promotionsHtml);\n\n updateAvailability(response, $productContainer);\n\n if (isChoiceOfBonusProducts) {\n var $selectButton = $productContainer.find('.select-bonus-product');\n $selectButton.trigger('bonusproduct:updateSelectButton', {\n product: response.product, $productContainer: $productContainer\n });\n } else {\n // Enable \"Add to Cart\" button if all required attributes have been selected\n $('button.add-to-cart, button.add-to-cart-global, button.update-cart-product-global').trigger('product:updateAddToCart', {\n product: response.product, $productContainer: $productContainer\n }).trigger('product:statusUpdate', response.product);\n }\n\n // Update attributes\n $productContainer.find('.main-attributes').empty()\n .html(getAttributesHtml(response.product.attributes));\n}\n\n/**\n * @typespec UpdatedQuantity\n * @type Object\n * @property {boolean} selected - Whether the quantity has been selected\n * @property {string} value - The number of products to purchase\n * @property {string} url - Compiled URL that specifies variation attributes, product ID, options,\n * etc.\n */\n\n/**\n * Updates the quantity DOM elements post Ajax call\n * @param {UpdatedQuantity[]} quantities -\n * @param {jQuery} $productContainer - DOM container for a given product\n */\nfunction updateQuantities(quantities, $productContainer) {\n if ($productContainer.parent('.bonus-product-item').length <= 0) {\n var optionsHtml = quantities.map(function (quantity) {\n var selected = quantity.selected ? ' selected ' : '';\n return '';\n }).join('');\n getQuantitySelector($productContainer).empty().html(optionsHtml);\n }\n}\nfunction renderSizesView(sizeValues){\n var isOutOfStock=$('.size-field').data('selectable');\n $('.sizes-container').empty();\n var html =\"\";\n\n $.each(sizeValues.variationAttributes[1].values, function(index, attrValue){\n if (attrValue.isValidSize) {\n html += `\n \n ${attrValue.displayValue}\n \n `;\n }\n \n })\n $('.select-all-size').html(html);\n}\n/**\n * updates the product view when a product attribute is selected or deselected or when\n * changing quantity\n * @param {string} selectedValueUrl - the Url for the selected variation value\n * @param {jQuery} $productContainer - DOM element for current product\n */\n function attributeSelect(selectedValueUrl, $productContainer) {\n if (selectedValueUrl && selectedValueUrl!=\"null\") {\n $('body').trigger('product:beforeAttributeSelect',\n { url: selectedValueUrl, container: $productContainer });\n function SkpwidthImage() {\n var window_Width= $(window).width(),\n PDP_width =(1/2 *(window_Width));\n \n if ( window_Width > 840 ) {\n var PDP_Height = (PDP_width* 1.24);\n $('.product-detail .primary-images .img-fluid,.primary-images,.primary-images iframe').css('height',PDP_Height);\n }else{\n var PDP_width =(1 *(window_Width)),\n PDP_Height = (PDP_width* 1.24);\n $('.product-detail .primary-images .img-fluid,.primary-images,.primary-images iframe').css('height',PDP_Height);\n \n }\n }\n SkpwidthImage();\n $.ajax({\n url: selectedValueUrl,\n method: 'GET',\n success: function (data) {\n renderSizesView(data.product);\n handleVariantResponse(data, $productContainer);\n updateOptions(data.product.optionsHtml, $productContainer);\n updateQuantities(data.product.quantities, $productContainer);\n $(\".add-to-cart .js-btnaddtocart\").removeClass('icon-check');\n $('.availability-text').removeClass('d-none');\n SkpwidthImage();\n var displaybutton = (!data.product.available && $('button.add-to-cart').data('backinstock') && data.product.productType !='master' && data.product.notifyBackInStock);\n var variantPid = data.product.id;\n $('.ereservation_button').attr('data-product-id', variantPid);\n $('.skp-selcet-size').removeClass('show-select-size');\n if(displaybutton){\n $('button.add-to-cart').addClass('d-none');\n $('.js-backInstock').removeClass('d-none');\n $('.js-backInstock').attr('data-variant-pid', data.product.id);\n if ($(\".size-field.selected\").length > 0) {\n $('.overlay-btn-backInstock').addClass('d-none');\n } else {\n $('.overlay-btn-backInstock').removeClass('d-none');\n }\n }else{\n $('button.add-to-cart', $productContainer).attr('disabled',\n (!data.product.readyToOrder || !data.product.available) );\n $('.js-backInstock').addClass('d-none');\n $('button.add-to-cart').removeClass('d-none');\n $('.js-backInstock').attr('data-variant-pid', '');\n }\n $('body').trigger('product:afterAttributeSelect',\n { data: data, container: $productContainer });\n $.spinner().stop();\n if(data.product.discount){\n $('.skp-attributes .skp-prices').append(`-${data.product.discount}%`);\n }\n // eReservation\n var widgetURL = $('#ereservation_button').attr('data-client-widget-url');\n var clientId = $('#ereservation_button').attr('data-client-id');\n var currency = $('#ereservation_button').attr('data-currency');\n\n $('.iframe-resa').html(``)\n \n },\n error: function () {\n $.spinner().stop();\n }\n });\n }else{\n // this code is only for tests purpose\n //TODO: in case we need the sku id, we must make an ajax call with (master product, color, size)\n // HERE sku is not available (based on sku null);\n $.get($('.select-size :selected').val(), function(data){\n $('button.add-to-cart').addClass('d-none');\n $('.js-backInstock').removeClass('d-none');\n $('.js-backInstock').attr('data-variant-pid', data.product.id);\n $('.availability-msg li').closest('.availability-text').data('notavailaible');\n $('.availability-msg li').empty().html($('.availability-msg li').closest('.availability-text').data('notavailaible'));\n },'JSON')\n }\n}\n\n/**\n * Retrieves url to use when adding a product to the cart\n *\n * @return {string} - The provided URL to use when adding a product to the cart\n */\nfunction getAddToCartUrl() {\n return $('.add-to-cart-url').val();\n}\n\n/**\n * Parses the html for a modal window\n * @param {string} html - representing the body and footer of the modal window\n *\n * @return {Object} - Object with properties body and footer.\n */\nfunction parseHtml(html) {\n var $html = $('
      ').append($.parseHTML(html));\n\n var body = $html.find('.choice-of-bonus-product');\n var footer = $html.find('.modal-footer').children();\n\n return { body: body, footer: footer };\n}\n\n/**\n * Retrieves url to use when adding a product to the cart\n *\n * @param {Object} data - data object used to fill in dynamic portions of the html\n */\nfunction chooseBonusProducts(data) {\n $('.modal-body').spinner().start();\n\n if ($('#chooseBonusProductModal').length !== 0) {\n $('#chooseBonusProductModal').remove();\n }\n var bonusUrl;\n if (data.bonusChoiceRuleBased) {\n bonusUrl = data.showProductsUrlRuleBased;\n } else {\n bonusUrl = data.showProductsUrlListBased;\n }\n\n var htmlString = ''\n + '
      '\n + ''\n + '
      '\n + ''\n + '
      '\n + '
      '\n + ' ' + data.labels.selectprods + ''\n + ' '\n + '
      '\n + '
      '\n + '
      '\n + '
      '\n + '
      '\n + '
      ';\n $('body').append(htmlString);\n $('.modal-body').spinner().start();\n\n $.ajax({\n url: bonusUrl,\n method: 'GET',\n dataType: 'json',\n success: function (response) {\n var parsedHtml = parseHtml(response.renderedTemplate);\n $('#chooseBonusProductModal .modal-body').empty();\n $('#chooseBonusProductModal .enter-message').text(response.enterDialogMessage);\n $('#chooseBonusProductModal .modal-header .close .sr-only').text(response.closeButtonText);\n $('#chooseBonusProductModal .modal-body').html(parsedHtml.body);\n $('#chooseBonusProductModal .modal-footer').html(parsedHtml.footer);\n $('#chooseBonusProductModal').modal('show');\n $.spinner().stop();\n },\n error: function () {\n $.spinner().stop();\n }\n });\n}\n\n/**\n * Updates the Mini-Cart quantity value after the customer has pressed the \"Add to Cart\" button\n * @param {string} response - ajax response from clicking the add to cart button\n */\nfunction handlePostCartAdd(response) {\n $('.minicart').trigger('count:update', response);\n var messageType = response.error ? 'alert-danger' : 'alert-success';\n // show add to cart toast\n if (response.newBonusDiscountLineItem\n && Object.keys(response.newBonusDiscountLineItem).length !== 0) {\n chooseBonusProducts(response.newBonusDiscountLineItem);\n } else {\n if ($('.add-to-cart-messages').length === 0) {\n $('body').append(\n '
      '\n );\n }\n\n }\n}\n\n/**\n * Retrieves the bundle product item ID's for the Controller to replace bundle master product\n * items with their selected variants\n *\n * @return {string[]} - List of selected bundle product item ID's\n */\nfunction getChildProducts() {\n var childProducts = [];\n $('.bundle-item').each(function () {\n childProducts.push({\n pid: $(this).find('.product-id').text(),\n quantity: parseInt($(this).find('label.quantity').data('quantity'), 10)\n });\n });\n\n return childProducts.length ? JSON.stringify(childProducts) : [];\n}\n\n/**\n * Retrieve product options\n *\n * @param {jQuery} $productContainer - DOM element for current product\n * @return {string} - Product options and their selected values\n */\nfunction getOptions($productContainer) {\n var options = $productContainer\n .find('.product-option')\n .map(function () {\n var $elOption = $(this).find('.options-select');\n var urlValue = $elOption.val();\n var selectedValueId = $elOption.find('option[value=\"' + urlValue + '\"]')\n .data('value-id');\n return {\n optionId: $(this).data('option-id'),\n selectedValueId: selectedValueId\n };\n }).toArray();\n\n return JSON.stringify(options);\n}\n\n/**\n * Makes a call to the server to report the event of adding an item to the cart\n *\n * @param {string | boolean} url - a string representing the end point to hit so that the event can be recorded, or false\n */\nfunction miniCartReportingUrl(url) {\n if (url) {\n $.ajax({\n url: url,\n method: 'GET',\n success: function () {\n // reporting urls hit on the server\n },\n error: function () {\n // no reporting urls hit on the server\n }\n });\n }\n}\n\nmodule.exports = {\n attributeSelect: attributeSelect,\n methods: {\n editBonusProducts: function (data) {\n chooseBonusProducts(data);\n }\n },\n\n focusChooseBonusProductModal: function () {\n $('body').on('shown.bs.modal', '#chooseBonusProductModal', function () {\n $('#chooseBonusProductModal').siblings().attr('aria-hidden', 'true');\n $('#chooseBonusProductModal .close').focus();\n });\n },\n\n onClosingChooseBonusProductModal: function () {\n $('body').on('hidden.bs.modal', '#chooseBonusProductModal', function () {\n $('#chooseBonusProductModal').siblings().attr('aria-hidden', 'false');\n });\n },\n\n trapChooseBonusProductModalFocus: function () {\n $('body').on('keydown', '#chooseBonusProductModal', function (e) {\n var focusParams = {\n event: e,\n containerSelector: '#chooseBonusProductModal',\n firstElementSelector: '.close',\n lastElementSelector: '.add-bonus-products'\n };\n focusHelper.setTabNextFocus(focusParams);\n });\n },\n\n colorAttribute: function () {\n $(document).on('click', '[data-attr=\"color\"] button', function (e) {\n e.preventDefault();\n\n if ($(this).attr('disabled')) {\n return;\n }\n var $productContainer = $(this).closest('.set-item');\n if (!$productContainer.length) {\n $productContainer = $(this).closest('.product-detail');\n }\n\n attributeSelect($(this).attr('data-colorUrl '), $productContainer);\n });\n },\n\n selectAttribute: function () {\n $(document).on('change', 'select[class*=\"select-size\"], .options-select', function (e) {\n e.preventDefault();\n $(\".add-to-cart .js-btnaddtocart\").text($(\".add-to-cart\").data('add-to-cart'));\n\n var $productContainer = $(this).closest('.set-item');\n if (!$productContainer.length) {\n $productContainer = $(this).closest('.product-detail');\n }\n attributeSelect(e.currentTarget.value, $productContainer);\n });\n },\n\n availability: function () {\n $(document).on('change', '.quantity-select', function (e) {\n e.preventDefault();\n\n var $productContainer = $(this).closest('.product-detail');\n if (!$productContainer.length) {\n $productContainer = $(this).closest('.modal-content').find('.product-quickview');\n }\n\n if ($('.bundle-items', $productContainer).length === 0) {\n attributeSelect($(e.currentTarget).find('option:selected').data('url'),\n $productContainer);\n }\n });\n },\n\n addToCart: function () {\n $(document).on('click', 'button.add-to-cart, button.add-to-cart-global', function () {\n \n if ($(\".size-field.selected\").length == 0) {\n $('.skp-selcet-size').addClass('show-select-size');\n } else {\n $('.skp-selcet-size').removeClass('show-select-size');\n }\n\n var addToCartUrl;\n var pid;\n var pidsObj;\n var setPids;\n\n $('body').trigger('product:beforeAddToCart', this);\n\n if ($('.set-items').length && $(this).hasClass('add-to-cart-global')) {\n setPids = [];\n\n $('.product-detail').each(function () {\n if (!$(this).hasClass('product-set-detail')) {\n setPids.push({\n pid: $(this).find('.product-id').text(),\n qty: $(this).find('.quantity-select').val(),\n options: getOptions($(this))\n });\n }\n });\n pidsObj = JSON.stringify(setPids);\n }\n\n pid = getPidValue($(this));\n\n var $productContainer = $(this).closest('.product-detail');\n if (!$productContainer.length) {\n $productContainer = $(this).closest('.quick-view-dialog').find('.product-detail');\n }\n\n addToCartUrl = getAddToCartUrl();\n\n var form = {\n pid: pid,\n pidsObj: pidsObj,\n childProducts: getChildProducts(),\n quantity: getQuantitySelected($(this))\n };\n\n if (!$('.bundle-item').length) {\n form.options = getOptions($productContainer);\n }\n\n $(this).trigger('updateAddToCartFormData', form);\n if (addToCartUrl) {\n $.ajax({\n url: addToCartUrl,\n method: 'POST',\n data: form,\n success: function (data) {\n handlePostCartAdd(data);\n $('body').trigger('product:afterAddToCart', data);\n $.spinner().stop();\n $(\".add-to-cart .js-btnaddtocart\").text($(\".add-to-cart\").data('product-added'));\n $(\".add-to-cart .js-btnaddtocart\").addClass('icon-check');\n miniCartReportingUrl(data.reportingURL);\n $('body').trigger('addToCart:success', data.addedToCartProduct);\n updateQuantity();\n \n $('.availability-msg-limited-stock').empty().html(data.maoMessage).addClass('mao-exist');\n var windowWidth = $(window).width();\n var maoMessage = $('.availability-msg-limited-stock');\n if (maoMessage.length > 0) {\n maoMessage.each(function() {\n if ($(this).text().trim() === \"\") {\n $('.availability-msg').removeClass('d-none');\n $('.availability-msg-limited-stock').removeClass('mao-exist');\n if ( windowWidth > 991 ) {\n $('.minicart .popover').addClass('show');\n }\n } else {\n $('.availability-msg').addClass('d-none');\n $('.availability-msg-limited-stock').addClass('mao-exist availability-msg-red');\n $('.add-to-cart .js-btnaddtocart').text($('.add-to-cart').data('add-to-cart')).removeClass('icon-check');\n if ( windowWidth > 991 ) {\n $('.minicart .popover').removeClass('show');\n }\n }\n });\n }\n },\n error: function () {\n $.spinner().stop();\n }\n });\n }\n });\n },\n selectBonusProduct: function () {\n $(document).on('click', '.select-bonus-product', function () {\n var $choiceOfBonusProduct = $(this).parents('.choice-of-bonus-product');\n var pid = $(this).data('pid');\n var maxPids = $('.choose-bonus-product-dialog').data('total-qty');\n var submittedQty = parseInt($choiceOfBonusProduct.find('.bonus-quantity-select').val(), 10);\n var totalQty = 0;\n $.each($('#chooseBonusProductModal .selected-bonus-products .selected-pid'), function () {\n totalQty += $(this).data('qty');\n });\n totalQty += submittedQty;\n var optionID = $choiceOfBonusProduct.find('.product-option').data('option-id');\n var valueId = $choiceOfBonusProduct.find('.options-select option:selected').data('valueId');\n if (totalQty <= maxPids) {\n var selectedBonusProductHtml = ''\n + '
      '\n + '
      '\n + $choiceOfBonusProduct.find('.product-name').html()\n + '
      '\n + '
      '\n + '
      '\n ;\n $('#chooseBonusProductModal .selected-bonus-products').append(selectedBonusProductHtml);\n $('.pre-cart-products').html(totalQty);\n $('.selected-bonus-products .bonus-summary').removeClass('alert-danger');\n } else {\n $('.selected-bonus-products .bonus-summary').addClass('alert-danger');\n }\n });\n },\n removeBonusProduct: function () {\n $(document).on('click', '.selected-pid', function () {\n $(this).remove();\n var $selected = $('#chooseBonusProductModal .selected-bonus-products .selected-pid');\n var count = 0;\n if ($selected.length) {\n $selected.each(function () {\n count += parseInt($(this).data('qty'), 10);\n });\n }\n\n $('.pre-cart-products').html(count);\n $('.selected-bonus-products .bonus-summary').removeClass('alert-danger');\n });\n },\n enableBonusProductSelection: function () {\n $('body').on('bonusproduct:updateSelectButton', function (e, response) {\n $('button.select-bonus-product', response.$productContainer).attr('disabled',\n (!response.product.readyToOrder || !response.product.available));\n var pid = response.product.id;\n $('button.select-bonus-product', response.$productContainer).data('pid', pid);\n });\n },\n showMoreBonusProducts: function () {\n $(document).on('click', '.show-more-bonus-products', function () {\n var url = $(this).data('url');\n $('.modal-content').spinner().start();\n $.ajax({\n url: url,\n method: 'GET',\n success: function (html) {\n var parsedHtml = parseHtml(html);\n $('.modal-body').append(parsedHtml.body);\n $('.show-more-bonus-products:first').remove();\n $('.modal-content').spinner().stop();\n },\n error: function () {\n $('.modal-content').spinner().stop();\n }\n });\n });\n },\n addBonusProductsToCart: function () {\n $(document).on('click', '.add-bonus-products', function () {\n var $readyToOrderBonusProducts = $('.choose-bonus-product-dialog .selected-pid');\n var queryString = '?pids=';\n var url = $('.choose-bonus-product-dialog').data('addtocarturl');\n var pidsObject = {\n bonusProducts: []\n };\n\n $.each($readyToOrderBonusProducts, function () {\n var qtyOption =\n parseInt($(this)\n .data('qty'), 10);\n\n var option = null;\n if (qtyOption > 0) {\n if ($(this).data('optionid') && $(this).data('option-selected-value')) {\n option = {};\n option.optionId = $(this).data('optionid');\n option.productId = $(this).data('pid');\n option.selectedValueId = $(this).data('option-selected-value');\n }\n pidsObject.bonusProducts.push({\n pid: $(this).data('pid'),\n qty: qtyOption,\n options: [option]\n });\n pidsObject.totalQty = parseInt($('.pre-cart-products').html(), 10);\n }\n });\n queryString += JSON.stringify(pidsObject);\n queryString = queryString + '&uuid=' + $('.choose-bonus-product-dialog').data('uuid');\n queryString = queryString + '&pliuuid=' + $('.choose-bonus-product-dialog').data('pliuuid');\n $.spinner().start();\n $.ajax({\n url: url + queryString,\n method: 'POST',\n success: function (data) {\n $.spinner().stop();\n if (data.error) {\n $('#chooseBonusProductModal').modal('hide');\n if ($('.add-to-cart-messages').length === 0) {\n $('body').append('
      ');\n }\n $('.add-to-cart-messages').append(\n '
      '\n + data.errorMessage + '
      '\n );\n setTimeout(function () {\n $('.add-to-basket-alert').remove();\n }, 3000);\n } else {\n $('.configure-bonus-product-attributes').html(data);\n $('.bonus-products-step2').removeClass('hidden-xl-down');\n $('#chooseBonusProductModal').modal('hide');\n\n if ($('.add-to-cart-messages').length === 0) {\n $('body').append('
      ');\n }\n $('.minicart-quantity').html(data.totalQty);\n\n $('.count-quantity').empty();\n $('.count-quantity').text('(' + data.totalQty + ')');\n\n $('.add-to-cart-messages').append(\n '
      '\n + data.msgSuccess + '
      '\n );\n setTimeout(function () {\n $('.add-to-basket-alert').remove();\n if ($('.cart-page').length) {\n location.reload();\n }\n }, 1500);\n }\n },\n error: function () {\n $.spinner().stop();\n }\n });\n });\n },\n\n getPidValue: getPidValue,\n getQuantitySelected: getQuantitySelected,\n miniCartReportingUrl: miniCartReportingUrl\n};\n\n $('.block-card-payment').each(function() {\n var $cardField = $(this);\n var cardText = $cardField.text();\n var cardParts = cardText.split('****');\n\n if (cardParts.length === 2) {\n\n var strongText = cardParts[0];\n var strongElement = '' + strongText + '';\n\n var cardNumberText = '****' + cardParts[1];\n var cardNumberElement = '

      ' + cardNumberText + '

      ';\n\n $cardField.empty().append(strongElement + cardNumberElement)\n\n }\n });\n","'use strict';\nvar base = require('./base');\nvar stockStore = require('./stockStore');\nvar pdpZoom = require('../pdpZoom/pdpZoom');\nvar scrollAnimate = require('base/components/scrollAnimate');\n\npdpZoom.initZoom();\n\n window.addEventListener(\"load\", (event) => {\n if (typeof paypal !== 'undefined' && $('.pp-message').length > 0) {\n paypal.Messages({\n amount: $('.pp-message').data('initial-price'),\n placement: \"product\",\n style: {\n layout: \"text\",\n text: {\n color: \"greyscale\",\n size: \"13\",\n align: \"center\"\n },\n logo: {\n type: \"none\"\n }\n }\n })\n .render(\".pp-message\");\n }\n var octipasEnabled = $('#store_selector').length > 0;\n if(!octipasEnabled){\n return;\n }\n if(typeof octipas === 'undefined'){\n console.log('octipas not loaded');\n return;\n }\n stockStore.init();\n });\n\n/**\n * Enable/disable UI elements\n * @param {boolean} enableOrDisable - true or false\n */\nfunction updateAddToCartEnableDisableOtherElements(enableOrDisable) {\n $('button.add-to-cart-global').attr('disabled', enableOrDisable);\n}\n\nfunction backInStockSubscribe() {\n var formData = {\n pid: $(\"#pid\").val(),\n email: $(\"#email\").val(),\n csrf_token: $(\"#csrf_token\").val()\n }\n\n $.ajax({\n type: \"POST\",\n url: $(\"#backinstock-subscribe-form\").data(\"bisubscribe-url\"),\n dataType: \"json\",\n data: formData,\n success: function(data) {\n $('#bis-modal-body').find('form').hide();\n $('#bis-msg').empty();\n $('#bis-msg').html(data.msg);\n $('#continue-shopping-cta').attr('hidden', false);\n },\n error: function(data) {\n window.location.reload();\n }\n });\n}\nfunction SizeSelected(){\n if ($(\".size-field.selected\").length > 0) {\n $('.skp-selcet-size').addClass('d-none');\n $('.js-select-size').addClass('hide');\n $('.js-btnaddtocart').removeClass('hide');\n $('.store-stock p').removeClass('show-message-stockStore');\n $('.error-message-store').addClass('d-none');\n $('.in-stock-indicator').removeClass('d-none');\n $('.availability-text').removeClass('d-none');\n $('.error-message-store').removeClass('red-message');\n $('.error-message-e-resa').removeClass('red-message');\n $('.add-to-cart,.E-rasa-button,.overlay-btn-backInstock').removeClass('scrollSize');\n if (!$('.js-backInstock').hasClass('d-none')) {\n $('#ereservation_pickup').addClass('full-width'); \n $('.js-backInstock').addClass('full-width'); \n $('.btn-mobile-pay').removeClass('E-resa-mobile');\n }else {\n $('#ereservation_pickup').removeClass('full-width'); \n $('.js-backInstock').removeClass('full-width'); \n if ($('.e-reservation').length) {\n $('.btn-mobile-pay').addClass('E-resa-mobile');\n }\n }\n } else {\n $('.skp-selcet-size').removeClass('d-none');\n $('.js-btnaddtocart').addClass('hide');\n $('.js-select-size').removeClass('hide');\n $('.error-message-store').removeClass('d-none');\n $('.in-stock-indicator').addClass('d-none');\n $('.availability-text').addClass('d-none');\n $('.add-to-cart').prop('disabled', false);\n if($(window).width() < 840){\n $('.add-to-cart,.E-rasa-button,.overlay-btn-backInstock').addClass('scrollSize');\n $('.add-to-cart').prop('disabled', false);\n }\n if (!$('.js-backInstock').hasClass('d-none')) {\n $('#ereservation_pickup').addClass('full-width'); \n $('.js-backInstock').addClass('full-width'); \n $('.btn-mobile-pay').removeClass('E-resa-mobile');\n } else {\n $('#ereservation_pickup').removeClass('full-width'); \n $('.js-backInstock').removeClass('full-width'); \n if ($('.e-reservation').length) {\n $('.btn-mobile-pay').addClass('E-resa-mobile');\n }\n }\n }\n}\n\n\n$(document).on(\"click\", \".E-rasa-button\", function () {\n if ($(\".size-field.selected\").length > 0) {\n $('.error-message-e-resa').removeClass('red-message');\n $('.E-resa-popin').removeClass('d-none');\n setTimeout(function () {\n $('.iframe-resa').addClass('show-e-resa');\n }, 200);\n $('body').addClass('overflow-hide-resa');\n $('.skp-selcet-size').removeClass('show-select-size');\n } else {\n $('.error-message-e-resa').addClass('red-message');\n $('.skp-selcet-size').addClass('show-select-size');\n }\n});\n\n\n $('.E-resa-popin .close-button').on('click', function() {\n $('.iframe-resa').removeClass('show-e-resa');\n setTimeout(function () {\n $('.E-resa-popin').addClass('d-none');\n }, 200);\n});\n\n$(document).on('click', function(e) {\n var popin = $('.E-resa-popin iframe');\n var boutonReservation = $('.E-rasa-button');\n\n if (!$(e.target).is('.E-rasa-button') && !$(e.target).closest('.E-rasa-button').length &&\n !popin.is(e.target) && popin.has(e.target).length === 0 &&\n !boutonReservation.is(e.target) && boutonReservation.has(e.target).length === 0) {\n $('.iframe-resa').removeClass('show-e-resa');\n setTimeout(function () {\n $('.E-resa-popin').addClass('d-none');\n }, 200);\n $('body').removeClass('overflow-hide-resa');\n }\n});\n\nwindow.addEventListener('message', function (event) {\n if (event.data === \"closeCheckoutIframe\") {\n var elem = document.getElementById('Octipas_checkout_fullscreen');\n $('.iframe-resa').removeClass('show-e-resa');\n setTimeout(function () {\n elem.classList.add('d-none');\n }, 200);\n $('body').removeClass('overflow-hide-resa');\n }\n})\n\nmodule.exports = {\n methods: {\n updateAddToCartEnableDisableOtherElements: updateAddToCartEnableDisableOtherElements\n },\n\n availability: base.availability,\n\n addToCart: base.addToCart,\n\n initModal: function () {\n $('body').on('shown.bs.modal', '#backInStockAlert', function (e) {\n var variantPid = $(e.relatedTarget).attr('data-variant-pid');\n $('#backInStockAlert #pid').val(variantPid);\n });\n $('body').on('hidden.bs.modal', '#backInStockAlert', function (e) {\n var textBis = $('#bis-msg').data('text-bis');\n $('#bis-modal-body').find('form').show();\n $('#bis-msg').html(textBis);\n $('#continue-shopping-cta').attr('hidden', true);\n });\n\n $(document).on(\"click\",\".add-to-back-in-stock\",function() {\n var errorMessage=\"\";\n //this stops the form from being submitted, to allow for validation\n event.preventDefault();\n //validation, stackoverflow code\n function isValidEmailAddress(emailAddress) {\n var pattern = new RegExp(/^[\\w.%+-]+@[\\w.-]+\\.[\\w]{2,6}$/);\n return pattern.test(emailAddress);\n };\n //email validation\n if (!isValidEmailAddress($(\"#email\").val())) {\n errorMessage = errorMessage + $(\"#backinstock-subscribe-form\").data('form-notifyme');\n };\n $(\"#error\").html(errorMessage);\n //submit form\n if(errorMessage==\"\") {\n backInStockSubscribe();\n }\n //alert user to errors, form doesn't get submitted\n else {\n $(\"#error\").html(errorMessage);\n }\n });\n },\n\n updateAttributesAndDetails: function () {\n $('body').on('product:statusUpdate', function (e, data) {\n var $productContainer = $('.product-detail[data-pid=\"' + data.id + '\"]');\n\n $productContainer.find('.description-and-detail .product-attributes')\n .empty()\n .html(data.attributesHtml);\n\n if (data.shortDescription) {\n $productContainer.find('.description-and-detail .description')\n .removeClass('hidden-xl-down');\n $productContainer.find('.description-and-detail .description .content .content-description')\n .empty()\n .html(data.shortDescription);\n } else {\n $productContainer.find('.description-and-detail .description')\n .addClass('hidden-xl-down');\n }\n\n if (data.longDescription) {\n $productContainer.find('.description-and-detail .details')\n .removeClass('hidden-xl-down');\n $productContainer.find('.description-and-detail .details .content')\n .empty()\n .html(data.longDescription);\n } else {\n $productContainer.find('.description-and-detail .details')\n .addClass('hidden-xl-down');\n }\n });\n },\n\n showSpinner: function () {\n $('body').on('product:beforeAddToCart product:beforeAttributeSelect', function () {\n $.spinner().start();\n });\n },\n updateAttribute: function () {\n $('body').on('product:afterAttributeSelect', function (e, response) {\n if ($('.product-detail>.bundle-items').length) {\n response.container.data('pid', response.data.product.id);\n response.container.find('.product-id').text(response.data.product.id);\n } else if ($('.product-set-detail').eq(0)) {\n response.container.data('pid', response.data.product.id);\n response.container.find('.product-id').text(response.data.product.id);\n } else {\n $('.product-id').text(response.data.product.id);\n $('.product-detail:not(\".bundle-item\")').data('pid', response.data.product.id);\n }\n SizeSelected();\n\n $('.availability-msg-limited-stock').empty().removeClass('mao-exist');\n var maoMessage = $('.availability-msg-limited-stock');\n if (maoMessage.length > 0) {\n maoMessage.each(function() {\n if ($(this).text().trim() === \"\") {\n $('.availability-msg').removeClass('d-none');\n $('.availability-msg-limited-stock').removeClass('mao-exist');\n } else {\n $('.availability-msg').addClass('d-none');\n $('.availability-msg-limited-stock').addClass('mao-exist availability-msg-red');\n }\n });\n }\n });\n\n if ($(\".size-field\").length == 1 && $(\".size-field.selected\").length > 0) {\n $('.availability-text').removeClass('d-none');\n $('.error-message-store').addClass('d-none');\n $('.in-stock-indicator').removeClass('d-none');\n }else{\n $('.availability-text').addClass('d-none');\n $('.error-message-store').removeClass('d-none');\n $('.in-stock-indicator').addClass('d-none');\n }\n SizeSelected();\n $(document).on(\"click\",\".size-field\", function(event){\n $('.select-size').val($(this).data(\"attr-value\")).trigger('change');\n $(\".size-field\").removeClass(\"selected\");\n $(this).addClass(\"selected\");\n });\n\n var colorSwatch= $('.swatch-circle');\n colorSwatch.each(function(){\n var self = $(this),\n colorValue= self.data(\"attr-value\"),\n strColor = colorValue.substring(0, 3);\n\n if (strColor === \"WHI\") {\n self.addClass('swatch-white');\n }\n });\n },\n updateAddToCart: function () {\n $('body').on('product:updateAddToCart', function (e, response) {\n // update local add to cart (for sets)\n var displaybutton = ((!response.product.readyToOrder || !response.product.available) && $('button.add-to-cart').data('backinstock'));\n\n if(displaybutton){\n $('button.add-to-cart').addClass('d-none');\n $('.js-backInstock').removeClass('d-none');\n $('#ereservation_pickup,.js-backInstock').addClass('full-width');\n }else{\n $('button.add-to-cart', response.$productContainer).attr('disabled',\n (!response.product.readyToOrder || !response.product.available) );\n $('.js-backInstock').addClass('d-none');\n $('button.add-to-cart').removeClass('d-none');\n $('#ereservation_pickup,.js-backInstock').removeClass('full-width');\n }\n\n var wdithofwindow = $(window).width();\n\n if(wdithofwindow <= 544) {\n $('.btn-mobile-pay').insertAfter('.js-backInstock');\n } else {\n $('.btn-mobile-pay').insertBefore('js-backInstock');\n }\n\n $('button.add-to-cart', response.$productContainer).attr('disabled',\n (!response.product.readyToOrder || !response.product.available));\n\n var enable = $('.product-availability').toArray().every(function (item) {\n return $(item).data('available') && $(item).data('ready-to-order');\n });\n module.exports.methods.updateAddToCartEnableDisableOtherElements(!enable);\n });\n },\n updateAvailability: function () {\n $('body').on('product:updateAvailability', function (e, response) {\n $('div.availability', response.$productContainer)\n .data('ready-to-order', response.product.readyToOrder)\n .data('available', response.product.available);\n $('.availability-msg', response.$productContainer)\n .empty().html(response.message);\n if ($('.global-availability').length) {\n var allAvailable = $('.product-availability').toArray()\n .every(function (item) {\n return $(item).data('available');\n });\n\n var allReady = $('.product-availability').toArray()\n .every(function (item) {\n return $(item).data('ready-to-order');\n });\n\n $('.global-availability')\n .data('ready-to-order', allReady)\n .data('available', allAvailable);\n\n $('.global-availability .availability-msg').empty()\n .html(allReady ? response.message : response.resources.info_selectforstock);\n\n }\n });\n },\n sizeChart: function () {\n $('.size-chart a').on('click', function (e) {\n e.preventDefault();\n var url = $(this).attr('href');\n var $prodSizeChart = $(this).closest('.size-chart').find('.size-chart-collapsible');\n if ($prodSizeChart.is(':empty')) {\n $.ajax({\n url: url,\n type: 'get',\n dataType: 'json',\n success: function (data) {\n $prodSizeChart.append(data.content);\n }\n });\n }\n $prodSizeChart.toggleClass('active');\n });\n\n var $sizeChart = $('.size-chart-collapsible');\n $('body').on('click touchstart', function (e) {\n if ($('.size-chart').has(e.target).length <= 0) {\n $sizeChart.removeClass('active');\n }\n });\n },\n copyProductLink: function () {\n $('body').on('click', '#fa-link', function () {\n event.preventDefault();\n var $temp = $('');\n $('body').append($temp);\n $temp.val($('#shareUrl').val()).select();\n document.execCommand('copy');\n $temp.remove();\n $('.copy-link-message').attr('role', 'alert');\n $('.copy-link-message').removeClass('d-none');\n setTimeout(function () {\n $('.copy-link-message').addClass('d-none');\n }, 3000);\n });\n },\n\n\n\n focusChooseBonusProductModal: base.focusChooseBonusProductModal()\n\n};\n\n function SkpwidthImage() {\n var window_Width= $(window).width(),\n PDP_width =(1/2 *(window_Width));\n\n if ( window_Width > 840 ) {\n var PDP_Height = (PDP_width* 1.24);\n $('.product-detail .primary-images .img-fluid,.primary-images,.primary-images iframe').css('height',PDP_Height);\n }else{\n var PDP_width =(1 *(window_Width)),\n PDP_Height = (PDP_width* 1.24);\n $('.product-detail .primary-images .img-fluid,.primary-images,.primary-images iframe').css('height',PDP_Height);\n\n }\n }\n SkpwidthImage();\n\n $(window).on('load resize', function () {\n SkpwidthImage();\n });\n $('#lightgallery li.skp-pdp-iframe').css({'position': 'relative','z-index': '-1'});\n\n function PLPHeightImage() {\n var window_Width = $(window).width(),\n PLP_width = (1/3 * window_Width),\n PLP_width_New = (1/2 * window_Width);\n \n if (window_Width > 840) {\n var PLP_Height = (PLP_width * 1.24);\n $('.skp-product-tile .product-tile .image-container, .product-tile .skp-fullscreen-vimeo,.skp-product-tile .product-tile .slide-box,.skp-product-tile .product-tile .slick-list').css('height', PLP_Height);\n \n var PLP_Height_New_Grid_Desktop = (PLP_width_New * 1.24);\n $('.newGrid > :nth-child(22n + 7) .image-container, .newGrid > :nth-child(22n + 8) .image-container, .newGrid > :nth-child(22n + 21) .image-container, .newGrid > :nth-child(22n + 22) .image-container,.newGrid > :nth-child(22n + 7) .slick-list, .newGrid > :nth-child(22n + 8) .slick-list, .newGrid > :nth-child(22n + 21) .slick-list, .newGrid > :nth-child(22n + 22) .slick-list,.newGrid > :nth-child(22n + 7) .slide-box, .newGrid > :nth-child(22n + 8) .slide-box, .newGrid > :nth-child(22n + 21) .slide-box, .newGrid > :nth-child(22n + 22) .slide-box').each(function() {\n $(this).css({\n 'height': PLP_Height_New_Grid_Desktop + 'px'\n });\n });\n } else {\n var PLP_width = (1/2 * window_Width),\n PLP_Height = (PLP_width * 1.24);\n $('.skp-product-tile .product-tile .image-container, .product-tile .skp-fullscreen-vimeo,.skp-product-tile .product-tile .slide-box,.skp-product-tile .product-tile .slick-list').css('height', PLP_Height);\n \n var PLP_Height_New_Grid_Mobile = (window_Width * 1.24);\n $('.newGrid > :nth-child(22n + 7) .image-container, .newGrid > :nth-child(22n + 8) .image-container, .newGrid > :nth-child(22n + 21) .image-container, .newGrid > :nth-child(22n + 22) .image-container,.newGrid > :nth-child(22n + 7) .slick-list, .newGrid > :nth-child(22n + 8) .slick-list, .newGrid > :nth-child(22n + 21) .slick-list, .newGrid > :nth-child(22n + 22) .slick-list,.newGrid > :nth-child(22n + 7) .slide-box, .newGrid > :nth-child(22n + 8) .slide-box, .newGrid > :nth-child(22n + 21) .slide-box, .newGrid > :nth-child(22n + 22) .slide-box').each(function() {\n $(this).css({\n 'height': PLP_Height_New_Grid_Mobile + 'px'\n });\n });\n \n }\n }\n \n $(document).ready(function () {\n PLPHeightImage();\n });\n \n $(window).on('load resize scroll', function () {\n PLPHeightImage();\n });\n\n // Validate email \n var emailInput;\n function validateEmail(email) {\n var pattern = /^([\\w-\\.]+)@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.)|(([\\w-]+\\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\\]?)$/;\n \n return $.trim(email).match(pattern) ? true : false;\n }\n $(\"#email\").on(\"keyup\", function() {\n emailInput = $(this).val();\n \n if (validateEmail(emailInput)) {\n $('.skp-error-msg').hide();\n } else {\n $('.skp-error-msg').show();\n }\n });\n\n$('.skp-materiels').children().last().css('padding-bottom','20px');\n$('.skp-lavage').children().last().css('padding-bottom','20px');\n\n/**\n * send GTM event view_item_list base on gtm attributes \n * @param {*} slider \n */ \nfunction pushGtmList(slider) {\n var items = [];\n let listName = $(slider).data(\"gtmList\");\n $(slider).find(\".product-tile\").each(function (i, v) {\n let itemGtmData = $(this).data(\"gtm\");\n itemGtmData.item_list_name = listName;\n items.push(itemGtmData);\n });\n var listView = {\n event: \"view_item_list\",\n ecommerce: {\n items: items\n }\n }\n dlWaitThenPush(listView)\n}\n$(document).ready(function () {\n var sliders = $(\".slider-recommendations\");\n sliders.each(function (i, slider) {\n pushGtmList(slider);\n });\n});\n\n// Function to handle DOM mutations\nfunction handleMutations(mutationsList, observer) {\n mutationsList.forEach((mutation) => {\n if (mutation.type === 'childList') {\n mutation.addedNodes.forEach((addedNode) => {\n if ($(addedNode).is(\"div.recommendations\")) {\n var items = [];\n let listName = $(addedNode).is(\"div.recommendations.container\") ? \"Upsell - Product Page\" : \"Last products - Product Page\";\n $(addedNode).find(\".product-tile\").each(function (i, v) {\n let itemGtmData = $(this).data(\"gtm\");\n itemGtmData.item_list_name = listName;\n items.push(itemGtmData);\n });\n var einsteinListView = {\n event: \"view_item_list\",\n ecommerce: {\n items: items\n }\n };\n dlWaitThenPush(einsteinListView);\n }\n });\n }\n });\n}\n\nconst targetNode = document.body;\n\nconst observer = new MutationObserver(handleMutations);\n\nconst config = { childList: true, subtree: true };\n\nobserver.observe(targetNode, config);\n\n\nfunction deplace() {\n var wdithofwindow = $(window).width();\n if(wdithofwindow <= 840){\n $('.pp-message,.payment-button').insertAfter('#store_pickup');\n } else {\n $('.pp-message,.payment-button').insertBefore('#store_pickup');\n }\n if(wdithofwindow <= 840){\n $('#ereservation_pickup').insertBefore('.cart-and-ipay .btn-mobile-pay .btn');\n } else {\n $('.pp-message,.payment-button').insertAfter('#ereservation_pickup');\n }\n}\ndeplace();\n\n$('body').on('click', '.scrollSize', function () {\n var $element = $('.skp-product-detials');\n var headerHeight = $('header').innerHeight();\n $('html, body').animate({\n scrollTop: $element.offset().top - headerHeight\n }, 1000); \n});\n\nwindow.onload = function () {\n if ($(\".payment-button\").height() > 0) {\n $(\".pp-message\").removeClass(\"d-block\");\n } else {\n $(\".pp-message\").addClass(\"d-block\").removeClass(\"d-none\");\n }\n};\n\nif (!$('.js-backInstock').hasClass('d-none')) {\n $('#ereservation_pickup').addClass('full-width'); \n $('.js-backInstock').addClass('full-width'); \n}\n\n$('body').on('click', '.overlay-btn-backInstock', function (e) { \n if ($(\".size-field.selected\").length == 0) {\n $('.skp-selcet-size').addClass('show-select-size');\n } else {\n $('.skp-selcet-size').removeClass('show-select-size');\n }\n});\n\n\nconst checkKleepButton = setInterval(function() {\n const kleepButton = $('.kleep-button');\n const kleepBlock = $('.block-kleep');\n const kleepContent = $('.kleep-content');\n \n if (kleepButton.length > 0 && kleepContent.length > 0) {\n\n kleepContent.append(kleepBlock);\n kleepBlock.removeClass('d-none');\n\n clearInterval(checkKleepButton);\n\n const kleepDefault = kleepContent.find('.kleep-default');\n\n const kleepText = kleepContent.attr('data-text-kleep');\n\n kleepDefault.empty();\n\n kleepDefault.append(`${kleepText}`);\n }\n}, 100);\n\n\nif ($('.e-reservation').length && $('.btn-backInstock.full-width').length < 1) {\n $('.btn-mobile-pay').addClass('E-resa-mobile');\n}","var selectStore = $('#store_selector');\nvar mapKey = \"AIzaSyARzS-TAaoD0bFE-D86lKJfim5msHg7Gfg\";\nvar clientId = selectStore.data('client-id');\nvar locale = selectStore.data('locale');\n\n\nstockStore = {\n init: function () {\n // Setup octipas library\n octipas.setup(clientId, locale);\n\n $('body').on('product:afterAttributeSelect',function(event,response) {\n selectStore.data('product-id', response.data.product.id);\n stockStore.loadStock();\n });\n\n // When clicking on the store selector button -> open the store selector iframe\n document.getElementById(\"store_selector\").onclick = function () {\n if ($(\".size-field.selected\").length > 0) { \n $('.store-stock p').removeClass('show-message-stockStore');\n octipas.chooseDefaultStore(selectStore.data('product-id'), mapKey).then(function (store) {\n // If a store has been selected -> load the stocks\n if (store) {\n stockStore.loadStock(store);\n }\n });\n } else {\n $('.store-stock p').addClass('show-message-stockStore');\n }\n };\n\n // When clicking on the store name -> open the store selector iframe\n\n document.getElementById(\"change_store\").onclick = function () {\n\n if ($(\".size-field.selected\").length > 0) {\n $('.error-message-store').addClass('d-none');\n $('.error-message-store').removeClass('red-message');\n octipas.chooseDefaultStore(selectStore.data('product-id'), mapKey).then(function (store) {\n // If a store has been selected -> load the stocks\n if (store) {\n stockStore.loadStock(store);\n }\n });\n } else {\n $('.error-message-store').removeClass('d-none');\n $('.error-message-store').addClass('red-message');\n }\n };\n stockStore.loadStock();\n },\n loadStock: function (storeParam) {\n // Colors and label for stock level\n const colors = {\n\n \"in_stock\": \"#000\",\n \"limited_stock\": \"#FFA500\",\n \"out_of_stock\": \"#DA3939\",\n\n }\n const labels = {\n \"in_stock\": selectStore.data('in-stock'),\n \"limited_stock\": selectStore.data('limited-stock'),\n \"out_of_stock\": selectStore.data('out-of-stock'),\n }\n const store = storeParam || octipas.getDefaultStore();\n if (!store) {\n // Display the store selector button\n document.getElementById(\"store-stock-container\").style.display = \"flex\";\n } else {\n if ($(\".size-field.selected\").length == 0) {\n document.getElementById(\"store_name\").textContent = store.name;\n document.getElementById(\"store_name\").style.display = \"inline\";\n document.getElementById(\"store-info\").style.display = \"flex\";\n }else{\n // Get the stock\n octipas.getProductStock(selectStore.data('product-id'), store.external_id).then(function (stock) {\n // Show stock and store\n document.getElementById(\"store-stock-container\").style.display = \"none\";\n document.getElementById(\"error-message-store\").style.display = \"none\";\n document.getElementById(\"store_name\").textContent = store.name;\n document.getElementById(\"store_name\").style.display = \"inline\";\n document.getElementById(\"store-info\").style.display = \"flex\";\n document.getElementById(\"in_stock_indicator\").textContent = labels[stock.stock_level]\n document.getElementById(\"in_stock_indicator\").style.color = colors[stock.stock_level]\n });\n }\n }\n\n }\n}\n\nmodule.exports = stockStore;\n","'use strict';\n\nvar processInclude = require('base/util');\n\n$(document).ready(function () {\n processInclude(require('./product/detail'));\n});\n","'use strict';\nmodule.exports = {\n updateQuantity: function () {\n var count = parseInt($('.minicart .minicart-quantity').text(), 10);\n var valueQuantity = $('.minicart-total.hide-link-med .minicart-quantity');\n\n if (count !== 0) {\n valueQuantity.removeClass('skp-no-product');\n } else {\n valueQuantity.addClass('skp-no-product');\n }\n }\n};","/**\n* Panzoom for panning and zooming elements using CSS transforms\n* Copyright Timmy Willison and other contributors\n* https://github.com/timmywil/panzoom/blob/main/MIT-License.txt\n*/\n(function (global, factory) {\n typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :\n typeof define === 'function' && define.amd ? define(factory) :\n (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Panzoom = factory());\n})(this, (function () { 'use strict';\n\n /*! *****************************************************************************\r\n Copyright (c) Microsoft Corporation.\r\n\r\n Permission to use, copy, modify, and/or distribute this software for any\r\n purpose with or without fee is hereby granted.\r\n\r\n THE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\n REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\n AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\n INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\n LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\n OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\n PERFORMANCE OF THIS SOFTWARE.\r\n ***************************************************************************** */\r\n\r\n var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n };\r\n return __assign.apply(this, arguments);\r\n };\n\n /* eslint-disable no-var */\n if (typeof window !== 'undefined') {\n // Support: IE11 only\n if (window.NodeList && !NodeList.prototype.forEach) {\n NodeList.prototype.forEach = Array.prototype.forEach;\n }\n // Support: IE11 only\n // CustomEvent is an object instead of a constructor\n if (typeof window.CustomEvent !== 'function') {\n window.CustomEvent = function CustomEvent(event, params) {\n params = params || { bubbles: false, cancelable: false, detail: null };\n var evt = document.createEvent('CustomEvent');\n evt.initCustomEvent(event, params.bubbles, params.cancelable, params.detail);\n return evt\n };\n }\n }\n\n /**\r\n * Utilites for working with multiple pointer events\r\n */\r\n function findEventIndex(pointers, event) {\r\n var i = pointers.length;\r\n while (i--) {\r\n if (pointers[i].pointerId === event.pointerId) {\r\n return i;\r\n }\r\n }\r\n return -1;\r\n }\r\n function addPointer(pointers, event) {\r\n var i;\r\n // Add touches if applicable\r\n if (event.touches) {\r\n i = 0;\r\n for (var _i = 0, _a = event.touches; _i < _a.length; _i++) {\r\n var touch = _a[_i];\r\n touch.pointerId = i++;\r\n addPointer(pointers, touch);\r\n }\r\n return;\r\n }\r\n i = findEventIndex(pointers, event);\r\n // Update if already present\r\n if (i > -1) {\r\n pointers.splice(i, 1);\r\n }\r\n pointers.push(event);\r\n }\r\n function removePointer(pointers, event) {\r\n // Add touches if applicable\r\n if (event.touches) {\r\n // Remove all touches\r\n while (pointers.length) {\r\n pointers.pop();\r\n }\r\n return;\r\n }\r\n var i = findEventIndex(pointers, event);\r\n if (i > -1) {\r\n pointers.splice(i, 1);\r\n }\r\n }\r\n /**\r\n * Calculates a center point between\r\n * the given pointer events, for panning\r\n * with multiple pointers.\r\n */\r\n function getMiddle(pointers) {\r\n // Copy to avoid changing by reference\r\n pointers = pointers.slice(0);\r\n var event1 = pointers.pop();\r\n var event2;\r\n while ((event2 = pointers.pop())) {\r\n event1 = {\r\n clientX: (event2.clientX - event1.clientX) / 2 + event1.clientX,\r\n clientY: (event2.clientY - event1.clientY) / 2 + event1.clientY\r\n };\r\n }\r\n return event1;\r\n }\r\n /**\r\n * Calculates the distance between two points\r\n * for pinch zooming.\r\n * Limits to the first 2\r\n */\r\n function getDistance(pointers) {\r\n if (pointers.length < 2) {\r\n return 0;\r\n }\r\n var event1 = pointers[0];\r\n var event2 = pointers[1];\r\n return Math.sqrt(Math.pow(Math.abs(event2.clientX - event1.clientX), 2) +\r\n Math.pow(Math.abs(event2.clientY - event1.clientY), 2));\r\n }\n\n var events = {\r\n down: 'mousedown',\r\n move: 'mousemove',\r\n up: 'mouseup mouseleave'\r\n };\r\n if (typeof window !== 'undefined') {\r\n if (typeof window.PointerEvent === 'function') {\r\n events = {\r\n down: 'pointerdown',\r\n move: 'pointermove',\r\n up: 'pointerup pointerleave pointercancel'\r\n };\r\n }\r\n else if (typeof window.TouchEvent === 'function') {\r\n events = {\r\n down: 'touchstart',\r\n move: 'touchmove',\r\n up: 'touchend touchcancel'\r\n };\r\n }\r\n }\r\n function onPointer(event, elem, handler, eventOpts) {\r\n events[event].split(' ').forEach(function (name) {\r\n elem.addEventListener(name, handler, eventOpts);\r\n });\r\n }\r\n function destroyPointer(event, elem, handler) {\r\n events[event].split(' ').forEach(function (name) {\r\n elem.removeEventListener(name, handler);\r\n });\r\n }\n\n var isIE = typeof document !== 'undefined' && !!document.documentMode;\r\n /**\r\n * Lazy creation of a CSS style declaration\r\n */\r\n var divStyle;\r\n function createStyle() {\r\n if (divStyle) {\r\n return divStyle;\r\n }\r\n return (divStyle = document.createElement('div').style);\r\n }\r\n /**\r\n * Proper prefixing for cross-browser compatibility\r\n */\r\n var prefixes = ['webkit', 'moz', 'ms'];\r\n var prefixCache = {};\r\n function getPrefixedName(name) {\r\n if (prefixCache[name]) {\r\n return prefixCache[name];\r\n }\r\n var divStyle = createStyle();\r\n if (name in divStyle) {\r\n return (prefixCache[name] = name);\r\n }\r\n var capName = name[0].toUpperCase() + name.slice(1);\r\n var i = prefixes.length;\r\n while (i--) {\r\n var prefixedName = \"\" + prefixes[i] + capName;\r\n if (prefixedName in divStyle) {\r\n return (prefixCache[name] = prefixedName);\r\n }\r\n }\r\n }\r\n /**\r\n * Gets a style value expected to be a number\r\n */\r\n function getCSSNum(name, style) {\r\n return parseFloat(style[getPrefixedName(name)]) || 0;\r\n }\r\n function getBoxStyle(elem, name, style) {\r\n if (style === void 0) { style = window.getComputedStyle(elem); }\r\n // Support: FF 68+\r\n // Firefox requires specificity for border\r\n var suffix = name === 'border' ? 'Width' : '';\r\n return {\r\n left: getCSSNum(name + \"Left\" + suffix, style),\r\n right: getCSSNum(name + \"Right\" + suffix, style),\r\n top: getCSSNum(name + \"Top\" + suffix, style),\r\n bottom: getCSSNum(name + \"Bottom\" + suffix, style)\r\n };\r\n }\r\n /**\r\n * Set a style using the properly prefixed name\r\n */\r\n function setStyle(elem, name, value) {\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n elem.style[getPrefixedName(name)] = value;\r\n }\r\n /**\r\n * Constructs the transition from panzoom options\r\n * and takes care of prefixing the transition and transform\r\n */\r\n function setTransition(elem, options) {\r\n var transform = getPrefixedName('transform');\r\n setStyle(elem, 'transition', transform + \" \" + options.duration + \"ms \" + options.easing);\r\n }\r\n /**\r\n * Set the transform using the proper prefix\r\n *\r\n * Override the transform setter.\r\n * This is exposed mostly so the user could\r\n * set other parts of a transform\r\n * aside from scale and translate.\r\n * Default is defined in src/css.ts.\r\n *\r\n * ```js\r\n * // This example always sets a rotation\r\n * // when setting the scale and translation\r\n * const panzoom = Panzoom(elem, {\r\n * setTransform: (elem, { scale, x, y }) => {\r\n * panzoom.setStyle('transform', `rotate(0.5turn) scale(${scale}) translate(${x}px, ${y}px)`)\r\n * }\r\n * })\r\n * ```\r\n */\r\n function setTransform(elem, _a, _options) {\r\n var x = _a.x, y = _a.y, scale = _a.scale, isSVG = _a.isSVG;\r\n setStyle(elem, 'transform', \"scale(\" + scale + \") translate(\" + x + \"px, \" + y + \"px)\");\r\n if (isSVG && isIE) {\r\n var matrixValue = window.getComputedStyle(elem).getPropertyValue('transform');\r\n elem.setAttribute('transform', matrixValue);\r\n }\r\n }\r\n /**\r\n * Dimensions used in containment and focal point zooming\r\n */\r\n function getDimensions(elem) {\r\n var parent = elem.parentNode;\r\n var style = window.getComputedStyle(elem);\r\n var parentStyle = window.getComputedStyle(parent);\r\n var rectElem = elem.getBoundingClientRect();\r\n var rectParent = parent.getBoundingClientRect();\r\n return {\r\n elem: {\r\n style: style,\r\n width: rectElem.width,\r\n height: rectElem.height,\r\n top: rectElem.top,\r\n bottom: rectElem.bottom,\r\n left: rectElem.left,\r\n right: rectElem.right,\r\n margin: getBoxStyle(elem, 'margin', style),\r\n border: getBoxStyle(elem, 'border', style)\r\n },\r\n parent: {\r\n style: parentStyle,\r\n width: rectParent.width,\r\n height: rectParent.height,\r\n top: rectParent.top,\r\n bottom: rectParent.bottom,\r\n left: rectParent.left,\r\n right: rectParent.right,\r\n padding: getBoxStyle(parent, 'padding', parentStyle),\r\n border: getBoxStyle(parent, 'border', parentStyle)\r\n }\r\n };\r\n }\n\n /**\r\n * Determine if an element is attached to the DOM\r\n * Panzoom requires this so events work properly\r\n */\r\n function isAttached(elem) {\r\n var doc = elem.ownerDocument;\r\n var parent = elem.parentNode;\r\n return (doc &&\r\n parent &&\r\n doc.nodeType === 9 &&\r\n parent.nodeType === 1 &&\r\n doc.documentElement.contains(parent));\r\n }\n\n function getClass(elem) {\r\n return (elem.getAttribute('class') || '').trim();\r\n }\r\n function hasClass(elem, className) {\r\n return elem.nodeType === 1 && (\" \" + getClass(elem) + \" \").indexOf(\" \" + className + \" \") > -1;\r\n }\r\n function isExcluded(elem, options) {\r\n for (var cur = elem; cur != null; cur = cur.parentNode) {\r\n if (hasClass(cur, options.excludeClass) || options.exclude.indexOf(cur) > -1) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n }\n\n /**\r\n * Determine if an element is SVG by checking the namespace\r\n * Exception: the element itself should be treated like HTML\r\n */\r\n var rsvg = /^http:[\\w\\.\\/]+svg$/;\r\n function isSVGElement(elem) {\r\n return rsvg.test(elem.namespaceURI) && elem.nodeName.toLowerCase() !== 'svg';\r\n }\n\n function shallowClone(obj) {\r\n var clone = {};\r\n for (var key in obj) {\r\n if (obj.hasOwnProperty(key)) {\r\n clone[key] = obj[key];\r\n }\r\n }\r\n return clone;\r\n }\n\n var defaultOptions = {\r\n animate: false,\r\n canvas: false,\r\n cursor: 'move',\r\n disablePan: false,\r\n disableZoom: false,\r\n disableXAxis: false,\r\n disableYAxis: false,\r\n duration: 200,\r\n easing: 'ease-in-out',\r\n exclude: [],\r\n excludeClass: 'panzoom-exclude',\r\n handleStartEvent: function (e) {\r\n e.preventDefault();\r\n e.stopPropagation();\r\n },\r\n maxScale: 4,\r\n minScale: 0.125,\r\n overflow: 'hidden',\r\n panOnlyWhenZoomed: false,\r\n relative: false,\r\n setTransform: setTransform,\r\n startX: 0,\r\n startY: 0,\r\n startScale: 1,\r\n step: 0.3,\r\n touchAction: 'none'\r\n };\r\n function Panzoom(elem, options) {\r\n if (!elem) {\r\n throw new Error('Panzoom requires an element as an argument');\r\n }\r\n if (elem.nodeType !== 1) {\r\n throw new Error('Panzoom requires an element with a nodeType of 1');\r\n }\r\n if (!isAttached(elem)) {\r\n throw new Error('Panzoom should be called on elements that have been attached to the DOM');\r\n }\r\n options = __assign(__assign({}, defaultOptions), options);\r\n var isSVG = isSVGElement(elem);\r\n var parent = elem.parentNode;\r\n // Set parent styles\r\n parent.style.overflow = options.overflow;\r\n parent.style.userSelect = 'none';\r\n // This is important for mobile to\r\n // prevent scrolling while panning\r\n parent.style.touchAction = options.touchAction;\r\n (options.canvas ? parent : elem).style.cursor = options.cursor;\r\n // Set element styles\r\n elem.style.userSelect = 'none';\r\n elem.style.touchAction = options.touchAction;\r\n // The default for HTML is '50% 50%'\r\n // The default for SVG is '0 0'\r\n // SVG can't be changed in IE\r\n setStyle(elem, 'transformOrigin', typeof options.origin === 'string' ? options.origin : isSVG ? '0 0' : '50% 50%');\r\n function resetStyle() {\r\n parent.style.overflow = '';\r\n parent.style.userSelect = '';\r\n parent.style.touchAction = '';\r\n parent.style.cursor = '';\r\n elem.style.cursor = '';\r\n elem.style.userSelect = '';\r\n elem.style.touchAction = '';\r\n setStyle(elem, 'transformOrigin', '');\r\n }\r\n function setOptions(opts) {\r\n if (opts === void 0) { opts = {}; }\r\n for (var key in opts) {\r\n if (opts.hasOwnProperty(key)) {\r\n options[key] = opts[key];\r\n }\r\n }\r\n // Handle option side-effects\r\n if (opts.hasOwnProperty('cursor') || opts.hasOwnProperty('canvas')) {\r\n parent.style.cursor = elem.style.cursor = '';\r\n (options.canvas ? parent : elem).style.cursor = options.cursor;\r\n }\r\n if (opts.hasOwnProperty('overflow')) {\r\n parent.style.overflow = opts.overflow;\r\n }\r\n if (opts.hasOwnProperty('touchAction')) {\r\n parent.style.touchAction = opts.touchAction;\r\n elem.style.touchAction = opts.touchAction;\r\n }\r\n }\r\n var x = 0;\r\n var y = 0;\r\n var scale = 1;\r\n var isPanning = false;\r\n zoom(options.startScale, { animate: false, force: true });\r\n // Wait for scale to update\r\n // for accurate dimensions\r\n // to constrain initial values\r\n setTimeout(function () {\r\n pan(options.startX, options.startY, { animate: false, force: true });\r\n });\r\n function trigger(eventName, detail, opts) {\r\n if (opts.silent) {\r\n return;\r\n }\r\n var event = new CustomEvent(eventName, { detail: detail });\r\n elem.dispatchEvent(event);\r\n }\r\n function setTransformWithEvent(eventName, opts, originalEvent) {\r\n var value = { x: x, y: y, scale: scale, isSVG: isSVG, originalEvent: originalEvent };\r\n requestAnimationFrame(function () {\r\n if (typeof opts.animate === 'boolean') {\r\n if (opts.animate) {\r\n setTransition(elem, opts);\r\n }\r\n else {\r\n setStyle(elem, 'transition', 'none');\r\n }\r\n }\r\n opts.setTransform(elem, value, opts);\r\n trigger(eventName, value, opts);\r\n trigger('panzoomchange', value, opts);\r\n });\r\n return value;\r\n }\r\n function constrainXY(toX, toY, toScale, panOptions) {\r\n var opts = __assign(__assign({}, options), panOptions);\r\n var result = { x: x, y: y, opts: opts };\r\n if (!opts.force && (opts.disablePan || (opts.panOnlyWhenZoomed && scale === opts.startScale))) {\r\n return result;\r\n }\r\n toX = parseFloat(toX);\r\n toY = parseFloat(toY);\r\n if (!opts.disableXAxis) {\r\n result.x = (opts.relative ? x : 0) + toX;\r\n }\r\n if (!opts.disableYAxis) {\r\n result.y = (opts.relative ? y : 0) + toY;\r\n }\r\n if (opts.contain) {\r\n var dims = getDimensions(elem);\r\n var realWidth = dims.elem.width / scale;\r\n var realHeight = dims.elem.height / scale;\r\n var scaledWidth = realWidth * toScale;\r\n var scaledHeight = realHeight * toScale;\r\n var diffHorizontal = (scaledWidth - realWidth) / 2;\r\n var diffVertical = (scaledHeight - realHeight) / 2;\r\n if (opts.contain === 'inside') {\r\n var minX = (-dims.elem.margin.left - dims.parent.padding.left + diffHorizontal) / toScale;\r\n var maxX = (dims.parent.width -\r\n scaledWidth -\r\n dims.parent.padding.left -\r\n dims.elem.margin.left -\r\n dims.parent.border.left -\r\n dims.parent.border.right +\r\n diffHorizontal) /\r\n toScale;\r\n result.x = Math.max(Math.min(result.x, maxX), minX);\r\n var minY = (-dims.elem.margin.top - dims.parent.padding.top + diffVertical) / toScale;\r\n var maxY = (dims.parent.height -\r\n scaledHeight -\r\n dims.parent.padding.top -\r\n dims.elem.margin.top -\r\n dims.parent.border.top -\r\n dims.parent.border.bottom +\r\n diffVertical) /\r\n toScale;\r\n result.y = Math.max(Math.min(result.y, maxY), minY);\r\n }\r\n else if (opts.contain === 'outside') {\r\n var minX = (-(scaledWidth - dims.parent.width) -\r\n dims.parent.padding.left -\r\n dims.parent.border.left -\r\n dims.parent.border.right +\r\n diffHorizontal) /\r\n toScale;\r\n var maxX = (diffHorizontal - dims.parent.padding.left) / toScale;\r\n result.x = Math.max(Math.min(result.x, maxX), minX);\r\n var minY = (-(scaledHeight - dims.parent.height) -\r\n dims.parent.padding.top -\r\n dims.parent.border.top -\r\n dims.parent.border.bottom +\r\n diffVertical) /\r\n toScale;\r\n var maxY = (diffVertical - dims.parent.padding.top) / toScale;\r\n result.y = Math.max(Math.min(result.y, maxY), minY);\r\n }\r\n }\r\n if (opts.roundPixels) {\r\n result.x = Math.round(result.x);\r\n result.y = Math.round(result.y);\r\n }\r\n return result;\r\n }\r\n function constrainScale(toScale, zoomOptions) {\r\n var opts = __assign(__assign({}, options), zoomOptions);\r\n var result = { scale: scale, opts: opts };\r\n if (!opts.force && opts.disableZoom) {\r\n return result;\r\n }\r\n var minScale = options.minScale;\r\n var maxScale = options.maxScale;\r\n if (opts.contain) {\r\n var dims = getDimensions(elem);\r\n var elemWidth = dims.elem.width / scale;\r\n var elemHeight = dims.elem.height / scale;\r\n if (elemWidth > 1 && elemHeight > 1) {\r\n var parentWidth = dims.parent.width - dims.parent.border.left - dims.parent.border.right;\r\n var parentHeight = dims.parent.height - dims.parent.border.top - dims.parent.border.bottom;\r\n var elemScaledWidth = parentWidth / elemWidth;\r\n var elemScaledHeight = parentHeight / elemHeight;\r\n if (options.contain === 'inside') {\r\n maxScale = Math.min(maxScale, elemScaledWidth, elemScaledHeight);\r\n }\r\n else if (options.contain === 'outside') {\r\n minScale = Math.max(minScale, elemScaledWidth, elemScaledHeight);\r\n }\r\n }\r\n }\r\n result.scale = Math.min(Math.max(toScale, minScale), maxScale);\r\n return result;\r\n }\r\n function pan(toX, toY, panOptions, originalEvent) {\r\n var result = constrainXY(toX, toY, scale, panOptions);\r\n // Only try to set if the result is somehow different\r\n if (x !== result.x || y !== result.y) {\r\n x = result.x;\r\n y = result.y;\r\n return setTransformWithEvent('panzoompan', result.opts, originalEvent);\r\n }\r\n return { x: x, y: y, scale: scale, isSVG: isSVG, originalEvent: originalEvent };\r\n }\r\n function zoom(toScale, zoomOptions, originalEvent) {\r\n var result = constrainScale(toScale, zoomOptions);\r\n var opts = result.opts;\r\n if (!opts.force && opts.disableZoom) {\r\n return;\r\n }\r\n toScale = result.scale;\r\n var toX = x;\r\n var toY = y;\r\n if (opts.focal) {\r\n // The difference between the point after the scale and the point before the scale\r\n // plus the current translation after the scale\r\n // neutralized to no scale (as the transform scale will apply to the translation)\r\n var focal = opts.focal;\r\n toX = (focal.x / toScale - focal.x / scale + x * toScale) / toScale;\r\n toY = (focal.y / toScale - focal.y / scale + y * toScale) / toScale;\r\n }\r\n var panResult = constrainXY(toX, toY, toScale, { relative: false, force: true });\r\n x = panResult.x;\r\n y = panResult.y;\r\n scale = toScale;\r\n return setTransformWithEvent('panzoomzoom', opts, originalEvent);\r\n }\r\n function zoomInOut(isIn, zoomOptions) {\r\n var opts = __assign(__assign(__assign({}, options), { animate: true }), zoomOptions);\r\n return zoom(scale * Math.exp((isIn ? 1 : -1) * opts.step), opts);\r\n }\r\n function zoomIn(zoomOptions) {\r\n return zoomInOut(true, zoomOptions);\r\n }\r\n function zoomOut(zoomOptions) {\r\n return zoomInOut(false, zoomOptions);\r\n }\r\n function zoomToPoint(toScale, point, zoomOptions, originalEvent) {\r\n var dims = getDimensions(elem);\r\n // Instead of thinking of operating on the panzoom element,\r\n // think of operating on the area inside the panzoom\r\n // element's parent\r\n // Subtract padding and border\r\n var effectiveArea = {\r\n width: dims.parent.width -\r\n dims.parent.padding.left -\r\n dims.parent.padding.right -\r\n dims.parent.border.left -\r\n dims.parent.border.right,\r\n height: dims.parent.height -\r\n dims.parent.padding.top -\r\n dims.parent.padding.bottom -\r\n dims.parent.border.top -\r\n dims.parent.border.bottom\r\n };\r\n // Adjust the clientX/clientY to ignore the area\r\n // outside the effective area\r\n var clientX = point.clientX -\r\n dims.parent.left -\r\n dims.parent.padding.left -\r\n dims.parent.border.left -\r\n dims.elem.margin.left;\r\n var clientY = point.clientY -\r\n dims.parent.top -\r\n dims.parent.padding.top -\r\n dims.parent.border.top -\r\n dims.elem.margin.top;\r\n // Adjust the clientX/clientY for HTML elements,\r\n // because they have a transform-origin of 50% 50%\r\n if (!isSVG) {\r\n clientX -= dims.elem.width / scale / 2;\r\n clientY -= dims.elem.height / scale / 2;\r\n }\r\n // Convert the mouse point from it's position over the\r\n // effective area before the scale to the position\r\n // over the effective area after the scale.\r\n var focal = {\r\n x: (clientX / effectiveArea.width) * (effectiveArea.width * toScale),\r\n y: (clientY / effectiveArea.height) * (effectiveArea.height * toScale)\r\n };\r\n return zoom(toScale, __assign(__assign({ animate: false }, zoomOptions), { focal: focal }), originalEvent);\r\n }\r\n function zoomWithWheel(event, zoomOptions) {\r\n // Need to prevent the default here\r\n // or it conflicts with regular page scroll\r\n event.preventDefault();\r\n var opts = __assign(__assign(__assign({}, options), zoomOptions), { animate: false });\r\n // Normalize to deltaX in case shift modifier is used on Mac\r\n var delta = event.deltaY === 0 && event.deltaX ? event.deltaX : event.deltaY;\r\n var wheel = delta < 0 ? 1 : -1;\r\n var toScale = constrainScale(scale * Math.exp((wheel * opts.step) / 3), opts).scale;\r\n return zoomToPoint(toScale, event, opts);\r\n }\r\n function reset(resetOptions) {\r\n var opts = __assign(__assign(__assign({}, options), { animate: true, force: true }), resetOptions);\r\n scale = constrainScale(opts.startScale, opts).scale;\r\n var panResult = constrainXY(opts.startX, opts.startY, scale, opts);\r\n x = panResult.x;\r\n y = panResult.y;\r\n return setTransformWithEvent('panzoomreset', opts);\r\n }\r\n var origX;\r\n var origY;\r\n var startClientX;\r\n var startClientY;\r\n var startScale;\r\n var startDistance;\r\n var pointers = [];\r\n function handleDown(event) {\r\n // Don't handle this event if the target is excluded\r\n if (isExcluded(event.target, options)) {\r\n return;\r\n }\r\n addPointer(pointers, event);\r\n isPanning = true;\r\n options.handleStartEvent(event);\r\n origX = x;\r\n origY = y;\r\n trigger('panzoomstart', { x: x, y: y, scale: scale, isSVG: isSVG, originalEvent: event }, options);\r\n // This works whether there are multiple\r\n // pointers or not\r\n var point = getMiddle(pointers);\r\n startClientX = point.clientX;\r\n startClientY = point.clientY;\r\n startScale = scale;\r\n startDistance = getDistance(pointers);\r\n }\r\n function move(event) {\r\n if (!isPanning ||\r\n origX === undefined ||\r\n origY === undefined ||\r\n startClientX === undefined ||\r\n startClientY === undefined) {\r\n return;\r\n }\r\n addPointer(pointers, event);\r\n var current = getMiddle(pointers);\r\n if (pointers.length > 1) {\r\n // A startDistance of 0 means\r\n // that there weren't 2 pointers\r\n // handled on start\r\n if (startDistance === 0) {\r\n startDistance = getDistance(pointers);\r\n }\r\n // Use the distance between the first 2 pointers\r\n // to determine the current scale\r\n var diff = getDistance(pointers) - startDistance;\r\n var toScale = constrainScale((diff * options.step) / 80 + startScale).scale;\r\n zoomToPoint(toScale, current);\r\n }\r\n else {\r\n // Panning during pinch zoom can cause issues\r\n // because the zoom has not always rendered in time\r\n // for accurate calculations\r\n // See https://github.com/timmywil/panzoom/issues/512\r\n pan(origX + (current.clientX - startClientX) / scale, origY + (current.clientY - startClientY) / scale, {\r\n animate: false\r\n }, event);\r\n }\r\n }\r\n function handleUp(event) {\r\n // Don't call panzoomend when panning with 2 touches\r\n // until both touches end\r\n if (pointers.length === 1) {\r\n trigger('panzoomend', { x: x, y: y, scale: scale, isSVG: isSVG, originalEvent: event }, options);\r\n }\r\n // Note: don't remove all pointers\r\n // Can restart without having to reinitiate all of them\r\n // Remove the pointer regardless of the isPanning state\r\n removePointer(pointers, event);\r\n if (!isPanning) {\r\n return;\r\n }\r\n isPanning = false;\r\n origX = origY = startClientX = startClientY = undefined;\r\n }\r\n var bound = false;\r\n function bind() {\r\n if (bound) {\r\n return;\r\n }\r\n bound = true;\r\n onPointer('down', options.canvas ? parent : elem, handleDown);\r\n onPointer('move', document, move, { passive: true });\r\n onPointer('up', document, handleUp, { passive: true });\r\n }\r\n function destroy() {\r\n bound = false;\r\n destroyPointer('down', options.canvas ? parent : elem, handleDown);\r\n destroyPointer('move', document, move);\r\n destroyPointer('up', document, handleUp);\r\n }\r\n if (!options.noBind) {\r\n bind();\r\n }\r\n return {\r\n bind: bind,\r\n destroy: destroy,\r\n eventNames: events,\r\n getPan: function () { return ({ x: x, y: y }); },\r\n getScale: function () { return scale; },\r\n getOptions: function () { return shallowClone(options); },\r\n pan: pan,\r\n reset: reset,\r\n resetStyle: resetStyle,\r\n setOptions: setOptions,\r\n setStyle: function (name, value) { return setStyle(elem, name, value); },\r\n zoom: zoom,\r\n zoomIn: zoomIn,\r\n zoomOut: zoomOut,\r\n zoomToPoint: zoomToPoint,\r\n zoomWithWheel: zoomWithWheel\r\n };\r\n }\r\n Panzoom.defaultOptions = defaultOptions;\n\n return Panzoom;\n\n}));\n"],"sourceRoot":""}